Précédent   Forum des professionnels en informatique > PHP > Langage > Syntaxe
Syntaxe Forum d'entraide sur la syntaxe de PHP et la POO. Avant de poster -> FAQ syntaxe, Cours d'initiation et cours de POO
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 13/12/2010, 02h39   #1
Membre du Club
 
Inscription : août 2008
Messages : 103
Détails du profil
Informations forums :
Inscription : août 2008
Messages : 103
Points : 57
Points : 57
Par défaut affiche une erreur en fin de page

Code :
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
<?php require_once('../Connections/boutiquedream.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}
 
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}
 
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);
 
  $logoutGoTo = "login.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "client";
$MM_donotCheckaccess = "false";
 
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 
 
  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && false) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}
 
$MM_restrictGoTo = "login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) 
  $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>
<?php
//init des variables 
if (!isset($_GET['commandeID'])) $_GET['commandeID']=0;
if (!isset($_SESSION['action'])) $action="";
else $action=$_SESSION['action'];
if (isset($_SESSION['liste']))  $liste=$_SESSION['liste'];//recup de la liste de la session
if (!isset($_SESSION['total'])) $total=0;
else $total=$_SESSION['total'];
if (!isset($_SESSION['clientID'])) $clientID=0;
else $clientID=$_SESSION['clientID'];
?>
<?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;
}
}
 
$colname_rsRappelClient = "-1";
if (isset($_SESSION['MM_Username'])) {
  $colname_rsRappelClient = $_SESSION['MM_Username'];
}
mysql_select_db($database_boutiquedream, $boutiquedream);
$query_rsRappelClient = sprintf("SELECT ID FROM clients WHERE email = %s", GetSQLValueString($colname_rsRappelClient, "text"));
$rsRappelClient = mysql_query($query_rsRappelClient, $boutiquedream) or die(mysql_error());
$row_rsRappelClient = mysql_fetch_assoc($rsRappelClient);
$totalRows_rsRappelClient = mysql_num_rows($rsRappelClient);
 
$colname_rsSelectCommande = "-1";
if (isset($_SESSION['clientID'])) {
  $colname_rsSelectCommande = $_SESSION['clientID'];
}
mysql_select_db($database_boutiquedream, $boutiquedream);
$query_rsSelectCommande = sprintf("SELECT ID, `date` FROM commandes WHERE clientID = %s ORDER BY ID DESC", GetSQLValueString($colname_rsSelectCommande, "int"));
$rsSelectCommande = mysql_query($query_rsSelectCommande, $boutiquedream) or die(mysql_error());
$row_rsSelectCommande = mysql_fetch_assoc($rsSelectCommande);
$totalRows_rsSelectCommande = mysql_num_rows($rsSelectCommande);
 
$maxRows_rsListe = 10;
$pageNum_rsListe = 0;
if (isset($_GET['pageNum_rsListe'])) {
  $pageNum_rsListe = $_GET['pageNum_rsListe'];
}
$startRow_rsListe = $pageNum_rsListe * $maxRows_rsListe;
 
$colname_rsListe = "-1";
if (isset($_GET['commandeID'])) {
  $colname_rsListe = $_GET['commandeID'];
}
mysql_select_db($database_boutiquedream, $boutiquedream);
$query_rsListe = sprintf("SELECT reference, quantite, prixArticle FROM listes WHERE commandeID = %s ORDER BY reference ASC", GetSQLValueString($colname_rsListe, "int"));
$query_limit_rsListe = sprintf("%s LIMIT %d, %d", $query_rsListe, $startRow_rsListe, $maxRows_rsListe);
$rsListe = mysql_query($query_limit_rsListe, $boutiquedream) or die(mysql_error());
$row_rsListe = mysql_fetch_assoc($rsListe);
 
if (isset($_GET['totalRows_rsListe'])) {
  $totalRows_rsListe = $_GET['totalRows_rsListe'];
} else {
  $all_rsListe = mysql_query($query_rsListe);
  $totalRows_rsListe = mysql_num_rows($all_rsListe);
}
$totalPages_rsListe = ceil($totalRows_rsListe/$maxRows_rsListe)-1;
 
$colname_rsCommande = "-1";
if (isset($_GET['commandeID'])) {
  $colname_rsCommande = $_GET['commandeID'];
}
mysql_select_db($database_boutiquedream, $boutiquedream);
$query_rsCommande = sprintf("SELECT commandes.`date`, commandes.etat, commandes.total, clients.nom, clients.prenom, clients.adresse, clients.ville, clients.cp, clients.tel, commandes.ID  FROM commandes, clients WHERE commandes.ID=%s AND commandes.clientID=clients.ID", GetSQLValueString($colname_rsCommande, "int"));
$rsCommande = mysql_query($query_rsCommande, $boutiquedream) or die(mysql_error());
$row_rsCommande = mysql_fetch_assoc($rsCommande);
$totalRows_rsCommande = mysql_num_rows($rsCommande);
?>
//------------Mémorisation du ID client dans la session
$clientID = mysql_result($rsRappelClient,0,'ID');
$_SESSION['clientID'] = $clientID ;
//---------------------------------------------------------
 
//-------------Enregistrement d'une nouvelle commande dans la table commandes
if ($action=="ENREGISTRER")
	 {//début du if
 	 //--------INSERTION DES PARAMETRES DE LA COMMANDE
	 mysql_select_db($database_boutiquedream, $boutiquedream);
	 $insertCommande="INSERT INTO commandes (date, clientID, total) VALUES
     (NOW(),'$clientID', '$total')";
	 $Result1=mysql_query($insertCommande, $boutiquedream);
	 $commandeID=mysql_insert_id(); 
  //récupere l'identifiant client attribué. 
 
  //RÉCUPÉRATION DES PARAMETRES DE LA LISTE 
  //DES ARTICLES
	//récupération des articles et de leur quantité,
    //puis enregistrement dans la table listes. 
	for ($i=0;$i<count($liste);$i++)
	{//début du for
	$reference=$liste[$i][0];
      //récup de la réf de l'article dans le panier
	$quantite=$liste[$i][1];
      //récup de la quantité de cet article 
	$prixArticle=$liste[$i][3];
      //récup du prix total de ces articles
 
	//INSERTION DES PARAMETRES DES ARTICLES 
    //DE LA COMMANDE
	$insertListe="INSERT INTO listes (commandeID, reference, quantite, prixArticle)
    VALUES ('$commandeID', '$reference', '$quantite', '$prixArticle')";
 	$Result1=mysql_query($insertListe, $boutiquedream);
	}//fin du for
 
  //----------DESTRUCTION DES INFORMATIONS DU PANIER
	//destruction de la liste, du total et du 
    //drapeau < action > de la session 
 	unset($_SESSION['liste']);
	unset($_SESSION['total']);
	unset($_SESSION['action']);
	}//fin du if ($action=="ENREGISTRER")
//-------------------------------------------------------------
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
<title>Untitled Document</title>
<style type="text/css">
.centrer {
	text-align: center;
}
#entete {
	height: 60px;
	width: 950px;
}
#menu {
	height: 35px;
	width: 950px;
	margin-right: auto;
	margin-left: auto;
}
#contenu {
	height: 600px;
	width: 950px;
	text-align: center;
}
#conteneur {
	width: 950px;
	margin-right: auto;
	margin-left: auto;
}
#conteneur #menu ul li {
	list-style-type: none;
	display: inline;
	font-size: 24px;
	padding-top: 0px;
	padding-bottom: 15px;
}
#conteneur #menu ul {
	list-style-type: none;
}
.espace {
	padding-right: 75px;
}
</style>
</head>
 
<body>
<div id="conteneur">
<div id="entete"><img src="../images/bandeauPublic.gif" width="950" height="60" /></div>
  <div id="menu">
  <ul>
  <li class="espace"><a href="catalogue.php">Catalogue</a></li>
  <li class="espace"><a href="panier.php">Panier</a></li>
  <li class="espace"><a href="commande.php">Commande</a></li>
  <li><a href="../administrateur/index.php">Admin</a></li>
  </u><?php echo $logoutAction ?>enu">
  <h2 class="centrer">COMMANDE</h2>
  <p><a href="<?php echo $logoutAction ?>" class="centrer">Deconnexion</a></p>
  <form id="form1" name="form1" method="get" action="commande.php">
    <table width="500" border="1" align="center">
      <tr>
        <td width="285" class="centrer">S&eacute;lectionner la commande : </td>
        <td width="199" class="centrer"><select name="commandeID" id="commandeID">
          <?php
