{'System/BaseURL'} ) { # this is homepage $match = " and ((do_where='1') or (do_where='3')) "; } # we want to extend match by checking the country via geoip require_once "Net/GeoIP.php"; $geoip = Net_GeoIP::getInstance("/var/www/html/recipebridge.com/html/geo/GeoIP.dat"); if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $rip = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $rip = $_SERVER['REMOTE_ADDR']; } try { $cc = $geoip->lookupCountryCode($rip); #echo $geoip->lookupCountryCode('71.0.170.218'); } catch (Exception $e) { // Handle exception } # do we have some defined country? if ($cc != '') { # apply it to the match $match = $match." and ((country='ANY') or (country='".$cc."')) "; } else { # we had NO country ip found -- so FORCE any $match = $match." and ((country='ANY')) "; } $Query = " SELECT * FROM backgrounds where status='1' $match order by rand() limit 1;"; #echo '
Q:'.$Query; $rbg = $DatabaseObj->fetchAll($Query); foreach ($rbg as $Result) { ################# # we need to deal with the new background options # if they are set we will apply them # !!! note that CENTERING overides some other options if ($Result->do_background_color != '-1') { # we have some background color $the_color = $Result->do_background_color; # background color -- this is a css modification ?> do_position; $top = $Result->do_top; # we have to modify the top based on the home page or other page # what is our page? #echo "

".$this->{'System/BaseURL'}."

"; #print_r($_SERVER); # adjust positon if FIXED to offset header (and zero top) $cval = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; if ($position == 'absolute') if ( $cval == $this->{'System/BaseURL'} ) { $top = 44; } else { $top = 111; } ?> do_centering; if ($centering == '1'){ # do not apply left } else { # apply left $left = $Result->do_left; ?> do_width; if ($width != '0') { # we have some set width ?> new_window == '0') { $nw = ''; } else { $nw = ' target="_blank" '; } $t_file = '/var/www/html/recipebridge.com/html/backgrounds/'.$Result->file_name; $t_url = $this->{'System/BaseURL'}.'backgrounds/'.$Result->file_name; if (file_exists($t_file)) { # yes show it # we are showing the image directly...and activating the click logic #echo ' '; # if CENTERING is active style differently if ($centering == '1'){ # centering IS active $size = getimagesize($t_file); $width = $size[0]; # default if not provided if (!is_numeric($width)) $width=1200; echo '
'; echo 'image description'; echo '
'; } else { # no centering echo 'image description'; } # end else centering ############ # script to activate click ?> '; } } # end foreach (should be only 1) ?>