Jump to content

dezkit

Members
  • Posts

    1,236
  • Joined

  • Last visited

Everything posted by dezkit

  1. Hey guys I'm trying to do so that it checks if a string has something like http://steamcommunity.com/id/XXXXXXX http://steamcommunity.com/profiles/YYYYYYYYYY where X can equal numbers and letters and where Y can equal a numbers I currently have if(preg_match("/^http://steamcommunity.com/id/[a-zA-Z0-9]/",$str)){ echo "match found 3"; } But it doesn't work gives me error Warning: preg_match() [function.preg-match]: Unknown modifier '/' in C:\xampp\htdocs\steamid.php on line 13
  2. hey guys i got this code: <?php $file = "http://steamcommunity.com/id/itzdezkit/?xml=1"; function contents($parser, $data){ echo $data; } function startTag($parser, $data){ echo "<b>"; } function endTag($parser, $data){ echo "</b><br />"; } $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "steamID", "steamID"); xml_set_character_data_handler($xml_parser, "contents"); $fp = fopen($file, "r"); $data = fread($fp, 80000); if(!(xml_parse($xml_parser, $data, feof($fp)))){ die("Error on line " . xml_get_current_line_number($xml_parser)); } xml_parser_free($xml_parser); fclose($fp); ?> which doesn't work and gives me this error: Warning: xml_parse() [function.xml-parse]: Unable to call handler steamID() in /home/dima1989/public_html/testz.php on line 28 what im trying to do: get all the inforamtion between <steamID> and </steamID> how would i be able to fix this? thank you. also i would like to set the parsed infrmation into a variable.
  3. ONE LAST THING: I want to echo all the ones that have 0 right after i have the ones that have 1. here is the code that won't echo the ones with 0. <?php $steamid = $_GET["steamid"]; $steamid = mysql_real_escape_string($_GET['steamid']); if($steamid){ $query1 = "SELECT * FROM achiev_unlocks WHERE authid='$steamid'"; $result1 = mysql_query($query1) or die(mysql_error()); $row1 = mysql_fetch_array($result1) or die(mysql_error()); $query2 = "SELECT * FROM achiev_list"; $result2 = mysql_query($query2) or die(mysql_error()); $save = $row2['save']; echo "Stats for: {$row1['authid']}<br>Last seen as: {$row1['name']}<br><br><br>"; echo "<table border=0>"; while($row2 = mysql_fetch_array($result2)){ $query3 = "SELECT * FROM achiev_unlocks WHERE {$row2['save']}='1' and authid='$steamid'"; $result3 = mysql_query($query3) or die(mysql_error()); while($row3 = mysql_fetch_array($result3)){ $query4 = "SELECT * FROM achiev_list WHERE save='".$row2['save']."'"; $result4 = mysql_query($query4) or die(mysql_error()); while($row4 = mysql_fetch_array($result4)){ echo $row4["name"]; echo "<br>"; echo $row4["info"]; echo "<br><br>"; } } } echo "<br><br><br>"; while($row2 = mysql_fetch_array($result2)){ $query3 = "SELECT * FROM achiev_unlocks WHERE {$row2['save']}='0' and authid='$steamid'"; $result3 = mysql_query($query3) or die(mysql_error()); while($row3 = mysql_fetch_array($result3)){ $query4 = "SELECT * FROM achiev_list WHERE save='".$row2['save']."'"; $result4 = mysql_query($query4) or die(mysql_error()); while($row4 = mysql_fetch_array($result4)){ echo $row4["name"]; echo "<br>"; echo $row4["info"]; echo "<br><br>"; } } } echo "</table>"; } else { echo "<form action=\"\" method=\"get\">Search: <input type=\"test\" name=\"steamid\"></form>"; } ?> btw if i could change the sql structure i would, but i didn't make it and i gotta work with it ;P thanks
  4. OH WOW, I just noticed that I had two " $row2 = mysql_fetch_array($result2) or die(mysql_error());" . I'm stupid, thank's for pointing that out bud. <3333333 u
  5. Hey, thanks for the reply, but I had fixed my code, the only problem I am having is that the first row isn't coming up for some reason..... <?php $steamid = $_GET["steamid"]; $steamid = mysql_real_escape_string($_GET['steamid']); if($steamid){ $query1 = "SELECT * FROM achiev_unlocks WHERE authid='$steamid'"; $result1 = mysql_query($query1) or die(mysql_error()); $row1 = mysql_fetch_array($result1) or die(mysql_error()); $query2 = "SELECT * FROM achiev_list"; $result2 = mysql_query($query2) or die(mysql_error()); $row2 = mysql_fetch_array($result2) or die(mysql_error()); $save = $row2['save']; echo "Stats for: {$row1['authid']}<br>Last seen as: {$row1['name']}<br><br><br>"; echo "<table border=0>"; while($row2 = mysql_fetch_array($result2)){ $query3 = "SELECT * FROM achiev_unlocks WHERE {$row2['save']}='1' and authid='$steamid'"; $result3 = mysql_query($query3) or die(mysql_error()); while($row3 = mysql_fetch_array($result3)){ $query4 = "SELECT * FROM achiev_list WHERE save='".$row2['save']."'"; $result4 = mysql_query($query4) or die(mysql_error()); while($row4 = mysql_fetch_array($result4)){ echo $row4["name"]; echo "<br>"; echo $row4["info"]; echo "<br><br>"; } } } echo "<br><br><br>"; echo "</table>"; } else { echo "<form action=\"\" method=\"get\">Search: <input type=\"test\" name=\"steamid\"></form>"; } ?>
  6. I figured it out, <?php $steamid = $_GET["steamid"]; $steamid = mysql_real_escape_string($_GET['steamid']); if($steamid){ $query1 = "SELECT * FROM achiev_unlocks WHERE authid='$steamid'"; $result1 = mysql_query($query1) or die(mysql_error()); $row1 = mysql_fetch_array($result1) or die(mysql_error()); $query2 = "SELECT * FROM achiev_list"; $result2 = mysql_query($query2) or die(mysql_error()); $row2 = mysql_fetch_array($result2) or die(mysql_error()); $save = $row2['save']; echo "Stats for: {$row1['authid']}<br>Last seen as: {$row1['name']}<br><br><br>"; echo "<table border=0>"; while($row2 = mysql_fetch_array($result2)){ $query3 = "SELECT * FROM achiev_unlocks WHERE {$row2['save']}='1' and authid='$steamid'"; $result3 = mysql_query($query3) or die(mysql_error()); while($row3 = mysql_fetch_array($result3)){ $query4 = "SELECT * FROM achiev_list WHERE save='".$row2['save']."'"; $result4 = mysql_query($query4) or die(mysql_error()); $row4 = mysql_fetch_array($result4); echo $row4["name"]; echo "<br>"; echo $row4["info"]; echo "<br><br>"; } } echo "</table>"; } else { echo "<form action=\"\" method=\"get\">Search: <input type=\"test\" name=\"steamid\"></form>"; } ?> OK Now my last problem: why doesn't my first row pop up? it skips automatically to the next row, can atleast 1 person help me..?
  7. How do I do it so only the ones with "1" are echo'd? What my script is doing is only echoing the first 1's in the loop, if there is a 0 in between the 1's it won't echo the rest, for example hello | 1 sadsd | 1 dksdko | 1 askdpok | 0 asdp | 1 opkas | 1 The script will only echo hello, sadsd, dksdko and won't echo asdp and opkas. ALSO, it won't echo the first row for some reason, what the hell is up with my script? <?php $steamid = $_GET["steamid"]; $steamid = mysql_real_escape_string($_GET['steamid']); if($steamid){ $query1 = "SELECT * FROM achiev_unlocks WHERE authid='$steamid'"; $result1 = mysql_query($query1) or die(mysql_error()); $row1 = mysql_fetch_array($result1) or die(mysql_error()); $query2 = "SELECT * FROM achiev_list"; $result2 = mysql_query($query2) or die(mysql_error()); $row2 = mysql_fetch_array($result2) or die(mysql_error()); $save = $row2['save']; echo "Stats for: {$row1['authid']}<br>Last seen as: {$row1['name']}<br><br><br>"; echo "<table border=0>"; while($row2 = mysql_fetch_array($result2)){ $query3 = "SELECT * FROM achiev_unlocks WHERE {$row2['save']}='1' and authid='$steamid'"; $result3 = mysql_query($query3) or die(mysql_error()); $row3 = mysql_fetch_array($result3) or die(mysql_error()); $query4 = "SELECT * FROM achiev_list WHERE save='".$row2['save']."'"; $result4 = mysql_query($query4) or die(mysql_error()); $row4 = mysql_fetch_array($result4) or die(mysql_error()); echo $row4["name"]; echo "<br>"; echo $row4["info"]; echo "<br><br>"; } echo "</table>"; } else { echo "<form action=\"\" method=\"get\">Search: <input type=\"test\" name=\"steamid\"></form>"; } ?>
  8. Uhh, ok this is weird, if my first row has the value 0, then it echos the name, but if the 0 is in another row, maybe like at the end, it wont echo... help
  9. I found a way.. <?php $steamid = $_GET["steamid"]; if($steamid){ $query1 = "SELECT * FROM achiev_unlocks WHERE authid='$steamid'"; $result1 = mysql_query($query1) or die(mysql_error()); $row1 = mysql_fetch_array($result1) or die(mysql_error()); $query2 = "SELECT * FROM achiev_list"; $result2 = mysql_query($query2) or die(mysql_error()); $row2 = mysql_fetch_array($result2) or die(mysql_error()); $save = $row2['save']; echo "Stats for: {$row1['authid']}<br>Last seen as: {$row1['name']}<br><br><br>"; echo "<table border=0>"; while($row2 = mysql_fetch_array($result2)){ $query3 = "SELECT * FROM achiev_unlocks WHERE {$row2['save']}='1' and authid='$steamid'"; ////////////////////////////////////////////////////////////// WHEN I PUT save to equal to 0 NOTHING SHOWS UP, there are rows with 0. WHY IS THAT ///////////////////////////////////////////////////// $result3 = mysql_query($query3) or die(mysql_error()); $row3 = mysql_fetch_array($result3) or die(mysql_error()); $query4 = "SELECT * FROM achiev_list WHERE save='".$row2['save']."'"; $result4 = mysql_query($query4) or die(mysql_error()); $row4 = mysql_fetch_array($result4) or die(mysql_error()); echo $row4["name"]; echo "<br>"; echo $row4["info"]; echo "<br><br>"; } echo "</table>"; } else { echo "<form action=\"\" method=\"get\">Search: <input type=\"test\" name=\"steamid\"></form>"; } ?> check the comment in the code to help me please.
  10. Sup guys, I need help. Ok here is my current code: <?php $steamid = $_GET["steamid"]; if($steamid){ $query1 = "SELECT * FROM achiev_unlocks WHERE authid='$steamid'"; $result1 = mysql_query($query1) or die(mysql_error()); $row1 = mysql_fetch_array($result1) or die(mysql_error()); $query2 = "SELECT * FROM achiev_list"; $result2 = mysql_query($query2) or die(mysql_error()); $row2 = mysql_fetch_array($result2) or die(mysql_error()); $save = $row2['save']; echo "Stats for: {$row1['authid']}<br>Last seen as: {$row1['name']}<br><br><br>"; echo "<table border=0>"; while($row2 = mysql_fetch_array($result2)){ $query3 = "SELECT * FROM achiev_unlocks WHERE {$row2['save']}='1'"; $result3 = mysql_query($query1) or die(mysql_error()); $row3 = mysql_fetch_array($result1) or die(mysql_error()); echo $row2["save"]; } echo "</table>"; } else { echo "<form action=\"\" method=\"get\">Search: <input type=\"test\" name=\"steamid\"></form>"; } ?> With my database layout like this: achiev_list name | info | save Amazing | Survive 5 rounds as a human | human_amazing achiev_unlocks authid | name | human_amazing | human_unbreakable | etc..... 1 | dezkit | 0 | 1 Here is my logic: You search for authid: for example "1" The php while loops the achiev_list For every loop, the php checks if there is a table in achiev_unlocks with "1" (for example if human_amazing is being checked in the loop, it checks if human_amazing is 1 in achiev_unlocks) If the table has 1 then echo the Name and Info. Please help me as for my code doesn't work for some reason. Thank you, if any info is needed ill be here.
  11. yeah i got it guys, thank you. ;P
  12. problem solved; removed $row1 = mysql_fetch_array($result1); thanks nobody
  13. hey guys, i have this code, but i cant ever seem to get the first row to echo with the others, im stumbled why it wont' echo. thank you and please help me fix my code. <?php mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("menu") or die(mysql_error()); $url = $_GET["groupid"]; if(isset($url)){ $query1 = "SELECT * FROM `menu` WHERE `groupid` = '".$url."'"; $query2 = "SELECT * FROM `groups` WHERE `id` = '".$url."'"; $result1 = mysql_query($query1) or die(mysql_error()); $result2 = mysql_query($query2) or die(mysql_error()); if(mysql_num_rows($result1)){ $row1 = mysql_fetch_array($result1); $row2 = mysql_fetch_array($result2); echo "<table width=\"100%\">"; echo "<tr><td></td>"; if($row2["set"] == "0" && $row2["drink"] == "" && !$row2["id"] == "14"){ echo "<td>Price</td></tr>"; } if($row2["set"] == "0" && $row2["drink"] == "1"){ echo "</tr>"; } if($row2["set"] == "1"){ echo "<td>Small</td><td>Medium</td><td>Large</td></tr>"; } if($row2["set"] == "0"){ while($row1 = mysql_fetch_array($result1)){ echo "<tr><td><b>".$row1['product']."</b><br><font size='-1'>".$row1['description']."</font></td><td>"; if($row2["drink"] == ""){ echo "$"; } echo $row1["price"]."</td></tr>"; } } if($row2["set"] == "1"){ while($row1 = mysql_fetch_array($result1)){ echo "<tr><td><b>".$row1['product']."</b><br><font size='-1'>".$row1['description']."</font></td><td>"; if($row1["id"] == "99"){ echo ""; } else { echo "$".$row2['small']; } echo "</td><td>"; if(!$row2['medium'] == ""){ echo "$"; } echo $row2['medium']."</td><td>$".$row2['large']."</td></tr>"; } } echo "</table>"; if(!$row2["text"] == ""){ echo "<br><br><i>".$row2["text"]."</i>"; } } } else { $query = "SELECT * FROM `groups` ORDER BY `groups`.`group` ASC"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo "<a href='?groupid={$row['id']}'>{$row['group']}</a>"; echo "<br />"; } } ?>
  14. Problem: I don't know how to put all those fields into an array, because I am not experienced with packets and whatever... Code: <?php class Connect { var $serveraddress; var $portnumber; var $gameserver_status; var $serverdata; function serverStatus($serveraddress, $portnumber){ ini_set(allow_url_fopen,1); $command = "\xFF\xFF\xFF\xFFTSource Engine Query\0\x00"; //var $serv_requestcommand_infos = "\xFF\xFF\xFF\xFFTSource Engine Query\0\x00"; //var $serv_requestcommand_rules = "\xFF\xFF\xFF\xFFV\x00"; //var $serv_requestcommand_players = "\xFF\xFF\xFF\xFFU\x00"; //var $serv_rconcommand1 = "\xFF\xFF\xFF\xFFchallenge rcon\x00"; //var $serv_rconcommand2 = "\xFF\xFF\xFF\xFFrcon"; //var $serv_rconcommand2 = "\xFF\xFF\xFF\xFFrcon"; $waittime = 1.5; $serverdata = ""; if (!$cssocket=fsockopen("udp://".$serveraddress,$portnumber,$errnr)){ $errmsg="No connection"; }else{ socket_set_blocking($cssocket,true); socket_set_timeout($cssocket,0,500000); fwrite($cssocket,$command,strlen($command)); $starttime=time(); do{ $serverdata.=fgetc($cssocket); $serverdatalen++; $socketstatus=socket_get_status($cssocket); if (time() > ($starttime+$waittime)){ $errmsg="Connection timed out"; fclose($cssocket); } } while ($socketstatus["unread_bytes"] ); fclose($cssocket); } $this->serv_infos[0][1] = 'address'; $this->serv_infos[1][1] = 'name'; $this->serv_infos[2][1] = 'map'; $this->serv_infos[3][1] = 'gamename'; $this->serv_infos[4][1] = 'players'; $this->serv_infos[5][1] = 'maxplayers'; $this->serv_infos[6][1] = 'protocol'; $this->serv_infos[0][2] = $ip.":".$port; $this->serv_infos[1][2] = ; $this->serv_infos[2][2] = ; $this->serv_infos[3][2] = ; $this->serv_infos[4][2] = ; $this->serv_infos[5][2] = ; $this->serv_infos[6][2] = ; if (strlen($serverdata) < 5){ $this->gameserver_status = "0"; echo $serverdata; }else{ $this->gameserver_status = "1"; echo $serverdata; } $endtime=time(); } } ?>
  15. Hello guys, I am in need of making a packet that I send to a Counter-Strike 1.6 server into an array, here is the reply format: Type byte Should be equal to 'I' (0x49) Version byte Network version. 0x07 is the current Steam version. Goldsource games will return 48 (0x30), also refered to as protocol version. Server Name string The Source server's name, eg: "Recoil NZ CS Server #1" Map string The current map being played, eg: "de_dust" Game Directory string The name of the folder containing the game files, eg: "cstrike" Game Description string A friendly string name for the game type, eg: "Counter Strike: Source" AppID short Steam Application ID Number of players byte The number of players currently on the server Maximum players byte Maximum allowed players for the server Number of bots byte Number of bot players currently on the server Dedicated byte 'l' for listen, 'd' for dedicated, 'p' for SourceTV OS byte Host operating system. 'l' for Linux, 'w' for Windows Password byte If set to 0x01, a password is required to join this server Secure byte if set to 0x01, this server is VAC secured Game Version string The version of the game, eg: "1.0.0.22" Extra Data Flag (EDF) byte if present this specifies which additional data fields will be included if ( EDF & 0x80 ) short The server's game port # is included if ( EDF & 0x10 ) long long The server's SteamID is included if ( EDF & 0x40 ) short string The spectator port # and then the spectator server name are included if ( EDF & 0x20 ) string The game tag data string for the server is included [future use] if ( EDF & 0x01 ) short ?? The Steam Application ID again + several 0x00 bytes Or can be found here. Here is a reply example: ÿÿÿÿI0CAL CS Match Server�cs_italy�cstrike�Counter-Strike� ���dw�1.1.2.6�‡i�¨J0É@ Can anybody bring me on the right foot to this? Thank you.
  16. hey, i try out this code <?php $times = "1022.3234"; $times = explode(".", $times); $1 = $times[0]; ?> But i keep receiving this message, Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/public_html/hi.php on line 4 What is the problem? thank you
  17. the url is this "?map=surf_#crypepsi" i think the php is grabbing surf_ and leaving out #crypepsi because of the numeral sign, how do i fix this?
  18. I am using this code: <?php mysql_connect("localhost", "xxx", "xxx") or die(mysql_error()); mysql_select_db("xxx") or die(mysql_error()); $map = mysql_real_escape_string(trim(strip_tags($_GET["map"]))); if($map){ $query = "SELECT * FROM maps WHERE mapname='".$map."' ORDER BY runtime"; $result = mysql_query($query) or die(mysql_error()); echo "<table>"; while($row = mysql_fetch_array($result)){ echo "<tr><td>{$row['name']}</td></tr>"; } echo "</table>"; } else { $query = "SELECT * FROM maps ORDER BY mapname"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo "<a href='?map={$row['mapname']}'>{$row['mapname']}</a><br>"; } } ?> there are 2 mapnames: surf_#crypepsi surf_water-run, both have name assigned to it. When i click on surf_#crypepsi, it shows blank, when I press surf_water-run, it shows a name
  19. hey, im trying to run a query within php but it won't work, this is the query: SELECT * FROM maps WHERE mapname='".$map."' ORDER BY runtime $map equals to surf_#crypepsi It works with other rows but not with surf_#crypepsi, what is the problem? thanks
  20. I am trying to connect to a game server to see if its running, so I can't do http or ftp. When I try icmp it shows an error. My last option is TCP which always gives me a connection refused error...
×
×
  • 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.