Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if(isset($_POST['submit'])){
- $con = mysqli_connect("localhost","root","","imetrics");
- $username = $_POST['username'];
- $password = $_POST['password'];
- $user = mysqli_query($con, "SELECT * FROM user WHERE password='$password' AND username='$username'")or die("Cannot connect");
- $count = mysqli_num_rows($user);
- if($count > 0) {
- $row = mysqli_fetch_assoc($user);
- if($row['usertype'] == 'Client'){
- $_SESSION['username'] = $_POST['username'];
- header("location:a.php");
- }
- else{
- $_SESSION['age'] = $row['age']; // declaration ng session na AGE na ang value is from AGE column ng user na nag login
- //DITO KA MAG LAGAY NG IF STATEMENT
- $_SESSION['username'] = $_POST['username'];
- header("location:takesurvey.php");
- }
- }
- else{
- echo '<script language="javascript">';
- echo 'alert("Wrong username/password")';
- echo '</script>';
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement