Jump to content

Recommended Posts

Well, I'm making a CMS...and I started on it today.

I have the very basic member login system down...but I have a little problem.

 

How do I make a page redirect? Not with the header thing either...

My examples:

This is if someone enters 'index.php'. It will automatically, and hopefully instantly, redirect them to 'index.php?act=index'.

elseif(empty($act)) 
{
//somehow redirect to index.php?act=index here
}

 

And this is in the login validation file...

If they login correctly, it sets a session variable to 1, meaning you are logged in throughout the site.

Then, it redirects them back to index.php?act=index. But I can't figure out how to do that either...

} else { 
$_SESSION['logged_in'] = '1'; 
$_SESSION['username'] = $username;

echo 'Thank you for logging in, '.$username;
echo "<br /><b><font size='2'><a href='?act=index'>Click here to return to the index</a></font></b>";
//I'd like to replace the above line with the redirect
}

 

Help please?

Link to comment
https://forums.phpfreaks.com/topic/75064-redirect-help/
Share on other sites

best way to redirect is threw headers i found.

if($result) {

if(mysql_num_rows($result)>0) {

//Login Successful

session_regenerate_id();

$member=mysql_fetch_assoc($result);

$_SESSION['SESS_MEMBER_ID']=$member['member_id'];

session_write_close();

header("location: ../Loginsucces.htm");

exit();

}else {

//Login failed

header("location: ../loginfailed.htm");

exit();

}

Link to comment
https://forums.phpfreaks.com/topic/75064-redirect-help/#findComment-379650
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.