» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Online Users: 43
1 members and 42 guests
TopShopOEM
Most users ever online was 611, 03-21-2008 at 10:10 PM.
» .::.
Web Hosting - web hosting, dedicated servers and web design services
Online Degree - search for 1000+ online degrees, online colleges & online universities.
Tattoo - we are a group of tattoo enthusiasts
Gexa Energy - your absolute best choice in electric service
Texas electricity - save on electric rates
Football Betting - best nfl betting promotions at sportsbook.com.
Oral Chelation - initial cleansing of your veins & arteries
Portatiles - Ofertas en Ordenadores y Portatiles. Increibles Ofertas DELL.

Register Now! Contact Us

About this Page
This is a discussion on Help understanding php if commands within the Site design forums, part of the General category; OK I have phpNuke 7.4 and I love it, but I want to learn PHP so I know what ...



Go Back   Nukemods Forum » General » Site design

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-01-2005, 08:19 PM
Junior Member
 
Join Date: Aug 2004
Posts: 1
Help understanding php if commands
OK I have phpNuke 7.4 and I love it, but I want to learn PHP so I know what the coding means. Currently I am on if/then and if/else commands and I am a little stuck by the { and } (I am a VERY visual learner. I just want to make sure I reognize the which bracket closes which. Here is the code:

Code:
if ($httpref==1) {
    $referer = $_SERVER["HTTP_REFERER"];
    $referer = check_html($referer, nohtml);
    if ($referer=="" OR eregi("^unknown", $referer) OR substr("$referer",0,strlen($nukeurl))==$nukeurl OR eregi("^bookmark",$referer)) {
    } else {
	$result = $db->sql_query("INSERT INTO ".$prefix."_referer VALUES (NULL, '$referer')");
    }
    $numrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_referer"));
    if($numrows>=$httprefmax) {
	$result2 = $db->sql_query("DELETE FROM ".$prefix."_referer");
    }
}
So, this is the order I THINK they open and close (1 corresponds with /1)

Code:
if ($httpref==1) { (1)
    $referer = $_SERVER["HTTP_REFERER"];
    $referer = check_html($referer, nohtml);
    if ($referer=="" OR eregi("^unknown", $referer) OR substr("$referer",0,strlen($nukeurl))==$nukeurl OR eregi("^bookmark",$referer)) { (2)
    } (/2) else { (3)
	$result = $db->sql_query("INSERT INTO ".$prefix."_referer VALUES (NULL, '$referer')");
    } (/3)
    $numrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_referer"));
    if($numrows>=$httprefmax) { (4)
	$result2 = $db->sql_query("DELETE FROM ".$prefix."_referer");
    } (/4)
} (/1)
Am I right? And for my own visual keeping-track-of, can I just have the { and } on seperate lines (as opposed to at the end of a line of text/code), Like this:

Code:
if ($httpref==1) 
{
    $referer = $_SERVER["HTTP_REFERER"];
    $referer = check_html($referer, nohtml);
    if ($referer=="" OR eregi("^unknown", $referer) OR substr("$referer",0,strlen($nukeurl))==$nukeurl OR eregi("^bookmark",$referer)) 
{
    } else {
	$result = $db->sql_query("INSERT INTO ".$prefix."_referer VALUES (NULL, '$referer')");
    }
    $numrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_referer"));
    if($numrows>=$httprefmax) 
{
	$result2 = $db->sql_query("DELETE FROM ".$prefix."_referer");
    }
}
Thanks all!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Not quite understanding this Block Retribution Purged Topics 1 02-14-2003 09:34 AM
I may need some help understanding Portal_ Open topics 1 11-15-2002 05:47 PM


All times are GMT -5. The time now is 10:24 PM.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31