Guest User

Untitled

a guest
Dec 6th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 14.75 KB | None | 0 0
  1.     <?php
  2. ini_set("session.use_only_cookies","1");
  3. ini_set("session.use_trans_sid","0");
  4.  
  5. include("conex.php");
  6.  
  7. require_once "recaptchalib.php";
  8. // Register API keys at https://www.google.com/recaptcha/admin
  9. $siteKey = "6LfP-iIUAAAAAI8tb0ISBP76WsB57GbI27vNkmqK";
  10. $secret = "6LfP-iIUAAAAAFcDCu8F9zx1PxdQRQZriOyk1k1q";
  11. // The error code from reCAPTCHA, if any
  12. $error = null;
  13.  
  14.  
  15. if (@$_POST['action']=="add") {
  16.  
  17.     @$nick = @$_POST['nick'];
  18.     @$pass =  base64_encode(($_POST['pass']));
  19.    
  20.     @$b_user = $conexion->query("SELECT * FROM users WHERE user='$nick' and borrado = 'N'");
  21.     $_SESSION["ultimoAcceso"]= date("Y-n-j H:i:s");
  22.     @session_set_cookie_params(0, "/", $HTTP_SERVER_VARS["HTTP_HOST"], 0);
  23.    
  24.     $ses = @$b_user->fetch_object();
  25.     if (@mysqli_num_rows($b_user)) {
  26.         if ($ses->password == $pass) {
  27.           $_SESSION['id'] = $ses->id;
  28.           $_SESSION['fecha'] = $ses->fecha;
  29.           $_SESSION['email'] = $ses->mail;
  30.           $_SESSION['pass'] = $ses->password;          
  31.           $_SESSION['dni'] = $ses->dni;
  32.           $_SESSION['nombre'] = $ses->nombre;
  33.           $_SESSION['apellido'] = $ses->apellido;
  34.           $_SESSION['cargo'] = $ses->cargo;
  35.           $_SESSION['user'] = $ses->user;
  36.           $_SESSION['search'] = $ses->search;
  37.           $_SESSION['recarga'] = $ses->recarga;
  38.           $_SESSION['persona'] = $ses->persona;
  39.           $_SESSION['parcela'] = $ses->parcela;
  40.           $_SESSION['register'] = $ses->register;
  41.           $_SESSION['register_web'] = $ses->register_web;
  42.           $_SESSION['banned'] = $ses->banned;
  43.           $_SESSION['web'] = 'N';
  44.           $_SESSION['intentos'] = 0;
  45.         }else{
  46.           $error=1;
  47.         }
  48.     }    
  49.     if(@$ses->user == ""){  
  50.       $error=2;
  51.     }
  52.  
  53.     if($error==2){
  54.         @$b_user = $conexion->query("SELECT * FROM usuarios_web WHERE email='$nick' and activo = 'S'");
  55.         $_SESSION["ultimoAcceso"]= date("Y-n-j H:i:s");
  56.         @session_set_cookie_params(0, "/", $HTTP_SERVER_VARS["HTTP_HOST"], 0);
  57.  
  58.         $ses = @$b_user->fetch_object();
  59.         if (@mysqli_num_rows($b_user)) {
  60.             if ($ses->contrasenia == $pass) {
  61.               $_SESSION['id'] = $ses->id;
  62.               $_SESSION['tipo'] = $ses->tipo;
  63.               $_SESSION['email'] = $ses->mail;
  64.               $_SESSION['empresa'] = $ses->empresa;
  65.               $_SESSION['dni'] = $ses->dni;
  66.               $_SESSION['nombrerazon'] = $ses->nombrerazon;
  67.               $_SESSION['fechaalta'] = $ses->fechaalta;
  68.               $_SESSION['web'] = 'S';
  69.               if($ses->tipo=='EM'){
  70.                $search= $conexion->query("SELECT * FROM empresas WHERE id=$ses->empresa and activo = 'S'");
  71.                $find = @$search->fetch_object();
  72.                $_SESSION['consultas'] = $find->consultas;
  73.               }else{
  74.                $_SESSION['consultas'] = $ses->consultas;  
  75.               }
  76.             }else{
  77.               $error=1;
  78.             }
  79.         }    
  80.         if(@$ses->user == ""){  
  81.           $error=2;
  82.         }
  83.     }
  84.      
  85. }
  86. if (isset($_GET['modo']) == 'desconectar') {
  87.     session_destroy();
  88.     $bd = null; ?>
  89.     <!DOCTYPE html>
  90.     <html lang="en">
  91.       <head>
  92.         <meta http-equiv="Refresh" content="2;url=login.php">  
  93.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  94.         <!-- Meta, title, CSS, favicons, etc. -->
  95.         <meta charset="utf-8">
  96.         <meta http-equiv="X-UA-Compatible" content="IE=edge">
  97.         <meta name="viewport" content="width=device-width, initial-scale=1">
  98.  
  99.         <title>INMUEBLES | XEREX</title>
  100.  
  101.         <!-- Bootstrap -->
  102.         <link href="../../../vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
  103.         <!-- Font Awesome -->
  104.         <link href="../../../vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
  105.         <!-- NProgress -->
  106.         <link href="../../../vendors/nprogress/nprogress.css" rel="stylesheet">
  107.         <!-- Animate.css -->
  108.         <link href="../../../vendors/animate.css/animate.min.css" rel="stylesheet">
  109.  
  110.         <!-- Custom Theme Style -->
  111.         <link href="../../../build/css/custom.min.css" rel="stylesheet">
  112.         <script>
  113.           function onSubmit() {
  114.              document.getElementById("login_user").submit();
  115.           }
  116.         </script>
  117.  
  118.       </head>
  119.  
  120.       <body class="login">
  121.         <div>
  122.           <a class="hiddenanchor" id="signup"></a>
  123.           <a class="hiddenanchor" id="signin"></a>
  124.  
  125.           <div class="login_wrapper">
  126.             <div class="animate form login_form">
  127.               <section class="login_content">
  128.                 <center><img align="center" src="../../images/lightbox-ico-loading.gif" ></center></br>
  129.                 <center><label>Te estas desconectando del sistema ... </label></center>
  130.                     <form name="login_user" action="#" method="post">
  131.                       <div class="clearfix"></div>
  132.  
  133.                       <div class="separator">
  134.                         </p>
  135.                         <div class="clearfix"></div>
  136.                         <br />
  137.                         <div>
  138.                           <h1><i class="fa fa-home"></i>INMUEBLES</h1>
  139.                               <p>Desarrollo XereX Soluciones IT ©2018 </p>
  140.                         </div>
  141.                       </div>
  142.                     </form>
  143.               </section>
  144.             </div>              
  145.           </div>
  146.         </div>
  147.       </body>
  148.     </html>
  149. <?php
  150.     exit();
  151. }
  152.  
  153. if (isset($_SESSION['id'])) {
  154.      header ('Location: ../configuracion/index.php');
  155. } else { ?>
  156.        
  157.         <!DOCTYPE html>
  158.         <html lang="en">
  159.           <head>
  160.             <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  161.             <!-- Meta, title, CSS, favicons, etc. -->
  162.             <meta charset="utf-8">
  163.             <meta http-equiv="X-UA-Compatible" content="IE=edge">
  164.             <meta name="viewport" content="width=device-width, initial-scale=1">
  165.  
  166.             <title>Inmuebles XereX</title>
  167.  
  168.             <!-- Bootstrap -->
  169.             <link href="../../../vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
  170.             <!-- Font Awesome -->
  171.             <link href="../../../vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
  172.             <!-- NProgress -->
  173.             <link href="../../../vendors/nprogress/nprogress.css" rel="stylesheet">
  174.             <!-- Animate.css -->
  175.             <link href="../../../vendors/animate.css/animate.min.css" rel="stylesheet">
  176.  
  177.             <!-- Custom Theme Style -->
  178.             <link href="../../../build/css/custom.min.css" rel="stylesheet">
  179.             <script src="https://www.google.com/recaptcha/api.js" async defer></script>
  180.              <script>
  181.                    function onSubmit() {
  182.                      document.getElementById("login_user").submit();
  183.                    }
  184.              </script>
  185.          
  186.           </head>
  187.  
  188.           <body class="login">
  189.             <div>
  190.               <a class="hiddenanchor" id="signup"></a>
  191.               <a class="hiddenanchor" id="signin"></a>
  192.  
  193.               <div class="login_wrapper">
  194.                 <div class="animate form login_form">
  195.                   <section class="login_content">
  196.                     <form name="login_user" id="login_user" action="#" method="post">
  197.                       <h1>Ingreso al Sistema</h1>
  198.                       <div>
  199.                         <input type="text" class="form-control" name="nick" placeholder="Usuario" required="" />
  200.                       </div>
  201.                       <div>
  202.                         <input type="password" class="form-control" name="pass" placeholder="Contrase&ntilde;a" required="" />
  203.                       </div>
  204.                       <div>
  205.                           <button name="login"  type="submit" class="g-recaptcha btn btn-default submit" data-sitekey="6LfP-iIUAAAAAI8tb0ISBP76WsB57GbI27vNkmqK" data-callback='onSubmit'>Ingresar</button>
  206.                           <input type="hidden"  id="action" name="action" value="add" /></br>
  207.                     </div>
  208.  <!--                      <div>
  209.                           <button class="btn btn-default submit" type="submit" name="login">Ingresar</button>
  210.                         <a class="reset_pass" href="#">Lost your password?</a>
  211.                       </div>-->
  212.  
  213.                       <div class="clearfix"></div>
  214.  
  215.                       <div class="separator">
  216.         <!--                <p class="change_link">New to site?-->
  217.         <!--                  <a href="#signup" class="to_register"> Create Account </a>-->
  218.                         </p>
  219.             <?php     if(@$error==2){  ?>    
  220.                           <div class="col-md-12 ">
  221.                            <div class="alert alert-danger alert-dismissible fade in" role="alert">
  222.                             <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span>
  223.                             </button>
  224.                             <strong>Alerta!</strong> Nombre de usuario no existe.
  225.                           </div>
  226.                         </div>
  227.             <?php     }
  228.                       if(@$error==1){       ?>            
  229.                         <div class="col-md-12 ">
  230.                            <div class="alert alert-danger alert-dismissible fade in" role="alert">
  231.                             <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span>
  232.                             </button>
  233.                             <strong>Alerta!</strong> Contrase&ntilde;a incorrecta.
  234.                            </div>
  235.                         </div>
  236.             <?php     }   ?>                
  237.                         <div class="clearfix"></div>
  238.                         <br />
  239.                         <div>
  240.                           <h1><i class="fa fa-home"></i> INMUEBLES</h1>
  241.                           <p><a href="http://www.xerex.com.ar">Desarrollo XereX Soluciones IT ©2018</a></p>
  242.                         </div>
  243.                       </div>
  244.                     </form>
  245.                   </section>
  246.                 </div>
  247.  
  248. <!--                <div id="register" class="animate form registration_form">
  249.                   <section class="login_content">
  250.                     <form>
  251.                       <h1>Create Account</h1>
  252.                       <div>
  253.                         <input type="text" class="form-control" placeholder="Username" required="" />
  254.                       </div>
  255.                       <div>
  256.                         <input type="email" class="form-control" placeholder="Email" required="" />
  257.                       </div>
  258.                       <div>
  259.                         <input type="password" class="form-control" placeholder="Password" required="" />
  260.                       </div>
  261.                       <div>
  262.                         <a class="btn btn-default submit" href="index.html">Submit</a>
  263.                       </div>
  264.  
  265.                       <div class="clearfix"></div>
  266.  
  267.                       <div class="separator">
  268.                         <p class="change_link">Already a member ?
  269.                           <a href="#signin" class="to_register"> Log in </a>
  270.                         </p>
  271.  
  272.                         <div class="clearfix"></div>
  273.                         <br />
  274.  
  275.                         <div>
  276.                           <h1><i class="fa fa-paw"></i> Gentelella Alela!</h1>
  277.                           <p>©2016 All Rights Reserved. Gentelella Alela! is a Bootstrap 3 template. Privacy and Terms</p>
  278.                         </div>
  279.                       </div>
  280.                     </form>
  281.                   </section>
  282.                 </div>-->
  283.               </div>
  284.             </div>
  285.  
  286.     <!-- jQuery -->
  287.     <script src="../../../vendors/jquery/dist/jquery.min.js"></script>
  288.     <!-- Bootstrap -->
  289.     <script src="../../vendors/bootstrap/dist/js/bootstrap.min.js"></script>
  290.     <!-- FastClick -->
  291.     <script src="../../../vendors/fastclick/lib/fastclick.js"></script>
  292.     <!-- NProgress -->
  293.     <script src="../../../vendors/nprogress/nprogress.js"></script>
  294.     <!-- bootstrap-progressbar -->
  295.     <script src="../../../vendors/bootstrap-progressbar/bootstrap-progressbar.min.js"></script>
  296.     <!-- iCheck -->
  297.     <script src="../../../vendors/iCheck/icheck.min.js"></script>
  298.        
  299.              
  300.     <!-- Custom Notification -->
  301.     <script>
  302.        
  303.       $(document).ready(function() {
  304.         var cnt = 10;
  305.  
  306.         TabbedNotification = function(options) {
  307.           var message = "<div id='ntf" + cnt + "' class='text alert-" + options.type + "' style='display:none'><h2><i class='fa fa-bell'></i> " + options.title +
  308.             "</h2><div class='close'><a href='javascript:;' class='notification_close'><i class='fa fa-close'></i></a></div><p>" + options.text + "</p></div>";
  309.  
  310.           if (!document.getElementById('custom_notifications')) {
  311.             alert('doesnt exists');
  312.           } else {
  313.             $('#custom_notifications ul.notifications').append("<li><a id='ntlink" + cnt + "' class='alert-" + options.type + "' href='#ntf" + cnt + "'><i class='fa fa-bell animated shake'></i></a></li>");
  314.             $('#custom_notifications #notif-group').append(message);
  315.             cnt++;
  316.             CustomTabs(options);
  317.           }
  318.         };
  319.  
  320.         CustomTabs = function(options) {
  321.           $('.tabbed_notifications > div').hide();
  322.           $('.tabbed_notifications > div:first-of-type').show();
  323.           $('#custom_notifications').removeClass('dsp_none');
  324.           $('.notifications a').click(function(e) {
  325.             e.preventDefault();
  326.             var $this = $(this),
  327.               tabbed_notifications = '#' + $this.parents('.notifications').data('tabbed_notifications'),
  328.               others = $this.closest('li').siblings().children('a'),
  329.               target = $this.attr('href');
  330.             others.removeClass('active');
  331.             $this.addClass('active');
  332.             $(tabbed_notifications).children('div').hide();
  333.             $(target).show();
  334.           });
  335.         };
  336.  
  337.         CustomTabs();
  338.  
  339.         var tabid = idname = '';
  340.  
  341.         $(document).on('click', '.notification_close', function(e) {
  342.           idname = $(this).parent().parent().attr("id");
  343.           tabid = idname.substr(-2);
  344.           $('#ntf' + tabid).remove();
  345.           $('#ntlink' + tabid).parent().remove();
  346.           $('.notifications a').first().addClass('active');
  347.           $('#notif-group div').first().css('display', 'block');
  348.         });
  349.       });
  350.     </script>
  351.     <!-- /Custom Notification -->
  352.     <script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl=<?php echo $lang;?>"></script>
  353.              
  354.           </body>
  355.         </html>
  356. <?php } ?>
Add Comment
Please, Sign In to add comment