Adjusting login for redirect

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rfigley
Forum Commoner
Posts: 70
Joined: Sun Apr 21, 2002 7:10 pm

Adjusting login for redirect

Post by rfigley »

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">
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

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']);
}
Post Reply