473,386 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

!isset

Hello,

does anybody know what the use of the exclamation mark in "!isset" is?
It seems that the script below is only willing to work properly if used
without "!".

extract($_SESSION);
if(!isset($password))
die ("Access denied");

Thanks!

Nov 8 '06 #1
2 1724
"shadowshifter" <ol***********@googlemail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
Hello,

does anybody know what the use of the exclamation mark in "!isset" is?
It is one of the basic operators, it performs a boolean NOT operation to
given value. Ie. if the value is FALSE, the NOT operator will make it TRUE,
and vice cersa, TRUE will become FALSE
It seems that the script below is only willing to work properly if used
without "!".
You are completely changing the functionality of the script to something it
was never intended.
extract($_SESSION);
if(!isset($password))
die ("Access denied");
This horrible piece of script registers all session variables as variables,
then checks weather the session variable called 'password' exists,
assumingly it is only present once the user has logged in. If it does not
exists, the script stops giving the error message 'access denied'. Once you
remove the exlamation mark, you are no longer checking weather the user is
logged in or not - in fact you are throwing out anyone who is. If this is
what you want, then you can remove the entire section of code if it is all
the same to you. Not that it was really secure in the first place...

--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
sp**@outolempi.net | rot13(xv***@bhgbyrzcv.arg)
Nov 8 '06 #2
Thank you for your answer. The problem occurred in an internal
information system, accessible by only a few users. There is another
virtual host running, which needed the php.ini's session parameters
adapted. Since then the first authentication of the information system
is indeed able to authenticate the user/password and to redirect into
the "odd" script which comes up with the "access denied" message
lately.

Anyway, the only protected function is an index-update, so I won't
spend much more time on the matter.

"shadowshifter" <ol***********@googlemail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
Hello,

does anybody know what the use of the exclamation mark in "!isset" is?

It is one of the basic operators, it performs a boolean NOT operation to
given value. Ie. if the value is FALSE, the NOT operator will make it TRUE,
and vice cersa, TRUE will become FALSE
It seems that the script below is only willing to work properly if used
without "!".

You are completely changing the functionality of the script to something it
was never intended.
extract($_SESSION);
if(!isset($password))
die ("Access denied");

This horrible piece of script registers all session variables as variables,
then checks weather the session variable called 'password' exists,
assumingly it is only present once the user has logged in. If it does not
exists, the script stops giving the error message 'access denied'. Once you
remove the exlamation mark, you are no longer checking weather the user is
logged in or not - in fact you are throwing out anyone who is. If this is
what you want, then you can remove the entire section of code if it is all
the same to you. Not that it was really secure in the first place...

--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
sp**@outolempi.net | rot13(xv***@bhgbyrzcv.arg)
Nov 8 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: christian9997 | last post by:
Hi I don't seem to understand the way isset works. Here is some Javascript code that makes a call using PHP: // USER CAME BACK TO CHANGE LANGUAGE if (<?echo isset($_REQUEST)?>) {...
2
by: Pedro Fonseca | last post by:
Greetings everyone! I'm porting everything to PHP5. I have session variables in all of my web application. Until PHP5 I was using session variables like: if ($_SESSION == 'Bar') { $value = 5;...
9
by: wouter | last post by:
hey hi..... I wanna make a switch wich does this: if pagid is set do A, if catid is set do B, if projectid is set do C, else do D. So i was thinking something like this:
2
by: sathyashrayan | last post by:
Dear group, My question may be novice. I have seen codes where the isset() is used to test weather a user's session ($_SESSION) is set before entering a page. A kind of direct access to a page is...
2
by: yawnmoth | last post by:
<?php $var = 'test'; echo isset($var) ? 'true' : 'false'; echo '<br>'; echo isset($var) ? 'true' : 'false'; ?> Why does that result in this output?:
8
by: Giovanni R. | last post by:
Take a look at this code (you can execute it): error_reporting(E_ALL); function byVal( $v) {} function byRef(&$v) {} print '<pre>'; byVal ($first); // gives a notice
9
by: arundelo | last post by:
Is there a way to tell whether accessing a variable will result in an "Undefined variable" E_NOTICE? isset() almost does this, but it also returns false if a variable is set to null: ...
8
by: Simon Dean | last post by:
Im taking Im doing something stupid here? I thought it was clever... just learned a little more about isset. $a = (isset($_GET)) ? $_GET : (isset($_POST)) ? $_POST : ""; I guess you can see...
10
by: major | last post by:
The following code processes a blank field as though it has some value and proceeds as though it was set to some value. Apparently isset() is not working, because it thinks that a blank text...
0
by: Michael Fesser | last post by:
..oO(Daniel Molina Wegener) They have side effects or don't work properly. If the variable or element you want to check doesn't exist, then * the first and fourth will create it and set it...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.