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
| <?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 `user` (ID, pseudo, email, password) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['ID'], "int"),
GetSQLValueString($_POST['pseudo'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['password'], "text"));
mysql_select_db($database_dico_connection, $dico_connection);
$Result1 = mysql_query($insertSQL, $dico_connection) or die(mysql_error());
$insertGoTo = "user/addword.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
$currentPage = $_SERVER["PHP_SELF"];
mysql_select_db($database_dico_connection, $dico_connection);
$query_definition_rs = "SELECT * FROM definition";
$definition_rs = mysql_query($query_definition_rs, $dico_connection) or die(mysql_error());
$row_definition_rs = mysql_fetch_assoc($definition_rs);
$totalRows_definition_rs = mysql_num_rows($definition_rs);
mysql_select_db($database_dico_connection, $dico_connection);
$query_exemple_rs = "SELECT * FROM exemple";
$exemple_rs = mysql_query($query_exemple_rs, $dico_connection) or die(mysql_error());
$row_exemple_rs = mysql_fetch_assoc($exemple_rs);
$totalRows_exemple_rs = mysql_num_rows($exemple_rs);
mysql_select_db($database_dico_connection, $dico_connection);
$query_user_rs = "SELECT * FROM `user`";
$user_rs = mysql_query($query_user_rs, $dico_connection) or die(mysql_error());
$row_user_rs = mysql_fetch_assoc($user_rs);
$totalRows_user_rs = mysql_num_rows($user_rs);
$maxRows_detail_rs = 10;
$pageNum_detail_rs = 0;
if (isset($_GET['pageNum_detail_rs'])) {
$pageNum_detail_rs = $_GET['pageNum_detail_rs'];
}
$startRow_detail_rs = $pageNum_detail_rs * $maxRows_detail_rs;
$colname_detail_rs = "-1";
if (isset($_GET['titre'])) {
$colname_detail_rs = $_GET['titre'];
}
mysql_select_db($database_dico_connection, $dico_connection);
$query_detail_rs = sprintf("SELECT titre, definition FROM definition WHERE titre = %s ORDER BY titre ASC", GetSQLValueString($colname_detail_rs, "text"));
$query_limit_detail_rs = sprintf("%s LIMIT %d, %d", $query_detail_rs, $startRow_detail_rs, $maxRows_detail_rs);
$detail_rs = mysql_query($query_limit_detail_rs, $dico_connection) or die(mysql_error());
$row_detail_rs = mysql_fetch_assoc($detail_rs);
if (isset($_GET['totalRows_detail_rs'])) {
$totalRows_detail_rs = $_GET['totalRows_detail_rs'];
} else {
$all_detail_rs = mysql_query($query_detail_rs);
$totalRows_detail_rs = mysql_num_rows($all_detail_rs);
}
$totalPages_detail_rs = ceil($totalRows_detail_rs/$maxRows_detail_rs)-1;
$queryString_definition_rs = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_definition_rs") == false &&
stristr($param, "totalRows_definition_rs") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_definition_rs = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_definition_rs = sprintf("&totalRows_definition_rs=%d%s", $totalRows_definition_rs, $queryString_definition_rs);
?> |
Partager