Advertisement
Guest User

Untitled

a guest
Aug 14th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. <?php
  2. $tbl_name="login"; // table name
  3.  
  4. // Connect to server and select database.
  5.   $connect=odbc_connect('0901070','','');
  6.   if (!$connect)
  7.   {
  8.     exit("Connection Failed: " . $connect);
  9.   }
  10.  
  11. // username and password sent from form
  12. $username=$_POST['username'];
  13. $password=$_POST['password'];
  14.  
  15.  
  16. $sql="SELECT * FROM $tbl_name WHERE username='$username' AND password='$password'";
  17. $result=odbc_exec($connect, $sql);
  18. if (!$result)
  19.   {exit("Error in SQL");}
  20. if (odbc_fetch_row($result))
  21.   {
  22.   $user=odbc_result($result,"username");
  23.     echo "hi, " . $user;
  24.   }
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement