Login System/Session Problem

0 Jonas Meise · June 15, 2015
Hey guys. 
For my website I wanted to create a login system with php for myself where I just have my own admin account. The ultimate goal of it will be that I can login as Admin and change the text in the content css bodies directly on the webpage as admin.

So for creating a secure system I followed a tutorial on youtube to create a secure login system. This is the tut:


So I followed his instructions and wrote this code:





It works fine like that so when I login into the system with a valid id and pw it redirects me to my index.php.
But in the video in the index.php he uses this code to get the session and check if the user is logged in or not:


so theoretically on top of my index.php page it should now display "Members Area".
But it doesn't.
So more or less the login system itself works but the thing with the session doesn't.
I'm not that experienced with sessions yet so I don't exactly see the problem.
Maybe some of you can help me out that would be great:)
Thanks for the help

Post a Reply


Oldest  Newest  Rating
0 Jason Eaton · June 20, 2015
I've fought the same battles.   Login is a pain.   But the videos are great so glad I've found this community....   Just what I was looking for best possible way to learn to code....
0 Jonas Meise · June 15, 2015
Okay guys I found out some more specific infos about it.

From testing I noticed that when you login both sessions seem to be declared properly so when you call the function
isLoggedIn() it looks if $this_login is true which it is not while on the index page, so it checks the verifySession() function.
In there both $this->sessionExist() and $this->verifyDatabase() return a value of true and through placing
 echo "$this->_access"; just below the variable definition in verifySession() is saw that this had the correct value 1.

So theoretically all of this should work and in my login php when asking if($login->isLoggedIn()) it should execute the echo code below. BUT it doesn't.

Does anyone know why?
0 Jonas Meise · June 15, 2015
Nevermind guys -.-

Line 69 in verifySession() note missing syntax: $this->_access = 1;

Freaking 2 hours of watching through my code agin and again for that xDDD
0 mitul shah · June 16, 2015
video wall

  • 1



Server-side, HTML embedded scripting language used to create dynamic Web pages.