Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include("php/connect_to_mysql.php");
- $msg = "";
- $submit = $_POST['btnLogin'];
- if($submit == "Log in"){
- $sqlSelUser = mysql_query("select * from tblaccount where username = '$_POST[txtLogin]' and password = '$_POST[txtPassword]' limit 1") or die(mysql_error());
- if(mysql_num_rows($sqlSelUser) == 1){
- $getAccUserId = mysql_fetch_array($sqlSelUser);
- $userid = $getAccUserId["user_id"];
- $sqlSelUserInfo = mysql_query("select user_type, fname, mname, lname from tblusers where user_id = '$userid'") or die(mysql_error());
- $getUserInfo = mysql_fetch_array($sqlSelUserInfo);
- $fname = $getUserInfo["fname"];
- $mname = $getUserInfo["mname"];
- $lname = $getUserInfo["lname"];
- $name = $lname.", ".$fname." ".$mname;
- $userType = $getUserInfo["user_type"];
- $_SESSION["name"] = $name;
- if($userType == "Administrator")
- header("location: admin_addnew_user.php");
- else if($userType == "Clerk")
- header("location: clerk_addnew_product.php");
- else
- $msg = '<p align="right" style="color:#a03; font-size:13px; margin-bottom:3px; margin-right:50px;">Something wrong with the account!</p>';
- }else
- $msg = '<p align="right" style="color:#a03; font-size:13px; margin-bottom:3px; margin-right:50px;">Username / Password does not exist!</p>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement