CanHasPotato
08-24-2009, 01:19 PM
On my website I have a big IFrame which all my content is viewed in. I also have a search script, which I want to load the results into the IFrame. I've been using GET to do it, but I want to move to sessions for more safety and it seems not to work. I've shown both of my scripts below, hope you can help. :D
The page with the big IFrame (mark.php or / (with .htaccess)):
<?php
if (isset($_GET['p']) || isset($_POST['p']) || isset($_SESSION['p'])) {
if (isset($_GET['p'])) {
$p = $_GET['p'];
}
elseif (isset($_SESSION['p'])) {
$p = $_SESSION['p'];
unset($_SESSION['p']);
}
else {
$p = $_POST['p'];
}
}
elseif (!isset($_GET['p']) && !isset($_GET['p']) && !isset($p) && !isset($_SESSION['p'])) {
$p = "news.php";
}
?>
<iframe id="content" src="http://harsh.bplaced.com/<?php echo $p; ?>" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:visible; width:100%; display:none"></iframe>
The search page (search.php):
<?php
session_start();
$_SESSION['p'] = "search_.php?query=" . $_POST['query'];
header("Location: http://www.harsh.bplaced.com/");
?>
The page with the big IFrame (mark.php or / (with .htaccess)):
<?php
if (isset($_GET['p']) || isset($_POST['p']) || isset($_SESSION['p'])) {
if (isset($_GET['p'])) {
$p = $_GET['p'];
}
elseif (isset($_SESSION['p'])) {
$p = $_SESSION['p'];
unset($_SESSION['p']);
}
else {
$p = $_POST['p'];
}
}
elseif (!isset($_GET['p']) && !isset($_GET['p']) && !isset($p) && !isset($_SESSION['p'])) {
$p = "news.php";
}
?>
<iframe id="content" src="http://harsh.bplaced.com/<?php echo $p; ?>" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:visible; width:100%; display:none"></iframe>
The search page (search.php):
<?php
session_start();
$_SESSION['p'] = "search_.php?query=" . $_POST['query'];
header("Location: http://www.harsh.bplaced.com/");
?>