Voici mon code:
Code :
<?php
$host = "localhost";
$user = "secret";
$password = "secret";
$bdd = "gameshots";
mysql_connect($host, $user, $password) or die ("Connexion au serveur impossible");
mysql_select_db($bdd) or die ("AYOYE!!! Erreur de connexion à la bd.");
if (!$password) {
echo "
<p>\n
<table bgcolor=#EFF2FB border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=100%>\n
<tr><td>\n
<a name=\"#auth\"><h2>Authentification!</h2></a>\n
</td></tr>\n
</table>\n
<p>\n
Veuillez fournir votre identifiant:<p>\n
<form action=\"scan.php3\" method=\"post\">\n
<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n
<tr>\n
<td>Nom d'utilisateur:</td><td><input type=text size=\"30\" name=\"user\"></td>\n
</tr>\n
<tr>\n
<td>Mot de passe:</td><td><input type=password size=\"20\" name=\"password\"></td>\n
</tr>\n
<tr>\n
<td colspan=\"2\"><input type=submit value=\"Go!\"></td>\n
</tr>\n
</table>\n
</form>\n";
}
else{
echo "
<p>\n
<table bgcolor=#EFF2FB border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=100%>\n
<tr><td>\n
<a name=\"#index\"><h2>Indexation du site en cours</h2></a>\n
</td></tr>\n
</table>\n
<p>\n";
$host = "localhost";
$bdd = "gameshots";
/* Connexion avec MySQL */
mysql_connect($host,$user,$password) or die ("Impossible de se connecter
au serveur de base de donnees");
mysql_select_db($bdd) or die ("Impossible d'accéder à la base $bdd");
$query = "DELETE FROM search";
mysql_query($query) or die ("Erreur de modification de la table");
function ScanDir($Directory,$Courant){
$MyDirectory = opendir($Directory);
while($Entry = readdir($MyDirectory)) {
if(is_dir($Entry)&& $Entry != "." && $Entry != "..") {
ScanDir($Entry,$Courant.$Entry."/");
}
else {
if (eregi(".htm",$Entry)){
$MetaTags = get_meta_tags($Directory."/".$Entry);
if ($MetaTags["robots"] == "all") {
$MetaKey = $MetaTags["keywords"];
$MetaKey = strtoupper($MetaKey);
echo "Meta($Directory/$Entry): $MetaKey\n";
$MetaTitre = $MetaTags["title"];
echo "Meta($Directory/$Entry): $MetaTitre\n";
$query = "INSERT INTO reviews (lien,keyword,titre)
VALUES(\"$Directory/$Entry\",\"$MetaKey\",\"$MetaTitre\")";
$mysql_result = mysql_query($query) or die ("Erreur
de modification de la table par la requete \"$query\"");
}
}
}
}
closedir($MyDirectory);
}
$open_basedir=".";
ScanDir(".","");
mysql_close();
}
?>
Merci!!!