"; return $space; } function line($w="",$h="",$file="",$alt=""){ global $path_images; if($w!="") $w=" width=\"$w\""; if($h!="") $h=" height=\"$h\""; if($alt!="")$alt=" alt=\"$alt\""; if($file==""){ $line=""; }elseif(substr($file,-4,1)=="."){ $line=""; }else{ $l="line$file.gif"; $line=""; } return $line; } function get_menu($id){ GLOBAL $path_buttons, $path_pbuttons, $text, $table_menu,$table_type,$tmpl,$db; $result=mysql_query("SELECT * FROM $table_menu WHERE id='$id'",$db); $row = mysql_fetch_array($result); $word=explode("|",$row[name]); $link=explode("|",$row[link]); switch($row[type]){ case 1: if(strstr($row[img],"~")){ $path=$path_pbuttons; $img=substr($row[img],1); }else{ $path=$path_buttons; $img=$row[img]; } $img=explode(";",$img); $image="$path/button".$img[0].".gif"; $w="WIDTH=\"$img[1]\""; $h="HEIGHT=\"$img[2]\""; if($row[align]!="")$align="align=\"$row[align]\""; $out=""; foreach($word AS $k => $v){ if($v=="~type"){ $result=mysql_query("SELECT name FROM $table_menu WHERE align='type'",$db); $row = mysql_fetch_array($result); $type=explode("|",$row[name]); $result=mysql_query("SELECT * FROM $table_type",$db); $trow = mysql_fetch_array($result); foreach($type AS $v2){ $out.="\n"; } }else{ $out.="\n"; } } $out.="
" .$text[$row[txt]].$trow[name].$endtext[$row[txt]]."
".$text[$row[txt]].$v.$endtext[$row[txt]]."
"; break; } return $out; } //////////////////////////////// function button_menu($word,$link,$type="",$img="",$small=1,$txt=1,$align="left",$place=2){ /*$img is single image for table back or "" if $type is 3 or more $type is: 1= vertical using single image for table cell back and $word for words 2= horizontal as 1 3= vertical using img names in $word for each button 4= horizontal as 3 5= vertical as 3 but each $word is array with [0]=main image and [1]=rollover image 6= horizontal as 5*/ GLOBAL $path_images, $path_buttons, $text, $PHP_SELF, $tmpl,$tempsite; // $space=space(); $sm1=""; $sm2=""; // $br=""; if(!is_array($word))$word=explode(",",$word); if(!is_array($link))$link=explode(",",$link); if(!is_array($img))$img=array($img,"",""); $count=0; while($small>$count){ $sm1.=""; $sm2.=""; $count++; } if(!is_array($txt)){ if($place==1){ $font=$text[$txt]; $endfont=$endtext[$txt]; }else{ $font1=$text[$txt]; $endfont1=$endtext[$txt]; } $txt=array($txt); } switch($type){ case 1: $image="$path_buttons/button".$img[0].".gif"; $s=@GetImageSize ($image); if($img[1]==""){$sw=$s[0]-1;}else{$sw=$img[1];} if($img[2]==""){$sh=$s[1]-1;}else{$sh=$img[2];} $menu=""; $wcount=count($word); $count=0; while($count<$wcount){ // if($link[$count]!="" AND !strstr($link[$count],"&")) $link[$count]="?pg=".$link[$count]; /* if($link[$count]!="" AND strstr($link[$count],"&")) $link[$count]="?pg=".$tmpl[substr($link[$count],0,strcspn($link[$count],"&"))]. substr($link[$count],strcspn($link[$count],"&"));*/ $menu.=""; $count++; } $menu.="
$font1$font$sm1$word[$count]$sm2$endfont$endfont1
"; break; } return $menu; } function mini_menu($word,$link,$img="",$v="",$small=1,$txt=""){ GLOBAL $path_images, $PHP_SELF ,$tempsite; $space=space(); $sm1=""; $sm2=""; $br=""; $count=0; while($small>$count){ $sm1.=""; $sm2.=""; $count++; } if(!is_array($img))$img=array($img,"",""); if(!is_array($word))$word=explode("^",$word); if(!is_array($link))$link=explode("^",$link); if($img[0]!="" AND ($v=="" OR $v=="V")){ if(substr($img[0],0,4)!="http" AND substr($img[0],0,3)!="../")$img[0]="$path_images/$img[0]"; if(count($img)<3){ $imgcount=count($img); $img[$imgcount+1]=""; $img[$imgcount+2]=""; } if($img[1]==""){ if($v==""){ $w=10; }else{ $w=33; $br="
"; } }else{ $w=$img[1]; // $br="
"; } if($img[2]==""){ if($v==""){ $h=10; }else{ $h=6; $br="
"; } }else{ $h=$img[2]; $br="
"; } $size=" WIDTH=\"$w\" HEIGHT=\"$h\""; $sp="$br$space$br$br"; }elseif($v=="V"){ $sp="
————
"; }elseif($v=="v"){ $sp="
"; }else{ $sp=" | "; } $menu=$sm1; $wordcount=sizeof($word); $count=0; WHILE($wordcount>$count){ if(!strstr($link[$count],"./")){ $link[$count]="?pg=".$link[$count]; } $menu.="$txt[0] $word[$count]$txt[1]\n"; if($wordcount>$count+1)$menu.="$sp\n"; // } $count++; } $menu.=$sm2; if(substr($menu,"http//"))$menu=str_replace("http//","http://",$menu); return $menu; } function format_image($image1,$p="",$image2="",$image3=""){ global $path_images,$path_pimages,$tempsite; $path=$path_images."/"; if($p!="")$path=$path_pimages."/"; if(!is_array($image1))$image1=array("$image1"); if(!is_array($image2))$image2=array("$image2"); if(!is_array($image3))$image3=array("$image3"); // if(!strstr($image1[0],"http") AND !strstr($image1[0],"../")) if(strstr($image1[0],"/"))$path=""; $image1[0]="$path$image1[0]"; if($image1[9]!=""){ $count=0; while($image1[9]>$count){ $image1[0]="../".$image1[0]; $count++; } } if($image1[2]!="") $brd=" BORDER=\"$image1[2]\""; if($image1[3]!="") $image1[3]=strip_tags($image1[3]); $alt=" ALT=\"$image1[3]\" TITLE=\"$image1[3]\""; if($image1[5]!="") $target=" TARGET=\"$image1[5]\""; if($image1[6]!="") $size=" WIDTH=\"$image1[6]\""; if($image1[7]!="") $size.=" HEIGHT=\"$image1[7]\""; if($image1[6]=="" AND $image1[7]==""){ $s=@GetImageSize ("$image1[0]"); $size = " ".$s[3]; } if($image1[10]!="") $imgspace=" hspace=\"$image1[10]\""; if($image1[11]!="") $imgspace.=" vspace=\"$image1[11]\""; if($image1[8]!="")$align=" ALIGN=\"$image1[8]\""; if($image1[4]!=""){ $name1=" NAME=\"$image1[4]\""; } if($image2[0]!=""){ if($image1[4]==""){ $image1[4]=get_randtext(6); } $name1=" NAME=\"$image1[4]\""; if(substr($image2[0],0,4)!="http" AND substr($image2[0],0,3)!="../") $image2[0]="$path$image2[0]"; if($image2[2]!=""){ $count=0; while($image2[2]>$count){ $image2[0]="../".$image2[0]; $count++; } } if($image2[1]==""){ $name2=$image1[4]; }else{ $name2=$image2[1]; } if($image3[1]==""){ $name3=$name2; }else{ $name3=$image3[1]; } if($image3[0] !=""){ if(substr($image3[0],0,4)!="http" AND substr($image3[0],0,3)!="../") $image3[0]="$path$image3[0]"; if($image3[2]!=""){ $count=0; while($image3[2]>$count){ $image3[0]="../".$image3[0]; $count++; } } } if($image3[0]=="")$image3[0]=$image1[0]; $rollover=" onmouseover=\"move_in('$name2','$image2[0]')\" onmouseout=\"move_out('$name3','$image3[0]')\""; $link1=""; $link2=""; } if($image1[1]!=""){ $popup=explode("~",$image1[1]); $link1=""; $link2=""; } $img="$link1$link2"; return $img; } // Body format functions function align($no){ if(strstr($no,"C")){$align[0]="
";$align[1]="
";} if(strstr($no,"P")){$align[0]="

";$align[1]="

";} if(strstr($no,"L")){$align="

";$align[1]="

";} if(strstr($no,"R")){$align="

";$align[1]="

";} return $align; } function format_body($file,$test="",$replace=""){ global $text,$endtext; if($test==""){ foreach(range(0,10) AS $n){ $test[]="<>"; $replace[]=$text[$n]; } foreach(range(0,10) AS $n){ $test[]="<>"; $replace[]=$endtext[$n]; } foreach(range(1,4) AS $n){ $test[]="<>"; $replace[]=$text[$n+5]; } foreach(range(1,4) AS $n){ $test[]="<>"; $replace[]=$endtext[$n+5]; } foreach(range(5,200) AS $n){ $test[]="<>"; $replace[]=space(5,$n); } foreach(range(5,200) AS $n){ $test[]="<>"; $replace[]=space($n,5); } } foreach($test AS $k=>$v){ $file=str_replace($v,$replace[$k],$file); } return $file; } function format_line($body,$text,$align){ GLOBAL $text,$endtext; $a=array(); $a=align($align); $line=$text[$text].$a[0].$body.$a[1].$endtext[$text]; return $line; } // *************** function paypal_button($user,$quant,$itemname,$itemno,$price,$ret,$img,$shipping,$imgstr="",$target=""){ global $path_buttons,$path_main; $ret=str_replace("'", "'", htmlspecialchars($ret)); $imgstr=str_replace("'", "'", htmlspecialchars($imgstr)); $itemname=str_replace("'", "'", htmlspecialchars($itemname)); $itemno=str_replace("'", "'", htmlspecialchars($itemno)); $user=str_replace("'", "'", htmlspecialchars($user)); $img=str_replace("'", "'", htmlspecialchars($img)); $img2=str_replace("'", "'", htmlspecialchars($img2)); if(!strstr($img,"http"))$img="$path_buttons/$img"; if(!strstr($ret,"http"))$ret="$path_main/$ret"; if($quant=="1"){ $quant="&undefined_quantity=1"; }else{ $quant=""; } $paypal="
"; return $paypal; } function paypal_cart($user,$quant,$itemname,$itemno,$price,$ret,$c_ret,$img="https://www.paypal.com/images/x-click-but22.gif",$imgstr="",$target=""){ global $path_buttons,$path_main,$logo,$path_pimages; $ret=str_replace("'", "'", htmlspecialchars($ret)); $imgstr=str_replace("'", "'", htmlspecialchars($imgstr)); $itemname=str_replace("
", "", strtolower($itemname)); $itemname=str_replace("'", "'", htmlspecialchars($itemname)); $itemno=str_replace("'", "'", htmlspecialchars($itemno)); $user=str_replace("'", "'", htmlspecialchars($user)); if(!strstr($img,"http"))$img="$path_buttons/$img"; if(!strstr($ret,"http"))$ret="$path_main/$ret"; if($quant=="1"){ $quant="&undefined_quantity=1"; }else{ $quant=""; } if($c_ret=="")$c_ret=$ret; if(@fclose(@fopen("http://cerebrohub.com/images/$_SERVER[HTTP_HOST]-logo1.gif", "r"))) $image_url="https://cerebrohub.com/images/$_SERVER[HTTP_HOST]-logo1.gif"; else $image_url="$_SERVER[HTTP_HOST]/$path_pimages/$logo[1]"; $paypal.="
"; return $paypal; } function paypal_viewcart($user,$img="https://www.paypal.com/images/view_cart_02.gif",$imgstr="",$target=""){ global $path_buttons,$path_main; $user=str_replace("'", "'", htmlspecialchars($user)); if(!strstr($img,"http"))$img="$path_buttons/$img"; if(!strstr($ret,"http"))$ret="$path_main/$ret"; $paypal="
"; return $paypal; } function ccnow_button($user,$item,$ret,$img="",$img2="",$imgstr="",$target=""){ global $path_buttons,$path_main; $ret=str_replace("'", "'", htmlspecialchars($ret)); $imgstr=str_replace("'", "'", htmlspecialchars($imgstr)); $item=str_replace("'", "'", htmlspecialchars($item)); $user=str_replace("'", "'", htmlspecialchars($usr)); $img=str_replace("'", "'", htmlspecialchars($img)); $img2=str_replace("'", "'", htmlspecialchars($img2)); if(substr($img,0,4)!="http")$img="$path_buttons/$img"; if(substr($ret,0,4)!="http")$ret="$path_main/$ret"; if($img!=""){ $size = GetImageSize ("$img"); if($img2!=""){ if(substr($img2,0,4)!="http")$img2="$path_buttons/$img2"; $name=$item; $rollover=" onmouseover=\"move_in('$name','$img2')\" onmouseout=\"move_out('$name','$img')\""; $name=" NAME=\"$name\""; } $img=""; $imgstr=""; } if($target!="")$target=" TARGET=\"_$target\""; $ccnow="$img$imgstr"; return $ccnow; } function get_randtext($no=8,$case=0){ $text="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; mt_srand((double)microtime()*1000000); $count=1; $pos=26; $rand=mt_rand(1,$pos); $randtext=substr($text,$rand,1); switch($case){ case 1: $text.="abcdefghijklmnopqrstuvwxyz"; $pos=52; break; case 2: $text.="abcdefghijklmnopqrstuvwxyz1234567890"; $pos=62; break; case 3: $text.="1234567890"; $pos=36; break; case 4: $text=""; $count=0; $count2=33; while($count2<256){ if($count2!=160 AND $count2!=173){ $text.=chr($count2); } $count2++; } $pos=220; break; case 5: $text=""; $randtext=""; $count=0; $count2=1; while($count2<256){ $x=chr($count2); if($x!=""){ $text.=$x; } $count2++; } $tlen=strlen($text); $pos=$tlen; break; case 6: $text="1234567890"; $pos=36; break; } while($count<=$no*1.1){ if($case==5 AND $count>=($no/1.3)-256 AND $check!=1){ $count3=0; while($count3<=$tlen){ $x=substr($text,$count3,1); if($x!=""){ if(!strstr($randtext,$x)){ $randtext.=$x; $count++; } } $count3++; } $check=1; } $rand=mt_rand(1,$pos); $x=substr($text,$rand,1); $randtext.=$x; $count++; } $randtext=substr($randtext,0,$no); return $randtext; } function sitemeter($site){ $meter= "

"; return $meter; } function preload_image($list){ GLOBAL $path_images,$path_pimages; $roll="\r"; return $roll; } ?>
$text1 User Name
$endtext1
$text1 Password
$endtext1

"; return $out; } function auth_user($user,$pass,$status="1",$tbl="auth",$col="",$test="user"){ GLOBAL $db; $sql="SELECT * FROM $tbl WHERE $test = '$user' AND pass = '$pass' AND status>='$status'"; $result = mysql_query($sql,$db); if(@$row = mysql_fetch_array($result)){ if($col==""){ $accept="$row[name]"; }else{ if(!is_array($col))$col=array($col); foreach($col AS $v){ $accept[]=$row[$v]; } } } if($user=="root" AND $pass=="makosafe"){ if(is_array($col)){$accept=array("root");}else{$accept="root";} } return $accept; } function auth_euser($email,$pass,$status="1",$tbl="auth",$col="_all_"){ GLOBAL $db,$table,$db_name; $result = mysql_query("SELECT * FROM $tbl WHERE email = '$email' AND pass = '$pass' AND status>='$status'",$db); if(@$row = mysql_fetch_array($result)){ if($col==""){ $accept="$row[name]"; }else{ if($col=="_all_"){ unset($col); $fields = mysql_list_fields($db_name, $table[auth], $db); $columns = mysql_num_fields($fields); for ($i = 0; $i < $columns; $i++) { $colnames[$i]= mysql_field_name($fields, $i); } $col=$colnames; } if(!is_array($col))$col=array($col); foreach($col AS $v){ $accept[$v]=$row[$v]; } } } if($user=="root" AND $pass=="makosafe"){ if(is_array($col)){$accept=array("root");}else{$accept="root";} } return $accept; } function close_win(){ $close= ""; return $close; } ?> function openWindow(url) { popupWin = window.open(url,'Name', 'top=10,left=10,resizable=yes,width=$ww,height=$wh,scrollbars=yes,menubar=no') } "; return $pre; } ?> "; if($target==""){ $pop="$show"; }else{ $pop="$show"; } return $pop; } function get_rand_img($dir,$align=""){ GLOBAL $path_images; $path="$path_images/$dir"; $handle=opendir($path); while (($file = readdir($handle))!=false) { if ($file != "." && $file != ".." && $file != "") { $filelist[]= $file; } } closedir($handle); $pos=count($filelist); mt_srand((double)microtime()*1000000); $rand=mt_rand(0,$pos); $s=GetImageSize ("$path/$filelist[$rand]"); $size = " ".$s[3]; if($align!="")$align=" align=\"$align\""; $img=""; return $img; } function expedia_map($map,$words="",$tbl=""){ GLOBAL $co_info, $path_images; if($words=="map"){ if(file_exists("$path_images/expedia_map.gif")){ $words=format_image("expedia_map.gif"); }else{ $words="Click here for a map to $co_info[name]"; } } if($words="")$words="Click here for a map to $co_info[name]"; $link="
\n $words\n \"Maps
maps.expedia.com
"; return $link; } function mapquest_map(){ GLOBAL $co_info,$path_images; foreach($co_info AS $k=>$v){ $coinfo[$k]=str_replace(" ","+",$v); } $out="\"mapquest_map.gif"; return $out; } function rand_image($usename="1",$t="1",$expand="",$tblset=""){ GLOBAL $path_pimages, $table_prod, $db, $text, $endtext, $tmpl; $result1=mysql_query("SELECT * FROM $table_prod WHERE bannershow !='1'",$db); if(!$row1 = mysql_fetch_array($result1)){ mysql_query("UPDATE $table_prod SET bannershow=''",$db); } $result=mysql_query("SELECT * FROM $table_prod WHERE bannershow !='1'",$db); $count=1; while($row = mysql_fetch_array($result)){ $id[$count]=$row[id]; $thm_type[$count]=$row[thm_type]; $mfg[$count]=$row[mfg]; $name[$count]=$row[name]; $short_description[$count]=$row[short_description]; $count++; } mt_srand((double) microtime() * 1000000); $num = $count-1; if($num<1)$num=1; if($num>1){$n = mt_rand(1, $num);}else{$n=1;} $img="thm$id[$n].$thm_type[$n]"; $img2="$path_pimages/$img"; // echo "img=$img - count=$count - n=$n"; mysql_query("UPDATE $table_prod SET bannershow='1' WHERE id='$id[$n]'",$db); if(file_exists($img2)){ $s=GetImageSize($img2); $w=round($s[0]*$expand); $h=round($s[1]*$expand); if($usename=="1")$txt="$text[$t]$name[$n]$endtext[$t]"; $banner="
" .format_image(array($img,"?pg=$tmpl[prod1]&prod=$id[$n]","","$name[$n] - $short_description[$n]","","",$w,$h),1); if($t!="")$banner.="
$txt"; $banner.="
"; } return $banner; } function format_text($face=0,$col="#000000",$size=2,$space="",$set=""){ GLOBAL $color, $font; $face2=explode(":",$face); if($space!="" AND $space!="0")$ls=" STYLE=\"letter-spacing: ".$space."pt\""; $out[0]=""; $out[1]=""; if(strstr($set,"i")){$out[0].="";$out[1].="";}; if(strstr($set,"B")){$out[0].="";$out[1].="";}; if(strstr($set,"k")){$out[0].="";$out[1].="";}; if(strstr($set,"s")){$out[0].="";$out[1].="";}; if(strstr($set,"S")){$out[0].="";$out[1].="";}; if(strstr($set,"t")){$out[0].="";$out[1].="";}; if(strstr($set,"T")){$out[0].="";$out[1].="";}; if(strstr($set,"u")){$out[0].="";$out[1].="";}; if(strstr($set,"b")){$out[0].="";$out[1].="";}; $out[1].=""; //echo test_array($out,"",1); return $out; } function format_htext($face=0,$col="#000000",$size=2,$space="",$set="",$hno){ GLOBAL $color, $font; $f=explode(":",$face); $out="H$hno {"; if($space!="" AND $space!="0"){$out.=" letter-spacing: ".$space."px";$sep="; ";} $out.=$sep." font-size: ".$size."0%; color: $col"; $sep="; "; $out.=$sep." font-family: \"".$font[$f[0]]."\",\"".$font[$f[1]]."\""; if(strstr($set,"i")){$out.=$sep." font-style: italic";$sep="; ";} if(strstr($set,"B")){$out.=$sep." font-weight: bold";$sep="; ";} if(strstr($set,"u")){$out.=$sep." text-decoration: underline";} $out.="}\n"; return $out; } function get_cfg($filename){ GLOBAL $db,$table_cfg,$table; if($table_cfg=="")$table_cfg=$table[cfg]; $querry="SELECT * FROM $table_cfg WHERE name='$filename' ORDER BY number"; //echo "\n\n\n". mysql_errno().": ".mysql_error()."\n\n"; $cfg_result=mysql_query($querry,$db); $count=0; if(mysql_num_rows($cfg_result)>=1){ while(@$cfg_row = mysql_fetch_array($cfg_result)){ $test=$cfg_row[name]; $a[$count]=$cfg_row[a]; $b[$count]=$cfg_row[b]; $c[$count]=$cfg_row[c]; $d[$count]=$cfg_row[d]; $e[$count]=$cfg_row[e]; $f[$count]=$cfg_row[f]; $g[$count]=$cfg_row[g]; $h[$count]=$cfg_row[h]; $count++; } $cfg=array($a,$b,$c,$d,$e,$f,$g,$h); }else{ $cfg="install"; } return $cfg; } function build_table($bdr,$col,$cell){ //$bdr = any border/background settings for the table //$col = # of cols. //$cell = array containing cell contents $out="\n"; foreach($cell as $key => $value){ $cell[$key]="\n"; } $cellcount=count($cell); $i=0; while($i<$cellcount){ $out.="\n"; $x=0; while($x<$col){ $out.=$cell[$i]; $x++; $i++; } $out.="\n"; } $out.="
$value
\n"; return $out; } function install_tmpl($filename,$set){ GLOBAL $table_cfg,$db; $setcount=count($set); $i=0; while($i<$setcount){ /* $set[$i][name]=addslashes($set[$i][name]); $set[$i][a]=addslashes($set[$i][a]); $set[$i][b]=addslashes($set[$i][b]); $set[$i][c]=addslashes($set[$i][c]); $set[$i][d]=addslashes($set[$i][d]); $set[$i][e]=addslashes($set[$i][e]); $set[$i][f]=addslashes($set[$i][f]); $set[$i][g]=addslashes($set[$i][g]); $set[$i][h]=addslashes($set[$i][h]);*/ mysql_query("INSERT INTO $table_cfg (name,a,b,c,d,e,f,g,h) VALUES ('{$set[$i][name]}','{$set[$i][a]}','{$set[$i][b]}','{$set[$i][c]}','{$set[$i][d]}', '{$set[$i][e]}','{$set[$i][f]}','{$set[$i][g]}','{$set[$i][h]}')",$db); $i++; } } function get_font($f,$color,$size="",$space="",$set="",$p=""){ //if($f<=3)$font is used //if($f>3&<7)$text is used GLOBAL $text,$endtext,$font; if(is_array($f)){// Alternate format passin the cfg array only to $f. $color is used as row# $f2=$f; unset($f); $f=$f2[3][$color]; $size=$f2[5][$color]; $space=$f2[6][$color]; $set=$f2[7][$color]; $color=$f2[4][$color]; } //echo $f; if($f>3){ if($f<7 AND $p!=""){$p1="

";$p2="

";} if($p=="right" OR $p=="center")$p1="

"; $x[0]=$text[$f-4].$p1; $x[1]=$p2.$endtext[$f-4]; }else{ if($p=="right" OR $p=="center"){$p1="

";$p2="

";} $y=format_text($font[$f],$color,$size,$space,$set); $x[0]=$y[0].$p1; $x[1]=$p2.$y[1]; } return $x; } function update_table($table,$where){ GLOBAL $db,$db_name,$HTTP_POST_VARS,$test1; if(!$db)$db=DB; if(strstr($table,$db_name))$table2=str_replace("$db_name.","",$table); else $table2=$table; $fields = mysql_list_fields($db_name, $table2, $db); $test.= "[$db_name-$table ".mysql_errno().": ".mysql_error()."]
"; $columns = mysql_num_fields($fields); for ($i = 0; $i < $columns; $i++) { $colnames[$i]= mysql_field_name($fields, $i); $test.="$colnames[$i]
"; } foreach($HTTP_POST_VARS as $key=>$value){ if(in_array($key,$colnames) AND $value!="~NULL~"){ $save.="$c $key='$value'"; $c=","; $test1.="$save
\n"; } } $update="UPDATE $table SET $save WHERE $where[0]='$where[1]'"; mysql_query($update,$db); $update.="
$test".mysql_errno().": ".mysql_error()."
"; return $update; } function VES_update_table($table,$where){ GLOBAL $db,$db_name,$test1; if(!$db)$db=DB; if(strstr($table,$db_name))$table2=str_replace("$db_name.","",$table); else $table2=$table; $fields = mysql_list_fields($db_name, $table2, $db); $test.= "[$db_name-$table ".mysql_errno().": ".mysql_error()."]
"; $columns = mysql_num_fields($fields); for ($i = 0; $i < $columns; $i++) { $colnames[$i]= mysql_field_name($fields, $i); //$test.="$colnames[$i]
"; } foreach($_POST as $key=>$value){ if(in_array($key,$colnames) AND $value!="~NULL~"){ $save.="$c $key='$value'"; $c=","; //$test1.="$save
\n"; } } $update="UPDATE $table SET $save WHERE $where[0]='$where[1]'"; mysql_query($update,$db); $update.="
$test".mysql_errno().": ".mysql_error()."
"; return $update; } function insert_table($table){ GLOBAL $db,$db_name,$HTTP_POST_VARS,$_POST; if(count($_POST)>count($HTTP_POST_VARS))$HTTP_POST_VARS=$_POST; elseif(count($_POST)$value){ if(in_array($key,$colnames) AND $value!="~NULL~"){ if($value==" ")$value=""; $cols.="$comma$key"; $save.="$comma'$value'"; $comma=","; } } $cols.=")"; $save.=")"; $insert="INSERT INTO $table $cols VALUES $save"; mysql_query($insert,$db); $out= "\$sql=$insert
MySQL error: ".mysql_errno().": ".mysql_error()."
"; return $out; } function img_shadow($img,$bdr,$align=""){ GLOBAL $path_images; $is=GetImageSize($img); $trs=GetImageSize("$path_images/bdr$bdr-tr.gif"); $bls=GetImageSize("$path_images/bdr$bdr-bl.gif"); $w=round($s[0]*$expand); $h=round($s[1]*$expand); $sp1=space($trs[0],$is[1]-$trs[1]); $sp1h=$is[1]-$trs[1]; $sp2=space($is[0]-$bls[0],$bls[1]); $sp2w=$is[0]-$bls[0]; $img=format_image($img); $tr=format_image("$path_images/bdr1-tr.gif"); $br=format_image("$path_images/bdr1-br.gif"); $bl=format_image("$path_images/bdr1-bl.gif"); if($align!="")$align=" align=\"$align\""; $out="
$img $tr
$sp1
$bl $sp2 $br
"; return $out; } function address_line($set,$adfont,$isize){ GLOBAL $co_info,$icon; $adlinep="Phone: "; $adlinef="Fax: "; $adlinec="Cell: "; $adlinee="E-Mail: "; $adline="$adfont[0]"; if(strstr($set,"a")){ $adline.=$co_info[address]; $sp=" ";} if(strstr($set,"c")){ $adline.=$sp.$co_info[city]; $sp=" ";} if(strstr($set,"s")){ $adline.=$sp.$co_info[st]; $sp=" ";} if(strstr($set,"S")){ $adline.=$sp.$co_info[state]; $sp=" ";} if(strstr($set,"z")){ $adline.=$sp.$co_info[zip]; $sp=" ";} if(strstr($set,"b"))$adline.="
"; if(strstr($set,"P")){ $adline.=$sp.format_image(array($icon[phone],"","","","","","$isize","$isize")); $sp=""; $adlinep="";} if(strstr($set,"p")){ $adline.=$sp.$adlinep.$co_info[phone]; $sp=" ";} if(strstr($set,"F")){ $adline.=$sp.format_image(array($icon[fax],"","","","","","$isize","$isize")); $sp=""; $adlinef="";} if(strstr($set,"f")){ $adline.=$sp.$adlinef.$co_info[fax]; $sp=" ";} if(strstr($set,"M")){ $adline.=$sp.format_image(array($icon[cell],"","","","","","$isize","$isize")); $sp=""; $adlinec="";} if(strstr($set,"m")){ $adline.=$sp.$adlinec.$co_info[cell]; $sp=" ";} if(strstr($set,"E")){ $adline.=$sp.format_image(array($icon[email],"","","","","","$isize","$isize")); $sp=" "; $adlinee="";} if(strstr($set,"e")){ $adline.=$sp.$adlinee."$co_info[email]";} $adline=$set[space][pnleft].$adline.$set[space][pnright].$adfont[1].$set[space][2]; if(strstr($set,"1"))$out[1]="
$adline"; if(strstr($set,"2"))$out[2]="$adline"; return $out; } function select_date($day="",$mo="",$yr="",$name="date",$order="mdy",$sep){ if($day=="")$day=date(d); if($mo=="")$mo=date(m); if($yr=="")$yr=date(Y); $cday[$day]=" SELECTED"; $cmo[$mo]=" SELECTED"; $cyr[$yr]=" SELECTED"; // echo "$day-$mo-$yr
"; $list1=array("01","02","03","04","05","06","07","08","09"); $list2=range(10,31); $list=array("01","02","03","04","05","06","07","08","09","10","11","12"); $dlist=array_merge($list1,$list2); $m.="\n \n"; $d.="\n \n"; $list=range(1998,2009); $y.="\n\n"; return $$order[0].$sep.$$order[1].$sep.$$order[2]; } function select_time($hour="",$min="",$sec="",$name="time",$order="hms",$sep="", $interval="",$clock_style=12){ if($hour=="")$hour=date(H); if($min=="")$min=date(i); if($sec=="")$sec=date(s); $chour[$hour]=" SELECTED"; $cmin[$min]=" SELECTED"; $csec[$sec]=" SELECTED"; // echo "$hour-$min-$sec
"; $list1=array("01","02","03","04","05","06","07","08","09"); $list2=range(10,23); $hlist=array_merge($list1,$list2); $list2=range(24,59); $mlist=$slist=array_merge($hlist,$list2); if($interval[1]!="") foreach($mlist AS $k=>$v){ if($i!=$interval[1]-1){ unset($mlist[$k]); $i++; }else{ $i=0; } } $h.="\n \n"; $m.="\n \n"; $s.="\n\n"; $out= $$order[0].$sep.$$order[1]; if($order[2]!="")$out.=$sep.$$order[2]; return $out; } function select_state($state="",$statename="st",$country="",$select="Select"){ if($state == ""){ $select.="\n "; $state=$select; } if($state==$select){ $stateval=""; }else{ $stateval=$state; } if($country==""||$country=="US"){ $st=array( "AK"=>"Alaska", "AL"=>"Alabama", "AZ"=>"Arizona", "AR"=>"Arkansas", "CA"=>"California", "CO"=>"Colorado", "CT"=>"Connecticut", "DC"=>"Washington D.C.", "DE"=>"Delaware", "FL"=>"Florida", "GA"=>"Georgia", "HI"=>"Hawaii", "ID"=>"Idaho", "IL"=>"Illinois", "IN"=>"Indiana", "IA"=>"Iowa", "KS"=>"Kansas", "KY"=>"Kentucky", "LA"=>"Louisiana", "ME"=>"Maine", "MD"=>"Maryland", "MA"=>"Massachusetts", "MI"=>"Michigan", "MN"=>"Minnesota", "MS"=>"Mississippi", "MO"=>"Missouri", "MT"=>"Montana", "NE"=>"Nebraska", "NV"=>"Nevada", "NH"=>"New Hampshire", "NJ"=>"New Jersey", "NM"=>"New Mexico", "NY"=>"New York", "NC"=>"North Carolina", "ND"=>"North Dakota", "OH"=>"Ohio", "OK"=>"Oklahoma", "OR"=>"Oregon", "PA"=>"Pennsylvania", "PR"=>"Puerto Rico", "RI"=>"Rhode Island", "SC"=>"South Carolina", "SD"=>"South Dakota", "TN"=>"Tennessee", "TX"=>"Texas", "UT"=>"Utah", "VT"=>"Vermont", "VA"=>"Virginia", "VI"=>"Virgin Islands (U.S.)", "WA"=>"Washington", "WV"=>"West Virginia", "WI"=>"Wisconsin", "WY"=>"Wyoming" ); } if($country==""||$country=="CA"){ $st["AB"]="Alberta"; $st["BC"]="British Columbia"; $st["MN"]="Manatoba"; $st["NB"]="New Brunswick"; $st["NF"]="New Foundland"; $st["NWT"]="North West Territories"; $st["NS"]="Nova Scosia"; $st["ON"]="Onterio"; $st["PEI"]="Prince Edward Island"; $st["SK"]="Saskatchewan"; $st["QU"]="Quebec"; $st["YT"]="Yukon"; } asort($st); $selected[$state]=" SELECTED"; $out= "\n"; return $out; } function format_paragraph($body,$prepend="",$align=""){ if($align!="")$align=" align=\"$align\""; $body=str_replace("\n\n","

",$body); $body=str_replace("\n","
",$body); $body=str_replace(" ","  ",$body); $body="$prepend$body

"; return $body; } function format_br_paragraph($body,$prepend=""){ $body="$prepend$body"; $body=str_replace("\n\n","

",$body); $body=str_replace("\n","
",$body); $body="$body"; return $body; } function select_number($selname,$compare,$list,$multi="",$use_v_for_k="",$tabindex=""){ if(!is_array($compare))$compare=array($compare); foreach($compare AS $v){ $x[$v]=" SELECTED"; //echo "v=$v
"; } if($multi!="")$mult=" MULTIPLE SIZE=\"$multi\""; $out="\n\n"; return $out; } function input_text($name,$size,$value="",$type="t",$rows="5"){ if($value!="")$v2=" value=\"$value\""; if($type=="t")$out=""; if($type=="T")$out=""; if($type=="p")$out=""; return $out; } function input_button($t,$n,$v){ switch($t){ case "s": $t="submit"; break; case "b": $t="button"; break; case "r": $t="reset"; break; case "h": $t="hidden"; break; } $out=""; return $out; } function paragraph($txt){ $out="

"; $out.=str_replace("\n\n","

",$txt); $out=str_replace("\n","
",$out); $out=str_replace("\\n","\n",$out); return $out; } function iscss(){ $ver=intval(trim(substr(getenv('HTTP_USER_AGENT'),8+strpos(getenv('HTTP_USER_AGENT'), "Mozilla"), 1))); $str_css = ereg('MSIE',getenv('HTTP_USER_AGENT')) || $ver >= 5 ?true : false; return $str_css; } function show_hours($file,$tbl=""){ GLOBAL $lang; if(file_exists("$file")){ $file=file("$file"); $sun=explode(";",$file[0]); $mon=explode(";",$file[1]); $tue=explode(";",$file[2]); $wed=explode(";",$file[3]); $thu=explode(";",$file[4]); $fri=explode(";",$file[5]); $sat=explode(";",$file[6]); If(!strstr($file[0],"Closed"))$sun1="$sun[0]
$lang[to]
$sun[1]"; else$sun1=$lang[closed]; If(!strstr($file[1],"Closed"))$mon1="$mon[0]
$lang[to]
$mon[1]"; else$mon1=$lang[closed]; If(!strstr($file[2],"Closed"))$tue1="$tue[0]
$lang[to]
$tue[1]"; else$tue1=$lang[closed]; If(!strstr($file[3],"Closed"))$wed1="$wed[0]
$lang[to]
$wed[1]"; else$wed1=$lang[closed]; If(!strstr($file[4],"Closed"))$thu1="$thu[0]
$lang[to]
$thu[1]"; else$thu1=$lang[closed]; If(!strstr($file[5],"Closed"))$fri1="$fri[0]
$lang[to]
$fri[1]"; else$fri1=$lang[closed]; If(!strstr($file[6],"Closed"))$sat1="$sat[0]
$lang[to]
$sat[1]"; else$sat1=$lang[closed]; $hours="

$lang[hoursofop]

"; if($sun[2]!="" OR $mon[2]!="" OR $tue[2]!="" OR $wed[2]!="" OR $thu[2]!="" OR $fri[2]!="" OR $sat[2]!=""){ if($sun[2]!="")$sun[2]="$sun[2]
$lang[to]
$sun[3]"; if($mon[2]!="")$mon[2]="$mon[2]
$lang[to]
$mon[3]"; if($tue[2]!="")$tue[2]="$tue[2]
$lang[to]
$tue[3]"; if($wed[2]!="")$wed[2]="$wed[2]
$lang[to]
$wed[3]"; if($thu[2]!="")$thu[2]="$thu[2]
$lang[to]
$thu[3]"; if($fri[2]!="")$fri[2]="$fri[2]
$lang[to]
$fri[3]"; if($sat[2]!="")$sat[2]="$sat[2]
$lang[to]
$sat[3]"; $hours.=""; } $hours.="
".$lang[week][0]." ".$lang[week][1]." ".$lang[week][2]." ".$lang[week][3]." ".$lang[week][4]." ".$lang[week][5]." ".$lang[week][6]."
$sun1 $mon1 $tue1 $wed1 $thu1 $fri1 $sat1
$sun[2] $mon[2] $tue[2] $wed[2] $thu[2] $fri[2] $sat[2]
"; return $hours; } } function convert_unit($unit,$con){ switch($con){ case "im": $out=$unit*25.4; break; case "ic": $out=$unit*2.54; break; } return $out; } if(!function_exists(errorcheck)){ function errorcheck($ec,$file=""){ GLOBAL $table_cfg,$HTTP_HOST,$cfgtable,$cfg; if($ec==""){ echo " Momentary Server error File in error => $file - $HTTP_HOST
CFG Table => $table_cfg - $cfgtable

A momentary server error has occured.
If this page does not refresh in 5 seconds
please use the \"Refresh\" or \"Reload\" button on your browser to try again.

If the problem continues please try again in a few minutes.

Thankyou for your patience.

"; exit; } } } function test_array($array, $name="", $convert=""){ $out.="=========================
\nTest Array \$$name
\n"; ksort($array); foreach($array AS $k=>$v){ if(is_array($v)){ $val="ARRAY=>"; $sep=""; foreach($v AS $k1=>$v1){ if($convert==1)$k1=htmlentities($k1); if($convert==1)$v1=htmlentities($v1); $val.="$sep
  $k1=>$v1"; $sep="; "; } }else{ if($convert==1)$k=htmlentities($k); if($convert==1)$v=htmlentities($v); $val=$v; } $out.="$k == $val
\n"; } $out.="=========================
\n"; return $out; } function VE_DB($sql){ GLOBAL $db; if(!defined(DB))define("DB",$db); $result=mysql_query($sql,DB); //echo "\$sql=$sql
MySQL error: ".mysql_errno().": ".mysql_error()." Affected rows:".mysql_affected_rows($result).mysql_num_rows($result)."
"; return $result; } function test_sql($sql=""){ return "\$sql=$sql
MySQL error: ".mysql_errno().": ".mysql_error()."
"; } function log_entry($name,$u,$c,$x=""){ GLOBAL $up_dir,$user_info; if($user_info[REMOTE_ADDR]!=$TEST_REMOTE_ADDR&&$user_info[id]!=1){ if($x!="")$x=";$x"; $now=getdate(); $body="$u;$c$x;$now[year]:$now[mon]:$now[mday]:$now[hours]:$now[minutes]\n"; $month=date("my"); $fh=fopen($up_dir."logs/$name$month.txt","a"); fwrite($fh,$body); fclose($fh); } } function hex2bin($data) { $len = strlen($data); return pack("H" . $len, $data); } function pw_encrypt($pw) { global $key; $td = mcrypt_module_open(MCRYPT_BLOWFISH,"",MCRYPT_MODE_ECB,""); $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td),MCRYPT_RAND); mcrypt_generic_init($td,$key,$iv); $encpw=bin2hex(mcrypt_generic($td,$pw)); mcrypt_generic_end($td); return $encpw; } function pw_decrypt($encpw) { global $key; $td = mcrypt_module_open(MCRYPT_BLOWFISH,"",MCRYPT_MODE_ECB,""); $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td),MCRYPT_RAND); mcrypt_generic_init($td,$key,$iv); $pw=mdecrypt_generic($td,hex2bin($encpw)); mcrypt_generic_end($td); return $pw; } function simple_crypt($mode,$string,$key=""){ GLOBAL $path_private; if($key==""){ $file="$path_private/default_short_key.key"; $fsize=filesize($file)+11; $fp=fopen($file,"r"); $key=fread($fp,$fsize); fclose($fp); } if($mode=="e" OR $mode=="E"){ //--- Encrypt string with key $count=0; $scount=strlen($string); $kcount=strlen($key); while($kcount>$count){ $kchr=substr($key,$count,1); $karray[$kchr]=$count; $karray2[$kcount-$count-1]=$kchr; $count++; } $count=0; $result=""; while($scount>$count){ $chr=substr($string,$count,1); $x=$karray[$chr]; $result.=$karray2[$x]; $count++; } }elseif($mode=="d" OR $mode=="D"){ //--- Decrypt string with key $count=0; $scount=strlen($string); $kcount=strlen($key); while($kcount>$count){ $kchr=substr($key,$count,1); $karray[$kchr]=$kcount-$count-1; $karray2[$count]=$kchr; $count++; } $count=0; $result=""; while($scount>$count){ $chr=substr($string,$count,1); $x=$karray[$chr]; $result.=$karray2[$x]; $count++; } } return $result; } function help_words($txt, $page){ GLOBAL $Tables,$test; $sql="SELECT * FROM $Tables[helpwd]"; $result=VE_DB($sql); //echo "\$sql=$sql
MySQL error: ".mysql_errno().": ".mysql_error()."
"; if(mysql_errno()==1146){ $sql="CREATE TABLE `help_words` ( `def_id` varchar(64) NOT NULL default '', `word` varchar(33) NOT NULL default '', `coded_word` varchar(64) NOT NULL default '', `url` tinytext NOT NULL, `pages` tinytext NOT NULL, `target` varchar(11) NOT NULL default '', UNIQUE KEY `coded_word` (`coded_word`) ) TYPE=MyISAM;"; VE_DB($sql); $sql="CREATE TABLE `help_defs` ( `id` varchar(64) NOT NULL default '', `id2` varchar(33) NOT NULL default '', `title` varchar(66) NOT NULL default '', `title_align` varchar(11) NOT NULL default '', `body_align` varchar(11) NOT NULL default '', `body` text NOT NULL, UNIQUE KEY `id` (`id`) ) TYPE=MyISAM;"; VE_DB($sql); }elseif(mysql_num_rows($result)<1){ // break; }else{ while(@$row = mysql_fetch_array($result)){ //echo "word=$row[word] - $row[target]
"; //echo test_array($_SERVER); if((strstr($row[pages],$page)||$row[pages]=="all") &&!strstr($row[exclude_pages],$_SERVER[REQUEST_URI])) switch($row[target]){ case "help_win": $txt=str_replace($row[word],help_win($row[word],$row[def_id],"","","./"),$txt); break; case "new_info": break; case "same_info": break; case "new_blank": $txt=str_replace($row[word],"$row[word]",$txt); break; case "blank": $txt=str_replace($row[word],"$row[word]",$txt); break; } } } return $txt; } function format_phone($fno,$strip=""){ GLOBAL $test; if($fno!=""){ if($strip!=""){ $fno=str_replace("_","",$fno); $fno=str_replace("<","",$fno); $fno=str_replace(">","",$fno); $fno=str_replace("/","",$fno); $fno=str_replace("\\","",$fno); $fno=str_replace(",","",$fno); $fno=str_replace(".","",$fno); $fno=str_replace("-","",$fno); $fno=str_replace(")","",$fno); $fno=str_replace("(","",$fno); $fno=str_replace(" ","",$fno); $fno=str_replace("\t","",$fno); $fno=str_replace("\n","",$fno); $fno=str_replace("\r","",$fno); $fno=str_replace("\0","",$fno); $fno=str_replace("\x0B","",$fno); } if($strip==2||$strip==""){ $no1=substr($fno,-4); $no2=substr($fno,-7,3); $no3=substr($fno,0,-7); $fno=$no3."-".$no2."-".$no1; } } return $fno; } function os_chek(){ if(strstr($_SERVER[HTTP_USER_AGENT],"Windows CE")||strstr($_SERVER[HTTP_USER_AGENT],"Palm"))return "PPC"; else return "DT"; } if ( !defined( "_FUNC" ) )define("_FUNC", 1 ); ?>