Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within PHP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
Liutauras Vilda
Jeanne Boyarsky
paul wheaton
Sheriffs:
Ron McLeod
Devaka Cooray
Henry Wong
Saloon Keepers:
Tim Holloway
Stephan van Hulst
Carey Brown
Tim Moores
Mikalai Zaikin
Bartenders:
Frits Walraven
Forum:
PHP
Need to implement Session time out in PHP code
sudeep naayak
Greenhorn
Posts: 5
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hay there
I have tried with the following code
<?php session_start(); $session_life = time() - $_SESSION['start']; if($session_life > $inactive) { session_destroy(); header("Location: error.php"); } ?>
This code I used at the scratch of my code.
Its not working. I dont have the access to php.ini at my server.
Can anybody help me out.
K. Tsang
Bartender
Posts: 3648
16
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
you can view the settings of php.ini using "echo phpinfo()".
K. Tsang CEng MBCS PMP PMI-ACP OCMJEA OCPJP
sudeep naayak
Greenhorn
Posts: 5
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thanks K. Tsang
I tried it in another way and it worked.
<?php session_cache_expire( 10 ); session_start(); $inactive = 600; if(isset($_SESSION['start']) ) { $session_life = time() - $_SESSION['start']; if($session_life > $inactive) { $_SESSION["logged_in"] = false;$_SESSION["username"]=""; $_SESSION["errmsg"]="Session Expired"; header("Location: error.php"); } } $_SESSION['start'] = time(); ?>
By the way thanks for your attention and valuable time.
I didn't do it. You can't prove it. Nobody saw me. The sheep are lying! This tiny ad is my witness!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Multiple Actions issue in JSF
MultiDimenaional Array sort
Need Random unique variable value in PHP 5
Jboss 5.1.0 jsp:root not working
Java Server, PHP client
More...