Location: PHPKode > projects > MembersGear > membersgear/user_onetimeoffer_signup.php
<?php
 require_once "config/config.php";  
 require_once INCLUDE_DIR."/users_signup_class.php";
 require_once INCLUDE_DIR."/product_class.php";
 $objUserSignup=new users_signup_class();
 $objprodcalss=new product_class();
// $lsuseridcookie= COOKIE_PREFIX.'onetimeofferuserid' ;
$productResultModifiedArray=array();  
$puserid='';
 if(isset($_COOKIE[COOKIE_PREFIX.'onetimeofferuserid']) && isset($_GET['productid']))  
 {
     $puserid=decrypt($_COOKIE[COOKIE_PREFIX.'onetimeofferuserid']);
     $lionetimeofferparentproductid=$_GET['productid'];
     //echo  $puserid;
     
  
 
 //$userSubscribedProducts=$objUserSignup->getAlluserSubscribedProduct($puserid);
    //$puserid=84;
 //$lionetimeofferparentproductid=75;
 //$arr=array();                   
// echo $_COOKIE[COOKIE_PREFIX.'onetimeofferuserid'];
// echo $_GET['productid'];
 $arr = $objUserSignup->getProductsToSignupOneTimeOffer($puserid,$lionetimeofferparentproductid);
 //$arrPayments=$objprodcalss->getUserPaymentHistory($puserid);
 //$iuserEmailSubStatus=$objUserSignup->isSubscribedForEmail($puserid); 
  
  $len=sizeof($arr);
  $allProducts=array();
  $counter=0;
  if($len>0)
   {
      foreach($arr as $key=>$val)
      {
         $specificProdcut=$objprodcalss->GetSpecificProduct($val);
         $allProducts[$counter]=$specificProdcut[0];
         $counter++;
      } 
   }
   
   /* modified by  nikunj for remove expired products */
  //$productResultModifiedArray=array();
         
        if(is_array($allProducts) && sizeof($allProducts)>0)
          {
             for($i=0;$i<=sizeof($allProducts)-1;$i++)
               {
                  $productid=$allProducts[$i]['id'];
                  $queryExpireddate="select * from ".TABLE_PREFIX."productpaymentoptions where productid=".$productid;
                  $resultOfExpiredProducts=$objUserSignup->View($queryExpireddate); 
                  if($resultOfExpiredProducts[0]['duration_type']=='Exact date (mm-dd-yyyy)')
                    {
                       $curentTimeStamp= strtotime(date("m/d/YH:i:s")); 
                       if($resultOfExpiredProducts[0]['duration_exactdate']<$curentTimeStamp)
                         {
                             //unset($productResults[$i]);
                             
                         }
                         else
                          {
                          $productResultModifiedArray[]=$allProducts[$i];  
                          }
                    
                    }
                 else
                  {
                    $productResultModifiedArray[]=$allProducts[$i];
                  
                  }   
                 
                   $lenofproducts=sizeof($productResultModifiedArray);
                   $smarty->assign('productlen',$lenofproducts);   
               }   
          
          }
          else
          {
             $smarty->assign('productlen',0);    
              $smarty->assign('msg','No Product Availabel for one time offer.');
          } 
 } 
 else
 {
      $smarty->assign('accessmsg','invalid'); 
      $smarty->assign('productlen',0);    
 
 }     
          
         // $lenofproducts=sizeof($productResultModifiedArray);     
          $smarty->assign('products',$productResultModifiedArray); 
          
          $smarty->assign('userid',$puserid);  
          $DEFAULTPAGE = $smarty->fetch('user_onetimeoffer.tpl');
          $smarty->assign('USER_CONTENT',     $DEFAULTPAGE); 
          $smarty->display('user_page_main.tpl');
          
          
 ?>
Return current item: MembersGear