Bonjour j'ai un problème avec session_start ()
il s'agit d'un simple script d'authentification, voici mon code :
et je me retrouve avec deux warnings :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 <?php session_start (); require_once("includes/_config.php"); require_once("includes/db.php"); ?> ...html... <?php if (isset($_POST['log'])){ $Querylog="SELECT `g_u_login`,`g_u_nom`,`g_u_prenom` FROM `general_users` WHERE (`general_users`.`g_u_login`=\"".$_POST['log']."\");"; $Resultlog=mysql_query($Querylog) or erreur_sql(__FILE__,__LINE__); $Querypass="SELECT `g_u_pass` FROM `general_users` WHERE (`general_users`.`g_u_pass`=\"".$_POST['pass']."\");"; $Resultpass=mysql_query($Querypass) or erreur_sql(__FILE__,__LINE__); if (false!==($controlelog=mysql_fetch_array($Resultlog)) && false!==($controlepass=mysql_fetch_array($Resultpass))){ $_SESSION['log']=$_POST['log']; echo "Bienvenue ".$controlelog[2]." ".$controlelog[1]; } else { echo "<span class='red'>Login ou mot de passe incorrect !</span><br> <form action='index.php' method='post' name='login' target='_self'> Nom d'utilisateur<br> <input name='log' id='log' type='text' size='15' /><br> Mot de passe<br> <input name='pass' id='pass' type='password' size='15' /><br> <input name='submit' type='submit' value='connection' /> </form>"; } } else { echo "<form action='index.php' method='post' name='login' target='_self'> Nom d'utilisateur<br> <input name='log' id='log' type='text' size='15' /><br> Mot de passe<br> <input name='pass' id='pass' type='password' size='15' /><br> <input name='submit' type='submit' value='connection' /> </form>"; } ?> ...
Code x : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\wamp\www\intranew_2\index.php:1) in C:\wamp\www\intranew_2\index.php on line 2 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\wamp\www\intranew_2\index.php:1) in C:\wamp\www\intranew_2\index.php on line 2
je crois me souvenir que cela advient si session_start() est précédé par du code, mais en l'occurence, ce n'est pas le cas, d'ou ma demande d'assistance... merci d'avance
Partager