Jump to content

I want to beable to use a Session expires in 20 Seconds possible?


Gayner

Recommended Posts

<html>
  <head>
     <meta http-equiv="refresh" content="20;url=http://www.takemehere.com/tomypage.php">
  </head>
  etc...

 

you may want to add php before outputting to see if they can be there to begin with etc..

 

Hey thanks for that link, but I cant find any examples on that.

 

"Descrição

void session_set_cookie_params ( int $lifetime [, string $path [, string $domain [, bool $secure [, bool $httponly ]]]] )

 

Define parâmetros dos cookies como no arquivo php.ini file. O efeito desta função é apenas pela duração do script. Então, então você precisa chamar session_set_cookie_params() para cada requisição e antes que session_start() seja chamada.

 

    Nota: O parâmetro secure foi adicionado no PHP 4.0.4, enquanto o parâmetro httponly foi adicionado no PHP 5.2.0. "

 

IS what PHP.net says and I dont understand?

 

 

Thanks for ur time, but sir is it ok if I ask u to tidy up just a small 20second script that refreshes users stored session? Thanks daniel or anyone appreciated.

<?php
private function startSession($time = 3600, $ses = 'MYSES') {
    session_set_cookie_params($time);
    session_name($ses);
    session_start();

    // Reset the expiration time upon page load
    if (isset($_COOKIE[$ses]))
      setcookie($ses, $_COOKIE[$ses], time() + $time, "/");
}
?>

Source: PHP: session_set_cookie_params - Manual (20 September 2009)

<?php
private function startSession($time = 3600, $ses = 'MYSES') {
    session_set_cookie_params($time);
    session_name($ses);
    session_start();

    // Reset the expiration time upon page load
    if (isset($_COOKIE[$ses]))
      setcookie($ses, $_COOKIE[$ses], time() + $time, "/");
}
?>

Source: PHP: session_set_cookie_params - Manual (20 September 2009)

 

i get

 

Parse error: syntax error, unexpected T_PRIVATE

 

?

that was  direct copy from php.net

 

$time = 3600 // actually means 1hour (in seconds), so set to suit

 

Also are you running php5 or 4? private I believe is a php5 thing that is used in a class... getting over my head

 

I was simply pointing to a course of action you can try.

 

If was I, I would try editing like;

<?php
function startSession($time = 3600, $ses = 'MYSES') {
    session_set_cookie_params($time);
    session_name($ses);
    session_start();

    // Reset the expiration time upon page load
    if (isset($_COOKIE[$ses]))
      setcookie($ses, $_COOKIE[$ses], time() + $time, "/");
}
$this=startSession('20','MYSESSIONAME');
?>

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.