Guest User

Untitled

a guest
Aug 28th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. <?php
  2. $databasehost = 'localhost';
  3. $dbname = 'ist';
  4. $datausuario = 'root';
  5. $datapass = 'f';
  6. mysql_connect($databasehost, $datausuario, $datapass)or error("Could not connect: ".mysql_error());
  7. mysql_select_db($dbname) or error(mysql_error());
  8.  
  9. $username = $_POST['username'];
  10. if(!empty($username)){
  11. $password = md5(md5($_POST['pass']));//encriptacion
  12. $oferta = $_POST['oferta'];
  13. if(!is_numeric($oferta))
  14. {
  15. die("No puede ser numerico");//prevenimos que la oferta sea letra
  16. }
  17. $seleccion = mysql_query("SELECT * FROM users WHERE username='" . mysql_real_escape_string($username) . "' AND username='$password';");
  18. if(!$seleccion)
  19. {
  20. die("Ha ocurrido un error al digitar el username o password");
  21. } else {
  22. $encontrado = mysql_fetch_assoc($seleccion);
  23. }
  24. $xats = $encontrado['xats'];
  25. echo $xats;
  26. }
  27. ?>
  28. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  29. Username <input type="text" name="username">
  30. <br>
  31. Password <input type="password" name="pass">
  32. <br>
  33. Tu oferta <input type="text" name="oferta"> (solo numeros)
  34. <center><input type="submit" name="aceptarcuenta" value="Aceptar"></center>
  35. </form>
Add Comment
Please, Sign In to add comment