ok i have several pages that the only way i know how to submit data is asking for the login
it was alright when it was only 1 page
not its turned into 10
and asking the user every time for their credentials sucks
ive been looking around about $_session
but i have no clue how to implement it into my code at all as i have never done it before
here is what i am currently using for a login code
if i have to add more fields in sql for spots for the session id or cookie value that is fine as what im working on is still at the begging
i would like to be able to ask the user to login once and have it be remember if they ask so, and for it to be secure so the cookie cant be hacked
any help would be much appricated
i was researching on this page: http://www.devshed.com/c/a/PHP/Creating-a-Secure-PHP-Login-Script/
but im not sure where to begin
thx again
if ($action == "send") {
$urn = strtolower($_POST['username']);
$urn = str_replace(';', '', $urn);
$urn = stripslashes($urn);
$urn = str_replace('%', '', $urn);
$urp = str_replace(';', '', $_POST['password']);
$urp = stripslashes($urp);
$urp = str_replace('%', '', $urp);
if (!$urn && !$urp){
print "Please complete all fields before pressing submit!";
exit;
}
######connect
$dblink = mysql_pconnect('', '', '') or die('Could not connect to the database: ' .mysql_error());
mysql_select_db('') or die('Could not select database');
$datafromdb="SELECT * FROM account_data WHERE urn=\"$urn\"";
$thedata=mysql_query($datafromdb);
#####echo ("connected <br>");
#####grab id and password of person
if (mysql_num_rows($thedata) > 0) {
$getpassword = mysql_query("SELECT * FROM account_data WHERE urn=\"$urn\"");
$list = mysql_fetch_array($getpassword);
$selpassword = $list['urp'];
#####check password
if ($selpassword == "$urp") {
}else{
echo "Invalid password, if you are having problems email XXXXX@xxxxx.com";
}
}else{
echo 'Invalid account, if you are having problems email xxxxx@xxxxx.com';
}
}else{
##### include login form when not posting data to sign in and post data to above form
include ("login.php");
}