Adding condetion to link if?!

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 :slight_smile:

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

}

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?!?!?

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?

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

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”>