Advertisement
Guest User

Untitled

a guest
Mar 20th, 2017
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include("php/connect_to_mysql.php");
  4.  
  5. $msg = "";
  6. $submit = $_POST['btnLogin'];
  7.  
  8. if($submit == "Log in"){
  9. $sqlSelUser = mysql_query("select * from tblaccount where username = '$_POST[txtLogin]' and password = '$_POST[txtPassword]' limit 1") or die(mysql_error());
  10. if(mysql_num_rows($sqlSelUser) == 1){
  11. $getAccUserId = mysql_fetch_array($sqlSelUser);
  12. $userid = $getAccUserId["user_id"];
  13.  
  14. $sqlSelUserInfo = mysql_query("select user_type, fname, mname, lname from tblusers where user_id = '$userid'") or die(mysql_error());
  15. $getUserInfo = mysql_fetch_array($sqlSelUserInfo);
  16. $fname = $getUserInfo["fname"];
  17. $mname = $getUserInfo["mname"];
  18. $lname = $getUserInfo["lname"];
  19. $name = $lname.", ".$fname." ".$mname;
  20. $userType = $getUserInfo["user_type"];
  21. $_SESSION["name"] = $name;
  22.  
  23. if($userType == "Administrator")
  24. header("location: admin_addnew_user.php");
  25. else if($userType == "Clerk")
  26. header("location: clerk_addnew_product.php");
  27. else
  28. $msg = '<p align="right" style="color:#a03; font-size:13px; margin-bottom:3px; margin-right:50px;">Something wrong with the account!</p>';
  29. }else
  30. $msg = '<p align="right" style="color:#a03; font-size:13px; margin-bottom:3px; margin-right:50px;">Username / Password does not exist!</p>';
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement