cydnello
Posts: 1
|
Posted: 02/15/2004, 3:37 AM |
|
Hello
I spent almost two weeks searching for a solution.
I am still searching ! Please I need Help...
Users can register online, get their personal password sent by e-mail. The login page can check and reject wrong passord.
The problem is Users Cannot be redirected to their Own and personal webPage once the password given is valid.
User remain on a blank page (checkuser.php :this the PHP script use to verify user's username and password).
May you please let me know how user during the registering session can automatically create their personal and specific webpage and be redirected to once their logon process is valid.
Here is the code on my file "checkuser.php" i believe may stuck all the process :
============ php ==================
<?
/* Check User Script */
session_start(); // Start Session
include 'db.php';
// Conver to simple variables
$username = $_POST['username'];
$password = $_POST['password'];
if((!$username) || (!$password)){
echo "Please enter ALL of the information! <br />";
include 'login_form.html';
exit();
}
// Convert password to md5 hash
$password = md5($password);
// check if the user info validates the db
$sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' AND activated='1'");
$login_check = mysql_num_rows($sql);
if($login_check > 0){
while($row = mysql_fetch_array($sql)){
foreach( $row AS $key => $val ){
$$key = stripslashes( $val );
}
// Register some session variables!
session_register('first_name');
$_SESSION['first_name'] = $first_name;
session_register('last_name');
$_SESSION['last_name'] = $last_name;
session_register('email_address');
$_SESSION['email_address'] = $email_address;
session_register('special_user');
$_SESSION['user_level'] = $user_level;
mysql_query("UPDATE users SET last_login=now() WHERE userid='$userid'");
header("Location: login_success.php");
}
} else {
echo "You could not be logged in! Either the username and password do not match or you have not validated your membership!<br />
Please try again!<br />";
include 'login_form.html';
}
?>
==============php=================
Thanks for your HELP !
CYD
_________________
DJ |
|
|
DonB
|
Posted: 02/16/2004, 5:06 PM |
|
It's pretty straightforward. I have a description of how to do this at:
http://www.gotodon.com/ccbth/Features/Knowledgebase.asp?find=personal
It's just a simple "redirect" after they log in. Exactly how you want this
done is up to you (creating a default home page, for example). You might
have additional specific requirements for security. I describe the general
concept, and you should be able to develop your own, unique, requirements
from that.
--
DonB
http://www.gotodon.com/ccbth
"cydnello" <cydnello@forum.codecharge> wrote in message
news:5402f59f7a8470@news.codecharge.com...
> Hello
> I spent almost two weeks searching for a solution.
> I am still searching ! Please I need Help...
>
> Users can register online, get their personal password sent by e-mail. The
login page can check and reject wrong passord.
> The problem is Users Cannot be redirected to their Own and personal
webPage once the password given is valid.
> User remain on a blank page (checkuser.php :this the PHP script use to
verify user's username and password).
>
> May you please let me know how user during the registering session can
automatically create their personal and specific webpage and be redirected
to once their logon process is valid.
>
> Here is the code on my file "checkuser.php" i believe may stuck all the
process :
>
> ============ php ==================
> <?
> /* Check User Script */
> session_start(); // Start Session
>
> include 'db.php';
> // Conver to simple variables
> $username = $_POST['username'];
> $password = $_POST['password'];
>
> if((!$username) || (!$password)){
> echo "Please enter ALL of the information! <br />";
> include 'login_form.html';
> exit();
> }
>
> // Convert password to md5 hash
> $password = md5($password);
>
> // check if the user info validates the db
> $sql = mysql_query("SELECT * FROM users WHERE username='$username' AND
password='$password' AND activated='1'");
> $login_check = mysql_num_rows($sql);
>
> if($login_check > 0){
> while($row = mysql_fetch_array($sql)){
> foreach( $row AS $key => $val ){
> $$key = stripslashes( $val );
> }
> // Register some session variables!
> session_register('first_name');
> $_SESSION['first_name'] = $first_name;
> session_register('last_name');
> $_SESSION['last_name'] = $last_name;
> session_register('email_address');
> $_SESSION['email_address'] = $email_address;
> session_register('special_user');
> $_SESSION['user_level'] = $user_level;
> mysql_query("UPDATE users SET last_login=now() WHERE userid='$userid'");
> header("Location: login_success.php");
> }
> } else {
> echo "You could not be logged in! Either the username and password do not
match or you have not validated your membership!<br />
> Please try again!<br />";
> include 'login_form.html';
> }
> ?>
>
> ==============php=================
> Thanks for your HELP !
> CYD
>
> _________________
> DJ
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
|