Web Hosting Vodahost    

Home Take The Royal Tour! Order Now Features Prices
Go Back   Web Hosting > VodaHost Web Hosting Support > mySQL & PHP

Notices

mySQL & PHP Discussions, information and help with mySQL and PHP.

Reply
 
LinkBack Thread Tools
  #1  
Old 11-26-2005, 02:36 PM
Private
 
Join Date: Nov 2005
Posts: 2
Default php?

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2  
Old 11-26-2005, 02:47 PM
VodaHost's Avatar
General & Forum Administrator
 
Join Date: Mar 2005
Location: Wilmington, Delaware USA
Posts: 8,577
Default Re: php?

click the below...

http://www.vodahost.com/vodatalk/mysql-php/2669-how-do-i-insert-php.html
__________________
VodaHost
Your Website People!
1-302-283-3777 North America / International
07092887580 / United Kingdom

Military Ranking System Explained


Click Here to take the royal VodaHost Tour
Click Here for the VodaHost Help Centre & Tutorials
Got a question? - Try a forum search! Available at the top of every page!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old 11-26-2005, 02:54 PM
Private
 
Join Date: Nov 2005
Posts: 2
Default Re: php?

Great! thanks that will help. but its not helping right now lol I have this script/mod
Code:
 
<?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%">&nbsp;</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%">&nbsp;</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>
 
kinda long sorry, but when i add it in as html then go to page properties and set the page extension up as php then preview the site it just has all the text running down the page. so how would I add something like this to my main page?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old 11-26-2005, 11:53 PM
paulb's Avatar
Master Sergeant
 
Join Date: Aug 2005
Location: UK
Posts: 68
Default 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old 11-26-2005, 11:58 PM
paulb's Avatar
Master Sergeant
 
Join Date: Aug 2005
Location: UK
Posts: 68
Default 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 03:19 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC7
2005-2009 VodaHost Web Hosting Your Perfect Web Host - All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176