Jump to content

Recommended Posts

Hello i dont know weather this would fall into this or the mysql table but heres the problem. Ok so i have 2 tables on my website. One for all the customers and one for all the artists. Now im trying to make it to where if you log in as an artist then it loads the artist portion of the website and the opposite for the customers. Now this is the error i get and following that is the code for where this error stems from.

The page isn't redirecting properly

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

    *   This problem can sometimes be caused by disabling or refusing to accept
          cookies.

<?php
//Here is the code for the login.inc.php page
if($_GET['act']=="login" && isset($_POST['username']) && isset($_POST['password'])){

$_POST['username'] = treatGet($_POST['username']);
$_POST['password'] = treatGet($_POST['password']);

$query = "SELECT ".$glob['dbprefix']."customer.customer_id, ".$glob['dbprefix']."customer.customer_id FROM ".$glob['dbprefix']."customer LEFT JOIN ".$glob['dbprefix']."artists on ".$glob['dbprefix']."artists.customer_id=".$glob['dbprefix']."customer.customer_id WHERE (".$glob['dbprefix']."customer.email=".$db->mySQLSafe($_POST['username'])." AND ".$glob['dbprefix']."customer.password = ".$db->mySQLSafe(md5($_POST['password']))." AND ".$glob['dbprefix']."customer.type>0) OR (".$glob['dbprefix']."artists.email=".$db->mySQLSafe($_POST['username'])." AND ".$glob['dbprefix']."artists.password = ".$db->mySQLSafe(md5($_POST['password']))." AND ".$glob['dbprefix']."artists.type>0)";

$customer = $db->select($query);

if($customer==FALSE) {

	if($db->blocker($_POST['username'],$ini['bfattempts'],$ini['bftime'],FALSE,"f")==TRUE)
	{
		$blocked = TRUE; 	
	}

} elseif($customer[0]['customer_id']>0) {

	if($db->blocker($_POST['username'],$ini['bfattempts'],$ini['bftime'],TRUE,"f")==TRUE)
	{
		$blocked = TRUE; 
	}
	else
	{

		$customerData["customer_id"] = $customer[0]['customer_id'];
		$update = $db->update($glob['dbprefix']."sessions", $customerData,"sessId=".$db->mySQLSafe($_SESSION['ccUser']));

		// redirect
		// "login","reg","unsubscribe","forgotPass"
		if(isset($_GET['redir']) && !empty($_GET['redir']) && !eregi("logout|login|forgotPass|changePass",base64_decode($_GET['redir']))){

			header("Location: ".str_replace("amp;","",treatGet(base64_decode($_GET['redir']))));
			exit;

		} else {

			header("Location: index.php");
			exit;

		}

	}

}
elseif(eregi("step1",base64_decode($_GET['redir'])))
{
	header("Location: ".$GLOBALS['rootRel']."cart.php?act=step1");
	exit;	
} 

}

//Here is the code on the session.inc.php
$query = "SELECT * FROM ".$glob['dbprefix']."sessions LEFT JOIN ".$glob['dbprefix']."customer ON ".$glob['dbprefix']."sessions.customer_id = ".$glob['dbprefix']."customer.customer_id JOIN ".$glob['dbprefix']."artists ON ".$glob['dbprefix']."sessions.customer_id = ".$glob['dbprefix']."artists.customer_id WHERE sessId = ".$db->mySQLSafe($_SESSION['ccUser']);
$ccUserData = $db->select($query);

// We have a session issue :-/ (e.g. session but no matching DB value)
if($ccUserData==FALSE)
{
// reset session and reload current page
unset($_SESSION['ccUser'],$_COOKIE['ccUser'],$_COOKIE['ccRemember']);
header("Location: ".str_replace("&","&",currentPage()));
exit;
}
?>

So what does it look like the problem is...

Link to comment
https://forums.phpfreaks.com/topic/75834-help-with-sessions/
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.