Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Galera estou com um sério problema no projeto que estou desenvolvendo.
Vejam o problema:
Ao clicar em determinado link abre-se a pagina "confirm_compra2.php?codprod=1471807994", ou seja estou passando um valor pela URL e recuperando na página com "$_GET['codprod']". Até ai tudo bem.
Criei então o recurso de Log in User do DreamWeaver. Porém agora quando o usuário digita seu nome de usuário ou senha incorretos a página atualiza mas não consigo mais recuperar o valor do código do produto.
vejam o meu codigo e se puderem me ajudar eu agradeço, pois cinceramente não sei onde estou errando:
<?php require_once('../Connections/ConnLA.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;$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
$codigoproduto= $_GET['codprod'];//Variavel que captura o valor passado via URL
// *** 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['apelido'])) {
$loginUsername=$_POST['apelido'];
$password=$_POST['senha'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "compra_confirmada.php";
/COLOQUEI INCLUSIVE OS VALORES A PASSAR PELA URL QUANTO O USUÁRIO ERRAR O LOGIN, PORÉM SÓ PASSA O VALOR "erroLogin=true" O OUTRO "codprod=$codigoproduto" RETORNA VAZIO. /
$MM_redirectLoginFailed = "confirm_compra2.php?erroLogin=true&codprod=$codigoproduto";
$MM_redirecttoReferrer = false;
mysql_select_db($database_ConnLA, $ConnLA);
$LoginRS__query=sprintf("SELECT strUsrApelido, strUsrSenha FROM la_usuarios WHERE strUsrApelido=%s AND strUsrSenha=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $ConnLA) 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 );
}header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<html>
<head>
<title>teste</title>
</head>
<body>
<div align="center">
<form name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" rowspan="2" align="center" style="border-right:#666 solid 2px;">echo $codigoproduto;
?>
</td>
<td width="50%" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20%" height="25" align="right" style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;">Apelido:</td>
<td align="left"><input name="apelido" type="text" id="apelido" maxlength="30" ></td>
</tr>
<tr>
<td height="25" align="right" style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;">Senha:</td>
<td><input name="senha" type="text" id="senha" maxlength="32">
</td>
</tr>
</table></td>
</tr>
<tr>
<td height="40" align="center"><input type="submit" name="button" id="button" value="Confirmar"></td>
</tr>
</table>
</form>
</div>
</body>
</html>Por favor me ajudem, não estou conseguindo passar o valor novamente via url quando o usuário "erra" o login. [http://forum.imasters.com.br/public/style_emoticons/](http://forum.imasters.com.br/public/style_emoticons/)default/natal_sad.gifCarregando comentários...