anyway to add some php to webpages? I have a few mods I would like to add to my site but not sure if its even possible.
php?
Collapse
X
-
VodaHost
Your Website People!
1-302-283-3777 North America / International
02036089024 / United Kingdom
291916438 / Australia
------------------------
Top 3 Best Sellers
Web Hosting - Unlimited disk space & bandwidth.
Reseller Hosting - Start your own web hosting business.
Search Engine & Directory Submission - 300 directories + (Google,Yahoo,Bing)
-
-
Re: php?
Great! thanks that will help. but its not helping right now lol I have this script/mod
Code:[size=2] <?php /************************************************************************/ /* PHP-NUKE: Neverwinter Nights Server Status */ /* =========================== */ /* */ /* Copyright (c) 2002 by Thure Fransen */ /* http://phpnuke.org */ /* */ /* ========================= */ /* Based on Ingmar Stieger's Query NWN Servers PnP Script */ /* */ /* This PHP script queries a Neverwinter Nights Server just like the */ /* graphical client does. */ /************************************************************************/ // Specify ip address or name of NWN server $ipaddr = '68.7.13.201'; // Example: The World Of Avlis, main server // Specify port of server (5121 is default) $port = '5121'; // Specify timeout (maximum time to wait for connection and data) $timeout = 5; // five seconds; function Connect() { global $ipaddr, $port, $timeout; // open connection to server $fp = fsockopen("udp://" . $ipaddr, $port, $errno, $errstr, $timeout); // return error if connection fsockopen failed if (!$fp) echo "ERROR: $errno - $errstr<br>\n"; // Set timeout on socket socket_set_timeout($fp, $timeout); // return connection return $fp; } function Disconnect($fp) { // Done reading, close connection fclose($fp); } function QueryServer($fp) { // Send query request to server $query = '\\status\\'; fwrite($fp,$query); // this counter acts as a safety net $passes = 0; // Read in everything the server sends us back while (!$status['eof'] && ($passes < 10)) { $singlechar = fread($fp,1); $serverinfo = $serverinfo . $singlechar; $status = socket_get_status ($fp); $bytes = $status["unread_bytes"]; $serverinfo = $serverinfo . fread($fp, $bytes); if (strstr($serverinfo, '\\final\\\\queryid')) { break; } $passes++; } // The string 'queryid' is at the end of every packet // We need to delete it so parsing will be easier later on $del = "\\queryid\\"; while (strstr($serverinfo, $del)) { // preg_replace seems to be unable to handle backslashes, so... $start = strpos($serverinfo, $del); $left = substr($serverinfo, 0, $start); $right = substr($serverinfo, $start + strlen($del)); $right = substr($right, strpos($right, '\\')); $serverinfo = $left . $right; } // return what the server sent us return $serverinfo; } // // Parse server info and return data as a map / associative array // function ParseServerInfo($serverinfo) { $lines = explode("\n", $serverinfo); $data = explode("\\", $lines[0]); for ($i = 1; $i < count($data); $i+=2) { $name = $data[$i]; $value = $data[$i+1]; $map[$name] = $value; //print "$name = $value\n"; } return $map; } // // Pare module description and return it as a string // TODO: Needs some formatting // function ParseModuleInfo($serverinfo) { // extract module description, part 1 // (everything except last line) $lines = explode("\n", $serverinfo); for ($i = 1; $i < count($lines) - 1; $i++) $moduledesc = $moduledesc . $lines[$i]; // extract module description, part 2 // (extract description part of last line) $lastDescLine = $lines[$i]; $moduledesc = $moduledesc . substr($lastDescLine, 0, strpos($lastDescLine, "\\")); return $moduledesc; } // // Parse player list and return it in a two dimensional, associative array // function ParsePlayerList($serverinfo, $numPlayers) { // parse player list $i=0; while ( ($i < 63) && (count($playerdata) < $numPlayers)) // max 63 players online { $pos_start = strpos($serverinfo, "player_" . $i); if ($pos_start != 0) // player was found { $playerinfo = substr($serverinfo, $pos_start, 144); // umm. yes. that's ugly. //print "<p>player $i info:$playerinfo</p>"; $playerinfo = explode("\\", $playerinfo); $newEntry = count($playerdata); $playerdata[$newEntry]['playername'] = $playerinfo[1]; $playerdata[$newEntry]['type'] = $playerinfo[3]; $playerdata[$newEntry]['charname'] = $playerinfo[5]; $playerdata[$newEntry]['charlevel'] = $playerinfo[7]; } $i++; } return $playerdata; } if (!eregi("modules.php", $PHP_SELF)) { die ("You can't access this file directly..."); } require_once("mainfile.php"); $module_name = basename(dirname(__FILE__)); get_lang($module_name); include("header.php"); $pagesize = 20; OpenTable(); //****************************** $fp=Connect(); $serverinfo = QueryServer($fp); Disconnect($fp); $server = ParseServerInfo($serverinfo); $moduledesc = ParseModuleInfo($serverinfo); $playerdata = ParsePlayerList($serverinfo, $server['numplayers']); /***************************************** * Create HTML output * *****************************************/ if (strlen($server['gamename']) > 0) { // Output server information ?> <div align="center"><b><?php echo $server['hostname']?> Status</b><br> <br> <br> </div> <div align="center"> <table width="90%" border=0 cellpadding="0" cellspacing="0"> <tr> <td width="48%" height="0"><div align="right">Server Status</div></td> <td width="3%"> </td> <td width="49%" height="0">Online @ <?php echo $ipaddr ?>:<?php echo $server['hostport']?></td></tr> <tr> <td width="48%" height="0"><div align="right">Current Players Online</div></td> <td width="3%"> </td> <td width="49%" height="0"><?php echo $server['numplayers']?></td></tr> </table> <?php // Output player information if ($server['numplayers'] > 0) { if ($server['numplayers'] == 1) print "<p>There is one player online.</p>\n"; else print "<p>There are " . $server['numplayers'] . " players online.</p>\n"; ?> <table width="50%" border=0 cellpadding="0" cellspacing="0"> </div> <tr> <th><div align="left">Player</div> </th> <th><div align="left">Character</div> </th> <th><div align="left">Level</div> </th> </tr> <div align="center"> <?php foreach ($playerdata as $player) { print "<tr>\n <td>" . $player['playername'] . "</td>\n"; print " <td>" . $player['charname'] . "</td>\n"; print " <td>" . $player['charlevel'] . "</td>\n</tr>\n"; } print "</table><br>"; } else { print "<p>There are no players online.</p><br>\n"; } } else // server hostname is empty { print "offline</b>. No additional info available, sorry.</p>\n"; } //****************************** CloseTable(); include("footer.php"); ?> </div> [/size]
Comment
-
-
Re: php?
Couple of things. Surely this is part of a larger script, it isn't on its own, do you have other php pages in with this? What's it for?
Generally when you download a script it will have a set of pages including index.php, config.php (to set your server side details) and either an sql file to upload or an install.php that you run and this asks for your database details, you then delete this page after install.
When you install scripts generally the index.php page becomes your home page so there's no integrating as such with html pages etc.
Any respectful script should come with a readme.txt file that tells you exactly what to do
Regards
Paul
Comment
-
-
Re: php?
Just noticed, this is for a nuke site right? Have you got phpnuke, cos it looks like it's to integrate with Nuke.
Paul
Comment
-
Comment