why at 5:23 i get this error Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in D:\XAMPP\htdocs\website\login.php on line 13
One thing though, if you are going to be using mysql_fetch_assoc then you need to free the memory using mysql_free_result afterwards. At least, it's good practice to do so.
This is the full working code for this tutorial. Part I
<?php
$username = $_POST['username'];
$password =$_POST['password'];
if ($username&&$password)
{ $connect = mysql_connect("localhost","root","") or die ("cannot connect to the database"); mysql_select_db("phpalex") or die("Couldn't find db"); $query = mysql_query("SELECT * FROM user1 WHERE username='$username'"); $numrows = mysql_num_rows($query); if ($numrows!=0) {
@FlamingTorch9 Maybe I am misunderstandig your question but the whole point is that you have a username inside a database that no one except for the owner of the database can view. What you are doing is, you are comparing what a user entered as a username on a form against what is in the database, if they are equal AND the password is correct as well than the user is granted access.
Please help me, it doesn't show up *that username doesn't exist* if I enter an username that doesn't exist, it's showing nothing instead. Help? Please!!
@MrWebmf As for the user being able to register more than once on the same name, you should add a uniqueness constraint on the username field inside your table. Just head over to phpmyadmin, go to the proper table and execute this piece of SQL code (under the SQL tab you can enter code):
help Parse error: syntax error, unexpected T_VARIABLE in /home/********/public_html/login.php line 11. can't figure out how to fix it. $query = mysql_query("SELECT * FROM users WHERE username='$username'");
Parse error: syntax error, unexpected '}', expecting ',' or ';' in /home/gabriel1/public_html/php-page/login.php on line 28 it mean in line after if($username==$dbusername||$password==$dbpassword) { echo "You'r in!" } how fix it?????
@rainbowcrak no need to do that because, the || means or we want && we must make sure that both match, you cant have it saying username or just the pass matches its cool, must be both, make sure you don't have an ; in the while, i had that then got rid of it and that fixed it for me mate.
I want the Numrows for the register script to check "user always exist"
But i make that so:
if ($register_submit)
{ include './../include/mysql_connect.php'; $register_query = mysql_query("SELECT * FROM bsp WHERE name='$register_name'") or die ("ERROR"); $register_numrows = mysql_num_rows($register_query); echo $register_query;
I recommend Googling your errors to find out what your errors mean. Mine turned out to be a query error. Turns out the rows I had named within phpmyadmin were not the same as those I'd specified in my login.php document. Works a charm now, thank you!
I've kind of realised that it's comparing my username to that in the database but not my password. I use the code provided by xBrandonMatthew93, even changing the && to AND. Still no luck. but if I take out the $password == $dbpassword it works fine.
Compares the usernames but not password. Any Help????
I'm getting the incorrect password part upon entering the correct password for my user. I've tried on both through xampp and my actual site. Neither has worked. I'm running a mac os x operating system on a macbook pro. Any ideas?
my god... just maximise your screen it would make it SOOOOOOOO much easier to make sure ive set everything up right im getting errors because you just go { } { } {} { } { }{{ {}{ } so its hard to see if ive done too many or not
@phpacademy hey i always get this warning when trying to add the numrows variable (Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\phptests\login.php on line 13) i cant figure it out
@PellyTravispell $query = SELECT * FROM users WHERE username='$username evaluates to TRUE which is a boolean. Therefore $query is now 1 or TRUE This is because you entered the username correctly and since there is only one row in your database, a.k.a. one user. What MIGTH fix this is adding another row to your database, but I am not sure, I can see though that
@xBrandonMatthew93 Read the comments... I got that problem but resolved it by updating PHP version.Or simply upload it to your online host which is what i did so you don't have to update your computers PHP version.
@xBrandonMatthew93 Hmm, check your code and if it still doesn't work upload your files to phpmyadmin on your host instead of using xamp. I did that and it went away.
@flappajak are you making the password a md5 hash? if yes, go to db and check if the password field is limited to 32 characters, and you prob want to use varchar
@flappajak lol, been there to, i coded something when i found out that my server was up to date, where a function was removed, it was some proxy stuff i was making tho
Why do you need a WHILE loop here in the first place? You should only get ONE valid match of password and username from the query anyway. I removed WHILE from my code and it still works fine. Or am I missing something?
if ($username==$dbusername&&$password==$dbpassword) { echo "Successfully logged-in!"; } else echo "Incorrect username or password"; //whats wrong with my code...im not sure what im doing wrong? pls help!!! Thanks
while ($row = mysql_fetch_assoc($query)); { $dbusername = $row['username']; $dbpassword = $row['password']; } //check to see if they match if ($username==$dbusername&&$password==$dbpassword) { echo "you're in!" } else echo "incorrect password!";
@Rous6026nz no cemi-colon needed after your in because semi-colons are line breaks for a new line of code to be separated from the next and since there is no more lines of code inside that function a line break(semi-colon) is not needed.
Hey guys, For some reason the "Wrong password" won't come up when i do wrong password, I'm willing to pay someone 1 dollar to help me fix it, I copied his whole code right but it won't say wrong password.
Whats wrong with my code? I have the same code as in the video. But my DreamViewer shows theres an error on line 28. In web it shows ''Parse error: syntax error, unexpected '}', expecting ',' or ';' in /home/mehisunri/domains/mehis.unri.lv/public_html/regtest/login.php on line 28''
So, can anyone share with the rest how we can get over the "Incorrect password!" part? I can't seem to find a solution anywhere. Removing the while statement does not fix it, as some have pointed. Plus, I've been getting Undefined index: $username as well as $password notices, which if fixed may or may not lead to fixing the "Incorrect password!" part aswell. Anyone? :|
I found my error. Instead of $dbusername = $row['username']; , I had $dbusername = $row['$username']; . Same thing with the password. How silly of me :P Still, I'd like to know of a proper fix for the notices instead of just turing them off when the page is 100% ready.
Can you please put it on 4shared or somethin like that. So we can just copy the text. Cuz I understand everything you say, but there is somethin wrong in my code, cuz when Im at the mysql_fetch_assoc part, and follow what you do, I probably made a mistake, but I checked like 100 times what I did wrong. When I test my script it says it has an syntax error. Please help me, cuz your lessons/tutz are great! But Im hopeless now. Sorry for bad English, Im Dutch.
@grkgerman100 If you run ubuntu open terminal and basically use this to get your answer if running (You)su Password: (if it worked it should say root) /opt/lampp/lampp start so owner@owner-Inspiron-537:~$ su Password: root@owner-Inspiron-537:/home/owner# /opt/lampp/lampp start Starting XAMPP for Linux 1.7.4... XAMPP: XAMPP-Apache is already running. XAMPP: XAMPP-MySQL is already running. XAMPP: XAMPP-ProFTPD is already running. XAMPP for Linux started.
Why do you need to check if the username in the DB is that same as the one you've put in? With the query you've written, any row you get is guarranted to have the same username as the one you've put in.
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in C:\xampp\htdocs\xampp\login.php on line 11
on my code when i go to try the numrows it says the echo "Please Enter and username and a password" i doesnt show me a 1 it shows me the echo... any help will be apprechated....
Hello to all.Very nice tutorials man.I have some problem with my log in page in my site and if you want to help me i will appreciate that.I woke in the morning and tried to log in but always says invalid password without changing.I have two log in users i delete one account from the database and recreate it,but when i try to log in always appears a message and says "You must have the proper credentials to access this page. Please login."What i did wrong?what should i do??please help :-(
@HIPHOP0NL I had this same problem after extensive research and headache I found out that, you must set a password for your phpMyAdmin. Once you have done that in every line of in the mysql_connect function you need to put your password into the parameters, in the 3rd set of quotation marks. Example: $connect = mysql_connect("localhost","root","ENTER YOUR PASSWORD HERE");
It says my password is incorrect no matter what. I have scanned over that code over ten times in depth..I can't figure out the problem..any suggestions?
Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 113 in /home/a5977309/public_html/login/login.php on line 9
I've run into a problem. My problem is with the mysql_num_rows(), when i do that just as in this tutorial, I get an error: "Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\bla\bla\Login.php on line 12" Anyone knows how to fix this?
why at 5:23 i get this error Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in D:\XAMPP\htdocs\website\login.php on line 13
That user doesn't exist!
doreto95 1 day ago in playlist Register & Login
i was getting wrong password error, so i started over, and for some reason it work.............started over back from tutorial part 1 and it works,
ShadowRazoe 4 days ago in playlist Register & Login
The 1 is not appearing on my screen nothing happened like before
xexoristo 4 days ago
hey can you tell me how to transfer data from one page to multiple pages?
ID from page1 to page2 to page3 and goes on........
MsSwami1234 4 days ago
rihanna's ass keeps distracting me!!
fruitman89 1 week ago
@fruitman89 hahahaha i agree
xexoristo 4 days ago
This has been flagged as spam show
I need someone who is capable of hacking* websites & accessing their email database
I don't need scraping,web crawling or extractors,I need this sites HACKED
I will need to test the result u give me,if it checks out I shall send u 3000$ ASAP and 10-20 websites monthly,which will
increase upon delivery of faster & quality service
Pls note,CONTINUITY is what I am after...
PLEASE SEND ME A MAIL ASAP IF U CAN DO THIS ; omorye007 (at) yahoo (dot) com
hacknixx 1 week ago
love these tutorials thank you!
MacintoshBourne 1 week ago
hey why did u use a while loop??? Shouldnt the sql query return only 1 result
kerokero9090 1 week ago
Hi, I made exacly what you did in the number 1, but it steel says:
Not Found
The requested URL /Web/login.php was not found on this server.
What shoud I do?... I enter user name and everything and it's the same... please help
guini0212 1 week ago
any tutorial for improving internet speed???
neeluom 2 weeks ago
One thing though, if you are going to be using mysql_fetch_assoc then you need to free the memory using mysql_free_result afterwards. At least, it's good practice to do so.
thebrazilianhustler 2 weeks ago
This is the full working code for this tutorial. Part I
<?php
$username = $_POST['username'];
$password =$_POST['password'];
if ($username&&$password)
{ $connect = mysql_connect("localhost","root","") or die ("cannot connect to the database"); mysql_select_db("phpalex") or die("Couldn't find db"); $query = mysql_query("SELECT * FROM user1 WHERE username='$username'"); $numrows = mysql_num_rows($query); if ($numrows!=0) {
Exrienz 2 weeks ago 4
Can anyone paste the full working code here?????
Exrienz 2 weeks ago
Comment removed
albert3366 2 weeks ago
How come you're checking the username held in the database? This seems wasteful as we already know it
FlamingTorch9 2 weeks ago
@FlamingTorch9 what if someone has not signed up? and they put a username in that doesn't exist in the db?
getupkid203 2 weeks ago in playlist More videos from phpacademy
@getupkid203 I guess so
FlamingTorch9 2 weeks ago
@FlamingTorch9 Maybe I am misunderstandig your question but the whole point is that you have a username inside a database that no one except for the owner of the database can view. What you are doing is, you are comparing what a user entered as a username on a form against what is in the database, if they are equal AND the password is correct as well than the user is granted access.
Fangornmmc 2 weeks ago
Please help me, it doesn't show up *that username doesn't exist* if I enter an username that doesn't exist, it's showing nothing instead. Help? Please!!
smoketest123 3 weeks ago in playlist Register & Login
mysql_num_rows() expects parameter 1 to be resource.
what does this mean?
paulceltics 3 weeks ago
@PellyTravispell I just had the errormessage too and found out that I made a mistake. Check if you have username = '$username'. That fixed mine.
yoeriboven 3 weeks ago in playlist Register & Login
Hi Alex,
I've created a login and a register form but I've two errors:
1. A user can login even though is not registered;
2. A user can register whit the same data more then once;
I save the data to a text file. I'm new to php and I would like you to help me out with my problems.
Hope you can help.
Thanks Mrwebmf.
MrWebmf 3 weeks ago in playlist Register & Login
@MrWebmf As for the user being able to register more than once on the same name, you should add a uniqueness constraint on the username field inside your table. Just head over to phpmyadmin, go to the proper table and execute this piece of SQL code (under the SQL tab you can enter code):
alter table nameoftable
add unique(usernamefieldhere);
I recommend you empty your table first though...
Fangornmmc 2 weeks ago
Comment removed
PktMma 3 weeks ago
Warning: mysql_num_rows() expects parameter 1 to be resource, string given in C:\xampp\htdocs\check_login.php on line 17
I don't understand where i have gone wrong :(
Spongehead1000 4 weeks ago
This helped me get my head around my uni work, of course I can't copy this but it helped a lot. Thanks dude
BiosNova 1 month ago in playlist Favorite videos
Hello, Thanks for very good tutorials.
I was wondering where did you get $dbusername and $dbpassword in the code bellow
====================================
while ($row =mysql_fatch_assoc($query))
{
$dbusername = $row('username');
$dbpassword = $row('password');
}
Are they a new varialbles you just created or you alraedy had in the page somewhere.
Thanks
RezanKara 1 month ago
@RezanKara They are a new variables
iGrendizer 1 month ago
@RezanKara Im pretty sure they are new.
jamesk14022 3 weeks ago
slight lag in sound and vid :D
anyway. Great tutorials.
qaipak1 1 month ago
What does this mean?:
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\member\login.php on line 13
channelninjacom 1 month ago
I can't login using my password, unless i entered the decrypted password with the ID.
LEilllLEi 1 month ago
Encryption? Security of database login? Do you have a video to revise this code using best practices?
datavirtue 1 month ago
hey when i do the query for numrows i dont get a number even when i have echo $numrows; could u plz help
jgile2 1 month ago
@jgile2 Check to see if your variable was $numrows or $numrow, keep it consistent throughout your code.
at least...that was my problem...
nigete 1 month ago in playlist PHP Login
I keep getting the error "Undefined variable: numrows in C:\xampp\htdocs\loginsession\login.php "
SodaWizard 1 month ago
@SodaWizard figured it out =)
SodaWizard 1 month ago
help Parse error: syntax error, unexpected T_VARIABLE in /home/********/public_html/login.php line 11. can't figure out how to fix it. $query = mysql_query("SELECT * FROM users WHERE username='$username'");
lol9392 1 month ago
Parse error: syntax error, unexpected '}', expecting ',' or ';' in /home/gabriel1/public_html/php-page/login.php on line 28 it mean in line after if($username==$dbusername||$password==$dbpassword) { echo "You'r in!" } how fix it?????
webhechoenlachona 1 month ago
What is a query ?
rainbowcrak 2 months ago
IF YOU KEEP GETTING INCORRECT PASSWORD DO THIS -
change: if($username==$dbusername&&$password==$dbpassword)
to: if($username==$dbusername||$password==$dbpassword)
It should work, give this a like! :)
rainbowcrak 2 months ago
@rainbowcrak Tyvm sir.
leodakl 1 month ago
@rainbowcrak no need to do that because, the || means or we want && we must make sure that both match, you cant have it saying username or just the pass matches its cool, must be both, make sure you don't have an ; in the while, i had that then got rid of it and that fixed it for me mate.
ItalianNatural 1 month ago
Comment removed
rainbowcrak 2 months ago
Comment removed
rainbowcrak 2 months ago
This has been flagged as spam show
Upgrade intelligent your blog/site , h t t p : / / w w w . ephptech . 22web . net This site have 5000+ phpscript , and 20 clone script
RoberrTh0 2 months ago
I want the Numrows for the register script to check "user always exist"
But i make that so:
if ($register_submit)
{ include './../include/mysql_connect.php'; $register_query = mysql_query("SELECT * FROM bsp WHERE name='$register_name'") or die ("ERROR"); $register_numrows = mysql_num_rows($register_query); echo $register_query;
if ($register_numrows!=0)
{
}
I become allways the or die error.. :/
WHY?
Thank you!
Flintede 2 months ago
awesome tutorials! thanks!
RedofYellow 2 months ago
what's the point of while loop, according to php site about fetch assoc: If you're expecting just one row, no need to use a loop
maljarlol 2 months ago
This has been flagged as spam show
santstudios(dot)com
html-world(dot)net
order now
santstudios 2 months ago
on the first step where i should get number 1 i get resource ID 41
athenesubscriber 2 months ago
Comment removed
j7512 2 months ago
@j7512 me too
LegoCreatorsTV 2 months ago
This has been flagged as spam show
My error about the Incorrect Password was
I had: "$dbusername == $row ['username'];"
It should be $dbusername = $row ['username'];
so "==" versus "="
well...
rogennew 2 months ago
My error about the Incorrect Password was
I had: "$dbusername == $row ['username'];"
It should be $dbusername = $row ['username'];
so "==" versus "="
well...
rogennew 2 months ago
I hate youtube ads!!!! im trying to learn :(
onebighoe 2 months ago in playlist More videos from phpacademy 11
@onebighoe Learn to bypass, fucking.
bitchslapper12 1 week ago
@onebighoe Just install adblock plus.
DiglettX 1 week ago
TM8Eyla 2 months ago
wen i have the query of xBrandonMatthew93 i get the message: Resource id #4
when i used echo "$query"
can someone pleaz help?
btw i get this also when i type a wrong username and password
TM8Eyla 2 months ago
@TM8Eyla this is script:
$query = mysql_query("SELECT password FROM users WHERE username='$username'&&password='$password'") or die('wrong password or username') ;
echo "$query" ;
TM8Eyla 2 months ago
Comment removed
TM8Eyla 2 months ago
Comment removed
TM8Eyla 2 months ago
Ok I fixed it.
I recommend Googling your errors to find out what your errors mean. Mine turned out to be a query error. Turns out the rows I had named within phpmyadmin were not the same as those I'd specified in my login.php document. Works a charm now, thank you!
zrowlandjones 2 months ago
I've kind of realised that it's comparing my username to that in the database but not my password. I use the code provided by xBrandonMatthew93, even changing the && to AND. Still no luck. but if I take out the $password == $dbpassword it works fine.
Compares the usernames but not password. Any Help????
zrowlandjones 2 months ago
I'm getting the incorrect password part upon entering the correct password for my user. I've tried on both through xampp and my actual site. Neither has worked. I'm running a mac os x operating system on a macbook pro. Any ideas?
zrowlandjones 2 months ago
thanks very useful!
dobromirtt 2 months ago
Excellent tutorial. Thanks :)
Tsusuu1 3 months ago
blakeyou91 3 months ago in playlist Liked
What is the sign that yo used in the minute 0:55 in the part of query?
AventuredofSantiago 3 months ago
awesome tutorial you actually your are the first one who taught me how to write mysql statements because no one else had good enough tutorials
swello100 3 months ago
you are the best maaaaan for ever :)
nas7em 3 months ago
givemeurmoney or die;
yougotaletter;
post;
hehehehism 3 months ago
@phpacademy hey i always get this warning when trying to add the numrows variable (Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\phptests\login.php on line 13) i cant figure it out
PellyTravispell 3 months ago 2
@PellyTravispell have you worked it out?
HUNTERZzProductions 3 months ago
@PellyTravispell change the numrows line to
$num_rows = $result->num_rows;
and itl work
blakeyou91 3 months ago in playlist Liked
@PellyTravispell $query = SELECT * FROM users WHERE username='$username evaluates to TRUE which is a boolean. Therefore $query is now 1 or TRUE This is because you entered the username correctly and since there is only one row in your database, a.k.a. one user. What MIGTH fix this is adding another row to your database, but I am not sure, I can see though that
Fangornmmc 2 weeks ago
@Fangornmmc Scrap that I see you already fixed it, well at least I got the source of the error right....
Fangornmmc 2 weeks ago
@PellyTravispell
theanmol1704 2 weeks ago
@the best
theanmol1704 2 weeks ago
IT KEEPS SAYING "INCORRECT PASSWORD" When the password is correct
ALEX!!!!! HELP
xBrandonMatthew93 4 months ago
@xBrandonMatthew93 Read the comments... I got that problem but resolved it by updating PHP version.Or simply upload it to your online host which is what i did so you don't have to update your computers PHP version.
flappajak 4 months ago
@flappajak i updated the phpmyadmin and still not working
xBrandonMatthew93 4 months ago
@flappajak i updated phpmyadmin and still not working
xBrandonMatthew93 4 months ago
@xBrandonMatthew93 Hmm, check your code and if it still doesn't work upload your files to phpmyadmin on your host instead of using xamp. I did that and it went away.
flappajak 4 months ago
Comment removed
rainbowcrak 2 months ago
It always says incorrect password.
I coded everything the same but it says the no password error so im guessing it isn't connection to db properly?
flappajak 4 months ago
@flappajak are you making the password a md5 hash? if yes, go to db and check if the password field is limited to 32 characters, and you prob want to use varchar
Swippz 4 months ago
@Swippz i don't have md5 just what alex wrote.
My tables are varchars and are limited to 25 characters.
I am using xamp.
flappajak 4 months ago
@Swippz Nevermind, it was because my php version wasn't up to date :O
flappajak 4 months ago
@flappajak lol, been there to, i coded something when i found out that my server was up to date, where a function was removed, it was some proxy stuff i was making tho
Swippz 4 months ago
@Swippz This is what i made in 2 days of PHP work socialize.comoj(dot)com
flappajak 4 months ago
@flappajak and? its not about who creates the most, its about learning while you write it.
Swippz 4 months ago
I did that and nothing shows up if the password is wrong or if the username and password are right.
Thetruthmaker 4 months ago
instead of doing ................
$query = mysql_query("SELECT * FROM users WHERE username='$username
Just Do..........
$query = mysql_query("SELECT * FROM users WHERE username='$username&&password='$password'");
Now it will cover both username and password
xBrandonMatthew93 4 months ago 12
@xBrandonMatthew93 Scratch That nevermind
xBrandonMatthew93 4 months ago
@xBrandonMatthew93 Yeah, wouldn't that be easier? I wonder why he doesn't do it that way.
PktMma 3 weeks ago
its not working when i click submit button it only show/display the query or source code for login.php help me pls.
jhenickoraine12 4 months ago
@jhenickoraine12 you need to install php and/or move your php files into the web server folders
Macuspantricidad 4 months ago
This has been flagged as spam show
@jhenickoraine12 you need to install php and/or move your php files into the web server folders
Macuspantricidad 4 months ago
Why do you need a WHILE loop here in the first place? You should only get ONE valid match of password and username from the query anyway. I removed WHILE from my code and it still works fine. Or am I missing something?
allesindwillkommen 4 months ago
didn't understand the while loop !
BENNN121 4 months ago
Comment removed
TheHumanBanana 4 months ago
if ($numrows!=0)
{ while ($row = mysql_fetch_assoc($query)) { $dbusername = $row['username']; $dbpassword = $row['password']; }
if ($username==$dbusername&&$password==$dbpassword) { echo "Successfully logged-in!"; } else echo "Incorrect username or password"; //whats wrong with my code...im not sure what im doing wrong? pls help!!! Thanks
jerlui20 4 months ago
@jerlui20 If you tell me what error it gives you i'd be happy to help m8
draken4200 4 months ago
thank you very much.
i liked a lot your explanations.
i'm not english fluent but i can understand you very well
because your speak clearly.
heber288 4 months ago 10
@heber288 its because otherwise there are always 12 yr old todlers spitting in the mic with a lowvolume of "Let the bodies hit tha flo!"
aljodewi 3 months ago
This is not the best way of doing it but it gets you up and running
willissteve0 4 months ago
what us wrong with this code:
while ($row = mysql_fetch_assoc($query)); { $dbusername = $row['username']; $dbpassword = $row['password']; } //check to see if they match if ($username==$dbusername&&$password==$dbpassword) { echo "you're in!" } else echo "incorrect password!";
}
else die("That user doesnt exist");
}
else die("Please enter username and password!");
?>
this code doesnt show an error message
maxxieboy95 4 months ago
@maxxieboy95: remove Semi column end of while( );
while ($row = mysql_fetch_assoc($query));<<<<<<<<<
ranaharoonhacker 4 months ago
@maxxieboy95 You've got a semi-colon after your "while" loop and you need a semi-colon after your echo "your in!".
Rous6026nz 4 months ago
@Rous6026nz no cemi-colon needed after your in because semi-colons are line breaks for a new line of code to be separated from the next and since there is no more lines of code inside that function a line break(semi-colon) is not needed.
flappajak 4 months ago
Comment removed
19205611415 4 months ago
why my numrows == 0 ?? ;xx
f0xbAbY 4 months ago
II NEED U R PAGE
SHEFT07 5 months ago in playlist Register & Login
@csyicker my comment was wrong, I wrote stuff out wrong sorry <3
csyicker 5 months ago
When I login the password is right, and email/username, it says the password is wrong, when it's all right :\.
csyicker 5 months ago
Hey guys, For some reason the "Wrong password" won't come up when i do wrong password, I'm willing to pay someone 1 dollar to help me fix it, I copied his whole code right but it won't say wrong password.
bigcasey1995 5 months ago
after login in this message shows
Notice: Undefined index: username in C:\xampp\htdocs\sitea\login.php on line 11
Notice: Undefined index: password in C:\xampp\htdocs\sitea\login.php on line 12
Please Enter a username and a password
--------------------------------------------
pls help me fix this..thanks a lot
keepr0ck 5 months ago
Comment removed
rainbowcrak 2 months ago
nice tutorial, but make it slower for the beginners
keepr0ck 5 months ago
Comment removed
bigcasey1995 5 months ago
05:32 "And my password is aaaaabc" - INVALID PASSWORD :D
ToadsterRoaster6 5 months ago
WHEN I FINISHED THE CODE, I BLAMED ALL MY MISTAKES ON YOU.
I HAD ABOUT 20 TYPOS and an INCORRECT LOCALHOST PASSWORD.
EVERYONE PLEASE SPELL CHECK YOUR CODE WITH CONTEXT NOT NOTEPAD ++, OR SPELL CHECK WITH DREAMWEAVER.
IN ADDITION, IF YOU NEED THE FULL CODE, PM ME, i WILL HAPPILY GIVE IT TO YOU, PEACE.
PHP ACADEMY, THANKYOU FOR YOUR TIME.
terraf1rma 5 months ago
Whats wrong with my code? I have the same code as in the video. But my DreamViewer shows theres an error on line 28. In web it shows ''Parse error: syntax error, unexpected '}', expecting ',' or ';' in /home/mehisunri/domains/mehis.unri.lv/public_html/regtest/login.php on line 28''
klikerisXD 6 months ago
So, can anyone share with the rest how we can get over the "Incorrect password!" part? I can't seem to find a solution anywhere. Removing the while statement does not fix it, as some have pointed. Plus, I've been getting Undefined index: $username as well as $password notices, which if fixed may or may not lead to fixing the "Incorrect password!" part aswell. Anyone? :|
HowlingRedXIII 6 months ago
I found my error. Instead of $dbusername = $row['username']; , I had $dbusername = $row['$username']; . Same thing with the password. How silly of me :P Still, I'd like to know of a proper fix for the notices instead of just turing them off when the page is 100% ready.
HowlingRedXIII 6 months ago
hi , why that block with mysql_fetch_assoc must be in while loop? thx
Martinsvk11 6 months ago
Can you please put it on 4shared or somethin like that. So we can just copy the text. Cuz I understand everything you say, but there is somethin wrong in my code, cuz when Im at the mysql_fetch_assoc part, and follow what you do, I probably made a mistake, but I checked like 100 times what I did wrong. When I test my script it says it has an syntax error. Please help me, cuz your lessons/tutz are great! But Im hopeless now. Sorry for bad English, Im Dutch.
daanajax3 6 months ago
Uknown231231231 6 months ago
Notice: Undefined variable: dbpassowrd in C:\xampp\htdocs\asd\login.php on line 24
if ("$password"=="$dbpassowrd" && $username==$dbusername)
What is wrong with this? :|
xDstefan100 6 months ago
@xDstefan100 $password and $dbpassword shouldn´t be in qoutes
That´s all...
SLZTeam 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
Comment removed
Grkgermn333 6 months ago
You can add checks like this to improve security. you should also add this check in the registration page.
// If the username does not contains letters or numbers, gives a error.
if (!ctype_alnum($username)
{ die("Invalid username."); }
pesintro 7 months ago
Why do you need to check if the username in the DB is that same as the one you've put in? With the query you've written, any row you get is guarranted to have the same username as the one you've put in.
hTux128 7 months ago
I keep getting the "Couldn't find db" error when I run it. I can't figure out why. I feel like it's something simple.
154Rambo 7 months ago
@154Rambo If you are using xampp, is your MySql running? I get the error when it's not.
Grkgermn333 6 months ago
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in C:\xampp\htdocs\xampp\login.php on line 11
Couldn't connect to database
I get this error any idea how to fix this?
FlipjuhhPlox 7 months ago
@FlipjuhhPlox Your username / password to connect to your database is invalid.
novasism 7 months ago
@FlipjuhhPlox XAMPP default setting has a empty password, use $dbpass = ""
pesintro 7 months ago
I enter my true password but it says " Incorrect password ! "
Any help ?
gentlxman 7 months ago
dunno if you do this but you should use the trim function like this trim($_POST['username']) as just spaces are accepted otherwise.
jimjimmy1995 7 months ago in playlist Register & Login
How do I put everything on localhost? :)
ThingsExplainedLike 7 months ago
on my code when i go to try the numrows it says the echo "Please Enter and username and a password" i doesnt show me a 1 it shows me the echo... any help will be apprechated....
xBrandonMatthew93 7 months ago
$username = mysql_real_escape_string($_POST['username'])
use this people, against injections.
Also put an md5 on the $password
ZTOID 7 months ago
@ZTOID considering this will not be echoed it doesn't matter and only use md5 on the password if the one in the database is md5'd
jimjimmy1995 7 months ago in playlist Register & Login
This has been flagged as spam show
thanks for this tutorial
for more tutorial - 0gate.com
king1king2king3 7 months ago
Comment removed
king1king2king3 7 months ago
Whenever I click submit on my login thing it just downloads the php file
TechWeKnow 8 months ago
@TechWeKnow You dont have apache installed.
rhoffer21 8 months ago
@TechWeKnow
Open it with Firefox.
MsFilmTrailers 7 months ago
Thank you for the wonderful tutorials. But the tutorials a bit too fast for me to grasp
makoto114 8 months ago
I thank you on the behalf of 100 students that need to finish their web projects!
bialillyblue 8 months ago
Hello to all.Very nice tutorials man.I have some problem with my log in page in my site and if you want to help me i will appreciate that.I woke in the morning and tried to log in but always says invalid password without changing.I have two log in users i delete one account from the database and recreate it,but when i try to log in always appears a message and says "You must have the proper credentials to access this page. Please login."What i did wrong?what should i do??please help :-(
alostratos 8 months ago
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\login.php on line 16
that user doesn't exitts when i enter correct username and password.its say user doesnt exits.plz help me
bikenb1 8 months ago
@bikenb1 ive got the same problem
LeoCh20 7 months ago
@bikenb1 try checking all ur spell
LeoCh20 7 months ago
my loginphp keeps blank what did i do wrong
HIPHOP0NL 8 months ago
This has been flagged as spam show
@HIPHOP0NL I had this same problem after extensive research and headache I found out that, you must set a password for your phpMyAdmin. Once you have done that in every line of in the mysql_connect function you need to put your password into the parameters, in the 3rd set of quotation marks. Example: $connect = mysql_connect("localhost","root","ENTER YOUR PASSWORD HERE");
j7512 2 months ago
try in the if statement md5('$password') ) and not md5($password)
jedon0212 8 months ago
It says my password is incorrect no matter what. I have scanned over that code over ten times in depth..I can't figure out the problem..any suggestions?
supafudge 8 months ago
how do i insert input string like üñá into the database..this is converted into something else!! Plz Help me!!
pcsx22 8 months ago
Hy there !
Could you tel me what commands shall I use to encrypt my password in the login page, if I used md5 for the registration ?
Sorry for my english .__.
TheKristofer999 8 months ago
@TheKristofer999 you just put an .md5 and it auto ancrypt's it
62arts 8 months ago
@62arts And to where?? O.o
Before the fetch assoc line, or after it, or to the very beginning of the script ?
Sry I'm a newbie :D
TheKristofer999 8 months ago
Hi i need some help here
Notice: Undefined variable: numrows in C:\xampp\htdocs\login.php on line 17
That user dosent't exist!
i already check 100 time i can't see the error on this
please help!
jaxwins01 8 months ago
PHP Error Message
Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 113 in /home/a5977309/public_html/login/login.php on line 9
Free Web Hosting
Couldn't Connect!
MrKoolTutorials 8 months ago
i cant connect to myphpadmin
MrKoolTutorials 8 months ago
No matter what password I use it always says I'm logged in heh'.
TheJackShred 9 months ago
I get a Notice: Undefined index: password when doing the while loop
NxP100 9 months ago
when i do any code it says "Parse error: syntax error, unexpected $end in C:\xampp\htdocs\login.php on line 23" plz help
wheatthin0005 9 months ago
@wheatthin0005 Send me the lines 20-24 via message or answer here!
EinfachZocken 9 months ago
he typed down "Please enter and username and password" lol
mikaelafiery 9 months ago
I've run into a problem. My problem is with the mysql_num_rows(), when i do that just as in this tutorial, I get an error: "Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\bla\bla\Login.php on line 12" Anyone knows how to fix this?
AllenTsuna 9 months ago
why i always get user does not exist error. omg
michaelangelorayco 9 months ago
Great, thanks!
Mysql injection would work on this, wouldn't it?? I think there is a built in php function that prevents that?
Screenfreezer 9 months ago