You are here: Re: how to create 'remember login' functionality during login « PHP Programming Language « IT news, forums, messages
Re: how to create 'remember login' functionality during login

Posted by floortje on 10/31/07 19:53

Op 2007-10-30 14:21:56 +0100, zei Chris Gorospe <chris@ekast.com>:

> You would use something along the lines of:
>
>
> if($_POST['remember'])
> {
> set_cookie("username", $username, time()+3600, "/", "yourwebsite.com");
> }
>
> Obviously you'd want this done after all login credentials have been checked.

I would have lotsa fun with this feature if I wasn't a nice guy. Even
some standard browsers let you manipulate cookies. You should also
store a string to check the validity of the cookie and the last know ip
adress.

Example
$supersercret='mysectret';
$md5hash=md5($_SERVER[''REMOTE_ADDR].$username.$supersecret);
add this value to the cookie.

on every page check if the md5hash of the username, ip and supersecret
match the hd5hash in the cookie

Floortje

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация