0

I have one page A having this code snippet

if (!var) {
  header("Location: ".URL, true, 301);
  exit();
}

if (!var2) {
  header("Location: ". $url2, true, 301);
  exit();
}

I want to create a page in between URL/$url2 and A I call this one B.

How do I have to change A to give B the content of URL/$url2 without the user seeing it? I could use something like

Location: mypage.php?url=$url2

But the user could change that what I don't want. If you recommend $_POST how would you do it? If not, what would you do?

I changed it to

session_start();
if (!var) {
  //header("Location: ".URL, true, 301);
  $data = URL;
  $_SESSION['keks'] = $data;
  require("transition.php");
  exit();
}

transition.php:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
   "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Frameset</title>
</head>
<frameset rows="50%,50%">
  <frame src="above.php" name="Navigation">
  <frame src="http://www.domain.com" name="Daten">
  <noframes>
    <body>
      <p>Something</p>
    </body>
  </noframes>
</frameset>
</html>

above.php:

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
    <title>
    </title>
  </head>
  <body>
    <div style="text-align: right;"><a href="<?php echo $_SESSION['keks']; ?>">Continue</a> 
    </div>
  </body>
</html>

Which leads to

<a href="">

1 Answer 1

4

Use a session cookie.

On the page with the info you can save text etc into a session var like this:

$data = 'hello';
$_SESSION['xxx'] = $data;

And get it back on the next page like this:

echo $_SESSION['xxx'];
// Hello

Dont forget you need to run session_start(); before using sessions.

Sign up to request clarification or add additional context in comments.

2 Comments

It seems to get lost on the way. I changed it like this here -> see answer your question.
You can debug it by making a page with just print_r($_SESSION); and refresh it to see what the current session vars are.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.