1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
<?php include 'config.php';
// Check if the user is logged in
if ((!isSet($_SESSION['loginname'])) || ($loggin <> '1')) { header("Location: login.php"); exit; } require("configure.php");
$footpagetitleen = htmlspecialchars($_POST["footpagetitleen"],ENT_QUOTES); $footpagetitletc = htmlspecialchars($_POST["footpagetitletc"],ENT_QUOTES); $footpagetitlesc = htmlspecialchars($_POST["footpagetitlesc"],ENT_QUOTES); $footpagedescen = preg_replace("/'/","\'",$_POST["footpagedescen"]); $footpagedesctc = preg_replace("/'/","\'",$_POST["footpagedesctc"]); $footpagedescsc = preg_replace("/'/","\'",$_POST["footpagedescsc"]); $footpagesort = $_POST["footpagesort"]; $nowdate = date("Y-m-d H:i:s"); //print_r($_POST);
$sql = "select max(footpageid) as maxid "; $sql .= "from footpage "; $result=mysql_query($sql); $row = mysql_fetch_array($result,MYSQL_ASSOC); $footpageid = $row{maxid}+1;
// Sort if ($footpagesort == '' || $footpagesort == '0') { $sql = "select max(footpagesort) as maxid "; $sql .= "from footpage "; $result=mysql_query($sql); $row = mysql_fetch_array($result,MYSQL_ASSOC); $footpagesort = $row{maxid}+1; } if( mysql_num_rows(mysql_query("SELECT footpageid FROM footpage WHERE footpagesort=$footpagesort ")) > 0){ mysql_query("UPDATE footpage SET footpagesort= footpagesort+1 WHERE footpagesort >=$footpagesort "); }
$sql = "insert into footpage (footpageid, footpagetitleen, footpagetitletc, footpagetitlesc, footpagedescen, footpagedesctc, footpagedescsc, footpagesort, footpagestatus, creationday, modifyday, cmsloginid) values ('$footpageid', '$footpagetitleen', '$footpagetitletc', '$footpagetitlesc', '$footpagedescen', '$footpagedesctc', '$footpagedescsc', '$footpagesort', '1', '$nowdate', '$nowdate', '".$_SESSION['cmsloginid']."')"; mysql_query($sql); if( mysql_errno() > 0 ){ echo 'Add Footer Page Error:<br />'. mysql_error() .'<br />SQL: '. $sql; exit; }
mysql_close($dbh);
header("Location: footpage_index.php?msg=Add Successful"); ?>
|