Multi User Role Based Login in Php With Mysqli Updated FREE
Multi User Role Based Login in Php With Mysqli
How to Create Multi User Login Course in PHP using MySQL Database?
Hello guyz, if you are looking for the tutorial that shows how to create a multi user login form in PHP using MySQL database and redirect to different pages based on user role, then you are in the right tutorial.
In the process of developing a webapps that is targeting for multiuser that they tin can login into the webapps, you need to create different user login in your webapps and must define different function of each terminate user and and then redirect to the different pages when they login to the webapps by using their associated username and password. When each end user login to the their business relationship in that webapps they must demand to admission only their spider web pages. The perfect example is facebook. So, this tutorial is all about this.
Steps:
Annotation: I am considering that you have bones noesis of PHP. If you are new to PHP, its amend to read this tutorials 🙂
1. If y'all guyz are working with the PHP for the very beginning time, so you should know that PHP is server side scripting language, and then it executes but in the server. if you create PHP file in your computer and endeavour to run in any browser, there is no output. So working with PHP is far more Different than working in the apparently HTML. That'south why you need to install server application in your calculator like wamp server, xampp server etc for window.
Download wamp server from hither: CLICK Hither
At present y'all should have text editing software in your PC, every window based PC have Notepad just i am using Dreamweaver CC. Afterward downloading and installing these two software(Dreamweaver and wamp server) y'all demand to ascertain site and testing server in Dreamweaver cc and then that every time when you try to execute PHP file, you do non need to salve your PHP file by browsing the location of the server. if you don't know how to do this. Read this article: CLICK Here
2. Later on installing wamp server application, Start your wampserver, then open your localhost, for this open up your whatsoever browsing software and type localhost or 127.0.0.1 in the address bar. Then new page volition announced and then roll down and findphpmyadmin and click on that. Then you will exist able to see the login page. Login in past inbound username and password (Default username is root and countersign is empty).
And then click on new and create one database having whatsoever name you desire and the click OK, then create table having 3 field in and click on become. Later on that, you need to insert the field proper name like: username, countersign and usertype. then select the length (like 50, 30, 100 etc) too as information type (recommend varchar) as your requirement and and so click on save. OR You can watch the video for this designing office, you lot may understand amend in video. some screenshot of creating database are:
NOTE: we take to insert username, password and usertype in our database. Then, for this, Click on insert tab and insert username, password and usertype as:
three. After completing this task, write the following piece of code and salvage it in .php extension.
<!doctype html> session_start(); <?php $servername="localhost"; $username="root"; $password=""; $dbname="multiuserlogin"; $conn = mysqli_connect($servername, $username, $password, $dbname); repeat("conneciton"); if(isset($_POST['Login'])){ $user=$_POST['user']; $pass = $_POST['pass']; $usertype=$_POST['usertype']; $query = "SELECT * FROM `multiuserlogin` WHERE username='".$user."' and password = '".$pass."' and usertype='".$usertype."'"; $effect = mysqli_query($conn, $query); if($result){ while($row=mysqli_fetch_array($result)){ repeat'<script type="text/javascript">alarm("you are login successfully and you are logined as ' .$row['usertype'].'")</script>'; } if($usertype=="admin"){ ?> <script type="text/javascript"> window.location.href="admin.php"</script> <?php }else{ ?> <script type="text/javascript"> window.location.href="user.php"</script> <?php } }else{ repeat 'no result'; } } $_SESSION['login'] = true; ?> <html> <head> <meta charset="utf-8"> <title>Multi user login arrangement</title> </head> <trunk> <form method="mail"> <table> <tr> <td>Username:<input type="text" name="user" placeholder="enter your username"</td> </tr> <tr> <td>Password:<input type="text" proper noun="laissez passer" placeholder="enter your password"</td> </tr> <tr> <td> Select user type: <select name="usertype"> <choice value="admin">admin</option> <option value="user">user</pick> </select> </td> </tr> <tr> <td><input type="submit" name="Login" value="Login"></td> </tr> </table> </form> </torso> </html>
iv. Open this .php file in any browser you want. 🙂 That's information technology guyz. if you lot have any confusion yous can annotate your confusion in the following comment section or watch the following
videos:
Multi User Role Based Login in Php With Mysqli
DOWNLOAD HERE
Source: https://www.techsupportnep.com/programming/php/how-to-create-multi-user-login-form-in-php-using-mysql-database.html
Posted by: bantonfisir1981.blogspot.com
0 Response to "Multi User Role Based Login in Php With Mysqli Updated FREE"
Post a Comment