Advertisement
Guest User

Untitled

a guest
Nov 8th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.80 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include "config.php";
  4. if(isset($_POST['username']) && isset($_POST['password'])){
  5. $username  = $_POST['username'];
  6. $password  = $_POST['password'];
  7. $query = $mysqli->query("SELECT * from prueba where username='$username' and password='$password'");
  8. $row   = $query->fetch_assoc();
  9. $user  = $row['username'];
  10. $pass  = $row['password'];
  11. $id    = $row['id_usuario'];
  12. $bloquear = $row['bloquear'];
  13. $usado = $row['usado'];
  14.  
  15. $sessionid=session_id();
  16.  
  17. if($username==$user && $password==$pass and $row>1){
  18.   $query = $mysqli->query("UPDATE  prueba set idses='$sessionid' where id_usuario='$id'");
  19.  
  20. $query = $mysqli->query("SELECT * from prueba where id_usuario='$id' and idses='$sessionid'");
  21. $row   = $query->fetch_assoc();
  22.  
  23. if($row['idses'] != $sessionid ){
  24. alert('ya habia una sesión por favor logueate de nuevo');
  25. echo "<script>window.location.href='contenido.php'</script>";
  26. }
  27. else{
  28.   echo "<script>window.location.href='contenido.php'</script>";
  29. }
  30.  
  31. $_SESSION['username']=$user;
  32. $_SESSION['id_usuario']=$id;
  33.  
  34.  
  35. ?>
  36. <script>window.location.href='contenido.php'</script>
  37. <?php
  38. }
  39. else{
  40.  
  41. echo  "<script>window.location.href='curso_WWK9x9.php?errorusuario=si'</script>";
  42. }
  43. }
  44. ?>
  45. <!DOCTYPE html>
  46. <html lang="en">
  47.   <head>
  48.     <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  49.     <meta charset="utf-8">
  50.     <title>Bienvenido</title>
  51.     <meta name="generator" content="Bootply" />
  52.     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  53.     <link href="css/bootstrap.min.css" rel="stylesheet">
  54.     <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css" rel="stylesheet">
  55.     <!--[if lt IE 9]>
  56.       <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
  57.     <![endif]-->
  58.  
  59. <link href="css/hoja.css" rel="stylesheet">
  60.    
  61.     <link href="css/styles.css" rel="stylesheet">
  62.    
  63.    
  64.   </head>
  65.   <body>
  66.   <div class="container" >
  67. <CENTER><h1 STYLE="color:white;">Bienvenido</h1></CENTER>
  68. <br>
  69. <center><img src="http://www.argoscursaradio.com/descargas/cursos/2016/cursonew/argoslogoblanco.png" class="img-responsive"   width="50%"  /></center>
  70.  
  71. <div class="col-md-4">
  72.  
  73. </div>
  74. <?php  $error=$_GET["errorusuario"]; ?>
  75.  
  76. <!-- inicia div medio -->
  77. <div class="col-md-4">
  78. <center>
  79. <section class="login-form">
  80.         <form method="post">
  81.          
  82.           <input type="text" name="username" placeholder="usuario" required class="form-control input-lg"  style="margin-bottom: 20px;" />
  83.           <input type="password" class="form-control input-lg" name="password" id="password" placeholder="Contraseña" style="margin-bottom: 20px;"  required="" />
  84.           <button type="submit" name="go" class="btn btn-lg btn-primary btn-block">Entrar</button>
  85.           <?php
  86. if($error=="si"){
  87. echo "<font color=red><center><b>Datos incorrectos</b></center></font>";
  88. }?>
  89.         </form>
  90.         <center>
  91.           <div id="final">
  92.           <h3>Siguenos</h3>
  93.           <div class="btn-group">
  94.           <a class="btn btn-twitter" href="https://twitter.com/argoscursa" target="_blank"><i class="icon-twitter icon-large"></i> Twitter</a>
  95.           <a class="btn btn-facebook" href="https://www.facebook.com/ArgosCursa-159244994166107/timeline/" target="_blank"><i class="icon-facebook icon-large"></i> Facebook</a>
  96.           </div>
  97.           <br>
  98.           <p> ArgosCursa Derechos Reservados 2016 <p><br>
  99.           <a href="aviso.php" style="color:white;">Aviso de Privacidad</a>
  100.           </div>
  101.         </center>
  102. </section>
  103. </center>
  104. </div> <!-- termina div medio -->
  105. <div class="col-md-4"></div>
  106. </div>
  107. </div>
  108. <!-- script references -->
  109. <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
  110. <script src="js/bootstrap.min.js"></script>
  111. </body>
  112. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement