• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

RevCMS Guest Login

Software Engineer
Loyal Member
Joined
Feb 19, 2008
Messages
1,055
Reaction score
492
You guys are checking if 'user' is set, but not if it returns true, then in the "AND" you're checking if 'id' is equal to "true", of course that code wont work. Not that I'm a PHP coder but this is more like what you guys were going for:

Code:
if(isset($_SESSION['user']) == true && isset($_SESSION['id]) == true) {

If I'm not mistaken? PHP is awful altogether, people can't even correct someone else's code without screwing it all up. Lol
 
Newbie Spellweaver
Joined
Jun 2, 2013
Messages
17
Reaction score
4
PHP is an easy programer language, so beginners easily understand it. That's why there are more possibilities.

You guys are checking if 'user' is set, but not if it returns true, then in the "AND" you're checking if 'id' is equal to "true", of course that code wont work. Not that I'm a PHP coder but this is more like what you guys were going for:

Code:
if(isset($_SESSION['user']) == true && isset($_SESSION['id]) == true) {

If I'm not mistaken? PHP is awful altogether, people can't even correct someone else's code without screwing it all up. Lol
This makes no sense. You don't have to check for the first dimension in two-dimensional arrays. Also you have forgotten a ' on the second session variable.

Code:
if(!isset($_SESSION['user']['id'])) { ... }

This is unsecure:
I doubt you know what you are talking about...

You can do this for the opposite effect:
Code:
[I]if ( isset($_SESSION['user']['id']) && is_numeric($_SESSION['user']['id']) {[/I]

But trust your own code and forget about the is_numeric check ;)
 
Last edited:
Experienced Elementalist
Joined
Apr 4, 2015
Messages
237
Reaction score
88
All I have seen from you is hate on other peoples work, yet you release nothing. Also, how the hell can
Code:
if(isset($_SESSION['user']['id']))

be vulnerable to SQL injections? You're giving bad advice & have no idea what the hell you're talking about.

PS, your 'better' practice example code doesn't even work, so I have this to say to you
Little thing that was missing is not a big problem, i had not test it.

ONT: Update your thread with the code that is given.
 
Software Engineer
Loyal Member
Joined
Feb 19, 2008
Messages
1,055
Reaction score
492
PHP is an easy programer language, so beginners easily understand it. That's why there are more possibilities.


This makes no sense. You don't have to check for the first dimension in two-dimensional arrays. Also you have forgotten a ' on the second session variable.

Code:
if(!isset($_SESSION['user']['id'])) { ... }


I doubt you know what you are talking about...

You can do this for the opposite effect:
Code:
[I]if ( isset($_SESSION['user']['id']) && is_numeric($_SESSION['user']['id']) {[/I]

But trust your own code and forget about the is_numeric check ;)

I was talking about this code:
Code:
if ( isset($_SESSION['user']) && $_SESSION['id'] == true ) {
I even asked someone I know who does PHP as well, he agreed with me. Again, I'm not a PHP programmer, but at least I can tell when someone posts retarded code.
 
Back
Top