Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //check connection to database
- if (mysqli_connect_errno())
- {
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- }
- // Perform queries
- $sql = mysqli_query("SELECT * FROM tbl_users WHERE username='$name' AND password='$password'");
- echo mysqli_num_rows($sql);
- if(mysqli_num_rows($sql)==1){
- session_start();
- $data = mysqli_fetch_array($sql);
- $_SESSION['id'] = $data['id_user'];
- $_SESSION['username'] = $data['username'];
- $_SESSION['password'] = $data['password'];
- echo "Proses Login";
- print "<html><head><meta http-equiv='refresh' content='1; URL=admin/index.php'</meta></head></html>";
- }
- else {
- echo "Login Denied";
- print "<html><head><meta http-equiv='refresh' content='1; URL=admin/index2.php'</meta></head></html>";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement