PHP problem (SA-MP panel) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: PHP problem (SA-MP panel) (
/showthread.php?tid=530986)
PHP problem (SA-MP panel) -
ranme15 - 10.08.2014
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 ><
Re: PHP problem (SA-MP panel) -
Faisal_khan - 10.08.2014
I suppose this must be posted to a forum related to PHP or in the general section of this forums.
Re: PHP problem (SA-MP panel) -
CutX - 10.08.2014
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