Exemple #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();
 }
if (isset($_SESSION['current_user_id'])) {
    $userController = new UserController();
    $user = $userController->selectByID($_SESSION['current_user_id']);
    echo $user->getFirstName() . ' ' . $user->getLastName();
} else {
    header('Location:http://localhost/Environment-Monitoring-System/login.php');
}
?>
                                    </strong>
                             </span>
                             <span class="text-muted text-xs block">
                                    <?php 
if (isset($_SESSION['login_id'])) {
    $userLoginController = new UserLoginController();
    $user = $userLoginController->selectById($_SESSION['login_id']);
    $userTypeController = new UserTypeController();
    $userType = $userTypeController->selectById($user->getUserTypeIduserType());
    echo $userType->getDescription();
}
?>
<b class="caret"></b></span> </span> </a>

                    </div>


                </li>
                <li class="active">
                    <a href="index.php"><i class="fa fa-th-large"></i> <span class="nav-label">Introduction</span></a>
                </li>

                <li>
 *   (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";
checkAdminLoggedIn();
include_once SP_CTRLPATH . "/user-type.ctrl.php";
$controller = new UserTypeController();
$controller->view->menu = 'seotools';
$controller->layout = 'ajax';
$controller->spTextPanel = $controller->getLanguageTexts('panel', $_SESSION['lang_code']);
$controller->set('spTextPanel', $controller->spTextPanel);
$controller->spTextWeb = $controller->getLanguageTexts('website', $_SESSION['lang_code']);
$controller->set('spTextWeb', $controller->spTextWeb);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    switch ($_POST['sec']) {
        case "create":
            $controller->createUserType($_POST);
            break;
        case "update":
            $controller->updateUserType($_POST);
            break;
        case "activateall":