<?php
session_start();

if (isset($_POST['pid']) and isset($_POST['link']) and isset($_POST['title']) and isset($_POST['id']) and isset($_POST['public'])) {
	
	include ("../includes/db.php");
	$userId = $_SESSION['id'];
	
	$id = mysql_escape_string($_POST['id']);
	$pid = mysql_escape_string($_POST['pid']);
	$link = mysql_escape_string($_POST['link']);
	$title = mysql_escape_string($_POST['title']);
	$public = 0; //mysql_escape_string($_POST['public']);
	
	// UPDATE PAGE
	if ($pid != '') {
		$query = "UPDATE page SET PageId = '$pid', Title = '$title', Link = '$link', Public='$public' WHERE Id = '$id' ";
	} else {
		$query = "UPDATE page SET Title = '$title', Link = '$link', Public='$public'  WHERE Id = '$id'  ";
	}
	mysql_query ($query);
		
	echo "success";
}

?>