Home > Blockchain >  is it possible to create a redirect page with diffrent content?
is it possible to create a redirect page with diffrent content?

Time:07-07

what i need is: create a redirect page with diffrent content (in same url) depending on source url where visitor come! for exemple :

the redirect page for both visitors X and Y is www.example.com/redirect-page but with different content for the visitor X a (button) with a href button to target1.com for the visitor Y a href (button) to target2.com (sorry for my bad english, i hope get the right answer )

CodePudding user response:

  1. read the query parameter
       parse_str($_SERVER['QUERY_STRING'], $queries);
       $queries["u"] will be the target
    
  2. Store the target value in session $_SESSION["targetValue"] = $queries["u"]
  3. Redirect the user to /redirect-page/
  4. You can show/hide/render depending on $_SESSION["targetValue"]

CodePudding user response:

By "redirect-page", if you mean it is actually redirecting to another 3rd page, then @ruleboy21's comment is correct.

But I think you mean "redirect-page" is the page that people are being redirected to, and you just want to add a customized "back" button to it. If so, here is one approach:

if ( !empty($_GET['u'] ) {
  echo '<a href="'.htmlspecialchars($_GET['u'], ENT_QUOTES,'UTF-8').'" style="border:1px solid black;padding:2px;"> back </a>';
}

Which doesn't create a <button>, but rather an <a> link containing the referring page in it's href attribute, and has some styling to make it look like a button (which you can change however you want).

  • Related