WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
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 Index
PHP Web Logs (BLogs)
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
Submit Site
Forex Trading Online forex trading platform

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 : Cross Browser Session Starter
Categories : PHP, Sessions, Cookies Click here to Update Your Picture
Olaf Lederer
Date : Nov 17th 2006
Grade : 3 of 5 (graded 2 times)
Viewed : 3117
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Olaf Lederer
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

If a session based web application is used by a visitor using Internet Explorer it's possible that this user get some trouble. This will happen if parts of the application are accessed for example via a shortcut on the desktop and the application opens then in a new Explorer window. At this moment a second session is started with a different ID, if the used web application has some session based authentication system the user has to login again. At the same time the user has to logout twice! In browsers like Mozilla Firefox new windows are treated the same way then tabs where the problem doesn't exists. This function will use a real cookie for the session ID and updates the expiration time with every script execution. The expiration is equal to the PHP directive "gc_maxlifetime" (default) or every custom value.

<?php

// $expire = the time in seconds until a session have to expire
function start_session($expire = 0) {
    if (
$expire == 0) {
       
$expire = ini_get("session.gc_maxlifetime");
    } else {
       
ini_set("session.gc_maxlifetime", $expire);
    }
    if (empty(
$_COOKIE['PHPSESSID'])) {
       
session_set_cookie_params($expire);
       
session_start();
    } else {
       
session_start();
       
setcookie("PHPSESSID", session_id(), time() + $expire);
    }
}
?>


this example will start a session with an expire time given by the php configuration
start_session();
<?php
start_session
(600) //will start a session which will expire after 10 minutes (60*10 seconds)
?>




PHP4 MYSQL Authentication Script with cookie. Short & Sweet
Categories : Authentication, Apache, Cookies, PHP, MySQL
Demo of Alternate Pagination Paradigm (Paging)
Categories : PHP, User Interface, Sessions
XDT Topsite (Gold v1.0)
Categories : Databases, CSS, PHP, HTML and PHP, Sessions
Authentication script to authenticate users in Active Directory through LDAP.
Categories : LDAP, Authentication, Cookies, PHP
Problem passing session variables
Categories : Sessions, PHP
GuestBook Light - a plug and play application for any website.
Categories : PHP, Complete Programs, Filesystem, Sessions
cookie
Categories : Cookies, PHP
A beginner's session handling class
Categories : PHP, PHP Classes, Sessions, Beginner Guides
A very simple PHP single password cookie based login without usernames.
Categories : PHP, Cookies, Security, Beginner Guides
Example voting script. Lets people enter suggestions and vote for existing ones.
Categories : MySQL, PHP, Cookies, Complete Programs, Databases
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
Form Security - Match A Value For Success
Categories : PHP, Authentication, HTML and PHP, Sessions, Security
AITSH Statistics
Categories : Complete Programs, Databases, HTML and PHP, Sessions, PHP
base64 with encryption - encode and decode sessions
Categories : PHP, PHP Classes, Encryption, Sessions
SPL and ITERATOR : examples
Categories : PHP, Object Oriented, PHP Classes, Sessions