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?