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
https://forums.phpfreaks.com/topic/38812-php-redirect/
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
https://forums.phpfreaks.com/topic/38812-php-redirect/#findComment-186617
Share on other sites

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.