vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   Getting Ready for VB3 - A Coding Tutorial (https://vborg.vbsupport.ru/showthread.php?t=54815)

KuraFire 10-30-2003 02:32 PM

Quote:

Originally Posted by amykhar
<snip>
PHP Code:

     $userid $_COOKIE['userid];  // initialize userid so that it contains a value from a cookie and only from a cookie
     if ($userid == 1) {
     // this is the admin id, let the person do what they want
    ....
 } 

<snip>

You have a little parse error in your code:
$_COOKIE['userid]; will give a parse error, it should be:
$_COOKIE['userid'];

Just FYI that you typo'd :)


Quote:

Originally Posted by NTLDR
EG: URL: test.php?debug=1

PHP Code:

  if ($debug)
    
// do stuff
  


In the above example it checks if $debug is set, ...

Actually, to be entirely precise, it checks whether the variable $debug evaluates to TRUE.

There is a vital difference between a variable that is set and a variable that evaluates to true.

This is important to note, because for starting programmers it's important to know the difference :)

For instance, if I SET my variable like this:
$debug = 0;

the variable is set fine, and it does exist fine. But it won't evaluate to TRUE, and so that if () will not occur.


If at any point you want to know if a variable is SET, use:

PHP Code:

isset($variable

if you want to know if the variable evaluates to TRUE, use:

PHP Code:

if ($variable

etc....

(for detailed hacking guidelines, wait a while until vB3 RC1 is out and we have the Hacking Document ready at vB.org :))


All times are GMT. The time now is 11:41 PM.

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

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02534 seconds
  • Memory Usage 1,722KB
  • 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
  • (4)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete