joris

Untitled

Mar 28th, 2012
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. <?php
  2. if ( isset($_POST['username']) && isset($_POST['password']) ) {
  3.  
  4. $con = mysql_connect("localhost","db_usiswa","password");
  5. if (!$con)
  6.   {
  7.   die('Could not connect : ' . mysql_error());
  8.   }
  9. mysql_select_db("db_siswa", $con);
  10. $sql="select * from tbl_login where username = '" . $_POST['username'] . "' and password = '" . $_POST['password']. "'";
  11. $query=mysql_query($sql);
  12. if($query){    
  13.          $arr_sukses = array ('response'=>'SuksesLogin');
  14.          echo json_encode($arr_sukses);
  15. }else {
  16.          $arr_gagal = array ('response'=>'GagalLogin');
  17.          echo json_encode($arr_gagal);    
  18.       }
  19. } else{
  20.  echo "No Post Here";
  21. }
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment