WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search


Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - השוואת מחירים בסופר
ZeroLag.com
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : session out Timer
Categories : PHP, Sessions, Security, Beginner Guides Click here to Update Your Picture
Sujith Kumar
Date : Dec 03rd 2005
Grade : 1 of 5 (graded 9 times)
Viewed : 67816
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Sujith Kumar
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

Code for Beginners-session out Timer !

This is code is used as a session timeout timer and acts like set cookie. I use this code to set a five minutes session. You Can change the session timeout (in minutes) in the file named: end_timer.php


file 1 : login.php
==================
<?php

//start the time @ your login page
   
session_start();
   
$start=time();
   
$_SESSION['time_start']=$start;
   
/*get the login info & set to session */
?>


file 2 : home.php
=================
<?php

    $end
=time();
    include(
"start_timer.php");
    include(
"end_timer.php");
   

/*    session variables like user login info ..    */

?>


file 3 : start_timer.php
========================
<?php

  $start
=$_SESSION['time_start']; 
       
       
$ItemStartDate=$start."<br>";
       
$ItemEndDate = $end."<br>";
       
//    $Today = time();
       
$TimeLeft = $ItemEndDate - $ItemStartDate;
       
//$TimeLeft = $ItemEndDate - $ItemStartDate;
       
if($TimeLeft > 0)
        {
       
$ADayInSecs = 24 * 60 * 60;
       
$Days = $TimeLeft / $ADayInSecs;
       
$Days = intval($Days);
       
       
$TimeLeft = $TimeLeft - ($Days * $ADayInSecs);
       
$Hours = $TimeLeft / (60 * 60);
       
$Hours = intval($Hours);
       
$TimeLeft = $TimeLeft - ($Hours * 60 * 60);
       
       
$Minutes = $TimeLeft / 60;
       
$Minutes = intval($Minutes);
       
$TimeLeft = $TimeLeft - ($Minutes * 60);
       
       
$Seconds = $TimeLeft;
       
$Seconds = intval($Seconds);
       
       
$TimeLeft = $TimeLeft - ($Seconds / 60 * 60 );
       
$MilliSeconds = $TimeLeft;
       
       
        }
?>


file 4 : end_timer.php
===================
<?php

$Seconds
." Seconds " ;
$time_out=5;
if(
$Minutes<$time_out){
   
$_SESSION['time_start']=$end;
}else{
    include(
"logout.php");
}
?>


file 5 : logout.php
===================
<?php
//log out /session time out after 5 minutes of idle time
session_destroy();
?>



A beginner's session handling class
Categories : PHP, PHP Classes, Sessions, Beginner Guides
Function to generate readable/remeberable random password
Categories : PHP, Security, Security
A simple PHP login script that you can modify to suite your needs. It use a session to store data in a session file submited by the page.
Categories : PHP, Sessions, Security, Authentication
Human readable PHP password generator
Categories : PHP, Security, Beginner Guides, Arrays
Session Validation Methods (Security Checks)
Categories : PHP, Sessions, Security
CAPTCHA[Image verification]
Categories : PHP, Security, GD image library, Graphics, Sessions
Securing Web Forms with Simple PHP-CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart)
Categories : PHP, Security, GD image library, Sessions
Basic Authentication with sessions
Categories : PHP, Beginner Guides, Authentication, Form Processing, Sessions
Simple Session example
Categories : PHP, Beginner Guides, Sessions
Form Security - Match A Value For Success
Categories : PHP, Authentication, HTML and PHP, Sessions, Security
A damaged image generator (class) for validating text. CAPTCHA - Completely Automated Public Turing test to tell Computers and Humans Apart
Categories : PHP, PHP Classes, Security, GD image library, Security
A login page that require username, password and userlevel.
Categories : PHP, Security, Sessions, MySQL, Databases
A very simple PHP single password cookie based login without usernames.
Categories : PHP, Cookies, Security, Beginner Guides
Authenticator for Exchange Server LDAP
Categories : PHP, Authentication, LDAP, Security, Sessions
Reverse a given number
Categories : PHP, Beginner Guides, Algorithms, Math.