thedigicraft / Atom.CMS

Atom.CMS
56 stars 52 forks source link

Part 28 ~ the Login Page.... #159

Closed shicala closed 8 years ago

shicala commented 8 years ago

I have followed the video writing it out the same in aptana as I see in the video, and I cannot get the login to ... log in, it just keeps going back to the login.php instead of moving over to the index.php in the admin folder....

my login.php = http://pastebin.com/ZSVgGfKJ my admin index.php = http://pastebin.com/tMrbzCig it's hosted here http://shicala.com/AtomCMS/admin/login.php and I set up the login test info as test@test.com password

please help me figure out where i screwed up :(

ps, you use dbc I use dbcon it is correct on that note

creptor commented 8 years ago

I have found no errors in your code, but maybe you can try to replace the if($_POST){ with if($_SERVER['REQUEST_METHOD']=="POST"){. Also check that the table is accessible from your page (if it works in other pages as well), and that the table name is correctly entered in the SQL query string ($q).

creptor commented 8 years ago

if you can't fix it, add the error_reporting(1); to the top of your login file.. so any errors would be output to the html, and easier to find.

shicala commented 8 years ago

@thedigicraft I have tried with the if($_SERVER['REQUEST_METHOD']=="POST"){ same result

I also put the error_reporting(1); line in (its still there actually on http://shicala.com/AtomCMS/admin/login.php it's not spitting out any errors tthat I can see

creptor commented 8 years ago

I'm sorry... it was error_reporting(-1);. Just checked the manual really quick. manual - error_reporting()

that also solves many questions for me .-.

shicala commented 8 years ago

ok I have no idea how or why, but it's started to work

using both formats ($_POST and $_SERVER['REQUEST_METHOD']etc)

not sure which is a better method, but since the $_POST seems to be working now I'll stick with it so I dont get mixed up while continuing to follow the tutorials

thankyou so very much for your time, I am finding this set of videos easy to follow and i've wanted to know how to do some of this for a while... so thankyou for making them and for your help :)

creptor commented 8 years ago

Nice! it's always a good thing to help :3


in case you're wondering, the $_SERVER[].... check that the file is fetch as POST (in this case, via form submit)... so this should work every time. If you use the $_POST you should declare it to be something in the if... like if(!empty($_POST)){... that way the $_POST never gets used if it's empty (null).

I didn't make the videos, just learn a lot from them and now I'm helping people with them.