timmah1 Posted February 22, 2012 Share Posted February 22, 2012 No matter what I try, I keep getting a session error. Can somebody look at this code and see what the problem? <?php ob_start(); session_start(); ini_set("display_errors",'ON'); require_once('../lib/config.db.php'); require_once('../inc/auth_func.php'); $message = ''; //echo DECRYPT('w9Ti2cqStdDU2w=='); if (!empty($_POST)) { $post = array(); foreach ($_POST as $key => $value) { $post[$key] = mysql_real_escape_string(strip_tags(html_entity_decode($value))); } $username = $post['username']; $password = ENCRYPT($post['password']); $sql = sprintf("SELECT id, name,transactionid FROM app_logins WHERE username = '%s' AND password = '%s' AND active = 1", $username, $password); $result = mysql_query($sql) or trigger_error(mysql_error()); if ($result && mysql_num_rows($result) > 0) { $row = mysql_fetch_object($result); $sqlapp = "SELECT * FROM app_queue WHERE transactionid={$row->transactionid} ORDER BY appid ASC LIMIT 1"; $rsapp = mysql_query($sqlapp); if($rsapp && mysql_num_rows($rsapp) > 0){ $rowapp = mysql_fetch_object($rsapp); $_SESSION['default_appid'] = $rowapp->appid; } $_SESSION['app_login_id'] = $row->id; $_SESSION['login_name'] = $row->name; $_SESSION['tid'] = $row->transactionid; $location = !empty($post['from']) ? urldecode($post['from']) : 'index.php'; //ob_clean(); header("location:{$location}"); } else { $message = '<p style="color:red;">That username and password<br />combination match none of our logins</p>'; } } ?> Thank you in advance Quote Link to comment https://forums.phpfreaks.com/topic/257564-session-errors/ Share on other sites More sharing options...
scootstah Posted February 22, 2012 Share Posted February 22, 2012 What is a "session error"? Quote Link to comment https://forums.phpfreaks.com/topic/257564-session-errors/#findComment-1320133 Share on other sites More sharing options...
timmah1 Posted February 22, 2012 Author Share Posted February 22, 2012 Warning: Cannot modify header information - headers already sent by (output started at /home/local/public_html/members-new/login1.php:1) in /home/local/public_html/members-new/login1.php on line 34 Quote Link to comment https://forums.phpfreaks.com/topic/257564-session-errors/#findComment-1320134 Share on other sites More sharing options...
scootstah Posted February 22, 2012 Share Posted February 22, 2012 Did you read this? Quote Link to comment https://forums.phpfreaks.com/topic/257564-session-errors/#findComment-1320136 Share on other sites More sharing options...
AyKay47 Posted February 22, 2012 Share Posted February 22, 2012 Warning: Cannot modify header information - headers already sent by (output started at /home/local/public_html/members-new/login1.php:1) in /home/local/public_html/members-new/login1.php on line 34 since the output is started on line 1, this makes me think that your text editor is using a BOM (Byte Order Mark). You can google BOM to learn more about them. If this is the case, you will need to change your text editors encoding to something that does not use a BOM. Also for clarification, this is not a session error, it is a header error. Quote Link to comment https://forums.phpfreaks.com/topic/257564-session-errors/#findComment-1320148 Share on other sites More sharing options...
timmah1 Posted February 22, 2012 Author Share Posted February 22, 2012 Thanks scootstah, I appreciate it. Quote Link to comment https://forums.phpfreaks.com/topic/257564-session-errors/#findComment-1320150 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.