Advertisement
AloneZ

Untitled

Apr 18th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1. <?php
  2. function ConectarBD()
  3. {
  4.     $server = "localhost";
  5.     $db = "ssrpdb";
  6.     $user = "root";
  7.     $pass = "52160967";
  8.     try
  9.     {
  10.         $pdo = new PDO("mysql:host=$server;dbname=$db", $user, $pass);
  11.     }
  12.     catch(PDOException $e)
  13.     {
  14.         echo"<script type='text/javascript'> window.alert('NAO FOI POSSIVEL SE CONECTAR COM O BANCO DE DADOS');</script>". $e->getMessage();
  15.         exit();
  16.     }
  17. }
  18. function SelectDB()
  19. {
  20.     $pdo = ConectarBD();
  21.     $BUSegura = $pdo->prepare("SELECT * FROM accounts WHERE Username=:user OR Password= :pass");
  22.    
  23.     $BUSegura->bindValue(":user", "Sr.AloneZ");
  24.     $BUSegura->bindValue(":pass", "52160967");
  25.     $BUSegura->execute();
  26.     echo $BUSegura->rowCount();
  27.    
  28.     echo $BUSegura['user'];
  29. }
  30. SelectDB()
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement