Example #1
0
	function index()
	{
		//validate login
		if (user_login())
		{
			if($this->session->userdata('user_type') != 'reseller')
			{
				redirect ('home/');
			}
            else
            {
                $data['page_name']		=	'dashboard';
                $data['selected']		=	'dashboard';
                $data['page_title']		=	'DASHBOARD';
                $data['main_menu']	    =	'default/main_menu/reseller_main_menu';
                $data['sub_menu']	    =	'';
                $data['main_content']	=	'reseller/dashboard';
                $this->load->view('default/template',$data);
            }
		}
        else
        {
            redirect ('home/'); //main home controller
        }
	}
Example #2
0
	function __construct()
	{
		parent::__construct();
		$this->load->model('freeswitch_model');
		// validate login
		if (!user_login())
		 {
		            redirect ('home/');
		 }
		//  else
		//  {
		//             if($this->session->userdata('user_type') == 'customer')
		//             {
		//                redirect ('customer/');
		//             }
		//             
		//             if($this->session->userdata('user_type') == 'reseller')
		// 	{
		// 		redirect ('reseller/');
		// 	}
		//              
		//             if($this->session->userdata('user_type') == 'sub_admin')
		//             {
		//                 if(sub_admin_access_any_cell($this->session->userdata('user_id'), 'view_profiles') == 0)
		//                 {
		//                     redirect ('home/');
		//                 }
		//             }
		//  }
	}
Example #3
0
	function __construct()
	{
		parent::__construct();
		$this->load->model('groups_model');
		$this->load->model('carriers_model');

		//validate login
		if (!user_login())
		{
			redirect ('home/');
		}
		else
		{
			if($this->session->userdata('user_type') == 'customer')
			{
				redirect ('customer/');
			}
            
            if($this->session->userdata('user_type') == 'reseller')
			{
				redirect ('reseller/');
			}
            
            if($this->session->userdata('user_type') == 'sub_admin')
            {
                if(sub_admin_access_any_cell($this->session->userdata('user_id'), 'view_rate_groups') == 0)
                {
                    redirect ('home/');
                }
            }
		}
	}
Example #4
0
	function __construct()
	{
		parent::__construct();
		$this->load->model('manage_accounts_model');

		//validate login
		if (!user_login())
		{
			redirect ('home/');
		}
		else
		{
			if($this->session->userdata('user_type') == 'customer')
			{
				redirect ('customer/');
			}
            
            if($this->session->userdata('user_type') == 'reseller')
			{
				redirect ('reseller/');
			}
            
            if($this->session->userdata('user_type') == 'sub_admin')
			{
				redirect ('home/');
			}
		}
	}
Example #5
0
 public function ajax_login()
 {
     $return = false;
     if (user_login()) {
         $return = '<span>您好,' . $_SESSION['user_login']['uname'] . '</span><b>|</b><a href="' . U('user/logout') . '">登出</a>';
     }
     echo $return;
 }
Example #6
0
 protected function access()
 {
     // 获取当前用户ID
     if (user_login() <= 0) {
         // 还没登录 跳转到登录页面
         $this->redirect('user/login', '', '1', '请登录...');
     }
 }
Example #7
0
 /**
  * Authenticate user
  *
  * @static
  * @param _array $user
  * @param array $user['login']
  * @param array $user['password']
  * @return string session ID
  */
 public static function authenticate($user)
 {
     $login = user_login($user['user'], $user['password'], ZBX_AUTH_INTERNAL);
     if ($login) {
         return $login;
     } else {
         self::$error = array('error' => ZBX_API_ERROR_PARAMETERS, 'data' => 'Given login or password is incorrect.');
     }
 }
/**
 * test if a value is a valid range
 *
 * @param string $value the value being tested
 * @param boolean $empty if field can be empty
 * @param array params validate parameter values
 * @param array formvars form var values
 */
function smarty_validate_criteria_isValidPassword($value, $empty, &$params, &$formvars)
{
    if (!isset($params['field2'])) {
        trigger_error("SmartyValidate: [isValidPassword] parameter 'field2' is missing.");
        return false;
    }
    if (strlen($value) == 0) {
        return $empty;
    }
    return user_login($formvars[$params['field']], $formvars[$params['field2']]);
}
Example #9
0
 function Grader()
 {
     parent::Controller();
     $this->load->model('home_model');
     $this->load->model('user_model');
     $this->load->model('admin_model');
     $this->load->helper('check_login');
     $this->load->helper('breadcrumb');
     if (!user_login()) {
         redirect('main/home/user_login');
     }
 }
Example #10
0
 public function _initialize()
 {
     parent::_initialize();
     $this->_mod = D('user');
     $this->_userid = user_login();
     if ($this->_userid) {
         $userinfo = $this->_mod->find($this->_userid);
         $this->assign('userid', $this->_userid);
         $this->assign('userinfo', $userinfo);
     }
     $this->assign('current', 'user');
     $seo['title'] = '会员中心';
     $this->_seo($seo);
 }
Example #11
0
function Login()
{
    $smarty = smarty_init(dirname(__FILE__) . '/templates');
    if (isset($_REQUEST['submit'])) {
        $data = formdata_from_post();
        $errors = formdata_validate($data);
        if (count($errors) == 0) {
            user_login($data['Extension']);
            header('Location: Account_Modify.php');
            die;
        }
    }
    $smarty->assign('Errors', $errors);
    return $smarty->fetch('Login.tpl');
}
Example #12
0
	function __construct()
	{
		parent::__construct();
		$this->load->model('reseller/billing_model');
		$this->load->library('pdf');
		//validate login
		if (!user_login())
		{
			redirect ('home/');
		}
		else
		{
            if($this->session->userdata('user_type') != 'reseller')
			{
				redirect ('home/');
			}
		}
	}
Example #13
0
	function __construct()
	{
		parent::__construct();
		$this->load->model('reseller/groups_model');
		$this->load->model('reseller/carriers_model');

		//validate login
		if (!user_login())
		{
			redirect ('home/');
		}
		else
		{
			if($this->session->userdata('user_type') != 'reseller')
			{
				redirect ('home/');
			}
		}
	}
Example #14
0
	function __construct()
	{
		parent::__construct();
		$this->load->model('customer_model');
		$this->load->model('groups_model');
		$this->load->model('manage_accounts_model');
        $this->load->model('billing_model');
		//validate login
		if (!user_login())
		{
			redirect ('home/');
		}
		else
		{
			if($this->session->userdata('user_type') != 'customer')
			{
				redirect ('home/');
			}
		}
	}
Example #15
0
function login_validate()
{
    global $smarty, $lang;
    $user = trim(@$_POST['user']);
    $pass = trim(@$_POST['pass']);
    $error = array();
    $lerr =& $lang['login']['error'];
    if (!$user) {
        $error['user'] = $lerr['user'];
    }
    if (!$pass) {
        $error['pass'] = $lerr['pass'];
    }
    if (!$error && !user_login($user, $pass)) {
        $error['match'] = $lerr['match'];
    }
    if ($error) {
        $smarty->assign('error', $error);
        return 0;
    }
    return 1;
}
Example #16
0
 function login($account, $username, $password)
 {
     log_debug("authenticate", "Executing login({$account}, {$username}, {$password})");
     // sanitise input
     $account = @security_script_input_predefined("any", $account);
     $username = @security_script_input_predefined("any", $username);
     $password = @security_script_input_predefined("any", $password);
     // $account is only used by Amberdms's hosted billing system - for single instance configurations
     // it is unused, and simply exists to ensure a standard API across all product versions
     $result = user_login($account, $username, $password);
     switch ($result) {
         case "-5":
             throw new SoapFault("Sender", "DATABASE_VERSION_MISMATCH");
             break;
         case "-4":
             throw new SoapFault("Sender", "USER_DISABLED");
             break;
         case "-3":
             throw new SoapFault("Sender", "INVALID_AUTHDETAILS");
             break;
         case "-2":
             throw new SoapFault("Sender", "USER_DISABLED");
             break;
         case "-1":
             throw new SoapFault("Sender", "BLACKLISTED");
             break;
         case "0":
         default:
             throw new SoapFault("Sender", "INVALID_AUTHDETAILS");
             break;
         case "1":
             // successful authentication
             $sid = session_name() . "=" . session_id();
             return $sid;
             break;
     }
 }
Example #17
0
$smarty->config_dir = $config['smarty']['config_dir'];
$smarty->cache_dir = $config['smarty']['cache_dir'];
//database connect
$pdo_db = new PDO(sprintf('mysql:host=%s;dbname=%s;charset=utf8', $config['mysql']['host'], $config['mysql']['dbname']), $config['mysql']['user'], $config['mysql']['passwd']);
$pdo_db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$pdo_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo_db->query("SET NAMES utf8");
$transaction_counter = 0;
$nested_transaction_counter = 0;
$total_time = 0;
$total_queries = 0;
set_exception_handler('oc_exception_handler');
//cookie check
if (!is_logged() && !isset($_SESSION['user_pending']) && isset($_COOKIE['auth'])) {
    if ($user_id = check_auth_cookie()) {
        if (user_login('', '', $user_id, $_COOKIE['auth'])) {
            header("Location:" . $_SERVER['REQUEST_URI']);
            exit;
        }
    }
}
//debug mode
if (is_admin() && isset($_GET['debug']) && ($debug = $_GET['debug'])) {
    if ($debug == 'on' && !isset($_SESSION['debug_mode'])) {
        $_SESSION['debug_mode'] = 1;
    } elseif ($debug == 'off' && $_SESSION['debug_mode']) {
        unset($_SESSION['debug_mode']);
    }
    header("Location:" . $_SERVER['HTTP_REFERER']);
    exit;
}
Example #18
0
 * If the admin wants to visit the homepage of the client
 * then we use the VIEW otherwise the admin is visiting the
 * profile of the client which is the profile VARIABLE
 */
if (isset($_GET['VIEW']) && !empty($_GET['VIEW']) || isset($_GET['PROFILE']) && !empty($_GET['PROFILE'])) {
    // Login as the user
    if (isset($_GET['VIEW'])) {
        $client_id = $_GET['VIEW'];
        $redirect_url = '/dashboard/dashboard';
    } else {
        $client_id = $_GET['PROFILE'];
        $redirect_url = '/users/profile';
    }
    $_SESSION['FAKE_LOGIN'] = $_SESSION['user']['PARTY_ID'];
    $client = users_get_login($client_id);
    user_login($client['USER_LOGIN_ID'], $client['CURRENT_PASSWORD']);
    $_SESSION['user']['IS_ADMIN'] = false;
    $_SESSION['user']['LAST_ACTION'] = time();
    header(sprintf('location: %s', $redirect_url));
    exit;
}
if (isset($_GET['DELETE']) && !empty($_GET['DELETE'])) {
    if (!party_exists($_GET['DELETE'])) {
        $errors[] = sprintf('Customer with id %s does not exist', $_GET['DELETE']);
    } else {
        $person = person_get($_GET['DELETE']);
        person_status_update($_GET['DELETE'], DELETED);
        $success[] = sprintf('Customer: %s %s has been marked as deleted', $person['FIRST_NAME'], $person['LAST_NAME']);
    }
}
$page = forms_get_page();
Example #19
0
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $success = false;
    if (isset($_POST['action'])) {
        $action = $_POST['action'];
        switch ($action) {
            case 'login':
                if (user_isloggedin()) {
                    break;
                }
                if (isset($_POST['username']) && isset($_POST['password'])) {
                    $username = mysql_real_escape_string(trim($_POST['username']));
                    $password = mysql_real_escape_string(trim($_POST['password']));
                    if (empty($username) or empty($password)) {
                        break;
                    }
                    $success = user_login($username, $password);
                }
                break;
            case 'logout':
                if (!user_isloggedin()) {
                    break;
                }
                $success = user_logout();
                break;
            default:
                break;
        }
    }
    if ($success) {
        echo 'success';
    } else {
Example #20
0
    <input type="submit" name="log">
  </form>

  <p>Регистрация</p>
  <form action="" method="post">
    <input type="text" name="login_reg">
    <input type="password" name="pass_reg">
    <input type="submit" name="reg">
  </form>
<?php 
    $login = '';
    $pass = '';
    if (isset($_POST['log'])) {
        $login = $_POST['login_log'];
        $pass = $_POST['pass_log'];
        $result = user_login($login, $pass);
        if ($result == false) {
            echo "Неверно указан логин или пароль";
        }
    }
    if (isset($_POST['reg'])) {
        $login = $_POST['login_reg'];
        $pass = $_POST['pass_reg'];
        $result = user_reg($login, $pass);
        var_dump($result);
        if ($result) {
            echo "Регистрация успешно удалась";
        } else {
            echo "Регистрация не удалась";
        }
    }
Example #21
0
<?php

$dir = preg_replace('/\\b\\w*users\\w*\\b/i', '', trim(__DIR__));
$dir = preg_replace('/\\b\\w*includes\\w*\\b/i', '', trim($dir));
include_once $dir . '/config/db_connect.php';
include_once $_SERVER["DOCUMENT_ROOT"] . site_name . '/classes/functions.php';
sec_session_start();
// Our custom secure way of starting a PHP session.
if (isset($_POST['email'], $_POST['p'])) {
    $email = $_POST['email'];
    $password = $_POST['p'];
    // The hashed password.
    if (user_login($email, $password, $mysqli) == true) {
        // Login success
        header('Location: ' . site_name . '/users/user_profile.php');
    } else {
        // Login failed
        header('Location: ' . site_name . '/login.php?error=1');
    }
} else {
    // The correct POST variables were not sent to this page.
    echo 'Invalid Request';
}
function last_contact($date, $show_only_date, $user_ID)
{
    //global $show_only_date;
    if ($show_only_date) {
        $data = mysql2localedate($date);
    } else {
        $data = mysql2localedatetime($date);
    }
    $login = user_login($user_ID, false);
    if ($login != '') {
        $threads_url = get_dispctrl_url('threads', 'colselect_submit=Filter+list&amp;u=' . $login);
        $data = '<a href="' . $threads_url . '">' . $data . '</a>';
    }
    return $data;
}
Example #23
0
 }
 if ($class == 'calc_cart' && isset($data['mobile_user_id']) && intval($data['mobile_user_id']) > 0) {
     //将会员信息存在session中
     /*
     es_session::set('uid',intval($data['mobile_user_id']));
     es_session::set('user_email',$data['mobile_user_name']);
     es_session::set('user_pwd',$data['mobile_user_pwd']);
     //cookie
     es_cookie::set('uid',intval($data['mobile_user_id']),3600*24*365);
     es_cookie::set('user_email',$data['mobile_user_name'],3600*24*365);
     es_cookie::set('user_pwd',$data['mobile_user_pwd'],3600*24*365);
     */
     es_cookie::set("user_name", $data['mobile_user_name'], 3600 * 24 * 30);
     es_cookie::set("user_pwd", md5($data['mobile_user_pwd'] . "_EASE_COOKIE"), 3600 * 24 * 30);
     //用户登陆处理;
     user_login();
 }
 if ($class == 'pay_order') {
     //微信v3版跳转
     //print_r($data['is_wap_url']); echo "<br>";echo $data['wap_notify_url'];exit;
     if ($data['wap_notify_url'] && $data['is_wap_url'] == 1) {
         Header("location:" . $data['wap_notify_url']);
         exit;
     }
     //在支付界面时,清空购买车,但如果清空了,用户点:返回 后,再去购买时,会购买空商品,这个需要注意处理一下
     $session_cart_data = es_session::get("cart_data");
     unset($session_cart_data);
     es_session::set("cart_data", $session_cart_data);
     es_session::set("cart_data", array());
     es_session::delete("cart_data");
 }
