Jump to content

Stay Logged Into A Site When Am Offline...


Netty

Recommended Posts

Not quite clear. Do you want users to your site to be able to return to the site without having to log in again? If so, then just use cookies to save the user login data. When they return to the site, check to see if there is a cookie w/ data and if so log them in with that data.

BTW: that's my same response to your identical question in the Computing.net forum. LOL.
Link to comment
Share on other sites

I am not sure if you will find a script that you can just cut and paste in and work how you want. Your best bet is to do some reasearch on cookie with php then look for simalar scripts. If you are going to write your own or modify someone elses you will need to know what is going on.
Link to comment
Share on other sites

I'm wondering, did you want to be logged onto your website or someone else's?

As for your own website, it's possible but you would need to provide your site.

As for someone else's website, unless you have access to their php code, then no, you can't be able to do it.
Link to comment
Share on other sites

Assuming you have a login script you need to add the following functionality:

Upon a successful login, save the username & password (MD5 hash or something similar I hope) to a cookie.

For any pages where you check login status, if the user is not already logged in, check if they have a cookie set and attempt to log them in using those credentials.
Link to comment
Share on other sites

Cookie example - one year expire time, more info on http://no.php.net/manual/fi/function.setcookie.php

[code]

<?php
session_start();

// check for valid user on login
if($login_ok) // simplified example
{
setcookie("cookie_name", "cookie_value", time()+60*60*24*365,"/",".yourdomain.com",0);
}


// or on logout, same parameters but with negative expire period
if($logout) // simplified example
{
setcookie("cookie_name", "cookie_value", time()-60*60*24*365,"/",".yourdomain.com",0);
}

?>

[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.