Jump to content

Session Errors


timmah1

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.