Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $myusername = $_POST['username'];
- $mypassword = $_POST['pass'];
- include("koneksi/koneksi.php");
- //proteksi dari SQL injection
- $myusernamex = stripslashes($myusername);
- $mypasswordx = stripslashes($mypassword);
- $usernametrue = mysql_real_escape_string($myusernamex);
- $passwordtrue = mysql_real_escape_string($mypasswordx);
- $sql = "select * from user_app where username = '$usernametrue' and pass = '$passwordtrue'";
- $result = mysql_query($sql);
- //menghitung jumlah baris
- $count = mysql_num_rows($result); //bila cocok maka nilainya 1
- if($count == 1){
- //register $myusername, $mypassword dan redirect ke file web.php
- session_register("myusername");
- session_register("mypassword");
- header("location: index.php");
- exit;
- } else {
- header('refresh: 3; url=./login.php');
- echo "Maaf, Password dan username anda salah";
- exit ;
- }
- ob_end_flush();
- ?>
Add Comment
Please, Sign In to add comment