Aller au contenu

Supprimer authentification pour admin ?


turfiste

Sujets conseillés

Bonjour,

j'ai beaucoup de mal a résoudre un problème, j'ai un script de pronostics et je n'arrive pas à acceder à l'administration car le serveur apache ne gère pas l'authentification "my realm", donc que dois supprimer dans ma page index.php dans le dossier admin pour accèder à mon administration sans avoir besoin de m"identifier s'il vous plait. La page est ci-dessous

Merci

CODE
<?

/**

* Copyright © 2004 Michael De Checchi <pronostic4web_AT_free.fr>

* http://pronostic4web.free.fr/

* This program is free software; you can redistribute it and/or

* modify it under the terms of the GNU General Public License

* as published by the Free Software Foundation; either version 2

* of the License, or (at your option) any later version.

*

* This program is distributed in the hope that it will be useful,

* but WITHOUT ANY WARRANTY; without even the implied warranty of

* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

* GNU General Public License for more details.

*

* You should have received a copy of the GNU General Public License

* along with this program; if not, write to the Free Software

* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/

if (!isset($_SERVER['PHP_AUTH_USER']))

{

header('WWW-Authenticate: Basic realm="My Realm"');

header('HTTP/1.0 401 Unauthorized');

echo '<center><strong>Attention vous n\'êtes pas autorisé à entrer</strong></center>';

exit;

}

else

{

include("../config.php");

$db = mysql_connect($host, $user, $pwd);

mysql_select_db($base, $db);

$requete = "SELECT * FROM ".$tbl_admin." WHERE pseudo='".$_SERVER['PHP_AUTH_USER']."' AND passe='".$_SERVER['PHP_AUTH_PW']."'";

$result = mysql_query ($requete, $db);

$nb = mysql_num_rows ($result);

if ($nb == 0)

{

echo '<center><strong>Attention vous n\'êtes pas autorisé à entrer</strong></center>';

exit;

}

else

{

?>

<html>

<head>

<title>Administration des pronostics</title>

<link href="feuille.css" rel="stylesheet" type="text/css" />

</head>

<body>

<p align="center"><strong><font size="4" face="Arial, Helvetica, sans-serif">

Espace d'administration des pronostics</font></strong></p>

<p align="center"><font size="2" face="Arial, Helvetica, sans-serif">Pour vous

déconnecter, fermez votre navigateur internet</font></p>

<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">

<tr bgcolor="#FFCC99">

<td valign="top" class="fontGras"><strong>Ajout d'une manche</strong></td>

<td align="center" class="font"> <form action="scripts/valid_ajout.php" target="_blank" method="post">

<div align="center"><i>Informations générales</i></div>

<p align="left">Intitulé :

<input name="match" type="text">

</p>

<p align="left">Heure :

<input name="heuretxt" type="text">

</p>

<p align="left">Date :

<input name="datetxt" type="text">

</p>

<div align="center"><i>Clôture du pronostic</i></div>

<p align="left">Heure / Minutes / Secondes :

<SELECT name="heure">

<?

for ($num = 23; $num >= 0; $num--)

print ("<option value=".$num.">".$num."</option>");

?>

</SELECT>

 

<SELECT name="min">

<?

for ($num2 = 0; $num2 <= 59; $num2++)

print ("<option value=".$num2.">".$num2."</option>");

?>

</SELECT>

 

<SELECT name="sec">

<?

for ($num3 = 0; $num3 <= 59; $num3++)

print ("<option value=".$num3.">".$num3."</option>");

?>

</SELECT>

</p>

<p align="left">Jour / Mois / Année :

<SELECT name="jour">

<?

for ($num4 = 1; $num4 <= 31; $num4++)

print ("<option value=".$num4.">".$num4."</option>");

?>

</SELECT>

 

<SELECT name="mois">

<?

for ($num5 = 1; $num5 <= 12; $num5++)

print ("<option value=".$num5.">".$num5."</option>");

?>

</SELECT>

 

<SELECT name="annee">

<?

for ($num6 = 2005; $num6 <= 2010; $num6++)

print ("<option value=".$num6.">".$num6."</option>");

?>

</SELECT>

</p>

<p align="left">Equipe à domicile :

<input name="dom" type="text">

</p>

<p align="left">Equipe à l'extèrieur :

<input name="ext" type="text">

</p>

<p align="left">

<?

$reqCat = "select * from ".$tbl_categorie;

$resCat = mysql_query ($reqCat, $db);

$nbCat = mysql_num_rows ($resCat);

if ($nbCat == 0)

print ("<br><center><font face=arial size=3><b>Pas de catégories.</b></font></center>");

else

{

?>

<br>

Catégorie de la manche :

<select name="cat">

<?

for ($t = 0; $t < $nbCat; $t++)

{

print ("<option value=".mysql_result($resCat, $t, "id").">".mysql_result($resCat, $t, "nom")."</option>");

}

?>

</select>

<?

}

?>

</p>

<p align="center">

<input type="submit" name="validAjout" value="Valider">

</p>

</form></td>

</tr>

<tr>

<td valign="top" class="fontGras"><strong>Modification d'une manche</strong></td>

<td class="font">

<?

$today = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y"), -1);

$req = "select * from ".$tbl_prochainspronos." where ((limite-$today)>0) order by `limite` DESC";

$res = mysql_query ($req, $db);

$nb = mysql_num_rows ($res);

if ($nb == 0)

print ("<br><center><font face=arial size=3><b>Pas de modification possible.</b></font></center>");

else

{

?>

<div align="left"><br>

Sélectionnez la manche à modifier :</div>

<form action="scripts/valid_modif.php" target="_blank" method="post">

<select name="ident">

<?

for ($t = 0; $t < $nb; $t++)

{

$req_t = "select * from ".$tbl_resultats." where idpp = '".mysql_result($res, $t, "idpp")."'";

$res_t = mysql_query ($req_t, $db);

$nb_t = mysql_num_rows ($res_t);

if ($nb_t == 0)

print ("<option value=".mysql_result($res, $t, "idpp").">".mysql_result($res, $t, "matchpp")."</option>");

mysql_free_result($res_t);

}

?>

</select>

<input type="submit" name="validModif" value="valider">

</form>

<?

}

mysql_free_result($res);

?>

<br> </td>

</tr>

<tr bgcolor="#FFCC99">

<td valign="top" class="fontGras"><strong>Mise à jour d'une manche</strong></td>

<td class="font">

<?

$req = "select * from ".$tbl_prochainspronos." where ((limite-$today)<0) order by `limite` DESC";

$res = mysql_query ($req, $db);

$nb = mysql_num_rows ($res);

$req2 = "select * from ".$tbl_resultats.",".$tbl_prochainspronos." where ".$tbl_resultats.".idpp = ".$tbl_prochainspronos.".idpp";

$res2 = mysql_query ($req2, $db);

$nb2 = mysql_num_rows ($res2);

if ($nb == 0)

print ("<br><center><font face=arial size=3><b>Pas de mise à jour à faire.</b></font></center>");

else

{

if ($nb2 == $nb)

print ("<br><center><font face=arial size=3><b>Pas de mise à jour à faire.</b></font></center>");

else

{

?>

<br>

Sélectionnez la manche à mettre à jour :<br> <form action="scripts/valid_result.php" target="_blank" method="post">

<select name="ident">

<?

for ($t = 0; $t < $nb; $t++)

{

$req_t = "select * from ".$tbl_resultats." where idpp = '".mysql_result($res, $t, "idpp")."'";

$res_t = mysql_query ($req_t, $db);

$nb_t = mysql_num_rows ($res_t);

if ($nb_t == 0)

print ("<option value=".mysql_result($res, $t, "idpp").">".mysql_result($res, $t, "matchpp")."</option>");

mysql_free_result($res_t);

}

?>

</select>

<input type="submit" name="validUpdate" value="valider">

</form>

<?

}

}

mysql_free_result($res);

mysql_free_result($res2);

?>

<br> </td>

</tr>

<tr>

<td valign="top" class="fontGras"><strong>Annulation d'une manche</strong></td>

<td class="font">

<?

$req = "select * from ".$tbl_prochainspronos." where ((limite-$today)>0) order by `limite` DESC";

$res = mysql_query ($req, $db);

$nb = mysql_num_rows ($res);

if ($nb == 0)

print ("<br><center><font face=arial size=3><b>Pas de manche à annuler.</b></font></center>");

else

{

?>

<br>

Sélectionnez la manche à mettre à annuler :<br> <form action="scripts/valid_supprime.php" target="_blank" method="post">

<select name="ident">

<?

for ($t = 0; $t < $nb; $t++)

{

$req_t = "select * from ".$tbl_resultats." where idpp = '".mysql_result($res, $t, "idpp")."'";

$res_t = mysql_query ($req_t, $db);

$nb_t = mysql_num_rows ($res_t);

if ($nb_t == 0)

print ("<option value=".mysql_result($res, $t, "idpp").">".mysql_result($res, $t, "matchpp")."</option>");

mysql_free_result($res_t);

}

?>

</select>

<input type="submit" name="validSuppr" value="valider">

</form>

<?

}

mysql_free_result($res);

?>

<br> </td>

</tr>

<tr bgcolor="#FFCC99">

<td valign="top" class="fontGras"><strong>Gestion des catégories</strong></td>

<td class="font">

Ajout d'une catégorie :<br>

<form action="scripts/add_categorie.php" target="_blank" method="post" ENCTYPE="multipart/form-data">

<p>Intitulé :

<input type="text" name="intitule" />

<input type="submit" name="validAjoutCat" value="Valider">

</p>

</form>

<br><br>

<?

$req = "select * from ".$tbl_categorie;

$res = mysql_query ($req, $db);

$nb = mysql_num_rows ($res);

if ($nb == 0)

print ("<br><center><font face=arial size=3><b>Pas de catégories.</b></font></center>");

else

{

?>

<br>

Sélectionnez la catégorie à supprimer :<br>

<form action="scripts/del_categorie.php" target="_blank" method="post">

<select name="ident">

<?

for ($t = 0; $t < $nb; $t++)

{

print ("<option value=".mysql_result($res, $t, "id").">".mysql_result($res, $t, "nom")."</option>");

}

?>

</select>

<input type="submit" name="validSupprCat" value="valider">

</form>

<?

}

mysql_free_result($res);

?>

<br> </td>

</tr>

</table>

<?

}

mysql_free_result($result);

mysql_close($db);

}

?>

</body>

</html>

Lien vers le commentaire
Partager sur d’autres sites

Veuillez vous connecter pour commenter

Vous pourrez laisser un commentaire après vous êtes connecté.



Connectez-vous maintenant
×
×
  • Créer...