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
Internet Security Software
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
פרייסז - הכח לקנות עובר לידיים שלך
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 : 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 : 7034
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  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)
?>




cookie
Categories : Cookies, PHP
Sessions and -enable-trans-sid
Categories : PHP, PHP Configuration, PHP Options and Info, Sessions
With this class you can use cookies with chips
Categories : PHP, Cookies
Function that does language negotiation based on the Accept-Language header, a cookie or host name
Categories : HTTP, PHP, Cookies
Example voting script. Lets people enter suggestions and vote for existing ones.
Categories : MySQL, PHP, Cookies, Complete Programs, Databases
PHP4 MYSQL Authentication Script with cookie. Short & Sweet
Categories : Authentication, Apache, Cookies, PHP, MySQL
How to implement a session tracking system.
Categories : PHP, Sessions, Variables
A flat file counter
Categories : PHP, Cookies, Filesystem, Beginner Guides
A beginner's session handling class
Categories : PHP, PHP Classes, Sessions, Beginner Guides
AITSH Statistics
Categories : Complete Programs, Databases, HTML and PHP, Sessions, PHP
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
A login page that require username, password and userlevel.
Categories : PHP, Security, Sessions, MySQL, Databases
Optimized Online users class
Categories : PHP, PHP Classes, Sessions
PHP Cookies - Simple cookie write/read methods that allow basic encryption
Categories : PHP, Cookies, Security, Encryption