Jump to content

Ansego

Members
  • Posts

    151
  • Joined

  • Last visited

Everything posted by Ansego

  1. um. Post the script and front page code...? or any other relative code required. One on one you would need to come up with a better way to ask your question. First understand what your question is and what you are trying to achieve and provide evidence, elements and descriptions that we could use to understand your problem more clear. This way we can help you and have a better understanding of the problem that you face. Welcome to try phpfreaks IRC chat... http://www.phpfreaks.com/page/irc-live-chat
  2. fyi your IF statement failed: Failed: if (isset($_SESSION['logged']) && $_SESSION['logged'] !== true){ Operators !== failed. Works: if (isset($_SESSION['logged']) && !$_SESSION['logged'] == true){ Works: if (isset($_SESSION['logged']) && $_SESSION['logged'] != true){
  3. Thanks, I assumed "session_id()" had something to do with the security of the session, thanks for straightening that up, was scratching my head on it for awhile. Thought encryption type "multipart/form-data" was for file uploads and "text/plain" was for debugging? All good, I'll start using "multipart/form-data" Nope, that was it, was just working out sessions to have a better grasp. Acceptable to use for a website session. Or has it got security breech all over it? Put the exit(); under the redirection headers. The GET was just for a quick msg, if someone wants to put junk in there it only echo's back ( Unless that is a breech? ). Thanks for your feed back mate, fixing the code up now.
  4. Hi guys, Have some questions about "SESSIONS". I am setting: $_SESSION['sessionID'] = session_id(); BUT not sure how to use it correctly or what for? Is code below acceptable? Any suggestions for improvements? <?php error_reporting(-1); ini_set('display_errors', 'On'); spl_autoload_register(function ($class) { include 'lib/' . $class . '.inc'; }); session_start(); // =============================================================== if (isset($_GET['msg'])){ echo $_GET['msg']; } // =============================================================== if (isset($_POST['btn_login']) && !empty($_POST['btn_login'])){ $_SESSION['logged'] = "true"; $_SESSION['sessionID'] = session_id(); session_write_close(); header( 'Location: http://localhost/work/index.php?msg=Logged in!' ) ; } // =============================================================== if (isset($_POST['btn_logout']) && !empty($_POST['btn_logout'])){ //true $_SESSION['logged'] = ""; $_SESSION['sessionID'] = ""; session_write_close(); session_destroy(); header( 'Location: http://localhost/work/index.php?msg=Logged out!' ) ; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Server Status</title> </head> <body> <?php // =============================================================== if (!$_SESSION['logged'] == true){ ?> <form action="#" method="post" enctype="application/x-www-form-urlencoded" name="user-login"> <input name="btn_login" type="submit" value="Logon" /> </form> <?php }else{ ?> <form action="#" method="post" enctype="application/x-www-form-urlencoded" name="user-login"> <input name="btn_logout" type="submit" value="Logout" /> </form> <?php } ?> </body> </html> Kind regards and thanks.
  5. Hi, mysql_real_escape_string() Warning This extension is deprecated as of PHP 5.5.0 http://www.php.net//manual/en/function.mysql-real-escape-string.php
  6. Thanks guys awesome feed back and help A+++
  7. Hi Raz3rt Nothing jumps out at me, though 4am... Could you please show us the full mail code. This is what I use in my headers: $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Take over the world Reminder <totw@example.com>' . "\r\n"; Worth trying a different header. Are you also sure the SMTP/POP3 server is setup correctly?
  8. Hi guys, Thanks for replying. @neil.johnson I have tried a simple connection script, works fine. But again when multiple servers using that script run into the same trouble of waiting. The function works, just a slow process. @Psycho Option 1 sounds like the only option to do, though is there a process function for php or does it require a session? Any suggestions on a process kept alive without a user present, that would be great ( Keeping in mind I am on a Windows box... I can hear you guys spewing up! ). I understand what you mean about the get_status() function, I will implement yours. Also agree that it seems long winded to process the output in another function. Looking forward to hear what you guys suggest for live process without the human element. Thank you for the great information and feed back.
  9. Hi guys, I've tested this code on the dev and live server and is very slow to run, is there something I am missing or looped? Or just plain wrong? I do however get the results after a little time, I have 6 records in the test database for testing but this is meant to be built for 100+ servers, will just take for ever to load... PS: Welcome any constructive suggestions My thoughts: I do however have a feeling it maybe: stream_socket_client ( If so, anyway to speed it up? ) with the wait time for a response from the server. Live server I pushed this on should not have to much trouble of that though, since it is in the same rack farm as the servers that it was tested on. So far I've increased and no change: memory_limit = 256M in the php.ini file. query_cache_size=256M in the my.ini for MySQL CODE: ( WARNING BIT MESSY ) Index.php: <?php error_reporting(-1); ini_set('display_errors', 'On'); spl_autoload_register(function ($class) { include 'lib/' . $class . '.inc'; }); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>index</title> </head> <body> <?php $servers = new servers; ?> </body> </html> lib/dbcon.inc: <?php include_once 'settings.inc'; class dbcon { protected $db_Hostname = HOSTNAME; protected $db_Username = USERNAME; protected $db_Password = PASSWORD; protected $db_Database = DATABASE; protected $dbConnection; public function __construct(){ $this->set_connection(); } public function set_connection(){ $this->dbConnection=mysqli_connect($this->db_Hostname,$this->db_Username,$this->db_Password,$this->db_Database); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } } public function get_connection(){ echo "Got connection"; return $this->dbConnection; } public function close_connection(){ echo "Connection Closed..."; mysqli_close($this->dbConnection); return true; } } ?> lib/servers.inc: <?php include_once 'settings.inc'; class servers { protected $dbConnection; function __construct() { spl_autoload_register(function ($class) { include '' . $class . '.inc'; }); $dbcon = new dbcon; $this->dbConnection = $dbcon->get_connection(); $this->get_servers(); } // End Construct public function get_servers(){ $message = ''; $message = '<h3>Current Servers</h3>'; $con = $this->dbConnection; $result = mysqli_query($con,"SELECT * FROM server_status.tbl_servers;")or die("Error: ".mysqli_error($con));; while($row = mysqli_fetch_array($result)) { $message .= "" . $row['ssGameType'] . " : "; $message .= "" . $row['ssIP'] . ":" . $row['ssPort'] . " : "; $message .= " Status:" . $this->get_status($row['ssIP'],$row['ssPort']) . " : "; $message .= "Timestamp:" . $row['Timestamp'] . " : "; $message .= "Orderby:" . $row['ssOrder'] . "<br />"; } $message .= "<br />End of the \"Server List\" "; $message .= "<br />"; echo $message; //$this->dbConnection->close_connection(); // FAILED return $message; } public function get_status($ServerIP,&$ServerPort){ if(@stream_socket_client("tcp://$ServerIP:$ServerPort", $errno, $errstr, 5) !== false) { return "<strong style='color:#33CC00'>Online</strong>"; } else { return "<strong style='color:#CC0000'>Offline</strong>"; } } } // End class ?> Results: Current Servers Minecraft : xxx.xxx.xxx.xxx:25575 : Status:Online : Timestamp:2014-06-17 22:19:46 : Orderby:1 Minecraft : xxx.xxx.xxx.xxx:25576 : Status:Offline : Timestamp:2014-06-17 22:19:54 : Orderby:2 Minecraft : xxx.xxx.xxx.xxx:25577 : Status:Offline : Timestamp:2014-06-17 22:20:00 : Orderby:3 Minecraft : xxx.xxx.xxx.xxx:25578 : Status:Offline : Timestamp:2014-06-17 22:20:06 : Orderby:4 Minecraft : xxx.xxx.xxx.xxx:25579 : Status:Offline : Timestamp:2014-06-17 22:20:13 : Orderby:5 Minecraft : xxx.xxx.xxx.xxx:25580 : Status:Offline : Timestamp:2014-06-17 22:20:20 : Orderby:6 End of the "Server List" Advance thanks for any help guys.
  10. I agree with @requinix, Might want to post the function code that handles the output. May have something like: strtolower($str); in there... ( REF: http://www.php.net//manual/en/function.strtolower.php ) If not maybe try another browser as @ginerjm suggested.
  11. @Jacques1 - These suggestions are amazing and sooo much appreciated mate, I've copied them down and are on my desktop for reference. Seriously thank you for the feed back, great bunch of guys on this forum, thank you, ps. Hope you don't mind I will send you a pm to pick your brains some. Re Ansego.
  12. lol @jarvis mac_gyver and Ch0cu3r suggestion is to redirect off that page for the result as it does not change it there and then. I had similar problems with sessions too and had to redirect it. I think there is a rule that this is meant to be at the top of the page but I've used it with in the page: header( 'Location: index.php' ) ; for redirection. Maybe try: $cookie_name = 'defaultLanguage'; if (isset($_GET["language"]) && !empty($_GET["language"])){ $cookie_value = $_GET["language"]; setcookie($cookie_name, $cookie_value, time() + (86400 * 30), '/'); // 86400 = 1 day header( 'Location: index.php' ); // Redirect to a page }else{ $cookie_value = 'English'; setcookie($cookie_name, $cookie_value, time() + (86400 * 30), '/'); // 86400 = 1 day header( 'Location: index.php' ); // Redirect to a page } If this does not work hopefully these guru's can shed some more light. But least this will have a redirection, just hope the logic is right. Good luck ;-)
  13. Sorry bit like blind leading blind, I just got over my head ache with sessions. Did not see anything check if $_COOKIE["defaultLanguage"] pre existed. In regards to @ ginerjm Manual: http://www.php.net/manual/en/function.setcookie.php @ ginerjm: You talking about example #1 OR Path, Domain, Secure and httponly? Example #1: <?php $value = 'something from somewhere'; setcookie("TestCookie", $value); setcookie("TestCookie", $value, time()+3600); /* expire in 1 hour */ setcookie("TestCookie", $value, time()+3600, "/~rasmus/", "example.com", 1); ?> Test Example: <?php // Print an individual cookie echo $_COOKIE["TestCookie"]; echo $HTTP_COOKIE_VARS["TestCookie"]; // Another way to debug/test is to view all cookies print_r($_COOKIE); ?>
  14. Hi Jarvis, I am still new with cookies / sessions and all so this may not work, but could you try this: $cookie_name = 'defaultLanguage'; if (empty($cookie_value)){ $cookie_value = 'English'; setcookie($cookie_name, $cookie_value, time() + (86400 * 30), '/'); // 86400 = 1 day }else{ $cookie_value = $_GET["language"]; setcookie($cookie_name, $cookie_value, time() + (86400 * 30), '/'); // 86400 = 1 day }
  15. Disregards Ch0cu3r on the job.
  16. NVM Thanks, fixed, had a bracket wrapping the whole thing and fixed logic in the IF Statements for && too || and empty() instead of isset()
  17. I am lost what the heck am i doing! PAGE: index.php <?php session_start(); //session_unset(); //session_destroy(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Server Status Login</title> </head> <body> <?php spl_autoload_register(function ($class) { include 'lib/' . $class . '.inc'; }); $handler = new handler; ?> <a style="text-decoration:none;" href='index.php'>Home</a> | <a style="text-decoration:none;" href='test.php'>Test</a> | <a style="text-decoration:none;" href='index.php'>A</a><br /><br /> <?php // # CHECKING SESSION READ OUT if (isset($_SESSION['USER_STATUS']) && $_SESSION['USER_STATUS'] == 1){ echo '<br />Session SET: '.$_SESSION['USER_STATUS'].'<br />'; }else{ echo '<br />Nothing<br />'; } // # ACCEPTS LOGIN DETAILS if (isset($_POST['username']) && !empty($_POST['username']) && isset($_POST['password']) && !empty($_POST['password'])){ $username = $_POST['username']; $password = $_POST['password']; echo $handler->logon($username, $password); } // # HANDLES LOGOUT if (isset($_POST['btn_logout']) && !empty($_POST['btn_logout'])){ $handler->logout(); echo '<br />Logged out<br />'; } // # SESSION CHECK AND SHOW LOGIN FORM if (isset($_SESSION['USER_STATUS']) && $_SESSION['USER_STATUS'] == 0){ ?> <form action="index.php" method="post" enctype="application/x-www-form-urlencoded" name="Login"> <table width="200" border="0" align="center" cellpadding="5" cellspacing="5"> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><input type="text" name="username" id="username" placeholder="Username" /></td> <td> </td> </tr> <tr> <td> </td> <td><input type="password" name="password" id="password" placeholder="Password" /></td> <td> </td> </tr> <tr> <td> </td> <td align="right"><input type="submit" name="btn_login" id="btn_login" value="Login" /></td> <td> </td> </tr> <tr> <td> </td> <td align="right"></td> <td> </td> </tr> </table> </form> <?php // # IF SESSION IS SET TOO 1 SHOW LOGOUT BUTTON FORM if (isset($_SESSION['USER_STATUS']) && $_SESSION['USER_STATUS'] == 1){ echo '<br />Session name: '. $_SESSION['USER_STATUS'] ."<br />"; ?> <form action="index.php" method="post" enctype="application/x-www-form-urlencoded" name="Login"> <table width="200" border="0" align="center" cellpadding="5" cellspacing="5"> <tr> <td> </td> <td></td> <td> </td> </tr> <tr> <td> </td> <td align="right"><input type="submit" name="btn_logout" id="btn_logout" value="Logout" /></td> <td> </td> </tr> <tr> <td> </td> <td align="right"></td> <td> </td> </tr> </table> </form> <?php echo $handler->listServers(); } } ?> <br /> <br /> <em style="font-size:9px;">copyright © 2014 ansego.com </em> </body> </html> PAGE: handler.inc <?php include_once '../../../Global-Includes/ServerStatus/db-connect.php'; //namespace xStatus; class handler { private $username = ''; private $password = ''; private $db_Hostname = HOSTNAME; private $db_Username = USERNAME; private $db_Password = PASSWORD; private $db_Database = DATABASE; private $dbSQL = ''; // function __construct($url, $port = '2302') { function __construct() { } // End Construct // ========================================================= Session Log in / out public function logon($username, $password){ if ($username == "admin" && $password == "coffee"){ //session_start(); $_SESSION['USER_STATUS'] = 1; }else{ echo '<br />Login Details failed!<br />'; } } public function logout(){ $_SESSION['USER_STATUS'] = 0; session_destroy(); //session_unset(); } // ========================================================= List Servers public function listServers(){ $db = new mysqli($this->db_Hostname,$this->db_Username,$this->db_Password,$this->db_Database); // use your credentials $message = ''; // list current servers from database $sql = "SELECT * FROM tbl_servers"; $res = $db->query($sql); if ($res->num_rows > 0) { $message = '<h3>Current Servers</h3>'; while ($row = $res->fetch_assoc()) { $message .= $row['HostGame'] . '<br />'; $message .= $row['HostIP'] . '<br />'; $message .= $row['HostPort'] . '<br />'; $message .= $this->get_status($row['HostIP'],$row['HostPort']) . '<br /><br />'; } } $message .= "<br />End of the \"Server List\" "; $message .= "<br />"; $db->close(); return $message; } // ========================================================= SEARCH SERVERS public function listSearchServers($field,$keyword){} // ========================================================= INSERT SERVERS public function insertServers($HostGame,$HostIP,$HostPort,$Datastamp,$Order){ $sql = "INSERT INTO `serverstatus`.`tbl_servers` (`HostGame`, `HostIP`, `HostPort`, `Datastamp`, `Order`) VALUES ($HostGame, $HostIP, $HostPort, $Datastamp, $Order)"; //$sql = "INSERT INTO person (name) VALUES ('$name')"; $result = sqlExecute($sql); return $result; } // ========================================================= UPDATE SERVERS public function updateServers($ID, $HostGame,$HostIP,$HostPort,$Datastamp,$Order){ $sql = "UPDATE `serverstatus`.`tbl_servers` SET `HostGame` = $HostGame, `HostIP` = $HostIP, `HostPort` = $HostPort, `Datastamp` = $Datastamp, `Order` = $Order WHERE `ID` = $ID"; //$sql = "INSERT INTO person (name) VALUES ('$name')"; $result = sqlExecute($sql); return $result; } // ========================================================= DELETE SERVERS public function deleteServers($id){ $sql = "DELETE FROM `serverstatus`.`tbl_servers` WHERE ID = $id"; //$sql = "INSERT INTO person (name) VALUES ('$name')"; $result = sqlExecute($sql); return $result; } // ========================================================= Execute Helpers public function sqlExecute($sqlStatement){ $db = new mysqli($this->db_Hostname,$this->db_Username,$this->db_Password,$this->db_Database); $db->real_escape_string($sqlStatement); if ($db->query($sqlStatement)) { printf("%d Row inserted.\n", $db->affected_rows); } //$db->query($sql); $db->close(); return true; } // ========================================================= GET STATUS public function get_status($ServerIP,&$ServerPort){ // NOTICE THE @ //if(@stream_socket_client("tcp://".$this.$ServerIP.":".$this.$ServerPort."", $errno, $errstr, 1) !== false) { //FIX: if(stream_socket_client("tcp://$ServerIP:$ServerPort", $errno, $errstr, 1) !== false) { if(@stream_socket_client("tcp://$ServerIP:$ServerPort", $errno, $errstr, 5) !== false) { return "<strong style='color:#33CC00'>Online</strong>"; } else { return "<strong style='color:#CC0000'>Offline</strong>"; } //return "Offline"; } /* SELECT `tbl_servers`.`ID`, `tbl_servers`.`HostGame`, `tbl_servers`.`HostIP`, `tbl_servers`.`HostPort`, `tbl_servers`.`Datastamp`, `tbl_servers`.`Order` FROM `serverstatus`.`tbl_servers`; INSERT INTO `serverstatus`.`tbl_servers` (`ID`, `HostGame`, `HostIP`, `HostPort`, `Datastamp`, `Order`) VALUES (<{ID: }>, <{HostGame: }>, <{HostIP: }>, <{HostPort: }>, <{Datastamp: }>, <{Order: }>); UPDATE `serverstatus`.`tbl_servers` SET `ID` = <{ID: }>, `HostGame` = <{HostGame: }>, `HostIP` = <{HostIP: }>, `HostPort` = <{HostPort: }>, `Datastamp` = <{Datastamp: }>, `Order` = <{Order: }> WHERE `ID` = <{expr}>; DELETE FROM `serverstatus`.`tbl_servers` WHERE <{where_expression}>; */ // property declaration public $var = 'a default value<br />'; // method declaration public function displayVar() { echo $this->var .'<br />'; } } // End class /* ======================================================== MESS //$this->myFunc = 'myFunc Value'; echo 'Hello from construct...<br />'; $this->server = array( "url" => $url, "port" => $port ); print_r($this->server); */ ?>
  18. So far seems I need " session_start(); " on top every page running that session... still playing up though...
  19. Just wanted to know if $_Session was a global thing or does php require cookies setup? I assumed that I could do something like this: PAGE: A.php session_start(); $_Session['Cat'] = 'Meow'; // ----------------------- PAGE: B.php if (isset($_Session['Cat']) && !empty($_Session['Cat'])){ echo $_Session['Cat']; } OUTPUT: Meow // ----------------------- PAGE: C.php if (isset($_Session['Cat']) && !empty($_Session['Cat'])){ echo $_Session['Cat']; } OUTPUT: Meow I can't seem to get this to work. Page: Handler.inc // ========================================================= Session Log in / out public function logon($username, $password){ if ($username == "admin" && $password == "coffee"){ session_start(); $_SESSION['USER_STATUS'] = '1'; echo 'IN SESSION LOGIN HANDLER'; echo $_SESSION['UserLogged']; } } public function logout(){ $_SESSION['USER_STATUS'] = '0'; echo 'IN SESSION LOGOUT HANDLER'; session_destroy(); //session_unset(); } Page: index.php if (!isset($_SESSION['USER_STATUS']) && empty($_SESSION['USER_STATUS']) || $_SESSION['USER_STATUS'] == 0){ if (isset($_POST['username']) && !empty($_POST['username']) && isset($_POST['password']) && !empty($_POST['password'])){ $username = $_POST['username']; $password = $_POST['password']; echo $handler->logon($username, $password); } <LOGIN FORM CODE> }else{ if (isset($_SESSION['USER_STATUS']) && !empty($_SESSION['USER_STATUS']) || $_SESSION['USER_STATUS'] == 1){ echo 'Session name: '. $_SESSION['USER_STATUS']; } if (isset($_POST['btn_logout']) && !empty($_POST['btn_logout'])){ $handler->logout(); echo '<br />Logged out<br />'; } <LOGOUT FORM BUTTON CODE> } Could someone point me in the right direction please. It does not seem to hold its session.
  20. Hi Ch0cu3r, Well done mate, I removed the ( @ ) and ( & ) and gave me an error: Catchable fatal error: Object of class servers could not be converted to string in.... Which pointed too: if(stream_socket_client("tcp://".$this.$ServerIP.":".$this.$ServerPort."", $errno, $errstr, 1) !== false) { I removed $this and wrapped it with "" and it works great now. End result: if(stream_socket_client("tcp://$ServerIP:$ServerPort", $errno, $errstr, 1) !== false) { Giving that reference page you have posted a good read too, cheers. Thanks mate, your awesome!
  21. Hi Ch0cu3r. I've moved the error reporting code to index.php with no change to outcome, still white page. <?php ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(E_ALL); error_reporting(-1); ?> I have removed the / from the include but still no change, white page no data. include 'lib/' . $class . '.inc';
  22. Hello, I am having some troubles and was hoping someone could guide me through it. Q: When ever I try call my get_status function all I get is a white page of nothing, no errors to work from etc... Can anyone here see what I am doing wrong? PATH: index.php NOTICE //<<-- KILLS PAGE <?php spl_autoload_register(function ($class) { include '/lib/' . $class . '.inc'; }); $servers = new servers; echo $servers->get_servers(); echo "STATUS: ".$servers->get_status("0.0.0.0",80); //<<-- KILLS PAGE ?> Page works fine until I want to use the status function, I get no errors or anything just a blank page. PATH: Lib/Servers.inc NOTICE //<<-- KILLS PAGE <?php ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(E_ALL); error_reporting(-1); include_once '../../Global-Includes/ServerStatus/db-connect.php'; //namespace xStatus; class servers { private $db_Hostname = HOSTNAME; private $db_Username = USERNAME; private $db_Password = PASSWORD; private $db_Database = DATABASE; private $dbSQL = ''; function __construct() { } // End Construct public function get_servers(){ $db = new mysqli($this->db_Hostname,$this->db_Username,$this->db_Password,$this->db_Database); $message = ''; // list current servers from database $sql = "SELECT * FROM tbl_servers"; $res = $db->query($sql); if ($res->num_rows > 0) { $message = '<h3>Current Servers</h3>'; while ($row = $res->fetch_assoc()) { $message .= $row['HostGame'] . '<br>'; $message .= $row['HostIP'] . '<br>'; $message .= $row['HostPort'] . '<br>'; $message .= $this->get_status($row['HostIP'],$row['HostPort']) . '<br>'; //<<-- KILLS PAGE! } } $message .= "<br>End of the \"Server List\" "; return $message; } public function get_status(&$ServerIP,&$ServerPort){ if(@stream_socket_client("tcp://".$this.$ServerIP.":".$this.$ServerPort."", $errno, $errstr, 1) !== false) { return "Online"; } else { return "Offline"; } return "Offline"; } } // End class ?> Kind regards and thank you.
  23. Cheek @ KevinM1 AKA The Terminator! Thought I'd jump in on the action in here too, might as well go in loops... sure not a home work post?
  24. Bump. Curious too, I am writing socket code atm, trying to get a generic code for multiple games but having no luck due to the variables are different for each game, though I would of expected some kind of standardisation with the variables ie host, server_type, players, max_player, name etc. One thing I do keep running into is: $port is a reserved variable so be aware of that if you are running through a function or set a constant. The code you have provided for TF2 gives output: ITF2 Servercp_dustbowltfTeam Fortressdw2198641i%8@TF2Stats,alltalk,cp,increased_maxplayers,norespawntime,respawntimes But I have noticed for games like Minecraft they use the tcp:// other then the udp:// as shown below (requires a handshake): @stream_socket_client('tcp://'.$url.':'.$xport, $errno, $errstr, 1) Also not 100% on the hex command lines, these would also vary per server type (I assume): http://ddecode.com/hexdecoder/?results=552bf941214641e4743cf5709401132a \xff\xff\xff\xff\x54\x53\x6f\x75\x72\x63\x65\x20\x45\x6e\x67\x69\x6e\x65\x20\x51\x75\x65\x72\x79\x00 This is details for Steam queries for source engine/valve (I don't know how to make use of it): https://developer.valvesoftware.com/wiki/Server_queries Wish us both luck. If I find something I'll share it. If any GURU's out there that know about sockets look forward in hearing from you too.
  25. Start reading: http://www.php-fig.org/ https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md http://www.phptherightway.com/ https://getcomposer.org/ http://www.php.net/
×
×
  • 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.