PHP problem (SA-MP panel)
#1

Hello,

I am trying to make 'Start' image to start my sa-mp hosted server, but instead of doing the linux command it sends me to "loginfail.php" page. Here is the code:
PHP код:
<body>
<?php
    
include("connect.php");
    include(
'Net/SSH2.php');
        *** 
CONNECTION TO DATABASE MYSQL CODE ***
    if(
mysql_num_rows($result) > 0)
    {
        while(
$row mysql_fetch_array($result))
        {
            
$_SESSION['logged'] = true;
            
$ssh = new Net_SSH2('xx.xx.xx.xx');
            if (!
$ssh->login($info['username'], $info['password'])) 
            {
                exit(
'Connection to Linux has failed, please try again.');
            }
            echo 
'<form action="" method="GET">';
            echo 
'<input type="image" src="start.png" width=100 height=100 name="start" />';
            echo 
'</form>';
            if(isset(
$_GET['start'])) 
            {
                echo 
$ssh->setTimeout(5);
                echo 
$ssh->exec('(cd '.$info['username'].' ; nohup ./samp03svr &)');
            }
        }
    }
    else
    {
        
$_SESSION['logged'] = null;
        
header("Location: loginfail.php");
    }
?>
</body>
I repeat, it sends me to "loginfail.php" when I click the "Start" image.
I would like to have some help here ><
Reply
#2

I suppose this must be posted to a forum related to PHP or in the general section of this forums.
Reply
#3

i'd say check your mysql
you say that it sends you to "loginfail.php" that'd be the case if
your first control structure (if(mysql_num_rows($result) > 0) ) equals false.
it seems like there isn't anything in $result
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)