Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $username= $_POST['user'];
- $password=$_POST['pass'];
- $DB_NAME = 'kampus';
- $DB_HOST = 'localhost';
- $DB_USER = 'root';
- $DB_PASS = '';
- $mysqli = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
- if (mysqli_connect_errno()) {
- printf("Connect failed: %s\n", mysqli_connect_error());
- exit();
- }
- $query = "SELECT * FROM admin WHERE user='$username' and pass = Md5('$password')";
- $result = $mysqli->query($query) or die($mysqli->error.__LINE__);
- if($result->num_rows > 0) {
- ?><script type="text/javascript">alert('Selamat Datang Admin');window.location.href="index.php";</script><?php
- }
- else {
- header("location:../index.php?pesan=gagal")or die(mysql_error());
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement