dennismonsewicz Posted February 8, 2009 Share Posted February 8, 2009 When i have this script in place // Begin session if (!isset($_SESSION)) { session_start(); } require_once('config/connection.php'); // Check email and password exist if(isset($_REQUEST['login_submit'])) { $user = trim($_REQUEST['email']); $pass = trim($_REQUEST['password']); $query_users = "SELECT * FROM members WHERE mem_email = '$user' AND mem_pass = '$pass'"; $rs_users = mysql_query($query_users); $row_users = mysql_fetch_assoc($rs_users); $personExists = mysql_num_rows($rs_users); if($personExists) { $_SESSION['authenticated'] = $row_users['user_id']; header("location: user/"); } else { header("location: login.php?notification=badlogin"); } } I get the cannot modify header info PHP error message... if I can't use the header(); function then what is a better practice? no HTML is being sent before this is processed... so i don't know whats wrong Quote Link to comment Share on other sites More sharing options...
premiso Posted February 8, 2009 Share Posted February 8, 2009 Check for a whitespace between the top of the file and the <?php any type of character (even whitespace) send to the browser will cause this error. Here is an example: <?php The above is bad, it should be: <?php However, you should get this with the session_start, but I get the feeling it is never being initiated with how you attempt to start it. Start the session no matter if $_SESSION is there, your check is not really doing any good. EDIT: Added more. Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted February 8, 2009 Author Share Posted February 8, 2009 thanks bud! I fixed the problem! your example rocks! Quote Link to comment 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.