Registration

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Простой пример сайта с админкой на php

Nemolite/student

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Читайте также:  Структура цикла do while python

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Проект «Портфолио достижений студента»

Структура файлов: index.php — стартовый (главный ) файл users.php — регистрация нового пользователя lk.php — личный кабинет пользователя, сюда попадаем только после авторизации chek.php — вход в систему (в личный кабинет) .htaccess — файл настроек (здесь можно изменить стартовый файл, например index.php на index.html , или на любой другой

Структура папок old_site — старый файлы сайта controllers — контроллеры (обрабочики, взаимодействие с базой данных), в основном php файлы css — файлы стилей (включая бутстрап) images — файлы изображений js — файлы JavaScript- скриптов sql — файлы структуры бд

About

Простой пример сайта с админкой на php

Источник

Create a Registration and Login System with PHP and MySQL

Create a Registration and Login System with PHP and MySQL

How to create a Registration and Login System with PHP and MySQL. Here is the quick solution to build a login system with PHP and MySQL. Nowadays almost every website provides Registration and login functionality. Thus, it is necessary to add a login system in modern web applications.

In this tutorial, we walk through the complete process of creating a user registration system. Users can create an account by providing username, password, email. After the account was created, the user can log in to their own account. Once the user login, it will redirect to the Dashboard page. Moreover, the user can logout from his panel. This whole system we are developed using PHP and MySQL.

Furthermore, we will show you how to build secure pages that are only accessed by logged in users. Without login, the user can not access the page.

How to create a Registration and Login System with PHP and MySQL

Here are Seven pretty simple steps you have to follow to create a login system.

  1. Create a Database and Database Table
  2. Connect to the Database
  3. Session Create for Logged in User
  4. Create a Registration and Login Form
  5. Make a Dashboard Page
  6. Create a Logout (Destroy session)
  7. CSS File Create

Create a Database and Database Table

First, you have to log in to PHPMyAdmin. Next, click on the Database tab to create a new database. Enter your database name and click on create database button. As soon as PHPMyAdmin will create a new database.

Create new database in MySQL - Registeration and login system

Similarly, you can execute the below query to create a database.

CREATE DATABASE LoginSystem;

Once you create a database, the second step to creating a user table. The user’s table will have the following fields.

  • id – int(11)
  • username – varchar(100)
  • email – varchar(100)
  • password – varchar(100)
  • create_datetime – datetime
CREATE TABLE IF NOT EXISTS `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(50) NOT NULL, `email` varchar(50) NOT NULL, `password` varchar(50) NOT NULL, `create_datetime` datetime NOT NULL, PRIMARY KEY (`id`) );

Copy the above query and execute it in the SQL query area.

Create user table in MySQL database - Registeration and login system

Your database table looks like the below screen.

User table structure

Connect to the Database

After creating the table, we have to create a PHP MySQL connector script to connect to the MySQL database server. Create a file named db.php and put the following code inside it.

db.php

Session Create for Logged in User

Next, we have to create a session for the user. Create a file named auth_session.php and paste the codes below.

auth_session.php

Creating a Registration Form

Furthermore, create PHP file registration.php and paste the following example code in it. This will create an HTML form. It will allow users to register.

registration.php

       

You are registered successfully.


Click here to Login

"; > else < echo "

Required fields are missing.


Click here to registration again.

"; > > else < ?>

Registration

Click to Login

?>

The output of the above code will look like this.

Registration form - Registration and Login System

Creating a Login Form

Similarly, create a PHP file login.php and put the following example code in it. This file code contains a form that allows users to enter username and password.

login.php

       else < echo "

Incorrect Username/password.


Click here to Login again.

"; > > else < ?>

Login

New Registration

?>

Similarly, the output of the above code will look like this.

Login form

Making a Dashboard Page

Once user login we will redirect to the user dashboard page. Create a PHP file named dashboard.php and paste the below code in it.

dashboard.php
        

Hey, !

You are now user dashboard page.

Logout

After the user login, you will see the following user dashboard screen.

User dashboard screen - Registration and Login System

Similarly, you can create another secure page. Only you need to add the below code first in your PHP file.

Create a Logout (Destroy session)

When clicking on the logout button we have to destroy user sessions. It will redirect to the login page. Thus, create a file named logout.php and add the below code.

logout.php

CSS File Create

Finally, important step for a user experience perspective. Create CSS file style.css and put the below code.

style.php
body < background: #3e4144; >.form < margin: 50px auto; width: 300px; padding: 30px 25px; background: white; >h1.login-title < color: #666; margin: 0px auto 25px; font-size: 25px; font-weight: 300; text-align: center; >.login-input < font-size: 15px; border: 1px solid #ccc; padding: 10px; margin-bottom: 25px; height: 25px; width: calc(100% - 23px); >.login-input:focus < border-color:#6e8095; outline: none; >.login-button < color: #fff; background: #55a1ff; border: 0; outline: 0; width: 100%; height: 50px; font-size: 16px; text-align: center; cursor: pointer; >.link < color: #666; font-size: 15px; text-align: center; margin-bottom: 0px; >.link a < color: #666; >h3

Finally, our login system is ready to use. You can download the source code from the below download link.

Final Thoughts

That all you need to know how to create registration and login system in PHP with MySQL database. Furthermore, we create a registration and login form. Moreover, we create a MySQL connection file to establish a database connection. Thus we create a complete login system with interactive design.

We hope you have found this article helpful. Let us know your questions or feedback if any through the comment section in below. You can subscribe our newsletter and get notified when we publish new WordPress articles for free. Moreover, you can explore here other JavaScript related articles.

Источник

Оцените статью