예제 #1
0
 function startRegistration()
 {
     $_POST = sanitizeData($_POST);
     $this->set('post', $_POST);
     $userInfo = $_POST;
     $subscriptionActive = false;
     $errMsg['userName'] = formatErrorMsg($this->validate->checkUname($userInfo['userName']));
     $errMsg['password'] = formatErrorMsg($this->validate->checkPasswords($userInfo['password'], $userInfo['confirmPassword']));
     $errMsg['firstName'] = formatErrorMsg($this->validate->checkBlank($userInfo['firstName']));
     $errMsg['lastName'] = formatErrorMsg($this->validate->checkBlank($userInfo['lastName']));
     $errMsg['email'] = formatErrorMsg($this->validate->checkEmail($userInfo['email']));
     $errMsg['code'] = formatErrorMsg($this->validate->checkCaptcha($userInfo['code']));
     $errMsg['utype_id'] = formatErrorMsg($this->validate->checkNumber($userInfo['utype_id']));
     // if payment plugin installed check whether valid payment gateway found
     $seopluginCtrler = new SeoPluginsController();
     if ($seopluginCtrler->isPluginActive("Subscription")) {
         $subscriptionActive = true;
         $errMsg['pg_id'] = formatErrorMsg($this->validate->checkNumber($userInfo['pg_id']));
     }
     if (!$this->validate->flagErr) {
         if (!$this->__checkUserName($userInfo['userName'])) {
             if (!$this->__checkEmail($userInfo['email'])) {
                 $utypeId = intval($userInfo['utype_id']);
                 $sql = "insert into users\r\n\t\t\t\t\t(utype_id,username,password,first_name,last_name,email,created,status) \r\n\t\t\t\t\tvalues ({$utypeId},'" . addslashes($userInfo['userName']) . "','" . md5($userInfo['password']) . "',\r\n\t\t\t\t\t'" . addslashes($userInfo['firstName']) . "','" . addslashes($userInfo['lastName']) . "',\r\n\t\t\t\t\t'" . addslashes($userInfo['email']) . "',UNIX_TIMESTAMP(),1)";
                 $this->db->query($sql);
                 // get user id created
                 $userId = $this->db->getMaxId('users');
                 // check whether subscription is active
                 if ($subscriptionActive and $userId) {
                     $utypeCtrler = new UserTypeController();
                     $utypeInfo = $utypeCtrler->__getUserTypeInfo($utypeId);
                     // if it is paid subscription, proceed with payment
                     if ($utypeInfo['price'] > 0) {
                         $paymentPluginId = intval($userInfo['pg_id']);
                         @Session::setSession('payment_plugin_id', $paymentPluginId);
                         $quantity = intval($userInfo['quantity']);
                         $pluginCtrler = $seopluginCtrler->createPluginObject("Subscription");
                         $paymentForm = $pluginCtrler->pgCtrler->getPaymentForm($paymentPluginId, $userId, $utypeInfo, $quantity);
                         $this->set('paymentForm', $paymentForm);
                     }
                 }
                 $this->render('common/registerconfirm');
                 return True;
             } else {
                 $errMsg['email'] = formatErrorMsg($_SESSION['text']['login']['emailexist']);
             }
         } else {
             $errMsg['userName'] = formatErrorMsg($_SESSION['text']['login']['usernameexist']);
         }
     }
     $this->set('errMsg', $errMsg);
     $this->register();
 }
예제 #2
0
 *   sendtogeo@gmail.com   												   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
include_once "includes/sp-load.php";
include_once SP_CTRLPATH . "/seoplugins.ctrl.php";
$seopluginCtrler = new SeoPluginsController();
if ($seopluginCtrler->isPluginActive("Subscription")) {
    // verify the payment plugin id and invoice id in the session
    if (!empty($_SESSION['payment_plugin_id']) && !empty($_SESSION['invoice_id'])) {
        $pluginCtrler = $seopluginCtrler->createPluginObject("Subscription");
        $pluginCtrler->pgCtrler->processTransaction($_SESSION['payment_plugin_id'], $_SESSION['invoice_id'], $_GET, $_POST);
    } else {
        echo "Valid invoice id not found!";
    }
} else {
    echo "Not authorized to access this page!";
}