Jump to content

[SOLVED] Refreshing/Redirecting without logging out? IE?


al3x8730

Recommended Posts

Well I own the website: http://imshare.us.to and I've been having a problem, I noticed that when users logged in they're just getting logged out. So I added

header('Refresh: 1; url=http://imshare.web44.net/profile.php' );

 

To the login file:

 

<?php
// config
include_once "../config.php";

// controllers
switch($_REQUEST['action']) {
	case 'submit':
		if($member_id = verifyLogin($_REQUEST['email'], $_REQUEST['password'])) {
			$messages = array("return" => "success", "message" => "Successfully signed into your account!");

			// set session hash
			$member = getMemberById($member_id);

			$_SESSION['sessionhash'] = ( sha1( $member['id'] ) . sha1( $member['password_salt'] ) . sha1( SESSION_SALT ) );
			header('Refresh: 1; url=http://imshare.web44.net/profile.php' );	

		} else { $messages = array("return" => "error", "message" => "You provided incorrect details"); }

		$smarty->assign("messages", $messages);
		break;
	default:
		// show register form
}

// view
$smarty->display( "login.tpl" );
?>

 

Now that fixed it in Opera. Now it redirects to the profile page of the user, no problem. But in IE it just logs the person out, and keeps them at the login page. Maybe this isn't the most efficent way to do what I want to do? Redirection without logging the user out in all web browsers.

 

Thanks^^.

I've never used a header() like that:

 

Try like this:

header("Location: profile.php");

 

Still doesn't work on IE. It just brings me to the homepage. And not logged in. :| I would also like it to wait a few seconds because I have a little "you've been suscesfully logged in" kinda thing, but if this problem can't be solved with a waiting thing, whatever I just want this fixed :|

 

If you want it to wait, look at the HTML meta refresh.

Why is it logging you out? I don't understand. Glimpsing at your code, it shouldn't be logging you out as soon as you log in.

 

I'm not sure :| Try it yourself. Make a quick account. Use IE with the code I was giving on here, watch what it does. It just logs me right out.

Archived

This topic is now archived and is closed to further replies.

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