Jump to content

php redirect


puregeenius

Recommended Posts

hey guys

im creating a beta site,

and wanted to create a fake account so the user can log in and get a feel for the site.

 

I dont really want to get involved in sessions etc as it is only an idea at the moment, so a redirection script or something would be fine,

 

i.e. if the client types in the right u/n (maybe not even p/w) it will redirect them to the profile, if they type the wrong u/n it sends them to an error page...

 

if you can help it would be much appreciated.

Link to comment
Share on other sites

the redirect i use is this:

 

echo "<META http-equiv=\"refresh\" content=\"1;URL=../index.php\">";

 

content=\"1 being the seconds it takes for it to redirect

 

And about your Username and/or password, just set one in your database and do something like this:

 

$result = mysql_query("SELECT id, usern, passw FROM users WHERE usern = '$user' OR passw = '$pass'", $db) or die(mysql_error()); 
$row = mysql_fetch_array($result) or die(mysql_error());

 

then just check to see if the Username and/or password matches the one in your DB such as in this code above:

 


if ($_POST['username'] == $row['usern']) {

// the redirect that redirects them to the correct page

}
else {

  // the redirect that redirects them back to the login with an error message or an error page that you create with an error message linking them back to the login

}

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.