vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Question about condition (https://vborg.vbsupport.ru/showthread.php?t=70440)

AnhTuanCool 10-11-2004 01:19 PM

Question about condition
 
Hi,

I have a question, is it OR '' still count as an condition or PHP just cross out that OR ''?

Colin F 10-11-2004 01:22 PM

I don't understand your question...

You can use "OR TRUE" or something similiar, but that would defeat the purpose of the if clause.
You can also say if($var == ('foo' OR ''){

AnhTuanCool 10-11-2004 01:49 PM

I use ... OR iif($expression, $valuereturniftrue, $valuereturniffalse = '') then if my $expression is false then I will get OR '' right?

Is that iif function always use to condition an expression in a comparison like $var = iif(....) or we can use it as a single condition like iif($expression, then true, then false) ?

Colin F 10-11-2004 01:59 PM

you can leave away the $valuereturniffalse

Are you trying to do this in a MYSQL query?

filburt1 10-11-2004 02:06 PM

What is the exact condition you are trying to evaluate?

AnhTuanCool 10-11-2004 02:33 PM

In the hack that I made
PHP Code:

        if (
            
$bbuserinfo['password'] != iif($password AND !$md5passwordmd5(md5($password) . $bbuserinfo['salt']), '') AND
            
$bbuserinfo['password'] != md5($md5password $bbuserinfo['salt']) AND
            
$bbuserinfo['password'] != iif($md5password_utfmd5($md5password_utf $bbuserinfo['salt']), '') OR 
            
$bbuserinfo['secpassword'] != iif($password2 != ''md5(md5($password2)), '')
        ) 

Look at the last line with OR as begin.

filburt1 10-11-2004 03:22 PM

That's too complex to even read. I suggest breaking some parts of it into functions (for example, password_matches_md5_hash()) and then ditching iif. An inline if is not pretty to begin with, and it is a mess to deal with inside a normal if.

AnhTuanCool 10-11-2004 03:43 PM

Quote:

An inline if is not pretty to begin with, and it is a mess to deal with inside a normal if.
Yah, I saw that too :ermm:, I'll try to break it into functions, thanks for the tip filburt1 :)


All times are GMT. The time now is 05:51 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01143 seconds
  • Memory Usage 1,729KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete