After hours of frustration, I finally figured out that I haven't declared the $connect variable or the $queryreg in my script. I'm guessing this is why my info won't post into the database account. Correct? How do I declare these variables, like I declared the $username and $password etc, at the top of the script?
- we should also use my_real_escape_string() for any entry
- He should check if username does not exists in the database before he inserts a newuser otherwise registered username can be taken even if it already exists.
- I do not want to continue with the errors.. because I do not want to discourage anyone for reading these tutorials
Alex, you're doing an awesome job! Watching videos like this makes me want to disconnected cable TV :).
I notice people are having issues with inserting data to the database here is a hint for those that cant get it. mysqlquery("insert into table(id,fullname) values('',$fullname)")
if everything looked good but the data wasn't input into the database, for me it needed two fixes:
1. in your database, the varchar of password should have a length of 32 or greater
and in my mysql_select_db("twist_phplogin") thats what i needed to do to fix mine so make sure its connecting and make sure you got this line as is $queryreg = mysql_query("INSERT INTO users VALUES ('','$fullname','$username','$password','$date')");
i did everything right but when i insert data and click on register it process alright. but nothing transferred into my database. it add's one raw and my details are not in it. error message
I have a proble. It says that I registered successfully but I can't see user in my datebase. Any help? I can send you my code too to check if there is any mistake.
@aleksy36 im still only new to PHP, but after following every step that Alex has shown us, it worked perfectly for me. Whilst watching the tutorial and reading your post, I thought that maybe the mysql_query that Alex had written was incorrect, but on second inspection its spot on...maybe go through it all again with a fine tooth comb and double check your code...there may be one tiny little character out of place...good luck :)
everytime I type in any information in register.php it says that passwords do not match. where did I make a mistake? I can send you a PHP code if you need it.
Hello everyone if anyone got notice errors in their text fields while doing this form validation procedure of when alex does value=the php code i figured out how to make it work in the browsers.The code is just like what alex has but i cant post it here if you want the code please send me a email on youtube requesting it.thanks..
aaaah i dont understand the html form value php script thing that alex phpacadamy did in this tutorial can someone plz send me the script or help me with the code please or send me mail in my inbox. i keep getting erros in my textboxes in my form what am i doing wrong.
@025JoshTMMM82 Putting the codes inside the value of the html means, that when a person for example fills all forms like username, fullname and password,and ...say if he entered the incorrect password.. when the page refreshs to inform him about the incorrect password entered the browser will store and keep the username, and full name to save you time from writing it again. For that effect, you must right the variable of the username inside the value of the html.i am so newbee knew that recently
I have had a bit of trouble with the coding on this part, with no fault to Alex (thank you very much by the way), but with the syntax of all the lines put together.
With so many if statements, you really have to make sure you understand what is being done if requirements are met and when they are not
I would also suggest downloading that text program he is using. ConTEXT is actually a great tool to diagnose any problems because it colors everything in an easy to understand way.
I need help Its when he putted the echos in the html fields but has anyone gotten this error message into their textbox or box yet of html code saying Notice Undefined Variable: fullname or username or something like this Notice: Undefined variable: firstname in C:\xampp\htdocs\register.php on line 77 has anyone came across this yet please let me know by sending me email on youtube. thanks. it has like bold and breaks in html code
@JDTuts you can learn without having to follow a step-by-step tutorial.. programming is logical; you can learn syntax and how everything works by simply reading the code over many times and trying to copy it
@smokenfly514 yeah if you think so you should just dump learning php .. the point is to see how it is done not to get the code - there are many done script on the web .. GTFO ! great tutorial !
@elpazzobg If one is familiar with the basic important programming concepts, one may learn a language by being provided with the code, understanding what it does, and then going over the syntax and logic. It's retyping the code several types that is key. Your comment merely demonstrates your lack of intelligence. And for the record, I'm way past this and learning at a faster pace than you with my method. You're dismissed.. and don't bother replying because I won't read your response.
if everything looked good but the data wasn't input into the database, for me it needed two fixes:
1. in your database, the varchar of password should have a length of 32 or greater
2. Something must be input into the mysql_query line (for me at least)... Changing the user id from '' to 0 (or any number) fixed it for me, that is... VALUES ('','$username','$password','$fullname','$date') ");
changed to VALUES (0,'$username','$password','$fullname','$date') ");
u are right :p but what I was trying to say is since we add the md5 encryption of our password in the database (of length 32 btw) and not our password(of length 25) our varchar needs to be 32 of length at least to make space for the md5. so if it says that uve been registered, but it DIDNT add to db, means that your codes good, only there is no space in your varchar for the md5 version, so change it to 32. If it says that password is too long, means u did md5 b4 checking length, so u checked md5
Hey guys just a heads-up, I've noticed that if you follow this tutorial step-by-step, it allows for duplicate usernames. If you want your users to have unique usernames, you'll have to select "username" from the database and check the number of rows. If no values are returned, the registeree's username is valid. Then, you can proceed to adding them to the database.
These videos are awesome. One problem on this one is that I am getting everything to the database, except the date, which shows all 0's. Did I miss something? Thanks!
I am not.... Although, many of us are spening hours and days trying to get it working and in the process learning some PHP. I still think that we should see a complete working codes so we can see where we are going wrong.
I just can say thanks for the tutorials you made. They are very useful and many webdesigners now can script :D because of you. God Bless you sir. :) (bow)
I was brought to the page where it said i successfully registered, but the data wasnt in the database. I think it is because in the beginning, we put the varchar of the password to 25! but with the md5 encryption, our password variable ($password) is longer than 25.... so i changed to varchar length to 1000 and it works! Thumbs up so everyone can see :)
@XxLethalxStrikesxX you shouldve set md5($password) after your password check
if (strlen($password)>16||strlen($password)<6) { echo "Password must be between 6 and 16 characters"; } else { //encrypt password $password = md5($password); $repeatpassword = md5($repeatpassword);
@XxLethalxStrikesxX Only needs to be 32. ALL MD5 hashes are 32 bits of data, more commonly known as 32 characters. If you have 1000 then you can run in to problems.
I was brought to the page where it said i successfully registered, but the data wasnt in the database. I think it is because in the beginning, we put the varchar of the password to 25! but with the mdy encryption, our password variable ($password) is longer than 25.... so i changed to varchar length to 1000 and it works! Thumbs up so everyone can see :)
@daeheadshot maybe you tried some other date format instead of $date = date("Y-m-d"); (which i also tried at first, since I use d-m-y in my daily life) or didn't put '$date' in the sql_query
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!
@MrKoolTutorials its because he ecrypted the passwords to md5 BEFORE he checked the length of the passwords(converting it to md5 creates a 32 char long string)
just put the md5() inside the else body of the password length test
@MrKoolTutorials that's because he applies md5 before checking for the length of password! Just check the length first and then apply md5. It should work :)
@MrKoolTutorials Reorganize your code so that the script MD5 encrypts the password AFTER it checks for password length, not before. Your perfectly legitimate password is put through md5 and ends up like this: 5f4dcc3b5aa765d61d8327deb882cf99, which is longer than 25 chars. Here is what is SHOULD look like: if (strlen($password)>25||strlen($password)<6) { echo "Username and password must be longer than 6 characters"; } else { md5($password); md5($repeatpassword); }
@MrKoolTutorials check your heirarchy of your if statements and go through them one at a time. be sure that they are all one after another until you are ready to register the user when everything is correct (in the middle of the if statements, before the user error messages that you put using else statements when the if statements are incorrect.) if you need more help i can pm you with what i have that works.
@MrKoolTutorials The reason your are getting this error is because Alex encrypted the password before checking for length. The length of md5 encrypted passwords is always 32 characters and that's why you get the error. To fix this just encrypt the passwords after you check for length.
You're getting the error because you are getting the length of the md5 encrypted version of the password, wich is 32 characters long. He only showed almost all of the ways to get an error message, but not how to get the succes message. You simply need to check the length of the non-md5 encrypted password :3
@MrKoolTutorials If you've enrypted the password before it checks if it is between 6 and 25, than it's gonna say it's too long. Move that encryption md5 code above the code for storing datas in the database.
@MrKoolTutorials it's because he set the md5 to the password before controlling the length and your password is no longer 6char but something like 5h39038n23hrh. So you can set the md5 just at the final else statement or you can assign a new variable for the password variable.
@MrKoolTutorials Take the $password = md5($password); and $repeatpassword = md5($repeatpassword); strings and put them after echo "Success!!";
Otherwise the passwords are automatically converted to md5 (and they are long) before they are even put in the data base. If you move it at the end, it will only convert them into md5 if all criteria have been met for a successful login.
Sorry if it doesn't make sense. I'm a total beginner. But it worked for me.
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...
@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.';
@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
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.
My code keeps giving me that my passwords don't match... even if i put in the same passwords. If i don't put a user name it will give me that same error too. please help
I keep getting Notice: Undefined index: password in C:\xampp\htdocs\Reg\register.php on line 7 whenever i get out of the page and hit register again in the index.php page
can u post here the full codes for register.php.. coz it is not recognize in the video.. in short.. the "VIDEO" didnt start at the top.. he started immediately in testing the register.php.. thanks..
can u post here the full codes for register.php.. coz it is not recognize in the video.. in short.. the "VIDEO" didnt start at the top.. he started immediately in testing the register.php.. thanks..
ok well when i entered all my info into the form it didn't display the registration success or the link to the login page, it comes up with a blank page with the word Register on top. and it will not insert any data into my database!
Also, one more thing I've noticed - due to the md5 hashing the hashed password is more than 25 characters. I've increased the lenght of the password in myphpadmin to 40 and then it was working fine. Hope this helps.
I was having the same issue - no errors, but data wasn't added to the database. I've checked in Google and it seems that the data was not added becase MySQL was trying to put the data in rows, so I've adjusted the code telling MySQL to put the data in the columns. Here is how the new code:
$queryreg = mysql_query("
INSERT INTO users (name, username, password, date) VALUES ('$name','$username','$password','$date')");
So, anybody know what code I could add to check user registration info against the info in the database and not let them re-register?
I would guess after the
$connect mysql_connect();
that this might be the next line of code
$connect = mysql_query("SELECT * FROM users WHERE email='$email'");
then...
just01161 2 hours ago
After hours of frustration, I finally figured out that I haven't declared the $connect variable or the $queryreg in my script. I'm guessing this is why my info won't post into the database account. Correct? How do I declare these variables, like I declared the $username and $password etc, at the top of the script?
just01161 3 hours ago
@just01161
$connect = mysql_connet(" "," "," ") or die ("Couldn't Connect!);
mysql_select_db (" ") or die ("Couldn't find Database!");
$queryreg = mysql_query("INSERT INTO users VALUES ('','$fullname','$username','$password','$repeatpassword','date')");
just01161 3 hours ago
@just01161 Do I need to add periods around them like the lower post? '.$username.'
just01161 3 hours ago
@just01161 my code does have the c in "mysql_connect" lol that's not the problem
just01161 3 hours ago
@just01161 ha, I just got it to work. Great tutorial, learned soo, soo, much. Thanks!!
just01161 3 hours ago
aa
alimunth 3 days ago
It works!
Incomingson 4 days ago
$queryreg = mysql_query('INSERT INTO users(name,username,password,date) VALUES("'.$fullname.'","'.$username.'","'.$password.'","'.$date.'")', $connect);
Incomingson 4 days ago
Comment removed
empireones 1 week ago
Comment removed
tgp611591 1 week ago in playlist More videos from phpacademy
I looked around and found this:
$queryreg = mysql_query ("INSERT INTO users SET id='',Name='$fullname',username='$username',password='$password',date='$date'");
It works now.
PktMma 3 weeks ago
- we should also use my_real_escape_string() for any entry
- He should check if username does not exists in the database before he inserts a newuser otherwise registered username can be taken even if it already exists.
- I do not want to continue with the errors.. because I do not want to discourage anyone for reading these tutorials
dapieputb 1 month ago
$sql = "insert into users (`id`, `name`, `username`, `password`, `date`) values ('', '$fullname', '$username', '$password', '$date')";
mysql_query($sql); at register.php
$username = (isset($_POST['username']) ? $_POST['username'] : false);
$password = (isset($_POST['password']) ? md5($_POST['password']) : false);
at login.php have to md5 the password
phpmyadmin: password varchar(32) because md5 changes anything to 32 characters
then it should work.
dapieputb 1 month ago
Somone Plz help!
I have everything setup, but when i went to sign up it said this:
Notice: Undefined variable: connect in C:\xampp\htdocs\test_website\register.php on line 38
Fatal error: Function name must be a string in C:\xampp\htdocs\test_website\register.php on line 38
XxRedDude 1 month ago
i couldnt save the data in the database ,, i read all comments and i did many changes and also the same ,,, i dont know what to do uff :(
MistoKurdish 1 month ago in playlist More videos from phpacademy
Alex, you're doing an awesome job! Watching videos like this makes me want to disconnected cable TV :).
I notice people are having issues with inserting data to the database here is a hint for those that cant get it. mysqlquery("insert into table(id,fullname) values('',$fullname)")
good luck, hope this helps!
zaroSword 1 month ago
I just finished writing all the tutorial and tested it with xampp and works like a charm. If you want the files PM and i will give you.
LEilllLEi 1 month ago
can you email the code no matter what i do i can't get it right
spanzies 1 month ago
Hmm still can't seem to get the user information to submit to the data table....
MikeTrottermb 1 month ago
i have problem with the date :( it only says 0000-00-00. how stup is that
iShieldBoy 1 month ago
This has been flagged as spam show
DATA WASN'T INPUT FIX:
if everything looked good but the data wasn't input into the database, for me it needed two fixes:
1. in your database, the varchar of password should have a length of 32 or greater
and in my mysql_select_db("twist_phplogin") thats what i needed to do to fix mine so make sure its connecting and make sure you got this line as is $queryreg = mysql_query("INSERT INTO users VALUES ('','$fullname','$username','$password','$date')");
twistedjproductionz 1 month ago
hey i have a brilliant idea of how to make this much easier....email me the codes :/
kaichin11 1 month ago
Hmm, i keep getting the message "Password must be between 6 and 25 character" even when they are over 6 characters
SodaWizard 1 month ago
Why I follow all steps as movie. But cannot move data into mysql???
HELP!!!!!!!!!!
mackthchan19 1 month ago
i did everything right but when i insert data and click on register it process alright. but nothing transferred into my database. it add's one raw and my details are not in it. error message
Notice: Undefined index: submit / fullname/ username / password/ repeatpassword. plz advise.
trinitymet777 2 months ago 2
@trinitymet777
alimunth 3 days ago
I have a proble. It says that I registered successfully but I can't see user in my datebase. Any help? I can send you my code too to check if there is any mistake.
aleksy36 2 months ago
@aleksy36 im still only new to PHP, but after following every step that Alex has shown us, it worked perfectly for me. Whilst watching the tutorial and reading your post, I thought that maybe the mysql_query that Alex had written was incorrect, but on second inspection its spot on...maybe go through it all again with a fine tooth comb and double check your code...there may be one tiny little character out of place...good luck :)
getupkid203 2 weeks ago
everytime I type in any information in register.php it says that passwords do not match. where did I make a mistake? I can send you a PHP code if you need it.
aleksy36 2 months ago
can you give the template?
vinz111490 2 months ago
I keep getting the "Incorrect password" page which we created. Its an 'else' in the 'login.php' page. Any help?
RedofYellow 2 months ago
Why is is when I press enter after filling out the form is offers me to download my register.php page.
RedofYellow 2 months ago
Hello everyone if anyone got notice errors in their text fields while doing this form validation procedure of when alex does value=the php code i figured out how to make it work in the browsers.The code is just like what alex has but i cant post it here if you want the code please send me a email on youtube requesting it.thanks..
025JoshTMMM82 2 months ago
aaaah i dont understand the html form value php script thing that alex phpacadamy did in this tutorial can someone plz send me the script or help me with the code please or send me mail in my inbox. i keep getting erros in my textboxes in my form what am i doing wrong.
thanks
025JoshTMMM82 2 months ago
@025JoshTMMM82 use error_reporting(0); after the first <?php tag.. IT works for me..
MrSLKasun 1 month ago in playlist More videos from phpacademy
@025JoshTMMM82 Putting the codes inside the value of the html means, that when a person for example fills all forms like username, fullname and password,and ...say if he entered the incorrect password.. when the page refreshs to inform him about the incorrect password entered the browser will store and keep the username, and full name to save you time from writing it again. For that effect, you must right the variable of the username inside the value of the html.i am so newbee knew that recently
LEilllLEi 1 month ago
Hello everyone,
I have had a bit of trouble with the coding on this part, with no fault to Alex (thank you very much by the way), but with the syntax of all the lines put together.
With so many if statements, you really have to make sure you understand what is being done if requirements are met and when they are not
I would also suggest downloading that text program he is using. ConTEXT is actually a great tool to diagnose any problems because it colors everything in an easy to understand way.
bcmatt316 2 months ago
Hello Alex,
I need help Its when he putted the echos in the html fields but has anyone gotten this error message into their textbox or box yet of html code saying Notice Undefined Variable: fullname or username or something like this Notice: Undefined variable: firstname in C:\xampp\htdocs\register.php on line 77 has anyone came across this yet please let me know by sending me email on youtube. thanks. it has like bold and breaks in html code
025JoshTMMM82 2 months ago
Seriously can you just post the code? I've wasted 5 hours of my life on this I think
smokenfly514 2 months ago 5
Here is a big hint for all you having trouble with the error message "Undefined index:"
if(isset($username)){echo $username;}
the function isset(); takes a variable and returns a boolean value 1(if value is not null) 0(if value is null)
deathcry 2 months ago
@smokenfly514 He wants you to LEARN the code, not just to copy/paste!
JDTuts 1 month ago
@JDTuts you can learn without having to follow a step-by-step tutorial.. programming is logical; you can learn syntax and how everything works by simply reading the code over many times and trying to copy it
smokenfly514 1 month ago
@smokenfly514 yeah if you think so you should just dump learning php .. the point is to see how it is done not to get the code - there are many done script on the web .. GTFO ! great tutorial !
elpazzobg 1 week ago
@elpazzobg If one is familiar with the basic important programming concepts, one may learn a language by being provided with the code, understanding what it does, and then going over the syntax and logic. It's retyping the code several types that is key. Your comment merely demonstrates your lack of intelligence. And for the record, I'm way past this and learning at a faster pace than you with my method. You're dismissed.. and don't bother replying because I won't read your response.
smokenfly514 1 week ago
@smokenfly514 you did not waste, you learned.
kirillosk 4 days ago
@kirillosk No. I learned elsewhere.
smokenfly514 4 days ago
noob alex!
answer in our questions or delete the video!
TheLoLGameplays7312 2 months ago 2
I don't ge the fucking data!
TheLoLGameplays7312 2 months ago in playlist Περισσότερα βίντεο από τον χρήστη phpacademy
I'm having a problem with my register.php
Here's the paste: pastebin (DOT) com/NUMygB9m
---it keeps saying---
Notice: Undefined index: submit in E:\xampp\htdocs\lesson\register.php on line 3
Nuerotronic 2 months ago
DATA WASN'T INPUT FIX:
if everything looked good but the data wasn't input into the database, for me it needed two fixes:
1. in your database, the varchar of password should have a length of 32 or greater
2. Something must be input into the mysql_query line (for me at least)... Changing the user id from '' to 0 (or any number) fixed it for me, that is... VALUES ('','$username','$password','$fullname','$date') ");
changed to VALUES (0,'$username','$password','$fullname','$date') ");
cdogg262 3 months ago
u are right :p but what I was trying to say is since we add the md5 encryption of our password in the database (of length 32 btw) and not our password(of length 25) our varchar needs to be 32 of length at least to make space for the md5. so if it says that uve been registered, but it DIDNT add to db, means that your codes good, only there is no space in your varchar for the md5 version, so change it to 32. If it says that password is too long, means u did md5 b4 checking length, so u checked md5
XxLethalxStrikesxX 3 months ago
Hey guys just a heads-up, I've noticed that if you follow this tutorial step-by-step, it allows for duplicate usernames. If you want your users to have unique usernames, you'll have to select "username" from the database and check the number of rows. If no values are returned, the registeree's username is valid. Then, you can proceed to adding them to the database.
TeehJ4yy 3 months ago
Hi Alex like others have said can you post your complete code so I don't have too many {{{{{{{{{{{{{or }}}}}}}}}}}}}} as well as human errors?
Daltonson 3 months ago
Incorrect integer value: '' for column 'id' at row 1
mundamaniac619 3 months ago
thanks man,
if you have 2 same registered user in the database then just remove md5($repeatpassword);
System32Design 3 months ago
I would recommend using regular expressions rather than strlen. You can save a lot of room this way. For example:
$check_name = preg_match('%^[a-zA-Z0-9\.\-]{6,15}$%', stripslashes($username));
do the same for password, then run a conditional to check if both of these values are true. This pretty much ruins any SQL Injection attempt.
Nerdicusable 3 months ago
I can't Insert my infos in the database.
EdgeCounter 4 months ago
These videos are awesome. One problem on this one is that I am getting everything to the database, except the date, which shows all 0's. Did I miss something? Thanks!
bobrusch 4 months ago
Great tutorial Alex. We all appreciate your time
Did anybody ever get this completely working?
I am not.... Although, many of us are spening hours and days trying to get it working and in the process learning some PHP. I still think that we should see a complete working codes so we can see where we are going wrong.
I am stuk with the md5 and perhaps more to come.
Please post the codes
Thanks
azadrajak 4 months ago 2
I'm getting addicted to your tuts
TrojanSpike1 4 months ago in playlist Register & Login
Comment removed
ShaneNL69 4 months ago in playlist MYSQL PHP
Comment removed
ShaneNL69 4 months ago in playlist MYSQL PHP
I just can say thanks for the tutorials you made. They are very useful and many webdesigners now can script :D because of you. God Bless you sir. :) (bow)
wallflips 4 months ago
i keep getting an error
about a unexpected { on line 25
steekker 5 months ago in playlist Register & Login
Comment removed
steekker 5 months ago in playlist Register & Login
Comment removed
steekker 5 months ago in playlist Register & Login
the password longer than 25 problem is because hte password is encrypter before that check therefore the encryption is always more than 25
kokaza 5 months ago
very nice tutorial..thanks man..lol i already done in my project..^^
vahnvallain 5 months ago
Even after filling all the fields its saying please fill all fields.
any one facing same prob.
muzzy4friends 5 months ago
oops sorry about that, didnt mean to put it up twice, my bad
XxLethalxStrikesxX 5 months ago
I was brought to the page where it said i successfully registered, but the data wasnt in the database. I think it is because in the beginning, we put the varchar of the password to 25! but with the md5 encryption, our password variable ($password) is longer than 25.... so i changed to varchar length to 1000 and it works! Thumbs up so everyone can see :)
XxLethalxStrikesxX 5 months ago 21
@XxLethalxStrikesxX you shouldve set md5($password) after your password check
if (strlen($password)>16||strlen($password)<6) { echo "Password must be between 6 and 16 characters"; } else { //encrypt password $password = md5($password); $repeatpassword = md5($repeatpassword);
//register the user echo "Congrats"; }
Thumbs up so everyone can see the fixed version!
SilencedReviews 3 months ago
Comment removed
j7512 2 months ago
@XxLethalxStrikesxX it still don't work for me :(
aleksy36 2 months ago
@XxLethalxStrikesxX Md5 only needs a length of 32!
datavirtue 1 month ago
@XxLethalxStrikesxX Only needs to be 32. ALL MD5 hashes are 32 bits of data, more commonly known as 32 characters. If you have 1000 then you can run in to problems.
johncolesuk 4 weeks ago
I was brought to the page where it said i successfully registered, but the data wasnt in the database. I think it is because in the beginning, we put the varchar of the password to 25! but with the mdy encryption, our password variable ($password) is longer than 25.... so i changed to varchar length to 1000 and it works! Thumbs up so everyone can see :)
XxLethalxStrikesxX 5 months ago
still wont let you log in, simply because your password is hashed, but in other cases, onto the next one! :D
terraf1rma 5 months ago
im done doing Login and Registration Tutorial with my database and it was successful, thank you PHPACADEMY, your the best..i'm from Philippines :))
shinsexy06 6 months ago
is it possible to upload notepad file.
HBChalise 6 months ago
Hi, how do you view or retrieve the auto incremented id after the user have registered? like giving the user id to the registered user.
dyanie0408 6 months ago
Wow thanks man!! It Works perfectly fine with me eventho my registration form is more vary
MrPeasant777 6 months ago
i get a notice in my box were i writhe fullname and username
a notice that the variable fullname/username dont have a value
flaggis97 6 months ago
@flaggis97 me 2
GodxGaming 6 months ago
This has been flagged as spam show
Thanks alex, My personal thanks in a video for phpacademy!
watch?v=DTSooY8fqpw
SilverMagics 6 months ago
how to get rid of the errors? Undefined index?
sergyu123456 6 months ago
@sergyu123456
Put @ beside the $ sign
VigilianceAurelious 5 months ago
you guys need to give more info when asking for help
jimjimmy1995 7 months ago in playlist Register & Login
HELP I just get all the time " Please fill in all the fields", what can be the problem?
Sweeta50 7 months ago
i always get please fill in all fields but i do and nothing else shows up. please help
ish1123 7 months ago
I don't get why it works when he does it. 100% sure you need to use an isset first!
ZTOID 7 months ago
So far, best php login and register tutorial i ever seen before
ferdinandelfacho 7 months ago
hmm date dosnt work for me, it comes up as 0000-00-00 in my database...
daeheadshot 8 months ago
@daeheadshot maybe you tried some other date format instead of $date = date("Y-m-d"); (which i also tried at first, since I use d-m-y in my daily life) or didn't put '$date' in the sql_query
HowlingRedXIII 6 months ago
WTF. Where did you explain the code? I mean the code from the top. I dont saw it anywere.
fanreymysterio619 8 months ago
By the way wtf with all people requesting for the code. Write your own code and learn!
glsmaster 8 months ago
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.
glsmaster 8 months ago
Is it best to have your mysql_connect happen off the page in a folder outside of htmldocs or web?
Vortex42 8 months ago
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!
Vortex42 8 months ago
please post the code .__.
cire72093 8 months ago
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 8 months ago
Help I Just keep Getting Password must be between 6 and 25 characters long! When It Is
MrKoolTutorials 8 months ago 9
@MrKoolTutorials Watch the end of the tutorial he shows how to get around that
mrwilson41 8 months ago
@mrwilson41 i fixed it ages ago any way soz
MrKoolTutorials 8 months ago
@MrKoolTutorials its because he ecrypted the passwords to md5 BEFORE he checked the length of the passwords(converting it to md5 creates a 32 char long string)
just put the md5() inside the else body of the password length test
daeheadshot 8 months ago
@MrKoolTutorials put md5 in the else of the password lenght test!
ikzegmenaamniet 7 months ago
@MrKoolTutorials that's because he applies md5 before checking for the length of password! Just check the length first and then apply md5. It should work :)
trishadeepak 7 months ago
@MrKoolTutorials Have you removed the md5 function on the top of the code?
abalbertab 7 months ago
Ayzhong 6 months ago
@MrKoolTutorials check your heirarchy of your if statements and go through them one at a time. be sure that they are all one after another until you are ready to register the user when everything is correct (in the middle of the if statements, before the user error messages that you put using else statements when the if statements are incorrect.) if you need more help i can pm you with what i have that works.
TwizzyTheWizzy 6 months ago
@MrKoolTutorials The reason your are getting this error is because Alex encrypted the password before checking for length. The length of md5 encrypted passwords is always 32 characters and that's why you get the error. To fix this just encrypt the passwords after you check for length.
Rhumage 6 months ago
Comment removed
nikkoamiu 6 months ago
@MrKoolTutorials
You're getting the error because you are getting the length of the md5 encrypted version of the password, wich is 32 characters long. He only showed almost all of the ways to get an error message, but not how to get the succes message. You simply need to check the length of the non-md5 encrypted password :3
Exfridos 5 months ago
@MrKoolTutorials md5 NEEDS to be after password length check
madmatthew1 5 months ago
@MrKoolTutorials If you've enrypted the password before it checks if it is between 6 and 25, than it's gonna say it's too long. Move that encryption md5 code above the code for storing datas in the database.
SlobodanV1984 5 months ago
@SlobodanV1984 FUCKING HELL I FIXED IT AGES AGOAND I KNOW STOP SAYING IT!
MrKoolTutorials 5 months ago
@MrKoolTutorials fuck you
SlobodanV1984 5 months ago
Comment removed
orangewarp 4 months ago
@MrKoolTutorials it's because he set the md5 to the password before controlling the length and your password is no longer 6char but something like 5h39038n23hrh. So you can set the md5 just at the final else statement or you can assign a new variable for the password variable.
soldierday 4 months ago
@MrKoolTutorials Take the $password = md5($password); and $repeatpassword = md5($repeatpassword); strings and put them after echo "Success!!";
Otherwise the passwords are automatically converted to md5 (and they are long) before they are even put in the data base. If you move it at the end, it will only convert them into md5 if all criteria have been met for a successful login.
Sorry if it doesn't make sense. I'm a total beginner. But it worked for me.
DarkRide 3 months ago
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.
xygrax 9 months ago
Could anybody post the full working code?
gymdani999 9 months ago
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!
IlPadrinoRulla 9 months ago
@IlPadrinoRulla THANK YOU SOOOO MUCH!!!!
shirleymz1228 5 months ago
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...
rinsa89 9 months ago
This has been flagged as spam show
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 9 months ago
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 9 months ago
@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 9 months ago
@buddhagoulash to fix this problem I had to encrypt the password after the strlen() check, in case others are having the same issue.
buddhagoulash 9 months ago
@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.';
}
Zuberguber105 8 months ago
@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
korvlord 8 months ago
Comment removed
buddhagoulash 9 months ago
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?
michaelangelorayco 9 months ago
Notice: Undefined index: fullname in C:\xampp\htdocs\xampp\aw\log in\login\register.php on line 7
Notice: Undefined index: username in C:\xampp\htdocs\xampp\aw\log in\login\register.php on line 8
Notice: Undefined index: password in C:\xampp\htdocs\xampp\aw\log in\login\register.php on line 9
Notice: Undefined index: repeatpassword in C:\xampp\htdocs\xampp\aw\log in\login\register.php on line 10
this is the error but the program works properly how do i remove that error
killerboduk999 9 months ago
@killerboduk999 Hello, You need to use " if (isset('submit')) { /*all your coding defining variables*/ } hope this helps!!! :)
k3episode 9 months ago
when i first click on the Register? link, some how the localhost/register.php shows this error:
Notice: Undefined index: submit in C:\xampp\htdocs\loginsession\register.php on line 5
same goes to index: fullname, username,password, repeatpassword.
can someone tell me how to fix this error?
sitishorty 9 months ago
Very clear and helpfull. Thanks
rvcsystems 9 months ago
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.
hmhross 10 months ago
error on line 48 and 54
using dreamwaver help please
line 48=else
line54=else
XxDJcommanderxX 10 months ago
AWHHHHHHHHHHH, ffs, now none of the god damn check's work..
TheBlakeWilliamson 10 months ago
Comment removed
RS777able 10 months ago
@PartyDoffy
make sure you are not missing any ; or any ()
RS777able 10 months ago
keep getting this error Parse error: syntax error, unexpected T_STRING on line 49
(not always line 49)
and i checked line 49(and other lines) and there is no error there..
only way i can fix this is to write the whole script thing again
already done it 4 times im getting sick of this
please help
PartyDoffy 10 months ago
Im using phpMyAdmin 3.3.9.2 and mysql 5.0.92
when i got
Incorrect integer value: '' for column 'id' at row 1
error from
INSERT INTO users VALUES ('','$fullanme','$username','$pw','$date')
so i tried
INSERT INTO users VALUES (null,'$fullanme','$username','$pw','$date'))
then it works
updownvid 10 months ago
Comment removed
updownvid 10 months ago
My code keeps giving me that my passwords don't match... even if i put in the same passwords. If i don't put a user name it will give me that same error too. please help
RS777able 10 months ago
@RS777able
check if you forgot to put $ on your password variable
updownvid 10 months ago
Please explain the full code in register.php because you started the video when testing the code.
MrUpload1000 10 months ago
@MrUpload1000
subscribe the channel and watch the playlist. you will find what you are looking for
updownvid 10 months ago
This is a life- saving tutorial. Thanks $Alex Garrett, &&$Murkata, &&$codyjd2010.
And every that contribute to this tutorial. You are all the best.
I am yet to figure out why somebody will dislike this tutorial. Probably they are reading from behind..
kosilaja2001 10 months ago
please speak slower and clearer - there are many people with foreign languages.... thanks. your tutorials are good....
vidividividi100 10 months ago
I saw all the Tutorials, but i don't understand nothing :(((
tiby4steaua 11 months ago
Works fine for me. Thanks for the tutorial.
EpicOkapi 11 months ago
Wont send everything to the database.. I dont get any errors ether...
McClover 11 months ago
This has been flagged as spam show
Why we need a, latin bitch busizz4me.info
DonsanUsake569 11 months ago
I keep getting Notice: Undefined index: password in C:\xampp\htdocs\Reg\register.php on line 7 whenever i get out of the page and hit register again in the index.php page
YDProductionz 11 months ago
can u post here the full codes for register.php.. coz it is not recognize in the video.. in short.. the "VIDEO" didnt start at the top.. he started immediately in testing the register.php.. thanks..
back022 11 months ago
can u post here the full codes for register.php.. coz it is not recognize in the video.. in short.. the "VIDEO" didnt start at the top.. he started immediately in testing the register.php.. thanks..
back022 11 months ago
ok well when i entered all my info into the form it didn't display the registration success or the link to the login page, it comes up with a blank page with the word Register on top. and it will not insert any data into my database!
freebiejeebiescrazy1 11 months ago
every time i put in all my info and with a password with more than 6 characters, it says "password must be between 6 and 25 characters!".
freebiejeebiescrazy1 11 months ago
sir in this lesson.do you have a field name confirm password in your database?
yuijade03 11 months ago
If you can't make the data adding to the DB make sure the variables you insert are in the correct order as in phpMyAdmin!
wapprez 11 months ago
Ur php tutorials are the best !!!
StymeX 1 year ago
Also, one more thing I've noticed - due to the md5 hashing the hashed password is more than 25 characters. I've increased the lenght of the password in myphpadmin to 40 and then it was working fine. Hope this helps.
murkata86 1 year ago
@murkata86 I was about to post the same thing! Good call.
kevinquinnyo 1 year ago
Hi All,
I was having the same issue - no errors, but data wasn't added to the database. I've checked in Google and it seems that the data was not added becase MySQL was trying to put the data in rows, so I've adjusted the code telling MySQL to put the data in the columns. Here is how the new code:
$queryreg = mysql_query("
INSERT INTO users (name, username, password, date) VALUES ('$name','$username','$password','$date')");
murkata86 1 year ago 19
@murkata86 how to put that code
christine69reyes 11 months ago
still i cant connect on my data base i have a proble m on root
christine69reyes 11 months ago
@murkata86
I did this and it went into mysql but the password is just changed to d
why??
MultiGuitarmania 11 months ago
@murkata86
you're the best !!!!!!! i was trying to figure out what the hell was wrong until i saw your "beautiful" comment ..
kouvasilias123 10 months ago
@murkata86
Hi, thank you for help! it´s working.
I coldn´t insert data in mysql, you help was a sucess.
obn2000 9 months ago
@murkata86
thanks a lot man :D
ruthwijma 7 months ago
@murkata86 thanks
Grkgermn333 6 months ago
Comment removed
Fastjur 1 year ago
Is anyone else getting an error on:
if(strlen($password)>25||strlen($password<6)
{
echo "Password must be between 6 and 25 characters";
}
On the } symbol ROFL
MrPayDay123 1 year ago
@MrPayDay123 Rofl fail I forgot the ) by $password
MrPayDay123 1 year ago