php - Register Session Error (null) -


Issue: After login, it does not send home.php to index.php from my observation, session registers for both Can anyone help me have a tap? I am new to PHP.

Thank you, sorry for poor grammar / English.

Check login:

  & lt ;? Php ob_start (); Include ("connect / db.php"); $ Username = $ _POST ['Username']; $ Password = $ _POST ['password']; $ Username = stripslashes ($ username); $ Password = strip slash ($ password); $ Username = mysql_real_escape_string ($ username); $ Password = mysql_real_escape_string ($ password); $ Sql ​​= "SELECT * from the user where login = '$ username' and passwd = '$ password'"; If (! Mysql_query ($ sql, $ con)) {dead ('error:' mysql_error ()); } $ Result = mysql_query ($ sql); $ = Mysql_num_rows ($ result) count; If ($ count == 1) {$ rows = mysql_fetch_array ($ result); $ Member = $ rows ['member_id']; $ _SESSION ["iduser"] = $ username; $ _SESSION ["idmember"] = $ member; Echo & lt; Center & gt; Login Success! & Lt; Br> Username: & lt; I & gt; '. $ _ Session ["iduser"] '['. $ _ Session ["idmember"]. '] & Lt; / I & gt; & Lt; Br> & Lt; Br> & # 39; & # 39; Echo "& lt; input class = 'button' type = 'button' value = 'enter' onClick = \" javascript: window.location.href = 'home.php' \ "& gt; & lt; / center & Gt; "; } Else {echo & lt; Center & gt; Login error! & Lt; Br> Invalid username or password. & Lt; Br> & Lt; Br> '; Echo "& lt; input class = 'button' type = 'button' value = 'back' onClick = \" javascript: window.location.href = 'index.php' \ "& gt; & lt; / center & gt; ; "; } Ob_end_flush (); ? & Gt;  

Home:

  & lt ;? Php session_start (); If (! Asset ($ _ session ['member'])) {header ("location: index.php"); } $ Username = $ _SESSION ['iduser']; $ Member = $ _SESSION ['idmember']; ? & Gt; Enter the page, add session_start () ->  

Home at the top of the page. In the page

if (! Isset ($ _ session ['member']) should be

if (! Isset ($ _ session ['idmember'])) {


Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -