Example #1
0
 /**
  * This function is used to show the currency
  * 
  * 
  * @return string
  */
 function displayEnabledCurrencies()
 {
     $sql = "SELECT a.id,a.currency_name,a.currency_code,a.currency_tocken,a.default_currency,b.cou_name as country_name FROM currency_master_table a, country_table b WHERE a.status=1 AND a.country_code=b.cou_code";
     $obj = new Bin_Query();
     $obj->executeQuery($sql);
     return Display_DCurrencySettings::displayEnabledCurrencies($obj->records);
 }
Example #2
0
 /**
  * Function get the list of categories available in the database 
  * 
  * 
  * @return string
  */
 function showCategory()
 {
     $sql = "select b.category_parent_id as parent ,b.category_id as child,a.category_name as parent_name,b.category_name from category_table a right outer join category_table b on a.category_id = b.category_parent_id ";
     $obj = new Bin_Query();
     $obj->executeQuery($sql);
     return Display_DCategoryList::displayCategory($obj->records);
 }
Example #3
0
 /**
  * Function generates a file with category details .
  * 
  * @param string $targetpath
  * @return file
  */
 function createCategoryTSVFile($targetpath)
 {
     $sql = "SELECT title,description,concat('?do=prodetail&action=showprod&prodid=',product_id)as destn FROM `products_table` order by product_id";
     $obj = new Bin_Query();
     $obj->executeQuery($sql);
     $arr = $obj->records;
     $str = "Campaign\tAd Group\tHeadline\tDescription Line 1\tDescription Line 2\tDisplay URL\tDestination URL\tCampaign Status\tAdGroup Status\tCreative Status";
     $fp = fopen($targetpath, 'w');
     for ($i = 0; $i < count($arr); $i++) {
         $campaign = "\nCampaign #1";
         $addGroup = "\tAd Group #1";
         $headline = "\t" . $arr[$i]['title'];
         $Desc1 = "\t" . substr(str_replace("\r\n", "", strip_tags($arr[$i]['description'])), 0, 24);
         $Desc2 = "\t" . substr(str_replace("\r\n", "", strip_tags($arr[$i]['description'])), 25, 50);
         $DispURL = "\t" . $_SERVER['SERVER_NAME'];
         $DestURL = "\t" . $_SERVER['SERVER_NAME'] . '/' . $arr[$i]['destn'];
         $CampStat = "\tActive";
         $AdGroupStat = "\tActive";
         $CreativeStat = "\tActive";
         $str .= $campaign . $addGroup . $headline . $Desc1 . $Desc2 . $DispURL . $DestURL . $CampStat . $AdGroupStat . $CreativeStat;
     }
     fwrite($fp, $str);
     fclose($fp);
     print_r($str);
     //exit();
 }
Example #4
0
 /**
  * Function generates the data need for showing the best selling products
  * 
  * 
  * @return string
  */
 function showBestSellingProducts()
 {
     $pagesize = 25;
     if (isset($_GET['page'])) {
         $start = trim($_GET['page'] - 1) * $pagesize;
         $end = $pagesize;
     } else {
         $start = 0;
         $end = $pagesize;
     }
     $total = 0;
     $sql = "SELECT orders.product_id, sum( orders.product_qty ) AS cnt , prod.title , prod.category_id , prod.thumb_image, cat.category_name, prod.msrp FROM order_products_table orders , products_table prod , category_table cat WHERE orders.product_id=prod.product_id and prod.category_id=cat.category_id and prod.intro_date <= now() AND status=1 GROUP BY orders.product_id ORDER BY cnt DESC";
     $query = new Bin_Query();
     if ($query->executeQuery($sql)) {
         $total = ceil($query->totrows / $pagesize);
         include_once 'classes/Lib/Paging.php';
         $tmp = new Lib_Paging('classic', array('totalpages' => $total, 'length' => 10), 'pagination');
         $this->data['paging'] = $tmp->output;
         $this->data['prev'] = $tmp->prev;
         $this->data['next'] = $tmp->next;
         $sql1 = "SELECT orders.product_id, sum( orders.product_qty ) AS cnt , prod.title , prod.category_id , prod.thumb_image, cat.category_name, prod.msrp FROM order_products_table orders , products_table prod , category_table cat WHERE orders.product_id=prod.product_id and prod.category_id=cat.category_id and prod.intro_date <= now() AND status=1 GROUP BY orders.product_id ORDER BY cnt DESC LIMIT {$start},{$end}";
         $query1 = new Bin_Query();
         if ($query1->executeQuery($sql1)) {
             return Display_DBestSellingProducts::showBestSellingProducts($query1->records, $this->data['paging'], $this->data['prev'], $this->data['next']);
         }
     } else {
         return "No Best Selling Products Found";
     }
 }
