Re: PHP session - Remember me problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



***************************************************
<?php session_start(); 
if($_COOKIE['rememberme']){
$cookName = $_COOKIE['name'];
$cookPassword = $_COOKIE['password'];
$cookRMe = $_COOKIE['rememberme'];
}

if(isset($_REQUEST['name'])){
if(!empty($_REQUEST['rememberme'])){
$nameVal = $_REQUEST['name']; 
$passwordVal = $_REQUEST['password']; 
$remembermeVal = $_REQUEST['rememberme']; 
setcookie("name", $nameVal, time()+3600); 
setcookie("password", $passwordVal, time()+3600); 
setcookie("rememberme", $remembermeVal, time()+3600);
}
print "<pre>";
print_r($_COOKIE);
print "</pre>";
}

?>
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Set Cookie</title>
</head>

<body>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<table width="400" border="1" cellspacing="0" cellpadding="10">
  <tr>
    <td><strong>UserID:</strong></td>
    <td><input type="text" name="name" id="name" value="<?=$cookName?>" /></td>
  </tr>
  <tr>
    <td><strong>Password:</strong></td>
    <td><input type="password" name="password" id="password" value="<?=$cookPassword?>" /></td>
  </tr>
  <tr>
    <td><input type="checkbox" name="rememberme" id="rememberme" value="1" <?php if($_COOKIE['rememberme']){ echo 'checked="checked"'; } ?>/></td>
    <td>&nbsp;Remember me</td>
  </tr>
  <tr>
    <td colspan="2"><input type="submit" name="Send" value="Send" /></td>
  </tr>
</table>
</form>

</body>
</html>
*************************************************************** S.M. Saidur RahmanSenior Consultant
Epsilon Consulting & Development Services [ECDS] Work: +8801911731214
Mobile: +8801911731214
rana_0036@xxxxxxxxx
http://ranawd.wordpress.com   
Visit MyBlogLog and get a signature like this! 





________________________________
From: Vijayabhaskar Reddy <vijayabhaskarreddy57@xxxxxxxxx>
To: php-objects@xxxxxxxxxxxxxxx
Cc: ejaincom@xxxxxxxxx
Sent: Thu, November 12, 2009 10:36:41 AM
Subject: Re:  PHP session - Remember me problem

  
hi ,
You need to add session_start( ); to all the pages in which you are accesing the session variable.

____________ _________ _________ __
From: abhishek jain <ejaincom@yahoo. com>
To: php-objects@ yahoogroups. com
Sent: Tue, November 10, 2009 1:05:20 PM
Subject: Re:  PHP session - Remember me problem

Hi,
Can you please share a piece of code for this,
I am using session_start( ) at the top of page, do i need to add the code you give to only login page or to all page.

--
Regards,
Abhishek jain

____________ _________ _________ __
From: pradip jadhav <jadhav_pradip@ yahoo.co. in>
To: php-objects@ yahoogroups. com
Sent: Tue, November 10, 2009 11:01:30 AM
Subject: Re:  PHP session - Remember me problem

Abhishek,

Please try it using cookies. Either you can use normal cookies or use persistent cookies.

Regards,
Pradip Jadhav

--- On Mon, 9/11/09, abhishek jain <ejaincom@yahoo. com> wrote:

From: abhishek jain <ejaincom@yahoo. com>
Subject:  PHP session - Remember me problem
To: "php mailing list" <php-objects@ yahoogroups. com>, "in-phpug" <in-phpug@yahoogrou p s.com>
Date: Monday, 9 November, 2009, 11:22 AM

Hi friends,

I need to have a checkbox like 'Remember me' in my site. Currently i have a login page which allows one to login but when someone closes and open the browser again, they have to relogin, i want that if a checkbox is selected, they should be able to save the session.

I think something has to be done  on the life of session cookie, but not sure.

Pl. advice

--

Regards,

Abhishek jain

The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo. com/

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]


 


      

[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux