View Single Post
  #10  
Old 02.01.2011, 00:47
andy23
Guest
 
Posts: n/a
Default

Ainsi que celui-ci:

<?php
// Configuration
$ip = "192.168.1.1";
$user = "admin";
$password = "admin";
// Fin Configuration

$url = "**External links are only visible to Support Staff**.$ip."/SubmitInternetService";
$login = $user.":".$password;
$action = Array("ACTION_CONNECT","ACTION_DISCONNECT","reconnect");
if(!isset($_GET['action']) || !in_array($_GET['action'],$action) ) {
?>
<html>
<head>
<title>Livebox Sagem: Connection Manager</title>
</head>
<body>

<form method='get' action='connect.php'>
<p>Que souhaitez vous faire ?</p>
<ul style='list-style-type:none;'>
<li><input type='radio' name='action' value='ACTION_CONNECT' /> Me connecter</li>
<li><input type='radio' name='action' value='ACTION_DISCONNECT' /> Me déconnecter</li>
<li><input type='radio' name='action' value='reconnect' /> Me reconnecter</li>
<li><input type='submit' name='submit' /></li>
</form>
</body>
</html>





<?php

}
elseif($_GET['action'] == "ACTION_CONNECT" || $_GET['action'] == "ACTION_DISCONNECT") {

if($_GET['action'] == "ACTION_CONNECT") $val = "Connecter";
else $val = "Déconnecter";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERPWD, $login);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, array($_GET['action'] => $val));
curl_exec($ch);
curl_close($ch);

echo $val;

}
else {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERPWD, $login);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, array("ACTION_DISCONNECT" => "Déconnecter"));
curl_exec($ch);
curl_close($ch);


echo "<br />Déconnexion: <b>OK</b>";
sleep(1);
echo "<br />Reconnexion dans 10 secondes";
for($i = 0; $i<5;$i++) {
echo ".";
sleep(2);
}

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERPWD, $login);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, array("ACTION_CONNECT" => "Connecter"));
curl_exec($ch);
curl_close($ch);

echo "<br />Connexion: <b>OK</b>";
}
?>