Copy link to clipboard
Copied
Why if I use an e-mail ex:(hdhg@gmail.com) as username with the login system that dreamweaver cs5 create, don't recognizing the user name, however, if you use only letters as username then recognize it, I think it has to be with the symbols "@" and ". " Somebody know how to fix it in the PHP script that dreamweaver cs5 creates ? Thanks.
P.S. I'm using PHP and Mysql (My mysql tables are working fine, so, tables are not the problem, it's the script created by DW)
Thank you.
Copy link to clipboard
Copied
hi friend, first -> do you use the DW Code Generator, if yes this check the php generated code you will find the character "@ . " in the code , read it will or post the full code here and i will show you where it is to be able to take any string value
Copy link to clipboard
Copied
Thanks a lot: Here's the script:
<?php require_once('CONECTION'); ?>
<?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['usuario'])) {
$loginUsername=$_POST['usuario'];
$password=$_POST['pass'];
$MM_fldUserAuthorization = "nivel_acceso";
$MM_redirectLoginSuccess = "after_login.php";
$MM_redirectLoginFailed = "login_fallido.php";
$MM_redirecttoReferrer = true;
mysql_select_db($database_IBC, $IBC);
$LoginRS__query=sprintf("SELECT usuario, pass_usuario, nivel_acceso FROM adminis WHERE usuario=%s AND pass_usuario=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $IBC) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'nivel_acceso');
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']) && true) {
$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=utf-8" />
<title>Administración IBC</title>
</head>
<body>
<div id="principal">
<div align="center">
<div id="wraping">
<table>
<tr>
<td><div id="wraping2">
<form action="<?php echo $loginFormAction; ?>" class="jqtransform" method="POST" id="loging">
<div id="apDiv2">
<div id="apDiv3">
<div id="apDiv4">
<div id="admin-cabez"> Administración IBC</div>
<p class="loging"> <br />
<br />
<input name="usuario" type="text" class="validate[required]" id="usuario" />
<img name="" src="../../principal/images/trans.png" width="20" height="10" alt="" />Usuario <br />
<br />
<input type="password" name="pass" id="pass" class="validate[required]"/>
<img name="" src="../../principal/images/trans.png" width="20" height="10" alt="" />Contraseña <br />
<br />
<input name="submit" type="submit" class="jqTransformButton" id="submit" value="Aceptar" />
</p>
</div>
</div>
</div>
</form>
<br />
<br />
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
</body>
</html>
Copy link to clipboard
Copied
mmm, this code has nothing wrong , it should work correctly.
the next step now to check The Field (usuario) Data type from your table Admins
check data type from this link : http://dev.mysql.com/doc/refman/5.0/en/string-types.html
Copy link to clipboard
Copied
thanks for helping
Copy link to clipboard
Copied
my friend , i made an example for you and i uploaded to this link
http://www.4shared.com/file/t0j958Bg/Test.html
and it works fine
i wish it could help you