Example #5
0
 /**
  * This function is used to get  the  user product review
  *
  * .
  * 
  * @return string
  */
 function showProductReview()
 {
     include 'classes/Display/DUserAccount.php';
     $userid = $_SESSION['user_id'];
     $pagesize = 10;
     if (isset($_GET['page'])) {
         $start = trim($_GET['page'] - 1) * $pagesize;
         $end = $pagesize;
     } else {
         $start = 0;
         $end = $pagesize;
     }
     $total = 0;
     $sqlselect = "SELECT date_format(review_date,'%e/%c/%Y') as rdate,b.title,review_caption FROM product_reviews_table a,products_table b where a.product_id=b.product_id and a.user_id=" . $userid;
     $query = new Bin_Query();
     $query->executeQuery($sqlselect);
     $total = ceil($query->totrows / $pagesize);
     include 'classes/Lib/Paging.php';
     $tmp = new Lib_Paging('classic', array('totalpages' => $total, 'length' => 10), 'pagination');
     $this->data['paging'] = $tmp->output;
     $this->data['prev'] = $tmp->prev;
     $this->data['next'] = $tmp->next;
     $sqlselect = "SELECT a.product_id,date_format(review_date,'%e/%c/%Y') as rdate,b.title,review_caption,rating,case when review_status=1 then 'Active' else 'In Active' end as rstatus FROM product_reviews_table a,products_table b where a.product_id=b.product_id and a.user_id=" . $userid . " LIMIT {$start},{$end}";
     $obj = new Bin_Query();
     $obj->executeQuery($sqlselect);
     return Display_DUserAccount::showProductReview($obj->records, $this->data['paging'], $this->data['prev'], $this->data['next'], $start);
 }
Example #6
0
 /**
  * This function is used to get the  rss
  *
  * .
  * 
  * @return XML data
  */
 function showRss()
 {
     $sql = " SELECT a.product_id, a.title,a.description, a.thumb_image, a.msrp, a.intro_date,b.soh,sum(c.rating)/count(c.user_id) as\n\t\t\trating\tFROM products_table a INNER JOIN\tproduct_inventory_table b ON a.product_id=b.product_id  left join product_reviews_table c on a.product_id=c.product_id WHERE datediff( CURDATE( ) , a.intro_date ) <=100 group by a.product_id order by a.intro_date desc";
     $query = new Bin_Query();
     $query->executeQuery($sql);
     return Core_CRss::writeXML($query->records);
 }
Example #7
0
 /**
  * This function is used to show the all new product page.
  *
  * 
  * 
  * @return string
  */
 function showAllNew()
 {
     include 'classes/Display/DUserAccount.php';
     $pagesize = 8;
     if (isset($_GET['page'])) {
         $start = trim($_GET['page'] - 1) * $pagesize;
         $end = $pagesize;
     } else {
         $start = 0;
         $end = $pagesize;
     }
     $total = 0;
     $sql = " SELECT a.product_id, a.title, a.thumb_image, a.msrp, a.intro_date,b.soh,sum(c.rating)/count(c.user_id) as\n\t\t\trating FROM products_table a INNER JOIN\tproduct_inventory_table b ON a.product_id=b.product_id left join product_reviews_table c on a.product_id=c.product_id WHERE a.intro_date <= '" . date('Y-m-d') . "' and a.status=1 group by a.product_id";
     $query = new Bin_Query();
     if ($query->executeQuery($sql)) {
         $total = ceil($query->totrows / $pagesize);
         include 'classes/Lib/Paging.php';
         $tmp = new Lib_Paging('classic', array('totalpages' => $total, 'length' => 10), 'pagination');
         $this->data['paging'] = $tmp->output;
         $this->data['prev'] = $tmp->prev;
         $this->data['next'] = $tmp->next;
         $sql = " SELECT a.product_id, a.title, a.thumb_image, a.msrp, a.intro_date,b.soh,sum(c.rating)/count(c.user_id) as\n\t\t\trating \tFROM products_table a INNER JOIN product_inventory_table b ON a.product_id=b.product_id left join product_reviews_table c on a.product_id=c.product_id WHERE a.intro_date <= '" . date('Y-m-d') . "' and a.status=1 group by a.product_id order by a.intro_date desc limit {$start},{$end}";
         $obj = new Bin_Query();
         if ($obj->executeQuery($sql)) {
             return Display_DUserAccount::showAllNew($obj->records, $this->data['paging'], $this->data['prev'], $this->data['next'], $start);
         } else {
             return 'No Products Found!';
         }
     } else {
         return 'No Products Found!';
     }
 }
 /**
  * Function gets the most search keyword frequency from the database
  * 
  * 
  * @return string
  */
 function showMostSearchedKeywords()
 {
     $pagesize = 25;
     if (isset($_GET['page'])) {
         $start = trim($_GET['page'] - 1) * $pagesize;
         $end = $pagesize;
     } else {
         $start = 0;
         $end = $pagesize;
     }
     $total = 0;
     $sql = "select search_tag as keyword,search_count as cnt from search_tags_table order by search_count desc ";
     $query = new Bin_Query();
     if ($query->executeQuery($sql)) {
         $total = ceil($query->totrows / $pagesize);
         include_once 'classes/Lib/Paging.php';
         $tmp = new Lib_Paging('classic', array('totalpages' => $total, 'length' => 10), 'pagination');
         $this->data['paging'] = $tmp->output;
         $this->data['prev'] = $tmp->prev;
         $this->data['next'] = $tmp->next;
         $sql1 = "select search_tag as keyword,search_count as cnt from search_tags_table order by search_count desc LIMIT {$start},{$end}";
         $query1 = new Bin_Query();
         if ($query1->executeQuery($sql1)) {
             return Display_DMostSearchedKeywords::showMostSearchedKeywords($query1->records, $this->data['paging'], $this->data['prev'], $this->data['next']);
         }
     } else {
         return "No Contents Found";
     }
 }
Example #9
0
 /**
  * This function is used to get  the all news from db
  * 
  * 
  * @return string
  */
 function showNewsPage()
 {
     $pagesize = 10;
     if (isset($_GET['page'])) {
         $start = trim($_GET['page'] - 1) * $pagesize;
         $end = $pagesize;
     } else {
         $start = 0;
         $end = $pagesize;
     }
     $total = 0;
     $sql = "SELECT news_title,DATE_FORMAT(news_date,'%M %D %Y')AS date,news_desc from news_table where news_status=1 order by news_date desc";
     $query = new Bin_Query();
     if ($query->executeQuery($sql)) {
         $total = ceil($query->totrows / $pagesize);
         include 'classes/Lib/Paging.php';
         $tmp = new Lib_Paging('classic', array('totalpages' => $total, 'length' => 10), 'pagination');
         $this->data['paging'] = $tmp->output;
         $this->data['prev'] = $tmp->prev;
         $this->data['next'] = $tmp->next;
         $sql = "SELECT news_title,DATE_FORMAT(news_date,'%M %D %Y')AS date,news_desc from news_table where news_status=1 order by news_date desc limit {$start},{$end}";
         $obj = new Bin_Query();
         if ($obj->executeQuery($sql)) {
             return Display_DNews::showNewsPage($obj->records, $this->data['paging'], $this->data['prev'], $this->data['next'], $start);
         } else {
             return Core_CLanguage::_(NO_NEWS_FOUND);
         }
     } else {
         return Core_CLanguage::_(NO_NEWS_FOUND);
     }
 }
