Jump to content

how can i stay logged in?


clown[NOR]

Recommended Posts

basicly what i've done is that I've made a CPanel on my personal website so I can log in and edit my site from there. But now I've made it as simple as I stay logged in for 1 hour.. after that I get logged out automaticly..

 

so what I wonder is what can I do to stay logged in untill I either close the whole site or I'm idle for moer than 5 minutes?

Link to comment
https://forums.phpfreaks.com/topic/45980-how-can-i-stay-logged-in/
Share on other sites

but the issue I forgot to mention here, is that i'm not using database but textfile. and also, I've used cookies to store the login state.. if login state is equal to 1 i'm logged in, if it's 0 i'm logged out =)

 

I'm a real rookie when it comes to PHP ... hehe... any good solutions that will work with the way I've made it now?

but how can I set up a session? see I've never worked with it. did some reading on php.net, but nothing more than that. can I add the session script into the allready exsisting login script that uses cookies?

 

and 1 last question.. can u give me a guideline on how I can do it?

 

this is the codes I've got in the login validation file:

<?php

$login_user = $_REQUEST['username'];
$login_pass = $_REQUEST['password'];
$login_string = $login_user . "@" . $login_pass;
$login_array = file("filename.txt");
$login_match = false;
foreach ($login_array as $login_ling) {
	if (rtrim($login_line) == $login_string) { $login_match = true; break; }
}
if($login_match){
	setcookie("phps_loginstate", 1, time()+3600);
	setcookie("phps_loginuser", $login_user, time()+3600);
	Header("Location: http://www.nstclan.com/phpschool/v1.1/index.php?action=login");
} else {
	echo 'Incorrect username or password.';
}

?> 

 

i have to go to bed now, it's 9am here now and i havent slept at all, so i'll check back here when i wake up

Archived

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

×
×
  • 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.