Location: PHPKode > projects > MembersGear > membersgear/user_signup.php
<?php
    require_once "config/config.php";
 //**********************************************Begin Page code**********************************************     
require_once INCLUDE_DIR."/users_class.php";
require_once INCLUDE_DIR."/users_signup_class.php";
require_once INCLUDE_DIR."/roles_class.php";
require_once INCLUDE_DIR."/usersinroles_class.php"; 
require_once INCLUDE_DIR."/fields_class.php";
require_once INCLUDE_DIR."/product_class.php"; 
require_once INCLUDE_DIR."/upsell_product_class.php";  
require_once INCLUDE_DIR."/PaygearWebserviceClient.php"; 

$objPayGear=new PaygearWebserviceClient();
$upsell_obj=new upsell_product_class();           

$users=new users_class();
$userrole=new roles_class();
$userinrole=new usersinroles_class();
$loManageFields = new fields_class();  
$product=new  product_class();  
$_action = isset($_GET['action']) ? $_action : 'SIGNUP';
$_action = strtoupper($_action);           


 if(function_exists('wordpress_check_Plugin_structure') and function_exists('wordpress_getWordpress_status')  )
 {
  
    $wordpressStatus=wordpress_getWordpress_status();
    if($wordpressStatus){

        $dirWordpress=wordpress_physical_path_dir()."wp-config.php";
        if(file_exists($dirWordpress)){
            require_once($dirWordpress);   
            assign_sessions();
        }
        
     }
   
 }  
 

 
  
if(isset($_SESSION[SESSION_PREFIX.'UserID']) and $_SESSION[SESSION_PREFIX.'UserID'] != '')
{
    
    Redirect(WEB_URL.'/member/user_default_page.php');   
}

switch($_action)
{
                                                   
    case 'INSERT':
     
             
                
                $insertToProductUser=null;
                $lstokenKey=createToken();
                $ladyncltValues=$_POST;
                $lsSelectedProduct=$_POST['products'];
                
                //updated by nikunj for bypass paygear signup when product is free
                
                $get_product_info =$product->GetSpecificProduct(trim($_POST['products']));
                $paygearProdId=$get_product_info[0]['paygear_productid'] ;
                $isFreeProduct=$get_product_info[0]['price'];
                $formatedPrice=number_format($isFreeProduct, 2, '.', ''); 
                
                if($_POST['gen_username']=="1")   
                {
                   $lsValues1[0]= createRandomusername();
                   $lsValues1[1]=session_id();
                   $lsusername=strtolower($lsValues1[0]) ;  
                
                } 
                else
                {   
                
                    $lsValues1[0] = $_POST['username'];
                    $lsValues1[1]=session_id();
                    $lsusername=strtolower($lsValues1[0]); 
           
                } 
                if($_POST['gen_password']=="1")   
                {
                   $lspassword=encrypt(createRandomPassword(),$lstokenKey);  
                    
                }
                else
                { 
                   $lspassword=encrypt($_POST['password'],$lstokenKey);
                }    
                $liUseravialble=$users->IsUserAvailable("SELECT * FROM ".TABLE_PREFIX ."users where username=? and session_id!=?",$lsValues1,null);
                
               
                if($liUseravialble==false)
                {    
                           if($_POST['personalInfoValidation']=='yes' and $_POST['shippingInfoValidation']=='yes')
                           {
                               
                                  $query="INSERT INTO ".TABLE_PREFIX ."users (username,password,secretsalt,firstname,lastname, Email,address1,
                                  city,country,state,zipcode,phone_main,billing_address,billing_city,billing_country,billing_state,billing_zip
                                  ,billing_phone,createdon, createdby,createdipaddress,isapproved,islockedout,isunsubscribedfromemails,session_id) 
                                  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; 
                                  
                           }
                           else if($_POST['personalInfoValidation']=='yes' and $_POST['shippingInfoValidation']=='no')
                           {
                               
                                  $query="INSERT INTO ".TABLE_PREFIX ."users (username,password,secretsalt,firstname,lastname, Email,address1,
                                  city,country,state,zipcode,phone_main,
                                  createdon, createdby,createdipaddress,isapproved,islockedout,isunsubscribedfromemails,session_id) 
                                  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; 
                                     
                                  
                           }
                           else if($_POST['personalInfoValidation']=='no' and $_POST['shippingInfoValidation']=='yes')
                            {
                                 $query="INSERT INTO ".TABLE_PREFIX ."users (username,password,secretsalt,firstname,lastname, Email,billing_address,
                                  billing_city,billing_country,billing_state,billing_zip,billing_phone,
                                  createdon, createdby,createdipaddress,isapproved,islockedout,isunsubscribedfromemails,session_id) 
                                  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; 
                                  
                                
                            }
                           else
                           {    
                                   $lTypes=null;   
                                   $query="INSERT INTO ".TABLE_PREFIX ."users (username,password,secretsalt,firstname,lastname, Email,createdon,createdby,createdipaddress,
                                   isapproved,islockedout,isunsubscribedfromemails,session_id) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)";           
                           }   
                                   
                                     $lsValues = array();
                                   //  $lsValues[]= $_POST['username'];
                                     
                                     $lsValues[]=trim($lsusername);
                                     $lsValues[]=$lspassword;
                                     $lsValues[]=$lstokenKey;
                                     $lsValues[]=$_POST['fname'];
                                     $lsValues[]= $_POST['lname'];
                                     $lsValues[]=$_POST['email'];
                                     if($_POST['personalInfoValidation']=='yes')
                                     {
                                          $lsValues[]=$_POST['address'];
                                          $lsValues[]=$_POST['city']; 
                                          $lsValues[]=$_POST['country']; 
                                          $lsValues[]=$_POST['state']; 
                                          $lsValues[]=$_POST['zipcode'];       
                                          $lsValues[]=$_POST['phone']; 
                                          //$lsValues[]=' ';
                                     }
                                     if($_POST['shippingInfoValidation']=='yes')
                                     {
                                          $lsValues[]=$_POST['addressSHP'];
                                          $lsValues[]=$_POST['citySHP']; 
                                          $lsValues[]=$_POST['billing_country']; 
                                          $lsValues[]=$_POST['bllling_state']; 
                                          $lsValues[]=$_POST['zipcodeSHP'];       
                                          $lsValues[]=$_POST['phoneSHP']; 
                                          //$lsValues[]=' ';
                                     }     
                                     
                                     $lsValues[]=mktime();
                                     $lsValues[]=0;
                                     $lsValues[]=$_SERVER['REMOTE_ADDR'];
                                     $lsValues[]=0; 
                                     $lsValues[]='0';
                                     /*changed by Asmita for global Configuration seeting*/
                                     if(MEMBER_USE_SUBSCRIBELINK =="true")
                                     { 
                                        $lsValues[]= (isset($_POST['chksubscribe']) and $_POST['chksubscribe']==0) ? $_POST['chksubscribe'] : 1;
                                     }
                                     else
                                     {
                                        $lsValues[]=0; 
                                     }
                                    $lsValues[]=session_id(); 
                                    
                                    $lsInsertedrows = $users->Insert($query,$lsValues,null);
                                    
                                    if($lsInsertedrows>0)
                                      {
                                                                                          
                                             $lauserinfovalue=array();
                                             $lauserinfovalue[0] = $lsusername; 
                                             $lauserinfo = $users->view("SELECT id FROM ".TABLE_PREFIX ."users where username=?",$lauserinfovalue,null);    
                                             
                                             $lsValuesrole=array();
                                             $lsValuesrole[0]='customer';
                                             $laroleid=$userrole->GetRoleID($lsValuesrole,null);
                                            
                                             $lauserinrolevalue=array();
                                             $lauserinrolevalue[0]=$lauserinfo[0]['id'];
                                             $lauserinrolevalue[1]=$laroleid[0]['id'];
                                             $lauserinrolevalue[2]=mktime();
                                             $lauserinrolevalue[3]=0; 
                                             $lauserinrolevalue[4]=$_SERVER['REMOTE_ADDR'];   
                                             $user= $userinrole->Insert('',$lauserinrolevalue,null);
                                             
                                             /* Entry For Dyanmic Control*/
                                             $loManageFields->insertsignupformdata('signup',$ladyncltValues,$lauserinfo[0]['id']);  
                                             /*End*/
                                             
                                             $usersignuupObj=new users_signup_class();
                                             $insertToProductUser=$usersignuupObj->insertToProductUser($lsSelectedProduct,$lauserinfo[0]['id']);
                                             //Redirect("ipn.php"); 
                                               
                                             
                                            
                                         }    
                                        // $smarty->assign('msg','New User is Inserted...');  
                                         //$message->SetMessage('User is Sucessfully Inserted');
                                         //Redirect('./user_signup.php'); 
                                         
                                         
                                       $usersignuupClass=new users_signup_class();
                                        $lsSalePageId=$usersignuupClass->getPayGearSalePageUrl($_POST['products']);
                                        //$browsUrl="http://192.168.99.109/paygear/sell.aspx?productpaymentoption=".$lsSalePageId;
                                        
                                        
                                        $result2 = $users->view('select `isrequiredshippingInformation` as `ship`,`isrequiredpersonalinformation` as `pers`  from '.TABLE_PREFIX.'products where id=?',array($_POST['products']),null);
                                        $shiping=$result2[0]['ship'];
                                        $personal=$result2[0]['pers'];
                                         $lbonetimeofferprodparent=$product->IsParentofontimeofferproduct(trim($_POST['products']));
                                        //if($lbonetimeofferprodparent==true && IS_ENABLE_ONE_TIME_OFFER =='true')
                                        if(IS_ENABLE_ONE_TIME_OFFER =='true')
                                        {     
                                             $tommorrow =  time() + (1*24*60*60);
                                             setcookie(COOKIE_PREFIX.'onetimeofferuserid',encrypt($lauserinfo[0]['id']),$tommorrow,"/"); 
                                        }
                                        
                                         $tommorrow =  time() + (1*24*60*60);
                                         setcookie(COOKIE_PREFIX.'user__id',encrypt($lauserinfo[0]['id']),$tommorrow,"/"); 
                                       
                                        if($insertToProductUser!=null)
                                         {
                                           setcookie(COOKIE_PREFIX.'Product_user_id',encrypt($insertToProductUser),$tommorrow,"/"); 
                                           setcookie(COOKIE_PREFIX.'lst_product',encrypt( $_POST['products']),$tommorrow,"/"); 
                                          
                                         }
                                                
                                        if($formatedPrice=="0.00")
                                         {
                                           
                                             $iUserId=$lauserinfo[0]['id'];
                                             $postedArry=ARRAY();
                                             $postedArry['pg_amount']='0';
                                             $postedArry['e_txn_id']='0';
                                             $postedArry['e_processor_name']='N/A';
                                             $postedArry['pg_txn_stat']='1';
                                             $postedArry['payment_type']='N/A';
                                             $postedArry['pg_order_id']='0';
                                             $postedArry['payment_date']=date("m/d/Y");  
                                             
                                             $results=$product->GetSpecificProductPaymentOptions(trim($_POST['products']));
                                            
                                             if($results!=false)
                                              { 
                                             
                                                     $ProductId=trim($_POST['products']);
                                                     $PaymentOptionId=trim($results[0]['paygear_productpaymentoptionid']);
                                                     $FirstName=trim($_POST['fname']);
                                                     $LastName=trim($_POST['lname']);
                                                     $Email=trim($_POST['email']);
                                                     $Address=isset($_POST['address'])?trim($_POST['address']):''; 
                                                     $City=isset($_POST['city'])?trim($_POST['city']):''; 
                                                     $State=isset($_POST['stathiddval'])?trim($_POST['stathiddval']):''; 
                                                     $ZiporPostalCode=isset($_POST['zipcode'])?trim($_POST['zipcode']):''; 
                                                     $Country=isset($_POST['countryhiddval'])?trim($_POST['countryhiddval']):''; 
                                                     $Phone=isset($_POST['phone'])?trim($_POST['phone']):''; 
                                                     $spFirstName=isset($_POST['fname'])?trim($_POST['fname']):''; 
                                                     $spLastName=isset($_POST['lname'])?trim($_POST['lname']):''; 
                                                     $spEmail=isset($_POST['email'])?trim($_POST['email']):''; 
                                                     $spAddress=isset($_POST['addressSHP'])?trim($_POST['addressSHP']):''; 
                                                     $spCity=isset($_POST['citySHP'])?trim($_POST['citySHP']):''; 
                                                     $spState=isset($_POST['shstathiddval'])?trim($_POST['shstathiddval']):''; 
                                                     $spZip=isset($_POST['zipcodeSHP'])?trim($_POST['zipcodeSHP']):''; 
                                                     $spCountry=isset($_POST['shcountryhiddval'])?trim($_POST['shcountryhiddval']):''; 
                                                     $spPhone=isset($_POST['phoneSHP'])?trim($_POST['phoneSHP']):''; 
                                                     $IPAddress=$_SERVER['REMOTE_ADDR'];
                                                        
                                                     $addUserToPaygear=$objPayGear->freePorductEntry($paygearProdId,$PaymentOptionId,$FirstName,
                                                                                                     $LastName,$Email,$Address,$City,$State,
                                                                                                     $ZiporPostalCode,$Country,$Phone,$spFirstName,
                                                                                                     $spLastName,$spEmail,$spAddress,$spCity,$spState,
                                                                                                     $spZip,$spCountry,$spPhone,$IPAddress);  
                                                     
                                                     if(strtoupper($addUserToPaygear['FreeSaleTransactionEntryResult'])==strtoupper("TRUE"))
                                                      {   
                                                         $usersignuupObj=new users_signup_class();
                                                         $usersignuupObj->updateToProductUser($postedArry,trim($_POST['products']),$iUserId);
                                                         
                                                         $ifProductSetForUpsell1=false;
                                                         $ifProductSetForUpsell1=$upsell_obj->GetSpecificUpsellProduct($ProductId,1);
                                                         
                                                         if($ifProductSetForUpsell1!=false)
                                                         {
                                                            $upsellurlLevel1=$ifProductSetForUpsell1[0]['upsellpageurl'];  
                                                            Redirect($upsellurlLevel1,true);
                                                         }
                                                         else
                                                         {       
                                                              $thankyoupageUrl=urldecode($results[0]['thankyoupageurl']);
                                                              Redirect($thankyoupageUrl,true);
                                                          }  
                                                      }
                                                     else
                                                     {
                                                     
                                                          $smarty->assign('msg','There is some error occured.Please try again later.');
                                                          $smarty->assign('is_postback','yes');
                                                             $iaPostdata = array();
                                                            $i=0;           
                                                            foreach($_POST as $key=>$value)                                                                                                                   
                                                            {   
                                                                    $iaPostdata[$key]=$value;
                                                                    $i++;
                                                            }        
                                                            
                                                             $smarty->assign('post',$iaPostdata);      
                                                              
                                                              $priceGroup=0;
                                                            if(isset($_GET['group']))
                                                               $priceGroup=$_GET['group'];
                                                             
                                                             $controlresult=$loManageFields->renderDynamiControlOnPage('signup',$priceGroup);
                                                             $lsvalidationresult=$loManageFields->renderDynamiControlvalidation('signup',"frmsignup",'frmvalidator');
                                                             $smarty->assign('controlvalidationresult',$lsvalidationresult);;
                                                             $smarty->assign('controlresult',$controlresult);
                                             
                                                               
                                                                  
                                                               $usersignuup=new users_signup_class();
                                                               
                                                                if(isset($priceGroup))
                                                                 $allProducts=$usersignuup->getProducts('Signup',$priceGroup);
                                                               else
                                                                 $allProducts=$usersignuup->getProducts('Signup');
                                                                  
                                                               $totalProducts=sizeof($allProducts);
                                                               
                                                                
                                                               
                                                          
                                                                  $smarty->assign('products',$allProducts);
                                                                  $smarty->assign('totalProducts',$totalProducts);
                                                                 
                                                                  $lsValues = array();
                                                                       
                                                                  $lTypes=null;
                                                                  //$query= "SELECT id,name FROM ".TABLE_PREFIX."location where ifnull(parentid,0)=0 and status=1 order by name asc";
                                                                  $query= "SELECT * FROM ".TABLE_PREFIX."location  WHERE name='United States' AND status=1 AND IFNULL(parentid,0)=0
                                                                            UNION
                                                                            SELECT * FROM (SELECT * FROM ".TABLE_PREFIX."location WHERE name <> 'United States' AND status=1 AND IFNULL(parentid,0)=0 ORDER BY name)  t;";
                                                                  $result = $users->View($query);
                                                                  $smarty->assign('country',$result);
                                                                  $smarty->assign('billing_country',$result);
                                                                 
                                                                  $LOGINPAGE = $smarty->fetch('user_signup.tpl');
                                                                  $smarty->assign('USER_CONTENT',     $LOGINPAGE); 
                                                                  $smarty->display('user_page_main.tpl');
                                                                  exit; 
                                                     
                                                     }    
                                              }
                                             else
                                              Redirect(WEB_URL."/user_signup.php");  
                                           
                                             
                                         }
                                        else 
                                         {
                                       
                                                 //$browsUrl="https://www.paygear.com/user/sell/productpaymentoption/".urlencode(stripslashes(str_replace('.','[[dot]]',$lsSalePageId)))."/userid/".urldecode(stripslashes(str_replace('.','[[dot]]',$lauserinfo[0]['id'])))."/productid/".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['products'])))."/firstname/".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['fname'])))."/lastname/".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['lname'])))."/email/".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['email'])));
                                                 //$browsUrl="http://localhost:1002/sscPayGear/user/sell/productpaymentoption/".urlencode(stripslashes(str_replace('.','[[dot]]',$lsSalePageId)))."/userid/".urldecode(stripslashes(str_replace('.','[[dot]]',$lauserinfo[0]['id'])))."/productid/".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['products'])))."/firstname/".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['fname'])))."/lastname/".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['lname'])))."/email/".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['email'])));
                                                 $browsUrl=PAYGEAR_WEB_URL."/sell.aspx?productpaymentoption=".urlencode(stripslashes(str_replace('.','[[dot]]',$lsSalePageId)))."&userid=".urldecode(stripslashes(str_replace('.','[[dot]]',$lauserinfo[0]['id'])))."&productid=".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['products'])))."&firstname=".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['fname'])))."&lastname=".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['lname'])))."&email=".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['email'])));   
                                                if($personal==1)
                                                   $browsUrl.= "&address=".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['address'])))."&city=".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['city'])))."&country=".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['countryhiddval'])))."&state=".urlencode(stripslashes( str_replace('.','[[dot]]',$_POST['stathiddval'])))."&zipcode=".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['zipcode'])))."&phone=".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['phone'])));
                                                
                                                if($shiping==1)   
                                                   $browsUrl.="&shaddress=".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['addressSHP'])))."&shcity=".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['citySHP'])))."&shcountry=".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['shcountryhiddval'])))."&shstate=".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['shstathiddval'])))."&shzipcode=".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['zipcodeSHP'])))."&shphone=".urlencode(stripslashes(str_replace('.','[[dot]]',$_POST['phoneSHP'])));
                                               
                                                 // $browsUrl.="/";
                                                  Redirect($browsUrl); 
                                         }
                             
                             
                }
                else
                {     
                
                     $smarty->assign('msg','Username is alreay taken.');
                    $smarty->assign('is_postback','yes');
                     $iaPostdata = array();
                    $i=0;           
                    foreach($_POST as $key=>$value)                                                                                                                   
                    {   
                            $iaPostdata[$key]=$value;
                            $i++;
                    }        
                    
                     $smarty->assign('post',$iaPostdata);      
                      
                      $priceGroup=0;
                    if(isset($_GET['group']))
                       $priceGroup=$_GET['group'];
                     
                     $controlresult=$loManageFields->renderDynamiControlOnPage('signup',$priceGroup);
                     $lsvalidationresult=$loManageFields->renderDynamiControlvalidation('signup',"frmsignup",'frmvalidator');
                     $smarty->assign('controlvalidationresult',$lsvalidationresult);;
                     $smarty->assign('controlresult',$controlresult);
     
                       
                          
                       $usersignuup=new users_signup_class();
                       
                        if(isset($priceGroup))
                         $allProducts=$usersignuup->getProducts('Signup',$priceGroup);
                       else
                         $allProducts=$usersignuup->getProducts('Signup');
                          
                       $totalProducts=sizeof($allProducts);
                       
                        
                       
                  
                          $smarty->assign('products',$allProducts);
                          $smarty->assign('totalProducts',$totalProducts);
                         
                          $lsValues = array();
                               
                          $lTypes=null;
                          //$query= "SELECT id,name FROM ".TABLE_PREFIX."location where ifnull(parentid,0)=0 and status=1 order by name asc";
                          $query= "SELECT * FROM ".TABLE_PREFIX."location  WHERE name='United States' AND status=1 AND IFNULL(parentid,0)=0
                                    UNION
                                    SELECT * FROM (SELECT * FROM ".TABLE_PREFIX."location WHERE name <> 'United States' AND status=1 AND IFNULL(parentid,0)=0 ORDER BY name)  t;";
                          $result = $users->View($query);
                          $smarty->assign('country',$result);
                          $smarty->assign('billing_country',$result);
                         
                          $LOGINPAGE = $smarty->fetch('user_signup.tpl');
                          $smarty->assign('USER_CONTENT',     $LOGINPAGE); 
                          $smarty->display('user_page_main.tpl');
                          exit;          
                          
                    
                }

  break;
  
    case 'INSERTFROMPAYGEAR':
    
                
                    $iProductId=urldecode($_POST['membersite_signup_productid']);
                    $iUserId=urldecode($_POST['membersite_signup_userid']); 
                    /*$iProductId=26;
                    $iUserId=145;
                    $postedArry=ARRAY();
                    $postedArry['pg_amount']=50;
                    $postedArry['e_txn_id']='1111111545';
                    $postedArry['e_processor_name']='PAYPAL';
                    $postedArry['pg_txn_stat']='0';
                    $postedArry['payment_type']='CREDITCARD';
                    $postedArry['pg_order_id']='115';
                    $postedArry['payment_date']=1243296000;*/
                
                    $usersignuupObj=new users_signup_class();
                    $usersignuupObj->writePostArrayTofile($_POST); 
                    $usersignuupObj->updateToProductUser($_POST,$iProductId,$iUserId);
           
    break;
    case 'SIGNUP':
     
     
    //require_once INCLUDE_DIR."/is_valid_captcha.php";  
    $priceGroup=0;
    if(isset($_GET['group']))
       $priceGroup=$_GET['group'];
     
     $controlresult=$loManageFields->renderDynamiControlOnPage('signup',$priceGroup);
     $lsvalidationresult=$loManageFields->renderDynamiControlvalidation('signup',"frmsignup",'frmvalidator');
     $smarty->assign('controlvalidationresult',$lsvalidationresult);;
     $smarty->assign('controlresult',$controlresult);
          
    /*  require_once INCLUDE_DIR."/ctl_isusernameavailable.php"; 
           if(MEMBER_UNIQUE_EMAIL=='true')
           {
                require_once INCLUDE_DIR."/ctl_isemailavailable.php"; 
           }
       require_once INCLUDE_DIR."/fill_states.php";
      require_once INCLUDE_DIR."/shipping_st.php";   
       require_once INCLUDE_DIR."/agreementavailable.php"; */ 
      // require_once INCLUDE_DIR."/is_valid_captcha.php"; 
       
       //phpajax::init();  
       
          
       $usersignuup=new users_signup_class();
       
        if(isset($priceGroup))
         $allProducts=$usersignuup->getProducts('Signup',$priceGroup);
       else
         $allProducts=$usersignuup->getProducts('Signup');
          
       $totalProducts=sizeof($allProducts);
       
        
       
       if($allProducts!=false)
       {  
          $smarty->assign('products',$allProducts);
          $smarty->assign('totalProducts',$totalProducts);
         
          $lsValues = array();
               
          $lTypes=null;
          //$query= "SELECT id,name FROM ".TABLE_PREFIX."location where ifnull(parentid,0)=0 and status=1 order by name asc";
          $query= "SELECT * FROM ".TABLE_PREFIX."location  WHERE name='United States' AND status=1 AND IFNULL(parentid,0)=0
                    UNION
                    SELECT * FROM (SELECT * FROM ".TABLE_PREFIX."location WHERE name <> 'United States' AND status=1 AND IFNULL(parentid,0)=0 ORDER BY name)  t;";
          $result = $users->View($query);
          $smarty->assign('country',$result);
          $smarty->assign('billing_country',$result);
         
          $LOGINPAGE = $smarty->fetch('user_signup.tpl');
      }
     else
      {
           $smarty->assign('msg','There is no product to sigunup.');
           $LOGINPAGE = $smarty->fetch('user_error.tpl');
      }     
}

   
//**********************************************End Page code**********************************************
//Common Line
$smarty->assign('USER_CONTENT',     $LOGINPAGE); 
$smarty->display('user_page_main.tpl');

?>

Return current item: MembersGear