Example #10
0
 /**
  * Function gets the latest customer details from the database 
  * 
  * 
  * @return string
  */
 function dispLatestCustomer()
 {
     $sql = 'select a.user_display_name,a.user_email,a.user_doj,c.orders_status_name,b.order_total from users_table a left outer join orders_table b on b.customers_id=a.user_id left outer join orders_status_table c on b.orders_status=c.orders_status_id  order by a.user_id desc limit 0,10';
     $obj = new Bin_Query();
     $obj->executeQuery($sql);
     return Display_DLatestOrders::dispLatestCustomer($obj->records);
 }
Example #11
0
  /**
   * Function updates the changes made in the site moto details into the table 
   * 
   * 
   * @return string
   */
  function updatesiteSettings()
  {
      $remove = array("\\n", "\\r");
      $_POST['google_analytics'] = str_replace($remove, "", $_POST['google_analytics']);
      $_POST['customer_header'] = str_replace($remove, "", $_POST['customer_header']);
      if ($_FILES['site_logo']['name'] != '') {
          $site_logo_path = 'images/logo/' . date("YmdHis") . '_' . $_FILES['site_logo']['name'];
          if (move_uploaded_file($_FILES['site_logo']['tmp_name'], '../' . $site_logo_path)) {
              $site_logo = $site_logo_path;
          }
      } else {
          $site_logo = $_POST['site_logo'];
      }
      $sql = "UPDATE admin_settings_table SET \n\t\t\tcustomer_header ='" . trim($_POST['customer_header']) . "' ,\n\t\t\tsite_logo='" . $site_logo . "',\n\t\t\tgoogle_analytics='" . trim($_POST['google_analytics']) . "',\n\t\t\ttime_zone='" . trim($_POST['time_zone']) . "',\n\t\t\tsite_moto='" . trim($_POST['site_moto']) . "',\t\t\t\n\t\t\tmeta_kerwords='" . stripslashes(trim($_POST['meta_kerwords'])) . "',\n\t\t\tmeta_description='" . stripslashes(trim($_POST['meta_description'])) . "'\n\t\t\twhere set_id='1'";
      $query = new Bin_Query();
      if ($query->updateQuery($sql)) {
          $_SESSION['msgSitemoto'] = '<div class="alert alert-success">
 				 <button type="button" class="close" data-dismiss="alert">×</button> Site settings has been updated successfully </div>';
      } else {
          $_SESSION['msgSitemoto'] = '<div class="alert alert-error">
  				<button type="button" class="close" data-dismiss="alert">×</button>Site settings has not been updated successfully</div>';
      }
      header('Location:?do=site');
      exit;
  }
Example #12
0
 /**
  * This function is used to show the faq page
  * 
  * 
  * @return string
  */
 function showFaq()
 {
     $pagesize = 10;
     if (isset($_GET['page'])) {
         $start = trim($_GET['page'] - 1) * $pagesize;
         $end = $pagesize;
     } else {
         $start = 0;
         $end = $pagesize;
     }
     $total = 0;
     $sql = "select * from faq_table";
     $query = new Bin_Query();
     if ($query->executeQuery($sql)) {
         $total = ceil($query->totrows / $pagesize);
         include 'classes/Lib/Paging.php';
         $tmp = new Lib_Paging('classic', array('totalpages' => $total, 'length' => 10), 'pagination');
         $this->data['paging'] = $tmp->output;
         $this->data['prev'] = $tmp->prev;
         $this->data['next'] = $tmp->next;
     }
     $sql = "select * from faq_table";
     $query = new Bin_Query();
     $query->executeQuery($sql);
     return Display_DFaq::listFaq($query->records, $this->data['paging'], $this->data['prev'], $this->data['next'], $start);
 }
Example #13
0
 /**
  * Function checks whether the user exists in the database
  * 
  * 
  * @return array
  */
 function checkUSer()
 {
     /**
      *
      * Here database query comes
      *
      */
     $sql = "SELECT * FROM user_registration  WHERE user_name='" . mysql_escape_string($_POST['usernametxt']) . "' and user_password = '******'passwordtxt'])) . "'";
     $obj = new Bin_Query();
     if ($obj->executeQuery($sql)) {
         $arr = $obj->totrows;
         print_r($arr);
     }
     if ($arr == 1) {
         if ($obj->records[0]['user_status'] == 1) {
             $_SESSION['user_id'] = $obj->records[0]['user_id'];
             $_SESSION['username'] = $obj->records[0]['user_name'];
             return "1";
         } else {
             if ($obj->records[0]['user_status'] == 0) {
                 $_SESSION['user_id'] = $obj->records[0]['user_id'];
                 $_SESSION['username'] = $obj->records[0]['user_name'];
                 return "0";
             } else {
                 if ($obj->records[0]['user_status'] == 2) {
                     return "Your are Suspended by Admin";
                 }
             }
         }
     } else {
         return "Invalid Username and Password";
     }
 }
Example #14
0
 /**
  * This function is used to get  the  account dashboard information 
  *
  * .
  * 
  * @return string
  */
 function showDashboard()
 {
     include 'classes/Display/DUserAccount.php';
     $pagesize = 10;
     if (isset($_GET['page'])) {
         $start = trim($_GET['page'] - 1) * $pagesize;
         $end = $pagesize;
     } else {
         $start = 0;
         $end = $pagesize;
     }
     $total = 0;
     $sqlselect = "SELECT a.customers_id,a.orders_id,date_format(a.date_purchased,'%e/%c/%Y') as pdate,b.orders_status_name,c.user_display_name,a.order_total as total,a.currency_id FROM `orders_table` a,orders_status_table b,users_table c,order_products_table d where a.orders_status=b.orders_status_id and a.customers_id=c.user_id and a.orders_id=d.order_id and a.customers_id=" . $_SESSION['user_id'] . " group by a.orders_id order by a.date_purchased desc";
     $query = new Bin_Query();
     if ($query->executeQuery($sqlselect)) {
         $total = ceil($query->totrows / $pagesize);
         include 'classes/Lib/Paging.php';
         $tmp = new Lib_Paging('classic', array('totalpages' => $total, 'length' => 10), 'pagination');
         $this->data['paging'] = $tmp->output;
         $this->data['prev'] = $tmp->prev;
         $this->data['next'] = $tmp->next;
     }
     $sqlselect = "SELECT a.customers_id,a.orders_id,date_format(a.date_purchased,'%e/%c/%Y') as pdate,b.orders_status_name,c.user_display_name,a.order_total as total,a.currency_id,e.id,e.currency_tocken  FROM `orders_table` a,orders_status_table b,users_table c,order_products_table d,currency_master_table e where a.orders_status=b.orders_status_id and a.customers_id=c.user_id and a.orders_id=d.order_id and a.customers_id=" . $_SESSION['user_id'] . " and e.id=a.currency_id group by a.orders_id order by a.date_purchased desc LIMIT {$start},{$end}";
     $sqlUser = '******' . $_SESSION['user_id'];
     $sqlNews = "SELECT user_id,b.status FROM `users_table` a,newsletter_subscription_table b where a.user_email=b.email and a.user_status=1 and a.user_id=" . $_SESSION['user_id'];
     $obj = new Bin_Query();
     $objuser = new Bin_Query();
     $objNews = new Bin_Query();
     $obj->executeQuery($sqlselect);
     $objuser->executeQuery($sqlUser);
     $objNews->executeQuery($sqlNews);
     return Display_DUserAccount::showDashboard($obj->records, $objuser->records, $objNews->records, $this->data['paging'], $this->data['prev'], $this->data['next'], $start);
 }
