muchas gracias
este es el script que estoy utilizando:
Código:
<?php require_once('CONECCION'); ?> <?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 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 = false; mysql_select_db($database_IBC, $IBC); $LoginRS__query=sprintf("SELECT e_mail_usuario, pass_usuario, nivel_acceso FROM adminis WHERE e_mail_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();} $_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=utf-8" /> <title>Administración IBC</title> </head> <body> <div id="principal"> <div align="center"> <div id="wraping"> <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 (e-mail) <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> </div> </div> </div> </body> </html>