Mahfoud - 2010-12-01 18:38:36
Hello, I found this script on the internet, but the code
admin does not work, there is a mistake, and I'm
a beginner ...
Thank you for your help
<?
session_start();
#----------------------------------------------------------------------------------------
# Glossaire 2.0 - Avril 2005
# David Bourrier (david@pixland.net)
# http://scripts.pixland.net
#----------------------------------------------------------------------------------------
require ("config/conf.inc.php");
require ("functions.php");
include ("header.php");
# Vérif des variables de session --------------------------------------------------------
if (!session_is_registered("nom") && !session_is_registered("pass"))
{
if(isset($_GET['action']))
{
if($_GET['action']=="register")
{
if($_POST['nom']==$nom_admin && $_POST['pass']==$pass_admin)
{
session_register("nom");
session_register("pass");
}
else echo "<span class=\"erreur\">Le nom et/ou le mot de passe sont incorrects.</span><br/><br/>";
}
}
}
if (!session_is_registered("nom") && !session_is_registered("pass"))
{
# Formulaire de connexion --------------------------------------------------------------
?>
Veuillez vous connecter :<br><br>
<form name="identification" method="post" action="admin.php?action=register">
<table id="tab-resultats">
<tr>
<td width="48" height="25">Login :
<br></td>
<td width="195"><input name="nom" type="text" id="nom3" size="20" maxlength="20"></td>
</tr>
<tr>
<td height="25">Pass :</td>
<td><input name="pass" type="password" id="pass2" size="20" maxlength="10"></td>
</tr>
<tr>
<td height="25"> </td>
<td><input type="submit" name="Submit" value="Ok"></td>
</tr>
</table>
</form>
<br/><br/><a href="glossaire.php">Retour au glossaire</a>
<?
}
else
{
# Si connexion ok on affiche le formulaire ---------------------------------------------
sql_connect();
?>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<?
if($user_add==1)
{
?>
<tr>
<td id="tab-admin-rubrique">Définitions ajoutées par les utilisateurs : </td>
</tr>
<tr>
<td>
<?
show_users_def();
?>
</td>
</tr>
<?
}
?>
<tr>
<td id="tab-admin-rubrique">Gestion des définitions : </td>
</tr>
<tr>
<td>
<form action="admin.php" method="post">
Mot :<br/><input type="text" name="word" size="30">
<br/><br/>Action : <br/>
<label><input type="radio" name="action" value="1" checked>Ajouter</label><br/><label><input type="radio" name="action" value="2">Modifier</label><br><label><input type="radio" name="action" value="3">Supprimer</label>
<br/><br/>Définition : <br/><textarea name="definition" cols="40" rows="5" wrap="VIRTUAL"></textarea><br/>
<input type="submit" value="Ok" name="Envoyer">
</form>
</td>
</tr>
</table>
<?
#---------------------------------------------------------------------------------------
if (!isset($_POST['action']))
{
$action="1";
}
else
{
#---------------------------------------------------------------------------------------
switch ($_POST['action'])
{
case 1: #Ajouter une définition
add_def();
break;
#---------------------------------------------------------------------------------------
case 2: #Modifier une entrée
mod_def();
break;
#---------------------------------------------------------------------------------------
case 3: #Supprimer une entrée
del_def();
break;
#---------------------------------------------------------------------------------------
}
}
?>
<br/><a href="logout.php">Déconnexion</a><br/>
<a href="glossaire.php">Retour au glossaire</a>
<?
}
#----------------------------------------------------------------------------------------
footer();
?>