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/html/add.php

361 lines
10 KiB
PHP
Raw Permalink Normal View History

2023-04-30 21:28:42 +02:00
<?
#############################################
# 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&egrave;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&egrave;res)</font><br>"; $add=0;}
if ($mcles == "")
{echo "<font color=\"red\">- Saisir les mots cl&eacute;s d&eacute;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&eacute;s (actuellement ".$mcles_len." caract&egrave;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&eacute;j&agrave enregistr&eacute; &agrave cette adresse</font><br>"; $add=0;}
}
if ($add==1) {
echo "Votre site a &eacute;t&eacute; enregistr&eacute; dans la liste d'attente. Il sera prochainement visit&eacute; et &eacute;ventuellememt ajout&eacute; &agrave 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&eacute;gorie correspondante au th&ecirc;me du site et &agrave; ce moment l&agrave; 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&egrave;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&egrave;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&eacute;s<br>(250 caract&egrave;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&eacute; dans la cat&eacute;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&eacute;cessaire, vous pouvez proposer deux cat&eacute;gories suppl&eacute;mentaires:<hr>";
if (isset($cs1)) {}
else {$cs1=0;}
if (isset($cs2)) {}
else {$cs2=0;}
// choix catsup 1
echo "1 - Cat&eacute;gorie suppl&eacute;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&eacute;gorie suppl&eacute;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>