361 lines
10 KiB
PHP
361 lines
10 KiB
PHP
|
<?
|
||
|
#############################################
|
||
|
# phpDirectory v1.0 #
|
||
|
# #
|
||
|
# Jean-Yves Fort - 21 avril 2001 #
|
||
|
# jean-yves@lozere-online.com #
|
||
|
# #
|
||
|
# Consulter les documents du repertoire #
|
||
|
# /doc pour plus d'informations sur #
|
||
|
# l'installation, l'auteur, les conditions #
|
||
|
# d'utilisation. #
|
||
|
#############################################
|
||
|
?>
|
||
|
<table width=450>
|
||
|
<tr>
|
||
|
<td>
|
||
|
|
||
|
<b>Ajouter un site</b>
|
||
|
<br><br>
|
||
|
|
||
|
<?
|
||
|
if($meta==1)
|
||
|
{include("html/tagimport.php");}
|
||
|
|
||
|
// verification de la saisie du formulaire
|
||
|
|
||
|
if ($add==1) {
|
||
|
|
||
|
$nom=enregistre($nom);
|
||
|
$description=enregistre($description);
|
||
|
$mcles=enregistre($mcles);
|
||
|
|
||
|
if ($nom == "")
|
||
|
{echo "<font color=\"red\">- Saisir le nom du site</font><br>"; $add=0;}
|
||
|
$nom_len=strlen($nom);
|
||
|
if ($nom_len>50)
|
||
|
{echo "<font color=\"red\">- Nom du site trop long (actuellement ".$nom_len." caractères)</font><br>"; $add=0;}
|
||
|
|
||
|
if ($description == "")
|
||
|
{echo "<font color=\"red\">- Saisir la description du site</font><br>"; $add=0;}
|
||
|
$des_len=strlen($description);
|
||
|
if ($des_len>100)
|
||
|
{echo "<font color=\"red\">- Description trop longue (actuellement ".$des_len." caractères)</font><br>"; $add=0;}
|
||
|
|
||
|
if ($mcles == "")
|
||
|
{echo "<font color=\"red\">- Saisir les mots clés décrivant le mieux votre site</font><br>"; $add=0;}
|
||
|
$mcles_len=strlen($mcles);
|
||
|
if ($mcles_len>250)
|
||
|
{echo "<font color=\"red\">- Trop de mots clés (actuellement ".$mcles_len." caractères)</font><br>"; $add=0;}
|
||
|
|
||
|
|
||
|
if (($url == "")||($url == "http://"))
|
||
|
{echo "<font color=\"red\">- Saisir l'URL du site</font><br>"; $add=0;}
|
||
|
|
||
|
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.[a-z]{2,3}$", $email))
|
||
|
{echo "<font color=\"red\">- Email non valide</font><br>"; $add=0;}
|
||
|
|
||
|
$link = mysql_connect($host,$user,$password);
|
||
|
$requete_url=mysql_db_query($base,"select id, url from ".$basesites." where url LIKE \"$url\"
|
||
|
",$link);
|
||
|
$num_url=mysql_num_rows($requete_url);
|
||
|
if ($num_url!=0)
|
||
|
{echo "<font color=\"red\">- Un site est déjà enregistré à cette adresse</font><br>"; $add=0;}
|
||
|
|
||
|
}
|
||
|
|
||
|
if ($add==1) {
|
||
|
|
||
|
echo "Votre site a été enregistré dans la liste d'attente. Il sera prochainement visité et éventuellememt ajouté à l'annuaire.";
|
||
|
|
||
|
mysql_db_query($base,"insert into ".$basesites." (nomsite, url, description, mcles, email, date, cat1, cat2, cat3) values('".$nom."', '".$url."', '".$description."', '".$mcles."', '".$email."', NOW(), '".$c."', '".$cs1."', '".$cs2."')",$link);
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (!isset($c))
|
||
|
{
|
||
|
echo "Pour ajouter un site web, allez dans la catégorie correspondante au thême du site et à ce moment là cliquez sur <i>Ajouter un site</i>.<br><br><a href=\"index.php\">Retour</a>";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
|
||
|
$link = mysql_connect($host,$user,$password);
|
||
|
|
||
|
|
||
|
|
||
|
if (isset ($csup))
|
||
|
{
|
||
|
// formulaire
|
||
|
if ($url=="") {$url="http://";}
|
||
|
echo "
|
||
|
<form action=\"index.php\" method=\"post\">
|
||
|
<input type=\"hidden\" name=\"m\" value=\"a\">
|
||
|
<input type=\"hidden\" name=\"c\" value=".$c.">
|
||
|
<input type=\"hidden\" name=\"cs1\" value=".$cs1.">
|
||
|
<input type=\"hidden\" name=\"cs2\" value=".$cs2.">
|
||
|
<input type=\"hidden\" name=\"csup\" value=1>
|
||
|
<input type=\"hidden\" name=\"add\" value=1>
|
||
|
<table>
|
||
|
<tr>
|
||
|
<td width=100% valign=top>Nom du site<br>(50 caractères max.)</td>
|
||
|
<td><TEXTAREA WRAP=\"physical\" NAME=\"nom\" COLS=30 ROWS=3>".stripslashes($nom)."</TEXTAREA></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td width=100% valign=top>Description<br>(100 caractères max.)</td>
|
||
|
<td><TEXTAREA WRAP=\"physical\" NAME=\"description\" COLS=30 ROWS=3>".stripslashes($description)."</TEXTAREA></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<tr>
|
||
|
<td width=100% valign=top>Mots clés<br>(250 caractères max.)</td>
|
||
|
<td><TEXTAREA WRAP=\"physical\" NAME=\"mcles\" COLS=30 ROWS=5>".stripslashes($mcles)."</TEXTAREA>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td width=100%>URL (http://...)</td>
|
||
|
<td><INPUT TYPE=\"text\" NAME=\"url\" SIZE=30 VALUE=\"".$url."\" MAXLENGTH=100></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td width=100%>Email</td>
|
||
|
<td><INPUT TYPE=\"text\" NAME=\"email\" SIZE=30 VALUE=\"".$email."\" MAXLENGTH=100></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td colspan=2 align=\"right\"><br><INPUT TYPE=\"submit\" value=\"Soumettre\"></form></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td colspan=2>
|
||
|
<form action=\"index.php\">Importer les meta-tag de l'URL:
|
||
|
<INPUT TYPE=\"text\" NAME=\"url\" VALUE=\"".$url."\" SIZE=30 MAXLENGTH=100>
|
||
|
<input type=\"hidden\" name=\"m\" value=\"a\">
|
||
|
<input type=\"hidden\" name=\"c\" value=".$c.">
|
||
|
<input type=\"hidden\" name=\"cs1\" value=".$cs1.">
|
||
|
<input type=\"hidden\" name=\"cs2\" value=".$cs2.">
|
||
|
<input type=\"hidden\" name=\"csup\" value=1>
|
||
|
<input type=\"hidden\" name=\"add\" value=0>
|
||
|
<input type=\"hidden\" name=\"meta\" value=1></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td colspan=2 align=\"right\"><INPUT TYPE=\"submit\" value=\"Importer\"></td>
|
||
|
</tr>
|
||
|
</form>
|
||
|
</table>
|
||
|
";
|
||
|
}
|
||
|
|
||
|
|
||
|
else
|
||
|
{
|
||
|
// choix des categories
|
||
|
$x=0;
|
||
|
$i=0;
|
||
|
$requete=mysql_db_query($base,"select * from ".$basecat." where id=".$c." ",$link);
|
||
|
|
||
|
$nomcat = mysql_result($requete,$i,"nomcat");
|
||
|
$nomcat=lire($nomcat);
|
||
|
$id = mysql_result($requete,$i,"id");
|
||
|
$idsubcat = mysql_result($requete,$i,"idsubcat");
|
||
|
|
||
|
$varid[$x]=$id;
|
||
|
$varnom[$x]=$nomcat;
|
||
|
|
||
|
echo "Votre site sera ajouté dans la catégorie:<br>accueil";
|
||
|
|
||
|
if($idsubcat!=0)
|
||
|
{
|
||
|
$x=1;
|
||
|
|
||
|
while($idsubcat!=0)
|
||
|
{
|
||
|
$requete2=mysql_db_query($base,"select nomcat, id, idsubcat from $basecat where id=".$idsubcat." ",$link);
|
||
|
|
||
|
$nomcat = mysql_result($requete2,$i,"nomcat");
|
||
|
$nomcat=lire($nomcat);
|
||
|
$id = mysql_result($requete2,$i,"id");
|
||
|
$idsubcat = mysql_result($requete2,$i,"idsubcat");
|
||
|
|
||
|
$varid[$x]=$id;
|
||
|
$varnom[$x]=$nomcat;
|
||
|
$x++;
|
||
|
}
|
||
|
|
||
|
$x=$x-1;
|
||
|
}
|
||
|
|
||
|
while($x!=-1)
|
||
|
{
|
||
|
echo " > ";
|
||
|
if ($varnom[$x]==$varnom[0]) { echo "<b><font color=\"red\">"; }
|
||
|
echo "".$varnom[$x]."";
|
||
|
if ($varnom[$x]==$varnom[0]) { echo "</font></b>"; }
|
||
|
$x=$x-1;
|
||
|
}
|
||
|
|
||
|
echo "<br><br>Si nécessaire, vous pouvez proposer deux catégories supplémentaires:<hr>";
|
||
|
|
||
|
if (isset($cs1)) {}
|
||
|
else {$cs1=0;}
|
||
|
if (isset($cs2)) {}
|
||
|
else {$cs2=0;}
|
||
|
|
||
|
// choix catsup 1
|
||
|
echo "1 - Catégorie supplémentaire:<br>";
|
||
|
if ($cs1!=0)
|
||
|
{
|
||
|
// arborescence en ligne
|
||
|
echo "<a href=\"index.php?m=a&c=".$c."&cs1=0&cs2=".$cs2."\">accueil</a>";
|
||
|
$x=0;
|
||
|
$i=0;
|
||
|
$requete3=mysql_db_query($base,"select * from ".$basecat." where id=".$cs1." ",$link);
|
||
|
|
||
|
$nomcat = mysql_result($requete3,$i,"nomcat");
|
||
|
$nomcat=lire($nomcat);
|
||
|
$id = mysql_result($requete3,$i,"id");
|
||
|
$idsubcat = mysql_result($requete3,$i,"idsubcat");
|
||
|
|
||
|
$varid[$x]=$id;
|
||
|
$varnom[$x]=$nomcat;
|
||
|
|
||
|
|
||
|
|
||
|
if($idsubcat!=0)
|
||
|
{
|
||
|
$x=1;
|
||
|
|
||
|
while($idsubcat!=0)
|
||
|
{
|
||
|
$requete4=mysql_db_query($base,"select nomcat, id, idsubcat from $basecat where id=".$idsubcat." ",$link);
|
||
|
|
||
|
$nomcat = mysql_result($requete4,$i,"nomcat");
|
||
|
$nomcat=lire($nomcat);
|
||
|
$id = mysql_result($requete4,$i,"id");
|
||
|
$idsubcat = mysql_result($requete4,$i,"idsubcat");
|
||
|
|
||
|
$varid[$x]=$id;
|
||
|
$varnom[$x]=$nomcat;
|
||
|
$x++;
|
||
|
}
|
||
|
|
||
|
$x=$x-1;
|
||
|
}
|
||
|
while($x!=-1)
|
||
|
{
|
||
|
echo " > <a href=\"index.php?m=a&c=".$c."&cs1=".$varid[$x]."&cs2=".$cs2."\"> ";
|
||
|
if ($varnom[$x]==$varnom[0]) { echo "<b><font color=\"red\">"; }
|
||
|
echo "".$varnom[$x]."";
|
||
|
if ($varnom[$x]==$varnom[0]) { echo "</font></b>"; }
|
||
|
$x=$x-1;
|
||
|
echo "</a>";
|
||
|
}
|
||
|
}
|
||
|
else {}
|
||
|
|
||
|
// affichage des souscategories
|
||
|
|
||
|
$requete5=mysql_db_query($base,"select id, nomcat from ".$basecat." where idsubcat=".$cs1." ",$link);
|
||
|
$num5=mysql_num_rows($requete5);
|
||
|
|
||
|
if($num5!=0)
|
||
|
{
|
||
|
$i=0;
|
||
|
while ( $i<$num5 )
|
||
|
{
|
||
|
$nomcat5 = mysql_result($requete5,$i,"nomcat");
|
||
|
$nomcat5=lire($nomcat5);
|
||
|
$id5 = mysql_result($requete5,$i,"id");
|
||
|
echo "<li><a href=\"index.php?m=a&c=".$c."&cs1=".$id5."&cs2=".$cs2."\">".$nomcat5."</a>";
|
||
|
$i++;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// choix catsup 2
|
||
|
echo "<hr>2 - Catégorie supplémentaire:<br>";
|
||
|
if ($cs2!=0)
|
||
|
{
|
||
|
// arborescence en ligne
|
||
|
echo "<a href=\"index.php?m=a&c=".$c."&cs1=".$cs1."&cs2=0\">accueil</a>";
|
||
|
$x=0;
|
||
|
$i=0;
|
||
|
$requete6=mysql_db_query($base,"select * from ".$basecat." where id=".$cs2." ",$link);
|
||
|
|
||
|
$nomcat = mysql_result($requete6,$i,"nomcat");
|
||
|
$nomcat=lire($nomcat);
|
||
|
$id = mysql_result($requete6,$i,"id");
|
||
|
$idsubcat = mysql_result($requete6,$i,"idsubcat");
|
||
|
|
||
|
$varid[$x]=$id;
|
||
|
$varnom[$x]=$nomcat;
|
||
|
|
||
|
|
||
|
|
||
|
if($idsubcat!=0)
|
||
|
{
|
||
|
$x=1;
|
||
|
|
||
|
while($idsubcat!=0)
|
||
|
{
|
||
|
$requete7=mysql_db_query($base,"select nomcat, id, idsubcat from $basecat where id=".$idsubcat." ",$link);
|
||
|
|
||
|
$nomcat = mysql_result($requete7,$i,"nomcat");
|
||
|
$nomcat=lire($nomcat);
|
||
|
$id = mysql_result($requete7,$i,"id");
|
||
|
$idsubcat = mysql_result($requete7,$i,"idsubcat");
|
||
|
|
||
|
$varid[$x]=$id;
|
||
|
$varnom[$x]=$nomcat;
|
||
|
$x++;
|
||
|
}
|
||
|
|
||
|
$x=$x-1;
|
||
|
}
|
||
|
|
||
|
while($x!=-1)
|
||
|
{
|
||
|
|
||
|
echo " > <a href=\"index.php?m=a&c=".$c."&cs1=".$cs1."&cs2=".$varid[$x]."\"> ";
|
||
|
if ($varnom[$x]==$varnom[0]) { echo "<b><font color=\"red\">"; }
|
||
|
echo "".$varnom[$x]."";
|
||
|
if ($varnom[$x]==$varnom[0]) { echo "</font></b>"; }
|
||
|
$x=$x-1;
|
||
|
echo "</a>";
|
||
|
|
||
|
}
|
||
|
}
|
||
|
else {}
|
||
|
|
||
|
// affichage des souscategories
|
||
|
|
||
|
$requete8=mysql_db_query($base,"select id, nomcat from ".$basecat." where idsubcat=".$cs2." ",$link);
|
||
|
$num8=mysql_num_rows($requete8);
|
||
|
|
||
|
if ($num8!=0)
|
||
|
{
|
||
|
$i8=0;
|
||
|
while ( $i8<$num8 )
|
||
|
{
|
||
|
$nomcat8 = mysql_result($requete8,$i8,"nomcat");
|
||
|
$nomcat8=lire($nomcat8);
|
||
|
$id8 = mysql_result($requete8,$i8,"id");
|
||
|
echo "<li><a href=\"index.php?m=a&c=".$c."&cs1=".$cs1."&cs2=".$id8."\">".$nomcat8."</a>";
|
||
|
$i8++;
|
||
|
}
|
||
|
}
|
||
|
echo "<hr>
|
||
|
<form action=\"index.php\" method=\"post\">
|
||
|
<input type=\"hidden\" name=\"m\" value=\"a\">
|
||
|
<input type=\"hidden\" name=\"c\" value=".$c.">
|
||
|
<input type=\"hidden\" name=\"cs1\" value=".$cs1.">
|
||
|
<input type=\"hidden\" name=\"cs2\" value=".$cs2.">
|
||
|
<input type=\"hidden\" name=\"csup\" value=1>
|
||
|
<table width=100%>
|
||
|
<td align=\"right\"><INPUT TYPE=\"submit\" value=\"Valider ce choix >>\"></td>
|
||
|
</table>
|
||
|
</form>";
|
||
|
|
||
|
}
|
||
|
|
||
|
}}?>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|