Daney11 Posted December 5, 2007 Share Posted December 5, 2007 Hey guys This is my login.php <form method="post" action="login.php"> <?php if (isset($HTTP_POST_VARS['member_email']) && isset($HTTP_POST_VARS['member_password'])) { $member_email = htmlentities($HTTP_POST_VARS['member_email']); $member_password = htmlentities(md5($HTTP_POST_VARS['member_password'])); $query = 'SELECT * FROM members '."where member_email='$member_email'" . "and member_password='$member_password'" . "and member_teamid='$team_url'"; $result = mysql_query($query); if (mysql_num_rows($result) >0 ) { $HTTP_SESSION_VARS['valid_user'] = $member_email; $HTTP_SESSION_VARS['valid_teamid'] = $member_teamid; } } if (isset($HTTP_SESSION_VARS['valid_user'])) { echo 'Welcome '.$HTTP_SESSION_VARS['valid_user'].''; echo $member_username; mysql_query("UPDATE members SET member_loggedin=member_loggedin+1 WHERE member_email = '".$HTTP_SESSION_VARS['valid_user']."'"); } else { if (isset($member_email)) { echo("You Could Not Be Logged In"); } ?> <table width="100%" cellpadding="0" cellspacing="0" border="0" height="60"> <tr> <td width="50%" height="20" valign="middle"> <strong>Username:</strong></td> <td width="50%" height="20" valign="middle"><input class="loginform" type="text" name="member_email"></td> </tr> <tr> <td width="50%" height="20" valign="middle"> <strong>Password:</strong></td> <td width="50%" height="20" valign="middle"><input class="loginform" type="password" name="member_password"></td> </tr> <tr> <td width="50%" height="20" valign="middle"> <strong><a href="forgot_password.php">Forgot Password?</a></strong></td> <td width="50%" height="20" valign="middle"><input class="loginform" type="submit" value="Login"></td> </tr> </table> </form> Everything works fine but id like to set another session variable for "$member_username" At the moment, valid_user is the email address, but im not sure how to create a valid_username part for a session, where it gets the members username from the database. Any ideas guys? Thanks Dane Quote Link to comment https://forums.phpfreaks.com/topic/80364-solved-session-problem/ Share on other sites More sharing options...
revraz Posted December 5, 2007 Share Posted December 5, 2007 I would highly recommend you use $_POST and $_SESSION instead. Your code won't work with future releases of PHP. Quote Link to comment https://forums.phpfreaks.com/topic/80364-solved-session-problem/#findComment-407321 Share on other sites More sharing options...
Daney11 Posted December 5, 2007 Author Share Posted December 5, 2007 Ok, thanks, ive changed it all to $_SESSION Quote Link to comment https://forums.phpfreaks.com/topic/80364-solved-session-problem/#findComment-407327 Share on other sites More sharing options...
Daney11 Posted December 5, 2007 Author Share Posted December 5, 2007 I have added into my login form, however it is still not creating a member_username session $loginrow = mysql_fetch_array($result); $_SESSION['member_username'] = $loginrow['$member_username']; Quote Link to comment https://forums.phpfreaks.com/topic/80364-solved-session-problem/#findComment-407353 Share on other sites More sharing options...
nathanmaxsonadil Posted December 5, 2007 Share Posted December 5, 2007 change $_SESSION['member_username'] = $loginrow['$member_username']; to $_SESSION['member_username'] = $loginrow['member_username']; Quote Link to comment https://forums.phpfreaks.com/topic/80364-solved-session-problem/#findComment-407354 Share on other sites More sharing options...
Daney11 Posted December 5, 2007 Author Share Posted December 5, 2007 thanks, why didnt i see that :S late i guess Quote Link to comment https://forums.phpfreaks.com/topic/80364-solved-session-problem/#findComment-407356 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.