Results 1 to 11 of 11

Thread: Winsock problems

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2005
    Posts
    65

    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:
    1. 1F
    2. echo $resultaat.'§'.$clickid.'§'.$given.'§'.$returned.'§'.$rank. '';
    3. 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:
    1. Winsock1.GetData a
    2. b = Split(Mid(a, InStr(1, a, vbCrLf & vbCrLf) + 4), "§")
    3. result.Caption = b(0)
    4. clickid.Caption = b(1)
    5. given.Caption = b(2)
    6. returned.Caption = b(3)
    7. credit.Caption = CInt(given.Caption) - CInt(returned.Caption)
    8. rank.Caption = b(4)
    9. 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'';
    ?>

  2. #2
    Frenzied Member
    Join Date
    May 2003
    Location
    Sydney
    Posts
    1,123

    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.

  3. #3
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 2002
    Location
    Nottingham
    Posts
    2,176

    Re: Winsock problems

    Ensure you declare A as string. I have seen faults with the winsock caused by it not being declared as string
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Aug 2005
    Posts
    65

    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

  5. #5
    Frenzied Member
    Join Date
    May 2003
    Location
    Sydney
    Posts
    1,123

    Re: Winsock problems

    what is "a" declared as? if it is not a string as bodwad mentioned, it will give problems.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Aug 2005
    Posts
    65

    Re: Winsock problems

    Sorry, im bit slow, yes
    A is Dim as string.

  7. #7
    Frenzied Member
    Join Date
    May 2003
    Location
    Sydney
    Posts
    1,123

    Re: Winsock problems

    before u do a split to a, see what it holds. you can do a debug.print to it.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Aug 2005
    Posts
    65

    Re: Winsock problems

    i already did.......lol. i also said what it holds......

  9. #9
    Frenzied Member
    Join Date
    May 2003
    Location
    Sydney
    Posts
    1,123

    Re: Winsock problems

    i did this in my vb
    VB Code:
    1. a = "1F"
    2.     a = a & vbCrLf & "echo $resultaat.'§'.$clickid.'§'.$given.'§'.$returned.'§'.$rank. '';"
    3.     a = a & vbCrLf & "0"
    4.     b = Split(Mid(a, InStr(1, a, vbCrLf & vbCrLf) + 4), "§")
    5.  
    6.     For cnt = 1 To UBound(b)
    7.         Debug.Print b(cnt)
    8.     Next cnt

    the return value was
    VB Code:
    1. '.$clickid.'
    2. '.$given.'
    3. '.$returned.'
    4. '.$rank. '';
    5. 0

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Aug 2005
    Posts
    65

    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.......

  11. #11
    Frenzied Member
    Join Date
    May 2003
    Location
    Sydney
    Posts
    1,123

    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
  •  



Click Here to Expand Forum to Full Width