Bonjour à tous.
Je crée un petit site net avec login + mdp.
Mon 1er fichier (accueil.php) sert à s'identifier et le voici :
Donc, qd le login et mdp sont correct, on va sur la page blank.php que voici :
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76 <?php session_start(); include "Include/header.php"; $username=""; $password=""; $msgerreur = ""; $result=""; $StrSQL=""; $username = strval(@$_POST['username']); $password = strval(@$_POST['password']); if ($username != ""){ $StrSQL = "SELECT username, password, group_id " ; $StrSQL = $StrSQL."FROM ".$tab_users; $StrSQL = $StrSQL." WHERE username = '".$username; $StrSQL = $StrSQL."' AND password = '".$password."';"; $result = mysql_query($StrSQL); $row = mysql_fetch_array($result); if ($row == "") { $msgerreur = "Echec de l'identification"; } else { $msgerreur = "OK"; //$_SESSION['session_group_id']="2"; $_SESSION['session_group_id']=$row['group_id']; header("Location: blank.php"); } } ?> <html> <head> <title></title> <style type="text/css"> <!-- @import url("Includes/perinatalite.css"); --> </style> </head> <body background="Img/fond2.gif" > <table width="100%" height="100%" border="0"> <tr> <td width="26%" align="left" valign="top"><img src="Img/logo.gif" width="80%" ></td> <td width="54%" align="center" valign="top" class="titre"> <br><br><div align="center">Accès Gestion des données </div><bR><bR> <strong class="texteGras"><font color="red"><?php echo $msgerreur; ?></font></strong><bR> <strong class="texteGras"><br> Merci de bien vouloir saisir votre identifiant et votre mot de passe ci-dessous :</strong><br> <br> <table width="300" height="180" border=1 bordercolor="#999999" cellspacing="0"> <tr><td align="center" valign="middle"><form method="post"> <table> <tr> <td class="texte" width="100">Login</td> <td><input name="username" value=""></td> </tr> <tr> <td class="texte">Mot de passe</td> <td><input name="password" value="" type="password"></td> </tr> <tr align="center"> <td colspan="2" class="texte"> </td> </tr> <tr align="center"> <td colspan="2" class="texte"><input type="submit" value="Valider"></td> </tr> </table></form></td></tr></table> </td> <td width="20%"> </td> </tr> </table> </body> </html> <?php include "Includes/footer.php";?>
Or, il ne m'affiche rien (dans la 1ere page, la valeur $_SESSION['session_group_id'] est bien enregistrée.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 <?php session_start(); echo $_SESSION['session_group_id']; ?>
Je teste sur ie7 cookies accepté, et avec firefox (les2 ne fonctionne pas)
A tout hazard voila aussi mon header et footer :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 <?php session_start(); if(! isset($_SESSION['session_group_id'])){ $_SESSION['session_group_id']= "";} $connect = mysql_connect('localhost', 'admin', '*****') or die("Erreur de connexion"); mysql_select_db('****',$connect) or die("Erreur de connexion base"); $tab_users="users"; $tab_acc="*****"; $tab_acc_new="***"; $tab_neonat="***"; $tab_fax="***"; ?>Je ne comprend pas du tt comment cela ce fait..
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 <?php mysql_close(); ?>
Merci à vous.
Nico
Partager