Log in

View Full Version : rederecting users when loged in



queerfm
09-02-2006, 05:03 PM
Hi i downloaded this really cool script that rederect poeple to the index.php page when they login however i would like to make it rederect them to there correct leavel. ie 1,5, or 10

here is the script



<?php

session_start();

include"top.php";

if($login) {

$error = 0;
$errorMessage = "";

if($username == NULL) { $error = 1; $errorMessage .= "Username must not be blank<br>"; }
if($password == NULL) { $error = 1; $errorMessage .= "Password must not be blank<br>"; }

if($error == 1) { echo "<b>ERROR:</b><br>" . $errorMessage . "</b><br>"; } else {

connect();

$password = md5($password);

$sql = "SELECT * FROM redcms_users WHERE redcms_users.user_uname = '" . $username . "' AND redcms_users.user_password = '" . $password . "'";

$result = mysql_query($sql);

$num = mysql_num_rows($result);

if($num == 1) {

$userID = mysql_result($result, "0", "redcms_users.user_id");
$userUName = mysql_result($result, "0", "redcms_users.user_uname");
$userLevel = mysql_result($result, "0", "redcms_users.user_level");

$_SESSION['redIn'] = 'TRUE';
$_SESSION['redUserID'] = $userID;
$_SESSION['redUserLevel'] = $userLevel;

if(isActive() == 'FALSE') {

$_SESSION['redIn'] = 'ACTIVATE';

echo '<meta http-equiv="Refresh" content="0;url=activate.php">';

include"bottom.php";

exit();

}

echo "Welcome " . $userUName . " you are now logged in.";

echo '<meta http-equiv="Refresh" content="0;url=login.php>';

include"bottom.php";

exit();

} else {

echo "<b>Login Failed: Invalid username / password combination. </b><br><br>";

}

}

}

?>

<form method="post" action="<?php echo $PHP_SELF?>">

Username: <input type="text" name="username" value="<?php echo $username; ?>"> <br><br>

Password: <input type="password" name="password"> <br><br>

<input type="Submit" name="login" value="Login">

<br>

<a href='forgot_pw.php'>Forgotten your password?</a>

<?php

include"bottom.php";

?>


If you can help that would be great demo at

http://qipcast.com/redLogin/