Solved

global.asa equivalent in PHP

Posted on 2008-10-23
1
409 Views
Last Modified: 2012-06-27
Hello,

I'm trying to keep track of a session variable in PHP.
It will be set to 0 when the user comes to the website but once they go to a certain page, I want it to be once throughout their session.
It should only be initialized to 0 when they close the browser.

Is there like a global.asa equivalent in php?
Thanks.
0
Comment
Question by:Isaac
1 Comment
 
LVL 11

Accepted Solution

by:
NoiS earned 500 total points
ID: 22789553
hmmm...
Maybe I didn't undertand it right but...
Sessions in PHP are recoverable by de id (you can acess the value by session_id() function).
If you do a session_start() PHP automatically read the session_id() from $_COOKIE or $_REQUEST (in this order).
SESSION is used to identify uniquely a user. So you can simulate persistance of vars and objects.
Its praticaly impossible to control when user go out,  so, the session have a time to expire (or not).
Some people use some tricks to test if the user is displaying the contents with AJAX or put a js on body tag function onunload(); But is untrusted.
Think about it!
About global.asa. Global.asa is for WEB SERVER, not for the script language. There's none relationship.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now