n/oldblog
Archived
1
0
Fork 0
This repository has been archived on 2024-02-13. You can view files and clone it, but cannot push or open issues or pull requests.
oldblog/liens/admin/testurl.php

79 lines
1.6 KiB
PHP
Raw Normal View History

2023-04-30 21:28:42 +02:00
<?
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 <20> 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>