Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Boa tarde amigos!!! Criei um sistema de login com o dreamweaver e esta acontecendo o seguinte problema, quando eu crio um login só com números sem letras (ex: login: 123 senha: 123) O login é feito sem nenhum erro, mas quando eu crio um login com letras e numeros ou só com letras (ex: login: log123 senha: 123) aparece esse erro: Unknown column 'login123' in 'where clause' Já refiz o sistema de login mas mesmo assim aparece esse erro. O que pode ser?
Obrigado...
<?php require_once('Connections/config.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;
}
}
?>
<?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['user'])) {
$loginUsername=$_POST['user'];
$password=$_POST['senha'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "login.php";
$MM_redirectLoginFailed = "login.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_config, $config);
$LoginRS__query=sprintf("SELECT `user`, senha FROM area_cliente WHERE `user`=%s AND senha=%s",
GetSQLValueString($loginUsername, "-1"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $config) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
//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">
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sem título</title>
</head>
<body>
<form id="form1" name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<table width="683" border="0" align="center" style="margin-top:200px;">
<tr>
<td colspan="3" style="font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:24px; color:#03F;"><p>ACESSO / AREA DO CLIENTE</p>
<p> </p></td>
</tr>
<tr>
<td style="font-family:Arial, Helvetica, sans-serif; font-weight:bold;"> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="154" style="font-family:Arial, Helvetica, sans-serif; font-weight:bold;">User do login :</td>
<td width="10"> </td>
<td width="514"><label for="user"></label>
<span id="sprytextfield1">
<input type="text" name="user" id="user" />
<span class="textfieldRequiredMsg" style="font-family:Arial, Helvetica, sans-serif;">É necessário informar o user de seu login </span></span></td>
</tr>
<tr>
<td style="font-family:Arial, Helvetica, sans-serif; font-weight:bold;">Senha do login :</td>
<td> </td>
<td><label for="senha"></label>
<span id="sprytextfield2">
<input type="password" name="senha" id="senha" />
<span class="textfieldRequiredMsg" style="font-family:Arial, Helvetica, sans-serif;">É necessário informar a senha de seu login </span></span></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><input name="botao" type="submit" class="botao" id="logar" value="ENTRAR" />
</td>
<td> </td>
<td> </td>
</tr>
</table>
</form>
<p> </p>
<script type="text/javascript">
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["blur"]});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {validateOn:["blur"]});
</script>
</body>
</html>Carregando comentários...