do {  
?>
          <option value="<?php echo $row_rsSelectCommande['ID']?>"<?php if (!(strcmp($row_rsSelectCommande['ID'], $_GET['commandeID']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsSelectCommande['ID']?><?php echo $row_rsSelectCommande['date']?></option>
          <?php
} while ($row_rsSelectCommande = mysql_fetch_assoc($rsSelectCommande));
  $rows = mysql_num_rows($rsSelectCommande);
  if($rows > 0) {
      mysql_data_seek($rsSelectCommande, 0);
	  $row_rsSelectCommande = mysql_fetch_assoc($rsSelectCommande);
  }
?>
        </select>
          <input type="submit" name="button" id="button" value="Envoyer" /></td>
      </tr>
    </table>
  </form>
  <br />
  </form>
  <p>&nbsp;</p>
  <?php if ($totalRows_rsListe > 0) { // Show if recordset not empty ?>
  <table border="0" align="center">
    <tr>
      <th scope="col">Référence</th>
      <th scope="col">Quantité</th>
      <th scope="col">Prix</th>
    </tr>
    <?php do { ?>
      <tr>
        <td><?php echo $row_rsListe['reference']; ?></td>
        <td><?php echo $row_rsListe['quantite']; ?></td>
        <td><?php echo $row_rsListe['prixArticle']; ?></td>
      </tr>
      <?php } while ($row_rsListe = mysql_fetch_assoc($rsListe)); ?>
<tr>
      <td>&nbsp;</td>
      <td colspan="2">Total a payer : <?php echo $row_rsCommande['total']; ?></td>
    </tr>
  </table>
<br />
  <table width="600" border="1" align="center">
    <tr>
      <td colspan="2" class="centrer">Commande N&deg; <?php echo $row_rsCommande['ID']; ?> du <?php echo $row_rsCommande['date']; ?> - Etat : <?php echo $row_rsCommande['etat']; ?></td>
    </tr>
    <tr>
      <td colspan="2" class="centrer">Adresse de Livraison et de facturation</td>
    </tr>
    <tr>
      <td>Nom :</td>
      <td><?php echo $row_rsCommande['nom']; ?></td>
    </tr>
    <tr>
      <td>Pr&eacute;nom :</td>
      <td><?php echo $row_rsCommande['prenom']; ?></td>
    </tr>
    <tr>
      <td>T&eacute;l :</td>
      <td><?php echo $row_rsCommande['tel']; ?></td>
    </tr>
    <tr>
      <td>Adresse :</td>
      <td><?php echo $row_rsCommande['adresse']; ?></td>
    </tr>
    <tr>
      <td>Ville</td>
      <td><?php echo $row_rsCommande['ville']; ?></td>
    </tr>
    <tr>
      <td>CP :</td>
      <td><?php echo $row_rsCommande['cp']; ?></td>
    </tr>
  </table>
<p>&nbsp;</p>
  <?php if ($totalRows_rsSelectCommande == 0) { // Show if recordset empty ?>
    <p class="centrer">Vous n'avez pas encore de commande d'enregistrée.<br />
      Cliquer sur la rubrique Catalogue pour sélectionner vos articles.</p>
  <?php } // Show if recordset empty ?>
</body>
</html>
<?php
mysql_free_result($rsRappelClient);
mysql_free_result($rsSelectCommande);
mysql_free_result($rsListe);
mysql_free_result($rsCommande);
?>
travail effectué sous dream 5
ikhor est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 13/12/2010, 09h53   #2
Membre actif
 
Avatar de Meloooo
 
Mélanie
Inscription : novembre 2008
Messages : 275
Détails du profil
Informations personnelles :
Nom : Mélanie
Âge : 22

Informations forums :
Inscription : novembre 2008
Messages : 275
Points : 178
Points : 178
Bonjour,
Les balises code !
Premier abord : balise php ouverte deux fois en début de code
Meloooo est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 13/12/2010, 09h56   #3
Membre chevronné
 
Inscription : juillet 2003
Messages : 625
Détails du profil
Informations forums :
Inscription : juillet 2003
Messages : 625
Points : 600
Points : 600
Bonjour,

quel est le message d'erreur ?
__________________
Le savoir est utile que s'il est partagé par tous.
/(bb|[^b]{2})/
!sleep() ? array((string))
syl2095 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 13/12/2010, 12h53   #4
Modérateur
 
Avatar de Benjamin Delespierre
 
Benjamin Delespierre
Développeur Web
Inscription : février 2010
Messages : 2 984
Détails du profil
Informations personnelles :
Nom : Benjamin Delespierre
Âge : 24
Localisation : France

Informations professionnelles :
Activité : Développeur Web
Secteur : High Tech - Opérateur de télécommunications

Informations forums :
Inscription : février 2010
Messages : 2 984
Points : 5 015
Points : 5 015
Hello

En mettant ton code dans Eclipse, j'obtiens une erreur "Unexpected EOF", ça signifie sûrement qu'un bloc n'a pas été fermé.

J'ai trouvé: ligne #311 tu ouvres un if que tu ne ferme pas :
Code :
<?php if ($totalRows_rsListe > 0) { // Show if recordset not empty ?>
Ferme-le là ou ça va bien et l'erreur devrait disparaitre.

Edit: Le phtml j'aime pas tellement, c'est compliqué à lire et ça provoque régulièrement ce genre d'erreurs. Une petite astuce tout de même, tu peux remplacer par Plus de détails ici :http://php.net/manual/en/ini.core.php
Benjamin Delespierre est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 13/12/2010, 15h33   #5
Membre du Club
 
Inscription : août 2008
Messages : 103
Détails du profil
Informations forums :
Inscription : août 2008
Messages : 103
Points : 57
Points : 57
Par défaut affiche une erreur en fin de page

bonjour,

je te remercie de ta réponse car l'erreur est bien partie

ikhor
ikhor est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 23h32.


 
 
 
 
Partenaires

Hébergement Web