I am using a login script for access to a page. Would like to adjust it to automatically redirect to a page depending on login. The current table structrue for the login database is:
id int(11) No auto_increment
Uname varchar(30) Yes NULL
Email varchar(30) Yes NULL
Fname varchar(30) Yes NULL
Lname varchar(30) Yes NULL
Pword varchar(30) Yes NULL
Would want to add a column to include page to redirect to, but not sure how the syntax for the code would go to have it redirect there?
$query = ("SELECT * FROM `loginphp` WHERE `Uname` = '$Uname' and 'Pword` = '$Pword'");
$result = mysql_query($query) or die("Query Fail");
if (mysql_num_rows($result) == 0)
{
echo "User Does not Exist";
} else
{
<meta http-equiv="refresh" content="0;URL=dedicated_user_page.php">
Adjusting login for redirect
Moderator: General Moderators
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
what is wrong with the way that you are redirecting? well if you want a specific page per use then add in a varchar(255) field named redirect into the db and store the page for each user then do
Code: Select all
if (mysql_num_rows($query) == 0)
{
die('invalid input');
}
else
{
$info = mysql_fetch_assoc($query);
header('Location: '.$info['redirect']);
}