|
-
Mar 14th, 2006, 02:40 AM
#1
Thread Starter
Addicted Member
Useful login
Hi,
I'm pretty new to PHP and MySQL - still, I want to make a login for my homepage.
Can anyone help me?
The database has to store username, password, a unique ID# and a type (admin or user).
Now, when a user logs in, the user can see more data about himself (I think I can figure this out myself).
I need to use sessions and a cookie for "remember-me"-service and a logout. Also a logout when the browser closes.
I know it sounds stupid and I have searched for code snippets and tutors, but no luck. But I'm a n00b at PHP :P
-
Mar 14th, 2006, 05:25 AM
#2
New Member
Re: Useful login
Check this thread and review Winsocket's answer!
-
Mar 14th, 2006, 06:43 AM
#3
Re: Useful login
I'm a newb at php as well but to set a cookie you can do ,
PHP Code:
setcookie("yourcookiename", "1", time()+3600);
this will expire in an hour during this time isset($s) returns true when it expires isset($s) = false. The 1 is for remember me = yes, 0 remember me = no for ex.
then on page load add,
PHP Code:
@$s = $_COOKIE["yourcookiename"];
if (isset($s)) //check if cookie has expied or not
{
if($S = "1"){
//remember me = true
}else{
//remember me = false
}
}else{
echo "Your remember me session has expired";
}
-
Mar 14th, 2006, 10:56 AM
#4
Thread Starter
Addicted Member
Re: Useful login (RESOLVED)
#2, thnx for that link! I found them very useful, so I'll just drop by later if there's a prob
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|