Server IP : 51.89.169.208 / Your IP : 216.73.216.57 Web Server : Apache System : Linux ns3209505.ip-198-244-202.eu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Tue Nov 5 04:50:16 EST 2024 x86_64 User : yellowleaf ( 1019) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/yellowleaf/public_html/business/ |
Upload File : |
<? session_start(); $path = $_SERVER['DOCUMENT_ROOT']; include_once $path."/connect_db.php"; $category=ucwords(str_replace('-',' ',$_GET['category'])); $id=ucwords(str_replace('-',' ',$_GET['id'])); $url=ucwords(str_replace('-',' ',$_GET['url'])); // http://www.yellowleaf.co.uk/Indian-Restaurant/110071-ilford.html $q = $category.' '.$url; $title = ucwords($category); $q_words = explode(" ",strtolower($q)); $area = ucwords($url); $category = str_replace(' ',' +',$category); //echo $id; echo $url; $yadsq1 = $connect->query("SELECT * FROM locations WHERE `area_id`='{$id}' LIMIT 1") or die($connect->error); while($row = @$yadsq1->fetch_array()){ foreach( $row AS $key => $val ){ $$key = stripslashes( $val ); } $long=$area_lon; $lat=$area_lat; } if (!$area_id) {header('Location: http://www.yellowleaf.co.uk/'); die;} if ($url != $area_name) {header('Location: http://www.yellowleaf.co.uk/'); die;} $radius = 200; $kilometers=6371; // reference to calculate with kilometers $miles=3959; // reference to calculate with miles $query = "SELECT *, ( {$miles} * acos( cos( radians(' ".mysql_real_escape_string($lat)." ') ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(' ".mysql_real_escape_string($long)." ') ) + sin( radians(' ".mysql_real_escape_string($lat)." ') ) * sin( radians( latitude ) ) ) ) AS distance FROM ads WHERE MATCH (`companyname`,`description`,`services_offered`,`category_plural`,`products_plural`) AGAINST ('+{$category}' IN BOOLEAN MODE) AND `active`='1' HAVING distance < '".mysql_real_escape_string($radius)."' ORDER BY distance e LIMIT 20"; $query_result = $connect->query($query) or die($connect->error); $num_rows = $query_result->num_rows; while ($row = $query_result->fetch_array()){ $words_array=array();$filtered='';$word_pos=0;$last_pos=0; foreach($row as $a=>$b){$$a=$b;} $r_ad_name=strtolower($companyname); $r_ad_name = preg_replace("/[^A-Za-z 0-9]/", "", $r_ad_name); $r_ad_name=str_replace(" "," ",$r_ad_name); $ad_name=str_replace(" ","-",$r_ad_name); if (!$metadesc) {$metadesc = $companyname;} $content_data = "$companyname Listed in: $category $street1 $street2 $county_name $district_name $town_name $postcode $description $services_offered Areas covered: $areas_cover Products & Services offered: $products"; $content_data = preg_replace('/\s+/', ' ', $content_data); $split_words=explode(' ',$content_data); foreach($split_words as $single_word){ if(in_array(preg_replace('/[^a-zA-Z0-9]/','',strtolower($single_word)),$q_words)){ construct_array($word_pos); } $word_pos++; } foreach($words_array as $word_pos=>$a){ if(($word_pos-$last_pos)>1 && $word_pos && $last_pos){$filtered.='..';} $last_pos=$word_pos; $filtered.=$split_words[$word_pos].' '; } if(!$words_array[0]){$filtered='..'.$filtered;} $result .= '<div class="cn_shaddow sresult"> <table width="100%"> <tr> <td width="90" valign="top" style="text-align:center;padding:17px 4px;"> <div style="width:125px;height:125px;overflow:hidden;"> '; if($row['image']!=''){ $result .= '<img width="300" style="margin-left:-80px" src="/members/uploads/logo/'.$row['image'].'">'; }else{ $result .= '<img width="125" src="/img/no_logo.png">'; } $result .= '</div>'; $filtered = str_replace(" || "," ",$filtered); if ($filtered == "..") { $addtitle=" $q"; $subDesc=substr($description,0,200); if(strlen($str)<200){$filtered=$subDesc.'...'; } else {$filtered=$description;} } if (strlen($filtered) > 800) {$filtered = substr($filtered,0,800);} $fulladd = "$street1 $street2 $town_name $county_name"; if(preg_match("/$area_name/i", $fulladd) == TRUE){ $servtown_name = " Serving $area_name"; } else { $servtown_name = "";} $result .= '</td><td valign="top" style="padding:10px;"> <div style="padding-top:0px;margin-bottom:5px; float:right; font-size:11pt;color:#DA9A05;"><b>'.$tel.'</b></div> <a style="font-size:15pt;" href="/pages/'.$adid.'-'.$ad_name.'.html">'.$row['companyname'].''.$addtitle.''.$servtown_name.'</a> <div style="padding-top:5px;font-size:10pt;color:#008000;"><b>Approx. '.round($row['distance'], 1).' mi. from '.$area.', '.$area_county.' UK.</b></div> <div style="margin:5px 0px;color:#666;font-size:10pt;">'.highlightWords($filtered,$q).'..</div></td></tr> </table></div>'; $addtitle=''; } // for menu top bar - start $today_date=date('l jS F Y'); if(isset($_SESSION['ename'])||isset($_COOKIE['yl_user'])){ $loggedin_nav.='<a href="/members">Members Area</a>'; }else{ $loggedin_nav.='<a href="/login">Login</a>'; $loggedin_nav.='<a href="/advertise">Advertise</a>'; } // for menu top bar - end // floating advertise button on right if(isset($_SESSION['ename'])||isset($_COOKIE['yl_user'])){$yleaf_url='/members/';}else{$yleaf_url='/advertise/';} $provided_by_btn='<a style="border:0px;outline:none;" href="'.$yleaf_url.'"> <img src="/img/providedby.png" onmouseover="this.src=\'/img/providedby_hover.png\'" onmouseout="this.src=\'/img/providedby.png\'" style="border:0;outline:none;"> </a>'; if (!$suggest) {$suggest ="Currently no suggestions available for <b>$title</b> near <b>$area</b>."; } $tplbody= file_get_contents("category_tpl.html"); $footer= file_get_contents("../footer.php"); $search_box = file_get_contents("../search_box2.php"); include_once('../top_bar2.php'); $tplbody = str_replace("{top_bar}", "$top_bar", $tplbody); $tplbody = str_replace("{provided_by_btn}", "$provided_by_btn", $tplbody); $tplbody = str_replace("{footer}", "$footer", $tplbody); $tplbody = str_replace("{metadesc}", $metadesc, $tplbody); $tplbody = str_replace("{title}", $title, $tplbody); $tplbody = str_replace("{area}", $area, $tplbody); $tplbody = str_replace("{page_no}", $page_no, $tplbody); $tplbody = str_replace("{search_box}", $search_box, $tplbody); $tplbody = str_replace("{results}", $result, $tplbody); $tplbody = str_replace("{pagin_prev}", $pagin_prev, $tplbody); $tplbody = str_replace("{pagin_next}", $pagin_next, $tplbody); $tplbody = str_replace("{county}", "$area_county", $tplbody); $tplbody = str_replace("{murl}", "$murl", $tplbody); $tplbody = str_replace("{type}", "$cattype", $tplbody); $tplbody = str_replace("{area_found}", "$area_found", $tplbody); $tplbody = str_replace("{longlat}", "$longlat", $tplbody); $tplbody = str_replace("{suggest}", $suggest, $tplbody); $outputline = split("\n",$tplbody); foreach ($outputline as $line) { if (trim($line)) { echo trim($line); echo " "; } } function highlightWords($string, $q) { $words=explode(' ',$q); foreach ( $words as $word ) { $word=trim(quotemeta(stripslashes($word))); $color_pos=1; $string = preg_replace('#([^a-zA-Z0-9])('.$word.')([^a-zA-Z0-9])#Usi', '\1<b>\2</b>\3', $string); $color_pos++; } return $string; } function construct_array($pos){ global $words_array; $words_include=15; for ($i=$words_include;$i>0;$i--) { if(($pos-$i)>=0){$words_array[$pos-$i]=1; } } $words_array[$pos]=1; for ($i=1;$i<=$words_include;$i++) { $words_array[$pos+$i]=1; } } ?>