Hi, I have a really simple login form that checks username and password in a database and if correct logs you in etc etc etc.
--------------------------------------------------------------------------------
<?php
$username = $_POST['username'];
$password = $_POST['password'];
//connect to the DB
include('db.php');
//set up the query
$query = "SELECT * FROM users WHERE username='$username' AND password='$password'";
//run the query and get the number of affected rows
$result = mysql_query($query, $connection) or die('error making query');
$affected_rows = mysql_num_rows($result);
//if there's exactly one result, the user is validated. Otherwise, user's invalid
if($affected_rows == 1) {
echo 'validated';
}
else {
echo 'not valid';
}
?>
--------------------------------------------------------------------------------
but, in my database table, I have a fourth column ('web') which holds a specified url. I would like clients to be directed to their specific url once they have logged in - I'm sure there is a really simple answer to this question but using the code I have above can anyone tell me how to implement what i'm trying to do?
Should I be using header("location:"?
Thankyou in advance...
--------------------------------------------------------------------------------
<?php
$username = $_POST['username'];
$password = $_POST['password'];
//connect to the DB
include('db.php');
//set up the query
$query = "SELECT * FROM users WHERE username='$username' AND password='$password'";
//run the query and get the number of affected rows
$result = mysql_query($query, $connection) or die('error making query');
$affected_rows = mysql_num_rows($result);
//if there's exactly one result, the user is validated. Otherwise, user's invalid
if($affected_rows == 1) {
echo 'validated';
}
else {
echo 'not valid';
}
?>
--------------------------------------------------------------------------------
but, in my database table, I have a fourth column ('web') which holds a specified url. I would like clients to be directed to their specific url once they have logged in - I'm sure there is a really simple answer to this question but using the code I have above can anyone tell me how to implement what i'm trying to do?
Should I be using header("location:"?
Thankyou in advance...