Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. <?php
  2.  
  3. $username = $_POST['txt1'];
  4. $password = $_POST['txt2'];
  5.  
  6. if(empty($username) || empty($password)){
  7. echo "<script>alert('Llena todos los campos!');</script>";
  8. }
  9. else{
  10. $tsql = "SELECT * FROM CatUsuarios WHERE U_UsdName='$username' AND U_Password='$password' LIMIT 1";
  11. }
  12. $stmt = sqlsrv_query( $conn, $tsql);
  13. while($Row=sqlsrv_fetch_array($stmt)){
  14. if($stmt == true){
  15. $_SESSION['valid_user'] = true;
  16. $_SESSION['usuario'] = $username;
  17. header('Location: index.php');
  18. die();
  19. }else{
  20. header('Location: error.html');
  21. die();
  22. }
  23. }
  24.  
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement