Thread: Global Call
View Single Post
  #1  
Old 22nd October 2016, 15:16
fireknight's Avatar
fireknight fireknight is offline
Administrator
 
Join Date: Aug 2010
Australia
Posts: 173
Default Global Call
I was just playing around with FreeTSP code.

Both takeeditaltusercp.php & takeeditusercp.php
At the bottom of the file have the return header

Code:
header("Location: $site_url/usercp.php?edited=1&action=$action".$urladd);
Code:
header("Location: $site_url/altusercp.php?edited=1&action=$action".$urladd);
This returns you back to your profile and lets you know the update was successful.
Which is exactly what it does.
But it should not work.
Because no global for $site_url has been defined.

Example
Code:
global $site_url;
So how does it understand what $site_url means.

Now both files call function_main.php.
And that file calls function_config.php.
Which contains the definition of $site_url.

If that is the reason it works.
That then raises the question.

Do we really need to use the global define at all in any file ??

I have just removed all the global defines from the index.php.
Some things work fine without the global call, yet others give errors ??

I have checked U232 V4 takeeditcp.php
And the same thing.
No main or any global call.
But the same line at the bottom of the file.

Code:
header("Location: {$INSTALLER09['baseurl']}/usercp.php?edited=1&action=$action" . $urladd);
This is not a major issue or anything like that.
It is just me wondering WHY?

Can any one shed any light on this for me.
Reply With Quote