NulliveX Posted January 31, 2007 Share Posted January 31, 2007 here is the code i'm starting with. I'd like to modify it so i don't need to create a new file for each ip address to get checked because i have multiple i'd like to check in a database but im pretty new to PHP. I attempted to assign a variable and use this form. $ip = "$ip_aasf"; and removed this $ip_aasf = '69.61.21.52'; and in my browser i used http://www.suckanade.com/scripts/test.php <?php include("stat.php?ip=69.61.21.52");?> and i get this error Warning: main(stat.php?ip=69.61.21.52) [function.main]: failed to open stream: No such file or directory in /home/suckanad/public_html/scripts/test.php on line 9 Warning: main(stat.php?ip=69.61.21.52) [function.main]: failed to open stream: No such file or directory in /home/suckanad/public_html/scripts/test.php on line 9 Warning: main() [function.include]: Failed opening 'stat.php?ip=69.61.21.52' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/suckanad/public_html/scripts/test.php on line 9 Here's the original if anyone could help me out i'd appriciate it <?php //-- Server Status Web Indicators v3.0 by; Inque187 - Copyright 2005-2007 //-- http://www.fbi-clan.org //---- *** EDIT THESE VALUES HERE *** --- \\ $ip_aasf = '69.61.21.52'; //---- Change to the IP address of your America's Army server (or DNS name: server.yoursite.com) $port_aasf = '1716'; //---- Change to the UDP port of your America's Army server (default is 1716) $img_path = 'http://www.suckanade.com/images'; //---- Change to the folder path where you uploaded the status images (add http:// in front - no trailing slash) $pass_aasf = ''; //---- Enter your America's Army password for weblink (if required - refer to your America's Army setup file) $password_on1 = '0'; //---- Change to number 1 to turn on server password for weblink (0 means no password required) //---- NO NEED TO MAKE ANY CHANGES IN THE SECTION BELOW - UNLESS YOU KNOW WHAT YOU'RE DOING! --- \\ if ($password_on1 != 0) { $pass_show1 = '?password='.$pass_aasf.''; } else { $pass_show1 = ''; } //---- NO NEED TO MAKE ANY CHANGES IN THE SECTION BELOW - UNLESS YOU KNOW WHAT YOU'RE DOING! --- \\ ini_set("max_execution_time","2"); $stat_aasf = @fsockopen("udp://${ip_aasf}",$port_aasf,$errno,$errstr,2); @socket_set_timeout($stat_aasf,000002); if (!$stat_aasf) { echo '<img src="'.$img_path.'/serv_off.gif" height="11" style="border:0px; vertical-align:middle; text-align:center;" title="America\'s Army Server Is Offline" width="47" />'; @fclose($stat_aasf); } else { $send = pack("CCCV",0xFE,0xFD,0x00,0x7E).pack("CCC", 0xFF,0xFF,0xFF); @fwrite ($stat_aasf, $send); $outp_aasf = @fread ($stat_aasf,1); if (!$outp_aasf) { echo '<img src="'.$img_path.'/serv_off.gif" height="11" style="border:0px; vertical-align:middle; text-align:center;" title="America\'s Army Server Is Offline" width="47" />'; @fclose($stat_aasf); } else { echo '<a href="aao://'.$ip_aasf.':'.$port_aasf.''.$pass_show1.'" title="America\'s Army is Online"><img src="'.$img_path.'/serv_on.gif" height="11" style="border:0px; vertical-align:middle; text-align:center;" title="America\'s Army Server Is Online" width="47" /></a>'; @fclose($stat_aasf); } } ?> Link to comment https://forums.phpfreaks.com/topic/36529-fsockopen-and-variables/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.