|
-
Oct 24th, 2005, 05:25 PM
#1
Thread Starter
Lively Member
Winsock problems
Hey guys
i am trying to communicate with my server using winsock
i am using the get variable and everything is fine...i guess
the php below is what i am posting to
after populating a Label i find that the returned data is the following
VB Code:
1F
echo $resultaat.'§'.$clickid.'§'.$given.'§'.$returned.'§'.$rank. '';
0
// Note that echo $resultaat is not what gets rendered, but substitute
// The actual values for what is echoed in th escript
in my script under Winsock1_DataArrival
i am parsing the information by the following
VB Code:
Winsock1.GetData a
b = Split(Mid(a, InStr(1, a, vbCrLf & vbCrLf) + 4), "§")
result.Caption = b(0)
clickid.Caption = b(1)
given.Caption = b(2)
returned.Caption = b(3)
credit.Caption = CInt(given.Caption) - CInt(returned.Caption)
rank.Caption = b(4)
Label10.Caption = a
however, this clearly does not have the intended effect
and i dont see why my script would be rendering
1F
blablabla
0
when i am not even echoing that information
Your support would be appreciated.
PHP Code:
<?php
include('inc_connect.php');
$result=mysql_query("SELECT * FROM recruiter WHERE uname='".$_GET["uname"]."';",$db);
if(mysql_num_rows($result)<1){
die("Username incorrect§00000000§0§0§");
}
$row = mysql_fetch_array($result);
if($row["rank"]=="banned"){
die("You are currently banned§00000000§0§0§");
}
$given=$row["given"];
$returned=$row["returned"];
$credit=$given-$returned;
$clickid=$row["clickid"];
$clickname=$row["clickname"];
$clickrace=$row["clickrace"];
$uid=$row["uid"];
$uname=$row["uname"];
$rank=$row["rank"];
$commando=$_GET["c"];
$resultaat="Next id";
if($clickid<>"noneleft" and $clickid<>"demo_end"){
if($commando=="click"){
mysql_query("UPDATE recruiter SET returned = returned + 1, false_id = 0 WHERE uid = '" . $clickid . "';",$db);
mysql_query("UPDATE recruiter SET given = given + 1 WHERE uid = '" . $uid . "';",$db);
$given++;
$resultaat="Click added";
}elseif($commando=="skip"){
$resultaat="Skipped id";
}elseif($commando=="report"){
mysql_query("UPDATE recruiter SET false_id = false_id + 1 WHERE uid = '".$clickid."';",$db);
$resultaat="False id reported";
}
mysql_query("INSERT INTO clicks SET ip = '".$_SERVER["REMOTE_ADDR"]."', clickid = '" . $clickid . "', clicktime = NOW(), uid = '" . $uid . "';",$db);
}
mysql_query("DELETE FROM clicks WHERE DATE_SUB(NOW(),INTERVAL 24 HOUR) > clicktime;",$db);
$clickedids=array();
$oldclick=$clickid;
$clickid="noneleft";
$result=mysql_query("SELECT clickid FROM clicks WHERE ip = '".$_SERVER["REMOTE_ADDR"]."';",$db);
if($rank=="unregistered" and mysql_num_rows($result)>100){
$clickid="demo_end";
}
while($row = mysql_fetch_array($result)){
$clickedids[]=$row["clickid"];
}
$result2=mysql_query("SELECT uid, uname, race FROM recruiter WHERE given - returned > -10 and false_id < 5 and rank <> 'banned' ORDER BY returned-given;",$db);
while($clickid=="noneleft" and $row2 = mysql_fetch_array($result2)){
if($oldclick<>$row2["uid"] and !in_array($row2["uid"],$clickedids)){
$clickid=$row2["uid"];
$clickname=$row2["uname"];
$clickrace=$row2["race"];
}
}
mysql_query("UPDATE recruiter SET clickid = '".$clickid."', clickname = '".$clickname."', clickrace = '".$clickrace."' WHERE uid='".$uid."';",$db);
echo $resultaat.'§'.$clickid.'§'.$given.'§'.$returned.'§'.$rank. '';
?>
-
Oct 24th, 2005, 10:49 PM
#2
Frenzied Member
Re: Winsock problems
ok, before you do b=split...., do a debug.print or msgbox to a, which is the value you receive. this will tell you what data was retrieved by winsock. u can post the result here and let us have a look.
-
Oct 25th, 2005, 02:18 AM
#3
KING BODWAD XXI
Re: Winsock problems
Ensure you declare A as string. I have seen faults with the winsock caused by it not being declared as string
-
Oct 25th, 2005, 03:52 AM
#4
Thread Starter
Lively Member
Re: Winsock problems
i already told you what data i am receiving
1F
Nextid§8charac§1§0§user'
0
this is what i get back from populating Label10
-
Oct 25th, 2005, 04:08 AM
#5
Frenzied Member
Re: Winsock problems
what is "a" declared as? if it is not a string as bodwad mentioned, it will give problems.
-
Oct 25th, 2005, 12:53 PM
#6
Thread Starter
Lively Member
Re: Winsock problems
Sorry, im bit slow, yes
A is Dim as string.
-
Oct 25th, 2005, 10:40 PM
#7
Frenzied Member
Re: Winsock problems
before u do a split to a, see what it holds. you can do a debug.print to it.
-
Oct 26th, 2005, 07:22 PM
#8
Thread Starter
Lively Member
Re: Winsock problems
i already did.......lol. i also said what it holds......
-
Oct 26th, 2005, 11:13 PM
#9
Frenzied Member
Re: Winsock problems
i did this in my vb
VB Code:
a = "1F"
a = a & vbCrLf & "echo $resultaat.'§'.$clickid.'§'.$given.'§'.$returned.'§'.$rank. '';"
a = a & vbCrLf & "0"
b = Split(Mid(a, InStr(1, a, vbCrLf & vbCrLf) + 4), "§")
For cnt = 1 To UBound(b)
Debug.Print b(cnt)
Next cnt
the return value was
VB Code:
'.$clickid.'
'.$given.'
'.$returned.'
'.$rank. '';
0
-
Oct 28th, 2005, 07:33 AM
#10
Thread Starter
Lively Member
Re: Winsock problems
I am aware of this, and i simply pasted the variables and didnt mean for you to copy them.
1F is not suppose to be there and i dont see why its returning that value in winsock but not when i manually visit the url with a browser.......
-
Oct 29th, 2005, 01:14 AM
#11
Frenzied Member
Re: Winsock problems
if u give me the url, i may be able to retrieve the data and do a split as u intend it to do. is it possible to give me a sample url. if it cant be posted here them maybe u can pm me the url.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|