User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion
Register FAQ Members List Calendar Arcade Today's Posts

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Unread 20 Dec 2005, 18:40   #1
Ragnarak
Registered User
 
Ragnarak's Avatar
 
Join Date: Oct 2000
Posts: 4,944
Ragnarak is a splendid one to beholdRagnarak is a splendid one to beholdRagnarak is a splendid one to beholdRagnarak is a splendid one to beholdRagnarak is a splendid one to beholdRagnarak is a splendid one to beholdRagnarak is a splendid one to behold
Basic PHP Help: Global Variables?

I was hoping that someone could help with this.

For our advertising system we need to generate a unique ID when a page is loaded and use that id in various files that are loaded when the page loads.

Below is how I'm creating the ID but I'm not sure where to put the code for this to work site-wide or how it needs modifying.


PHP Code:
function OurID()
        {
        return 
rand(pow(10,7), (pow(10,8))-1);
        }

                
$OurID=OurID(); 
We also need various conditions such as whether we're on the home page, on the forums or somewhere else to display different ads.

Basically I need to figure out how to use the function to create the variable when a page is loaded and be able to use it throughout various files.

How does PHP declare global variables? Maybe I'm getting confused but all I see when googling is how to use a already defined global variable inside a function (global $variable;).

I hope that made at least some sense and someone can help out.
__________________
I find it kind of funny
I find it kind of sad
The dreams in which i'm dying
Are the best i've ever had
Ragnarak is offline   Reply With Quote
 



Forum Jump


All times are GMT +1. The time now is 23:34.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018