Example #15
0
 /**
  * Function gets all the header link from the table 
  * 
  * 
  * @return string
  */
 function showHeaderLink()
 {
     $sql = "SELECT * FROM header_link_table ";
     $query = new Bin_Query();
     $query->executeQuery($sql);
     return Display_DHeaderSettings::showHeaderLink($query->records);
 }
Example #16
0
 /**
  * This function is used to get the rating from db
  * @param integer $productid
  * .
  * 
  * @return array 
  */
 function disRates($productid)
 {
     $sql = 'select min(msrp) as msrp from msrp_by_quantity_table where product_id =' . $productid;
     $obj = new Bin_Query();
     $obj->executeQuery($sql);
     $val = $obj->records;
     return $val[0]['msrp'];
 }
 /**
  * Function gets the order status details from the database 
  * 
  * 
  * @return string
  */
 function editOrderStatus()
 {
     $id = $_GET['id'];
     $sql = 'select * from orders_status_table where orders_status_id=' . $id;
     $obj1 = new Bin_Query();
     $obj1->executeQuery($sql);
     return Display_DOrderStatusManagement::editOrderStatus($obj1->records);
 }
Example #18
0
 /**
  * Function gets the contents from the html contents table.
  * 
  * 
  * @return string
  */
 function dispCategory()
 {
     $id = 4;
     $sql = "select * from html_contents_table where html_content_name='Category Content'";
     $obj = new Bin_Query();
     $obj->executeQuery($sql);
     return Display_DDisplayCategoryList::dispCategory($obj->records);
 }
Example #19
0
 /**
  * This function is used to get the  map for category
  *
  * @return HTML data
  */
 function showMap()
 {
     include 'classes/Display/DSiteMap.php';
     $sql = "select category_id,category_name from category_table where category_parent_id=0 and category_status=1";
     $query = new Bin_Query();
     $query->executeQuery($sql);
     return Display_DSiteMap::showMap($query->records);
 }
Example #20
0
 /**
  * Function  to find the    category id
  * @param integer $productid
  * @return string
  */
 function findCategoryid($productid)
 {
     $sql = 'select category_id from products_table where product_id=' . $productid;
     $obj = new Bin_Query();
     $obj->executeQuery($sql);
     $val = $obj->records[0]['category_id'];
     return $val;
 }
Example #21
0
 /**
  * This function is used to get  the price compare page
  *
  * .
  * 
  * @return string 
  */
 function showPriceComparePage()
 {
     $obj = new Bin_Query();
     $sql = "select set_value from admin_settings_table where set_name='www.pricerunner.com Affiliate ID'";
     if ($obj->executeQuery($sql)) {
         $pricerunnerid = $obj->records[0]['set_value'];
     }
     $output = Display_DPriceCompare::showPriceComparePage($pricerunnerid);
     return $output;
 }
Example #22
0
 /**
  * Function updates the contact us details into the table 
  * 
  * 
  * @return string
  */
 function updateContactUs()
 {
     $sql = "UPDATE contactus_table SET contactus='" . $_POST['contactus'] . "' Where id=1";
     $query = new Bin_Query();
     if ($query->updateQuery($sql)) {
         return '<div class="success_msgbox">Contact Us Information Updated Successfully</div>';
     } else {
         return '<div class="error_msgbox">Content Not Updated </div>';
     }
 }
Example #23
0
 /**
  * Function updates the copyrights details into the table 
  * 
  * 
  * @return string
  */
 function updateCopyrights()
 {
     $sql = "UPDATE admin_settings_table SET set_value='" . $_POST['copyrights'] . "' Where set_name='Copy Rights'";
     $query = new Bin_Query();
     if ($query->updateQuery($sql)) {
         return '<div class="success_msgbox">Copy right Information Updated Successfully</div>';
     } else {
         return '<div class="error_msgbox">Copyright  Not Updated </div>';
     }
 }
