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:

https://www.youtube.com/watch?v=foptrvfCqdk


So I followed his instructions and wrote this code:

login.php


/images/forum/upload/2015-06-15/67ce065e8fb32fa5cbf5d0596841e518.PNG

class.login.php


/images/forum/upload/2015-06-15/ee36421f0fe5a8c9aedc6c878f381b4b.PNG
/images/forum/upload/2015-06-15/8c5a8522b39c89dd1b9753bc9ad96d8b.PNG

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:

index.php


/images/forum/upload/2015-06-15/386aab3ca3b99b567f7115768c0de36b.PNG
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
LuPaw

Post a Reply

Replies

Oldest  Newest  Rating
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

www.xtreme-media.in
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....
  • 1

PHP

107,309 followers
About

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

Links
Moderators