mIRC Home    About    Download    Register    News    Help

Print Thread
#195904 05/03/08 04:31 PM
Joined: Sep 2007
Posts: 28
M
Miyako Offline OP
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Sep 2007
Posts: 28
Hi! I made a script with a socket, problem: I don't get the complete source.
This is the script:

Code:
on *:SOCKOPEN:imgstat: {
  if ($sock($sockname).mark == 1) {
    if ($sockerr) { .timer 1 0 imgstat 3 | return }
    echo -a $+(/status/status.php?pass=postpass&nick=,$imgstat(1,conf,name),$imgstat(1,conf,ext),&gen=,$imgstat(1,conf,gender),&stat=1)
    sockwrite -n $sockname GET $+(/status/status.php?pass=postpass&nick=,$imgstat(1,conf,name),$imgstat(1,conf,ext),&gen=,$imgstat(1,conf,gender),&stat=1) HTTP/1.1
    sockwrite -n $sockname Host: miyako.gratishosted.nl
    sockwrite -n $sockname Connection: close
    sockwrite -n $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3
    sockwrite -n $sockname Accept: text/xml,text/html,text/plain,image/png,image/jpeg,image/gif
    sockwrite -n $sockname Keep-Alive: 300
    sockwrite -n $sockname $crlf
  }
}

on *:SOCKREAD:imgstat: {
  if ($sock($sockname).mark == 1) {
    if ($sockerr) { .timer 1 0 imgstat 3 | return }
    sockread %imgstat
    echo -a > %imgstat
  }
}


The result of the GET is:
Quote:
/status/status.php?pass=postpass&nick=miyako224&gen=0&stat=1


Normal I should get an error-code or something like that, but the only thing of the source I get is:
Quote:
> HTTP/1.1 200 OK
> Date: Wed, 05 Mar 2008 17:46:19 GMT
> Server: Apache/2
> X-Powered-By: PHP/5.2.5
> Set-Cookie: PHPSESSID=fc5b960b523dfff180bda842ab2b43ac; expires=Wed, 05 Mar 2008 18:46:19 GMT; path=/
> Expires: Thu, 19 Nov 1981 08:52:00 GMT
> Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
> Pragma: no-cache
> Vary: Accept-Encoding,User-Agent
> Content-Length: 62
> Keep-Alive: timeout=1, max=100
> Connection: Keep-Alive
> Content-Type: text/html
>
> <html>
> <title>Status Image</title>
> <body>


While the HTML-code is supposed to be:
Quote:
<html>
<title>Status Image</title>
<body>
1 Done</body></html>

So it looks like I'm missing the output-code, but I don't know why.
The PHP-page is over here:
http://miyako.gratishosted.nl/status/status.php

If you need the PHP-script:
Code:
<html>
<title>Status Image</title>
<body>
<?php
$nickname = $_GET['nick'];
$gender = $_GET['gen'];
$status = $_GET['stat'];
$pass = $_GET['pass'];
$pass = MD5("$pass");

if ("$pass" != '3638bc9a765aeacd9d331ca6d0771288') {
	print "0 Wrong Pass";
} elseif ($gender != 0 && $gender != 1) {
	print "0 Wrong Gender";
} elseif ($status != 0 && $status != 1) {
	print "0 Wrong Status";
} elseif (!$nickname) {
	print "0 No Nickname";
} else {
	if ($gender == 0 && $status == 1) {
		copy('online2.gif',"$nickname.gif");
	} elseif ($gender == 0 && $status == 0) {
		copy('offline2.gif',"$nickname.gif");
	} elseif ($gender == 1 && $status == 1) {
		copy('online.gif',"$nickname.gif");
	} elseif ($gender == 1 && $status == 0) {
		copy('offline.gif',"$nickname.gif");
	}
	else {
		print "0 Unknown error";
		return;
	}
	print "1 Done";
}

?>
</body></html>

Miyako #195908 05/03/08 05:58 PM
Joined: Aug 2003
Posts: 144
M
Vogon poet
Offline
Vogon poet
M
Joined: Aug 2003
Posts: 144
Hi

Use only

sockwrite -n $sockname GET /status/status.php HTTP/1.1

And them try to see if you receive all the info.

Good luck

Miguel_A #195910 05/03/08 06:46 PM
Joined: Sep 2007
Posts: 28
M
Miyako Offline OP
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Sep 2007
Posts: 28
Still no difference, I tried almost everything.
Maybe I should get another host :P

Miyako #195913 05/03/08 09:09 PM
Joined: Aug 2003
Posts: 144
M
Vogon poet
Offline
Vogon poet
M
Joined: Aug 2003
Posts: 144
Try with this sockread event
Check if the server send any data tht the mirc canĀ“t read or somthing.

Code:
 
on *:SOCKREAD:imgstat: {
sockread &data
echo -s Total Lengh is $bvar( &data, 0)
echo -s $bvar( &data, 1-).text --> Total Lengh $len( $bvar( &data, 1-).text )
}


good luck

Miguel_A #195914 05/03/08 09:20 PM
Joined: Sep 2007
Posts: 28
M
Miyako Offline OP
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Sep 2007
Posts: 28
I already fixed it, but thanks.
I'm using the Content-Length to "identify" my output. It looks a bit crappy because my output texts need different lengths now, but ok :P

Last edited by Miyako; 05/03/08 09:20 PM.

Link Copied to Clipboard