Example #24
0
 /**
  * Function gets the count of products from the database with their brand details. 
  * 
  * 
  * @return string
  */
 function dispBrandWithCount()
 {
     // $catid=$_POST['id'];
     //	   $catid=$_GET['id'];
     $catid = 2;
     $sql = 'Select brand, count(*)as cnt from    products_table where category_id=' . $catid . ' group by brand having count(*) > 0 ';
     $obj = new Bin_Query();
     $obj->executeQuery($sql);
     return Display_DNarrowSearch::dispBrandWithCount($obj->records);
 }
Example #25
0
 /**
  * Function selects the data from the table need for generating auto complete popup window. 
  * 
  * 
  * @return xml
  */
 function autoComplete()
 {
     $aUsers = array();
     $sql = "SELECT title FROM products_table";
     $obj = new Bin_Query();
     $obj->executeQuery($sql);
     $count = count($obj->records);
     for ($i = 0; $i < $count; $i++) {
         $aUsers[] = $obj->records[$i]['title'];
     }
     $input = strtolower($_GET['input']);
     $len = strlen($input);
     $limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 0;
     $aResults = array();
     $count = 0;
     if ($len) {
         for ($i = 0; $i < count($aUsers); $i++) {
             // had to use utf_decode, here
             // not necessary if the results are coming from mysql
             //
             if (strtolower(substr(utf8_decode($aUsers[$i]), 0, $len)) == $input) {
                 $count++;
                 $aResults[] = array("id" => $i + 1, "value" => htmlspecialchars($aUsers[$i]));
             }
             if ($limit && $count == $limit) {
                 break;
             }
         }
     }
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     // Date in the past
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
     // always modified
     header("Cache-Control: no-cache, must-revalidate");
     // HTTP/1.1
     header("Pragma: no-cache");
     // HTTP/1.0
     if (isset($_REQUEST['json'])) {
         header("Content-Type: application/json");
         echo "{\"results\": [";
         $arr = array();
         for ($i = 0; $i < count($aResults); $i++) {
             $arr[] = "{\"id\": \"" . $aResults[$i]['id'] . "\", \"value\": \"" . $aResults[$i]['value'] . "\"}";
         }
         echo implode(", ", $arr);
         echo "]}";
     } else {
         header("Content-Type: text/xml");
         echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?><results>";
         for ($i = 0; $i < count($aResults); $i++) {
             echo "<rs id=\"" . $aResults[$i]['id'] . "\" >" . $aResults[$i]['value'] . "</rs>";
         }
         echo "</results>";
     }
 }
Example #26
0
 /**
  * Function updates the changes made in the time zone details into the database 
  * 
  * 
  * @return string
  */
 function updateTimeZone()
 {
     if ($_POST['timezone'] != '') {
         $sql = "UPDATE admin_settings_table SET set_value='" . $_POST['timezone'] . "' where set_name='Time Zone'";
         $query = new Bin_Query();
         if ($query->updateQuery($sql)) {
             return '<div class="alert alert-success">
 <button type="button" class="close" data-dismiss="alert">×</button> <strong> well done !</strong> Timezone Updated to <b>' . $_POST['timezone'] . '</b> Successfully</div>';
         }
     }
 }
