Forum Moderators: coopster
You could also look at this thread
Password Encryption and the Basics of User Authentication [webmasterworld.com]
msg 3 in particular
It shouldn't be a big deal to do the redirect once the user is authenticated. You could just use the header function really.
When you design these custom urls to forward your visitor to I would suggest either storing the path to forward them to in the db or making logical paths that you could construct based on user data.
If your login works with a db that stores the users username and encrypted password, for example, it could also store the value of the url for that users USLP. (If you wanted you could instead store the value for USLP in a cookie on the users system...)
Once the user is verified he/she would then be sent to the approprote landing page via:
header("Location: h*tp://www.mysite.com/$USLP_VALUE"); So, building off of Jatar K's post in the link he provided:
session_start();
$username = $_POST['username'];
$userpass = md5($_POST['userpass']);
$sql = "select * from usertable where username='$username' and password='$userpass'";
$result = mysql_query($sql);
if (mysql_num_rows($result)!= 1) {
$error = "Login failed";
include "loginform.php";
} else {
$row = mysql_fetch_array($result);
$_SESSION['username'] = "$username";
$_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
// any other data needed to navigate the site or
// to authenticate the user can be added here
header("Location: h*tp://www.mysite.com/$row['USLP_VALUE']");
}
You can find an example of a connection script in our PHP Library [webmasterworld.com]. It's in the thread called Basics of extracting data from MySQL using PHP [webmasterworld.com].