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
| <?php require_once('Connections/mabase.php'); ?>
<?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;
}
}
session_start();?>
<?php
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_Resultats = 200;
$pageNum_Resultats = 0;
if (isset($_GET['pageNum_Resultats'])) {
$pageNum_Resultats = $_GET['pageNum_Resultats'];
}
$startRow_Resultats = $pageNum_Resultats * $maxRows_Resultats;
$MotCle_Resultats = "null";
if (isset($_POST['MotCle'])) {
$MotCle_Resultats = $_POST['MotCle'];
}
mysql_select_db($database_mabase, $mabase);
$query_Resultats = sprintf("SELECT * FROM shop_article WHERE shop_article.libelle LIKE %s OR shop_article.application LIKE %s OR shop_article.reference LIKE %s OR shop_article.nom_usuel LIKE %s OR shop_article.id LIKE %s ORDER BY shop_article.libelle ASC", GetSQLValueString("%" . $MotCle_Resultats . "%", "text"),GetSQLValueString("%" . $MotCle_Resultats . "%", "text"),GetSQLValueString("%" . $MotCle_Resultats . "%", "text"),GetSQLValueString("%" . $MotCle_Resultats . "%", "text"),GetSQLValueString("%" . $MotCle_Resultats . "%", "text"));
$query_limit_Resultats = sprintf("%s LIMIT %d, %d", $query_Resultats, $startRow_Resultats, $maxRows_Resultats);
$Resultats = mysql_query($query_limit_Resultats, $mabase) or die(mysql_error());
$row_Resultats = mysql_fetch_assoc($Resultats);
if (isset($_GET['totalRows_Resultats'])) {
$totalRows_Resultats = $_GET['totalRows_Resultats'];
} else {
$all_Resultats = mysql_query($query_Resultats);
$totalRows_Resultats = mysql_num_rows($all_Resultats);
}
$totalPages_Resultats = ceil($totalRows_Resultats/$maxRows_Resultats)-1;
$queryString_Resultats = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Resultats") == false &&
stristr($param, "totalRows_Resultats") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Resultats = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_Resultats = sprintf("&totalRows_Resultats=%d%s", $totalRows_Resultats, $queryString_Resultats);
?>
<?php
// *** Validate request to login to this site.
session_start();
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}
if (isset($_POST['email'])) {
$loginUsername=$_POST['email'];
$password=$_POST['mdp'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "account/index.php";
$MM_redirectLoginFailed = "login_failed.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_mabase, $mabase);
$LoginRS__query=sprintf("SELECT mail, mdp FROM shop_client WHERE mail='%s' AND mdp='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $mabase) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$GLOBALS['MM_Username'] = $loginUsername;
$GLOBALS['MM_UserGroup'] = $loginStrGroup;
//register the session variables
session_register("MM_Username");
session_register("MM_UserGroup");
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<?php
session_start();?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><!-- InstanceBegin template="/Templates/frame.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="doctitle" -->
<title></title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="description-keywords" -->
<meta name="description" content="" />
<meta name="keywords" content="" />
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
.Style1 {font-size: medium}
-->
</style>
<!-- InstanceEndEditable -->
<link href="style/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="header">
<div class="page">
</div>
</div>
<div class="page">
<div id="content">
<!-- Google AdSense Inclusion -->
<!-- End Of Google AdSense Inclusion -->
<!-- InstanceBeginEditable name="Corps de Page" -->
<?php $MotCle = isset($_POST['MotCle']) ? $_POST['MotCle'] : ''; ?>
<h1>Resultat de la recherche pour : <?php echo $_POST['MotCle']; ?></h1>
<p> </p>
<?php if ($totalRows_Resultats == 0) { // Show if recordset empty ?>
<p>Il n'y a pas de résultat pour votre requête.</p>
<?php } // Show if recordset empty ?>
<p> </p>
<p></p>
<p></p>
<p>
<?php do { ?>
<strong><span class="Style1"><a href="article_detail.php?id=<?php echo $row_Resultats['id']; ?>"><?php echo $row_Resultats['libelle']; ?></a></span> (<?php echo $row_Resultats['prix_ttc']; ?>€) </strong><br>
<?php echo $row_Resultats['nom_usuel']; ?><br>
<?php echo $row_Resultats['application']; ?> (<a href="article_detail.php?id=<?php echo $row_Resultats['id']; ?>">en savoir plus</a>)<br>
<br>
<?php } while ($row_Resultats = mysql_fetch_assoc($Resultats)); ?>
</p>
<p> article<strong> <?php echo ($startRow_Resultats + 1) ?></strong> à<strong> <?php echo min($startRow_Resultats + $maxRows_Resultats, $totalRows_Resultats) ?></strong> sur <strong><?php echo $totalRows_Resultats ?></strong>
<table border="0" width="50%" align="center">
<tr>
<td width="23%" align="center">
<?php if ($pageNum_Resultats > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Resultats=%d%s", $currentPage, 0, $queryString_Resultats); ?>">Première Page</a>
<?php } // Show if not first page ?>
</td>
<td width="31%" align="center">
<?php if ($pageNum_Resultats > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Resultats=%d%s", $currentPage, max(0, $pageNum_Resultats - 1), $queryString_Resultats); ?>">Page Précédente</a>
<?php } // Show if not first page ?>
</td>
<td width="23%" align="center">
<?php if ($pageNum_Resultats < $totalPages_Resultats) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Resultats=%d%s", $currentPage, min($totalPages_Resultats, $pageNum_Resultats + 1), $queryString_Resultats); ?>">Page Suivante</a>
<?php } // Show if not last page ?>
</td>
<td width="23%" align="center">
<?php if ($pageNum_Resultats < $totalPages_Resultats) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Resultats=%d%s", $currentPage, $totalPages_Resultats, $queryString_Resultats); ?>">Dernière Page </a>
<?php } // Show if not last page ?>
</td>
</tr>
</table>
<p> </p>
<p><a href="index.php">Retour au catalogue</a></p>
<!-- InstanceEndEditable --> </div>
<div id="sidebar1">
<ul><!-- InstanceBeginEditable name="Colonne 1" --><!-- #BeginLibraryItem "/Library/login.lbi" -->
<li>
<h2>Espace Clients</h2>
<?php if (!isset($_SESSION['MM_Username'])) { ?>
<ul>
<form action="" method="post" name="login" id="login">
<p>adresse mail :
<input name="email" type="text" id="email">
<br>
mot de passe :
<input name="mdp" type="password" id="mdp">
<input type="submit" name="Submit" value="Se connecter">
</p>
</form>
</ul></li>
<?php } else { ?>
<ul>
<p><a href="account/index.php">Mon espace client</a> <br>
<a href="logout.php">Se déconnecter</a></p>
</ul>
</li><?php } ?><!-- #EndLibraryItem --><!-- #BeginLibraryItem "/Library/recherche.lbi" --><form action="resultat.php" method="post" name="Recherche" id="Recherche">
<li>
<h2>Rechercher un article</h2>
<br>
<ul> <input name="MotCle" type="text" id="MotCle">
<input type="submit" name="Submit" value="Chercher">
</ul></li>
</form>
<!-- #EndLibraryItem --><!-- InstanceEndEditable --></ul> </div>
</div>
<div id="sidebar2">
<ul>
<li><h2> </h2>
</li>
</ul>
</div>
</div>
<div id="footer">
</div>
</div>
<!-- Google Analytics Tracking -->
<!-- End Of Google Analytics Tracking -->
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($Resultats);
?> |
Partager