Example #24
0
                        validUserLog($row, 1, '');
                    }
                }
            }
        }
    }
    if (empty($error)) {
        $nv_redirect = !empty($nv_redirect) ? nv_base64_decode($nv_redirect) : NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
        $info = $lang_module['login_ok'] . "<br /><br />\n";
        $info .= "<img border=\"0\" src=\"" . NV_BASE_SITEURL . "images/load_bar.gif\"><br /><br />\n";
        $info .= '[<a href="' . $nv_redirect . '">' . $lang_module['redirect_to_back'] . '</a>]';
        $contents .= user_info_exit($info);
        $contents .= '<meta http-equiv="refresh" content="2;url=' . nv_url_rewrite($nv_redirect) . '" />';
        include NV_ROOTDIR . '/includes/header.php';
        echo nv_site_theme($contents, $full);
        include NV_ROOTDIR . '/includes/footer.php';
        exit;
    }
    $lang_module['login_info'] = '<span style="color:#fb490b;">' . $error . '</span>';
    $array_login = array('nv_login' => $nv_username, 'nv_password' => $nv_password, 'nv_header' => $nv_header, 'nv_redirect' => $nv_redirect);
} else {
    $array_login = array('nv_login' => '', 'nv_password' => '', 'nv_header' => $nv_header, 'nv_redirect' => $nv_redirect);
}
$array_login['openid_info'] = $lang_module['what_is_openid'];
if ($global_config['allowuserreg'] == 2) {
    $array_login['openid_info'] .= '<br />' . $lang_module['or_activate_account'];
}
$contents .= user_login($gfx_chk, $array_login);
include NV_ROOTDIR . '/includes/header.php';
echo nv_site_theme($contents, $full);
include NV_ROOTDIR . '/includes/footer.php';
Example #25
0
            	<img src="<?php 
echo base_url();
?>
system/assets/images/logo.png" alt="logo"/>
		</div>
	</div>
    <div class="row-fluid">
		<div class="span12">
            <!--menu start-->
            <div class="navbar">
                    <div class="navbar-inner">                
                            	<?php 
$active = 'active';
?>
				<?php 
if (user_login()) {
    ?>
                            	<ul class="nav">    
                                    <!--<li class="<?php 
    if ($page == 'home') {
        echo $active;
    }
    ?>
"><a href="<?php 
    echo base_url();
    ?>
">Home</a></li>-->
                                    <?php 
    if ($this->session->userdata('user_type') == '3') {
        ?>
                                    <li class="<?php 
Example #26
0
        } else {
            $arr['email'] = db_string($email);
        }
    }
    if ($chpasswd_val) {
        global $passwd, $passwd_confirm;
        if ($passwd != $passwd_confirm) {
            add_info('Ошибка подтверждеия пароля. Пароль не был обновлен.');
        } else {
            $arr['password'] = '******' . addslashes(user_password_hash(user_login(), stripslashes($passwd))) . '")';
        }
    }
    if (count($arr) > 0) {
        db_update('user', $arr, '`id`=' . user_id());
        if (isset($arr['password'])) {
            user_authorize(user_login(), stripslashes($passwd));
        }
    }
}
$u = user_get_by_id(user_id());
$f = new CVCForm();
$f->Init('', 'action=.?action\\=save' . ($redirect != '' ? '&redirect=' . prepare_arg($redirect) . ';backlink=' . prepare_arg($redirect) : '') . ';method=POST;add_check_func=check;');
$f->AppendLabelField('Имя пользователя', '', $u['name']);
$f->AppendLabelField('Логин', '', $u['login']);
if ($u['email'] != '') {
    $f->AppendCustomField(array('src' => '<table class="clear" width="100%"><tr><td width="30%">E-Mail</td><td><input id="email" name="email" type="text" class="txt block" value="' . htmlspecialchars($u['email']) . '"></td></tr></table>' . '<button class="block" type="button" onclick="check_frm_email ();" style="margin-top: 4px;">Проверить</button>' . '<div id="email_check_res" style="display: none;"></div>'));
}
$f->AppendCustomField(array('title' => '<input type="checkbox" class="cb pointer" value="1" onclick="fchpasswd (this);" id="chpasswd" name="chpasswd_val"><span class="pointer" onclick="var e=getElementById (\'chpasswd\'); e.checked=!e.checked; fchpasswd (e);">Сменить пароль</span>', 'src' => '<div id="passwd_block" class="invisible">' . '<table class="clear" width="100%"><tr><td width="85">Новый пароль</td><td style="padding-bottom: 2px;"><input type="password" class="txt block" id="passwd" name="passwd" onkeyup="check_passwd ();" onchange="check_passwd ();"></td></tr>' . '<tr><td>Подтверждение</td><td style="padding-top: 2px;"><input type="password" class="txt block" id="passwd_confirm" name="passwd_confirm" onkeyup="check_passwd ();" onchange="check_passwd ();"></td></tr>' . '</table><div id="passwd_msg"></div></div>'));
?>

