General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 24th, 2003, 08:48 AM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
sick of isset and !isset

I am sick of isset screwing me,......anyone else go through this before?

PHP Code:
if( ( !isset( $_COOKIE['uid'] ) ) && ( !isset( $_COOKIE['phash'] ) ) )
{
     
/*
     This will make the if statement return false and die().
     even if the cookies not set
     */
}
else
{
    die( 
"Cookies Not Set, Please Login" );



PHP Code:
if( ( $_COOKIE['uid'] ) && ( $_COOKIE['phash'] ) )
{
     
// This works fine
}
else
{
    die( 
"Cookies Not Set, Please Login" );

__________________
-- Jason

Reply With Quote
  #2  
Old June 24th, 2003, 06:45 PM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 7
I really don't see the problem with this code:
Code:
if( ( !isset( $_COOKIE['uid'] ) ) && ( !isset( $_COOKIE['phash'] ) ) )
{
    print "Both Not Set";
}
else
{
    die( "Cookies Not Set, Please Login" );
}

Its prints "Both Not Set" when I run it.
Take a look at some of your code before these lines and make absolute sure you are not setting either one of these variables.
The best thing to do is what I did... Put this in a file by itself and run it.
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
  #3  
Old June 24th, 2003, 10:25 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
ok now try it this way,...

PHP Code:
if( ( isset( $_COOKIE['uid'] ) ) && ( isset( $_COOKIE['phash'] ) ) )
{
    die( 
"cookies are set??? or,... isset() has failed me again" );
}
else
{
    die( 
"Cookies Not Set" );



see what I mean?

Reply With Quote
  #4  
Old June 25th, 2003, 12:22 AM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 7
In order for this line to be true:
PHP Code:
if( ( isset( $_COOKIE['uid'] ) ) && ( isset( $_COOKIE['phash'] ) ) ) 

Both $_COOKIE['uid'] and $_COOKIE['phash'] would have to have been set... this just is not the case, thus the statement returns false and the else part is executed.

Reply With Quote
  #5  
Old June 25th, 2003, 12:31 AM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
I need to go back and change the code back to what is was before.,...so I can re-duplicate what had happened,.....thus getting my thoughts on this back on track,....

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > sick of isset and !isset


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT