Fatal error: Uncaught Error: Call to a member function bind_param() on boolean in /home/u631074255/public_html/zyro/6.php:23 Stack trace: #0 /home/u631074255/public_html/zyro/index.php(48): include() #1 /home/u631074255/public_html/index.php(3): include('/home/u63107425...') #2 {main} thrown in /home/u631074255/public_html/zyro/6.php on line 23
Hi as I am not familiar with PHP. So you can use this login.php code written by @ckhawand as a tutorial. Or you can wait for him to correct your this coding.
Please don’t recommend that code - see the tutorial page for a lengthy discussion of the several serious security problems within. Folks who use that will get hacked in short order, if their login is protecting anything even slightly valuable.
This problem can be searched for using a search engine - it appears every other week on Stack Overflow! The prepare() call failed and returned false - you need to trap that in your code, so it is better handled, and then find out what causes it in this instance. Maybe the table or the column you’ve specified does not exist?
Aside: I notice that you’re using parameter binding and password hashing. Both are excellent in security terms, well done.
Not a problem at all. I should say that my encouraging you to do some research is to help you get better at it - if I just provided answers, that only helps you now, not in the long term. It’s the old adage about “teaching a man to fish”.
Mhm… Well, the main issue was that I put my database instead of table. Only thing I have to do now is work out how to complete the authentication xD And make it actually go to another page if it’s right, and send an error message if it isn’t which that code SHOULD do. But it won’t, so I guess I need to do a LOT more research
That sends a message to the browser to redirect to the new location, though I would change it slightly:
header ("Location: logged-in.php");
exit();
I’ve changed:
the location it goes to should be your logged in page, not the login page
the ./ thing was wrong, that looked like a file reference - you want a URL here
once you’ve sent a Location header, you should stop the script (with an exit) otherwise PHP will carry on trying to execute the script, right up until the browser breaks the connection
Absolutely great, thanks for that matey… Small issue now though, is that the form redirects to the page it says in the action attribute, which is the same page as the login form and where all this code is in instead of where I put in the Location: bit. And it doesn’t seem to check for for anything either, it just passes it no matter what I put. This is honestly irritating me, i’m so confused at this point because everything i’ve done is correct as far as I can see
Could someone further help me on this post, or maybe even PM me?