Need help with log-in...
Posted: Sat Nov 10, 2007 6:11 pm
I have a registration form that when submitted into the database encrypts the name and username submitted... the code for encryption I use is...
I'm telling that for the info that I would need in creating the log-in script... but I might simple change that encryption just to md5($username); and nothing else... I need help on this... any help would be greatly appreciated.
I have a very basic idea on what I would need... I mean VERY basic like only the thoughts of what Ineed but have no idea how to do it... what I want is something like this...
A log-in where a user submits a Name and a password which is than encrypted and than the other password and name are taken from the database (which are encrypted the same way) and then the name and password to be checked if they are the same, and if they are then they are logged in and if they are not the same then the user is not logged in and gets an error...
If the user is logged in then a session cookie is created holding the following values...
Name
User id
member-level (as in administrator or member)
Logged-in (verifies that the user is logged in)
And if I want to post the user's name on a page (if they are logged in) the could would look something like the following...
(I think thats what it would be... I'm just learning PHP) and to make certain features available to members it would be something like...
Is that right? or would it be something else? I need a lot of help on this...
The questions I have is...
)
I think I made myself clear on this... I need help with all of that... how do I do all of that?
Code: Select all
//Encrypting function
function Encrypt($string) {//hash then encrypt a string
$crypted = crypt(md5($string), md5($string));
return $crypted;
}
//Encrypting the password and username
$password = encrypt($password);
$name = encrypt($username);I have a very basic idea on what I would need... I mean VERY basic like only the thoughts of what Ineed but have no idea how to do it... what I want is something like this...
A log-in where a user submits a Name and a password which is than encrypted and than the other password and name are taken from the database (which are encrypted the same way) and then the name and password to be checked if they are the same, and if they are then they are logged in and if they are not the same then the user is not logged in and gets an error...
If the user is logged in then a session cookie is created holding the following values...
Name
User id
member-level (as in administrator or member)
Logged-in (verifies that the user is logged in)
And if I want to post the user's name on a page (if they are logged in) the could would look something like the following...
Code: Select all
echo $session->$name;Code: Select all
<?php
if($session->member) {
?>
Members only words
<?php
} else {
?>
Nonmembers words
<?php
}
?>The questions I have is...
- How do I make a session cookies holding all of that submitted info?
How do I make the session cookie go from page to page (or each page having access to that cookie... I don't want the cookie info to be stored in the url).
I think I made myself clear on this... I need help with all of that... how do I do all of that?