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.