78 lines
1.6 KiB
PHP
78 lines
1.6 KiB
PHP
<?
|
|
require("../conf/db.php");
|
|
$link = mysql_connect($host,$user,$password);
|
|
?>
|
|
<html><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
|
|
<body>
|
|
<?php
|
|
|
|
function checkurl($url)
|
|
{
|
|
if ( $url )
|
|
{
|
|
|
|
if (!ereg("http://", $url))
|
|
return false;
|
|
|
|
urlencode($url);
|
|
|
|
$file = @fopen("$url", "r");
|
|
|
|
if (!$file)
|
|
$file = @fopen("$url/","r");
|
|
|
|
if ( $file )
|
|
{
|
|
@fclose($file);
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
$nliens=0;
|
|
echo "<a href=\"index.php\">Retour</a>";
|
|
echo "<h2>Administration - Liens à vérifier</h2>";
|
|
echo "<HR>";
|
|
echo "<ul>";
|
|
$requeteliens=mysql_db_query($base,"select nomsite, url, id, cat1 from ".$basesites." order by nomsite",$link);
|
|
$numliens=mysql_num_rows($requeteliens);
|
|
if ($numliens==0)
|
|
{
|
|
echo "Tous les sites sont valides.";
|
|
}
|
|
else
|
|
{
|
|
while ( $nliens<$numliens )
|
|
{
|
|
$nomsite = mysql_result($requeteliens,$nliens,"nomsite");
|
|
$id = mysql_result($requeteliens,$nliens,"id");
|
|
$url = mysql_result($requeteliens,$nliens,"url");
|
|
$cat = mysql_result($requeteliens,$nliens,"cat1");
|
|
|
|
if(checkurl($url)==false)
|
|
{
|
|
$requetevalid=mysql_db_query($base,"update ".$basesites." set valid=0 where id=".$id."",$link);
|
|
echo "<li><a href=\"".$url."\">".$nomsite."</a> - [<a href=\"index.php?c=".$cat."\"><font size=1>Voir dans l'annuaire</font></a>]";
|
|
}
|
|
|
|
|
|
$nliens++;
|
|
}
|
|
}
|
|
|
|
|
|
?>
|
|
</ul>
|
|
|
|
|
|
</body>
|
|
</html>
|