Skip to main content

User Management System with PHP & MySQL

In our previous PHP project tutorial, we have explained how to develop School Management System with PHP & MySQL. In this tutorial, we will explain how to develop User Management System with PHP & MySQL.

User management is an important part of any web application where users can create their account and manage. The users are allowed to register their account and login to access their account. The users are also managed by administrator to allow certain roles or update users info.

So if you’re looking for solution to build secure user management system then you’re here the right place. In this tutorial, you will learn how to create secure user management system with PHP and MySQL. You would also like to checkout Login and Registration System with PHP & MySQL to implement user login and registration.

We will implement functionality to manage user operations like user registration, user email verification, login, password reset and edit profile. We will also create Admin panel to manage users at admin end to create new user, edit existing users details and delete user.

Also, read:

We will cover this tutorial in easy steps with live example to manage users from front-end and administrator end.

So let’s start implementing user management system with PHP and MySQL. Before we begin, take a look on files structure for this example.

User Login and Registration features:

  • User registration with email verification.
  • User Login with remember password.
  • Forget password & reset password.
  • User profile.
  • User profile edit & save.

Admin Panel features:

  • Admin login.
  • Admin password reset.
  • Admin profile.
  • Dashboard with users stats.
  • Users list.
  • Add new user with role.
  • Edit & save user.
  • Delete user.

So let’s start implementing user management system with PHP and MySQL. Before we begin, take a look on files structure for this example.

  • index.php: User dashboard
  • register.php: Handle User registration.
  • verify.php: Complete user registration after email verification.
  • login.php: Handle user login.
  • forget_password.php: Handle user forget password reset.
  • reset_password.php: Reset new password.
  • account.php: User profile.
  • edit_account.php: edit user profile.
  • User.php: Class which hold user methods.

There will be following files for Admin section to manage users.

  • index.php: Handle user login
  • dashboard.php: Display users stats
  • change_password.php: Change admin password.
  • profile.php: Display admin profile.
  • user_list.php: Display user list, add new user, edit and delete user.

Step1: Create MySQL Database Table

First we will create MySQL database table user to store user details to manage users.

