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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
| <?php require_once('../../Connections/admin_monsite.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE accueil SET titre_page1=%s, texte_page1=%s, texte_page2=%s, image_page2=%s WHERE id=%s",
GetSQLValueString($_POST['titre_page1'], "text"),
GetSQLValueString($_POST['texte_page1'], "text"),
GetSQLValueString($_POST['texte_page2'], "text"),
GetSQLValueString($_POST['image_page2'], "text"),
GetSQLValueString($_POST['id'], "int"));
mysql_select_db($database_admin_monsite, $admin_monsite);
$Result1 = mysql_query($updateSQL, $admin_monsite) or die(mysql_error());
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE Page1 SET titre_page1=%s, texte_page1=%s, image_page1=%s, texte_page2=%s, image_page2=%s WHERE id=%s",
GetSQLValueString($_POST['titre_page1'], "text"),
GetSQLValueString($_POST['texte_page1'], "text"),
GetSQLValueString($_POST['image_page1'], "text"),
GetSQLValueString($_POST['texte_page2'], "text"),
GetSQLValueString($_POST['image_page2'], "text"),
GetSQLValueString($_POST['id'], "int"));
mysql_select_db($database_admin_monsite, $admin_monsite);
$Result1 = mysql_query($updateSQL, $admin_monsite) or die(mysql_error());
$updateGoTo = "view.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
mysql_select_db($database_admin_monsite, $admin_monsite);
$query_rsPage1 = "SELECT * FROM Page1";
$rsPage1 = mysql_query($query_rsPage1, $admin_monsite) or die(mysql_error());
$row_rsPage1 = mysql_fetch_assoc($rsPage1);
$totalRows_rsPage1 = mysql_num_rows($rsPage1);
?>
//Page - code XHTML
<?php
mysql_free_result($rsPage1);
?> |
Partager