<script language="JavaScript" type="text/JavaScript">
Example #27
0
    $count = $db->getOne("select count(*) from author where email = '{$email}'");
    if ($count > 0) {
        $check = false;
        $smarty->assign('error_msg', 'the email address is already used');
        $smarty->assign('user', $_POST);
        $smarty->display('register.tpl');
        exit;
    }
    $password = md5($password);
    $db->query("insert into author (username,password,email,plan,defaultLanguageId) values ('{$username}','{$password}','{$email}','{$plan}','{$languageId}')");
    show_message('Your account is created! Now you can login and enjoy yourself!', 'Go To Home Page', 'index.php');
} elseif ($action == 'login') {
    $username = isset($_POST['username']) ? htmlspecialchars(trim($_POST['username'])) : '';
    $password = isset($_POST['password']) ? $_POST['password'] : '';
    $smarty->caching = 0;
    user_login($username, $password);
    header('location: index.php');
} elseif ($action == 'logout') {
    setcookie('user_id', '');
    setcookie('password', '');
    header('location: index.php');
} elseif ($action == 'update') {
    $smarty->assign('title', 'Update Person Info');
    $smarty->assign('user_info', $login_user);
    $smarty->assign('compilers', get_compilers());
    $smarty->caching = 0;
    $smarty->display('user.tpl');
} elseif ($action == 'detail') {
    $user_id = isset($_GET['authorId']) ? intval($_GET['authorId']) : 0;
    if (empty($user_id) && !empty($login_user)) {
        $user_id = $login_user['user_id'];
Example #28
0
<?php

require 'lib/header.php';
if (isset($_GET['act'])) {
    $action = $_GET['act'];
} else {
    $action = '';
}
if (isset($_SESSION['user_id']) && in_array($action, array('', 'login', 'login_openid', 'register'))) {
    header("Location:index.php");
    return;
}
switch ($action) {
    case 'login':
        if (user_login($_POST['login'], $_POST['passwd'])) {
            if (isset($_SESSION['return_to'])) {
                header('Location:' . $_SESSION['return_to']);
            } else {
                header('Location:index.php');
            }
        } else {
            header('Location:login.php?act=error');
        }
        log_timing();
        exit;
    case 'login_openid':
        $r = user_login_openid($_POST['token']);
        switch ($r) {
            case 1:
                if (isset($_SESSION['return_to'])) {
                    header('Location:' . $_SESSION['return_to']);
Example #29
0
<table id="viewuser">
	<tr>
		<th> اسم </th><th> نام کاربری </th><th> رمز عبور </th><th> ایمیل </th><th> نقش کاربر </th>
	</tr><br>

<?php 
    $index = "viewuser";
    $result = request_select($index);
    if ($result) {
        get_form($result, $index);
    }
    ?>

</table>

<?php 
    get_admin_sidebar();
    get_admin_footer();
    ?>

<?php 
} else {
    if (isset($_POST['login'])) {
        $login = array("username" => "{$_POST['username']}", "password" => "{$_POST['password']}");
        $url = $_SERVER['REQUEST_URI'];
        $url = ltrim($url, "cms1/admin");
        user_login($login, 'login', $url);
    }
    // end isset()
    require_once dirname(dirname(__FILE__)) . '/login_form.php';
}
Example #30
0
include_once BASE . 'functions/init/cpaths.php';
include_once BASE . 'functions/init/date_range.php';
include_once BASE . 'error.php';
include_once BASE . 'functions/calendar_functions.php';
include_once BASE . 'functions/userauth_functions.php';
// Grab the action (login or logout).
$action = '';
if (isset($_GET['action'])) {
    $action = $_GET['action'];
} else {
    if (isset($_POST['action'])) {
        $action = $_POST['action'];
    }
}
// Login and/or logout.
list($username, $password, $invalid_login) = user_login();
if ($action != 'login') {
    $invalid_login = false;
}
if ($action == 'logout' || $invalid_login) {
    list($username, $password) = user_logout();
}
if (ini_get('max_execution_time') < 60) {
    @ini_set('max_execution_time', '60');
}
// Pull the calendars off the GET line if provided. The $cal_filename
// is always an array, because this makes it easier to deal with below.
$cal_filenames = array();
if (isset($_GET['cal']) && $_GET['cal'] != '') {
    // If the cal value is not an array, split it into an array on
    // commas.