Jump to content

Archived

This topic is now archived and is closed to further replies.

Netty

Stay Logged Into A Site When Am Offline...

Recommended Posts

how would i stay logged into a website. when i go offline?

is there a script to do this?

thanks alot.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
lmao. what a cowinkidink :)

but seriously .. is there a script to do it?

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites
hehe ... ok ... over my head all this ...

how do i get the login cookie? log into the site .. then go to my "Cookies" folder?

any one have an instant messanger to talk me thru it?

Share this post


Link to post
Share on other sites
By your response on Computing.Net I can see that you are wanting to stay logged in to another site. A cookie isn't going to help you do that. It may be possible to launch a php page to log into another site and keep that login state, but I don't know how.

Share this post


Link to post
Share on other sites
i have been told you can do it using cURL?

do you think that thats possible?

Share this post


Link to post
Share on other sites

×

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.