ajgkqsldxvkqsldkqs azelfkqsmkqsmlkdqsmld azmlekdqmskdmlqskd nkldsfkqsmldkqsmdmlskd decrypt($_GET['id']); /* Fetch the information */ $con = db_connect(); $sql = session($con,$session); $message = ""; if(db_rows($con,$sql)>0){ /* fetch userid and create session token */ $query = mysqli_query($con,$sql); while($row=mysqli_fetch_array($query)){ $userid = $row['userid']; $lat = $row['latitude']; $lon = $row['longitude']; } $sql = "select * from businesses order by name asc"; if(db_rows($con,$sql)>0){ /* company detail */ $query = mysqli_query($con,$sql); while($row=mysqli_fetch_array($query)){ $id = $row['token']; $name = $row['name']; $image = $row['image']; $image = business_image_url($image); array_push($business_categories,array('name'=>$mcrypt->encrypt($name), 'image'=>$mcrypt->encrypt($image), 'id'=>$mcrypt->encrypt($id) ) ); } }else{ $message = "No category on record."; } /* Get subscribed newsfeed */ $sql = "select u.name,n.userid,n.title,n.description,n.image,n.date,n.token from newsfeeds as n inner join users as u on u.id=n.userid where n.userid in(select userid from newsfeed_subscriptions where subscriber=".intval($userid).") order by n.id desc limit 2"; $total = db_rows($con,$sql); if($total>0){ /* Fetch the list of companies */ $query = mysqli_query($con,$sql); while($row=mysqli_fetch_array($query)){ $title = $row['title']; $desc = $row['description']; $image = $row['image']; $subscription = 0; $token = $row['token']; $id = $row['userid']; if(newsfeed_subscribed($con,$id,$userid)){ $subscription = 1; } if(!empty($image)){ $image = newsfeed_link($image); } $date = changeDateToDayMonthYear($row['date']); $name = $row['name']; array_push($newsfeeds,array( 'title'=>$mcrypt->encrypt($title), 'desc'=>$mcrypt->encrypt($desc), 'image'=>$mcrypt->encrypt($image), 'date'=>$mcrypt->encrypt($date), 'subscription'=>$mcrypt->encrypt($subscription), 'name'=>$mcrypt->encrypt($name), 'token'=>$mcrypt->encrypt($token), 'id'=>$mcrypt->encrypt($id), ) ); } } /* Get the newly registered company */ $sql = latest_company($lat,$lon); if(db_rows($con,$sql)>0){ $query = mysqli_query($con,$sql); while($row=mysqli_fetch_array($query)){ $id = $row['id']; $name = $row['name']; $about = $row['about']; $logo = $row['picture']; /* if logo is empty, use default logo */ if(empty($logo)){ $logo = "no_image.png"; } $logo = pic_url($logo); $region = region_name($con,$row['region']); $town = town_name($con,$row['town']); $phone = $row['phone']; $direction = $row['direction']; $ghana_post = $row['ghana_post']; $website = $row['website']; if(empty($website)){ $website = " "; } $alt_phone = $row['alt_phone']; if(empty($alt_phone)){ $alt_phone = " "; } $landmark = $row['landmark']; $latitude = $row['latitude']; $longitude = $row['longitude']; $token = $row['token']; $opening_hrs = company_opening_hours($con,$id); if(empty($opening_hrs)){ $opening_hrs = " "; } array_push($company,array('name'=>$mcrypt->encrypt($name), 'about'=>$mcrypt->encrypt($about), 'logo'=>$mcrypt->encrypt($logo), 'region'=>$mcrypt->encrypt($region), 'town'=>$mcrypt->encrypt($town), 'phone'=>$mcrypt->encrypt($phone), 'website'=>$mcrypt->encrypt($website), 'alt_phone'=>$mcrypt->encrypt($alt_phone), 'landmark'=>$mcrypt->encrypt($landmark), 'opening_hrs'=>$mcrypt->encrypt($opening_hrs), 'direction'=>$mcrypt->encrypt($direction), 'ghana_post'=>$mcrypt->encrypt($ghana_post), 'latitude'=>$mcrypt->encrypt($latitude), 'longitude'=>$mcrypt->encrypt($longitude), 'cid'=>$mcrypt->encrypt($id), 'id'=>$mcrypt->encrypt($token) ) ); } } /* Fetch advert */ $sql = "Select * from ads where status=1 ORDER BY RAND() LIMIT 1"; if(db_rows($con,$sql)==0){ $sql = "select * from ads where id=1"; } $query = mysqli_query($con,$sql); while($row=mysqli_fetch_array($query)){ $image = $row['image']; $image = ad_image($image); $title = $row['title']; $desc = $row['description']; $website = $row['website']; $advertiser = $row['userid']; $more = $row['more']; $balance = $row['balance']; if(empty($more)){ $more = " "; } $token = $row['token']; $link = " "; if(!empty($website)){ $link="http://closeapp.kuulchatmedia.com/adclick.php?id=".$mcrypt->encrypt($token)."&sid=".$mcrypt->encrypt($session); } array_push($advert,array('image'=>$mcrypt->encrypt($image), 'title'=>$mcrypt->encrypt($title), 'desc'=>$mcrypt->encrypt($desc), 'more'=>$mcrypt->encrypt($more), 'link'=>$mcrypt->encrypt($link), 'id'=>$mcrypt->encrypt($token) ) ); /* Charge for view */ if(!($advertiser==$userid)){ $type = 1; advert_activity($con,$userid,$type,$balance,$token); } } }else{ $message = "You don't have right."; } echo json_encode(array("categories"=>$business_categories,"newsfeeds"=>$newsfeeds,"company"=>$company,"advert"=>$advert,"message"=>$message)); db_close($con); } ?>