Probléme de connexion d'un user sur mon site

Fermé
marysd Messages postés 6 Date d'inscription dimanche 29 août 2010 Statut Membre Dernière intervention 30 août 2010 - 29 août 2010 à 15:49
Bilow Messages postés 1014 Date d'inscription samedi 21 août 2010 Statut Membre Dernière intervention 2 août 2015 - 29 août 2010 à 18:11
Hello ;I 've always this error message ' Warning: Can not modify header information - headers already sent by (output started " at c : \ program files \ easyphp1 - 8 \ www \ bci \ tete.php : 6 ) in c: \ program files \ easyphp1 - 8 \ www \ bci \ connexion.php on line 55 '
Thank you for helping me
You will find enclosed the code
<? php include ( " tete.php " ); ? >
<div class="art-content">
<div class="art-Post">
<div class="art-Post-body">
<div class="art-Post-inner">
<br>
<p class="title"> Connection </ p >
<h4> This page allows you to log in as an operator or administrator < / h4>
<form action="index.php" method="post" >
<? Php if (isset ( $ _COOKIE [" USERNAME "])){
? >
<input type="button" name="deco" value="deconnexion" onClick="location.href='deconnexion.php'" class="bot">
<? php} ? > <br>
Username : <input name="pseudo" /> <br /> <br />
Password: <input type="password" name="pwd" value=""/> <br /> <br />
<input type="submit" value="Se connecter" class="bot"> <br />

<br> <br>
< php
if ( isset ( $ _POST [ 'username ' ]) AND isset ($ _POST [' pwd '])){
if ($ _POST [ 'username ' ]! = NULL AND $ _POST [ 'pwd '] ! = NULL) {
$ username = htmlentities ( $ _POST [' username ' ]) ;
$ pwd = htmlentities ($ _POST [' pwd ' ]);
mysql_connect (" localhost " , " root " , " " ) ;
mysql_select_db ( "stage " ) ;
$ Res1 = mysql_query ( " select * from operators; ");
while ( $ tab = mysql_fetch_array ( $ res1 ) AND ( $ nickname ! = $ tab [' username ']) AND ( $ pwd ! = $ tab [' pwd ']));
if ( ($ username == $ tab [ ' username ' ]) AND ( $ pwd == $ tab [ ' pwd '])){
setcookie ( " USERNAME ", $ tab [" username "] , time () 3600 , "/");
header (' Location : index.php ' ) ;
}
else ? > <script type="text/javascript"> alert ( ' nick or / and password \ 't exist ( s) not ' );
< / script>
<? Php }
}
? >

< ? php if (isset ($ _COOKIE [" ADMIN "])){
? >


< ? php }? >
-Bank
< ? php if (isset ( $ _COOKIE [ " ADMIN "])){
? >


< / form>
<br> <br>
< php
if (isset ($ _POST [ ' pwd '])){
if ( $ _POST [ ' pwd ' ] ! = NULL ) {
$ Pwd = $ _POST [ ' pwd '] ;
mysql_connect (" localhost " , " root " , " " ) ;
mysql_select_db (" stage ") ;
$ Res1 = mysql_query ("select * from admin ; ");
while ( $ tab = mysql_fetch_array ($ res1 ) )
if ( $ pwd == $ tab [ ' pwd ' ] ) {
setcookie (" ADMIN ", $ tab [ " pwd " ] , time () 3600 , "/");
header ( "Location: index.php " ) ;
}
else
echo ' password \ 't exist ' ;
}
}
> < ? php }? > <br> <br>
<br> -Bank
<br>

<div class="cleared"> < / div>
< / div >
< / div >
< / div >
<? php include (" bas.php ");?>
A voir également:

1 réponse

Bilow Messages postés 1014 Date d'inscription samedi 21 août 2010 Statut Membre Dernière intervention 2 août 2015 117
29 août 2010 à 18:11
Hello !

We speak French in this forum.

Il ne doit y avoir aucune sortie (texte) envoyée avant l'utilisation du header.
Mettez header() au début de code, avant l'inclusion.

Bye ;)
0