Starting Server
#10

Quote:
Originally Posted by SchurmanCQC
Посмотреть сообщение
PHP код:
<?php 
if( isset( $_REQUEST['start'] ))  
{  
    
StartServer(); 
    echo 
"<script type='text/javascript'>alert('Server Started');</script>"; 
}
function 
StartServer() 
{ 
    
$connection = ssh2_connect("178.63.193.38", 22); 
    
ssh2_auth_password($connection, "purerp", "teeheeilikepie"); 
    
ssh2_exec($connection, 'cd /home/purerp/samp'); 
    
ssh2_exec($connection, './samp03svr'); 
} 
?> 
<form> 
<input type="submit" name="start" value="Start Server" /> 
<input type="submit" name="start" value="Stop Server" /> 
</form>
Try that
Good job!, let me just correct you with a small thing

PHP код:
<?php  
if( isset( $_REQUEST['start'] ))   
{   
    
StartServer();  
    echo 
"<script type='text/javascript'>alert('Server Started');</script>";  
} 
function 
StartServer()  
{  
    
$connection = ssh_connect("178.63.193.38", 22); // when you connect it should always be ssh even if its the same definition.
    
ssh2_auth_password($connection, "purerp", "teeheeilikepie");  
    
ssh2_exec($connection, 'cd /home/purerp/samp');  
    
ssh2_exec($connection, './samp03svr');  
}  
?>  
<form>  
<input type="submit" name="start" value="Start Server" />  
<input type="submit" name="start" value="Stop Server" />  
</form>
Reply


Messages In This Thread
Starting Server - by Mattakil - 03.02.2014, 03:49
Re: Starting Server - by Wizz123 - 03.02.2014, 09:20
Re: Starting Server - by Mattakil - 03.02.2014, 19:49
Re: Starting Server - by Vince - 03.02.2014, 20:09
Re: Starting Server - by Wizz123 - 03.02.2014, 20:16
Re: Starting Server - by Mattakil - 03.02.2014, 20:49
Re: Starting Server - by Mattakil - 03.02.2014, 23:03
Re: Starting Server - by SchurmanCQC - 03.02.2014, 23:05
Re: Starting Server - by San1 - 04.02.2014, 03:59
Re: Starting Server - by Wizz123 - 04.02.2014, 09:13

Forum Jump:


Users browsing this thread: 1 Guest(s)