Author Topic: cookie help  (Read 680 times)

0 Members and 1 Guest are viewing this topic.

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
cookie help
« on: March 13, 2010, 01:48:30 AM »
I am creating a changepassword script and can find the $user = $_COOKIE[user];
I want the $user to be the login user any thoughts?

Code: [Select]
<?


ob_start();
session_start();
if(!isset($_COOKIE["id"]))
{
     header("Location: login.php");
}
else
{

include("header.php");
session_start();
//session_register("session");
//if(!isset($session['userid'])){
//echo "<center><font face='Verdana' size='2' color=red>Sorry, Please login and use this page </font></center>";
//exit;
//}
// This is displayed if all the fields are not filled in



$user = $_COOKIE[user];
//include 'user.php';
$empty_fields_message = "<p>Please go back and complete all the fields in the form.</p>Click <a class=\"two\" href=\"javascript:history.go(-1)\">here</a> to go back";
// Convert to simple variables
$password1 = $_POST['password1'];
$password2 = $_POST['password2'];
if (!isset($_POST['password1'])) {

$smarty->assign('message', $message);
$smarty->display('changepassword.tpl');


}
elseif (empty($password1) || empty($password2))  {
    echo $empty_fields_message;
}
else {
//include 'includes/connection.php';


$db_password1=md5(mysql_real_escape_string($password1));
//Setting flags for checking
$status = "OK";
$msg="";
if ( strlen($password1) < 3 or strlen($password1) > 10 ){
$msg=$msg."Password must be more than 3 characters in length and maximum 10 characters in length<BR>";
$status= "NOTOK";}     
if (strcmp( $password1,$password2 ) !=0){
$msg=$msg."Both passwords do not match<BR>";
$status= "NOTOK";}     
if($status<>"OK"){
echo "<font face='Verdana' size='2' color=red>$msg</font><br><center><input type='button' value='Retry' onClick='history.go(-1)'></center>";
}else{ // if all validations are passed.
if(mysql_query("UPDATE pp_user SET pass='$db_password1'where user= '$user'"));
{
echo "<font face='Verdana' size='2' ><center>Thanks ". $user ."<br> Your password changed successfully. Please keep changing your password for better security</font></center>". $password1;
}

}
}
}

?>
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com

Offline FireDart

  • Project Leader
  • Pro Member
  • *****
  • Posts: 406
  • Karma: 4
    • View Profile
    • FireDart
Re: cookie help
« Reply #1 on: March 13, 2010, 02:20:01 AM »
Do you mean when they logout then comeback the username is already filled out depending on there cache?

This sounds easier if your created an I.P log that tracked the username, then the log would expire every 5 days.

hilfo could answer this better I think, he has more experience with cache.

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: cookie help
« Reply #2 on: March 13, 2010, 03:12:45 AM »
Do you mean when they logout then comeback the username is already filled out depending on there cache?

This sounds easier if your created an I.P log that tracked the username, then the log would expire every 5 days.

hilfo could answer this better I think, he has more experience with cache.


I have created a forgot password that e-mails the user a new password to login then I wanted to give them the option to change it. so they would br login at this time.
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: cookie help
« Reply #3 on: March 13, 2010, 03:45:30 AM »
thanks,
I got it working will post code later
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: cookie help
« Reply #4 on: March 13, 2010, 04:25:45 AM »
post code under Modifications
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com