Solved

global.asa equivalent in PHP

Posted on 2008-10-23
1
437 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

821 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