SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 1999
    Location
    Milan, Italy
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Global Variables

    Does in php exist anything like the "global.asa" in asp?
    I need to use somelike the "isClientConnected" function to know if someone left my protected area without clicking the "logout" link.
    thank you in advance.
    simone
    Simone Lippolis
    Milan, Italy
    www.hotservices.net

  2. #2
    SitePoint Zealot oodie's Avatar
    Join Date
    Jul 2000
    Location
    Misty Mountain
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know ASP so I'm nor sure what global.asa does. But if you want to make global variables work in a function, you need to declare it as globals inside the function.

    function something(){
    global $var1,$var2;

    }

  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 1999
    Location
    Milan, Italy
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know english very well, so i don't know if "global variable" is the right definition.

    Using asp, you can create a global.asa file which contains variable definitions and functions which are accessible from all over the virtual site without specifying any "include" directive.

    if you change the value of a variable defined within global.asa, the change takes effect in all of your pages. I used this to create a really simple asp chat room; i saved messages and users info within 2 different variables in my global.asa, so each user, when chat.asp reloads, is able to see variable value changes.

    in asp, it is possible to use within the global.asa file some predefined functions which detect "server status". it is possible to perform check on "user status" or "session status".

    Now, i can't remember the exact function name (something like "sessionOnload()") but i know it is possible to detect when a user lives the site (or, at least, when the session expires).

    I was wondering if it is possible to use something like "global.asa" with php, or if it is possible to detect session expiration.

    Hope i was able to explain what i mean, sorry for my english,
    simone
    Simone Lippolis
    Milan, Italy
    www.hotservices.net

  4. #4
    SitePoint Addict
    Join Date
    Nov 2000
    Location
    London, UK
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've learned a little bit of ASP, and I don't think that there is that same thing in PHP. I know that in ASP there are Server Variables and Application Variables that you can use to maintain state. However, in PHP, those aren't really there. There are Session Variables, which can be used to maintain state for a single user.
    However, it shouldn't be too hard to make a file that you can include in all of your pages that would do that functionality for you...

    ... what's the world coming to?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •