Need Help Regarding php files
#1

Hello,

I Have Just download a SAMP Server manage system
at the moment im testing it at Home not on website..................

it have 2 .php files and when i linked like : <li><a href="server.php">Server Info</a></li>
It just opens the php file :
PHP код:
<center><?php
require "samp_query.php";
$serverIP "5.39.11.61";
$serverPort 7777;
try
{
        
$rQuery = new QueryServer$serverIP$serverPort );
        
$aInformation  $rQuery->GetInfo( );
        
$aServerRules  $rQuery->GetRules( );
        
$aBasicPlayer  $rQuery->GetPlayers( );
        
$aTotalPlayers $rQuery->GetDetailedPlayers( );
        
$rQuery->Close( );
}
catch (
QueryServerException $pError)
{
       echo 
"Oops! Server Is Currently Offline We'll Be Back Soon. Thanks For Waiting :)";
}
if(isset(
$aInformation) && is_array($aInformation)){
?>
    <b>Server Stats/Information.</b>
    <table width="400">
            <tr>
                    <td>Server Name</td>
                    <td><?php echo htmlentities($aInformation['Hostname']); ?></td>
            </tr>
            <tr>
                    <td>Gamemode</td>
                    <td><?php echo htmlentities($aInformation['Gamemode']); ?></td>
            </tr>
            <tr>
                    <td>Players</td>
                    <td><?php echo $aInformation['Players']; ?> / <?php echo $aInformation['MaxPlayers']; ?></td>
            </tr>
            <tr>
                    <td>Mapname</td>
                    <td><?php echo htmlentities($aInformation['Map']); ?></td>
            </tr>
            <tr>
                    <td>Weather</td>
                    <td><?php echo $aServerRules['weather']; ?></td>
            </tr>
            <tr>
                    <td>World Time</td>
                    <td><?php echo $aServerRules['worldtime']; ?></td>
            </tr>
            <tr>
                    <td>SA:MP Server Version</td>
                    <td><?php echo $aServerRules['version']; ?></td>
            </tr>
            <tr>
                    <td>Password</td>
                    <td><?php echo $aInformation['Password'] ? 'Yes' 'No'?></td>
            </tr>
    </table>
    <br />
    <b>Online Players</b>
    <?php
    
if(!is_array($aTotalPlayers) || count($aTotalPlayers) == 0){
            echo 
'<br /><i>None</i>';
    } else {
    
?>
        <table width="400">
                <tr>
                        <td><b>Player ID</b></td>
                        <td><b>Nickname</b></td>
                        <td><b>Score</b></td>
                        <td><b>Ping</b></td>
                </tr>
        <?php
        
foreach($aTotalPlayers AS $id => $value){
        
?>
                <tr>
                        <td><?php echo $value['PlayerID']; ?></td>
                        <td><?php echo htmlentities($value['Nickname']); ?></td>
                        <td><?php echo $value['Score']; ?></td>
                        <td><?php echo $value['Ping']; ?></td>
                </tr>
        <?php
        
}
    
        echo 
'</table>';
    }
}
?>
<p>Copyright © 2011 GTA Gaming Playground - Scripted By<a href="http://www.viswanathkeerthi.me/">Viswanath Keerthi</a></p></center>
Hope anyone Help me !
Thanks
Reply
#2

You have to run the php files on a php compatible webserver, its not like html where you can just browse it locally. If you want to set up something quick and easy on your home computer then you could try XAMPP or sign up for some free webhosting and test it on that.
Reply
#3

You need PHP installed on the webserver, if you are hosting it on your own machine, then download WAMP(for Windows), LAMP(for Linux) or MAMP(for Mac). Once downloaded and installed go to the drive you installed it in and open up "wamp" folder. Then, go to the "www" folder and put those two files there. Run wamp and access those pages by going into your browser and typing "localhost/server.php" in the URL bar.
Reply
#4

i have hosting from Volt. SO where i need to put the both .php files in >?
Reply
#5

Quote:
Originally Posted by Avi57
Посмотреть сообщение
i have hosting from Volt. SO where i need to put the both .php files in >?
Upload those files to your web-server and run them from your domain. Otherwise, I'd recommend you to go for XAMPP or WAMP that would help you test stuff on your local machine.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)