Part of the ‘Register & Login’ Project from PHP Academy. This tutorials walks you through registering a user to allow them to log in to your site.
Reader Interactions
Comments
korvlordsays
@buddhagoulash i think its cause it encrypts it to md5 beforehand wich means that it is looking at the encryption length, try adding the md5 encryption after you have gone through the check password length, hope it helps if not send me a message and ill try to find a fix for you
I think that the use of a javascript for field verification should work a way better than querying the database each time the user posts invalid or wrong data. It saves bandwidth and server load IMHO.
Absolutely clear and well produced tutorials, Alex. Thanks so much. Really helps supplement my reading of the books to see someone putting all this together before my eyes. Excellent stuff. Subscribed!
@buddhagoulash yes i found out why, its because of the md5() function changing the password too early in the form, that the $password becomes the “fdsgnkw4nwkfn20fekmwlef” or whatever, to fix this, simply add the md5() [or in my case, the hash(‘sha256’)] right before you finish your form… for eg.
…} else{
$password = hash(‘sha256’, $password);
$repeatpassword = hash(‘sha256’, $repeatpassword);
echo ‘You have been successfully registered.’;
}
Hi all,first of all i’m an italian boy so sorry for my bad english xD. Thanks a lot for this great tutorial. It helped me so much. For everyone that have some problem with the querys i resolved with:
even after typing the correct data into all the fields and clicking register..i donot get success…i keep gettin passwords donot match..any helppp…plssss…
great tutorials. i think it would be helpful if you upload the .php documents so that we can compare our codes. the if and else statements here get very complex.
korvlord says
@buddhagoulash i think its cause it encrypts it to md5 beforehand wich means that it is looking at the encryption length, try adding the md5 encryption after you have gone through the check password length, hope it helps if not send me a message and ill try to find a fix for you
glsmaster says
By the way wtf with all people requesting for the code. Write your own code and learn!
glsmaster says
I think that the use of a javascript for field verification should work a way better than querying the database each time the user posts invalid or wrong data. It saves bandwidth and server load IMHO.
Vortex42 says
Is it best to have your mysql_connect happen off the page in a folder outside of htmldocs or web?
Vortex42 says
Absolutely clear and well produced tutorials, Alex. Thanks so much. Really helps supplement my reading of the books to see someone putting all this together before my eyes. Excellent stuff. Subscribed!
cire72093 says
please post the code .__.
MrKoolTutorials says
Alex please can u put your register.php and login.php in the descripion because i have done this 2 now and i get an error with the validation.’s
MrKoolTutorials says
Help I Just keep Getting Password must be between 6 and 25 characters long! When It Is
Zuberguber105 says
@buddhagoulash yes i found out why, its because of the md5() function changing the password too early in the form, that the $password becomes the “fdsgnkw4nwkfn20fekmwlef” or whatever, to fix this, simply add the md5() [or in my case, the hash(‘sha256’)] right before you finish your form… for eg.
…} else{
$password = hash(‘sha256’, $password);
$repeatpassword = hash(‘sha256’, $repeatpassword);
echo ‘You have been successfully registered.’;
}
xygrax says
Im also having the same issue. the page seems to be ok and says, registration is successful. but it’s not inserting into my database. please help.
k3episode says
@killerboduk999 Hello, You need to use ” if (isset(‘submit’)) { /*all your coding defining variables*/ } hope this helps!!! 🙂
gymdani999 says
Could anybody post the full working code?
IlPadrinoRulla says
Hi all,first of all i’m an italian boy so sorry for my bad english xD. Thanks a lot for this great tutorial. It helped me so much. For everyone that have some problem with the querys i resolved with:
$queryreg = mysql_query(“INSERT INTO `users`(id, username, password, date) VALUES (NULL, ‘$fullname’, ‘$username’, ‘$password’)”);
I hope that it will help you. Bye!
rinsa89 says
even after typing the correct data into all the fields and clicking register..i donot get success…i keep gettin passwords donot match..any helppp…plssss…
buddhagoulash says
@buddhagoulash to fix this problem I had to encrypt the password after the strlen() check, in case others are having the same issue.
buddhagoulash says
@buddhagoulash this is the problem I’m having…I get the ‘password is too long’ error message no matter how long my password is…any ideas why?
buddhagoulash says
When we check the password length, isn’t it already md5 encrypted? In that case it will always be more than 25 chars long, am I right?
buddhagoulash says
When we check the password length, isn’t it already md5 encrypted? In that case it will always be more than 25 chars long, am I right?
michaelangelorayco says
even i specify the fields of the database on the sql command, i still cannot save my data in my database. but i don’t get errors. anyone?
killerboduk999 says
Notice: Undefined index: fullname in C:xampphtdocsxamppawlog inloginregister.php on line 7
Notice: Undefined index: username in C:xampphtdocsxamppawlog inloginregister.php on line 8
Notice: Undefined index: password in C:xampphtdocsxamppawlog inloginregister.php on line 9
Notice: Undefined index: repeatpassword in C:xampphtdocsxamppawlog inloginregister.php on line 10
this is the error but the program works properly how do i remove that error
killerboduk999 says
@codyjd2010 plssss help me its still error says…..Undefined variable: name
sitishorty says
when i first click on the Register? link, some how the localhost/register.php shows this error:
Notice: Undefined index: submit in C:xampphtdocsloginsessionregister.php on line 5
same goes to index: fullname, username,password, repeatpassword.
can someone tell me how to fix this error?
obn2000 says
@murkata86
Hi, thank you for help! it´s working.
I coldn´t insert data in mysql, you help was a sucess.
rvcsystems says
Very clear and helpfull. Thanks
hmhross says
great tutorials. i think it would be helpful if you upload the .php documents so that we can compare our codes. the if and else statements here get very complex.