<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<head>
<title>Efface SQL</title>
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
<meta http-equiv="Expires" content="0" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<body>
<?php
// bts2m.free.fr/Wifi/VI_raz.php?table=1
//--Connexion au serveur
define("NOM","tpil.projet"); //nom = login chez free
define("PASSE","MotDePasse"); // passe=votre mot de passe free
define("SERVEUR","sql.free.fr"); // adresse du serveur free
$link = mysql_connect(SERVEUR,NOM,PASSE);
$table='mesures';
$titre='mesuresTitre';
if(!$link) {echo"Impossible de se connecter au serveur".mysql_error();exit;}
else {echo "<h2>Connexion au serveur réussie !</h2>\n";}
if (isset($_GET['table'])) {
$table='mesures'.$_GET['table'];
$titre='mesuresTitre'.$_GET['table'];
echo "<p>Table : ".$table." Titre : ".$titre."</p>\n";
}
mysql_select_db($table,$link);
$requete = "TRUNCATE TABLE ".$table;
if (!mysql_query($requete, $link)) {
echo "<p>Requête : ".$requete."</p>";
echo "<p>Echec !\n".mysql_error()."</p>";exit;}
echo "<p>Requête : ".$requete."</p>";
mysql_close($link);
?>
</body>
</html>