Example #27
0
 /**
  * Function generates a excel product report for google base
  * 
  * 
  * @return file
  */
 function googleProduct()
 {
     include "classes/Lib/excelwriter.inc.php";
     $excel = new ExcelWriter("GoogleBase_Product_Feed.xls");
     if ($excel == false) {
         echo $excel->error;
     }
     $myArr = array("Product Id", "Product Title", "Description", "Product Price", "Link", "Brand", "Image Link", "Weight");
     $excel->writeLine($myArr);
     $sql = 'select product_id,title,description,price,brand,thumb_image,weight from products_table';
     $obj = new Bin_Query();
     if ($obj->executeQuery($sql)) {
         $cnt = count($obj->records);
         for ($i = 0; $i < $cnt; $i++) {
             $product_id = $obj->records[$i]['product_id'];
             $title = $obj->records[$i]['title'];
             $description = strip_tags($obj->records[$i]['description']);
             $price = $obj->records[$i]['price'];
             $brand = $obj->records[$i]['brand'];
             $thumb_image = $obj->records[$i]['thumb_image'];
             $image_link = $_SERVER['SERVER_NAME'] . '/' . $thumb_image;
             $weight = $obj->records[$i]['weight'];
             $link = $_SERVER['SERVER_NAME'] . '/?do=prodetail&action=showprod&id=' . $product_id;
             $excel->writeRow();
             $excel->writeCol($product_id);
             $excel->writeCol($title);
             $excel->writeCol($description);
             $excel->writeCol($price);
             $excel->writeCol($link);
             $excel->writeCol($brand);
             $excel->writeCol($image_link);
             $excel->writeCol($weight);
         }
         $excel->close();
     }
     if (strpos($_SERVER['USER'], 'MSIE')) {
         // IE cannot download from sessions without a cache
         header('Cache-Control: public');
     } else {
         //header("Cache-Control: no-cache, must-revalidate");
         header("Cache-Control: no-cache");
     }
     $file = "GoogleBase_Product_Feed.xls";
     //chmod ($file, 0755);
     header("Pragma: no-cache");
     header("Content-Type: php/doc/xml/html/htm/asp/jpg/JPG/sql/txt/jpeg/gif/bmp/png/xls/csv/x-ms-asf\n");
     header("Connection: close");
     header("Content-Disposition: attachment; filename=" . $file . "\n");
     header("Content-Transfer-Encoding: binary\n");
     header("Content-length: " . (string) filesize("{$file}"));
     $fd = fopen($file, "rb");
     fpassthru($fd);
 }
Example #28
0
 /**
  * This function is used to insert  the site hit count
  * 
  * 
  * @return string
  */
 function setCount()
 {
     $ip = Core_CHitCounter::getRealIpAddr();
     $sql = "select * from site_hit_counter_table where ip_address='" . $ip . "' and date(visited_on)='" . date("Y-m-d") . "'";
     $query = new Bin_Query();
     $query->executeQuery($sql);
     if (empty($query->records)) {
         $sql = "insert into site_hit_counter_table (ip_address,visited_on) values('" . $ip . "','" . date("y.m.d H.i.s") . "')";
         $query = new Bin_Query();
         $query->executeQuery($sql);
     }
 }
Example #29
0
 /**
  * Function updates the custom header details into the table
  * 
  * 
  * @return string
  */
 function updateCustomHeader()
 {
     $sql = "update admin_settings_table set set_value='" . trim($_POST['headerContent']) . "' where set_name='Custom Header'";
     $obj = new Bin_Query();
     if ($obj->updateQuery($sql)) {
         return '<div class="alert alert-success">
 <button type="button" class="close" data-dismiss="alert">×</button> <strong> well done !</strong> Custom Header changed Successfully</div>';
     } else {
         return '<div class="alert alert-error">
 <button type="button" class="close" data-dismiss="alert">×</button> Unable to change Custom Header</div>';
     }
 }
Example #30
0
 /**
  * Function adds an HTML Content value into the database
  * 
  * 
  * @return string
  */
 function addContent()
 {
     if (trim($_POST['contentname']) != '' && trim($_POST['htmlcontent']) != '') {
         $content = $_POST['contentname'];
         $sql = "INSERT INTO html_contents_table (html_content_name,html_content) VALUES ('" . $content . "','" . $_POST['htmlcontent'] . "')";
         $query = new Bin_Query();
         if ($query->updateQuery($sql)) {
             return '<div class="success_msgbox">Content Added Successfully</div>';
         }
     } else {
         return '<div class="error_msgbox">Field Can not be Blank</div>';
     }
 }