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
| <?php require_once('Connections/iloled.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_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO Personnages (Username, Nom, Classe, difficulte) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['Username'], "text"),
GetSQLValueString($_POST['Nom'], "text"),
GetSQLValueString($_POST['Classe'], "text"),
GetSQLValueString($_POST['difficulte'], "int"));
mysql_select_db($database_iloled, $iloled);
$Result1 = mysql_query($insertSQL, $iloled) or die(mysql_error());
$insertGoTo = "choixduperso.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_iloled, $iloled);
$query_nomdesclasses = "SELECT Nom FROM Classes WHERE Niveaurequis = 0";
$nomdesclasses = mysql_query($query_nomdesclasses, $iloled) or die(mysql_error());
$row_nomdesclasses = mysql_fetch_assoc($nomdesclasses);
$totalRows_nomdesclasses = mysql_num_rows($nomdesclasses);
mysql_free_result($nomdesclasses);
?>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Nom:</td>
<td><input type="text" name="Nom" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Classe:</td>
<td><select name="Classe">
<?php
do {
?>
<option value="<?php echo $row_nomdesclasses['Nom']?>" ><?php echo $row_nomdesclasses['Nom']?></option>
<?php
} while ($row_nomdesclasses = mysql_fetch_assoc($nomdesclasses));
?>
</select>
</td>
<tr>
<tr valign="baseline">
<td nowrap align="right">Difficulte:</td>
<td><select name="difficulte">
<option value="1" <?php if (!(strcmp(1, ""))) {echo "SELECTED";} ?>>Facile</option>
<option value="2" <?php if (!(strcmp(2, ""))) {echo "SELECTED";} ?>>Moyen</option>
<option value="3" <?php if (!(strcmp(3, ""))) {echo "SELECTED";} ?>>Difficile</option>
<option value="4" <?php if (!(strcmp(4, ""))) {echo "SELECTED";} ?>>Rude</option>
<option value="5" <?php if (!(strcmp(5, ""))) {echo "SELECTED";} ?>>Pure Folie</option>
</select>
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Insérer l'enregistrement"></td>
</tr>
</table>
<input type="hidden" name="Username" value="">
<input type="hidden" name="MM_insert" value="form1">
</form> |
Partager