Jump to content


Photo

Stay Logged Into A Site When Am Offline...


  • Please log in to reply
9 replies to this topic

#1 Netty

Netty
  • Members
  • PipPip
  • Member
  • 12 posts
  • LocationLiverpool

Posted 27 October 2006 - 06:17 PM

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

is there a script to do this?

thanks alot.
With Regards,

Annette

#2 Psycho

Psycho
  • Moderators
  • Move along, nothing to see here
  • 11,892 posts
  • LocationCanada

Posted 27 October 2006 - 06:45 PM

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.
The quality of the responses received is directly proportional to the quality of the question asked.

I do not always test the code I provide, so there may be some syntax errors. In 99% of all cases I found the solution to your problem here: http://www.php.net

#3 Netty

Netty
  • Members
  • PipPip
  • Member
  • 12 posts
  • LocationLiverpool

Posted 27 October 2006 - 06:51 PM

lmao. what a cowinkidink :)

but seriously .. is there a script to do it?
With Regards,

Annette

#4 jpratt

jpratt
  • Members
  • PipPipPip
  • Advanced Member
  • 144 posts

Posted 27 October 2006 - 06:59 PM

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.

#5 briant

briant
  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts

Posted 27 October 2006 - 07:02 PM

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.

#6 Psycho

Psycho
  • Moderators
  • Move along, nothing to see here
  • 11,892 posts
  • LocationCanada

Posted 27 October 2006 - 07:14 PM

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.
The quality of the responses received is directly proportional to the quality of the question asked.

I do not always test the code I provide, so there may be some syntax errors. In 99% of all cases I found the solution to your problem here: http://www.php.net

#7 alpine

alpine
  • Members
  • PipPipPip
  • Advanced Member
  • 756 posts
  • LocationNorway

Posted 27 October 2006 - 07:17 PM

Cookie example - one year expire time, more info on http://no.php.net/ma...n.setcookie.php


<?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);
}

?>



#8 Netty

Netty
  • Members
  • PipPip
  • Member
  • 12 posts
  • LocationLiverpool

Posted 27 October 2006 - 07:25 PM

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?
With Regards,

Annette

#9 Psycho

Psycho
  • Moderators
  • Move along, nothing to see here
  • 11,892 posts
  • LocationCanada

Posted 27 October 2006 - 11:04 PM

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.
The quality of the responses received is directly proportional to the quality of the question asked.

I do not always test the code I provide, so there may be some syntax errors. In 99% of all cases I found the solution to your problem here: http://www.php.net

#10 Netty

Netty
  • Members
  • PipPip
  • Member
  • 12 posts
  • LocationLiverpool

Posted 28 October 2006 - 11:18 AM

i have been told you can do it using cURL?

do you think that thats possible?
With Regards,

Annette




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users