PHP Tutorials: Register & Login (Part 5): User Login (Part 1)

preview_player
Показать описание

Official site

Twitter
Рекомендации по теме
Комментарии
Автор

These tutorials give a really nice insight on how a website is created in a professional manner. First someone can make the mockup html / css, then the php coder cuts it up into pieces and adds the functionality. I've been looking for a tutorial like this for a long time. It's not about knowing the code, it's more about knowing how to structure it. Thanks a lot for this Alex.

Pitpalacu
Автор

This is the clearest explanation on this topic in the world.

yellowhat
Автор

Object Oriented Programming Programming is when you create a function/object/method once then use it multiple places rather than redundantly placing the same code in multiple files. It is much cleaner and much easier to work with. OOP is the only way to go.

toombs
Автор

It's a minor detail but it's not very secure to say a user doesn't exist. The better route would be to say "Please enter a correct username and password". That way a hacker or a friend who knows someones password but not username wouldn't be able to login. It's not likely to happen but security isn't there to only protect against likely problems. Still though, very good tutorial :)

toombs
Автор

I just went through that part, everything seems ok. Go again with this tutorial :)

Glyptdn
Автор

Alex, apart from a few glitches (my fault) this tutorial is looking good. Thanks for your hard work, it is appreciated.

dashbyictfd
Автор

check the form in the login.php, maybe it has the same name "username" in both username input text and password input text.

latlov
Автор

ok so you can echo each one like this on the login page:


include'core/init.php';


if(empty($_POST) === false ) {

$username = $_POST['username'];
$password = $_POST['password'];

}
echo $username;
echo $password;


make sure that you echo under the last curly brace. That was the difference for me. there are lots of others on that page so i ended up using a different method all together

dukestt
Автор

@HiddenShadey Hey dudes, if you are new to PHP make sure you have "proper grammar" in PHP, always remember to put a semicolon " ; " at the end of each PHP statement. Also remember the difference between double" & single' quotation marks since if you use single quotation marks in a statement when using a variable inside of it it won't work since single quo. marks are used to echo just plain text with no variables in it. Check those things and if you follow Alex's steps you should be fine :D

jackdelar
Автор

if you do var_dump($_POST) you will notice that the keys  are not empty which means that the $_POST is not empty which will always return false instead you should check if the keys have any values in them before moving forward so if the values are empty then we can log errors or default the errors  to an empty array (with no keys or values to ensure the array is empty which is something important and should be set to an empty array before running any code in the login.php page (the one that processes the login form)

harleyurquhart
Автор

im at 5:23 now
so i said input type submit value login
and it just shows an empty button, i dont see login written inside that button

VDEngineering
Автор

i was so glad when you changed the password name @ 8:25 was doing my head in for 2 minutes aha :)

charliesheen
Автор

you have to use instead of It took me 3 hours to figure that out nice tutorial

littlescoots
Автор

when i login at 9:42 its an error
the error message which i did from ur older tutorials appears

VDEngineering
Автор

Damn, its a very professional tutorial. Many thanks for Your courses Alex!

MrBeerbant
Автор

to fix blank page in init.php write the code in this way:


require 'functions/users.php';
require 'core/database/connect.php';


session_start()

Thank you for the tutorial 

BilalBaydoun
Автор

Dude, these tutorials are so awesome

MrVideoAndroid
Автор

Q: The form in login.php which is in the widget subfolder folder of includes, that is meant to be

form action="login.php" method="POST"

or

form action="../../login.php" method="POST"

Just a question as having problem logging in, just keeps returning to logged out form. Any help would be appreciated.

dashbyictfd
Автор

I find this extremely confusing firstly because you guys haven't even provided all the necessary files so it's not even possible to know what file we are on.
Just a tip maybe provide a download with ALL the files? (Login.php, Register.php the css, etc etc etc).
Other then that I like how you explain things pretty well but I noticed on your new boston tutorials you confused me a bit at times (you didn't explain blocks in PHP very well)
With that aside I just want to say thank you Alex!

BlufferYVHacker
Автор

finally found a solution in a forum, but that doesn't really explain why SELECT COUNT works for alex in the tutorial code, yet not in mine.
The mysql functions to turn the resource id into data is not included.
// mysql_fetch_row returns an array.
$Q = mysql_fetch_row($query);
$Q = $Q[0];
echo $Q;

IKnowYouDidnt