Fatal error: Cannot redeclare getsqlvaluestring() RESOLU - PHP - Programmation
Marsh Posté le 14-08-2007 à 03:00:53
et merci encore enormement à ceux qui me repondront
Marsh Posté le 14-08-2007 à 03:08:25
L'erreur est limpide :
dothalelectricite_menug.php essaye de déclarer une fonction qui est déja déclarée dans dothalelectricite_signin.php . Tu ne peux redéclarer une fonction.
Marsh Posté le 14-08-2007 à 02:58:55
salut,
j'ai un gros pb avec le site que je suis en train de programmer. J'ai ce message qui s'affiche et je n'y comprend rien et ne sais absolument pas le corriger...
donc si vous avez une solution
merci
le message en question:
Fatal error: Cannot redeclare getsqlvaluestring() (previously declared in c:\program files\easyphp1-8
En plus j'ai un gros soucis pour accéder à ma page de site desire apres une identification par mot de passe et mail... rien ne se passe...
mon script dont le nom de la page est menug.php:
<?php require_once('Connections/electricite.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 = "dothalelectricite_accueil.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo" );
exit;
}
}
?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "" )
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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"] == "achat" )) {
$insertSQL = sprintf("INSERT INTO dothal_panier (client, article, quantite) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['client'], "text" ),
GetSQLValueString($_POST['article'], "int" ),
GetSQLValueString($_POST['quantité'], "int" ));
mysql_select_db($database_electricite, $electricite);
$Result1 = mysql_query($insertSQL, $electricite) or die(mysql_error());
$insertGoTo = "account/dothalelectricite_panier.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
$paramclient_panier = "0";
if (isset($_SESSION [ 'MM_Username' ])) {
$paramclient_panier = (get_magic_quotes_gpc()) ? $_SESSION [ 'MM_Username' ] : addslashes($_SESSION [ 'MM_Username' ]);
}
$paramarticle_panier = "0";
if (isset($_GET [ 'id' ])) {
$paramarticle_panier = (get_magic_quotes_gpc()) ? $_GET [ 'id' ] : addslashes($_GET [ 'id' ]);
}
mysql_select_db($database_electricite, $electricite);
$query_panier = sprintf("SELECT id FROM dothal_panier WHERE client = '%s' AND article = '%s'", $paramclient_panier,$paramarticle_panier);
$panier = mysql_query($query_panier, $electricite) or die(mysql_error());
$row_panier = mysql_fetch_assoc($panier);
$totalRows_panier = mysql_num_rows($panier);
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['Adresse mail'])) {
$loginUsername=$_POST['Adresse mail'];
$password=$_POST['mot de passe'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "dothalelectricite_accueilclient.php";
$MM_redirectLoginFailed = "dothalelectricite_ko.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_electricite, $electricite);
$LoginRS__query=sprintf("SELECT mail, mot_de_passe FROM dothal_client WHERE mail='%s' AND mot_de_passe='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $electricite) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!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-1" />
<title>Document sans titre</title>
</head>
<body>
<div class="deco_menu">
<table align="center" width="200" border="0" >
<tr>
<td>
<font color="#CCCCCC">
<?php
$date=date("d-m-y" );
echo "DATE DU JOUR: $date";
?> </font>
<?php if(!isset ($_SESSION['MM_Username'])) {?>
<font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"> <li>S'IDENTIFIER</li> </font>
<form id="se_connecter" name="se_connecter" method="POST" action="<?php echo $loginFormAction; ?>" >
<font color="#FFFFFF" size="1" face="Arial, Helvetica, sans-serif"> Adresse mail </font> <br />
<input name="Adresse mail" type="text" id="Adresse mail" size="15" maxlength="64"/><br />
<font color="#FFFFFF" size="1" face="Arial, Helvetica, sans-serif"> Mot de passe</font> <br />
<input name="mot de passe" type="text" id="mot de passe" size="15" maxlength="6" /><BR /><br />
<label>
<input type="submit" name="Submit" value="se connecter" />
</label>
</form>
<?php } ?>
<?php if (isset ($_SESSION['MM_Username'])) { ?>
</td>
</tr>
<tr>
<td>
<font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"><li><a href=<?php echo $logoutAction ?>>SE DECONNECTER </A> </li>
</font>
<?php if ($totalRows_panier == 0) { // Show if recordset empty ?>
<form action="<?php echo $editFormAction; ?>" method="POST" name="achat">
<input name="client" type="hidden" value="<?php echo $_SESSION['MM_Username '];?>" />
<input name="article" type="hidden" value="<?php echo $row_Produit['id '] ; ?>" />
<input name="quantité" type="hidden" value="1" />
<input name="acheter" type="submit" value="acheter" />
<input type="hidden" name="MM_insert" value="achat">
</form>
<?php if ($totalRows_panier > 0) { // Show if recordset not empty ?>
<?php } // Show if recordset empty ?>
<font face="Arial, Helvetica, sans-serif" color="#FF0000" size="4"><a href="account/dothalelectricite_panier.php">"Cet article est déjà présent dans votre panier, cliquez ici pour en modifier la quantité commandée."</a></font>
<?php } // Show if recordset not empty ?>
<?php } ?> </td>
</tr>
<tr>
<td>
<font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"><li><A href="dothalelectricite_signin.php">CREER UN COMPTE </A> </li> </font>
</td>
</tr>
</table>
</div>
</body>
</html>
<?php
mysql_free_result($panier);
?>
Message édité par lylyka le 13-06-2010 à 22:58:56