Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "connect.php";
- $username= isset($_POST['username'])?$_POST['username']:NULL;
- $password= isset($_POST['password'])?$_POST['password']:NULL;
- if (!empty($username) && !empty($password))
- {
- $username = mysql_real_escape_string(stripslashes($username));
- $password = mysql_real_escape_string(stripslashes($password));
- $sql="SELECT * "
- ."FROM login "
- ."WHERE username='".$username."'"
- ."AND password='".$password."'";
- if($result=mysql_query($sql))
- {
- if(mysql_num_rows($result)==1)
- {
- $r=mysql_fetch_array($result);
- session_start();
- $_SESSION['username']=$r['username'];
- $_SESSION['status']=$r['status'];
- }
- else
- {
- echo "No data founds";
- }
- }
- }
- {
- echo "<script>alert('isi username dan password anda!');javascript:history.go(-1);</script>";
- exit;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment