Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(!empty($_POST['username'] && $_POST['pass'])) {
- $id=0;
- $username = $_POST['username'];
- $pass = $_POST['pass'];
- $result = mysqli_query($conn,"SELECT * FROM users WHERE username='" . $username . "' AND password = '". $pass ."'");
- if(mysqli_num_rows($result)==1) {
- while ($row = mysqli_fetch_assoc($result)) {
- $id = $row['id'];
- $type = $row['type'];
- }
- $_SESSION['username'] = $username;
- $_SESSION['id'] = $id;
- if ($type == 'admin') {
- header("Location: index_af_adm.php");
- } else {
- header("Location: index_af.php");
- }
- }else{
- $message='Username sau parola sunt invalide';
- header('Location: index.php?msg=1');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement