Jump to content

Recommended Posts

Yes Daniel0 u r right its 1440.

Now if i have version 5.0 and my session are working, but another person using same version, session are not working. his version is same to mine one.

So is it possible that the length of session.gc_maxlifetime will be different than mine one.

Although that the version are same.

Any comments on this...

I think u did not get my point what i want to say:

Now if i have version 5.0 and my session are working, but another person using same version, session are not working. his version is same to mine one.

So is it possible that the length of session.gc_maxlifetime will be different than mine one by default in php that versions.

 

Any way thanks for information.

Well guys, Here is an observation I made in my website which I can't explain, so I have to rely on you. My webpage can save session for about 5 mins. Which means if I remain idle for about 5 mins continuously, and then try to go another page (in my site), it says I logged out. I inspect phpinfo, and the value of session.gc_maxlifetime of the server is set to its default value 1440. Had I made something wrong in the coding, it should be logged out whenever I load that page, isn't it? What is the meaning of logging out after approx 5 idle minutes? As I said in previous page, I add

 

if (!isset($_SESSION)) {
session_start();
}

 

in every page and I never use any other function of Session other the Session_Start(). So no chance of Session expire manually. If u can tell me if there any other way to time out the sessions?

 

mmarif4u: I used only

session_start();

instead, and the result is same.

 

Daniel0: thanx for ur info. I will set the value through ini_set and then see what happens !!

 

** Sorry for not being so good on php coding.

sessions are better then cookies and also database seeion's are even more powefull ok.

 

that it.

 

100% agree with you.

 

@abdbuet:

There is some thing wrong in ur coding thats why u facing this error.

Check ur scripts for sessions where included.

I was a moderator on an online game a while back and we had problems with players being sneaky and grabbing player's session IDs. Not having access to the code (as I was only a moderator) this caused a problem. One of the players even wrote a PHP script to steal player's session IDs using PHP and Javascript. They then wrote a browser where they could enter another player's session IDs and steal their identity.

 

By adding session_regenerate_id() this gives the user a new session ID. If placed in the first include I think this would have stopped a lot of the problems.

 

Anyone else want to comment on this? I'd also be interested on what some of the more experienced programmers think of this.

Here is a v simple page I made to check whether the is anything wrong in my coding

 

<?php
session_start();
include "config.php";
if(!isset($_SESSION['level'])){
      header("Location: index.php");
}
if ($_SESSION['level'] != "1" and $_SESSION['level'] != "2" and $_SESSION['level'] != "3" and $_SESSION['level'] != "4") {
      header("Location: index.php");
exit();
}
?>
<html><head><title></title></head><body>
Lets see if the problem presists.
</body></html>

 

The config.php file contains

 

<?php
$localhost = "localhost";
$dbuser = "user";
$dbpass = "password";
$dbtable = "mydb";
$con = mysql_connect("$localhost","$dbuser","$dbpass")

        or die("Error Could not connect");

$db = mysql_select_db("$dbtable", $con)
	or die("Error Could not select database");
?>

 

But the problem still on. Any comment?

 

Is there any chance that the free hosting service provider intentionally expire sessions?

ok guys, thanx 4 ur help. My problem is getting really inconsistence. So let investigate me first in deep. But one thing I can't understand, why I dont get the same problem in my PC (local server). This problem only happens when I upload the files on the server. I think any affect of wrong coding should be seen in my PC too. Anyway, lets see what can i do. thanx again.

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.