CREATE TABLE `user` (
  `id` int(11) NOT NULL,
  `first_name` varchar(50) NOT NULL,
  `last_name` varchar(50) NOT NULL,
  `email` varchar(50) NOT NULL,
  `password` varchar(50) NOT NULL,
  `gender` enum('male','female') CHARACTER SET utf8 NOT NULL,
  `mobile` varchar(50) NOT NULL,
  `designation` varchar(50) NOT NULL,
  `image` varchar(250) NOT NULL,
  `type` varchar(250) NOT NULL DEFAULT 'general',
  `status` enum('active','pending','deleted','') NOT NULL DEFAULT 'pending',
  `authtoken` varchar(250) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Step2: Implement User Registration

We will design user registration form in register.php file and handle user registration on form submit.

<div id="signupbox" class="col-md-7">
	<div class="panel panel-info">
		<div class="panel-heading">
			<div class="panel-title">Sign Up</div>				
		</div>  
		<div class="panel-body" >
			<form id="signupform" class="form-horizontal" role="form" method="POST" action="">				
				<?php if ($message != '') { ?>
					<div id="login-alert" class="alert alert-danger col-sm-12"><?php echo $message; ?></div>                            
				<?php } ?>	
				<div class="form-group">
					<label for="firstname" class="col-md-3 control-label">First Name*</label>
					<div class="col-md-9">
						<input type="text" class="form-control" name="firstname" placeholder="First Name" value="<?php if(!empty($_POST["firstname"])) { echo $_POST["firstname"]; } ?>" required>
					</div>
				</div>
				<div class="form-group">
					<label for="lastname" class="col-md-3 control-label">Last Name</label>
					<div class="col-md-9">
						<input type="text" class="form-control" name="lastname" placeholder="Last Name" value="<?php if(!empty($_POST["lastname"])) { echo $_POST["lastname"]; } ?>" >
					</div>
				</div>					
				<div class="form-group">
					<label for="email" class="col-md-3 control-label">Email*</label>
					<div class="col-md-9">
						<input type="email" class="form-control" name="email" placeholder="Email Address" value="<?php if(!empty($_POST["email"])) { echo $_POST["email"]; } ?>" required>
					</div>
				</div>					
				<div class="form-group">
					<label for="password" class="col-md-3 control-label">Password*</label>
					<div class="col-md-9">
						<input type="password" class="form-control" name="passwd" placeholder="Password" required>
					</div>
				</div>								
				<div class="form-group">						                                  
					<div class="col-md-offset-3 col-md-9">
						<button id="btn-signup" type="submit" name="register" value="register" class="btn btn-info"><i class="icon-hand-right"></i>   Register</button>			
					</div>
				</div>					
				<div class="form-group">
					<div class="col-md-12 control">
						<div style="border-top: 1px solid#888; padding-top:15px; font-size:85%" >
							If You've already an account! 
						<a href="login.php">
							Log In 
						</a>Here
						</div>
					</div>
				</div>  				
			</form>
		 </div>
	</div>
</div>	

In class User.php, we will create method register() to implement user registration. We will send an email verification email to user’s email address with link to verify and complete registration.

public function register(){		
	$message = '';
	if(!empty($_POST["register"]) && $_POST["email"] !='') {
		$sqlQuery = "SELECT * FROM ".$this->userTable." 
			WHERE email='".$_POST["email"]."'";
		$result = mysqli_query($this->dbConnect, $sqlQuery);
		$isUserExist = mysqli_num_rows($result);
		if($isUserExist) {
			$message = "User already exist with this email address.";
		} else {			
			$authtoken = $this->getAuthtoken($_POST["email"]);
			$insertQuery = "INSERT INTO ".$this->userTable."(first_name, last_name, email, password, authtoken) 
			VALUES ('".$_POST["firstname"]."', '".$_POST["lastname"]."', '".$_POST["email"]."', '".md5($_POST["passwd"])."', '".$authtoken."')";
			$userSaved = mysqli_query($this->dbConnect, $insertQuery);
			if($userSaved) {				
				$link = "<a href='http://example.com/user-management-system/verify.php?authtoken=".$authtoken."'>Verify Email</a>";			
				$toEmail = $_POST["email"];
				$subject = "Verify email to complete registration";
				$msg = "Hi there, click on this ".$link." to verify email to complete registration.";
				$msg = wordwrap($msg,70);
				$headers = "From: info@webdamn.com";
				if(mail($toEmail, $subject, $msg, $headers)) {
					$message = "Verification email send to your email address. Please check email and verify to complete registration.";
				}
			} else {
				$message = "User register request failed.";
			}
		}
	}
	return $message;
}	

We will create a method verifyRegister() in class User.php to verify user email to complete registration.

public function verifyRegister(){
	$verifyStatus = 0;
	if(!empty($_GET["authtoken"]) && $_GET["authtoken"] != '') {			
		$sqlQuery = "SELECT * FROM ".$this->userTable." 
			WHERE authtoken='".$_GET["authtoken"]."'";
		$resultSet = mysqli_query($this->dbConnect, $sqlQuery);
		$isValid = mysqli_num_rows($resultSet);	
		if($isValid){
			$userDetails = mysqli_fetch_assoc($resultSet);
			$authtoken = $this->getAuthtoken($userDetails['email']);
			if($authtoken == $_GET["authtoken"]) {					
				$updateQuery = "UPDATE ".$this->userTable." SET status = 'active'
					WHERE id='".$userDetails['id']."'";
				$isUpdated = mysqli_query($this->dbConnect, $updateQuery);					
				if($isUpdated) {
					$verifyStatus = 1;
				}
			}
		}
	}
	return $verifyStatus;
}	

Step3: Implement User Login

We will design user login form in login.php file and handle login functionality on form submit.

<div class="col-md-6">                    
	<div class="panel panel-info" >
		<div class="panel-heading">
			<div class="panel-title">Log In</div>                        
		</div> 
		<div style="padding-top:30px" class="panel-body" >
			<?php if ($errorMessage != '') { ?>
				<div id="login-alert" class="alert alert-danger col-sm-12"><?php echo $errorMessage; ?></div>                            
			<?php } ?>
			<form id="loginform" class="form-horizontal" role="form" method="POST" action="">                                    
				<div style="margin-bottom: 25px" class="input-group">
					<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
					<input type="text" class="form-control" id="loginId" name="loginId"  value="<?php if(isset($_COOKIE["loginId"])) { echo $_COOKIE["loginId"]; } ?>" placeholder="email">                                        
				</div>                                
				<div style="margin-bottom: 25px" class="input-group">
					<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
					<input type="password" class="form-control" id="loginPass" name="loginPass" value="<?php if(isset($_COOKIE["loginPass"])) { echo $_COOKIE["loginPass"]; } ?>" placeholder="password">
				</div>            
				<div class="input-group">
				  <div class="checkbox">
					<label>
					  <input  type="checkbox" id="remember" name="remember" <?php if(isset($_COOKIE["loginId"])) { ?> checked <?php } ?>> Remember me
					</label>
					<label><a href="forget_password.php">Forget your password</a></label>	
				  </div>
				</div>
				<div style="margin-top:10px" class="form-group">                               
					<div class="col-sm-12 controls">
					  <input type="submit" name="login" value="Login" class="btn btn-info">						  
					</div>						
				</div>
				 <div class="form-group">
					<div class="col-md-12 control">
						<div style="border-top: 1px solid#888; padding-top:15px; font-size:85%" >
							Don't have an account! 
						<a href="register.php">
							Register 
						</a>Here. 
						</div>
					</div>
				</div>    	
			</form>   
		</div>                     
	</div>  
</div>

We will create a method login() in class User.php to handle user login functionality.

public function login(){		
	$errorMessage = '';
	if(!empty($_POST["login"]) && $_POST["loginId"]!=''&& $_POST["loginPass"]!='') {	
		$loginId = $_POST['loginId'];
		$password = $_POST['loginPass'];
		if(isset($_COOKIE["loginPass"]) && $_COOKIE["loginPass"] == $password) {
			$password = $_COOKIE["loginPass"];
		} else {
			$password = md5($password);
		}	
		$sqlQuery = "SELECT * FROM ".$this->userTable." 
			WHERE email='".$loginId."' AND password='".$password."' AND status = 'active'";
		$resultSet = mysqli_query($this->dbConnect, $sqlQuery);
		$isValidLogin = mysqli_num_rows($resultSet);	
		if($isValidLogin){
			if(!empty($_POST["remember"]) && $_POST["remember"] != '') {
				setcookie ("loginId", $loginId, time()+ (10 * 365 * 24 * 60 * 60));  
				setcookie ("loginPass",	$password,	time()+ (10 * 365 * 24 * 60 * 60));
			} else {
				$_COOKIE['loginId' ]='';
				$_COOKIE['loginPass'] = '';
			}
			$userDetails = mysqli_fetch_assoc($resultSet);
			$_SESSION["userid"] = $userDetails['id'];
			$_SESSION["name"] = $userDetails['first_name']." ".$userDetails['last_name'];
			header("location: index.php"); 		
		} else {		
			$errorMessage = "Invalid login!";		 
		}
	} else if(!empty($_POST["loginId"])){
		$errorMessage = "Enter Both user and password!";	
	}
	return $errorMessage; 		
}

We will create object of user class and call user method login() to complete user login.

include('class/User.php');
$user = new User();
$message =  $user->login();

Step4: Implement User Password Reset

We will design user password reset form in reset_password.php file to user password. The user email is entered and submitted in forget_password.php and a password reset email will be send to user email address. When user click on password reset link, it will redirect user to reset password form and ask the user to enter new password to save.

<div class="col-md-6">                    
	<div class="panel panel-info" >
		<div class="panel-heading">
			<div class="panel-title">Reset Password</div>                        
		</div> 
		<div style="padding-top:30px" class="panel-body" >
			<?php if ($errorMessage != '') { ?>
				<div id="login-alert" class="alert alert-danger col-sm-12"><?php echo $errorMessage; ?></div>                            
			<?php } ?>
			<?php if(!empty($_GET['authtoken']) && $_GET['authtoken']) { ?>
				<form id="loginform" class="form-horizontal" role="form" method="POST" action="">                                    
					<div style="margin-bottom: 25px" class="input-group">
						<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
						<input type="password" class="form-control" id="password" name="password"  placeholder="New password..." required>			
					</div>
					<div style="margin-bottom: 25px" class="input-group">
						<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
						<input type="password" class="form-control" id="cpassword" name="cpassword"  placeholder="Confirm password..." required>              
					</div>	
					<div style="margin-top:10px" class="form-group">                               
						<div class="col-sm-12 controls">
							<input type="hidden" name="authtoken"  value="<?php echo $_GET['authtoken']; ?>" />
							<input type="submit" name="resetpassword" value="Save" class="btn btn-info">						  
						</div>						
					</div>					 
					</div>  	
				</form>
			<?php } else { ?>
				Invalid password reset request.
			<?php } ?>
		</div>                     
	</div>  
</div>

We will create a method resetPassword() in class User.php to send password reset email to user.

public function resetPassword(){
	$message = '';
	if($_POST['email'] == '') {
		$message = "Please enter username or email to proceed with password reset";			
	} else {
		$sqlQuery = "
			SELECT email 
			FROM ".$this->userTable." 
			WHERE email='".$_POST['email']."'";			
		$result = mysqli_query($this->dbConnect, $sqlQuery);
		$numRows = mysqli_num_rows($result);
		if($numRows) {			
			$user = mysqli_fetch_assoc($result);
			$authtoken = $this->getAuthtoken($user['email']);
			$link="<a href='https://www.webdamn.com/demo/user-management-system/reset_password.php?authtoken=".$authtoken."'>Reset Password</a>";				
			$toEmail = $user['email'];
			$subject = "Reset your password on examplesite.com";
			$msg = "Hi there, click on this ".$link." to reset your password.";
			$msg = wordwrap($msg,70);
			$headers = "From: info@webdamn.com";
			if(mail($toEmail, $subject, $msg, $headers)) {
				$message =  "Password reset link send. Please check your mailbox to reset password.";
			}				
		} else {
			$message = "No account exist with entered email address.";
		}
	}
	return $message;
}

We will create a method savePassword() in class User.php to save new password.

public function savePassword(){
	$message = '';
	if($_POST['password'] != $_POST['cpassword']) {
		$message = "Password does not match the confirm password.";
	} else if($_POST['authtoken']) {
		$sqlQuery = "
			SELECT email, authtoken 
			FROM ".$this->userTable." 
			WHERE authtoken='".$_POST['authtoken']."'";			
		$result = mysqli_query($this->dbConnect, $sqlQuery);
		$numRows = mysqli_num_rows($result);
		if($numRows) {				
			$userDetails = mysqli_fetch_assoc($result);
			$authtoken = $this->getAuthtoken($userDetails['email']);
			if($authtoken == $_POST['authtoken']) {
				$sqlUpdate = "
					UPDATE ".$this->userTable." 
					SET password='".md5($_POST['password'])."'
					WHERE email='".$userDetails['email']."' AND authtoken='".$authtoken."'";	
				$isUpdated = mysqli_query($this->dbConnect, $sqlUpdate);	
				if($isUpdated) {
					$message = "Password saved successfully. Please <a href='login.php'>Login</a> to access account.";
				}
			} else {
				$message = "Invalid password change request.";
			}
		} else {
			$message = "Invalid password change request.";
		}	
	}
	return $message;
}

Step5: Manage User Profile

We will design user profile edit forum in edit_account.php to edit user details and save.

<div class="panel">
	<div class="panel-heading">
		<div class="panel-title">Edit Account Details</div>				
	</div>  
	<div class="panel-body col-md-7">
		<form class="form-horizontal" role="form" method="POST" action="">				
			<?php if($message != '') { ?>
				<div id="login-alert" class="alert alert-danger col-sm-12"><?php echo $message; ?></div>                            
			<?php } ?>	
			<div class="form-group">
				<label for="firstname" class="col-md-3 control-label">First Name*</label>
				<div class="col-md-9">
					<input type="text" class="form-control" name="firstname" placeholder="First Name" value="<?php echo $userDetail['first_name'];?>" >
				</div>
			</div>
			<div class="form-group">
				<label for="lastname" class="col-md-3 control-label">Last Name</label>
				<div class="col-md-9">
					<input type="text" class="form-control" name="lastname" placeholder="Last Name" value="<?php echo $userDetail['last_name'];?>" >
				</div>
			</div>					
			<div class="form-group">
				<label for="email" class="col-md-3 control-label">Email*</label>
				<div class="col-md-9">
					<input type="email" class="form-control" name="email" placeholder="Email Address" value="<?php echo $userDetail['email'];?>" required>
				</div>
			</div>	
			<div class="form-group">
				<label for="email" class="col-md-3 control-label">Mobile</label>
				<div class="col-md-9">
					<input type="text" class="form-control" name="mobile" placeholder="Mobile" value="<?php echo $userDetail['mobile'];?>" >
				</div>
			</div>	
			<div class="form-group">
				<label for="lastname" class="col-md-3 control-label">Designation</label>
				<div class="col-md-9">
					<input type="text" class="form-control" name="designation" placeholder="Designation" value="<?php echo $userDetail['designation'];?>" >
				</div>
			</div>	
			<div class="form-group">
				<label for="gender" class="col-md-3 control-label">Gender</label>
				<div class="col-md-9">
					<label class="radio-inline">
						<input type="radio" name="gender" value="male" <?php if($userDetail['gender'] == 'male') { echo 'checked'; } ?> required>Male
					</label>;
					<label class="radio-inline">
						<input type="radio" name="gender" value="female" <?php if($userDetail['gender'] == 'female') { echo 'checked'; } ?> required>Female
					</label>
				</div>
			</div>	
			<div class="form-group">
				<label for="password" class="col-md-3 control-label">Password</label>
				<div class="col-md-9">
					<input type="password" class="form-control" name="passwd" placeholder="Password" value="">
				</div>
			</div>	
			<div class="form-group">
				<label for="password" class="col-md-3 control-label">Confirm Password</label>
				<div class="col-md-9">
					<input type="password" class="form-control" name="cpasswd" placeholder="Confirm Password" value="">
				</div>
			</div>						
			<div class="form-group">						                                  
				<div class="col-md-offset-3 col-md-9">
					<button id="btn-signup" type="submit" name="update" value="update_account" class="btn btn-info"><i class="icon-hand-right"></i>   Save Changes</button>			
				</div>
			</div>							
		</form>
	 </div>
</div>
</div>	

We will create a method editAccount() in class User.php edit and save user profile.

public function editAccount () {
	$message = '';
	$updatePassword = '';
	if(!empty($_POST["passwd"]) && $_POST["passwd"] != '' && $_POST["passwd"] != $_POST["cpasswd"]) {
		$message = "Confirm passwords do not match.";
	} else if(!empty($_POST["passwd"]) && $_POST["passwd"] != '' && $_POST["passwd"] == $_POST["cpasswd"]) {
		$updatePassword = ", password='".md5($_POST["passwd"])."' ";
	}		
	$updateQuery = "UPDATE ".$this->userTable." 
		SET first_name = '".$_POST["firstname"]."', last_name = '".$_POST["lastname"]."', email = '".$_POST["email"]."', mobile = '".$_POST["mobile"]."' , designation = '".$_POST["designation"]."', gender = '".$_POST["gender"]."' $updatePassword
		WHERE id ='".$_SESSION["userid"]."'";
	$isUpdated = mysqli_query($this->dbConnect, $updateQuery);	
	if($isUpdated) {
		$_SESSION["name"] = $_POST['firstname']." ".$_POST['lastname'];
		$message = "Account details saved.";
	}
	return $message;
}	

Step6: Implement Admin Login

We will design form in index.php to handle admin login.

<div class="col-md-6">                    
	<div class="panel panel-info">
		<div class="panel-heading" style="background:#00796B;color:white;">
			<div class="panel-title">Admin In</div>                        
		</div> 
		<div style="padding-top:30px" class="panel-body" >
			<?php if ($errorMessage != '') { ?>
				<div id="login-alert" class="alert alert-danger col-sm-12"><?php echo $errorMessage; ?></div>                            
			<?php } ?>
			<form id="loginform" class="form-horizontal" role="form" method="POST" action="">                                    
				<div style="margin-bottom: 25px" class="input-group">
					<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
					<input type="text" class="form-control" id="email" name="email" placeholder="email" style="background:white;" required>                                        
				</div>                                
				<div style="margin-bottom: 25px" class="input-group">
					<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
					<input type="password" class="form-control" id="password" name="password"placeholder="password" required>
				</div>
				<div style="margin-top:10px" class="form-group">                               
					<div class="col-sm-12 controls">
					  <input type="submit" name="login" value="Login" class="btn btn-info">						  
					</div>						
				</div>	
				<div style="margin-top:10px" class="form-group">                               
					<div class="col-sm-12 controls">
					User: admin@webdamn.com<br>
					password:123				  
					</div>						
				</div>	
			</form>   
		</div>                     
	</div>  
</div>

We will create method adminLogin() in class User.php to complete admin login.

public function adminLogin(){		
	$errorMessage = '';
	if(!empty($_POST["login"]) && $_POST["email"]!=''&& $_POST["password"]!='') {	
		$email = $_POST['email'];
		$password = $_POST['password'];
		$sqlQuery = "SELECT * FROM ".$this->userTable." 
			WHERE email='".$email."' AND password='".md5($password)."' AND status = 'active' AND type = 'administrator'";
		$resultSet = mysqli_query($this->dbConnect, $sqlQuery);
		$isValidLogin = mysqli_num_rows($resultSet);	
		if($isValidLogin){
			$userDetails = mysqli_fetch_assoc($resultSet);
			$_SESSION["adminUserid"] = $userDetails['id'];
			$_SESSION["admin"] = $userDetails['first_name']." ".$userDetails['last_name'];
			header("location: dashboard.php"); 		
		} else {		
			$errorMessage = "Invalid login!";		 
		}
	} else if(!empty($_POST["login"])){
		$errorMessage = "Enter Both user and password!";	
	}
	return $errorMessage; 		
}

Step7: Admin Dishboard

We will design HTML in dashboard.php to display users stats in admin dashboard.

<div class="col-lg-10 col-md-10 col-sm-9 col-xs-12">   
	<a href="#"><strong><span class="fa fa-dashboard"></span> My Dashboard</strong></a>
	<hr>		
	<div class="row">
		<div class="col-md-12">
			<div class="row">
				<div class="col-md-3">
					<div class="panel panel-default">
						<div class="panel-body bk-primary text-light">
							<div class="stat-panel text-center">
								<div class="stat-panel-number h1 "><?php echo $user->totalUsers(""); ?></div>
								<div class="stat-panel-title text-uppercase">Total Users</div>
							</div>
						</div>											
					</div>
				</div>
				<div class="col-md-3">
					<div class="panel panel-default">
						<div class="panel-body bk-success text-light">
							<div class="stat-panel text-center">
								<div class="stat-panel-number h1 "><?php echo $user->totalUsers('active'); ?></div>
								<div class="stat-panel-title text-uppercase">Total Active Users</div>
							</div>
						</div>											
					</div>
				</div>		
				<div class="col-md-3">
					<div class="panel panel-default">
						<div class="panel-body bk-success text-light">
							<div class="stat-panel text-center">
								<div class="stat-panel-number h1 "><?php echo $user->totalUsers('pending'); ?></div>
								<div class="stat-panel-title text-uppercase">Total Pending Users</div>
							</div>
						</div>											
					</div>
				</div>													
				<div class="col-md-3">
					<div class="panel panel-default">
						<div class="panel-body bk-danger text-light">
							<div class="stat-panel text-center">												
								<div class="stat-panel-number h1 "><?php echo $user->totalUsers('deleted'); ?></div>
								<div class="stat-panel-title text-uppercase">Total Deleted Users</div>
							</div>
						</div>											
					</div>
				</div>							
			</div>
		</div>
	</div>		
</div>

Step8: Manage User in Admin Panel

We will design HTML in user_list.php to display users list in Datatable. We will design modal to add and edit user. Als handle muser delete functionality.

<div class="col-lg-10 col-md-10 col-sm-9 col-xs-12">   
	<a href="#"><strong><span class="fa fa-dashboard"></span> User List</strong></a>
	<hr>		
	<div class="panel-heading">
		<div class="row">
			<div class="col-md-10">
				<h3 class="panel-title"></h3>
			</div>
			<div class="col-md-2" align="right">
				<button type="button" name="add" id="addUser" class="btn btn-success btn-xs">Add</button>
			</div>
		</div>
	</div>
	<table id="userList" class="table table-bordered table-striped">
		<thead>
			<tr>
				<th>ID</th>
				<th>Name</th>
				<th>Gender</th>
				<th>Email</th>
				<th>Mobile</th>
				<th>Role</th>					
				<th></th>
				<th></th>
				<th></th>
			</tr>
		</thead>
	</table>
</div>
<div id="userModal" class="modal fade">
	<div class="modal-dialog">
		<form method="post" id="userForm">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">×</button>
					<h4 class="modal-title"><i class="fa fa-plus"></i> Edit User</h4>
				</div>
				<div class="modal-body">
					<div class="form-group">
						<label for="firstname" class="control-label">First Name*</label>
						<input type="text" class="form-control" id="firstname" name="firstname" placeholder="First Name" required>							
					</div>
					<div class="form-group">
						<label for="lastname" class="control-label">Last Name</label>							
						<input type="text" class="form-control" id="lastname" name="lastname" placeholder="Last Name">							
					</div>	   	
					<div class="form-group">
						<label for="lastname" class="control-label">Email*</label>							
						<input type="text" class="form-control"  id="email" name="email" placeholder="Email" required>							
					</div>	 
					<div class="form-group" id="passwordSection">
						<label for="lastname" class="control-label">Password*</label>							
						<input type="password" class="form-control"  id="password" name="password" placeholder="Password" required>							
					</div>
					<div class="form-group">
						<label for="gender" class="control-label">Gender</label>							
						<label class="radio-inline">
							<input type="radio" name="gender" id="male" value="male" required>Male
						</label>;
						<label class="radio-inline">
							<input type="radio" name="gender" id="female" value="female" required>Female
						</label>							
					</div>	
					<div class="form-group">
						<label for="lastname" class="control-label">Mobile</label>							
						<input type="text" class="form-control" id="mobile" name="mobile" placeholder="Mobile">							
					</div>	 
					<div class="form-group">
						<label for="lastname" class="control-label">Designation</label>							
						<input type="text" class="form-control" id="designation" name="designation" placeholder="designation">							
					</div>	
					<div class="form-group">
						<label for="gender" class="control-label">Status</label>							
						<label class="radio-inline">
							<input type="radio" name="status" id="active" value="active" required>Active
						</label>;
						<label class="radio-inline">
							<input type="radio" name="status" id="pending" value="pending" required>Pending
						</label>							
					</div>
					<div class="form-group">
						<label for="user_type" class="control-label">User Type</label>							
						<label class="radio-inline">
							<input type="radio" name="user_type" id="general" value="general" required>General
						</label>;
						<label class="radio-inline">
							<input type="radio" name="user_type" id="administrator" value="administrator" required>Administrator
						</label>							
					</div>	
				</div>
				<div class="modal-footer">
					<input type="hidden" name="userid" id="userid" />
					<input type="hidden" name="action" id="action" value="updateUser" />
					<input type="submit" name="save" id="save" class="btn btn-info" value="Save" />
					<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
				</div>
			</div>
		</form>
	</div>
</div>

We will create JavaScript file users.js to handle Datatable data load, handle add, edit and delete records.

$(document).ready(function(){
	var usersData = $('#userList').DataTable({
		"lengthChange": false,
		"processing":true,
		"serverSide":true,
		"order":[],
		"ajax":{
			url:"action.php",
			type:"POST",
			data:{action:'listUser'},
			dataType:"json"
		},
		"columnDefs":[
			{
				"targets":[0, 7, 8],
				"orderable":false,
			},
		],
		"pageLength": 10
	});		
	$(document).on('click', '.delete', function(){
		var userid = $(this).attr("id");		
		var action = "userDelete";
		if(confirm("Are you sure you want to delete this user?")) {
			$.ajax({
				url:"action.php",
				method:"POST",
				data:{userid:userid, action:action},
				success:function(data) {					
					usersData.ajax.reload();
				}
			})
		} else {
			return false;
		}
	});	
	$('#addUser').click(function(){
		$('#userModal').modal('show');
		$('#userForm')[0].reset();
		$('#passwordSection').show();
		$('.modal-title').html("<i class='fa fa-plus'></i> Add User");
		$('#action').val('addUser');
		$('#save').val('Add User');
	});	
	$(document).on('click', '.update', function(){
		var userid = $(this).attr("id");
		var action = 'getUser';
		$.ajax({
			url:'action.php',
			method:"POST",
			data:{userid:userid, action:action},
			dataType:"json",
			success:function(data){
				$('#userModal').modal('show');
				$('#userid').val(data.id);
				$('#firstname').val(data.first_name);
				$('#lastname').val(data.last_name);
				$('#email').val(data.email);
				$('#password').val(data.password);
				$('#passwordSection').hide();
				if(data.gender == 'male') {
					$('#male').prop("checked", true);
				} else if(data.gender == 'female') {
					$('#female').prop("checked", true);
				}
				if(data.status == 'active') {
					$('#active').prop("checked", true);
				} else if(data.gender == 'pending') {
					$('#pending').prop("checked", true);
				}
				if(data.type == 'general') {
					$('#general').prop("checked", true);
				} else if(data.type == 'administrator') {
					$('#administrator').prop("checked", true);
				}
				$('#mobile').val(data.mobile);
				$('#designation').val(data.designation);	
				$('.modal-title').html("<i class='fa fa-plus'></i> Edit User");
				$('#action').val('updateUser');
				$('#save').val('Save');
			}
		})
	});	
	$(document).on('submit','#userForm', function(event){
		event.preventDefault();
		$('#save').attr('disabled','disabled');
		var formData = $(this).serialize();
		$.ajax({
			url:"action.php",
			method:"POST",
			data:formData,
			success:function(data){				
				$('#userForm')[0].reset();
				$('#userModal').modal('hide');				
				$('#save').attr('disabled', false);
				usersData.ajax.reload();
			}
		})
	});	
});

We will create method getUserList() in class User.php to get user list and return as JSON data to display in Datatables.

public function getUserList(){		
	$sqlQuery = "SELECT * FROM ".$this->userTable." WHERE id !='".$_SESSION['adminUserid']."' ";
	if(!empty($_POST["search"]["value"])){
		$sqlQuery .= '(id LIKE "%'.$_POST["search"]["value"].'%" ';
		$sqlQuery .= ' OR first_name LIKE "%'.$_POST["search"]["value"].'%" ';
		$sqlQuery .= ' OR last_name LIKE "%'.$_POST["search"]["value"].'%" ';
		$sqlQuery .= ' OR designation LIKE "%'.$_POST["search"]["value"].'%" ';
		$sqlQuery .= ' OR status LIKE "%'.$_POST["search"]["value"].'%" ';
		$sqlQuery .= ' OR mobile LIKE "%'.$_POST["search"]["value"].'%") ';			
	}
	if(!empty($_POST["order"])){
		$sqlQuery .= 'ORDER BY '.$_POST['order']['0']['column'].' '.$_POST['order']['0']['dir'].' ';
	} else {
		$sqlQuery .= 'ORDER BY id DESC ';
	}
	if($_POST["length"] != -1){
		$sqlQuery .= 'LIMIT ' . $_POST['start'] . ', ' . $_POST['length'];
	}	
	$result = mysqli_query($this->dbConnect, $sqlQuery);

	$sqlQuery1 = "SELECT * FROM ".$this->userTable." WHERE id !='".$_SESSION['adminUserid']."' ";
	$result1 = mysqli_query($this->dbConnect, $sqlQuery1);
	$numRows = mysqli_num_rows($result1);

	$userData = array();	
	while( $users = mysqli_fetch_assoc($result) ) {		
		$userRows = array();
		$status = '';
		if($users['status'] == 'active')	{
			$status = '<span class="label label-success">Active</span>';
		} else if($users['status'] == 'pending') {
			$status = '<span class="label label-warning">Inactive</span>';
		} else if($users['status'] == 'deleted') {
			$status = '<span class="label label-danger">Deleted</span>';
		}
		$userRows[] = $users['id'];
		$userRows[] = ucfirst($users['first_name']." ".$users['last_name']);
		$userRows[] = $users['gender'];			
		$userRows[] = $users['email'];	
		$userRows[] = $users['mobile'];	
		$userRows[] = $users['type'];
		$userRows[] = $status;						
		$userRows[] = '<button type="button" name="update" id="'.$users["id"].'" class="btn btn-warning btn-xs update">Update</button>';
		$userRows[] = '<button type="button" name="delete" id="'.$users["id"].'" class="btn btn-danger btn-xs delete" >Delete</button>';
		$userData[] = $userRows;
	}
	$output = array(
		"draw"				=>	intval($_POST["draw"]),
		"recordsTotal"  	=>  $numRows,
		"recordsFiltered" 	=> 	$numRows,
		"data"    			=> 	$userData
	);
	echo json_encode($output);
}

You may also like:

You can view the live demo from the Demo link and can download the script from the Download link below.
Admin Demo User Demo Download

156 thoughts on “User Management System with PHP & MySQL

  1. I have fixed the config issue but when i try to register a new user i get the response of
    User register request failed’. Anybody have any ideas please I have checked the sql connection that is fine.

  2. Hi, i try your user management system and when i click the logout it is 404 page. thanks

    1. it’s working correctly in live demo, may be you have missed something in your code. thanks!

  3. Hi,

    Here iam trying to configure but i could not receive email for the confirmation in localhost also in online webserver, kindly provide me a help.

    regards
    jay

    1. may be there issue with your server. you can contact with your hosting provider support to fix mail send issue. thannks!

  4. He bajado el codigo, he creado una cuenta de usuario y la he cambiado a activa y administrator.

    Pero cuando hago login desde el admin, no hace nada. Lo he depurado y nada.
    Alguna idea?

    1. ¿Tiene algún error? Por favor, intente depurar la línea de línea para encontrar la causa del problema. ¡Gracias!

  5. Warning: mysqli::mysqli(): (HY000/1049): Unknown database ‘webdamn_demos’ in C:\xampp\htdocs\user\class\User.php on line 18
    Error failed to connect to MySQL: Unknown database ‘webdamn_demos’

  6. I have an issue with the forget_password.php / reset_password.php which works correctly with my localhost, see below for steps, but fails #3 when the code is deployed https on a test site. Selecting Save for reset_password.php appears to do nothing, not showing any kind of message.
    Any ideas?

    ==>>> Correct operation on my local host development environment:
    1. From forget_password.php, enter email address to initiate sending a password reset email
    2. The email is received and I select on the link which I can see have the correct md5 string
    3. From reset_password.php, enter new and confrim passwords and see message “Password saved successfully. Please Login to access account.”

  7. Great stuff! Thanks.

    I’m only using the admin part. I’ve got a user part already on my system. I still had to build a better/nicer admin part to deal with users.
    So, users can’t register themselves etc.

    I’ve also removed the password field to be generated automatically with:
    $passwd = password_hash($_POST[‘passwd’], PASSWORD_DEFAULT);
    and then verify separately upon login of user.
    replaced “if ($isvalidLogin)” with “if (password_verify($password, $userDetails[‘password’]))”

    I was wondering, what triggers the Update in the admin user_list.php? And what part of User Class populates the update form that pops up?
    It appears empty on my side.

    And although I hacked my self in your code, I just can’t seem to find this. Did I miss something?

  8. hello I have the same problem with User.php ( require(‘include/config.php ) already try the fixings, and move the page to ( Class folder ) but ( register.php new user, add new user”admin”, login, etc ) don’t do the function…

    there is any solution to this problem?

    thanks.

    1. I think you need to include this everywhere in your script to work everywhere. Thanks!

  9. hi….there is an error when i run the code on localhost

    this error : Warning: require(../config.php): failed to open stream: No such file or directory in C:\xampp\htdocs\admin\class\User.php on line 3

  10. Please, Did I need to adjust email configuration on live server? I can’t get any email message on the registered email.

  11. I don’t want to use the email verification during registration, how do I delete it ?. or is there a script without using the verify email

    1. hy brother u get any solution …….i also want same code with ou email verification

  12. Me parece muy interesante el articulo, pero uso la demostración como usuario intentando registrarme y no me envio el correo para confirmar el registro.
    Probe con olvido la contraseña y pude cambiarla , pero no me deja entrar

    La demo esta operativa , ¿? Lo comento porque antes de probarlo si no me funciona la demo ¿?
    Un saludo

    1. a funcionalidad de envío de correo electrónico se deshabilita en la demostración. Puede descargar el código fuente y ejecutarlo en su servidor, ¡gracias!

  13. Hi, I have uploaded the code to my cpanel hosting, it works fine except… It cannot send the token…
    I have to activate the user manually from the admin dashboard

    1. check if email send working or any error there. may be issue with email send that you need to get work, thanks!

  14. The search row is not part of the .zip downloaded from your site. Can you please add the newest Version of this System?

  15. Is it still safe to use md5 for password encryption, I don’t think so. Why not use $hash = password_hash($password, PASSWORD_DEFAULT); or something like bcrypt. That being said I applaud you for a great tutorial

    1. Yes md5 is not safe but I have used this in examples. You can use password_hash() or bcrypt instead. Thanks!

  16. Hi,

    Where is the verify.php file code? When I search the page for “verify.php” I find that you include “verify.php” in the list of the files structure, and you code verify.php in the register() method. But I dont see the code for the verify.php.

    I’m new but am I missing something?

    Thank you.

  17. Where we have to use the step 1 code. Any separate file to be created or how it is working? Please explain.

  18. Great work , thanks !
    I have a problem with pagination. I have 34 entries in db, dbtable shows only the first 10 and no more pages.
    On the bottom of the table only page 1 is displayed, page 2 and 3 dont appear.
    Page length is set to 10. Any suggestions how to fix it ??

  19. I am wanting to use this and it works fine except the email authentication. I am wanting to set this up without the email authentication. How do I modify the script to eliminate the need for a new user to authenticate through their email?

  20. Pagination doesn’t work, because you’re feeding the wrong numbers for recordsTotal and recordsFiltered.

    First, get the total number of records in the table:

    $numQuery = “SELECT id FROM “.$this->userTable.” WHERE id !='”.$_SESSION[‘adminUserid’].”‘ “;
    $numResult = mysqli_query($this->dbConnect, $numQuery);
    $totalRows = mysqli_num_rows($numResult);

    To get the total number of rows that match our criteria, we need to have another SQL query, before the last bit that does the pagination is appended:

    $sqlQuery = “SELECT * FROM “.$this->userTable.” WHERE id !='”.$_SESSION[‘adminUserid’].”‘ “;
    if(!empty($_POST[“search”][“value”])){
    $sqlQuery .= ‘AND id LIKE “%’.$_POST[“search”][“value”].’%” ‘;
    $sqlQuery .= ‘ OR first_name LIKE “%’.$_POST[“search”][“value”].’%” ‘;
    $sqlQuery .= ‘ OR last_name LIKE “%’.$_POST[“search”][“value”].’%” ‘;
    $sqlQuery .= ‘ OR email LIKE “%’.$_POST[“search”][“value”].’%” ‘;
    $sqlQuery .= ‘ OR institution LIKE “%’.$_POST[“search”][“value”].’%” ‘;
    $sqlQuery .= ‘ OR status LIKE “%’.$_POST[“search”][“value”].’%” ‘;
    }
    if(!empty($_POST[“order”])){
    $columnOffset = $_POST[‘order’][‘0’][‘column’] +1;
    $sqlQuery .= ‘ORDER BY ‘. $columnOffset.’ ‘.$_POST[‘order’][‘0’][‘dir’].’ ‘;
    } else {
    $sqlQuery .= ‘ORDER BY id DESC ‘;
    }
    $filterResult = mysqli_query($this->dbConnect, $sqlQuery);
    $filteredRows = mysqli_num_rows($filterResult);

    if($_POST[“length”] != -1){
    $sqlQuery .= ‘LIMIT ‘ . $_POST[‘start’] . ‘, ‘ . $_POST[‘length’];
    }

    Now you can feed the proper numbers back to DataTables:

    $output = array(
    “draw” => intval($_POST[“draw”]),
    “recordsTotal” => $totalRows,
    “recordsFiltered” => $filteredRows,
    “data” => $userData
    );

  21. Sorting sorts the wrong columns, it’s offset by 1 column. I am not skilled enough to find the proper fix (which has something to do with misaligned column and array references), but used this quick work around:

    if(!empty($_POST[“order”])){
    $columnOffset = $_POST[‘order’][‘0’][‘column’] +1;
    $sqlQuery .= ‘ORDER BY ‘. $columnOffset.’ ‘.$_POST[‘order’][‘0’][‘dir’].’ ‘;

  22. Search function doesn’t work because of a SQL error.

    In class/User.php, in the function getUserList, remove () from the SQL query so it reads:

    $sqlQuery .= ‘AND id LIKE “%’.$_POST[“search”][“value”].’%” ‘;
    $sqlQuery .= ‘ OR first_name LIKE “%’.$_POST[“search”][“value”].’%” ‘;
    $sqlQuery .= ‘ OR last_name LIKE “%’.$_POST[“search”][“value”].’%” ‘;
    $sqlQuery .= ‘ OR email LIKE “%’.$_POST[“search”][“value”].’%” ‘;
    $sqlQuery .= ‘ OR institution LIKE “%’.$_POST[“search”][“value”].’%” ‘;
    $sqlQuery .= ‘ OR status LIKE “%’.$_POST[“search”][“value”].’%” ‘;

  23. Hello,
    I just downloaded this and your User.php file isnt correct.
    When you display_errors I saw
    Warning: require(../config.php): failed to open stream: No such file or directory in public_html/boss/class/User.php on line 3
    Looking at User.php line 3 shows this:
    require(‘../config.php’);
    However this is not correct since your config.php file is located in a folder, so the path needs to be updated to:
    require(‘../include/config.php’);

    Hope this helps anyone else who sees this problem.
    Thanks

      1. Change the path to the path where config.php is in.

        If this doesn’t work you can move the config.php file in the Class folder

        and then change this code
        require(‘../config.php’); -> require(‘config.php’);

  24. I have installed your code on my website,
    All working fine, Thank you…
    Only one problem I found… email for verification and reset password not coming…
    can you please help me server side code , I have searched user.php and changed, but no email….

  25. Please how to setup dashboard per user on the same website. That will link the Registrar to his/her main dashboard not a single dashboard for everyone

  26. Hi, i have a problem with the admin user list, i can’t add user, when i click the button, the form appears but when i complete the form and submit, i doesn’t nothing. I have no errors.

    In User.php : private $dbConnect = false;

    1. It’s working fine in download code, try to debug issue, may be there error. Thanks!

  27. Your assistance would be much appreciated regarding the fatal error I received on start-up.

    Fatal error: Uncaught Error: Class ‘mysqli’ not found in C:\Users\lanny\BRMphp\class\User.php:19 Stack trace: #0 C:\Users\lanny\BRMphp\index.php(3): User->__construct() #1 {main} thrown in C:\Users\lanny\BRMphp\class\User.php on line 19

    1. May be there mysqli not installed there, Please install this and proceed. thanks!

      1. Fixed the mysqli issue by adding the following to the phi.ini file
        [PHP_MYSQLI]
        extension=php_mysqli.dll

        Although the login screens appear, I received the following warning message:
        Deprecated: Methods with same name as their class will not be constructors in a future version of PHP; dbConfig has a deprecated constructor in config.php file. Please advise.

        Lastly, when I attempt to register myself as a user, the process fails with message: User register request failed. Please advise.

        Thank you for your valuable support.

        1. After login to Admin, I clicked on the User List icon and received the following message:

          localhost:4000 says
          DataTables warning: table id=userlist – Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1

          Following debug instructions, it is not clear what data caused this warning message. If possible, please provide some insight as to the likely source of this problem.

          1. This error mabe due to returned json data is empty. Check your select SQL query and json to make sure it is creating correctly. Thanks!

        2. yes the dbConfig constructor concept deprecated in php7, we will update the tutorial soon work without warning. thanks!

          1. Any update regarding the error “User register request failed.”
            I’m stuck with this, and I really wanted to fix this issue.

          2. It user details not saving into your database table. Please check this and fix. Thanks!

  28. Does the download link contain all of the code and scripts required for the following version
    User Management System with PHP & MySQL (updated April 12, 2020)?

  29. I want to delete the user data from the table by pressing the Delete button. I have changed the query from user.php but it’s not working.

    public function deleteUser(){
    if($_POST[“userid”]) {
    $sqlUpdate = “DELETE “.$this->userTable.” WHERE id = ‘”.$_POST[“userid”].”‘”;
    mysqli_query($this->dbConnect, $sqlUpdate);
    }
    }

  30. Hye, how to solve this problem? I keep getting this error when i try to register, Warning: mail(): Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp_port” setting in php.ini or use ini_set() in C:\xampp\htdocs\customer4\wetwest\class\User.php on line 132

    1. You need to make changes in your php.ini or set init variable with PHP for post and SMTP to work email. thank!

  31. This is great except no matter what it only shows 10 entries:

    Showing 1 to 10 of 10 entries

    This is the same on the admin test area on here, how to resolve this?

    Thanks!

  32. I have downloded the zip file and uploaded into the htdocs folder in xampp but it is not working. Can you help please

  33. iam getting error
    Warning: require(../config.php): failed to open stream: No such file or directory in C:\xampp\htdocs\atm\user-management-system-php\class\User.php on line 3

    Fatal error: require(): Failed opening required ‘../config.php’ (include_path=’C:\xampp\php\PEAR’) in C:\xampp\htdocs\atm\user-management-system-php\class\User.php on line 3

      1. i cant get pass this error

        iam getting error
        Warning: require(../config.php): failed to open stream: No such file or directory in C:\xampp\htdocs\atm\user-management-system-php\class\User.php on line 3

        Fatal error: require(): Failed opening required ‘../config.php’ (include_path=’C:\xampp\php\PEAR’) in C:\xampp\htdocs\atm\user-management-system-php\class\User.php on line 3

  34. Hey Guys,

    Great piece of work, well done! I got the whole system up and running so I well pleased; there is one thing I would like to see and that is for the login and logout times record, the the whole system would be truly awesome!

    Cliff

  35. Can i ask you why do you save the password in a cookie for the remember me feature? it’s not safe, i would like to see a version with a secure token

    1. yes it’s not safe, you can try other secure methods in your application. I will also try to update with same. thanks!

  36. Warning: mysqli::__construct(): (HY000/1049): Unknown database ‘webdamn_demos’ in C:\xampp\htdocs\user2\class\User.php on line 18
    Error failed to connect to MySQL: Unknown database ‘webdamn_demos’

  37. Thank you so much for this script which helped me a lot to create an adequate login system. However, I’d like to ask for a help:

    1. How to add an another user ‘designation’ which may help to upgrade the present ‘general’ user to ‘something’ new designation?

    2. In the page users_list.php while search, it gives this error: DataTables warning: table id=userList – Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1. How to resolve?
    (Instead in the demo it doesn’t work even!)?

    Please give me a hand. Sorry to disturb!

    1. You can add more functionality as per your needs. May there response data not get and its returning error. You can try to debug code to fix issue. Thanks!

  38. Showing entries are only 4 on my adminpanel in users even when in there is more in the datebase

  39. Awesome work!

    How to add profile pictures? Or profile picture + few more pictures into some kind of local profile gallery?

    1. this also works; Replace
      require(‘../config.php’); with include(‘include/config.php’);

  40. Great tutorial, as I am a newbie in PHP. I have your code working (I think ) but how do I secure the pages which is for the valid users with password in a existing website. I assume you have to ass some code in the start of the pages you want to secure.

    Thank you for sharing your code

    1. Yes, you can store logged in user details to session and check at the start of pages to secure it. thanks!

  41. hi I uploaded the demo on my site and this error comes out .. can you help me?
    thanks, david.

    Fatal error: require(): Failed opening required ‘../config.php’ (include_path=’.:’) in /membri/davidepro/class/User.php on line 3

    1. There are issue with include file config.php path. Check the file location and then fixed that. thanks!

      1. there are no limit, i use the demo script and directly upload and add data in mysql, but pagination just show 1

        1. where is the code for limit select query in show table ? i will try check and change the limit, i want to change limit 100 per page

  42. Tried to implement the php script i downloaded from the bottom of your guide on my website, but when I try to open the index.php I get a http server error 500


    This page isn’t working
    is currently unable to handle this request.
    HTTP ERROR 500

    i edited the two config.php files and User.php

    Am i missing something?

    1. Try to debug the code to find the cause of issue. You can also provide us the code to fix this. thanks!

      1. hi same error to me, i tried school management system its perfectly working, but this is not same error i tried to check in my cpanel but error This page isn’t working..
        is currently unable to handle this request.
        HTTP ERROR 500

    1. You can easily add this. You have do changes for this. Try and ask me if you face any issue. thanks!

  43. WEBDAMN,
    I down loaded your code and set it up on my system. Everything works fine except when I press the update button on the user list page. Nothing happens. debug shows that .update function is called but dies at $.ajax.

    users.js section:
    $(document).on(‘click’, ‘.update’, function(){
    var userid = $(this).attr(“id”);
    var action = ‘getUser’;
    // Died after this point
    $.ajax({
    url:’action.php’,
    method:”POST”,
    data:{userid:userid, action:action},
    dataType:”json”,
    success:function(data){
    $(‘#userModal’).modal(‘show’);
    $(‘#userid’).val(data.id);
    $(‘#firstname’).val(data.first_name);
    $(‘#lastname’).val(data.last_name);
    $(‘#email’).val(data.email);
    $(‘#password’).val(data.password);
    $(‘#passwordSection’).hide();
    if(data.gender == ‘male’) {
    $(‘#male’).prop(“checked”, true);
    } else if(data.gender == ‘female’) { …………………………….Con

    1. Is there js error? have checked response? check everything otherwise send code to me to fix issue for you. thanks!

    2. Will u be that nice and tell me how u have fixed the problem I have the same problem .

  44. The Edit User Modal form does not populate with row data when I click the update button on the Admin’s user list table for me on the downloaded code.

    1. Same issue after downloading the file, Admin Page is working except the Search Box and Update Button.

      Search : Invalid JSON popup
      Update Button: Not showing the modal Update button

  45. Hello Dear,

    is there anyone to help me out!

    I cannot login in, I did copy email id and password from phpmyadmin, and tried to login it says invalid login; then I try to register myself with new info yet its not working.

    anyone please help me.

    Thanks

    1. In database table password stored as md5 encode, so you need to login with actual password. thanks!

  46. Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; dbConfig has a deprecated constructor in /home/dmasraco/dmasra.com/demosite/admin/admin-area/include/config.php on line 2

  47. Hi

    When I try to register I am getting the following error

    ” mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. 33sm23549146wra.41 – gsmtp in C:\xampp\htdocs\My work\user.php on line 132″

    How do I fix this ?

    I reconfigured the settins in php.ini and sendmail.ini

    But I am still getting the above error

  48. Hello

    I have a little problem wiht this script if I do so as you explane I get a white screen how can I fix that ??

    Please help

    Already thanks

    Greets Flexx

  49. I am getting this response on my localhost: DataTables warning: table id=userList – Invalid JSON response. For more information about this error,
    Not able to update the data (popup not showing) and search function is not working as well.

  50. Hi I setup the db and the php files in my localhost using xampp but when I login using admin password then it redirects to index.php (not dashboard). How can I fix this? Is this a route issue?

  51. Hey I have it all setup but the cookie/remember me function isn’t working. Seems to be using sessions not the cookies. Am I missing something?

      1. I don’t find demo link is working yet however it is mentioned to be fixed and working. Could you please review so that demo link works, then only it will work for individuals use.

  52. can you please tell me how to add admin approvel functionality in dashboard.when admin approve users then they able to login.

    1. There are already “status” field in table to store user status as pending, active or delete. You can implement this with user in admin section perform user approval. Thanks!

  53. I have downloaded scripts and uploaded all files in /var/www/html but its not working.

Comments are closed.