Skip to main content

Archive

  • 2024 601
    • May 53
    • Apr 528
    • Mar 17
    • Feb 3
  • 2023 71
    • Nov 5
    • Oct 13
    • Sept 24
    • Jun 18
    • May 5
    • Jan 6
  • 2022 29
    • Dec 3
    • Nov 4
    • Oct 3
    • Sept 5
    • Aug 3
    • Jul 6
    • Jun 3
    • Mar 1
    • Jan 1
  • 2021 160
    • Dec 3
    • Aug 1
    • Jul 54
      • How to convert text or link into QR code
      • Simple Login System Design Using PHP And MySql Dat...
      • Full Screen Responsive Overlay Navigation Bar Desi...
      • Button Border Animation On Hover | HTML And CSS
      • Skewed Background Design | HTML And CSS
      • Gaming CPU Landing Page Design Using GSAP | HTML, ...
      • How To Edit Blogger Template XML And CSS
      • How to convert each character in the string to an ...
      • How to check a string contains numeric digits usin...
      • How to remove m=1 from blogger url
      • 12+ Best Competitive Coding Challenge Websites
      • Smooth Parallax Scrolling Effect ( Pure CSS) | HTM...
      • Multiple Overlay Animation On Image Using Html Css...
      • Page Transition Animation Using GSAP | HTML, CSS A...
      • Website Loader Animation Using GSAP | HTML, CSS An...
      • Portfolio Landing Page With Animation And Responsi...
      • Notification Card Design | HTML And CSS
      • How to find LCM of two numbers in javascript
      • How to generate random number within a range in ja...
      • How to add two numbers in javascript
      • How to get file extension using javascript
      • How to refresh page on specific time using javascript
      • How To Generate Random Rgb Color Using Javascript
      • How to Get Random Value from Array in Javascript
      • How to scroll to the top of the page using javascript
      • How to disable right click on website using javasc...
      • How To Generate a Random Color in JavaScript
      • How to redirect to another page using javascript
      • How to get user screen size using javascript
      • How to convert radians to degrees using javascript
      • How to print hello world using javascript
      • How to create array in javascript
      • How to include one javascript file in another
      • How to insert an item into an array at a specific ...
      • How to check whether a string contains a substring...
      • How to determine whether a value exists in an arra...
      • How to apply foreach loop on an array in javascript
      • How to count the number of keys/properties of an o...
      • How to dynamically access object property using va...
      • Follow Us On Social Media | HTML And CSS
      • How to remove a specific item from an array in jav...
      • How to Get an Object Keys and Values in JavaScript
      • How to clear javascript console in Google Chrome
      • How to set default argument values in JavaScript f...
      • How to check data type in javascript
      • How to remove a property of JavaScript object
      • How To Get The Current Page Url With Javascript
      • Write a JavaScript function to check if an input i...
      • What is the reverse of the push function in javasc...
      • How to validate an email address Using JavaScript
      • How to get unique values of an array using JavaScript
      • How to get the first element of an array using jav...
      • Cookies Card Design | HTML And CSS
      • Navigation Bar With Hover Animation | HTML And CSS
    • Jun 29
    • May 17
    • Apr 29
    • Mar 19
    • Feb 8
  • 2020 8
    • Nov 1
    • Aug 2
    • Jul 1
    • May 4
  • 2019 8
    • Oct 2
    • Sept 4
    • Mar 2
Show more

Simple Login System Design Using PHP And MySql Database

Login-system-design-using-php-and-mysql

Simple Login System Design Using PHP And MySql Database

This login system is a very simple design concept that can be found on any website that has a user login concept. We have already designed a number of login form interfaces, you can visit that playlist. The purpose of creating a login system is to collect user data and provide them some services that are not acceptable to normal users. So when you log in on that website you can able to use their services.

In this article, we will present a very simple concept for the login system. After this article, you will have the ability to design a login system. But we need some software and technologies that are used in this login system design. Before making this system, we will have to understand the technologies involved.

We will discuss every step in detail but you have to be attentive and try to understand what's is going on. So let's discuss.

Required Technologies

Let us first see what kind of technologies we are using to design this system. You don't need in-depth knowledge of all these techniques to design this system. If you have even basic knowledge then you can do it.

  • 01. HTML
  • 02. CSS
  • 03. PHP
  • 04. MySql

Required Softwares

Now, let's look at the main technologies that will be used to develop this system. In order to make your system work faster and get the work done in less time, it is very important to have these following software programs. You can check out the article on code Editing software.

  • 01. Text Editor(Atom, Vs Code, Sublime)
  • 02. Browser(Chrome, Safari, Opera)
  • 03. PHP Local Server(WAMP, XAMPP, AMPPS)
  • 04. MySql Database(inbuilt in PHP software)

client-server model

Login systems operate on a server-client model. It is used on every website that performs crud (create, read, update and delete) operations. You can see the image below how the client-server architecture. We are using wamp software for php server and database as we told you earlier.

