Eléphant du PHP |
297 Messages
20 avr. 2006, 22:27
voici le script (partie haute)
pour les variables, elles sont bonnes je pense, car ca fonctionne si je pose sur une autre page)
<?php
// Les variables
$visiteur=$row_Recordset3['visiteur'];
$sujet=$row_Recordset4['sujet'];
$msg="<html>";
$msg .= " <strong><em>Question visiteur</em></strong><br />";
$msg .= "<br />";
$msg .= "<strong><em>Client:</em></strong>:<br />";
$msg .= "\t$visiteur\n<br />";
$msg .= "<strong><em>Sujet:</em></strong>:<br />";
$msg .= "\t$sujet\n<br />";
$msg .="<html>";
$email="[email protected]";
$sujet="Question";
$Headers = "Content-Type:text/html;charset=iso-8859-1\n";
$Headers .= "Content-Transfer-Encoding: 8bit\n";
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 = $_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 clients_emails SET adresse=%s, clave=%s WHERE id=%s",
GetSQLValueString($_POST['adresse'], "text"),
GetSQLValueString($_POST['clave'], "text"),
GetSQLValueString($_POST['id'], "int"));
mail($email, $sujet, $msg, $Headers);
mysql_select_db($database_Clients, $Clients);
$Result1 = mysql_query($updateSQL, $Clients) or die(mysql_error());
$updateGoTo = "clientes_repmajemail.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}