Tuesday, July 20, 2010

Check session expiration in php

/* The below script will check for users inactivity on page, If use open one page, then store the current time on $_SESSION['start'] variable. If he doesn't move cursor or click any key from keyboard for some time, and then if he click on any link it will check his inactive time. if it is greater than the limited time we set here 5 minutes as exmple, then he will redirected to inactive.php page */
session_start(); // NEVER FORGET TO START
$inactive = 300; //means expire within 5 minutes
if(isset($_SESSION['start']) ) { // if session start set
$session_life = time() - $_SESSION['start'];
if($session_life > $inactive){ //if session time expired
header("Location: inactive.php"); //session expired message page
$_SESSION['start']=time(); //in pageload current time stored in session.

Recommended discussions forums for php


Enable SSH access for you shared hosting account in godaddy server

To Enable SSH on Your Linux Shared Hosting Account
1. Log in to your Account Manager.
2. From the Products section, click Web Hosting.
3. Next to the hosting account you want to use, click Launch.
4. In the Settings section of the Hosting Control Center, click the SSH icon.
5. Type your Country Code, Phone Number, and Extension (if applicable) in the corresponding fields and click Enable.

NOTE: SSH requires a strong password. If prompted to change your password, click Change Password, type a new password, and click OK.
6. We call the phone number provided within 10 minutes. Once the connection is established, an automated message plays a message containing a PIN. Type the PIN number into the You will be called with your PIN field and click Verify.
Once verified, it may take 24-72 hours for SSH to be enabled for your account. During this time, you are locked out from the account as it is moved to a new server.