La premiere des choses que j'ai faite c'est de regarde si ssh était bien activé dans php.. J'ai retrouve les lignes suivantes donc je pense que c'est bon.
Code : Tout sélectionner
Registered PHP Streams https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, zip, ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp Code : Tout sélectionner
#!/bin/sh
screen -l -AmdS serv1 taskset -c 1 /opt/server_cs/hlds_run -game cstrike +ip 88.190.19.180 -port 27015 +maxplayers 12 -pingboost 3 +map de_dust2 +sys_ticrate 1020
Voila ma page
Code : Tout sélectionner
<?php
require_once('connexion.php');
session_start();
if (isset($_SESSION['authentification']) && isset($_SESSION['privilege']) == "user"){
}
else {
header("Location:index.php?erreur=intru"); // redirection en cas d'echec
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<title>Panel M's server</title>
<link rel="stylesheet" media="screen" type="text/css" title="Design" href="design.css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<p>
Utilisateur <?php echo $_SESSION['login']; ?>
</p>
<?php
$connection = ssh2_connect('************, 22);
ssh2_auth_password($connection, '*****', '******');
if ($_SESSION['login'] == "serv1")
{
$stream = ssh2_exec($connection, "/bin/sh /opt/server_cs/up.sh");
echo 'test';
}
else
{
header("Location:index.php?erreur=intru");
}
?>
</body>
</html>