Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 24 May 2004, 14:13
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Real name: sabe
conditional query

can i do?


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
UNDER CONSTRUCTION: Confessionary Hack

Make me a Hack of The Month author: GRPS: Groups Commune
make my hacks, they'll make you famous

unless it's a security concern, please do not pm/im me for support unless you're willing to pay.
Reply With Quote
  #2  
Old 24 May 2004, 14:57
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Real name: Stefan Kaeser
i think you forgot a { } pair


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Unfortunatelly i am completely out of vbulletin buisness, so i won't upgrade any of my hacks anymore. Everyone who wants to upgrade my hacks or use part of my codes is allowed to do so, without needing any special permission by me anymore. You just have to mention my full name if you want to reuse some of my work, thats all i ask for.
Reply With Quote
  #3  
Old 24 May 2004, 14:59
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Real name: sabe
but if i put them additionals curly brackets in, won't i close the conditionals? before it's acheive what i want it to?
__________________
UNDER CONSTRUCTION: Confessionary Hack

Make me a Hack of The Month author: GRPS: Groups Commune
make my hacks, they'll make you famous

unless it's a security concern, please do not pm/im me for support unless you're willing to pay.
Reply With Quote
  #4  
Old 24 May 2004, 15:06
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Real name: sabe
heres an example of the code i'm trying to ask if will work or not

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
UNDER CONSTRUCTION: Confessionary Hack

Make me a Hack of The Month author: GRPS: Groups Commune
make my hacks, they'll make you famous

unless it's a security concern, please do not pm/im me for support unless you're willing to pay.

Last edited by sabret00the : 24 May 2004 at 16:56.
Reply With Quote
  #5  
Old 24 May 2004, 15:36
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Real name: Stefan Kaeser
if you don't close the brackets, the else will be regarded to the inner if's and not to the outer if as you want to have
__________________
Unfortunatelly i am completely out of vbulletin buisness, so i won't upgrade any of my hacks anymore. Everyone who wants to upgrade my hacks or use part of my codes is allowed to do so, without needing any special permission by me anymore. You just have to mention my full name if you want to reuse some of my work, thats all i ask for.
Reply With Quote
  #6  
Old 24 May 2004, 16:57
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Real name: sabe
ok sorry to bother you but i don't get it, just edited my last post for a clarity, basically the conditional starts inside of the if/else and ends outside of it. yet if i close them, then it's not gonna perform what i'm asking it to do?
__________________
UNDER CONSTRUCTION: Confessionary Hack

Make me a Hack of The Month author: GRPS: Groups Commune
make my hacks, they'll make you famous

unless it's a security concern, please do not pm/im me for support unless you're willing to pay.
Reply With Quote
  #7  
Old 24 May 2004, 18:20
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Real name: Stefan Kaeser
now you have confused me.....

i don't get what you want, but from what you said before, that code is correct:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Unfortunatelly i am completely out of vbulletin buisness, so i won't upgrade any of my hacks anymore. Everyone who wants to upgrade my hacks or use part of my codes is allowed to do so, without needing any special permission by me anymore. You just have to mention my full name if you want to reuse some of my work, thats all i ask for.
Reply With Quote
  #8  
Old 24 May 2004, 18:24
Velocd's Avatar
Velocd Velocd is offline
 
Join Date: Mar 2002
Real name: Mike
I've clarified your code.

It's extremely recommended to put brackets for if, else, loops, and functions under the statement. Also, when verifying if a variable exists, use isset(). If you just want to see if a variable has a value, check with the ! (bang) operator in a boolean statement. For strings, use empty().

Here is your code. I'm not sure what you're trying to achieve with the empty IFs, but you were missing the last bracket.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #9  
Old 24 May 2004, 21:59
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Real name: sabe
thank you all, it's very much appreciated, velo, what i was trying to acheive started with the $flood variable and ended with the "INSERT INTO confessions SET..." bit basically i was trying to find out if i needed to repeat the whole code or if i could just use the conditional based on an admin cp option of letting guests confess or not.
__________________
UNDER CONSTRUCTION: Confessionary Hack

Make me a Hack of The Month author: GRPS: Groups Commune
make my hacks, they'll make you famous

unless it's a security concern, please do not pm/im me for support unless you're willing to pay.
Reply With Quote
  #10  
Old 25 May 2004, 00:51
Velocd's Avatar
Velocd Velocd is offline
 
Join Date: Mar 2002
Real name: Mike
Just a minor correction..

I had:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

The ! (bang) operator, which could literally be translated to "not", is equivalent to empty().

Not using ! is equivalent to !empty(), or just placing a variable between the () in a statement.

The code should have been:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #11  
Old 25 May 2004, 08:41
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Real name: sabe
thanks it's appreciated.

not to be a pain but why do you recommend putting all curly brackets under the statement?
__________________
UNDER CONSTRUCTION: Confessionary Hack

Make me a Hack of The Month author: GRPS: Groups Commune
make my hacks, they'll make you famous

unless it's a security concern, please do not pm/im me for support unless you're willing to pay.
Reply With Quote
  #12  
Old 25 May 2004, 16:42
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Real name: Stefan Kaeser
Originally Posted by sabret00the
thanks it's appreciated.

not to be a pain but why do you recommend putting all curly brackets under the statement?
well, it's the vb3 coding standard, and also a well know coding standart in real programming languages like C++.

it makes the code better readable, and especially makes it easier to find if you have missed a bracket
__________________
Unfortunatelly i am completely out of vbulletin buisness, so i won't upgrade any of my hacks anymore. Everyone who wants to upgrade my hacks or use part of my codes is allowed to do so, without needing any special permission by me anymore. You just have to mention my full name if you want to reuse some of my work, thats all i ask for.
Reply With Quote
  #13  
Old 26 May 2004, 09:00
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Real name: sabe
i'll have to try and get used to it, it's just as i'm learning it, i'm being taught to do it

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

(which i find alot easier to read)

rather than

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

arghh feels like such a waste of space.
__________________
UNDER CONSTRUCTION: Confessionary Hack

Make me a Hack of The Month author: GRPS: Groups Commune
make my hacks, they'll make you famous

unless it's a security concern, please do not pm/im me for support unless you're willing to pay.
Reply With Quote
  #14  
Old 26 May 2004, 19:39
dstruct2k's Avatar
dstruct2k dstruct2k is offline
 
Join Date: Dec 2002
Real name: Bill
The way I've always coded, I've done this:
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Bit of both.
Reply With Quote
  #15  
Old 27 May 2004, 13:26
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Real name: Stefan Kaeser
*gg*
everyone bringing in his own coding standards
__________________
Unfortunatelly i am completely out of vbulletin buisness, so i won't upgrade any of my hacks anymore. Everyone who wants to upgrade my hacks or use part of my codes is allowed to do so, without needing any special permission by me anymore. You just have to mention my full name if you want to reuse some of my work, thats all i ask for.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools

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


New To Site? Need Help?

All times are GMT. The time now is 08:28.

Layout Options | Width: Wide Color: