<?php
ob_start();
include_once("includes/application.php");
$cond4="";
$incHTML="";
$incFILE="";
$incRIGHTHTML="";
$incRIGHTFILE="";
$incLEFTHTML="";
$incLEFTFILE="";
$incMSFFILE=""; // MOST SEARCH FILE
$incHTML="";
$incFILE="";
$banFILE="";
$meta_keywords="";
$navtype="";
$navtype2="";
//$page_desc=$cstuff_query_rows['ldescription'];
//$description=$category_query['description'];
$page_title = "";
$page_desc = "";
$page_keywords = "";
$description="Page Under Construction...";
/***************************************************/
if(!empty($_REQUEST['mod_option'])){
$menuclass=1;
$banjara_add = "Banjara Hills, Hyderabad";
$most_searched = '';
/*1**************************************************/
// subcat, cat, yellowpage, view
if($_REQUEST['mod_option']=="cat"){
	$navtype = "Restraunts";
	if(!empty($_GET['area'])){
		bh_area_name();
		$area = " At ".$area_name[$_GET['area']];
	}else{
		$area = '';
	}
	
	$page_title		= getdata("bh_yellowpagesubcat","name","id='".$_GET['subcat']."'").$area." in ".$banjara_add;
	$page_desc		= "";
	$page_keywords	= "";
	
	$rightincFILE	= "modules/right.php";
 	$incLEFTFILE	= "modules/left.php";
	$most_searched	= 'yes';
	$incFILE		= "modules/yp_all_listings.php";
}
/*2**************************************************/
if($_REQUEST['mod_option']=="classified_sub_cat"){
$navtype="menu";
if(!empty($_GET['yp_cid'])) {
yp_cat_details();
$title=$yp_cat_name[$_GET['yp_cid']];
$navigation="<table border='0' cellspacing='0' cellpadding='0'>
  <tr>
    <td><a href='".$siteurl."Yellowpages' class='dlinks'>Yellowpages</a></td>
    <td class='search-div'><a href='#nogo'></a></td>
    <td class='orng'>".$title."</td>
  </tr>
</table>";
$page_title=$title." in ".$banjara_add;
}else{
if(!empty($_GET['area'])){
bh_area_name();
$area=" At ".$area_name[$_GET['area']];
}else{ $area=''; }
$title=getdata("bh_clsf_category","cat_name","id='".$_GET['cid']."'");
$navigation="<table border='0' cellspacing='0' cellpadding='0'>
  <tr>
    <td><a href='".$siteurl."Classifieds' class='dlinks'>Classifieds</a></td>
    <td class='search-div'><a href='#nogo'></a></td>
    <td class='orng'>".$title."</td>
  </tr>
</table>";
$page_title=$title." in ".$banjara_add;
}
	$rightincFILE="modules/right.php";
	$incFILE="modules/class_sc.php";
	$most_searched="yes";
}
/*3**************************************************/
if($_REQUEST['mod_option']=="more-sub-cats"){
$navtype="menu";
if(!empty($_GET['scat_id']) && $_GET['scat_id']==6){
	$navigation="Yellowpages";
	$rightincFILE="modules/right.php";
	$page_title="Yellowpages in ".$banjara_add;
	
}elseif(!empty($_GET['scat_id']) && $_GET['scat_id']==5){
	$navigation="Classifieds";
	$rightincFILE="modules/right.php";
	$page_title="Classifieds in ".$banjara_add;
	
}elseif(!empty($_GET['scat_id']) && $_GET['scat_id']==4){
	$navigation="Malls";
	$rightincFILE="modules/right.php";
	$page_title="Malls in ".$banjara_add;
	
}else{
	yp_cat_details();
	$navigation=$yp_cat_name[$_GET['scat_id']];
	$rightincFILE="modules/right.php";
	$page_title=$yp_cat_name[$_GET['scat_id']]." in ".$banjara_add;
}
$incFILE="modules/more_sub_cat.php";
$most_searched='yes';
}
/*4**************************************************/
if($_REQUEST['mod_option']=="service"){
$navtype="menu";
$navigation="More Services";
if(!empty($_GET['start'])){ $start=$_GET['start']; }else{ $start=0; }
$len=9;
bh_area_name();
if(!empty($_GET['sub_area'])){
	$area=" At ".$area_name[$_GET['sub_area']];
	$page_title=$area." in ".$banjara_add;
	$navigation=$area_name[$_GET['sub_area']];
	$link_name="Services/sub-area/p/".$_GET['sub_area']."/".SafeURL($area_name[$_GET['sub_area']]);
	$link=$siteurl.$link_name;
}else{ $area=''; 
	$cat_name=GetData("bh_services_category","cat_name","id='".$_GET['service_cat_id']."'");
	$page_title=SafeURL($cat_name).$area." in ".$banjara_add;
	$navigation=$cat_name;
	$bcat_name=SafeURL($cat_name);
	$link_name="Services/p/".$bcat_name."/".$_GET['service_cat_id'];
	$link=$siteurl.$link_name;
}
	$rightincFILE="modules/right.php";
	$incLEFTFILE="modules/services_left.php";
	$most_searched='yes';
	$incFILE="modules/services.php";
}
/*5**************************************************/
if($_REQUEST['mod_option']=="service-details"){
$navtype="menu";bh_area_name();
$navigation="More Services";
$sql=$db->query("SELECT service_name,cat_id,area,sub_area FROM `bh_services` where status=1 and sid=".$_GET['sid']."");
$num=$db->numRows($sql);
$row=$db->fetchArray($sql);
$page_title=$row['service_name']." At ".trim(str_replace("Banjara Hills","",$area_name[$row['area']])).", ".$area_name[$row['sub_area']].", ".$banjara_add;
$cat_name=GetData("bh_services_category","cat_name","id=".$row['cat_id']."");
$navigation="<table border='0' cellspacing='0' cellpadding='0'>
  <tr>
    <td><a href='".$siteurl."Services/".$row['cat_id']."/".str_replace(" ","-",$cat_name)."' class='dlinks'>".$cat_name."</a></td>
    <td class='search-div'><a href='#nogo'></a></td>
    <td class='orng'>".$row['service_name']."</td>
  </tr>
</table>";
	$rightincFILE="modules/right.php";
	$incFILE="modules/services_detail.php";
	$most_searched='yes';
}
/*6**************************************************/
if($_REQUEST['mod_option']=="moreservices"){
$navtype="menu";
$navigation="More Services";
	$rightincFILE="modules/right.php";
	$page_title="More Services in ".$banjara_add;
	$incFILE="modules/more_services.php";
	$most_searched='yes';
}
/*7**************************************************/
if($_REQUEST['mod_option']=="classifieds"){
$navtype="menu";
if(!empty($_GET['start'])){ $start=$_GET['start']; }else{ $start=0; }
	$len=15;
	$link_name="classifieds/pc";
	$link=$siteurl.$link_name;
	$navigation="Classifieds";
	$rightincFILE="modules/right.php";
	$page_title="Classifieds in ".$banjara_add;
	$incFILE="modules/classifieds.php";
	$most_searched='yes';
}
/*8**************************************************/
if($_REQUEST['mod_option']=="all-classifieds"){
cf_sub_cat_details();cf_cat_details();bh_area_name();
if(!empty($_GET['start'])){ $start=$_GET['start']; }else{ $start=0; }
$len=10;
if(!empty($_GET['sub_area_id'])){
$link_name="";
$link=$siteurl.$link_name;
$navtype="menu";
$navigation="<table border='0' cellspacing='0' cellpadding='0'>
  <tr>
    <td><a href='".$siteurl."Classifieds' class='dlinks'>Classifieds</a></td>
    <td class='search-div'><a href='#nogo'></a></td>
    <td class='orng'>".$area_name[$_GET['sub_area_id']]."</td>
  </tr>
</table>";
$page_title="Classifieds in ".$area_name[$_GET['sub_area_id']]." At ".$banjara_add;
}else{
$link_name="".SafeURL($cf_cat_name[$_GET['cid']])."/clc".$_GET['cid']."/cls".$_GET['sc_id']."/".SafeURL($cf_sub_cat_name[$_GET['sc_id']])."/p";
$link=$siteurl.$link_name;
$navtype="menu";
$navigation="<table border='0' cellspacing='0' cellpadding='0'>
  <tr>
    <td><a href='".$siteurl."Classifieds' class='dlinks'>Classifieds</a></td>
    <td class='search-div'><a href='#nogo'></a></td>
    <td class='orng'>".$cf_sub_cat_name[$_GET['sc_id']]."</td>
  </tr>
</table>";
$page_title="Classifieds in ".$cf_sub_cat_name[$_GET['sc_id']]." At ".$banjara_add;
}
	$rightincFILE="modules/right.php";
	$incLEFTFILE="modules/class_left.php";
	$incFILE="modules/view_classifieds.php";
	$most_searched='yes';
}
/*9**************************************************/
if($_REQUEST['mod_option']=="classifieds-details"){
$navtype="menu";
cf_sub_cat_details();cf_cat_details();
$sql=$db->fetchArray($db->query("select * from bh_classifieds where id=".$_GET['cid']."")); 
$navigation=$sql['title'];
$navigation="<table border='0' cellspacing='0' cellpadding='0'>
  <tr>
    <td><a href='".$siteurl."Classifieds' class='dlinks'>Classifieds</a></td>
    <td class='search-div'><a href='#nogo'></a></td>
    <td><a href='".$siteurl."".str_replace(" ","-",$cf_cat_name[$sql['cat_id']])."/clc".$sql['cat_id']."/cls".$sql['sub_cat_id']."/".str_replace(" ","-",$cf_sub_cat_name[$sql['sub_cat_id']])."' class='dlinks'>".$cf_sub_cat_name[$sql['sub_cat_id']]."</a></td>
    <td class='search-div'><a href='#nogo'></a></td>
    <td class='orng'>".$sql['title']."</td>
  </tr>
</table>";
	$rightincFILE="modules/right.php";
	$page_title=$sql['title']." in ".$banjara_add;
	$incFILE="modules/classifieds_details.php";
	$most_searched='yes';
}
/*10**************************************************/
if($_REQUEST['mod_option']=="classifieds-search"){
cf_sub_cat_details();cf_cat_details();bh_area_name();
if(!empty($_GET['start'])){ $start=$_GET['start']; }else{ $start=0; }
$len=10;
$link_name="classified-search";
$link=$siteurl.$link_name;
$navtype="menu";
$navigation="<table border='0' cellspacing='0' cellpadding='0'>
  <tr>
    <td><a href='".$siteurl."Classifieds' class='dlinks'>Classifieds</a></td>
    <td class='search-div'><a href='#nogo'></a></td>
    <td class='orng'>Search Classifieds</td>
  </tr>
</table>";
	$page_title="Search Classifieds in ".$banjara_add;
	$rightincFILE="modules/right.php";
	$incFILE="modules/search_classifieds.php";
	$most_searched='yes';
}
/*11**************************************************/
if($_REQUEST['mod_option']=="Malls"){
	$navtype="menu";
	bh_area_name();
	get_mall();
	
	if(!empty($_GET['sub_area'])){
		$area=" At ".$area_name[$_GET['sub_area']];
		$page_title=$area." in ".$banjara_add;
		$navigation=$area_name[$_GET['sub_area']];
		$link_name="Services/p/".$_GET['sub_area'];
	}else{
		$area=''; 
		$cat_name=GetData("bh_mall","mall_name","mall_id='".$_GET['mall_id']."'");
		$page_title=$cat_name.$area." in ".$banjara_add;
		$navigation=$cat_name;
		$link_name="Malls/p/".SafeURL($cat_name)."/".$_GET['mall_id'];
	}
	
	if(!empty($_GET['start'])){ $start=$_GET['start']; }else{ $start=0; }
	$len=9;
	$page_desc = substr($mall_description[$_GET['mall_id']],0,150);
	$link = $siteurl.$link_name;
	$rightincFILE="modules/right.php";
	$incFILE="modules/malls.php";
	$most_searched='yes';
}
/*12**************************************************/
if($_REQUEST['mod_option']=="morelist"){
$cml='';
if($_GET['type']=="Food-And-Nightlife"){ $cml="Food &amp; Nightlife"; } else if($_GET['type']=="Health-And-Beauty"){ $cml="Health &amp; Beauty"; }else if($_GET['type']=="Shopping"){ $cml="Shopping "; }
	
	$navtype="menu";
	$navigation=$cml;
	$rightincFILE="modules/right.php";
	$page_title=$cml." Category List";
	$incFILE="modules/yp_morelist.php";
}
/*13**************************************************/
if($_REQUEST['mod_option']=="allsearch"){
	bh_area_name();
	$navtype="menu";
	$navigation="All Search List";
	$rightincFILE="modules/right.php";
	$incFILE="modules/yp_all_searchlist.php";
	$most_searched='yes';
}
/*14**************************************************/
if($_REQUEST['mod_option']=="banjarahills"){
$row=$db->fetchArray($db->query("select `title`,`id`,`meta_description`, `code`,`description` from  bh_cms where id=".$_GET['i'])); 
$page_title=$row['title']." | ".$banjara_add;
	$rightincFILE="modules/right.php";
	$incFILE="modules/bh_disclaimer.php";
}
/*15**************************************************/
if($_REQUEST['mod_option']=="yellowpage"){
	$navtype = "menu";
	bh_area_name();
	yp_sub_cat_details();
	$sql = $db->fetchArray($db->query("select business_name,busi_desc,yp_area,cat,search_tag from bh_yellowpages where y_id=".$_GET['i'])); 
	
	if(!empty($area_name[$sql['yp_area']])){
		$road_no=str_replace("Banjara Hills","",$area_name[$sql['yp_area']]);
		}else{
		$road_no='';
	}
	
	if(!empty($_GET['sc_id'])){
		$cat_no=$yp_sub_cat_name[$_GET['sc_id']]." in ";
		}else{
		$cat_no='';
	}
	
	$page_title		= $sql['business_name']." | ".$cat_no.$road_no." ".$banjara_add;
	$page_desc		= substr($sql['busi_desc'],0,150);
	$page_keywords	= $sql['search_tag'];
	
	$rightincFILE	= "modules/right.php";
	$incFILE		= "modules/yellowpage.php";
	$most_searched	= 'yes';
}
/*16**************************************************/
if($_REQUEST['mod_option']=="Yellowpages"){
$navtype="menu";
$navigation="Yellowpages";
bh_area_name();yp_sub_cat_details();
	$page_title="Yellowpages in ".$banjara_add;
	$page_desc = "";
	$page_keywords = "";
	$rightincFILE="modules/right.php";
	$incFILE="modules/yellowpages_main.php";
	$most_searched='yes';
}
/*17**************************************************/
if($_REQUEST['mod_option']=="yellowpages-search"){
cf_sub_cat_details();cf_cat_details();bh_area_name();
if(!empty($_GET['start'])){ $start=$_GET['start']; }else{ $start=0; }
$len=10;
$link_name="yellowpage-search";
$link=$siteurl.$link_name;
$navtype="menu";
$navigation="<table border='0' cellspacing='0' cellpadding='0'>
  <tr>
    <td><a href='".$siteurl."Yellowpages' class='dlinks'>Yellowpages</a></td>
    <td class='search-div'><a href='#nogo'></a></td>
    <td class='orng'>Search Yellowpages</td>
  </tr>
</table>";
	$page_title="Search Yellowpages in ".$banjara_add;
	$rightincFILE="modules/right.php";
	$incFILE="modules/search_yellowpages.php";
	$most_searched='yes';}
/*18**************************************************/
if($_REQUEST['mod_option']=="yp_list"){
$db->query("insert into yp_list(yp_id,yp_name,userid,date_added) values('".$_GET['id']."','".$_GET['name']."','".$_SESSION['userid']."',now())");
header('location:index.php?mod_option=yellowpage&i='.$_GET['id']);
}
/*19**************************************************/
if($_REQUEST['mod_option']=="myaccount"){
$navtype="menu";
$navigation="My Account";
include_once("login_chk.php");
	$page_title="My Account in ".$banjara_add;
	$incLEFTFILE="modules/user_left.php";
	$incFILE="modules/myacc.php";
}
/*20**************************************************/
if($_REQUEST['mod_option']=="myreviews"){
include_once("login_chk.php");
	$page_title="Myreviews ";
	$navtype="menu";
	$navigation="My Reviews";
	$incLEFTFILE="modules/user_left.php";
	$incFILE="modules/myreviews.php";
}
/*21**************************************************/
if($_REQUEST['mod_option']=="deals"){
	$navtype="menu";
	$navigation="Deals";
	yp_details();bh_area_name();
	if(!empty($_GET['start'])){ $start=$_GET['start']; }else{ $start=0; }
	$len=6;
if(!empty($_GET['area_yid'])){
	$link_name="loc-deals/".$_GET['area_yid'];
	$page_title="Deals in ".$area_name[$yp_id_by_area[$_GET['area_yid']]]." At ".$banjara_add;
	}else{
	$link_name="deals"; $page_title="Find Best Offers and Deals, Discount Coupons"." in ".$banjara_add;
	}
	
	$link=$siteurl.$link_name;
	$incLEFTFILE="modules/deals_left.php";
	$rightincFILE="modules/right.php";
	$incFILE="modules/deals.php";
}
/*22**************************************************/
if($_REQUEST['mod_option']=="events"){
$navtype="menu";
$navigation="Events";
bh_area_name();
if(!empty($_GET['start'])){ $start=$_GET['start']; }else{ $start=0; }
$len=10;
$link="index.php?mod_option=events&a=a";
$page_title="Events in ".$banjara_add;
	$incLEFTFILE="modules/ev_left.php";
	$rightincFILE="modules/calen.php";
	$incFILE="modules/events.php";
}
/*23**************************************************/
if($_REQUEST['mod_option']=="event-details"){
yp_details();
$date=date("Y-m-d");
$navtype="menu";
$bs_navigation="Events";
bh_area_name();	
if(!empty($_GET['start'])){ $start=$_GET['start']; }else{ $start=0; }
$len=6;
$link="index.php?mod_option=event-details&eid=".$_GET['eid']."&a=a";
$evd_sel=$db->query("select * from bh_events where event_id=".$_GET['eid']." and status=1 and (ev_st_date>='".$date."' or ev_end_date>='".$date."')");
$evd_count=$db->numRows($evd_sel);
$sql=$db->fetchArray($evd_sel); 
$page_title=$sql['event_title']." in ".$banjara_add;
$page_desc=substr($sql['ev_description'],0,150);
	$rightincFILE="modules/calen.php";
	$incFILE="modules/event_details.php";
}
/*24**************************************************/
if($_REQUEST['mod_option']=="events-search"){
$navtype="menu";
$navigation="Events";
bh_area_name();
if(!empty($_GET['start'])){ $start=$_GET['start']; }else{ $start=0; }
$len=24;
$link="index.php?mod_option=events-search&a=a&y=".$_GET['y']."&m=".$_GET['m']."&d=".$_GET['d']."";
	$page_title="Events in ".$banjara_add;
	$incLEFTFILE="modules/ev_left.php";
	$rightincFILE="modules/calen.php";
	$incFILE="modules/events_show.php";
}
/*25**************************************************/
if($_REQUEST['mod_option']=="business"){
include_once("login_chk.php");
$navtype="menu";
if(!empty($_GET['yid'])){ $f_type="Edit"; }else{ $f_type="Add"; }
$navigation=$f_type." Business";
$page_title=$f_type." Business in ".$banjara_add;
if(!empty($_GET['yid'])){
$bu_sel=$db->query("select * from  bh_yellowpages where y_id=".$_GET['yid']."");
$bu_row=$db->fetchArray($bu_sel);
$wrow=$db->fetchArray($db->query("select * from yp_working_hours where y_id='".$_GET['yid']."'"));
}
/*26**************************************************/
if($_SERVER['REQUEST_METHOD']=="POST" && isset($_POST['step1_hid'])){
$ex="";
$sub_cat_multi_values='';
		
	if(!empty($_GET['yid'])){$web_url=$_POST['web_url']; }else{ $web_url=$_POST['url_http'].$_POST['web_url'];}
	if(!empty($_GET['yid'])){$fb_url=$_POST['fb_url']; }else{ $fb_url=$_POST['url_http'].$_POST['fb_url'];}
	if(!empty($_GET['yid'])){$yt_url=$_POST['yt_url']; }else{ $yt_url=$_POST['url_http'].$_POST['yt_url'];}
	if(!empty($_GET['yid'])){$tw_url=$_POST['tw_url']; }else{ $tw_url=$_POST['tw_url'].$_POST['tw_url'];}
		
	if(!empty($_POST['y_subcat'])){
	$sub_cat_multi_values=implode(",",$_POST['y_subcat']);
	}
	 if(!empty($_POST['map_loc']) && $_POST['map_loc']!="Please Copy and Paste  Map location Code"){ $map_loc=$_POST['map_loc']; }else{ $map_loc=''; }
$error_type="";	$error="";
$yr=date("Y");
$cmp_date=date("M");
$folder="uploads/yp_uploads/".$yr;
// for creating Year wise folder here if it exists comes out from loop
if(!file_exists($folder)){
$catdir=@mkdir($folder);
chmod($folder,0777);
} //end of year folder
$sub_folder="uploads/yp_uploads/".$yr."/".$cmp_date;
// for creating month wise folder here, if it exists comes out from loop
if(!file_exists($sub_folder)){
$catdir=@mkdir($sub_folder);
chmod($sub_folder,0777);
}
	
if($_FILES["img"]["size"]>0){
	$filetype=strstr($_FILES["img"]["name"],'.');
	if($filetype!='.jpeg' && $filetype!='.JPEG' && $filetype!='.jpg' && $filetype!='.JPG' && $filetype!='.GIF' && $filetype!='.gif' && !empty($filetype)){
	$error_type="Please Upload .jpg or .jpeg or .Gif Files Only"; 
}
		$qq=getimagesize($_FILES['img']['tmp_name']);
		 $width=$qq[0];
		 $height=$qq[1];
		if(($width>150 && $height>150) && ($width<1024 && $height<1024))
		    { 
			    $v_path =$sub_folder; 
 				if(!empty($bu_row['yp_image']) && !empty($_GET['yid'])){ unlink(substr($bu_row['yp_image'],3)); }
 			    $v_pht= AddFiles($v_path);
				if(!empty($v_pht[0][0])) 
				 $v_imgpath = @$v_pht[0][0]; 
				 $v_imgpath='../'.$v_imgpath;
 	        }else{ 
			$error="Sorry You Cannot Upload Image size Less Than 150 x 150 And More Than 1024 x 1024";}
	       }else{
				 $v_imgpath=$_POST['old_img'];
			}
 	
	if(empty($error_type) && (empty($error))) {
		if(!empty($_GET['yid'])){	
		yp_details();
			 if(!empty($_POST['y_cat'])){ $pos="`cat`='".$_POST['y_cat']."' ,`subcat`='".$sub_cat_multi_values."', "; }
			 $up="UPDATE `bh_yellowpages` SET ".$pos." `business_name` = '".bsr_rep_spl_char(remove_slashes($_POST['businessname']))."',
														`busi_desc` = '".bsr_rep_spl_char(remove_slashes($_POST['desc']))."',
														`phno1` = '".$_POST['ph1']."', 
														`phno2` = '".$_POST['ph2']."',
														`email_add` = '".$_POST['email']."',
														`landmark` = '".$_POST['landmark']."',
														`yp_url` = '".$web_url."',
														`facebook_url` = '".$fb_url."',
														`youtube_url` = '".$yt_url."',
														`twitter_url` = '".$tw_url."',
														`yp_fax` = '".$_POST['fax']."',
														`yp_maplocation` = '".bsr_rep_spl_char($map_loc)."',
														`yp_image`='".$v_imgpath."',
														`yp_area` = '".$_POST['yp_area']."',
														`yp_sub_area` = '".$_POST['sub_area']."',
														`yp_add1` = '".bsr_rep_spl_char(remove_slashes($_POST['ad1']))."',
														`yp_add2` = '".bsr_rep_spl_char(remove_slashes($_POST['ad2']))."',
														`yp_city` = '".$_POST['city']."',
														`yp_zipcode` = '".$_POST['pin']."',
														`working_hours`='".$_POST['work_hours']."'
														 WHERE y_id=".$_GET['yid'];
 		$qury=$db->query($up);
		if($_POST['work_hours']==1){
		if(!empty($_POST['mon_check'])) { $mon=$_POST['mon_check']; }else{ $mon="";}
		if($mon!=""){ $mon_am=$_POST["mon_am"];  $mon_pm=$_POST["mon_pm"]; }else{ $mon_am=""; $mon_pm="";}
		
		if(!empty($_POST['tues_check'])){ $tue=$_POST['tues_check']; }else{ $tue="";}
		if($tue!=""){ $tue_am=$_POST["tues_am"]; $tue_pm=$_POST["tues_pm"]; }else{ $tue_am=""; $tue_pm="";}
		
		if(!empty($_POST['wed_check'])) { $wed=$_POST['wed_check']; }else{ $wed="";}
		if($wed!=""){ $wed_am=$_POST["wed_am"]; $wed_pm=$_POST["wed_pm"]; }else{ $wed_am=""; $wed_pm="";}
		
		if(!empty($_POST['thur_check'])){ $thu=$_POST['thur_check']; }else{ $thu="";}
		if($thu!=""){ $thu_am=$_POST["thur_am"]; $thu_pm=$_POST["thur_pm"]; }else{ $thu_am=""; $thu_pm="";}
		
		if(!empty($_POST['fri_check'])) { $fri=$_POST['fri_check']; }else{ $fri="";}
		if($fri!=""){ $fri_am=$_POST["fri_am"]; $fri_pm=$_POST["fri_pm"]; }else{ $fri_am=""; $fri_pm="";}
		
		if(!empty($_POST['sat_check'])) { $sat=$_POST['sat_check']; }else{ $sat="";}
		if($sat!=""){ $sat_am=$_POST["sat_am"]; $sat_pm=$_POST["sat_pm"]; }else{ $sat_am=""; $sat_pm="";}
		
		if(!empty($_POST['sun_check'])) { $sun=$_POST['sun_check']; }else{ $sun="";}
		if($sun!=""){ $sun_am=$_POST["sun_am"]; $sun_pm=$_POST["sun_pm"]; }else{ $sun_am=""; $sun_pm="";}
			  $wk_cnt=GetIdName("yp_working_hours","count(*)","y_id=".$_GET['yid']);
		if($wk_cnt>0){
				$wup="update `yp_working_hours` SET mon='".$mon_am."',mon_et='".$mon_pm."', thue='".$tue_am."',thue_et='".$tue_pm."',wed='".$wed_am."',wed_et='".$wed_pm."',thur='".$thu_am."',thur_et='".$thu_pm."', fri='".$fri_am."',fri_et='".$fri_pm."',sat='".$sat_am."',sat_et='".$sat_pm."',sun='".$sun_am."',sun_et='".$sun_pm."',mon_wr='".$mon."',thue_wr='".$tue."',wed_wr='".$wed."',thur_wr='".$thu."',fri_wr='".$fri."',sat_wr='".$sat."',sun_wr='".$sun."' where y_id=".$_GET['yid']."";
				$qury1=$db->query($wup);  
		   } else { 
				 $wk_hrs=$db->query("insert into `yp_working_hours`(`y_id`,`mon`,`mon_et`,`thue`,`thue_et`,`wed`,`wed_et`,`thur`,`thur_et`,`fri`,`fri_et`,`sat`,`sat_et`,`sun`,`sun_et`,`status`,`mon_wr`,`thue_wr`,`wed_wr`,`thur_wr`,`fri_wr`,`sat_wr`,`sun_wr`) VALUES ('".$_GET['yid']."','".$mon_am."','".$mon_pm."','".$tue_am."','".$tue_pm."','".$wed_am."','".$wed_pm."','".$thu_am."','".$thu_pm."','".$fri_am."','".$fri_pm."','". $sat_am."',
				 '".$sat_pm."','".$sun_am."','".$sun_pm."','1','".$mon."','".$tue."','".$wed."','".$thu."','".$fri."','".$sat."','".$sun."')");  }
		} else { 
		$wk_up=$db->query("update `yp_working_hours` SET mon=0,mon_et=0, thue=0,thue_et=0,wed=0,wed_et=0,thur=0,thur_et=0, fri=0,fri_et=0,sat=0,sat_et=0,sun=0,sun_et=0,mon_wr=0,thue_wr=0,wed_wr=0,thur_wr=0,fri_wr=0,sat_wr=0,sun_wr=0 where y_id=".$_GET['yid']."");
		}	header("location:".$siteurl."Yellowpage-Manage/".$_GET['yid']."/".str_replace(" ","-",$yp_name[$_GET['yid']])."");
		 }else{
		
		   $in="INSERT INTO `bh_yellowpages` (`y_id`, `cat`, `subcat`, `parent_id`, `business_name`,`yp_area`,`yp_sub_area`,`yp_image`,
							 `phno1`, `phno2`,  `email_add`,yp_maplocation, 
							`yp_add1`, `yp_add2`, `yp_city`,`yp_zipcode`,   
							 `yp_adduser`, `status`, `date_added`,
							 `working_hours`,`landmark`,
							 `l_direction`,`busi_desc`,`yp_url`,`facebook_url`,`youtube_url`,`twitter_url`,`yp_fax`) VALUES 
							 
							 (NULL, '".$_POST['y_cat']."', '".$sub_cat_multi_values."', '0', 
							 '".bsr_rep_spl_char($_POST['businessname'])."','".$_POST['yp_area']."', '".$_POST['sub_area']."', '".$v_imgpath."', '".$_POST['ph1']."', '".$_POST['ph2']."',  '".$_POST['email']."', '".$map_loc."',
								 '".$_POST['ad1']."', '".$_POST['ad2']."', '".$_POST['city']."',
								'".$_POST['pin']."',  '".$_SESSION['userid']."', '1', now(),'".$_POST['work_hours']."', '".bsr_rep_spl_char($_POST['landmark'])."', '".$_POST['ld1']."','".bsr_rep_spl_char($_POST['desc'])."','".$web_url."','".$fb_url."','".$yt_url."','".$tw_url."','".$_POST['fax']."')";
							   
		$insetid=$db->insert($in);
							   
		if($_POST['work_hours']==1){ 
				if(!empty($_POST['mon_check'])) { $mon=$_POST['mon_check']; }else{ $mon="";}
				if($mon!=""){ $mon_am=$_POST["mon_am"];  $mon_pm=$_POST["mon_pm"]; }else{ $mon_am=""; $mon_pm="";}
		
				if(!empty($_POST['tues_check'])){ $tue=$_POST['tues_check']; }else{ $tue="";}
				if($tue!=""){ $tue_am=$_POST["tues_am"]; $tue_pm=$_POST["tues_pm"]; }else{ $tue_am=""; $tue_pm="";}
		
				if(!empty($_POST['wed_check'])) { $wed=$_POST['wed_check']; }else{ $wed="";}
				if($wed!=""){ $wed_am=$_POST["wed_am"]; $wed_pm=$_POST["wed_pm"]; }else{ $wed_am=""; $wed_pm="";}
		
				if(!empty($_POST['thur_check'])){ $thu=$_POST['thur_check']; }else{ $thu="";}
				if($thu!=""){ $thu_am=$_POST["thur_am"]; $thu_pm=$_POST["thur_pm"]; }else{ $thu_am=""; $thu_pm="";}
		
				if(!empty($_POST['fri_check'])) { $fri=$_POST['fri_check']; }else{ $fri="";}
				if($fri!=""){ $fri_am=$_POST["fri_am"]; $fri_pm=$_POST["fri_pm"]; }else{ $fri_am=""; $fri_pm="";}
		
				if(!empty($_POST['sat_check'])) { $sat=$_POST['sat_check']; }else{ $sat="";}
				if($sat!=""){ $sat_am=$_POST["sat_am"]; $sat_pm=$_POST["sat_pm"]; }else{ $sat_am=""; $sat_pm="";}
		
				if(!empty($_POST['sun_check'])) { $sun=$_POST['sun_check']; }else{ $sun="";}
				if($sun!=""){ $sun_am=$_POST["sun_am"]; $sun_pm=$_POST["sun_pm"]; }else{ $sun_am=""; $sun_pm="";}
				
		 $wk_hrs=$db->query("insert into `yp_working_hours`(`y_id`,`mon`,`mon_et`,`thue`,`thue_et`,`wed`,`wed_et`,`thur`,`thur_et`,
		
															 `fri`,`fri_et`,`sat`,`sat_et`,`sun`,`sun_et`,`status`,
		
															 `mon_wr`,`thue_wr`,`wed_wr`,`thur_wr`,`fri_wr`,`sat_wr`,
		
															 `sun_wr`) VALUES ('".$insetid."','".$mon_am."','".$mon_pm."','".$tue_am."','".$tue_pm."',
		
															 '".$wed_am."','".$wed_pm."','".$thu_am."','".$thu_pm."','".$fri_am."','".$fri_pm."','".$sat_am."',
		
															 '".$sat_pm."','".$sun_am."','".$sun_pm."','1','".$mon."','".$tue."','".$wed."',
		
															 '".$thu."','".$fri."','".$sat."','".$sun."')"); 
		
			}
		
		/*$nextstep="1";
		session_unregister('yp_insertid');
		session_register('yp_insertid');
		$_SESSION['yp_insertid']=$insetid;
		*/
		header("location:".$siteurl."My-Yellowpages");}
	}
}
	$incLEFTFILE="modules/user_left.php";
	$incFILE="modules/business.php";
}
/*27**************************************************/
if($_REQUEST['mod_option']=="Add Coupons"){
include_once("login_chk.php");
	$navtype="menu";
	$navigation="Add Coupons";
	$incLEFTFILE="modules/user_left.php";
	$incFILE="modules/yp_postdeals.php";
}
/*28**************************************************/
if($_REQUEST['mod_option']=="Change-Password"){
include_once("login_chk.php");
$navtype="menu";
$navigation="Add Coupons";
$page_title="Change Password";
if($_SERVER['REQUEST_METHOD']=="POST")
{
	$db->query("update register_users set pswd='".$_POST['ch_password']."' where reg_id=".$_SESSION['userid']."");
	$suc_ch_pswd="Your Password Has Been Successfully Changed";
}
	$incLEFTFILE="modules/user_left.php";
	$incFILE="modules/changes_password.php";
}
/*29**************************************************/
if($_REQUEST['mod_option']=="yellowpage-photos"){
include_once("login_chk.php");
$navtype="menu";
$navigation="Add Yellowpage Photos";
yp_details();
$page_title="Add Photos For ".$yp_name[$_GET['yp_did']]." in ".$banjara_add;
if($_SERVER['REQUEST_METHOD']=="POST")
{
$yr=date("Y");
$cmp_date=date("M");
$ne_folder="uploads/yp_uploads/";
// for creating Year wise folder here if it exists comes out from loop
if(!file_exists($ne_folder)){
$catdir=@mkdir($ne_folder);
chmod($ne_folder,0777);
} //end of year folder
$folder="uploads/yp_uploads/".$yr;
// for creating Year wise folder here if it exists comes out from loop
if(!file_exists($folder)){
$catdir=@mkdir($folder);
chmod($folder,0777);
} //end of year folder
$sub_folder="uploads/yp_uploads/".$yr."/".$cmp_date;
// for creating month wise folder here, if it exists comes out from loop
if(!file_exists($sub_folder)){
$catdir=@mkdir($sub_folder);
chmod($sub_folder,0777);
} //end of month folder
// for creating images and thumbs folder here, if it exists comes out from loop
$sub_folder1="uploads/yp_uploads/".$yr."/".$cmp_date;
if(!file_exists($sub_folder1)){
$catdir=@mkdir($sub_folder1);
chmod($sub_folder1,0777);
}
  $filetype=strstr($_FILES["ph_large1"]["name"],'.');
  if($filetype!='.jpeg' && $filetype!='.JPEG' && $filetype!='.jpg' && $filetype!='.JPG' && !empty($filetype)){
           $error_type="Please Upload File of type .jpg or .jpeg or .JPG or .JPEG "; 
   }else{
		$qq=getimagesize($_FILES['ph_large1']['tmp_name']);
		$width=$qq[0];
		$height=$qq[1];// exit;
		if(($width>=250 && $height>=250) && ($width<=900 && $height<=600))
		{
 			$v_path =$sub_folder1;
			$v_pht= AddFiles($v_path);
			if(!empty($v_pht[0][0])) {$v_imgpath = @$v_pht[0][0];$v_imgpath = "../".$v_imgpath;}
			else $v_imgpath =""; 
$insert=$db->query("insert into yp_photos_gallery (photo_id,y_id,image) values ('','".$_GET['yp_did']."','".$v_imgpath."')");
header("location:".$siteurl."Yellowpage-Manage/".$_GET['yp_did']."/".str_replace(" ","-",$yp_name[$_GET['yp_did']])."");
}else{ $err_msg="Sorry You Can't Upload Image size Less Than 250x250 And More Than 900x600"; }
		}
	}	
	$incLEFTFILE="modules/user_left.php";
	$incFILE="modules/yp_add_photos.php";
}
/*30**************************************************/
if($_REQUEST['mod_option']=="login"){
if(!empty($_SESSION['userid'])) { header("location:".$siteurl.""); }
if($_SERVER['REQUEST_METHOD']=="POST" && !empty($_POST['username'])){
$query=$db->query("select reg_id ,uname,pswd,email,phone1 from register_users where email='".$_POST['username']."' and pswd='".$_POST['password']."' and status=1");
$num=$db->numRows($query);
if($num>0){
$sql=$db->fetchArray($query);
//session_unregister("userid"); session_register("userid");
 $_SESSION['userid']=$sql['reg_id'];
//session_unregister('username'); session_register('username');
 $_SESSION['username']=$sql['uname'];
//session_unregister('email_id'); session_register('email_id');
 $_SESSION['email_id']=$sql['email'];
//session_unregister('bh_user_phno'); session_register('bh_user_phno');
 $_SESSION['bh_user_phno']=$sql['phone1'];
header("location:".$siteurl."Myaccount");
}else{ 
$msg="Wrong user id and Password. Try Again!";
}
if($_SERVER['REQUEST_METHOD']=="POST" && !empty($_POST['mail_to'])){
}
}
	$page_title="Login At ".$banjara_add;
	$rightincFILE="modules/right.php";
	$incFILE="modules/login.php";
}
/*31**************************************************/
if($_REQUEST['mod_option']=="forgotpasssword"){
if(!empty($_SESSION['userid'])) { header("location:".$siteurl.""); }
$page_title="Forgot Password ";
if($_SERVER['REQUEST_METHOD']=="POST"){
$navigation="Forgot Password";
// value sent from form
$email_to=$_POST['email_to'];
// retrieve password from table where e-mail = $email_to(mark@phpeasystep.com)
$result=$db->query("SELECT email,pswd FROM register_users WHERE email='".$email_to."' and status=1");
// if found this e-mail address, row must be 1 row
// keep value in variable name "$count"
$count=$db->numRows($result);
// compare if $count =1 row
if($count>0){
$rows=$db->fetchArray($result);
// keep password in $your_password
$your_name=$rows['email'];
$your_password=$rows['pswd'];
$bodycontent="<table width='50%' border='0' align='left' cellpadding='5' cellspacing='0' bgcolor='#FFFFFF'>
<tr>
<td colspan='2' align='left' valign='top'><span class='uid'><strong>Your user ID and password for banjarahills.com</strong></span></td>
</tr>
<tr>
<td width='33%' align='left' valign='top'>User Name</td>
<td width='81%' align='left' valign='top'>".$rows['email']."</td>
</tr><tr>
<td align='left' valign='top'>Password</td>
<td align='left' valign='top'>".$rows['pswd']."</td>
</tr></table>";
 		$srisig='';$subject="Forgot Password";$from=$bs_admin_id;$name='';$toname='';
 		$fp_msg=str_replace("{bodycontent}","$bodycontent",$fp_msg);
		$fp_msg=str_replace("{sig}","$srisig",$fp_msg);
		$fp_msg=str_replace("disname","$toname",$fp_msg);
		$bcc="";$cc="";$to=$email_to; 
		fp_sendmail($cc,$bcc,$to, $name, $subject, $from, $fp_msg);
		$forgot_suc_mes= "Your Password Has Been Sent To Your Email Address.";
// ---------------- SEND MAIL FORM ----------------
 }
// else if $count not equal 1
else {
$errmes= "Not found your user id in our database";
}
}
 	$rightincFILE="modules/right.php";
	$incFILE="modules/forgot_password.php";
}
/*32**************************************************/
if($_REQUEST['mod_option']=="register"){
if(!empty($_GET['av_id'])){
	ru_details();
	$page_title="Activate Your Account in ".$banjara_add;
	$st_user=$ruser_status[$_GET['av_id']];
	if($st_user==1){
		$reg_suc_mesg="Your Account Already Activated.";
	}else{
		$reg_u_id=$db->query("update register_users set status='1' where reg_id=".$_GET['av_id']."");
		$reg_suc_mesg="Your Accout Activated Successfully.";
	}}else{
$page_title="Register in ".$banjara_add;
if($_SERVER['REQUEST_METHOD']=="POST" && isset($_POST['register'])){
$reg_count=GetData("register_users","count(*)","email='".$_POST['mail']."'");
	if($reg_count==0){
 	$reg_u_id=$db->insert("INSERT INTO register_users(`reg_id`, `uname`, `pswd`, `email`,`phone1`,`status`, `ipaddress`, `regdate`) VALUES (NULL, '".$_POST['user']."', '".$_POST['pswd1']."', '".$_POST['mail']."', '".$_POST['mob_no']."', '2', '".$_SERVER['REMOTE_ADDR']."', now())");
	$bodycontent="<table width='98%' border='0' align='center' cellpadding='2' cellspacing='0' bgcolor='#FFFFFF'>
				<tr>
				<td style='padding-left:25px'><b>Account Details</b>,</td>
				</tr>
				<tr>
				<td style='padding-left:25px'><table width='100%' border='0' cellpadding='5' cellspacing='0' bgcolor='#FFFFFF'>
					<tr>
					  <td width='100'><table border='0' cellspacing='0' cellpadding='4'>
                        <tr bgcolor='#FFFFFF'>
                          <td width='50' nowrap style='padding-left:12px'>User ID</td>
                          <td valign='top' style='padding-left:12px'>".$_POST['mail']."</td>
                        </tr>
                        <tr bgcolor='#FFFFFF'>
                          <td nowrap style='padding-left:12px'>Password</td>
                          <td valign='top' style='padding-left:12px'>".$_POST['pswd1']."</td>
                        </tr>
                      </table></td>
				  </tr>
					<tr>
					  <td style='padding-left:12px'>Please Note - you must complete this last step to become a registered member. You will only need to visit this URL once to activate your account.</td>
					</tr>
					<tr>
					  <td style='padding-left:12px'>To Activate your Account Please <a href='".$siteurl."Activat-Account/".$reg_u_id."' target='_blank' class='slinks'><strong>Click here</strong></a></td>
					</tr>
				  </table>
				</td>
				</tr>
				</table>";
				
			$srisig='';
			$subject="Registration Details From Banjarahills.com";
			$from=$bs_admin_id;
			$name='';
			$toname='';
			$fp_msg=str_replace("{bodycontent}","$bodycontent",$fp_msg);
			$fp_msg=str_replace("{sig}","$srisig",$fp_msg);
			$fp_msg=str_replace("disname","$toname",$fp_msg);
			$bcc="admin@banjarahills.com";$cc="";$to=$_POST['mail']; 
			fp_sendmail($cc,$bcc,$to, $name, $subject, $from, $fp_msg);
			$forgot_suc_mes= "Your Password has been Sent to Your E-Mail Address.";
	$reg_suc_mesg="<span style='font-size:13px; color:#49C2C6; font-weight:bold;'>Thank You For Registration in Banjahills.com. Please check your email id to confirm your registration.</span>";
	header("location:".$siteurl."Success/Register");
	}else{
	$reg_err_msg="This User id is already registered.Try Again"; }
}else if($_SERVER['REQUEST_METHOD']=="POST" && isset($_POST['logname']))
{
$query=$db->query("select uname,reg_id,email from register_users where email='".$_POST['logname']."' and pswd='".$_POST['logpswd']."' and status=1");
$num=$db->numRows($query);
if($num>0)
{
$sql=$db->fetchArray($query);
//session_unregister("userid"); session_register("userid"); 
$_SESSION['userid']=$sql['reg_id'];
//session_unregister('username'); session_register('username'); 
$_SESSION['username']=$sql['uname'];
//session_unregister('email_id'); session_register('email_id'); 
$_SESSION['email_id']=$sql['email'];
header("location:".$siteurl."Myaccount");
}else{
$msg="Wrong username and Password. Try Again!";
}
}
}
	$rightincFILE="modules/right.php";
	$incFILE="modules/register.php";
}
/*33**************************************************/
if($_REQUEST['mod_option']=="logout"){
session_destroy();
header('location:index.php');
}
/*34**************************************************/
if($_REQUEST['mod_option']=="editprofile"){
include_once("login_chk.php");
$navtype="menu";
$page_title="Edit Profile in ".$banjara_add;
$navigation="My Account";
if($_SERVER['REQUEST_METHOD']=="POST"){
       $yr=date("Y");
	   $folder="uploads/user_profiles/".$yr;
		// for creating Year wise folder here if it exists comes out from loop
 		if(!is_dir($folder)){
 		$catdir=@mkdir($folder);
 		chmod($folder,0777);
 		}
		if($_FILES["img"]["size"]>0){
 		$filetype=strstr($_FILES["img"]["name"],'.');
 		if($filetype!='.jpeg' && $filetype!='.JPEG' && $filetype!='.jpg' && $filetype!='.JPG' && $filetype!='.GIF' && $filetype!='.gif' && !empty($filetype)){
 		$error_type="Please Upload .jpg or .jpeg or .Gif Files Only"; 
 		}
		$qq=getimagesize($_FILES['img']['tmp_name']);
 		$width=$qq[0];
 		$height=$qq[1];
 
		if(($width>150 && $height>150) && ($width<1024 && $height<1024))
		    {  $v_path=$folder; 		
			    $v_pht= AddFiles($v_path);
				if(!empty($v_pht[0][0])) 
				 $v_imgpath = @$v_pht[0][0]; 
				else  $v_imgpath = "";
		    } else{ $error="Sorry You Cannot Upload Image size Less Than 150 x 150 And More Than 1024 x 1024";}
			}else $v_imgpath=$_POST['old_img'];
		if(empty($error_type) && empty($error)){
			$query=$db->query("UPDATE `register_users` SET `city` = '".$_POST['city']."',`uname`='".$_POST['name']."',`phone1`='".$_POST['phone']."',`email`='".$_POST['email']."',`addr`='".$_POST['address']."',`user_pic`='".$v_imgpath."' WHERE `reg_id` =".$_SESSION['userid']);
			header("location:".$siteurl."Myaccount");
		}
}
	$incLEFTFILE="modules/user_left.php";
	$incFILE="modules/editprofile.php";
}
/*35**************************************************/
if($_REQUEST['mod_option']=="myyellowpages"){
include_once("login_chk.php");
$navtype="menu";
$navigation="My Listings";
$page_title="My Listings";
yp_cat_details();
if(!empty($_GET['start'])){ $start=$_GET['start']; }else{ $start=0; }
$len=20;
$link="".$siteurl."My-Yellow-Pages"; 
	$incLEFTFILE="modules/user_left.php";
	$incFILE="modules/myyellowpages.php";
}
/*36**************************************************/
if($_REQUEST['mod_option']=="yellowpagesmanage"){
include_once("login_chk.php");
$navtype="menu";
$page_title="";
if(!empty($_GET['id']) && (!empty($_GET['st'])))
{
if($_GET['st']==1){ $val=2;}else{$val=1; }
$up=$db->query("update bh_deals set status='$val' where deal_id=".$_GET['id']."");
header("location:index.php?mod_option=yellowpagesmanage&yid=".$_GET['yid']."");
}
if(!empty($_GET['start'])){ $start=$_GET['start']; }else{ $start=0; }
$len=25;
if(!empty($_GET['yp_stat'])){
$link="my_yellow_page.php?a=a&yp_stat=".$_GET['yp_stat'];
}else { 
$link="my_yellow_page.php?a=a";} 
$mange_yellowpages=$db->query("select * from bh_yellowpages where y_id=".$_GET['yid']." and yp_adduser='".$_SESSION['userid']."'");
$yell_row=$db->fetchArray($mange_yellowpages);
$page_title=$yell_row['business_name']." in ".$banjara_add;
if($yell_row['yp_adduser']!=$_SESSION['userid']){
header("location:index.php");
}
$name=$yell_row['business_name'];
$navigation="<table border='0' cellspacing='0' cellpadding='0'>
  <tr>
    <td><a href='".$siteurl."My-Yellowpages' class='orng14'>My Listings</a></td>
    <td class='search-div'><a href='#nogo'></a></td>
    <td>".$name."</td>
  </tr>
</table>";
	$incLEFTFILE="modules/user_left.php";
	$incFILE="modules/yellowpagesmanage.php";
}
/*37**************************************************/
if($_REQUEST['mod_option']=="morereviews"){
yp_details();ru_details();
$navtype="menu";
if(!empty($_GET['start'])){ $start=$_GET['start']; }else{ $start=0; }
$len=15;$link=$siteurl."more-reviews";
$navigation="Reviews";
$s_req=$db->query("SELECT * FROM `bh_yp_reviews`where status=1 order by id desc");
$total=$db->numRows($s_req);
$review=$db->query("SELECT * FROM `bh_yp_reviews` where status=1 order by id desc limit $start,$len");
	
	$rightincFILE="modules/right.php";
	$incFILE="modules/more_reviews.php";
}
/*38**************************************************/
if($_REQUEST['mod_option']=="moredeals"){
yp_details();ru_details();bh_area_name();
$navtype="menu"; $date=date("Y-m-d");
if(!empty($_GET['start'])){ $start=$_GET['start']; }else{ $start=0; }
$len=5;
$link=$siteurl."more-deals";
$navigation="More Deals";
//$s_req=$db->query("select * from bh_deals where status=1 order by deal_id desc ");
$s_req=$db->query("select * from bh_deals where status=1 and (start_date>='".$date."' or exp_date>='".$date."') order by deal_id desc limit 4");
$total=$db->numRows($s_req);
//$deal_sel=$db->query("select * from bh_deals where status=1 order by deal_id desc limit $start,$len");
$deal_sel=$db->query("select * from bh_deals where status=1 and (start_date>='".$date."' or exp_date>='".$date."') order by deal_id desc limit $start,$len");
$deal_count=$db->numRows($deal_sel);
$page_title="More Deals in ".$banjara_add;
	$rightincFILE="modules/right.php";
	$incFILE="modules/more_deals.php";
}
/*39**************************************************/
if($_REQUEST['mod_option']=="postdeals"){
include_once("login_chk.php");
$navtype="menu";yp_details();
if(!empty($_GET['id'])){ $f_t="Edit"; }else{$f_t="Add"; }
$page_title=$f_t." Deal FOR ".$yp_name[$_GET['yp_did']]." in ".$banjara_add;
$navigation="My Account";
if(!empty($_GET['id']))
{
$qq=$db->query("select coupon_img_path from bh_deals WHERE deal_id=".$_GET['id']."");
$row=$db->fetchArray($qq);
}
if($_SERVER['REQUEST_METHOD']=="POST"&&!empty($_POST['submitdeal']))
{
$coupfilepath="";
$yr=date("Y");
$cmp_date=date("M-Y");
$ne_folder="uploads/deals/";
// for creating Year wise folder here if it exists comes out from loop
if(!file_exists($ne_folder)){
$catdir=@mkdir($ne_folder);
chmod($ne_folder,0777);
} //end of year folder
$folder="uploads/deals/".$yr;
// for creating Year wise folder here if it exists comes out from loop
if(!file_exists($folder)){
$catdir=@mkdir($folder);
chmod($folder,0777);
} //end of year folder
$sub_folder="uploads/deals/".$yr."/".$cmp_date;
// for creating month wise folder here, if it exists comes out from loop
if(!file_exists($sub_folder)){
$catdir=@mkdir($sub_folder);
chmod($sub_folder,0777);
} //end of month folder
// for creating images and thumbs folder here, if it exists comes out from loop
$sub_folder1="uploads/deals/".$yr."/".$cmp_date;
if(!file_exists($sub_folder1)){
$catdir=@mkdir($sub_folder1);
chmod($sub_folder1,0777);
}
if($_FILES['coupfile']['size']>0){
if(!empty($row['coupon_img_path']) && !empty($_GET['id'])){ unlink($row['coupon_img_path']); }
 $pimage=AddFiles("$sub_folder1","coupfile");
 
if(!empty($pimage[0][0])) $coupfilepath=@$pimage[0][0];
}
else if(!empty($_POST['old_img'])) { $coupfilepath=$_POST['old_img']; } else {$coupfilepath="";}
$dispimgpath="";
 
$deal_imgpath=$coupfilepath;
 	
		if(isset($_POST["dealtitle"]))
		{
			if(!empty($_GET['id'])){$cond=" and deal_id<>".$_GET['id']."";}else{$cond="";}
			$q=$db->query("select * from bh_deals  WHERE deal_title='".$_POST["dealtitle"]."' ".$cond."");
			$row=$db->fetchArray($q);
			$num=$db->numRows($q); 
			//numRows($row);  dispimg
			if(($db->numRows($q)>0))
			{
			$isname="Deal with this title  exists";
			}
			else
			{
			 if(!empty($_GET['id']))
			{
			$upday=date('Y-m-d');
			$up_deal="update bh_deals set deal_title='".$_POST["dealtitle"]."', coupon_code='".$_POST["cpn_code"]."', disc_amount='".$_POST["di_amt"]."', act_discount='".$_POST["act_disc"]."',  start_date='".$_POST['st_date']."',deal_desc='".$_POST["desc"]."',  exp_date='".$_POST["expdate"]."', coupon_img_path='$coupfilepath',on_date='$upday' where deal_id=".$_GET['id']."";
			$q=$db->query($up_deal);
			header("location:".$siteurl."Yellowpage-Manage/".$_GET['yp_did']."/".$yp_name[$_GET['yp_did']]."");
			}else{
			$date=date("Y-m-d");
 			$iq=$db->query("INSERT INTO `bh_deals` (`deal_id`,`deal_title`,`coupon_code`,`act_discount`, `disc_amount`,`deal_desc`,`ypage_id`,`start_date`,`exp_date`, `coupon_img_path`, `on_date`, `added_by`, `status` )
			  VALUES ('','".$_POST["dealtitle"]."','".$_POST["cpn_code"]."','".$_POST["act_disc"]."',   '".$_POST["di_amt"]."', '".addslashes($_POST["desc"])."', '".$_GET["yp_did"]."','".$_POST['st_date']."','".$_POST["expdate"]."','$coupfilepath','$date','".$_SESSION['userid']."',1)");
			header("location:".$siteurl."Yellowpage-Manage/".$_GET['yp_did']."/".$yp_name[$_GET['yp_did']]."");
			}
			}	
		}
	 
 }
	$incLEFTFILE="modules/user_left.php";
	$incFILE="modules/yp_postdeals.php";
}
/*40**************************************************/
if($_REQUEST['mod_option']=="deal_details"){
include_once("login_chk.php");
$count=$db->getCount("select count(*) from bh_deals  where deal_id='".$_GET['dl_id']."'");
$qry = $db->query("select * from bh_deals where deal_id='".$_GET['dl_id']."'");
$num=$db->numRows($qry);
$dealrow=$db->fetchArray($qry); 
yp_details();
$navtype="menu";
$navigation="My Account";
$name=$yp_name[$_GET['yp_d_id']];
$page_title=$dealrow['deal_title']." of ".$yp_name[$_GET['yp_d_id']]." in ".$banjara_add;
$page_desc=substr($dealrow['deal_desc'],0,150);
$navigation="<table border='0' cellspacing='0' cellpadding='0'>
  <tr>
    <td><a href='".$siteurl."My-Yellowpages' class='orng14'>My Listings</a></td>
    <td class='search-div'><a href='#nogo'></a></td>
    <td><a href='".$siteurl."Yellowpage-Manage/".$_GET['yp_d_id']."/".SafeURL($yp_name[$_GET['yp_d_id']])."' class='orng14'>".$name."</a></td>
    <td class='search-div'><a href='#nogo'></a></td>
    <td>".$dealrow['deal_title']."</td>
  </tr>
</table>";
	$incLEFTFILE="modules/user_left.php";
	$incFILE="modules/deal_details.php";
}
/*41**************************************************/
if($_REQUEST['mod_option']=="add-event"){
include_once("login_chk.php");
yp_details();
if(!empty($_GET['ev_edtid']))
{
$evs=$db->query(" select * from bh_events where event_id='".$_GET['ev_edtid']."'");
$eventsrow=$db->fetchArray($evs); 
$f_t="Edit ";
}else{ $f_t="Add ";}
$navtype="menu";
$navigation="<table border='0' cellspacing='0' cellpadding='0'>
  <tr>
    <td><a href='".$siteurl."My-Yellowpages' class='orng14'>My Listings</a></td>
    <td class='search-div'><a href='#nogo'></a></td>
    <td><a href='".$siteurl."Yellowpage-Manage/".$_GET['yid']."/".str_replace(" ","-",$yp_name[$_GET['yid']])." ' class='orng14'>".$yp_name[$_GET['yid']]."</a></td>
    <td class='search-div'><a href='#nogo'></a></td>
    <td>".$f_t." Event</td>
  </tr>
</table>";
if($_SERVER['REQUEST_METHOD']=="POST" && (!empty($_POST['ev_publish_b']))) { 
$err_msg=""; $error_type="";
$disval=""; 
$filetype=strstr($_FILES["ev_img_icon"]["name"],'.');
if($filetype!='.jpeg' && $filetype!='.JPEG' && $filetype!='.jpg' && $filetype!='.JPG' && $filetype!='.gif' && $filetype!='.GIF' && !empty($filetype)){
$error_type="Please Upload File of type .jpg or .jpeg or .JPG or .JPEG or .gif or .GIF"; 
}
 
if($_FILES['ev_img_icon']['size']>0){
$qq=getimagesize($_FILES['ev_img_icon']['tmp_name']);
$width=$qq[0];
$height=$qq[1];// exit;
 
$yr=date("Y");
$cmp_date=date("M-Y");
$ne_folder="uploads/Event_uploads/";
// for creating Year wise folder here if it exists comes out from loop
if(!file_exists($ne_folder)){
$catdir=@mkdir($ne_folder);
chmod($ne_folder,0777);
} //end of year folder
$folder="uploads/Event_uploads/".$yr;
// for creating Year wise folder here if it exists comes out from loop
if(!file_exists($folder)){
$catdir=@mkdir($folder);
chmod($folder,0777);
} //end of year folder
$sub_folder="uploads/Event_uploads/".$yr."/".$cmp_date;
// for creating month wise folder here, if it exists comes out from loop
if(!file_exists($sub_folder)){
$catdir=@mkdir($sub_folder);
chmod($sub_folder,0777);
} //end of month folder
// for creating images and thumbs folder here, if it exists comes out from loop
$sub_folder1="uploads/Event_uploads/".$yr."/".$cmp_date;
if(!file_exists($sub_folder1)){
$catdir=@mkdir($sub_folder1);
chmod($sub_folder1,0777);
}
$v_path =$sub_folder1;
//echo $eventsrow['image_icon'];exit;
if(!empty($eventsrow['image_icon']) && !empty($_GET['ev_edtid'])){ unlink(substr($eventsrow['image_icon'],3)); }
$v_pht= AddFiles($v_path);
if(!empty($v_pht[0][0])) $v_imgpath = @$v_pht[0][0];
$v_imgpath="../".$v_imgpath;
}
else if(!empty($_POST['oldimageicon'])) { $v_imgpath=$_POST['oldimageicon']; } else {  $v_imgpath ="";  }
if(empty($error_type))	 {	 
if(!empty($_GET['ev_edtid'])){
	$status=1;
 	$in="update bh_events set event_title='".bsr_rep_spl_char($_POST['ev_title'])."',image_icon='".$v_imgpath."',ev_description='".bsr_rep_spl_char($_POST['ev_desc'])."',ev_category='".$_POST['ev_category']."',
	phone='".$_POST['phno']."',pin='".$_POST['ev_pin']."',ev_area='".$_POST['ev_area']."',ev_sub_area='".$_POST['ev_sub_area']."',ev_st_date='".$_POST['ev_startday']."',
	ev_start_hr='".$_POST['ev_st_time']."',ev_end_date='".$_POST['ev_endday']."',ev_start_hr='".$_POST['ev_st_time']."',ev_end_hr='".$_POST['ev_end_time']."'
	 where event_id='".$_GET['ev_edtid']."'";
	$db->query($in); 
	header("location:".$siteurl."Yellowpage-Manage/".$_GET['yid']."/".$yp_name[$_GET['yid']]."");
	
}else{
$status=1;
$event_in="insert into bh_events(event_id,yid,event_title,image_icon,ev_city,ev_description,ev_category,phone,pin,ev_area,ev_sub_area,ev_st_date,ev_start_hr,ev_end_date,ev_end_hr,ev_added_by,ev_added_date,status) 
values('','".$_GET['yid']."','".bsr_rep_spl_char($_POST['ev_title'])."','".$v_imgpath."','".$_POST['city']."','".bsr_rep_spl_char($_POST['ev_desc'])."','".$_POST['ev_category']."','".$_POST['phno']."',
'".$_POST['ev_pin']."', '".$_POST['ev_area']."','".$_POST['ev_sub_area']."', '".$_POST['ev_startday']."','".$_POST['ev_st_time']."','".$_POST['ev_endday']."','".$_POST['ev_end_time']."','".$_SESSION['user_id']."',now(),'$status') ";
$eveid=$db->insert($event_in);
header("location:".$siteurl."Yellowpage-Manage/".$_GET['yid']."/".$yp_name[$_GET['yid']]."");
}}}
	$page_title="Add Event ";
 	$incLEFTFILE="modules/user_left.php";
	$incFILE="modules/add_event.php";
}
/*42**************************************************/
if($_REQUEST['mod_option']=="yp-event-details"){
include_once("login_chk.php");
$ev_row=$db->fetchArray($db->query("select * from bh_events where event_id=".$_GET['yp_eid']."")); 
$page_title=$ev_row['event_title']." in ".$banjara_add;
$page_desc=substr($ev_row['ev_description'],0,150);
yp_details();bh_area_name();
$navtype="menu";
$navigation="<table border='0' cellspacing='0' cellpadding='0'>
  <tr>
    <td><a href='".$siteurl."My-Yellowpages' class='orng14'>My Listings</a></td>
    <td class='search-div'><a href='#nogo'></a></td>
    <td><a href='".$siteurl."Yellowpage-Manage/".$_GET['yid']."/".str_replace(" ","-",$yp_name[$_GET['yid']])." ' class='orng14'>".$yp_name[$_GET['yid']]."</a></td>
    <td class='search-div'><a href='#nogo'></a></td>
    <td>View Event</td>
  </tr>
</table>";
	$incLEFTFILE="modules/user_left.php";
	$incFILE="modules/yp_event_details.php";
}
/*43**************************************************/
if($_REQUEST['mod_option']=="photo-gallery"){
bh_area_name();
$navtype="menu";
if(!empty($_GET['start'])){ $start=$_GET['start']; }else{ $start=0; }
$len=50;
$navigation="Photo Gallery";
if(!empty($_GET['psid'])){
$navigation="<table border='0' cellspacing='0' cellpadding='0'>
  <tr>
    <td><a href='".$siteurl."Photo-Gallery' class='orng14'>Photo Gallery</a></td>
    <td class='search-div'><a href='#nogo'></a></td>
    <td>".$area_name[$_GET['psid']]."</td>
  </tr>
</table>";
$page_title=$area_name[$_GET['psid']]." Photos in ".$banjara_add;
$link=$siteurl."psa".$_GET['psid']."/p/".SafeURL($area_name[$_GET['psid']])."";
}else{
	$link=$siteurl."photo-gallery";
	$page_title="Photo Gallery ".$banjara_add;
}
	$incLEFTFILE="modules/pg_left.php";
	$incFILE="modules/photo_gallery.php";
}
/*44**************************************************/
if($_REQUEST['mod_option']=="videos-all"){
bh_area_name();
$navtype="menu";
if(!empty($_GET['start'])){ $start=$_GET['start']; }else{ $start=0; }
$len=50;
$navigation="Videos";
if(!empty($_GET['vsid'])){
$navigation="<table border='0' cellspacing='0' cellpadding='0'>
  <tr>
    <td><a href='".$siteurl."Videos' class='orng14'>Videos</a></td>
    <td class='search-div'><a href='#nogo'></a></td>
    <td>".$area_name[$_GET['vsid']]."</td>
  </tr>
</table>";
$page_title=$area_name[$_GET['vsid']]." Videos in ".$banjara_add;
$link=$siteurl."vsa".$_GET['vsid']."/p/".SafeURL($area_name[$_GET['vsid']])."";
}else{
	$link=$siteurl."videos";
	$page_title="Videos in ".$banjara_add;
}
	$incLEFTFILE="modules/vd_left.php";
	$incFILE="modules/videos.php";
}
/*45**************************************************/
if($_REQUEST['mod_option']=="lisging-ur-business"){
$navtype="menu";
$navigation="<table border='0' cellspacing='0' cellpadding='0'>
  <tr>
     <td>Listing Your Business</td>
  </tr>
</table>";
$page_title="Listing Your Business in ".$banjara_add;
	$rightincFILE="modules/right.php";
	$incFILE="modules/listing_business.php";
}
/*46**************************************************/
if($_REQUEST['mod_option']=="advertise-with-us"){
$navtype="menu";
$navigation="<table border='0' cellspacing='0' cellpadding='0'>
  <tr>
     <td>Advertise With Us</td>
  </tr>
</table>";
$page_title="Advertise With Us in ".$banjara_add;
	$rightincFILE="modules/right.php";
	$incFILE="modules/advertise_with_us.php";
}
/*47**************************************************/
if($_REQUEST['mod_option']=="yp_cat_list"){
$navtype="menu";yp_cat_details();
$navigation="<table border='0' cellspacing='0' cellpadding='0'>
  <tr>
     <td class='orng'>Yellowpages in ".$yp_cat_name[$_GET['ypc_id']]."</td>
  </tr>
</table>";
$page_title="Yellowpages in ".$yp_cat_name[$_GET['ypc_id']]." ".$banjara_add;
if(!empty($_GET['start'])){ $start=$_GET['start']; }else{ $start=0; }
$len=9;
$link=$siteurl."yc".$_GET['ypc_id']."/p/".SafeURL($yp_cat_name[$_GET['ypc_id']])."";
	$rightincFILE="modules/right.php";
	$incFILE="modules/yp_cat-listings.php";
}
}else{
	$incFILE="modules/home.php";
	$rightincFILE="modules/index_right.php";
}
include("f-template.php");
?>