Note that there are some explanatory texts on larger screens.

plurals
  1. POsession parameters
    text
    copied!<p>i did this code :</p> <p>file index.php:</p> <pre><code> &lt;?php if (isset($_POST['valider'])) { if (!isset($_SESSION)) { session_start(); } require("function.php"); $email = mysql_escape_string($_POST['email']); $password = mysql_escape_string($_POST['password']); if(!VerifierAdresseMail($email)){?&gt; &lt;script&gt;alert('invalid mail');&lt;/script&gt; &lt;?php } else{ if(!authentification($email,$password)) {?&gt; &lt;script&gt;alert('logging failed');&lt;/script&gt; &lt;?php } else{ header('Location: choice.php'); }} } ?&gt; </code></pre> <p>In function.php:</p> <pre><code>&lt;?php function VerifierAdresseMail($adresse) { $Syntaxe='#^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,6}$#'; if(preg_match($Syntaxe,$adresse)) return true; else return false; } function statistics($id){ $HOST_DB ="localhost"; $NAME_DB="makempf3_captcha"; $USER_DB ="root"; $PWD_DB=""; $connect = mysql_connect($HOST_DB,$USER_DB,$PWD_DB); $db=mysql_select_db($NAME_DB); ?&gt;&lt;script&gt;alert(&lt;?php echo $cle ?&gt;);&lt;/script&gt;&lt;?php $Log_query=mysql_query( " SELECT * FROM tbl_captcha WHERE user_id ='$id' ") or die(mysql_error()); $_SESSION['success'] =0; $_SESSION['fail'] =0; if ($Log_query == true &amp;&amp; mysql_num_rows($Log_query) &gt;0) { ?&gt;&lt;script&gt;alert('heni');&lt;/script&gt;&lt;?php while ($Res_user = mysql_fetch_array($Log_query) ) { $_SESSION['success'] += $Res_user['success']; $_SESSION['fail'] += $Res_user['fail']; } } } function authentification($mail,$pwd_U){ $HOST_DB ="localhost"; $NAME_DB="makempf3_captcha"; $USER_DB ="root"; $PWD_DB=""; $connect = mysql_connect($HOST_DB,$USER_DB,$PWD_DB); $db=mysql_select_db($NAME_DB); $Log_query=mysql_query( " SELECT * FROM tbl_user WHERE email ='$mail' AND user_pass ='$pwd_U' ") or die(mysql_error()); if ($Log_query == true &amp;&amp; mysql_num_rows($Log_query) &gt;0) { $Res = array(); while ($Res_user = mysql_fetch_array($Log_query) ) { $_SESSION['mail'] = $mail; $_SESSION['pwd'] = $pwd_U; $_SESSION['id'] = $Res_user['id']; } return true; } else return false; } ?&gt; </code></pre> <p>when i verify $_SESSION['id'] in choice.php, it is null, but in index.php (before redirection) it has a value. i don't understand why i lost this session variable</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload