Jump to content

previous page


otuatail

Recommended Posts

The session can be set (Or if lazy cookie/GET/hiddenfield) but it would make more sense if you told us the scope of what you wish this for, example:

 

<input type="hidden" name="submitter" value="<?php print $_SERVER['REQUEST_URI']; ?>">

...

print $_POST['submitter'] . "Submitted the form!";

Link to comment
https://forums.phpfreaks.com/topic/199243-previous-page/#findComment-1045706
Share on other sites

This code page should handel difrent requests from pages including History.php

 

<?
include ("../CmsFunctions.php");
session_start();
Session_Init();

if(!isset($_SESSION['Page']))
{
  header('Location: index.php');
}

$id = $_GET['id'];
$Title = $_POST['Title'];
$page = $_SESSION['Page'];

if(isset($_GET['id2']))
{
  connectDB(3);
  $id2 = $_GET['id2'];
  $sql = "UPDATE Pages SET Current = '$id2' WHERE Page = '$page'";
  $query = mysql_query ($sql);
  header('Location: History.php');
  exit;
}

$x = $_POST['document']; // have to re-work tinyMCE
$x = Stripslashes($x);
$x = str_replace("'","''",$x);
$x = str_replace('"','\"',$x);
$x = str_replace('<p>','<br />',$x);
$x = str_replace('</p>','',$x);
$Direction = $_POST['submit'];
$now = time();
$md5now = md5($now);

connectDB(3);

if($Direction == "Create New")
{

    $sql = "INSERT INTO cmscontent VALUES ('' ,'$x', '$Title', '$now' ,'' , '$page' , '$md5now')";
    $query = mysql_query ($sql);
    header('Location: History.php');
}

if($Direction == "Overwrite content")
{
    $sql = "UPDATE cmscontent SET Content = '$x' , Submitted = '$now' WHERE PIN = '$id'";
    $query = mysql_query ($sql);
    header('Location: History.php');
}

if($Direction == "Cancel")
{
  header('Location: History.php');
}
?>

Link to comment
https://forums.phpfreaks.com/topic/199243-previous-page/#findComment-1045723
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.