Jump to content

mckooter

Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mckooter's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ive been working on this for a while, and i cannot determine if i am not connecting properly, or if the data im sending is wrong and thats why im not getting a response. The goal is to send data to a gaming server via udp, and recieve a response of server information. mainly i am looking to just see if the game server is running, and it will not respond to a regular tcp ping at its port, but the data it sends back could also be usefull too. here is the code i have so far: <?php $binary_msg = chr(0x00).chr(0x02).chr(0xF1).chr(0x26).chr(0x01).chr(0x26).chr(0xF0).chr(0x90).chr(0xA6).chr(0xF0).chr(0x26).chr(0x57).chr(0x4E).chr(0xAC).chr(0xA0).chr(0xEC).chr(0xF8).chr(0x68).chr(0xE4).chr(0x8D).chr(0x21); $fp = fsockopen("udp://<<ipaddresshere>>",2302,$errno,$errstr); if (!$fp) { echo "ERROR: $errno - $errstr<br />\n"; } else { fwrite($fp, $binary_msg); echo fread($fp, 26); fclose($fp); } ?> the server was not doing anything at this point, through some help i recieved elsewhere i tried this: var_dump(bin2hex(fread($fp, 26))); and the response was different depending on if i ran it as php4 or php5 (i have to put .php5 on the file to force it myself) PHP5: PHP4: so I assume that its working, but im not getting any response from the server, is that right? or am i missing something, and if the code is right, can anyone see why it might not be responding, the data i am sending was gathered from this script that does work (C# i believe): Socket s = new Socket(lep.Address.AddressFamily, SocketType.Dgram, ProtocolType.Udp); byte[] inputToBeSent = new byte[21]; // Create the "special" packet that will return the correct data inputToBeSent[0] = 0x00; inputToBeSent[1] = 0x02; inputToBeSent[2] = 0xF1; inputToBeSent[3] = 0x26; inputToBeSent[4] = 0x01; inputToBeSent[5] = 0x26; inputToBeSent[6] = 0xF0; inputToBeSent[7] = 0x90; inputToBeSent[8] = 0xA6; inputToBeSent[9] = 0xF0; inputToBeSent[10] = 0x26; inputToBeSent[11] = 0x57; inputToBeSent[12] = 0x4E; inputToBeSent[13] = 0xAC; inputToBeSent[14] = 0xA0; inputToBeSent[15] = 0xEC; inputToBeSent[16] = 0xF8; inputToBeSent[17] = 0x68; inputToBeSent[18] = 0xE4; inputToBeSent[19] = 0x8D; inputToBeSent[20] = 0x21; try { DateTime dtStart = DateTime.Now; // Sends datagram to the IpEndPoint specified. This call blocks. s.SendTo(inputToBeSent, 0, inputToBeSent.Length, SocketFlags.None, lep); // Creates an IpEndPoint to capture the identity of the sending host. IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0); EndPoint tempRemoteEP = (EndPoint)sender; // Creates a byte buffer to receive the message. int iAvailable = s.Available; int iSecCount = 0;
  2. sorry, i think im being confusing, what im trying to say is the username is already in a variable before the user even enters the page $userinfo['username'] is the variable that has the username in it (before they even click on the page) they have to be logged into the site to be able to even view the page im talking about therefore i already have their name what im trying to do is search the database to see if their name is already in it, if it is then just display one thing, if not display another
  3. yes, i figured that would be one option, but rather than wait till someone fills out the form to tell them that the username is already taken i want the form to know when its loaded. in subdreamer the username is stored in a global variable $userinfo['username'] what i want to be able to do is something where it can check if the above variable is in the database before even starting and generate a variable that i can run a simple if statement on, the variable would most likely be a 1 or 0,  or it could even be (blank or (the username)) hopefully that helps to what im looking for
  4. okay im working on a script that takes users information and stores it to database, a very simple thing, the problem is it allows users (from subdreamer cms) to sign up multiple times, (this is different than the usersystem built into the cms) what i need to be able to do is search the database (all in one table) for a username if it exsists than display one page and if it doesent display the form. I have a global variable that has the username, and when the person fills out the form it automatically stores it to the database so now i need to scan the database for it, im sure its a simple select query but how do i get php to give me a simple yes or no from a select query? can i select the name and then check to see if the result is !=0 or so, im not sure and cant seem to get it to work, a bit of guidance and ill surely figure it out and apply it, thanks for any help chris
  5. cancell this, i figured it out eventually with help and i think that i just cannot use a mysql server as old as 4.0.24
  6. okay i recently tried a new hosting idea for one of my sites, to increase bandwith, in this they advertised mysql4 which is good cause all my scripts were installed for mysql4, now im importing my sql files and running into syntax errors, so before i made a bunch of stupid posts before checking i looked into it, in this i found a few ways to check mysql versions (via google search) im newer to php and mysql and do only minor work so im not sure if i can trust these scripts word, here they are, first script, (first one i learned in php): [code]<? phpinfo(); ?>[/code] ( http://www.mckooter.com/phpinfo.php ) under mysql in that page: [quote]Client API version 3.23.49[/quote] SECOND SCRIPT: [code]<?php function find_SQL_Version() {   $output = shell_exec('mysql -V');   preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version);   return $version[0]; } echo 'Your SQL version is ' . find_SQL_Version(); ?> [/code] ( http://www.mckooter.com/sql.php ) Result: [quote]Your SQL version is 3.23.58[/quote] emailed support at this time because their help says they run 4.0.24 and from what i could see they werent, response i got: (obviously form letter) [quote]We are currently running the 4.0.24 version of MySQL on all of our shared hosting servers. Please follow these directions to import your sql file.[/quote] Do i just not know what im looking at or is my server not really running mysql4, i dont want to send them an email telling them they are wrong unless i know for a fact they are, i cant see how it couldnt be but as i stated above im newer, thanks for reviewing my long message, i like to include all the data so i dont have to reply again and again because i forgot something stupid, ... Chris
  7. thank you very much, this quick (i must say i am very impressed and happy to see people so glad to help me out) anyway, this quick response showed me that it should work, then after looking i realized if i actually called that variable it might show me the result, (simple stupid mistake) it works now, thanks again, with this info i think i might be able to finish this script once and for all
  8. Okay, i posted this on another forum, then i found this wonderful place (figured web freaks hosted my website so well might as well use their site to help me learn) Note: Im new but I am trying to learn so if im missing something simple sorry, I have been reading my books to try to learn and this is my first script, it dosent use a database as its a calculator and it wouldt really be feasable. okay from a recent post of mine i made a session variable, now using these variables i plan to do calculations, by doing that i first call the session to a regular variable (simply because i made the calculation using regular variables) [code]$aloan1 = $_SESSION['aloan1'];[/code] then that variable is used later in program as a number for a calculation, something like this [code]$taloan = ($aloan1 + $aloan2 + $aloan3 + $aloan4 + $aloan5 + $aloan6 + $aloan7 + $aloan8 + $aloan9 + $aloan10);[/code] ( i realise that is probably the long way of doing something but im learning) now after getting that $taloan variable i run an if statement on it (something like:) [code]if ($under10k == "yes" and $vestbal <= 10000) { $fcalc1 = ($vestbal - $taloan - $tdloan - $taint); }[/code] (note there are some variables i did not include above for relevance and legnth of post) when i process page i get this error: [quote]Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0[/quote] now after looking at this register_globals I assume mine is turned off because im not getting a result, now does this mean that i cannot use these sessions variables to send data for calculations? I believe i have confused myself with my first script and hopefully the above post is understandable
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.