Ver Mensaje Individual
  #32 (permalink)  
Antiguo 22/11/2011, 16:05
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: inicio de sesion

este te tiene que redireccionar bien si el usuario no existe redirecciona a falleuser y si la pass no es igual tambien y en caso de ser igual te crea las sesiones y redirecciona a welcome cualquier error me comentas y ahora te miro lo otro

Código PHP:
Ver original
  1. <?php require_once('Connections/config.php');
  2. if (!function_exists("GetSQLValueString")) {
  3.     function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  4.     {
  5.       if (PHP_VERSION < 6) {
  6.         $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  7.       }
  8.      
  9. $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  10.      
  11.       switch ($theType) {
  12.         case "text":
  13.           $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  14.           break;    
  15.         case "long":
  16.         case "int":
  17.           $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  18.           break;
  19.         case "double":
  20.           $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  21.           break;
  22.         case "date":
  23.           $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  24.           break;
  25.         case "defined":
  26.           $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  27.           break;
  28.       }
  29.       return $theValue;
  30.     }
  31.     }
  32.      
  33.     mysql_select_db($database_config, $config);
  34.     $query_Recordset1 = "SELECT * FROM FT_USUARIOS";
  35.     $Recordset1 = mysql_query($query_Recordset1, $config) or die(mysql_error());
  36.     $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  37.     $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  38.      
  39.     $colname_Recordset2 = "-1";
  40.     if (isset($_SESSION['MM_username'])) {
  41.         $colname_Recordset2 = $_SESSION['MM_username'];
  42.         }
  43.        
  44.     mysql_select_db($database_config, $config);
  45.     $query_Recordset2 = sprintf("SELECT usuario FROM FT_USUARIOS WHERE usuario = %s", GetSQLValueString($colname_Recordset2, "text"));
  46.     $Recordset2 = mysql_query($query_Recordset2, $config) or die(mysql_error());
  47.     $row_Recordset2 = mysql_fetch_assoc($Recordset2);
  48.     $totalRows_Recordset2 = mysql_num_rows($Recordset2);
  49.  
  50.     // *** Validate request to login to this site.
  51.     if (!isset($_SESSION)) {
  52.     }
  53.      
  54.     $loginFormAction = $_SERVER['PHP_SELF'];
  55.    
  56.     if (isset($_GET['accesscheck'])) {
  57.       $_SESSION['PrevUrl'] = $_GET['accesscheck'];
  58.     }
  59.      
  60.     if (isset($_POST['usuario'])) {
  61.       $loginUsername=$_POST['usuario'];
  62.       $password=$_POST['pass'];
  63.       $MM_fldUserAuthorization = "";
  64.       $MM_redirectLoginSuccess = "?seccion=welcome";
  65.       $MM_redirectLoginFailed = "?seccion=falleuser";
  66.       $MM_redirecttoReferrer = false;
  67.       mysql_select_db($database_config, $config);
  68.      
  69.       $LoginRS__query=sprintf("SELECT usuario, pass FROM FT_USUARIOS WHERE usuario=%s AND pass=%s",
  70.         GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
  71.    
  72.        
  73.       $LoginRS = mysql_query($LoginRS__query, $config) or die(mysql_error());
  74.       $loginFoundUser = mysql_num_rows($LoginRS);
  75.       $login_results = mysql_fetch_array($LoginRS);
  76.  
  77.      
  78.       if ($loginFoundUser) {
  79.          $loginStrGroup = "";}
  80.        
  81.         //declare two session variables and assign them
  82.        
  83.        
  84.           if($login_results['usuario'] != $loginUsername) {
  85.              
  86.               header("Location: " . $MM_redirectLoginFailed );
  87.  
  88.             }else{
  89.  
  90.           if($login_results['pass'] != $password) {
  91.    
  92.               header("Location: " . $MM_redirectLoginFailed );
  93.  
  94.             }else{     
  95.  
  96.  
  97.               $_SESSION['MM_Username'] = $loginUsername;
  98.               $_SESSION['MM_UserGroup'] = $loginStrGroup;
  99.               header("Location: " . $MM_redirectLoginSuccess );
  100.              
  101.              
  102.               }}}?>
  103.              
  104.              
  105.              
  106.     <div id="content-box">
  107.             <div class="padding">
  108.                 <div class="login" id="element-box">
  109.                     <div class="t">
  110.                         <div class="t">
  111.                             <div class="t"></div>
  112.                         </div>
  113.                     </div>
  114.                     <div class="m">
  115.      
  116.                         <h1>Ingreso de Usuarios Registrados</h1>
  117.                        
  118.                                 <div id="section-box">
  119.                 <div class="t">
  120.                     <div class="t">
  121.                         <div class="t"></div>
  122.                     </div>
  123.                 </div>
  124.                 <div class="m">
  125.             <form action="<?php echo $loginFormAction; ?>" style="clear: both;" id="form-login" name="login" method="POST">
  126.         <p id="form-login-username">
  127.             <label for="modlgn_username">Usuario</label>
  128.             <input type="text" size="15" class="inputbox" id="modlgn_username" name="usuario">
  129.         </p>
  130.      
  131.         <p id="form-login-password">
  132.             <label for="modlgn_passwd">Contraseña</label>
  133.             <input type="password" size="15" class="inputbox" id="modlgn_passwd" name="pass">
  134.         </p>
  135.             <p style="clear: both;" id="form-login-lang">
  136.            
  137.         <div class="button_holder">
  138.         <div class="button1">
  139.             <div class="next">
  140.                 <a onclick="login.submit();">
  141.                     Entrar</a>
  142.      
  143.             </div>
  144.         </div>
  145.         </div>
  146.         <div class="clr"></div>
  147.         <input type="submit" value="Entrar" style="border: 0; padding: 0; margin: 0; width: 0px; height: 0px;">
  148.        
  149.        
  150.         </form>
  151.     <div class="clr"></div>
  152.                 </div>
  153.     <div class="b">
  154.                     <div class="b">
  155.                         <div class="b"></div>
  156.                     </div>
  157.                 </div>
  158.             </div>
  159.            
  160.                         <p>Ingresa un nombre de usuario y contraseña validos para acceder al Sistema.</p>
  161.                         <p>
  162.                             <a href="javascript:history.back(1)">Regresar a la Pagina Anterior</a>
  163.                         </p>
  164.                         <div id="lock"></div>
  165.                         <div class="clr"></div>
  166.                     </div>
  167.         <div class="h_green" id="border-top">
  168.             <div>
  169.                 <div>
  170.                     <div class="adminform">Insurance Broker Sistem By ARTEM LABS, CA</div>
  171.                 </div>
  172.             </div>
  173.         </div>
  174.                     <div class="b">
  175.                         <div class="b">
  176.                             <div class="b"></div>
  177.                         </div>
  178.                     </div>
  179.                 </div>
  180.                             <div class="clr"></div>
  181.             </div>
  182.     </div>
  183.         <div id="border-bottom"><div><div></div></div>
  184.     </div>
  185.     </body><?php
  186.     mysql_free_result($Recordset1);
  187.      
  188.     mysql_free_result($Recordset2);
  189.     ?>