0){ if (!$promo['basket']['on']){ $promo['basket']['showinbasket']="y"; $promo['basket']=$promo['default']; $promo['basket']['on']=true; $promo['basket']['percent_off']=1; } $promo['basket']['discount']=$discount; $promo['basket']['offerid']=$offer_id; $promo['basket']['percent_off'] *= $discount; } return $discount; } } } function show_item(){ global $types, $temp_shop_2, $temp_shop_wish,$temp_shop, $weight, $total,$c,$shipping, $prod_name,$prod_image,$prod_weight,$prod_price,$prod_id,$prod_product_id; global $prod_id,$prod_name,$prod_desc,$prod_link,$prod_thumb,$prod_price,$prod_image,$prod_merchant_id,$prod_product_id,$prod_add_dt,$prod_cat_id ,$prod_source_id,$prod_source_cat,$prod_ibsn,$prod_brand,$prod_source_id,$prod_merchant_name,$prod_pub_cat,$prod_pub_adv,$prod_model,$prod_opt; global $cat_id,$cat_word_id,$cat_page,$cat_title,$cat_link,$cat_name,$cat_short_desc,$cat_long_desc,$cat_status,$cat_visible, $cat_par_id,$cat_par_source_id,$cat_par_name,$tdcat,$cat_tdcat,$cat_pub_cat,$cat_par_pub_cat,$cat_type,$cat_par_type; global $temp_name, $temp_file,$temp_page_file, $temp_id, $temp_css, $temp_listing, $temp_advert, $temp_logos,$temp_menu,$temp_max_ads ,$temp_max_cat_ads, $temp_prod, $temp_pub_prod, $temp_pub_prod2,$temp_background,$temp_robots,$temp_privacy,$temp_aboutus,$temp_logo ,$temp_max_prods,$temp_content_format,$temp_max_pic_width,$temp_extension,$temp_directories,$temp_extra_pages,$temp_extra_files,$temp_contact ,$temp_pub_searches,$temp_searchbox,$temp_page_type, $temp_listing, $temp_static, $temp_shop,$temp_shop_2,$temp_shop_single,$temp_shop_wish,$temp_shop_summ ,$temp_pub_prod_extra,$temp_version ,$temp_table ,$temp_additional,$temp_meta,$temp_shop_promo,$promo,$discountcode ; global $c,$shipping, $total, $url_id,$types,$domain,$pagename,$imagedir,$canonical,$temp_robs,$typ,$serach_title; global $types,$version,$site; check_promos (); if ($_GET['id']){ $id = mysql_real_escape_string($_GET['id']); } if ($_GET['prodid']){ $id = mysql_real_escape_string($_GET['prodid']); $SQLstr = "select * from h_our_products where prod_product_id in ('$id','0$id','00$id','000$id')"; $result=MYSQL_QUERY("$SQLstr"); $row = mysql_fetch_array($result) ; $id = $row['prod_id']; } if ($_GET['byprod']){ $SQLstr = "select * from h_our_products where prod_product_id in ('$id','0$id','00$id','000$id')"; $result=MYSQL_QUERY("$SQLstr"); $row = mysql_fetch_array($result) ; $id = $row['prod_id']; } if ($id ==""){ echo file_get_contents("404.html"); // countclick2($url_id,$domain,100+$ex,"Prod ID Not Found",$clickadvid,$clickregid,$clickpageid,$clickprodid,$sres_id); die(); } $out = showitem($id); $ret = file_get_contents ("templatefile.htm"); // $canonical = 1; $ret = standard_replaces($ret); $ret = str_replace("",show_basket_total ("gids","counts",false),$ret); $ret = str_replace("",show_basket_total ("wids","wcounts",false),$ret); $ret = str_replace("",$out,$ret); echo $ret; } function add_item ($idtyp,$counttyp){ global $prod_opt; if ($idtyp == ""){ $idtyp = "gids"; $counttyp = "counts"; } if (!isset($_SESSION[$idtyp])) { $_SESSION[$idtyp] = array(); $_SESSION[$counttyp] = array(); $_SESSION[$idtyp][] = mysql_real_escape_string($_GET["id"]); $_SESSION[$counttyp][] =1; } //check for current item in the current shopping cart content $i=0; get_prod(mysql_real_escape_string($_GET["id"])); if ($prod_opt[4]> 0.05){ $found = false; $tot = count($_SESSION[$idtyp]); while ($i<$tot) { if ($_SESSION[$idtyp][$i] == mysql_real_escape_string($_GET["id"])){ $found = true; if ($prod_opt[4]>$_SESSION[$counttyp][$i]){ $_SESSION[$counttyp][$i]++; } } $i++; } if ($found==false){ //no item - add it to $gids array $_SESSION[$idtyp][] = mysql_real_escape_string($_GET["id"]); $_SESSION[$counttyp][] = 1; } } else { $_SESSION[$counttyp][] = 1; } /* while ($i0) $c += $_SESSION[$counttyp][$j]; //not empty? if (isset($_SESSION[$idtyp]) && $c){ switch ($idtyp){ case "wids": $txt = explode(":::",treat($types[$temp_shop_wish]['alpha5'])); $return = $txt[0]; break; case "gids": default: $txt = explode(":::",treat(treat($types[$temp_shop]['alpha7']))); $return = $txt[0]; break; } for ($i=0; $i0 && $_SESSION[$counttyp][$i]>0){ $SQLstr = "SELECT * FROM h_our_products WHERE prod_id ='".$_SESSION[$idtyp][$i]."'"; $result=MYSQL_QUERY("$SQLstr"); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $ct++; load_prod($row); $ourprodlist .= "$prod_product_id:"; $ret = $txt[1]; $ret = str_replace("***prodname***",$prod_name,$ret); $ret = str_replace("***prodimage***",$prod_image,$ret); $ret = str_replace("***prodweight***",$prod_weight,$ret); if ($promo['basket']['on']) { $prc = str_replace("***oldprice***",$prod_price,$promo['basket']['price_display']); $prc = str_replace("***price***",number_format ($_SESSION[$counttyp][$i]*$prod_price * $prcratio,2),$prc); $ret = str_replace("***prodprice***",$prc,$ret); } else { $ret = str_replace("***prodprice***",number_format ($_SESSION[$counttyp][$i]*$prod_price,2),$ret); } $ret = str_replace("***prodid***",$prod_id,$ret); $ret = str_replace("***count***",$ct,$ret); $ret = str_replace("***itemcount***",$_SESSION[$counttyp][$i],$ret); $return .= $ret; $total += $_SESSION["counts"][$i]*$prod_price*$prcratio; $oldtotal += $_SESSION["counts"][$i]*$prod_price; if ($prod_weight <= 0) { $prod_weight = $types[$temp_shop_2]['num9']; } $weight += $prod_weight; } } } $return .= $txt[2]; } $shipping = get_shipping(); return standard_replaces($return); } function get_shipping (){ global $types, $temp_shop_2, $weight, $total,$oldtotal,$c,$shipping,$imagedir,$userPostal,$version,$temp_shop_promo,$promo ,$discountcode,$site; if ($types[$temp_shop_2]['alpha8'] != ""){ $post = explode(":::",$types[$temp_shop_2]['alpha8']); foreach ($post as $postage){ $items = explode(";",$postage); $costs[$items[0]][1] ['lim']= $items[2]; $costs[$items[0]][1] ['prc']= $items[3]; $costs[$items[0]][2] ['lim']= $items[4]; $costs[$items[0]][2] ['prc']= $items[5]; $costs[$items[0]][3] ['lim']= $items[6]; $costs[$items[0]][3] ['prc']= $items[7]; } if ($userPostal == "") { $userPostal = "UK"; } if ($weight<$costs[$userPostal][1]['lim']) { $shipping = $costs[$userPostal][1]['prc'] + (($c - 1) * ($types[$temp_shop_2]['num2']/100)); } elseif ($weight< $costs[$userPostal][2]['lim']){ $shipping = $costs[$userPostal][2]['prc'] + (($c - 1) * ($types[$temp_shop_2]['num2']/100)); } else { $shipping = $costs[$userPostal][3]['prc']+ (($c - 1) * ($types[$temp_shop_2]['num2']/100)); } return $shipping; } else { if ($weight<$types[$temp_shop_2]['num3']) { $shipping = $types[$temp_shop_2]['num1'] + (($c - 1) * $types[$temp_shop_2]['num2']); } elseif ($weight< $types[$temp_shop_2]['num5']){ $shipping = $types[$temp_shop_2]['num4'] + (($c - 1) * $types[$temp_shop_2]['num2']); } else { $shipping = $types[$temp_shop_2]['num4'] + (($c - 1) * $types[$temp_shop_2]['num2']); } return $shipping/100; } } function get_basket_total ($idtyp,$counttyp) { global $types, $temp_shop_2, $weight, $total,$oldtotal,$c,$shipping,$imagedir,$userPostal,$version,$temp_shop_promo,$promo,$discountcode,$site; $total = 0; $weight = 0; $c = 0; $shipping =0; check_promos (); if ($promo['basket']['on']) { $prcratio = (100 - $promo['basket']['percent_off']) /100; } else { $prcratio = 1; } for ($i=0; $i0 && $_SESSION[$counttyp][$i]>0){ $SQLstr = "SELECT * FROM h_our_products WHERE prod_id ='".$_SESSION[$idtyp][$i]."'"; $result=MYSQL_QUERY("$SQLstr"); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $c+= $_SESSION[$counttyp][$i]; $prod_price = $row['prod_price']; $prod_weight = $row['prod_weight']; $total += $_SESSION[$counttyp][$i]*$prod_price*$prcratio; if ($prod_weight <= 0) { $prod_weight = $types[$temp_shop_2]['num9']; } $weight += $prod_weight; } } } $shipping = get_shipping(); } function show_basket_total ($idtyp,$counttyp,$display){ global $types, $temp_shop_2,$temp_shop,$temp_shop_wish, $weight, $total,$temp_shop_promo ,$promo,$discountcode,$site; global $c,$shipping, $total,$oldtotal, $url_id,$types,$domain,$pagename,$temp_shop,$temp_static,$imagedir,$userPostal,$version; if ($idtyp == ""){ $idtyp = "gids"; $counttyp = "counts"; } get_basket_total ($idtyp,$counttyp); if ($total > 0) { $ret = treat($types[$temp_shop]['alpha8']); } else { switch ($idtyp){ case "gids": $ret = treat($types[$temp_shop]['alpha9']); // empty basket break; case "wids": $ret = treat($types[$temp_shop_wish]['alpha9']); // empty wishlist break; } } $ret = standard_replaces($ret); if ($display == true){ echo $ret; } else { return $ret; } } function show_basket($idtyp,$counttyp,$display){ global $types, $temp_shop_2,$temp_shop, $temp_shop_wish, $weight, $total,$temp_shop_promo,$promo,$discountcode,$site ; global $c,$shipping, $total,$oldtotal, $url_id,$types,$domain,$pagename,$temp_shop,$temp_static,$imagedir,$userPostal,$version; $ret = treat($types[$temp_shop]['alpha1']); $basktotal = show_basket_total ($idtyp,$counttyp,$display); $ret = standard_replaces($ret); if ($display == true){ echo $ret; } else { return $ret; } } function show_full_basket($idtyp,$counttyp,$display){ global $c,$shipping, $total, $oldtotal,$url_id,$types,$domain,$pagename,$temp_shop,$temp_static,$imagedir,$userPostal,$version,$site; global $types, $temp_shop_2, $temp_shop_wish,$temp_shop, $weight, $total,$c,$shipping, $prod_name,$prod_image,$prod_weight,$prod_price,$prod_id,$prod_product_id,$temp_shop_promo,$promo,$discountcode ; $out = get_basket_items($idtyp,$counttyp); $ret = file_get_contents("nakedtemplatefile.htm"); $ret = str_replace("",treat($types[$temp_shop]['alpha8']),$ret); $pagename= "View Basket"; $ret = standard_replaces($ret); $ret = str_replace("",$out,$ret); echo $ret; } function assess_action ($url_id){ global $prod_id,$prod_name,$prod_desc,$prod_link,$prod_thumb,$prod_price,$prod_image,$prod_merchant_id,$prod_product_id,$prod_add_dt,$prod_cat_id ,$prod_source_id,$prod_source_cat,$prod_ibsn,$prod_brand,$prod_source_id,$prod_merchant_name,$prod_pub_cat,$prod_pub_adv,$prod_model,$prod_opt; global $cat_id,$cat_word_id,$cat_page,$cat_title,$cat_link,$cat_name,$cat_short_desc,$cat_long_desc,$cat_status,$cat_visible, $cat_par_id,$cat_par_source_id,$cat_par_name,$tdcat,$cat_tdcat,$cat_pub_cat,$cat_par_pub_cat,$cat_type,$cat_par_type; global $temp_name, $temp_file,$temp_page_file, $temp_id, $temp_css, $temp_listing, $temp_advert, $temp_logos,$temp_menu,$temp_max_ads ,$temp_max_cat_ads, $temp_prod, $temp_pub_prod, $temp_pub_prod2,$temp_background,$temp_robots,$temp_privacy,$temp_aboutus,$temp_logo ,$temp_max_prods,$temp_content_format,$temp_max_pic_width,$temp_extension,$temp_directories,$temp_extra_pages,$temp_extra_files,$temp_contact ,$temp_pub_searches,$temp_searchbox,$temp_page_type, $temp_listing, $temp_static, $temp_shop,$temp_shop_2,$temp_shop_single,$temp_shop_wish,$temp_shop_summ ,$temp_pub_prod_extra,$temp_version,$temp_table ,$temp_additional,$temp_meta,$temp_shop_promo,$promo,$discountcode ; global $adv_id,$adv_nm,$adv_title,$adv_short_desc,$adv_long_desc,$adv_webiste,$adv_par_id,$adv_par_desc,$adv_priority,$adv_jump, $adv_page,$adv_my_ref,$adv_your_ref,$adv_type,$adv_keywords,$adv_banner_img,$adv_logo_img,$adv_logo2,$adv_logo3,$adv_link_display,$adv_link_type, $adv_word_group,$adv_word_group2,$adv_link,$adv_visible,$adv_status,$adv_banner_link,$adv_logo_link,$adv_program,$adv_jump_file, $adv_full_jump,$jumplink,$adv_my_ref2,$adv_my_ref3,$adv_my_ref4,$adv_my_ref5 ; global $uid, $nm, $title, $subtitle, $css, $dir, $keywords, $prod_keywords, $adv_keywords, $desc, $page, $domain, $type, $visible, $big_logo, $small_logo, $template, $root,$url_directories,$ug_id,$imagedir, $verify, $pub_keywords,$brand_keywords, $insert1,$insert2,$insert3,$insert4,$insert5,$insert6,$insert7,$insert8,$insert9,$insert10,$columns,$advct,$html,$banner, $ref1,$ref2,$ref3,$ref4,$ref5,$url_status,$word_group,$word_group2,$tdcat,$tdurl,$showpages,$reldt,$head_inserts; global $c,$shipping, $total, $oldtotal,$url_id,$types,$domain,$pagename,$version,$canonical,$temp_robs,$typ,$serach_title,$site; session_start(); switch ($_GET['act']){ case "showitem": case "item": get_url($url_id); get_template($template); $site[name]="default"; $site[directory]=""; if ($temp_mobile > 0) { for ($i=1;$i<10;$i++){ if ($types[$temp_mobile]['num'.$i] == $override_template) { if ($types[$temp_mobile]['alpha'.$i] != "") { $options = explode ("\r\n",$types[$temp_mobile]['alpha'.$i]); foreach ($options as $option){ $opt = explode (";;;",$option); if (strpos($opt[0],"^^^")!== false || strpos($opt[0],"~~~")!== false){ $site['replaces'][$opt[0]]= $opt[1]; } else { $site[$opt[0]]= $opt[1]; } } } } } } if ($override_template > 0) { get_template($override_template,true); } get_types(); show_item(); die(); break; case "confirmwish": $echo=true; unset($_SESSION["wids"]); unset($_SESSION["wcounts"]); $_SESSION["wids"] = array(); $_SESSION["wcounts"] = array(); if ($_POST['wids']) { $wids = explode(":",mysql_real_escape_string($_POST['wids'])); $origwids=mysql_real_escape_string($_POST['wids']); } if ($_GET['wids']) { $wids = explode(":",mysql_real_escape_string($_GET['wids'])); $origwids=mysql_real_escape_string($_GET['wids']); } foreach ($wids as $wid){ $_SESSION["wids"][] = $wid; $_SESSION["wcounts"][] = 1; } $_SESSION["origurl"] = mysql_real_escape_string($_GET['urlid']); $ret = file_get_contents ("nakedtemplatefile.htm"); $pagename = "Wish-List Request for Information"; $ret = standard_replaces($ret); $out = file_get_contents ("wish_details.shtml"); $out = str_replace("***wids***",$origwids,$out); $out = str_replace("***nxtact***","wish",$out); $out = str_replace("***gids***","",$out); $out = standard_replaces($out); break; case "confirm": $echo=true; unset($_SESSION["gids"]); unset($_SESSION["counts"]); if ($_POST['gids']) { $gids = mysql_real_escape_string($_POST['gids']); $origgids=mysql_real_escape_string($_POST['gids']); } if ($_GET['gids']) { $gids = mysql_real_escape_string($_GET['gids']); $origgids=mysql_real_escape_string($_GET['gids']); } $i=0; $gids = explode(":",$gids); foreach ($gids as $gid){ if (strpos($gid,"x") === false){ //has xCount $_SESSION["gids"][] = $gid; $out.= $gid.","; $_SESSION["counts"][] = 1; } else { $it = explode("x",$gid); $_SESSION["gids"][] = $it[0]; $out .= $it[0].","; $_SESSION["counts"][] = $it[1]; } } $_SESSION["origurl"] = mysql_real_escape_string($_GET['urlid']); $ret = file_get_contents ("nakedtemplatefile.htm"); $pagename = "Order Confirmation"; $headers = 'MIME-Version: 1.0' . "\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n"; $headers .= "From: Vintage Kitty <' info@vintagekitty.co.uk '>"; $emails = explode(":::",$types[$temp_shop_2]['alpha4']); foreach ($emails as $to){ if ($to != ""){ mail ($to,"Confirmation page entered","Item Numbers in Basket: ".$out,$headers); } } $ret = standard_replaces($ret); $out = file_get_contents ("order_details.shtml"); $out = str_replace("***gids***",$origgids,$out); $out = standard_replaces($out); break; case "datalist": $echo=true; $ret = file_get_contents ("nakedtemplatefile.htm"); $pagename = "Product List"; $ret = standard_replaces($ret); $out = data_list("",0); $out = standard_replaces($out); break; case "paid": $echo=true; $ret = file_get_contents ("nakedtemplatefile.htm"); $pagename = "Paid"; $ret = standard_replaces($ret); $out = $types[$temp_shop_2]['alpha7']; $out = standard_replaces($out); $headers = 'MIME-Version: 1.0' . "\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n"; $headers .= "From: Vintage Kitty <' paid@vintagekitty.co.uk '>"; $emails = explode(":::",$types[$temp_shop_2]['alpha4']); foreach ($emails as $to){ if ($to != ""){ mail ($to,"PAYMENT RECEIVED #".$orderid,$out."\n".print_r($_GET),$headers); } } break; default: if ($_COOKIES['basketid']> 0 ){ } else { $out = "No items in basket"; } } if ($echo){ $ret = str_replace("",show_basket_total ("gids","counts",false),$ret); $ret = str_replace("",show_basket_total ("wids","wcounts",false),$ret); $ret = str_replace("",$out,$ret); echo $ret; } else { return $out; } } function standard_replaces($txt){ global $c,$shipping, $total, $url_id,$types,$domain,$pagename,$temp_shop,$temp_static,$imagedir,$userPostal,$site; global $temp_shop_2, $weight, $total,$oldtotal,$c,$shipping,$version,$temp_shop_promo,$promo,$discountcode,$canonical,$temp_robs,$typ,$serach_title ; foreach ($site['replaces'] as $val=>$key){ $txt = str_replace($val,$key,$txt); } $ret = str_replace("***addbasket2***","***shop4***",$txt); $ret = str_replace("***addbasket***","***shop4***",$txt); $ret = str_replace("***count***",$c,$txt); $ret = str_replace ( "***shop1***", treat($types [$temp_shop] ['alpha1']), $ret ); $ret = str_replace ( "***shop2***", treat($types [$temp_shop] ['alpha2']), $ret ); $ret = str_replace ( "***shop3***", treat($types [$temp_shop] ['alpha3']), $ret ); $ret = str_replace ( "***shop4***", treat($types [$temp_shop] ['alpha4']), $ret ); $ret = str_replace ( "***shop5***", treat($types [$temp_shop] ['alpha5']), $ret ); $ret = str_replace ( "***shop6***", treat($types [$temp_shop] ['alpha6']), $ret ); $ret = str_replace ( "***shop7***", treat($types [$temp_shop] ['alpha7']), $ret ); $ret = str_replace ( "***shop8***", treat($types [$temp_shop] ['alpha8']), $ret ); $ret = str_replace ( "***shop9***", treat($types [$temp_shop] ['alpha9']), $ret ); $ret = str_replace ( "***static1***", treat($types [$temp_static] ['alpha1']), $ret ); $ret = str_replace ( "***static2***", treat($types [$temp_static] ['alpha2']), $ret ); $ret = str_replace ( "***static3***", treat($types [$temp_static] ['alpha3']), $ret ); $ret = str_replace ( "***static4***", treat($types [$temp_static] ['alpha4']), $ret ); $ret = str_replace ( "***static5***", treat($types [$temp_static] ['alpha5']), $ret ); $ret = str_replace ( "***static6***", treat($types [$temp_static] ['alpha6']), $ret ); $ret = str_replace ( "***static7***", treat($types [$temp_static] ['alpha7']), $ret ); $ret = str_replace ( "***static8***", treat($types [$temp_static] ['alpha8']), $ret ); $ret = str_replace ( "***static9***", treat($types [$temp_static] ['alpha9']), $ret ); $ret = str_replace("***shipping***",number_format ($shipping,2),$ret); $ret = str_replace("***gtotal***",number_format($total+$shipping,2),$ret); $ret = str_replace("***total***",number_format($total,2),$ret); $ret = str_replace("***pound***","£",$ret); $ret = str_replace("***amp***","&",$ret); $ret = str_replace("***shopsite***",$version['shopsite'],$ret); if (strpos($ret,"***gids***") !== false){ $i = 0 ; foreach ($_SESSION["gids"] as $gid) { if ($gid != 0 && $_SESSION['counts'][$i] !=0){ $str .= $gid."x".$_SESSION['counts'][$i].":"; } $i++; } $ret = str_replace("***gids***",$str,$ret); } if (strpos($ret,"***wids***") !== false){ $str=""; $i = 0; foreach ($_SESSION["wids"] as $wid) { if ($wid != 0 && $_SESSION['wcounts'][$i] !=0){ $str .= $wid."x".$_SESSION['wcounts'][$i].":"; } $i++; } $ret = str_replace("***wids***",$str,$ret); } $ret = str_replace("***urlid***",$url_id,$ret); $ret = str_replace("***imagedir***",$imagedir,$ret); $ret = str_replace ( "Nomenu", $pagename, $ret ); $ret = str_replace ( "About Us", $pagename, $ret ); $ret = str_replace("***livemetadesc***",$pagename.". ",$ret); $ret = str_replace("***livemetakeywords***",str_replace(" ",",",$pagename),$ret); $ret = str_replace("***domain***",$domain,$ret); $ret = str_replace ( "***nofollow***", "rel=\"nofollow\"", $ret ); $file = $_SERVER["SCRIPT_NAME"]; $break = explode('/', $file); $pfile = $break[count($break) - 1]; $ret = str_replace("***thisscript***",$pfile,$ret); if (strpos($ret,"***robot***") !== false){ if ($temp_robs[$pfile][0] != ""){ $rob =$temp_robs[$pfile][0]; } else { $rob = "NONE"; } $ret = str_replace("***robot***",$rob,$ret); if ($temp_robs[$pfile][1] != ""){ $rob =$temp_robs[$pfile][1]; $ret = str_replace("***googlebot***","",$ret); } else { $ret = str_replace("***googlebot***","",$ret); } } if (strpos($ret,"***canonical***") !== false){ if ($canonical != "" && $canonical != 1){ $ret = str_replace ( "***canonical***", "", $ret ); } elseif ($canonical == 1) { $args = explode("&",str_replace("act=recsumm","",$_SERVER["QUERY_STRING"])); $reps = array("pageid","regid","lv","show","r","c","for","sresid","global","limit","order","catid","whr","urlid","id"); foreach($args as $arg){ $val = explode("=",$arg); if (!in_array($val[0],$reps) && $val[1] != ""){ $comb[$val[0]] = $val[1]; } } switch ($typ){ case "byprice": case "price": if ($comb['pfr'] != "" && $comb['pto'] !="") { if ($comb['fr'] % $types[$temp_pub_prod]['num2'] == 1 && $comb['to'] -$comb['fr'] == $types[$temp_pub_prod]['num2']-1) { if (floor($comb['fr'] /$types[$temp_pub_prod]['num2']) > 0){ $comb['pg']= floor($comb['fr'] /$types[$temp_pub_prod]['num2'])+1; } else { $comb['pg']= ""; } $comb['fr']=""; $comb['to']=""; } } break; default: if ($comb['fr'] % $types[$temp_pub_prod]['num2'] == 1 && $comb['to'] -$comb['fr'] == $types[$temp_pub_prod]['num2']-1) { if (floor($comb['fr'] /$types[$temp_pub_prod]['num2']) > 0){ $comb['pg']= floor($comb['fr'] /$types[$temp_pub_prod]['num2'])+1; } else { $comb['pg']= ""; } $comb['fr']=""; $comb['to']=""; } } if ($comb['prodnm']!=""){ $comb['nm']=$comb['prodnm'];$comb['prodnm']="";} asort($comb); $canonical = "$pfile?for="; if ($comb['for'] != "") { $canonical .= $comb['for']; } else { $canonical .= urlencode($search_title); } if ($sres_id > 0 ){ $canonical .= "&sresid=$sres_id"; } foreach($comb as $arg => $val){ if ($val != ""){ $canonical .= "&$arg=$val"; } } $ret = str_replace ( "***canonical***", "", $ret ); } else { $ret = str_replace ( "***canonical***", "", $ret ); } } return $ret; } function showitem($id){ global $prod_id,$prod_name,$prod_desc,$prod_link,$prod_thumb,$prod_price,$prod_image,$prod_merchant_id,$prod_product_id,$prod_add_dt,$prod_cat_id ,$prod_source_id,$prod_source_cat,$prod_ibsn,$prod_brand,$prod_source_id,$prod_merchant_name,$prod_pub_cat,$prod_pub_adv,$prod_model,$prod_opt; global $cat_id,$cat_word_id,$cat_page,$cat_title,$cat_link,$cat_name,$cat_short_desc,$cat_long_desc,$cat_status,$cat_visible, $cat_par_id,$cat_par_source_id,$cat_par_name,$tdcat,$cat_tdcat,$cat_pub_cat,$cat_par_pub_cat,$cat_type,$cat_par_type; global $temp_name, $temp_file,$temp_page_file, $temp_id, $temp_css, $temp_listing, $temp_advert, $temp_logos,$temp_menu,$temp_max_ads ,$temp_max_cat_ads, $temp_prod, $temp_pub_prod, $temp_pub_prod2,$temp_background,$temp_robots,$temp_privacy,$temp_aboutus,$temp_logo ,$temp_max_prods,$temp_content_format,$temp_max_pic_width,$temp_extension,$temp_directories,$temp_extra_pages,$temp_extra_files,$temp_contact ,$temp_pub_searches,$temp_searchbox,$temp_page_type, $temp_listing, $temp_static, $temp_shop,$temp_shop_2,$temp_shop_single,$temp_shop_wish,$temp_shop_summ ,$temp_pub_prod_extra,$temp_version ,$temp_table ,$temp_additional,$temp_meta,$temp_shop_promo ,$promo,$discountcode; global $c,$shipping, $total, $oldtotal,$url_id,$types,$domain,$pagename,$canonical,$temp_robs,$typ,$serach_title,$site; global $types; check_promos (); get_prod($id); if (strpos($prod_thumb,";;;") !== false){ $allimgs = explode(";;;",$prod_thumb); $imgs = explode(",",$allimgs[0]); $thumbpic = $allimgs[1]; $mainpic = $allimgs[2]; } else { $imgs = explode(",",$prod_thumb); } $images = ""; foreach ($imgs as $img){ if ($img != "" && $img != " "){ if ($ct % $types[$temp_shop_single]['num3']== 0){ $images .= treat($types[$temp_additional[2]]['alpha3']);} $myimg = str_replace("***prodimage***",$img,treat($types[$temp_shop_single]['alpha8'])); $myimg = str_replace("***size***",$types[$temp_shop_single]['num2'],$myimg); $images .= treat($types[$temp_shop_single]['alpha4']).$myimg.treat($types[$temp_shop_single]['alpha7']); if($ct<1){ $thumbpic = $img; $mainpic = $img; } $ct++; } } $images .= "
"; $images = str_replace("http:","https:",$images); if ($prod_price == 0.01){ $ret = treat($types[$temp_shop_single]['alpha6']); }else{ $ret = treat($types[$temp_shop_single]['alpha2']); } $ret = standard_replaces($ret); $ret = str_replace("***prodimages***",$images,$ret); $ret = str_replace("***prodname***",$prod_name,$ret); $namelen = $templates [$temp_pub_prod] ['namelen']; if (strpos($ret,"***proddesc") !==false){ $ret = str_replace("***proddesc***",treat($prod_desc),$ret); } $ret = str_replace ( "***prodfullrawdesc***", $prod_full_desc, $ret ); $it = substr($prod_desc,0,$desclen); $ret = str_replace ( "***prodrawdesc***", $prod_desc, $ret ); if (strpos($ret,"***prodshortdesc") !==false){ $ret = str_replace ( "***prodshortdesc***", substr(treat($prod_desc),0,$desclen), $ret ); } $it = treat($prod_name); $ret = str_replace ( "***prodname***", $it, $ret ); $ret = str_replace ( "***prodrawname***", $prod_name, $ret ); $ret = str_replace ( "***prodrawrawname***", sq($prod_name), $ret ); $ret = str_replace ( "***prodcleanname***",treat($prod_name), $ret ); $ret = str_replace ( "***produrlname***", urlencode($it), $ret ); $ret = str_replace ( "***prodshortname***", substr($it,0,$namelen), $ret ); $ret = str_replace ( "***prodrawshortname***", substr($prod_name,0,$namelen), $ret ); if ($promo['basket']['on']) { $prc = str_replace("***oldprice***",number_format($prod_price,2),$promo['basket']['price_display']); $prc = str_replace("***price***",number_format($prod_price * (100 - $promo['basket']['percent_off'])/100,2),$prc); $ret = str_replace("***prodprice***",$prc,$ret); } else { $ret = str_replace("***prodprice***",number_format ($prod_price,2),$ret); } $ret = str_replace("***prodid***",$prod_id,$ret); $ret = str_replace("***prodproductid***",$prod_product_id,$ret); $ret = str_replace("***prodimage***",$prod_image,$ret); $ret = str_replace("***prodthumb***",prod_img($prod_image,$prod_image,$prod_name,200,"right"),$ret); $ret = str_replace("***prodthumbpic***",$thumbpic,$ret); $ret = str_replace("***prodmainpic***",$mainpic,$ret); $ret = str_replace("***prodweight***",$prod_weight,$ret); $ret = str_replace("***prodopta1***",$prod_opt[0],$ret); $ret = str_replace("***prodopta2***",$prod_opt[1],$ret); $ret = str_replace("***prodopta3***",$prod_opt[2],$ret); $ret = str_replace("***prodoptn1***",$prod_opt[3],$ret); $ret = str_replace("***prodoptn2***",$prod_opt[4],$ret); $ret = str_replace("***prodoptn3***",$prod_opt[5],$ret); $pagename = $prod_name; $ret = standard_replaces($ret); return $ret; } function assess_basket ($act){ global $prod_id,$prod_name,$prod_desc,$prod_link,$prod_thumb,$prod_price,$prod_image,$prod_merchant_id,$prod_product_id,$prod_add_dt,$prod_cat_id ,$prod_source_id,$prod_source_cat,$prod_ibsn,$prod_brand,$prod_source_id,$prod_merchant_name,$prod_pub_cat,$prod_pub_adv,$prod_model,$prod_opt; global $cat_id,$cat_word_id,$cat_page,$cat_title,$cat_link,$cat_name,$cat_short_desc,$cat_long_desc,$cat_status,$cat_visible, $cat_par_id,$cat_par_source_id,$cat_par_name,$tdcat,$cat_tdcat,$cat_pub_cat,$cat_par_pub_cat,$cat_type,$cat_par_type; global $temp_name, $temp_file,$temp_page_file, $temp_id, $temp_css, $temp_listing, $temp_advert, $temp_logos,$temp_menu,$temp_max_ads ,$temp_max_cat_ads, $temp_prod, $temp_pub_prod, $temp_pub_prod2,$temp_background,$temp_robots,$temp_privacy,$temp_aboutus,$temp_logo ,$temp_max_prods,$temp_content_format,$temp_max_pic_width,$temp_extension,$temp_directories,$temp_extra_pages,$temp_extra_files,$temp_contact ,$temp_pub_searches,$temp_searchbox,$temp_page_type, $temp_listing, $temp_static, $temp_shop,$temp_shop_2,$temp_shop_single,$temp_shop_wish,$temp_shop_summ,$temp_pub_prod_extra,$temp_version ,$temp_table ,$temp_additional,$temp_meta,$temp_shop_promo ,$promo,$discountcode; global $adv_id,$adv_nm,$adv_title,$adv_short_desc,$adv_long_desc,$adv_webiste,$adv_par_id,$adv_par_desc,$adv_priority,$adv_jump, $adv_page,$adv_my_ref,$adv_your_ref,$adv_type,$adv_keywords,$adv_banner_img,$adv_logo_img,$adv_logo2,$adv_logo3,$adv_link_display,$adv_link_type, $adv_word_group,$adv_word_group2,$adv_link,$adv_visible,$adv_status,$adv_banner_link,$adv_logo_link,$adv_program,$adv_jump_file, $adv_full_jump,$jumplink,$adv_my_ref2,$adv_my_ref3,$adv_my_ref4,$adv_my_ref5 ; global $uid, $nm, $title, $subtitle, $css, $dir, $keywords, $prod_keywords, $adv_keywords, $desc, $page, $domain, $type, $visible, $big_logo, $small_logo, $template, $root,$url_directories,$ug_id,$imagedir, $verify, $pub_keywords,$brand_keywords, $insert1,$insert2,$insert3,$insert4,$insert5,$insert6,$insert7,$insert8,$insert9,$insert10,$columns,$advct,$html,$banner, $ref1,$ref2,$ref3,$ref4,$ref5,$url_status,$word_group,$word_group2,$tdcat,$tdurl,$showpages,$reldt,$head_inserts; global $url_id,$types,$total,$oldtotal,$c,$weight,$shipping, $ourprodlist; global $pagename,$version,$canonical,$temp_robs,$typ,$serach_title,$site; session_start(); if ($act == "") { if (isset($_GET['act'])){ $act = mysql_real_escape_string($_GET['act']); } } switch ($act){ case "removewish": case "addwish": case "showwish": case "viewwish": case "wishtotal": $idtyp = "wids"; $counttyp = "wcounts"; break; case "clear": case "remove": case "add": case "viewbasket": case "show": default: $idtyp = "gids"; $counttyp = "counts"; break; } switch ($act){ case "clear": $refreshpage=true; unset($_SESSION["gids"]); unset($_SESSION["counts"]); break; case "remove": case "removewish": $refreshpage=true; $i=0; while ($i=$_SESSION[$counttyp][$i]){ $_SESSION[$counttyp][$i]++; // left here incase multiple items is enabled in future } } } if (!$found){ //no item - add it to $gids array $_SESSION[$idtyp][] = mysql_real_escape_string($_GET["id"]); $_SESSION[$counttyp][] = 1; } //check for current item in the current shopping cart content /* $i=0; while ($i 0) { for ($i=1;$i<10;$i++){ if ($types[$temp_mobile]['num'.$i] == $override_template) { if ($types[$temp_mobile]['alpha'.$i] != "") { $options = explode ("\r\n",$types[$temp_mobile]['alpha'.$i]); foreach ($options as $option){ $opt = explode (";;;",$option); if (strpos($opt[0],"^^^")!== false || strpos($opt[0],"~~~")!== false){ $site['replaces'][$opt[0]]= $opt[1]; } else { $site[$opt[0]]= $opt[1]; } } } } } } if ($override_template > 0) { get_template($override_template,true); } get_types(); check_promos(); $c = 0; for ($j=0; $j0) $c += $_SESSION[$counttyp][$j]; //not empty? if (isset($_SESSION[$idtyp]) && $c) { $check = treat($types[$temp_shop]['alpha3']); switch ($act){ case "viewwish": $txt = explode(":::",treat(treat($types[$temp_shop_wish]['alpha7']))); $out .= $txt[0]; break; case "wishtotal": $txt = explode(":::",treat($types[$temp_shop_wish]['alpha5'])); $out .= $txt[0]; break; case "showwish": $out = treat($types[$temp_shop_wish]['alpha5']); break; case "viewbasket": $txt = explode(":::",treat(treat($types[$temp_shop]['alpha7']))); $out .= $txt[0]; break; case "viewtotal": $txt = explode(":::",treat($types[$temp_shop_2]['alpha5'])); $out .= $txt[0]; break; default: // $out = treat($types[$temp_shop]['alpha6']); } for ($i=0; $i0 && $_SESSION[$counttyp][$i]>0){ $SQLstr = "SELECT * FROM h_our_products WHERE prod_id ='".$_SESSION[$idtyp][$i]."'"; $result=MYSQL_QUERY("$SQLstr"); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $ct++; load_prod($row); $ourprodlist .= "$prod_product_id:"; switch ($act){ case "viewwish": case "wishtotal": case "viewbasket": case "viewtotal": $ret = $txt[1]; $ret = str_replace("***prodname***",$prod_name,$ret); $ret = str_replace("***prodimage***",$prod_image,$ret); $ret = str_replace("***prodweight***",$prod_weight,$ret); if ($promo['basket']['on']) { $prc = str_replace("***oldprice***",number_format($prod_price,2),$promo['basket']['price_display']); $prc = str_replace("***price***",number_format($prod_price * (100 - $promo['basket']['percent_off'])/100,2),$prc); $ret = str_replace("***prodprice***",$prc,$ret); } else { $ret = str_replace("***prodprice***",number_format ($_SESSION[$counttyp][$i]*$prod_price,2),$ret); } $ret = str_replace("***prodid***",$prod_id,$ret); $ret = str_replace("***count***",$ct,$ret); $ret = str_replace("***itemcount***",$_SESSION[$counttyp][$i],$ret); $out .= $ret; break; case "showwish": default: break; } if ($promo['basket']['on']) { $total += $_SESSION["counts"][$i]*$prod_price * (100 - $promo['basket']['percent_off'])/100; }else{ $total += $_SESSION["counts"][$i]*$prod_price; } if ($prod_weight <= 0) { $prod_weight = $types[$temp_shop_2]['num9']; } $weight += $prod_weight; } } } $shipping = get_shipping (); } else { $out .= treat($types[$temp_shop]['alpha9']); // empty basket } } if (isset($_SESSION[$idtyp])) { switch ($act) { case "viewwish": $ret = file_get_contents("nakedtemplatefile.htm"); $ret = str_replace("",show_basket_total ("gids","counts",false),$ret); $ret = str_replace("",show_basket_total ("wids","wcounts",false),$ret); $pagename= "View Wish-List"; $out .=$txt[2]; $out = standard_replaces($out); $ret = standard_replaces($ret); $ret = str_replace("",$out,$ret); echo $ret; break; case "showwish": $out = treat($types[$temp_shop_wish]['alpha5']); $ret = standard_replaces($out); return $ret; case "confirm": case "wishtotal": case "viewtotal": $ret = standard_replaces($out); return $ret; break; case "viewbasket": $ret = file_get_contents("nakedtemplatefile.htm"); $ret = str_replace("",show_basket_total ("gids","counts",false),$ret); $ret = str_replace("",show_basket_total ("wids","wcounts",false),$ret); $pagename= "View Basket"; $ret = standard_replaces($ret); $ret = str_replace("",$out,$ret); echo $ret; break; case "showitem": if (isset($_SESSION[$idtyp])) { // $out .= assess_basket("showwish"); } $pagename = $prod_name; case "show": if (isset($_SESSION["wids"])) { $out .= assess_basket("showwish"); } echo $out; break; case "": default: return $out; } } else { echo $out; } $refreshpage = false; } if ($refreshpage ){ header("Location: ".$_SERVER['HTTP_REFERER']); } } function splitdesc($txt){ global $prod_desc; $pos = strpos($prod_desc,$txt); if ($pos > 0) { $newpos=strpos($prod_desc,"",$pos)+4; $res = substr($prod_desc,$newpos,strpos($prod_desc,"
",$newpos)-$newpos); } return $res; } function data_list($typ,$id){ global $prod_id,$prod_name,$prod_desc,$prod_link,$prod_thumb,$prod_price,$prod_image,$prod_merchant_id,$prod_product_id,$prod_add_dt,$prod_cat_id ,$prod_source_id,$prod_source_cat,$prod_ibsn,$prod_brand,$prod_source_id,$prod_merchant_name,$prod_pub_cat,$prod_pub_adv,$prod_model,$prod_opt; switch ($typ){ case "name": $whr = " prod_name like '%$id%' or prod_desc like '%$id%'"; break; case "cat": $whr = " prod_pub_cat = $id"; break; default: $whr = "true"; } $cols = "TitlePrice"; $cols .= "Date"; $SQLstr = "SELECT * FROM h_our_products WHERE $whr"; $result=MYSQL_QUERY("$SQLstr"); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $ct++; load_prod($row); $type = splitdesc("Item Type"); $dt= splitdesc("Estimated Date"); $style= splitdesc("Style"); $width= splitdesc("Width"); $height= splitdesc("Length"); $condition= splitdesc("Condition"); $colour= splitdesc("Main Colour"); $res .= "$prod_name$prod_price"; $res .= "$dt"; } $res ="\n\n".$cols."\n$res\n".$cols."\n
"; $scr1 = "\n"; $scr0 = ""; return $scr0.$res.$scr1; } function load_prod($row){ global $prod_id,$prod_name,$prod_desc,$prod_link,$prod_thumb,$prod_price,$prod_image,$prod_merchant_id,$prod_product_id,$prod_add_dt,$prod_cat_id ,$prod_source_id,$prod_source_cat,$prod_ibsn,$prod_brand,$prod_source_id,$prod_merchant_name,$prod_pub_cat,$prod_pub_adv,$prod_model,$prod_opt; $prod_id= $row['prod_id']; $prod_name = utf8_encode($row['prod_name']); $prod_link = utf8_encode($row['prod_link']); $prod_desc= utf8_encode($row['prod_desc']); $prod_thumb= $row['prod_thumb']; $prod_price= $row['prod_price']; $prod_image= $row['prod_image']; $prod_product_id= $row['prod_product_id']; $prod_merchant_id= $row['prod_merchant_id']; $prod_merchant_name= $row['prod_merchant_name']; $prod_cat_id= $row['prod_cat_id']; $prod_add_dt= $row['prod_add_dt']; $prod_ibsn= $row['prod_ibsn']; $prod_brand= $row['prod_brand']; $prod_source_id= $row['prod_source_id']; $prod_source_cat= $row['prod_source_cat']; $prod_pub_cat= $row['prod_pub_cat']; $prod_pub_adv= $row['prod_pub_adv']; $prod_opt[0]= $row['prod_opt_a1']; $prod_opt[1]= $row['prod_opt_a2']; $prod_opt[2]= $row['prod_opt_a3']; $prod_opt[3]= $row['prod_opt_n1']; $prod_opt[4]= $row['prod_opt_n2']; $prod_opt[5]= $row['prod_opt_n3']; if ($prod_weight ==0 && $prod_opt[3] > 0) { $prod_weight = $prod_opt[3]; } } function get_prod($id){ global $prod_id,$prod_name,$prod_desc,$prod_link,$prod_thumb,$prod_price,$prod_image,$prod_merchant_id,$prod_product_id,$prod_add_dt,$prod_cat_id ,$prod_source_id,$prod_source_cat,$prod_ibsn,$prod_brand,$prod_source_id,$prod_merchant_name,$prod_pub_cat,$prod_pub_adv,$prod_model,$prod_opt,$temp_table; $SQLstr = "select * from $temp_table where prod_id = '$id'"; $result=MYSQL_QUERY("$SQLstr"); if ($result) { $row = mysql_fetch_array($result); load_prod($row); if ($prod_id > 0){ return true; } else { return false; } } else { return false; } } function load_offer($row){ global $offer_id, $offer_desc,$offer_disp_desc,$offer_add_dt,$offer_upd_dt,$offer_st_dt,$offer_end_dt,$offer_adv_id,$offer_code,$offer_url,$offer_visible,$offer_info; $offer_id = $row['offer_id']; $offer_st_dt = $row['offer_st_dt']; $offer_end_dt = $row['offer_end_dt']; $offer_upd_dt = $row['offer_upd_dt']; $offer_add_dt = $row['offer_add_dt']; $offer_desc = $row['offer_desc']; $offer_disp_desc = $row['offer_disp_desc']; $offer_code = $row['offer_code']; $offer_adv_id = $row['offer_adv_id']; $offer_url = $row['offer_url']; $offer_visible = $row['offer_visible']; if (strpos($offer_url,":::") !== false){ $values = explode(":::",$offer_url); foreach($values as $value) { $val = explode(";;;",$value); $offer_info[$val[0]]=$val[1]; } } } function get_offer($id){ global $offer_id, $offer_desc,$offer_disp_desc,$offer_add_dt,$offer_upd_dt,$offer_st_dt,$offer_end_dt,$offer_adv_id,$offer_code,$offer_url,$offer_visible,$offer_info; $SQLstr = "select * from h_offers where offer_id = '$id'"; $result=MYSQL_QUERY("$SQLstr"); if ($result) { $row = mysql_fetch_array($result); load_offer($row); return true; } else { return false; } } function get_discount($id){ global $offer_id, $offer_desc,$offer_disp_desc,$offer_add_dt,$offer_upd_dt,$offer_st_dt,$offer_end_dt,$offer_adv_id,$offer_code,$offer_url,$offer_visible,$offer_info; $now = date("Y-m-d"); $SQLstr = "select * from h_offers where offer_code = '$id'"; $result=MYSQL_QUERY("$SQLstr"); $row = mysql_fetch_array($result); load_offer($row); if ($now >= $offer_st_dt && $now <= $offer_end_dt && $offer_info['sold'] < $offer_info['maxsales'] && $offer_visible == 1 && $offer_info['discount'] > 0){ return (100 - $offer_info['discount']) /100; } else { if ($now >= $offer_st_dt && $now <= $offer_end_dt) { return -1; } if ($offer_info['sold'] < $offer_info['maxsales']) { return -2; } if ($offer_visible == 1) { return -3; } return -4; } } function upd_offer_item($id,$itm,$val){ global $now; $SQLstr = "update h_offers set offer_$itm='$val',offer_upd_dt = '$now' where offer_id = $id"; $result=MYSQL_QUERY("$SQLstr"); } function incr_discount($id){ global $offer_id, $offer_desc,$offer_disp_desc,$offer_add_dt,$offer_upd_dt,$offer_st_dt,$offer_end_dt,$offer_adv_id,$offer_code,$offer_url,$offer_visible,$offer_info; get_offer($id); $offer_info['sold']++; foreach($offer_info as $info => $k){ if ($info != "") $new_info .= "$info;;;$k:::"; } upd_offer_item($id,"url",$new_info); } ?> Server unreachable"); MYSQL_SELECT_DB($database) or die ( "

Database non existent

"); /* if ($version['loaded'] != 1) { $version['loaded'] = 1; $version['system']="U"; $version['dbsystem']="localhost"; define ("DEFAULTTEMPLATE", "100"); get_types(); if ($types[0]['num1'] > 0){ $std = explode("\n",$types[$types[0]['num1']]['alpha1']); foreach($std as $op){ list($it,$val) = explode(";;;",$op); switch ($it){ case "email": $email = trim($val); break; case "email2": $email2 = trim($val); break; case "imagedir": $imagedir = trim($val); break; case "huburl": $huburl = trim($val); break; case "commondir": $commondir = trim($val); break; case "basedir": $basedir = trim($val); break; case "countdir": $countdir = trim($val); break; case "ipaddr": $ipaddr = trim($val); break; case "homedir": $homedir = trim($val); break; default: echo "Host load error $it $val"; die(); } } $std = explode("\n",$types[$types[0]['num1']]['alpha2']); foreach($std as $op){ list($it,$val) = explode(";;;",$op); $version[$it] = trim($val); } } else { */ $email = "nigel@redoblong.co.uk"; $imagedir = "www.u1ab.co.uk/images"; $huburl = "http://www.internetshoppingstore.co.uk"; $commondir= "http://www.u1a.co.uk/common"; $basedir = "/home/default/u1a.co.uk/user/htdocs/pub"; $ipaddr = "213.171.197.184"; // } //} ?> 0){ $num[$i] = $types[$temp_additional[1]]['num'.$i]; list ($type[$i],$head[$i],$body[$i],$tail[$i]) = explode(":::",treat($types[$temp_additional[1]]['alpha'.$i])); if ($type[$i] ==$format){ $order[0] = $i; } } $ad= $types[$temp_additional[1]]['num9']; if ($types[$temp_additional[$ad]]['num'.$i]>0){ list ($type[$i],$head[$i],$body[$i],$tail[$i]) = explode(":::",treat($types[$temp_additional[$ad]]['alpha'.$i])); if ($type[$i] ==$format){ $order[0] = $i+10; } } } } foreach ($order as $i){ switch ($i){ case($i<9): $temp = 1; $of = $i; break; case($i>10 && $i<20): $temp = $types[$temp_additional[1]]['num9']; $of = $i-10; break; case($i>20 && $i<30): $temp = $types[$temp_additional[1]]['num9']; $temp = $types[$temp_additional[$temp]]['num9']; $of = $i-20; break; } if ($types[$temp_additional[$temp]]['num'.$of]>0){ $num[$i] = $types[$temp_additional[$temp]]['num'.$of]; // orig list ($type[$i],$head[$i],$body[$i],$tail[$i],$blockno[$i],$starttext[$i],$prevtext[$i],$nexttext[$i],$lasttext[$i],$stdtext[$i],$starttext2[$i],$prevtext2[$i],$nexttext2[$i],$lasttext2[$i]) = explode(":::",treat($types[$temp_additional[$temp]]['alpha'.$of])); $tret = explode(":::",$types[$temp_additional[$temp]]['alpha'.$of]); $type[$i] = treat($tret[0]); $head[$i] = treat($tret[1]); $body[$i] = treat($tret[2]); $tail[$i] = treat($tret[3]); switch ($type[$i]){ case "filter": $blockno[$i] = $tret; // just to allow it dro pthrou later on. $alttail[$i] = treat($tret[3]); $tail[$i] = treat($tret[4]); $icols[$i] = $tret[5]; // cols internal to a filter display $irows[$i] = $tret[6]; $cols[$i] = $tret[7]; // cols of filter dispay $rows[$i] = $tret[8]; $istarttext[$i] = treat($tret[9]); $imidtext[$i] = treat($tret[10]); $iendtext[$i] = treat($tret[11]); $starttext[$i] = treat($tret[12]); $midtext[$i] = treat($tret[13]); $endtext[$i] = treat($tret[14]); $include[$i] = treat($tret[15]); $prog1[$i] = treat($tret[16]); // not used in generat $prog2[$i] = treat($tret[17]); // is used in generate break; case "title": $prog1[$i] = treat($tret[5]); // not used in generat $prog2[$i] = treat($tret[6]); // is used in generate break; case "cat": $blockno[$i] = treat($tret[4]); $starttext[$i] = treat($tret[5]); $prevtext[$i] = treat($tret[6]); $lasttext[$i] = treat($tret[7]); case "price": $prog1[$i] = treat($tret[4]); // not used in generat $prog2[$i] = treat($tret[5]); // is used in generate //$tail[$i] = treat($tret[5]); //echo "
$i. ".$prog2[$i]; //print_r($tret); break; case "num": default: $blockno[$i] = treat($tret[4]); if($tret[4] != ""){ $starttext[$i] = treat($tret[5]); $prevtext[$i] = treat($tret[6]); $nexttext[$i] = treat($tret[7]); $lasttext[$i] = treat($tret[8]); $stdtext[$i] = treat($tret[9]); $starttext2[$i] = treat($tret[10]); $prevtext2[$i] = treat($tret[11]); $nexttext2[$i] = treat($tret[12]); $lasttext2[$i] = treat($tret[13]); $prog1[$i] = treat($tret[14]); // not used in generat $prog2[$i] = treat($tret[15]); // is used in generate } } $res[$i] = $head[$i]; if ($formats[$type[$i]] < 1){ $formats[$type[$i]] = $i; } switch($type[$i]){ case "num": if ($temp_pub_prod > 0 ){ $incr = $types[$temp_pub_prod]['num2']; } elseif ($temp_glossary['incr'] > 0) { $incr = $temp_glossary['incr']; } $thispage = floor($fr / $incr)+1; if ($count%$incr == 0){ $lastpage = floor($count / $incr); } else { $lastpage = floor($count / $incr)+1; } if ($blockno[$i] > 0) { if ($fr > ($count-($blockno[$i]*$incr/2))){ $endpos = floor($count/$incr); $stpos = $endpos-$blockno[$i]; } else { $stpos = round(($fr/$incr) - ($blockno[$i]/2)); if ($stpos < 0){ $stpos = 0; } $endpos = $stpos + $blockno[$i]; } if ($stpos < 0){ $stpos = 0; $endpos = $stpos + $blockno[$i]; } if ($endpos > floor($count/$incr)-1) { $endpos = floor($count/$incr); if ($count % $incr == 0){ $endpos--; } } } else { $stpos = 0; $endpos = floor($count/$incr)-1; } if ($blockno[$i] == 1) { $endpos = $stpos;} for ($j=$stpos;$j<=$endpos;$j++){ if (($j-$stpos)%$num[$i]==0 && $j > $stpos) { $res[$i] .= "\n"; } $start = $j*$incr+1; $end = min($start +$incr-1,$sres_analysis['count']); $before =$gap; $after=$gap2; if($start == $fr) { if ($link != "" || $fullresults == true) { $before = $beforeimg; $after = $afterimg; } } if ($blockno[$i] > 0) { if ($j == $stpos){ if ($j == $stpos && $fr > 1){ $pageno = $starttext[$i]; if ($pageno != ""){ $itm = $body[$i]; $itm = str_replace("***link***",$link,$itm); $itm = str_replace("***pagetext***",$pageno,$itm); $itm = str_replace("***start***",1,$itm); $itm = str_replace("***end***",$incr,$itm); $itm = str_replace("***beforeimage***","",$itm); $itm = str_replace("***afterimage***","",$itm); $itm = str_replace("***pageno***",1,$itm); $res[$i] .= $itm; } $pageno = $prevtext[$i]; if ($pageno != ""){ $itm = $body[$i]; $itm = str_replace("***link***",$link,$itm); $itm = str_replace("***pagetext***",$pageno,$itm); $itm = str_replace("***start***",$fr-$incr,$itm); $itm = str_replace("***end***",$fr-1,$itm); $itm = str_replace("***beforeimage***","",$itm); $itm = str_replace("***afterimage***","",$itm); $itm = str_replace("***pageno***",$thispage-1,$itm); $res[$i] .= $itm; } } else { $pageno = $starttext2[$i]; if ($pageno != ""){ $itm = $body[$i]; $st = strpos($itm,"",$st)+1; $st3 = strpos($itm,"",$st)+1; $st3 = strpos($itm,"",$st)+1; $st3 = strpos($itm," 0) { $pageno = $j; if ($pageno == $endpos){ $laststart = (floor($count/$incr))*$incr+1; if ($laststart > $count){ $laststart = $count - $incr +1; } if ($start != $fr || $lastpage != $thispage){ // not last page selected or current page only $pageno = $nexttext[$i]; if ($pageno != ""){ $itm = $body[$i]; $itm = str_replace("***link***",$link,$itm); $itm = str_replace("***pagetext***",$pageno,$itm); $itm = str_replace("***start***",$fr+$incr,$itm); $ed =$fr+$incr+$incr-1; if ($ed > $count) { $ed = $count; } $itm = str_replace("***end***",$ed,$itm); $itm = str_replace("***beforeimage***","",$itm); $itm = str_replace("***afterimage***","",$itm); $itm = str_replace("***pageno***",$thispage+1,$itm); $res[$i] .= $itm; } $pageno = $lasttext[$i]; if ($pageno != ""){ $itm = $body[$i]; $itm = str_replace("***link***",$link,$itm); $itm = str_replace("***pagetext***",$pageno,$itm); $itm = str_replace("***start***",$laststart,$itm); $itm = str_replace("***end***", $count, $itm); $itm = str_replace("***beforeimage***","",$itm); $itm = str_replace("***afterimage***","",$itm); $itm = str_replace("***pageno***",$lastpage,$itm); $res[$i] .= $itm; } } else { $pageno = $nexttext2[$i]; if ($pageno != ""){ $itm = $body[$i]; $st = strpos($itm,"",$st)+1; $st3 = strpos($itm," $count) { $ed = $count; } $itm = str_replace("***end***",$ed,$itm); $itm = str_replace("***beforeimage***","",$itm); $itm = str_replace("***afterimage***","",$itm); $itm = str_replace("***pageno***",$thispage+1,$itm); $res[$i] .= $itm; } $pageno = $lasttext2[$i]; if ($pageno != ""){ $itm = $body[$i]; $st = strpos($itm,"",$st)+1; $st3 = strpos($itm,"0){ $res[$i] .= $itm; } } } $counter=1; break; case "filter": $thisct=0; // if ($cols[$i]>0){ // $res[$i]= $starttext[$i]; // } else { $res[$i]= ""; // } foreach($sres_analysis['filter'] as $ftyp => $tr){ $oktocont = true; if ($cols[$i] > 0 && $include[$i] != ""){ if ($subtype != "" && strtolower($subtype) != strtolower($ftyp)){ $oktocont = false; } if (strpos(",".$include[$i].",",",$ftyp,") === false){ $oktocont = false; } } if ($ftyp != "" && $tr != "" && $oktocont) { $cnt = 0; $thisct++; $res[$i] .= $head[$i]; $res[$i] = str_replace("***title***",sq($ftyp),$res[$i]); $res[$i] = str_replace("***urltitle***",urlencode(strtolower(sq($ftyp))),$res[$i]); $res[$i] = str_replace("***count***",$thisct,$res[$i]); $more = false; foreach($tr as $tar){ if ($cnt <= $num[$i] || $all){ if (!$all && $icols[$i] && $cnt>=$icols[$i]*$irows[$i]) { $more = true; break; } list($nm,$ct,$item1,$item2,$item3,$item4,$item5,$item6,$item7,$item8,$item9) = explode(":",$tar); // echo $nm; if($nm != ""){ $counter++; $cnt++; $nm = treat(treat($nm)); $itm = $body[$i]; $itm = str_replace("***urltitle***",urlencode(strtolower(sq($ftyp))),$itm); $itm = str_replace("***urlname***",urlencode(strtolower(sq($nm))),$itm); $itm = str_replace("***name***",sq($nm),$itm); $itm = str_replace("***item1***",$item1,$itm); $itm = str_replace("***item2***",$item2,$itm); $itm = str_replace("***item3***",$item3,$itm); $itm = str_replace("***item4***",$item4,$itm); $itm = str_replace("***item5***",$item5,$itm); $itm = str_replace("***item6***",$item6,$itm); $itm = str_replace("***item7***",$item7,$itm); $itm = str_replace("***item8***",$item8,$itm); $itm = str_replace("***item9***",$item9,$itm); $itm = str_replace("***count***",$ct,$itm); // $itm = str_replace("***id***",$id,$itm); $res[$i] .= $itm; if ($icols[$i] >0 && $cnt%$irows[$i] == 0){ $res[$i] .= $imidtext[$i]; } } } else { $more = true; break; } } if (!is_numeric($blockno[$i]) && $blockno[$i]!="" && $more && !$all){ $res[$i] .= $alttail[$i]; } else { $res[$i] .= $tail[$i]; } if ($cols[$i] >0 && $thisct%$cols[$i] ==0 && $include[$i] == ""){ $res[$i] .= $midtext[$i]; } $res[$i] = str_replace("***title***",sq($ftyp),$res[$i]); $res[$i] = str_replace("***urltitle***",urlencode(strtolower(sq($ftyp))),$res[$i]); if ($include[$i] != ""){ $ordres[$ftyp] = $res[$i]; $res[$i] = ""; } } if ($cols[$i] >0 && $thisct>=$cols[$i]*$rows[$i]){ break; } } if ($include[$i] != ""){ $res[$i]=""; $ord = explode(",",$include[$i]); $ct = 0; foreach ($ord as $it){ if ($ordres[$it] != ""){ $res[$i].=$ordres[$it]; $ct++; if ($cols[$i] >0 && $ct%$cols[$i]==0){ $res[$i] .= $midtext[$i]; } } } $ordres = ""; } if ($cols[$i]>0){ $res[$i]= $starttext[$i].$res[$i].$endtext[$i]; } break; case "cat": case "adv": case "title": case "brand": default: if ($starttext[$i]> 0){ $cols = $starttext[$i]; $rows= $prevtext[$i]; $hed = $nexttext[$i] ; $mid = $lasttext[$i] ; $tal = $stdtext[$i] ; if ($prog1[$i]== ""){ $prog1[$i] = $starttext2[$i]; $prog2[$i] = $prevtext2[$i]; } $num[$i] = $cols*$rows-1; $res[$i] .= $hed; } $counter = 0; $more=false; foreach($sres_analysis[$type[$i]."s"] as $tar){ if ($counter <= $num[$i] || $all){ list($nm,$ct,$id) = explode(":",$tar); if($nm != ""){ $counter++; $nm = str_replace("*c*",":",$nm); switch ($type[$i]){ case "adv": get_adv($nm); $nm = $adv_nm; $id = $adv_id; $pic1 = $adv_logo_img; $pic2 = $adv_logo2; $pic3 = $adv_logo3; break; case "cat": $catset = true; $id = $nm; get_wg_info($nm); $nm = $cat_name; $pic1 = $wg_img1; $pic2 = $wg_img2; $pic3 = $wg_img3; break; default: $nm = treat(treat(treat($nm))); } $itm = $body[$i]; $itm = str_replace("***name***",$nm,$itm); $itm = str_replace("***count***",$ct,$itm); $itm = str_replace("***img1***",sq($pic1),$itm); $itm = str_replace("***img2***",sq($pic2),$itm); $itm = str_replace("***img3***",sq($pic3),$itm); $itm = str_replace("***text***",urlencode(strtolower($nm)),$itm); $itm = str_replace("***pageid***",0,$itm); $itm = str_replace("***id***",$id,$itm); $res[$i] .= $itm; if ($cols> 0 && $counter%$cols==0){ $res[$i] .= $mid; } } } else { $more=true; break; } } if ($cols> 0 ){ $res[$i] .= $tal; } break; } if ($type[$i]!="filter"){ if (!is_numeric($blockno[$i]) && $blockno[$i]!="" && (!$more || $all)){ $res[$i] .= $blockno[$i]; } else { $res[$i] .= $tail[$i]; } } $res[$i] = str_replace("***type***",$type[$i],$res[$i]); $res[$i] = str_replace("***pound***","£",$res[$i]); $res[$i] = str_replace("***totalproducts***",$count,$res[$i]); $res[$i] = str_replace("***totalpages***",ceil($count/$incr),$res[$i]); $res[$i] = str_replace("***currentpage***",ceil($fr/$incr),$res[$i]); if ($linkedsearch){ $res[$i] = str_replace("***thescript***",$prog2[$i],$res[$i]); } else { $res[$i] = str_replace("***thescript***",$prog1[$i],$res[$i]); } if ($counter ==0){ $res[$i]=""; } } $result .= $res[$i]; } if (!$catset){ get_wg_info($sres_cat); } $result = str_replace("***sresid***",$sres_id,$result); $result = str_replace("***searchid***",$search_id,$result); return $result; } function analyze_results(){ global $analysis,$prod_filter,$myprod; $analysis['set'] =1; $analysis['total']['total']++; $analysis['brand'][strtolower(sq($myprod['brand']))]++; $analysis['title'][sq(str_replace(":","*c*",$myprod['name']))]++; $analysis['cat'][$myprod['pub_cat']]++; $analysis['adv'][$myprod['pub_adv']]++; $analysis['price']['incrs'][floor($myprod['price']/$analysis['price']['incr'])]++; if ($prod_price > $analysis['price']['high']){ $analysis['price']['high'] = $myprod['price']; } if ($prod_price < $analysis['price']['low']){ $analysis['price']['low'] =$myprod['price']; } } function complete_analysis(){ global $analysis,$types,$temp_live; if ($analysis['set']==1){ $analysis['price']['slots'] = $types[$temp_live]['num6']; $res .= "".$analysis['total']['total']; $res .= "".$analysis['price']['slots']; $res .= "".$analysis['price']['low']; $res .= "".$analysis['price']['high']; $res .= "".$analysis['price']['incr']; arsort($analysis['brand']); $res .= ""; foreach ($analysis['brand'] as $k => $br){ if ($k != ""){ $res .="$k:$br"; } } arsort($analysis['cat']); $res .= ""; foreach ($analysis['cat'] as $k => $br){ $res .="$k:$br"; } arsort($analysis['adv']); $res .= ""; foreach ($analysis['adv'] as $k => $br){ $res .="$k:$br"; } arsort($analysis['title']); $res .= ""; foreach ($analysis['title'] as $k => $br){ // if ($br> 1){ $res .="".sq($k).":$br"; // } else { // break; // } } $res .= ""; $res .= ""; ksort($analysis['price']['incrs']); foreach ($analysis['price']['incrs'] as $k => $br){ $res .="$k:$br"; } $res .= ""; } $analysis = $res; } function start_analysis($hi){ global $analysis,$search_filter,$types,$temp_live; $analysis = ""; $analysis['set'] =0; $num = $types[$temp_live]['num6']; switch ($hi){ case ($hi < $num *10): $rund = 0; break; case ($hi < $num *100): $rund = -1; break; case ($hi < $num *1000): $rund = -2; break; } $analysis['price']['incr'] = round($hi/$num,$rund); $analysis['price']['high'] = $hi; $analysis['price']['low'] = 0; for ($i=0;$i < $types[$temp_live]['num6'];$i++){ $analysis['price']['incrs'][$i] = 0; } if ($search_filter != ""){ $filters = explode(":::",$types[$search_filter]['alpha1']); foreach ($filters as $filter){ $i = explode(";;;",$filter); $typ = $i[0]; $fil = $i[1]; $cond = explode(",",$i[2]); foreach ($cond as $c){ $analysis['filter'][$typ][$fil][$c]=0; } } } } function get_url_searches($id){ $SQLstr = "select s.link_secondary_id as sresid from h_links as p, h_links as s where p.link_primary_id = $id and p.link_type='upg' and p.link_secondary_id =s.link_primary_id and s.link_type='pse'"; $result=MYSQL_QUERY($SQLstr); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $ret[] = $row["sresid"]; } return $ret; } ?>