Ver Mensaje Individual
  #21 (permalink)  
Antiguo 22/11/2011, 15:30
Avatar de memp500
memp500
 
Fecha de Ingreso: octubre-2011
Ubicación: venezuela
Mensajes: 40
Antigüedad: 12 años, 6 meses
Puntos: 0
Respuesta: inicio de sesion

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