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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
| <?php require_once('Connections/basesiteperso.php'); ?>
<?php require_once('Connections/basesiteperso.php'); ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "echec.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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 = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE news SET titre=%s, texte=%s, `date`=%s WHERE id=%s",
GetSQLValueString($HTTP_POST_VARS['titre'], "text"),
GetSQLValueString($HTTP_POST_VARS['texte'], "text"),
GetSQLValueString($HTTP_POST_VARS['date'], "date"),
GetSQLValueString($HTTP_POST_VARS['id'], "int"));
mysql_select_db($database_basesiteperso, $basesiteperso);
$Result1 = mysql_query($updateSQL, $basesiteperso) or die(mysql_error());
}
if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE news SET titre=%s, texte=%s, `date`=%s WHERE id=%s",
GetSQLValueString($HTTP_POST_VARS['titre'], "text"),
GetSQLValueString($HTTP_POST_VARS['texte'], "text"),
GetSQLValueString($HTTP_POST_VARS['date'], "date"),
GetSQLValueString($HTTP_POST_VARS['id'], "int"));
mysql_select_db($database_basesiteperso, $basesiteperso);
$Result1 = mysql_query($updateSQL, $basesiteperso) or die(mysql_error());
$updateGoTo = "maj.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE news SET titre=%s, texte=%s, `date`=%s WHERE id=%s",
GetSQLValueString($HTTP_POST_VARS['titre'], "text"),
GetSQLValueString($HTTP_POST_VARS['texte'], "text"),
GetSQLValueString($HTTP_POST_VARS['date'], "date"),
GetSQLValueString($HTTP_POST_VARS['id'], "int"));
mysql_select_db($database_basesiteperso, $basesiteperso);
$Result1 = mysql_query($updateSQL, $basesiteperso) or die(mysql_error());
$updateGoTo = "maj.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE news SET date1=%s, titre1=%s, texte1=%s, date2=%s, titre2=%s, texte2=%s, date3=%s, titre3=%s, texte3=%s WHERE id=%s",
GetSQLValueString($HTTP_POST_VARS['date1'], "date"),
GetSQLValueString($HTTP_POST_VARS['titre1'], "text"),
GetSQLValueString($HTTP_POST_VARS['texte1'], "text"),
GetSQLValueString($HTTP_POST_VARS['date2'], "date"),
GetSQLValueString($HTTP_POST_VARS['titre2'], "text"),
GetSQLValueString($HTTP_POST_VARS['texte2'], "text"),
GetSQLValueString($HTTP_POST_VARS['date3'], "date"),
GetSQLValueString($HTTP_POST_VARS['titre3'], "text"),
GetSQLValueString($HTTP_POST_VARS['texte3'], "text"),
GetSQLValueString($HTTP_POST_VARS['id'], "int"));
mysql_select_db($database_basesiteperso, $basesiteperso);
$Result1 = mysql_query($updateSQL, $basesiteperso) or die(mysql_error());
$updateGoTo = "maj.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE news SET date1=%s, titre1=%s, texte1=%s, date2=%s, titre2=%s, texte2=%s, date3=%s, titre3=%s, texte3=%s WHERE id=%s",
GetSQLValueString($HTTP_POST_VARS['date1'], "date"),
GetSQLValueString($HTTP_POST_VARS['titre1'], "text"),
GetSQLValueString($HTTP_POST_VARS['texte1'], "text"),
GetSQLValueString($HTTP_POST_VARS['date2'], "date"),
GetSQLValueString($HTTP_POST_VARS['titre2'], "text"),
GetSQLValueString($HTTP_POST_VARS['texte2'], "text"),
GetSQLValueString($HTTP_POST_VARS['date3'], "date"),
GetSQLValueString($HTTP_POST_VARS['titre3'], "text"),
GetSQLValueString($HTTP_POST_VARS['texte3'], "text"),
GetSQLValueString($HTTP_POST_VARS['id'], "int"));
mysql_select_db($database_basesiteperso, $basesiteperso);
$Result1 = mysql_query($updateSQL, $basesiteperso) or die(mysql_error());
$updateGoTo = "maj.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE news SET date1=%s, titre1=%s, texte1=%s, date2=%s, titre2=%s, texte2=%s, date3=%s, titre3=%s, texte3=%s WHERE id=%s",
GetSQLValueString($HTTP_POST_VARS['date1'], "date"),
GetSQLValueString($HTTP_POST_VARS['titre1'], "text"),
GetSQLValueString($HTTP_POST_VARS['texte1'], "text"),
GetSQLValueString($HTTP_POST_VARS['date2'], "date"),
GetSQLValueString($HTTP_POST_VARS['titre2'], "text"),
GetSQLValueString($HTTP_POST_VARS['texte2'], "text"),
GetSQLValueString($HTTP_POST_VARS['date3'], "date"),
GetSQLValueString($HTTP_POST_VARS['titre3'], "text"),
GetSQLValueString($HTTP_POST_VARS['texte3'], "text"),
GetSQLValueString($HTTP_POST_VARS['id'], "int"));
mysql_select_db($database_basesiteperso, $basesiteperso);
$Result1 = mysql_query($updateSQL, $basesiteperso) or die(mysql_error());
$updateGoTo = "maj.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
mysql_select_db($database_basesiteperso, $basesiteperso);
$query_Recordset1 = "SELECT * FROM news";
$Recordset1 = mysql_query($query_Recordset1, $basesiteperso) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_select_db($database_basesiteperso, $basesiteperso);
$query_Recordset2 = "SELECT * FROM news";
$Recordset2 = mysql_query($query_Recordset2, $basesiteperso) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Document sans titre</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" method="POST" action="<?php echo $editFormAction; ?>">
<table width="100%" border="1">
<!--DWLayoutTable-->
<tr>
<td width="340">Mise à jour date :</td>
<td width="414"><label>
<input name="date" type="text" id="date" value="<?php echo $row_Recordset1['date']; ?>">
</label></td>
</tr>
<tr>
<td>Mise à jour titre :</td>
<td><label>
<input name="titre" type="text" id="titre" value="<?php echo $row_Recordset1['titre']; ?>">
</label></td>
</tr>
<tr>
<td>Mise à jour texte :</td>
<td><label>
<textarea name="texte" id="texte"><?php echo $row_Recordset1['texte']; ?></textarea>
</label></td>
</tr>
<tr>
<td height="2"></td>
<td></td>
</tr>
</table>
<br>
<input name="id" type="hidden" id="id" value="<?php echo $row_Recordset1['id']; ?>">
<br>
<br>
<input type="submit" name="Submit" value="Mise à jour">
<input type="hidden" name="MM_update" value="form1">
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
mysql_free_result($Recordset2);
?> |
Partager