Vous allez peut-être me prendre pour un guignol mais bon.
J'ai crée un formulaire avec Dreamweaver CS5 :
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO table (link, hd, `language`) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['link'], "text"),
GetSQLValueString(isset($_POST['hd']) ? "true" : "", "defined","1","0"),
GetSQLValueString($_POST['langue'], "text"),);
mysql_select_db($database_localhost, $localhost);
$Result1 = mysql_query($insertSQL, $localhost) or die(mysql_error());
}
?>
<form name="form1" method="POST" action="<?php echo $editFormAction; ?>">
<p>
<label>Link
<input type="text" name="link" id="link">
</label></p>
<p>
<label>Language
<select name="langue" id="langue">
<option value="en" selected>english</option>
<option value="fr">french</option>
</select>
</label>
</p>
<p>
</p>
<p>
</p>
<p>
<label>
<input type="checkbox" name="hd" id="hd">
HD ?</label>
</p>
<p>
<input type="submit" name="submit" id="submit" value="Submit">
</p>
<input type="hidden" name="MM_insert" value="form1">
</form>
Ca marchait très bien jusqu'à maintenant où tous les slashs, les & et les = disparaissent.
L'url du forum donne par exemple : httpwwwwebmasterhubcomindexphpappforum
Ce qui est bizarre, c'est que ça fonctionnait très bien puis pouf (je n'ai rien touché)
Je n'ai pas enlevé la fonction mysql_real_escape_string par crainte d'injection dangereuse.
Pouvez-vous m'aider svp.
En vous remerciant.
Ce message a été modifié par yaK2manD - 24 avril 2011 - 10:48.



Haut











