jmansa
October 11, 2010, 4:17pm
1
I’m wandering if its possible to add a condition like:
&con=1
to all links on my site starting like this:
users.php?ga=“somevariable”
without having to change all the links hardcoded…
Example
if($app){
// Add the $con=1 to the users.php?ga="somevariable" //
}
Does this make sense? Thanks in advance
tmapm
October 11, 2010, 4:54pm
2
Do you have a file that you include on every page??
You could just do something along the lines of:
if ($_GET['ga'] == 'somevariable') {
$_GET['con'] = 1; // Set Con Variable
}
jmansa
October 11, 2010, 6:15pm
3
What if I use str_replace?
In my script I could have several users.php?ga=???
So I need to look through my script, find all the users.php?ga=something (this could vari several of times within the same script)
Then some how replace or change the users.php?ga=??? to users.php?ga=???&con=1 or even just add the &con=1 at the end of each line with the users.php?ga
Is this possible?!?!?
jmansa
October 11, 2010, 6:05pm
4
tmapm:
In theory. The link doesn’t change, but your script process it as if it did.
You might want something like:
$con = false;
// Set Con Variable
if (isset($_GET['ga']) && $_GET['ga'] == 'somevariable') {
$con = true;
}
//Then just use $con in your script
Well, I need the browser url to show the “&con=1” so that the browser can read it…
And how can I set the “some variable” to wildcard?
tmapm
October 11, 2010, 5:56pm
5
In theory. The link doesn’t change, but your script process it as if it did.
You might want something like:
$con = false;
// Set Con Variable
if (isset($_GET['ga']) && $_GET['ga'] == 'somevariable') {
$con = true;
}
//Then just use $con in your script
jmansa
October 11, 2010, 5:32pm
6
tmapm:
Do you have a file that you include on every page??
You could just do something along the lines of:
if ($_GET['ga'] == 'somevariable') {
$_GET['con'] = 1; // Set Con Variable
}
So if I have a link inside the script like this:
<a href=“users.php?ga=test&info=123”>
it should then change to:
<a href=“users.php?ga=test&con=1 &info=123”>