How To Create A Login System In PHP For Beginners | Procedural MySQLi | PHP Tutorial

Dani Krossing · 1.2M views · 2020 · 1:57:38

Open on YouTube

Web developmentPython, Ruby & scripting languagestutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as the tutorial they followed when building a PHP login system, and they often cite it when asking about session or password-check problems that came up while following along.

Recommended by 1 people across 1 different months, 2021 to 2022.

What it is

A nearly two-hour beginner tutorial by Dani Krossing that builds a login and signup system in procedural PHP with MySQLi. It covers forms, error handlers, sessions and showing content only to logged-in users.

What people said

Recommends JK Tech · 2021-06 · Stack Overflow · on “the session created in a page doesnt shares with other”

i tough that it shouldnt have session start when you said it, but seeing this [this video] video i notice two things, it has `session_start();` in the other pages and it have the `exit();` in the end of the files, i did as how he did and now it is working perfectly, thank you for you answer though, if i understood it right i would have fixed this problem already. but yeah, `session_start();` is needed in the other pages aswell, i tough that doing once would work for every page

Cites Matt Drake · 2021-05 · Stack Overflow · on “Global $_SESSION variables”

I've been following Dani Krossings Login System [this video] It's a great tutorial and is just what I am looking for, there is just one thing I'm struggling with. After logging in, the header doesn't refresh. Following login, the header should change to ...Profile Page, Logout. The code I have stays as Sign Up, Login. It is as is the $_SESSION variable has not come through to the header. However, if after login, I select the Sign up or login link, the header changes to what it should be. Function code function uidExists($conn, $username) { $sql = "SELECT * FROM users WHERE usersUid = ? OR usersEmail = ?;"; $stmt = mysqli_stmt_init($conn); if (!mysqli_stmt_prepare($stmt, $sql)) { header("location:

Cites drakepolo · 2022-01 · Stack Overflow · on “Why am I receiving null as a response for an sql column with data in it? (PHP)”

I am building a log in system and every other part works perfectly fine except for the portion that cross references the entered password with the password in the database. So when I checked to see if the passwords match I realized that the password from the database is coming back as null. May I ask what is happening?? (There is no issue with the "uidExists" method, it seems to just be in the "loginUser" method). This is based of of this video [this video] I believe its around the hour and 40 minute mark he gets to the loginUser function. function loginUser($conn,$username,$pwd){ $uidExists = uidExists($conn,$username,$username); if($uidExists === false){ header("location: ../login.php?error=wro