Location: PHPKode > projects > MembersGear > membersgear/admin/admin_import.php
<?php
  require_once "../config/config.php";
  require_once INCLUDE_DIR."/users_class.php";
  require_once INCLUDE_DIR."/import_class.php";
  require_once INCLUDE_DIR."/usersinroles_class.php";
  require_once INCLUDE_DIR."/location_class.php";
  require_once INCLUDE_DIR."/roles_class.php";
  require_once INCLUDE_DIR."/users_signup_class.php"; 
  require_once INCLUDE_DIR."/product_class.php"; 


  $users = new users_class();   
  $users_signup_class=new users_signup_class(); 
  $productobj=new product_class();
  $loImportClass = new import_class();
  
  $userinrole = new usersinroles_class();
  
  $loLocationClass = new location_class();
  
  $loRoleClass = new roles_class();
  
  if($users->IsAdminhavePermission($_SESSION[SESSION_PREFIX.'Admin_UserID'],'Can run import')==false)
  {
    Redirect('admin_nopermission.php',true);  
  }
  
  $laUserTableField = array();
  $laUserFieldIndex = array();
                            
  $laSubscriptionTableField = array();
  $laSubscriptionFieldIndex = array();


 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);  
            require_once(wordpress_physical_path_dir()."wp-admin/includes/user.php");  
            assign_sessions();     
        }
        
     }
   
 }    
                            
    switch($_action)
    {
        case 'setFields':
                $tempMsg = '';
                if($_POST['ddlUsername'] == '')
                {
                        $tempMsg .= 'Please select field where username stored in your file<br/>';   
                }
                if($_POST['ddlPassword'] == '')
                {
                        $tempMsg .= 'Please select field where password stored in your file or make it fixed<br/>';   
                }
             /*   if($_POST['ddlSubType'] == '' )
                {
                        $tempMsg .= 'Please select field where subcription type stored in your file<br/>';   
                }    */
                if($_POST['ddlSubExpireDate'] == '')
                {
                        $tempMsg .= 'Please select field where subsciption expire date stored in your file or make it fixed<br/>';   
                }
                if($_POST['ddlSubReceipt'] == '')
                {
                        $tempMsg .= 'Please select field where subscription receipt stored in your file or make it fixed<br/>';   
                }
                
                if($tempMsg != '')
                {
                        $smarty->assign('action','setFields');
                        $smarty->assign('lsmsg',$tempMsg);
                        $smarty->assign('UserNote','Step 1 of 4 : Define input format.');
                        $smarty->assign('Post',$_POST);
                        $smarty->display('admin_import.tpl');
                        break;       
                }
                $_POST['txtFieldDelimeted'] = ($_POST['txtFieldDelimeted'] == ',' or $_POST['txtFieldDelimeted'] == ';') ? $_POST['txtFieldDelimeted'] : ',';
                $smarty->assign('FieldValue',$_POST);
                $smarty->assign('action','uploadfile');
                $smarty->assign('UserNote','Step 2 of 4 : Please upload file.');
                $smarty->display('admin_import.tpl');
                break;
        
        case 'uploadfile':
                
                if($_FILES['csvFile']['size'] > 0)
                {
                        $fileName= $_FILES['csvFile']['name'];
                        $ext= explode('.',$fileName);
                        $fileType=end($ext);
                        $ext=strchr($fileName,'.');
                        $AllowedExtensions = array('.csv');
                        if(in_array($ext,$AllowedExtensions) and strlen($fileName)>0)
                        {
                            /**********************************User Table Feilds and Values***********************************/
                            $laUserTableField['username'] = 'username';
                            $laUserFieldIndex['username'] = ($_POST['hdnUsername'] != '') ? $_POST['hdnUsername'] : 0;
                            
                            $laUserTableField['password'] = 'password';
                            $laUserFieldIndex['password'] = ($_POST['hdnPassword'] != '') ? $_POST['hdnPassword'] : ' ';
                            
                            $laUserTableField['Email'] = 'Email';
                            $laUserFieldIndex['Email'] = ($_POST['hdnEmail'] != '') ? $_POST['hdnEmail'] : 0;
                            
                            $laUserTableField['firstname'] = 'firstname';
                            $laUserFieldIndex['firstname'] = ($_POST['hdnFirstname'] != '') ? $_POST['hdnFirstname'] : 0;
                            
                            $laUserTableField['lastname'] = 'lastname';
                            $laUserFieldIndex['lastname'] = ($_POST['hdnLastname'] != '') ? $_POST['hdnLastname'] : 0;
                            
                            $laUserTableField['country'] = 'country';
                            $laUserFieldIndex['country'] = ($_POST['hdnCountry'] != '') ? $_POST['hdnCountry'] : 0;
                            
                            $laUserTableField['state'] = 'state';
                            $laUserFieldIndex['state'] = ($_POST['hdnState'] != '') ? $_POST['hdnState'] : 0;
                            
                            $laUserTableField['city'] = 'city';
                            $laUserFieldIndex['city'] = ($_POST['hdnCity'] != '') ? $_POST['hdnCity'] : 0;
                            
                            $laUserTableField['address1'] = 'address1';
                            $laUserFieldIndex['address1'] = ($_POST['hdnAddress'] != '') ? $_POST['hdnAddress'] : 0;
                            
                            $laUserTableField['zipcode'] = 'zipcode';
                            $laUserFieldIndex['zipcode'] = ($_POST['hdnZIP'] != '') ? $_POST['hdnZIP'] : 0;
                            
                            $laUserTableField['isapproved'] = 'isapproved';
                            $laUserFieldIndex['isapproved'] = ($_POST['hdnIsApproved'] != '') ? $_POST['hdnIsApproved'] : 0;
                            
                            $laUserTableField['islockedout'] = 'islockedout';
                            $laUserFieldIndex['islockedout'] = ($_POST['hdnIsLockOut'] != '') ? $_POST['hdnIsLockOut'] : 0;
                            
                            $laUserTableField['phone_main'] = 'phone_main';
                            $laUserFieldIndex['phone_main'] = ($_POST['hdnContact'] != '') ? $_POST['hdnContact'] : 0;
                            
                            $laUserTableField['billing_country'] = 'billing_country';     
                            $laUserFieldIndex['billing_country'] = ($_POST['hdnShippingCountry'] != '') ? $_POST['hdnShippingCountry'] : 0;
                            
                            $laUserTableField['billing_state'] = 'billing_state';     
                            $laUserFieldIndex['billing_state'] = ($_POST['hdnShippingState'] != '') ? $_POST['hdnShippingState'] : 0;
                            
                            $laUserTableField['billing_city'] = 'billing_city';     
                            $laUserFieldIndex['billing_city'] = ($_POST['hdnShippingCity'] != '') ? $_POST['hdnShippingCity'] : 0;      
                            
                            $laUserTableField['billing_address'] = 'billing_address';     
                            $laUserFieldIndex['billing_address'] = ($_POST['hdnShippingAddtess'] != '') ? $_POST['hdnShippingAddtess'] : 0;     
                            
                             $laUserTableField['billing_phone'] = 'billing_phone';     
                            $laUserFieldIndex['billing_phone'] = ($_POST['hdnShippingContact'] != '') ? $_POST['hdnShippingContact'] : 0;
                            
                            $laUserTableField['billing_zip'] = 'billing_zip';     
                            $laUserFieldIndex['billing_zip'] = ($_POST['hdnShippingZIP'] != '') ? $_POST['hdnShippingZIP'] : 0;
                            
                            $laUserTableField['isunsubscribedfromemails'] = 'isunsubscribedfromemails';
                            $laUserFieldIndex['isunsubscribedfromemails'] = ($_POST['hdnIsUnsubscription'] != '') ? $_POST['hdnIsUnsubscription'] : 0;
                            
                           /****************************************************************************************************/ 
                           
                           /**************************** "temp_product_user" table fields and values ***************************/ 
                             
                             //$laSubscriptionTableField['hdnSubscriptionType'] = 'hdnSubscriptionType';
                             //$laSubscriptionFieldIndex['hdnSubscriptionType'] = ($_POST['hdnSubscriptionType'] != '') ? $_POST['hdnSubscriptionType'] : 0;
                             
                             $laSubscriptionTableField['username'] = 'username';
                             $laSubscriptionFieldIndex['username'] = ($_POST['hdnUsername'] != '') ? $_POST['hdnUsername'] : 0;
                             
                             $laSubscriptionTableField['productid'] = 'productid';
                             $laSubscriptionFieldIndex['productid'] = ($_POST['hdnProductID'] != '') ? $_POST['hdnProductID'] : 0;
                             
                             $laSubscriptionTableField['fromdate'] = 'fromdate';
                             $laSubscriptionFieldIndex['fromdate'] = ($_POST['hdnSubBeginDate'] != '') ? $_POST['hdnSubBeginDate'] : 0;
                             
                             $laSubscriptionTableField['uptodate'] = 'uptodate';
                             $laSubscriptionFieldIndex['uptodate'] = ($_POST['hdnSubExpireDate'] != '') ? $_POST['hdnSubExpireDate'] : 0;
                             
                             $laSubscriptionTableField['amount'] = 'amount';
                             $laSubscriptionFieldIndex['amount'] = ($_POST['hdnPaymentAmt'] != '') ? $_POST['hdnPaymentAmt'] : 0;
                             
                             $laSubscriptionTableField['paygear_etransactionid'] = 'paygear_etransactionid';
                             $laSubscriptionFieldIndex['paygear_etransactionid'] = ($_POST['hdnSubReceipt'] != '') ? $_POST['hdnSubReceipt'] : 0;
                           
                           
                           /****************************************************************************************************/     
                            
                            $result = $loImportClass->CSVImport($_FILES['csvFile']['tmp_name'],$laUserTableField,$laUserFieldIndex,$laSubscriptionTableField,$laSubscriptionFieldIndex,$_POST['hdnFieldDelimeted']);
                            
                            //print_r($result);die;
//                            print_r($result);die;

                            $DemoData = 'false';
                            
                            if( $result[0] != false && $result[1] != false) {
                                $DemoData = $loImportClass->ShowCSVData($_FILES['csvFile']['tmp_name'],$laUserTableField,$laUserFieldIndex,$laSubscriptionTableField,$laSubscriptionFieldIndex,$_POST['hdnFieldDelimeted']);                                
                            }

                            //if($result != null)
                            //{
                            $smarty->assign('UserNote','Step 3 of 4: Confirmation.');
                            $smarty->assign('UserTableQuery',$result[0]);
                            $smarty->assign('ProductTempTableQuery',$result[1]);
                            $smarty->assign('DemoData',$DemoData);
                            $smarty->assign('action','confirmation');
                            //}
                        }
                        else
                        {
                                $smarty->assign('lsmsg','Specified file is not a data file.');
                                $smarty->assign('FieldValue',$_POST);
                                $smarty->assign('action','uploadfile');
                                $smarty->assign('UserNote','Step 2 of 4 : Please upload file.');
                                
                        }
                }
                else
                {
                        $smarty->assign('lsmsg','Please specify upload file for import.');
                        $smarty->assign('FieldValue',$_POST);
                        $smarty->assign('action','uploadfile');
                        $smarty->assign('UserNote','Step 2 of 4 : Please upload file.');
                }
                
                $smarty->display('admin_import.tpl');
                break;
        
        case 'confirmation':
                  $UserTableError = '';
                  $ProductTempTableError = '';
                  
                if($_POST['hdnUserTableQuery'] != '')
                {
                       $laQuery = explode("|",trim($_POST['hdnUserTableQuery']));
                       $lsUserRejectData = '';
                       foreach($laQuery as $key=>$value)
                       {
                           if($value != '')
                           {
                                   $laInsertData = explode(",",$value);
                                   $laInsertData[0] = trim($laInsertData[0]);
                                   $existRecord = "select * from ".TABLE_PREFIX."users where username='$laInsertData[0]'";
                                   $IsUserAvailabe = $users->View($existRecord);
                                   
                                    if(!$IsUserAvailabe and (strtoupper($laInsertData[0]) != "ADMINISTRATOR" or strtoupper($laInsertData[0]) != "ADMIN"))
                                    {
                                        $InsertQuery = $loImportClass->GetUserTableQuery($laInsertData);    
                                      
                                        //$queryResult = $loImportClass->Insert($InsertQuery);
                                        $queryResult = mysql_query($InsertQuery) 
                                        or die('<br><br><h1 style="text-align:center">Import Process Failed ! </h1><br><a href="'.WEB_URL.'/admin/admin_import.php"><h2 style="text-align:center">Back to import page !</h2></a>');
                                        if($queryResult)
                                        {
                                            $liLastInsertID = mysql_insert_id();
                                            $rolename = array('customer');
                                            $roleID = $loRoleClass->GetRoleID($rolename);
                                            $lauserinrolevalue=array();
                                            $lauserinrolevalue[0]=$liLastInsertID;
                                            $lauserinrolevalue[1]=$roleID[0]['id'];
                                            $lauserinrolevalue[2]=mktime();
                                            $lauserinrolevalue[3]=0; 
                                            $lauserinrolevalue[4]=' ';   
                                            $lsRoleQueryResult = $userinrole->Insert('',$lauserinrolevalue,null);
                                            
                                            if($users_signup_class->wordpressStatuscheck()){
                                                             
                                            $wordpressReqquiredFile= wordpress_physical_path();

                                            if(file_exists($wordpressReqquiredFile)){
                                                 
                                                 $userData=$users->getSpecificUserInfoById($liLastInsertID);
                                                 $isapproved=$userData[0]['isapproved'];
                                                 $username=$userData[0]['username'];
                                                 $email= $userData[0]['email'];
                                                 $plainpass=decrypt($userData[0]['password'],$userData[0]['secretsalt']);  
                                                  
                                                 $createdUserId=wordpress_Register_User($username,$plainpass,$email);
                                                 if(!is_array($createdUserId) and !is_object($createdUserId)){
                                                 
                                                     wordpress_add_user_meta( $createdUserId, 'first_name', $userData[0]['firstname'],false);
                                                     wordpress_add_user_meta( $createdUserId, 'last_name', $userData[0]['lastname'],false);
                                                     wordpress_add_user_meta( $createdUserId, 'nickname', $username,false);
                                                    
                                                     wordpress_add_user_role($createdUserId,'subscriber');
                                                        
                                                  }

                                              } 
                                             
                                            }
                                            
                                      
                                        }
                                    }
                                    else
                                    {
                                        
                                        /* Addeed By sa For Asmita For Product Update*/
                                        
                                        
                                         $updateQuery=$loImportClass->GetUserTableUpdateQuery($laInsertData,$IsUserAvailabe[0]['id']);
                                         //$queryResult = mysql_query(stripslashes($updateQuery)) or die('<br><br><h1 style="text-align:center">Import Process Failed ! </h1><br><a href="'.WEB_URL.'/admin/admin_import.php"><h2 style="text-align:center">Back to import page !</h2></a>');
                                         $queryResult = mysql_query($updateQuery) or die('<br><br><h1 style="text-align:center">Import Process Failed ! </h1><br><a href="'.WEB_URL.'/admin/admin_import.php"><h2 style="text-align:center">Back to import page !</h2></a>');
                                        
                                        //$UserTableError .= 'Duplicate Username : '.$laInsertData[0].' This record won\'t be imported.<br/>'; 
                                            if($users_signup_class->wordpressStatuscheck()){
                                                                     
                                                     $wordpressReqquiredFile= wordpress_physical_path();
                                                    
                                                      if(file_exists($wordpressReqquiredFile)){
                                                             
                                                           $laUserData=$users->getSpecificUserInfoById($IsUserAvailabe[0]['id']);
                                                           
                                                           if($laUserData!=false){
                                                         
                                                                 $plainpass=decrypt($laUserData[0]['password'],$laUserData[0]['secretsalt']);
                                                                 
                                                                 $createdUserId = wordpress_username_exists( $laUserData[0]['username'] );
                                                                  $isemailExist=wordpress_email_exists($laUserData[0]['email']);            
                                                                  if(!$createdUserId and !$isemailExist){  
                                                                  
                                                                      $createdUserId=wordpress_Register_User($laUserData[0]['username'],$plainpass,$laUserData[0]['email']);
                                                                      if(!is_array($createdUserId) and !is_object($createdUserId)){
                                                                     
                                                                         wordpress_add_user_meta( $createdUserId, 'first_name', $laUserData[0]['firstname'],false);
                                                                         wordpress_add_user_meta( $createdUserId, 'last_name', $laUserData[0]['lastname'],false);
                                                                         wordpress_add_user_meta( $createdUserId, 'nickname', $laUserData[0]['username'],false);
                                                                         
                                                                         $savedRoles=wordpress_get_option('membersgear_roles'); 
                                                                         $wp_role=array('subscriber'=>0,'contributor'=>1,'author'=>4,'editor'=>7,'administrator'=>10);
                                                                         $wp_role_byname=array(0=>'subscriber',1=>'contributor',4=>'author',7=>'editor',10=>'administrator');
                                                                        
                                                                         
                                                                         $userSubscribedProducts=$users_signup_class->getAlluserSubscribedProduct( $IsUserAvailabe[0]['id']); 
                                                                         $rolArr=array();
                                                                          if(count($userSubscribedProducts) > 0 and $userSubscribedProducts!=false)
                                                                          {
                                                                             for($i=0;$i<=count($userSubscribedProducts)-1;$i++)
                                                                              {
                                                                                  if(array_key_exists($userSubscribedProducts[$i]['id'],$savedRoles)){
                                                                                  
                                                                                    if(array_key_exists($savedRoles[$userSubscribedProducts[$i]['id']],$wp_role)){
                                                                                    
                                                                                        $rolArr[]=$wp_role[$savedRoles[$userSubscribedProducts[$i]['id']]];
                                                                                    
                                                                                     }
                                                                                  
                                                                                  }
                                                                              }
                                                                          } 
                                                                         $maxRole=max($rolArr);
                                                                         $roleName=$wp_role_byname[$maxRole];  
                                                                            
                                                                         if($roleName!=''){
                                                                        
                                                                            wordpress_add_user_role($createdUserId,$roleName);
                                                                         }
                                                                        else{
                                                                        
                                                                            wordpress_add_user_role($createdUserId,'subscriber');
                                                                          
                                                                        }
                                                                            
                                                                     }
                                                                   
                                                                 }
                                                                else{
                                                                      wordpress_change_user_password($laUserData[0]['username'],$plainpass);  
                                                                     
                                                                
                                                                }      
                                                                 
                                                           }
                                                       
                                                       
                                                      } 
                                                          
                                                 }
                                                 
                                              $phpBBStatus=false;  
                                             $phpBBStatus=$users_signup_class->phpbbStatuscheck();
                                             if($phpBBStatus)
                                             {
                                                $laUserData=$users->getSpecificUserInfoById($IsUserAvailabe[0]['id']);
                                                $isApprovedUser=$laUserData[0]['isapproved'];
                                                
                                                $pro_Id=phpBB_get_product_id();   
                                                mysql_select_db(MEMBERSGEAR_DB_NAME); 
                                                $phpBBSubscriptionId=$productobj->checkForActiveSubscription($IsUserAvailabe[0]['id'],$pro_Id);
                                                if($phpBBSubscriptionId!="" and $phpBBSubscriptionId!=null){
                                                
                                                     if($isApprovedUser=="1"){
                                                       
                                                         phpBB_activate_deactivate_user($laInsertData[0],0);
                                                         phpBB_user_change_password($laInsertData[0],$UserTableValues[1]);     
                                                         mysql_select_db(MEMBERSGEAR_DB_NAME);
                                                      
                                                     }
                                                     else{
                                                            phpBB_activate_deactivate_user($laInsertData[0],1);
                                                            phpBB_user_change_password($laInsertData[0],$UserTableValues[1]);     
                                                            mysql_select_db(MEMBERSGEAR_DB_NAME);
                                                     } 
                                                
                                                }
                                             mysql_select_db(MEMBERSGEAR_DB_NAME); 
                                          }
                                          
                                          
                                    }
                           }
                       }   
                }
                
                if($_POST['hdnProductTempTableQuery'] != '')
                {
                       $laQuery = explode("|",trim($_POST['hdnProductTempTableQuery']));
                       foreach($laQuery as $key=>$value)
                       {
                           if($value != '')
                           {
                                   $laInsertData = explode(",",$value);
                                   $laInsertData[0] = trim($laInsertData[0]);
                                   $getUserID = "select id from ".TABLE_PREFIX."users where username='$laInsertData[0]'";
                                   $userID = $users->View($getUserID);
                                   
                                   if(isset($userID) and is_array($userID))
                                   {
                                       $existRecord = 'select * from '.TABLE_PREFIX.'product_users where userid=? and productid=?';
                                       $lsProductTempData = array();
                                       $lsProductTempData[] = $userID[0]['id'];
                                       $lsProductTempData[] = $laInsertData[1];
                                       
                                       $IsDataExist = $loImportClass->View($existRecord,$lsProductTempData,null);
                                       
                                //       if(!$IsDataExist)
                                       {
                                           $laInsertData[0] = $userID[0]['id'];   
                                           $InsertQuery = $loImportClass->GetProductTempTableQuery($laInsertData);
                                       //    echo $InsertQuery;
                                          
                                           $queryResult = mysql_query($InsertQuery) or die('<br><br><h1 style="text-align:center">Import Process Failed ! </h1><br><a href="'.WEB_URL.'/admin/admin_import.php"><h2 style="text-align:center">Back to import page !</h2></a>');
                                       }
                                       //else
//                                       {
//                                            $ProductTempTableError .= 'Duplicate Product ID : '.trim($laInsertData[1]).' And User ID : '.$userID[0]['id'].' This record won\'t be imported.<br/>';
//                                       }

                                         $userData=$users->getSpecificUserInfoById($userID[0]['id']);
                                         
                                         if($userData!=false){
                                         
                                             $isapproved=$userData[0]['isapproved'];
                                             $username=$userData[0]['username'];
                                             $email= $userData[0]['email'];
                                             $plainpass=decrypt($userData[0]['password'],$userData[0]['secretsalt']);  
                                             
                                             if($users_signup_class->wordpressStatuscheck()){
                                                     
                                                    $wordpressReqquiredFile= wordpress_physical_path();
                                                  
                                                    if(file_exists($wordpressReqquiredFile)){
                                                                 
                                                         $user_id = wordpress_username_exists( $userData[0]['username'] );
                                                       
                                                         if ( $user_id ) {
                                                         
                                                            $savedRoles=wordpress_get_option('membersgear_roles'); 
                                                             
                                                                     
                                                             if(array_key_exists($proId,$savedRoles)){
                                                             
                                                                $rolename=strtolower($savedRoles[$proId]);
                                                                wordpress_add_user_role($user_id,$rolename);
                                                               
                                                             }
                                                            else{
                                                            
                                                                 wordpress_add_user_role($user_id,'subscriber');
                                                              
                                                            }
                                                         
                                                         }
                                                    } 
                                        
                                              }
                                                  
                                             $phpBBStatus=false;
                                             $phpBBStatus=$users_signup_class->phpbbStatuscheck();
                                             if($phpBBStatus)
                                             {
                                                $pro_Id=phpBB_get_product_id(); 
                                                mysql_select_db(MEMBERSGEAR_DB_NAME); 
                                                         
                                                if($laInsertData[1]==$pro_Id){
                                              
                                                         
                                                         
                                                         $userdata_phpbb=phpBB_IFUser_Exist($username);
                                                         mysql_select_db(MEMBERSGEAR_DB_NAME);    
                                                         if($userdata_phpbb!=null and $userdata_phpbb!="" and $userdata_phpbb!=false and isset($userdata_phpbb['username']))
                                                         {
                                                                             
                                                               $subsProId=$productobj->checkForActiveSubscription($userID[0]['id'],$pro_Id);
                                                               if($pro_Id==$subsProId)
                                                               {
                                                                   if($isapproved=="1"){
                                                                   
                                                                         phpBB_activate_deactivate_user($username,0);
                                                                         phpBB_user_change_password($username,$plainpass);     
                                                                         mysql_select_db(MEMBERSGEAR_DB_NAME);
                                                                    
                                                                   }
                                                                  else{ 
                                                                          phpBB_activate_deactivate_user($username,1);
                                                                          phpBB_user_change_password($username,$plainpass);  
                                                                   }
                                                               }
                                                           
                                                          
                                                            
                                                         }
                                                        else{
                                                        
                                                             $subsProId=$productobj->checkForActiveSubscription($userID[0]['id'],$pro_Id);
                                                               if($pro_Id==$subsProId)
                                                               {
                                                                   if($isapproved=="1"){
                                                                
                                                                         phpBB_registerUser($username,$plainpass,$email,0);
                                                                   }
                                                                   else{
                                                                   
                                                                         phpBB_registerUser($username,$plainpass,$email,1);
                                                                   
                                                                   }
                                                               }   
                                                           } 
                                                           
                                                  }              
                                             }
                                             
                                           
                                          } 
                                        
                                   }
                                   else
                                   {
                                        $ProductTempTableError .= 'User : '.$laInsertData[0].' not found. Product ID : '.trim($laInsertData[1]).' this record wont\'t be imported.<br/>';   
                                   }
                           }
                       }
                }
                //die;  
                $smarty->assign('UserNote','Completed');
                $smarty->assign('action','complete');
                $smarty->assign('UserTableError',$UserTableError);
                $smarty->assign('ProductTempTableError',$ProductTempTableError);
                $smarty->display('admin_import.tpl');
                 
                break;
        default:
                $smarty->assign('action','setFields');
                $smarty->assign('UserNote','Step 1 of 4 : Define input format.');
                $smarty->display('admin_import.tpl');
        
    }
?>
Return current item: MembersGear