Basic-Structure-Client-Server-Working

FLOW CHART

Only one concept is left that will show us the flow of our login system. As you can see in the below image where we have three HTML files(index.html, error.html and home.html) that will show us content in the browser window. We have one file of PHP( action.php), which handles the login submitted data and takes action according to the situation as you can see in the image.

Login-System-Flow-Chart

01. index.html

After all the basic knowledge of this system let's look ahead and try to apply everything practically. So let's design the login form that will take data from the user. So we are designing this form using simple HTML code which is below. This is an 'index' file that is visible to the user.

<!DOCTYPE html>
<html>
  <head>
    <title>Simple Login System Design Using Php And MySql | Rustcode</title>
    <link rel="stylesheet" href="style.css">
  </head>
  <body>
    <section>
      <form method="post" class="log-form" action="action.php">
        <div class="heading-container">
          <h2>Welcome back!</h2>
          <p>Please enter your login details</p>
        </div>
        <div class="group log-input">
          <input type="email" name="email" placeholder="Email" required>
        </div>
        <div class="group log-input">
          <input type="password" name="password" placeholder="Password" required>
        </div>
        <div class="group form-link ">
          <span>
          <input type="checkbox">Remember Me
          </span>
          <a href="#">Forgot Password?</a>
        </div>
        <div class="group">
          <button type="submit" class="btn">LOGIN</button>
        </div>
      </form>
    </section>
  </body>
</html>


Output:

Login-form-html-page-output


02. style.css

Now let's work on the 'Login form' user interface because aligning HTML elements creates a better user experience and interface. In the below code we write css code. We also include the Poppins font family in css file.

@import url(https://fonts.googleapis.com/css?family=Poppins);
* {
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
}

body {
    padding: 0px;
    margin: 0px;
    background: #eee;
    display: flex;
    height: 100vh;
    justify-content: center;
    align-items: center;
}

.heading-container {
    text-align: center;
    margin-bottom: 40px;
    padding: 0px;
}

.heading-container>* {
    margin: 0px;
    padding: 5px;
}

.log-form {
    width: 380px;
    border-radius: 4px;
    margin: 2em auto;
    padding: 3em 2em 2em 2em;
    background: #fafafa;
    border: 1px solid #ebebeb;
    box-shadow: rgba(0, 0, 0, 0.14902) 0px 1px 1px 0px, rgba(0, 0, 0, 0.09804) 0px 1px 2px 0px;
}

.group {
    position: relative;
    margin-bottom: 30px;
}

.log-input {
    font-size: 18px;
    width: 100%;
    border: none;
}

.form-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
}

.log-form a {
    font-size: 11px;
    font-weight: 500;
    color: black;
}

input[type="email"],
input[type="password"] {
    width: 100%;
    border: 2px solid #7768AE;
    font-family: "Poppins", sans-serif;
    font-size: 12px;
    font-weight: 600;
    padding: 12px;
}

.btn {
    width: 100%;
    padding: 10px 0px;
    background-color: #7768AE;
    cursor: pointer;
    font-size: 16px;
    font-family: "Poppins", sans-serif;
    color: #fff;
    border: none;
    font-weight: 500;
}:


Output:

Login-form-design-page-with-css-output


03. Database Design

We are using wamp software to create this login system. You can read the full document of the wamp software from the wamp official site. This software has a MySQL database to store data. There are two methods to create a database and table. The first method is using a console and the second is using MySQL interface. We will use the interface method because it is a fast and easy method.

First, start wamp software then open your web browser and go to localhost. Now login with 'root' user after that select 'new database' then enters the database name, we gave database name "login demo". Now time to create a table inside the database. Click on the 'new table' and give the table name accordingly, we gave "user". Then next is to create the column in the table. The column has three important properties first is their name, the second is their value type and the third is length. As you can see in the image.

Now your database is ready. You can store data in the table. But we need some extra knowledge to store data in the database. Because the database can not store everything. So we will use PHP language as server-side that help us to perform data deletion, insertion, updating tasks, etc.


After creating a database and table we inserted some dummy data in that table so that we can perform login operation. You can see in the image.

Data-Insertion-In-MySQL-Database


04. Database Connection

After creating a database and a table in that database to store login data. Now We will connect our website server with the MySQL database So that we can easily extract and import data in the MySQL database. Below is the PHP script which will help us to connect the MySQL data and the server.

<?php      
 $host = "localhost";  
 $user = "root";  
 $password = '';  
 $dbname = "databasename";  
    
  $con = mysqli_connect($host, $user, $password, $dbname);  
   if(mysqli_connect_errno()) {  
    die("Failed to connect with MySQL: ". mysqli_connect_error());  
   }  
?>  


05. Action.php

This file (action.php) will handle the login form data after the form is submitted and will take the redirect decision accordingly. As you have already seen in the flow chart.

You can see in the code of the "action" file that if the submit details in the form match the data entered in "MySQL", we will go to the "homepage", but if it doesn't match, you will be redirected "Error" page. So that you can get the login option. You can also redirect to index.html instead of redirecting to the error page

<?php
 $email=$_POST['email'];
 $password=$_POST['password'];

 $con=mysqli_connect('localhost','root','','logindemo');
 $q="Select * from user where email='$email' && password='$password'";
 $result=mysqli_query($con,$q);
 $n=mysqli_num_rows($result);
 if($n==1){
  header('location:home.html');
 }
 else{
  header('location:error.html');
 }
?>


06. Login Successful (Home.html)

This homepage design is done with the help of HTML and CSS. This is a very simple page, just made to show you that we are on a new page.

HTML

<!DOCTYPE html>
<html>
<head>
  <title>Homapage | Rustcode</title>
</head>

<body>

   <h1>Welcome to homepage!</h1>

</body>
</html>

CSS

body {
  padding: 0px;
  margin: 0px;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  font-family: "Popiins", sans-serif;
  background-color: #C7EDE4;
  text-transform: uppercase;
}

Output:

Login-Successful-Home-Page


07. Login Failed (Error.html)

Now this is the design of the error page, this is also a very simple page in which the link of the login page is given so that you can go back to the login page

HTML

<!DOCTYPE html>
<html>

<head>
 <title>Login Failed | Rustcode</title>
</head>

<body>

  <span>Invalid email or password <a href="index.html">login again</a></span>

</body>
</html>

CSS

@import url('https://fonts.googleapis.com/css?family=Poppins');
body {
  padding: 0px;
  margin: 0px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100vh;
  font-family: "Popiins", sans-serif;
  background-color: #EDD382;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.5em;
}

Output:

Login-Failed-Error-Page


08. Souce Code

We would suggest you to practice yourself and write the code. But if you want to download the code then you can do it by clicking on the button given below.


We try to provide you the best content, if there is any mistake in this article, then let us know.




Comments

哆哆女性网网站制作贵不贵给女朋友起名字大全吉林省建设招标信息网站厦门网站优化生辰起名网免费 取名老太太cheapwindowsvps80岁斌字好听的微信网名八十年代起名常用字化妆品起名带财气的沈姓宝宝取名起名大全关于iu的个性签名10画的字字起名睢县北湖必去景点称骨算命男版张姓猪孩子起名大全网站优化案例分析猴宝宝起名武汉网站制作销售一个商城网站制作唐诗的 宋词 起名名字起的太大会怎样有意义女孩起名大全b2b2c网站建设全国连锁超市起名苏州设计网站公司晋灵公广州营销推广托管宝石公司起名哪个网站有英文教学设计地产起名大全免费淀粉肠小王子日销售额涨超10倍罗斯否认插足凯特王妃婚姻不负春光新的一天从800个哈欠开始有个姐真把千机伞做出来了国产伟哥去年销售近13亿充个话费竟沦为间接洗钱工具重庆警方辟谣“男子杀人焚尸”男子给前妻转账 现任妻子起诉要回春分繁花正当时呼北高速交通事故已致14人死亡杨洋拄拐现身医院月嫂回应掌掴婴儿是在赶虫子男孩疑遭霸凌 家长讨说法被踢出群因自嘲式简历走红的教授更新简介网友建议重庆地铁不准乘客携带菜筐清明节放假3天调休1天郑州一火锅店爆改成麻辣烫店19岁小伙救下5人后溺亡 多方发声两大学生合买彩票中奖一人不认账张家界的山上“长”满了韩国人?单亲妈妈陷入热恋 14岁儿子报警#春分立蛋大挑战#青海通报栏杆断裂小学生跌落住进ICU代拍被何赛飞拿着魔杖追着打315晚会后胖东来又人满为患了当地回应沈阳致3死车祸车主疑毒驾武汉大学樱花即将进入盛花期张立群任西安交通大学校长为江西彩礼“减负”的“试婚人”网友洛杉矶偶遇贾玲倪萍分享减重40斤方法男孩8年未见母亲被告知被遗忘小米汽车超级工厂正式揭幕周杰伦一审败诉网易特朗普谈“凯特王妃P图照”考生莫言也上北大硕士复试名单了妈妈回应孩子在校撞护栏坠楼恒大被罚41.75亿到底怎么缴男子持台球杆殴打2名女店员被抓校方回应护栏损坏小学生课间坠楼外国人感慨凌晨的中国很安全火箭最近9战8胜1负王树国3次鞠躬告别西交大师生房客欠租失踪 房东直发愁萧美琴窜访捷克 外交部回应山西省委原副书记商黎光被逮捕阿根廷将发行1万与2万面值的纸币英国王室又一合照被质疑P图男子被猫抓伤后确诊“猫抓病”

哆哆女性网 XML地图 TXT地图 虚拟主机 SEO 网站制作 网站优化