Jump to content

Search the Community

Showing results for tags 'limitation'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. HI, Guys Im back! After i successfully found my solution to problem earlier. I want to ask what code i will add to have limitation to employee to admin can access, My problem is when My Employee Logged in he will direct to localhost/MIS/Webpage/Employee/home.php This is the correct for my employee but when i changed the address to localhost/MIS/Webpage/Admin/home.php My Employee can access the admin homepage. this is the problem i want to have limitation of my employee access. so this is my codes of my index.php <?php require 'core.php'; require 'connect.php'; if (loggedin()) { if($_SESSION['type'] == 'ADMINISTRATION'){ header('Location:../Mis/Webpage/Employee/home.php'); }else if($_SESSION['type'] == 'EMPLOYEE'){ header('Location:../Mis/Webpage/Admin/home.php'); } } else{ header('Location:Webpage/index.php'); } ?> this is my loginform <?php include '../../Mis/connect.php'; include '../../Mis/core.php'; if(isset($_POST['eusername']) && isset($_POST['epassword'])){ if(!empty($_POST['eusername']) && !empty($_POST['epassword'])){ $user = mysql_real_escape_string($_POST['eusername']); $pass = mysql_real_escape_string(md5($_POST['epassword'])); $query = "SELECT * FROM tbl_account WHERE LogUsername='".$user."' AND LogPassword = '".$pass."' AND type = 'EMPLOYEE'"; if($query_run = mysql_query($query)){ $query_num_rows = mysql_num_rows($query_run); if($query_num_rows == 0){ echo "<script>alert('Incorrect Pass or User')</script>"; }else{ $user_id = mysql_result($query_run, 0, 'LogUsername'); $_SESSION['user_id']=$user_id; $_SESSION['type'] = "EMPLOYEE"; echo "<script>alert('Employee Login')</script>"; header('Location: ../../Mis/index.php'); } }else{ echo "<script>alert('Connecting Failed')</script>"; } }else{ echo "<script>alert('Sorry, You must supply Username/Password...')</script>"; } } if(isset($_POST['username']) && isset($_POST['password'])){ if(!empty($_POST['username']) && !empty($_POST['password'])){ $user = mysql_real_escape_string($_POST['username']); $pass = mysql_real_escape_string(md5($_POST['password'])); $query = "SELECT * FROM tbl_account WHERE LogUsername='".$user."' AND LogPassword = '".$pass."' AND type = 'ADMINISTRATION'"; if($query_run = mysql_query($query)){ $query_num_rows = mysql_num_rows($query_run); if($query_num_rows == 0){ echo "<script>alert('Incorrect Pass or User')</script>"; }else{ $user_id = mysql_result($query_run, 0, 'LogUsername'); $_SESSION['user_id']=$user_id; $_SESSION['type'] = "ADMINISTRATION"; echo "<script>alert('Admin Login')</script>"; header('Location: ../../Mis/index.php'); } }else{ echo "<script>alert('Connecting Failed')</script>"; } }else{ echo "<script>alert('Sorry, You must supply Username/Password...')</script>"; } } ?> <div id="employee"> <form action="<?php echo $current_file; ?>" method="POST"> Employee ID: <input type="text" name="eusername"> </br> Password: <input type="password" name="epassword"> <input type="submit" id="employeesubmit" value="Log in"> </form> </div> <div id="admin"> <form action="<?php echo $current_file; ?>" method="POST"> Admin ID: <input type="text" name="username"> </br> Password: <input type="password" name="password"> <input type="submit" id="adminsubmit" value="Log in"> </form> </div> This is my core.php <?php ob_start(); session_start(); $current_file = $_SERVER['SCRIPT_NAME']; function loggedin() { if (isset($_SESSION['user_id'])&&!empty($_SESSION['user_id'])) { return true; } else { return false;; } } function adminloggedin() { if (isset($_SESSION['user_id'])&&!empty($_SESSION['user_id'])) { return true; } else { return false;; } } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.