Jump to content

directs to a different page...


rainprop

Recommended Posts

b4 this i had a problem where the query failed..and its solved now..but now it directs me to a different page.. (login-failed.php) where from what i see, it should direct me to (member-index.php)

tis is the code..

 

$qry="SELECT * FROM `user` WHERE user_id='login' AND user_password='".md5($_POST['password'])."'";

$result=mysql_query($qry);

 

if($result) {

if(mysql_num_rows($result) == 1) {

session_regenerate_id();

$member = mysql_fetch_assoc($result);

$_SESSION['SESS_USER_ID'] = $member['user_id'];

$_SESSION['SESS_EMP_NAME'] = $member['emp_name'];

session_write_close();

header("location: member-index.php");

exit();

}else {

header("location: login-failed.php");

exit();

}

}else {

die("Query failed");

}

 

 

is the mistake here??

$_SESSION['SESS_USER_ID'] = $member['user_id'];

$_SESSION['SESS_EMP_NAME'] = $member['emp_name'];

can someone tell me what is this code for??

thanks.

Link to comment
https://forums.phpfreaks.com/topic/194744-directs-to-a-different-page/
Share on other sites

Does the form widget name= have a value of login? if so then:

$login= $_POST['login']

and then:

WHERE user_id='$login'

 

is the mistake here??

$_SESSION['SESS_USER_ID'] = $member['user_id'];

$_SESSION['SESS_EMP_NAME'] = $member['emp_name'];

can someone tell me what is this code for??

The above code takes elements of an array named $member, obtained from querying the DB and assigns the values to similar session vars.

 

As for the error or problem. Have you tried echo'ing out the results you get from the form and the DB to see if its what you expect? or dont expect?

 

Now here is the big question, if you cant answer it things are really broke.

Why are you using session_regenerate_id() and session_write_close()

 

 

HTH

Teamatomic

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.