本文整理汇总了PHP中helpers\Session::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::init方法的具体用法?PHP Session::init怎么用?PHP Session::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers\Session
的用法示例。
在下文中一共展示了Session::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
//turn on output buffering
ob_start();
//site address
define('DIR', 'http://127.0.0.1:8888/simple_with_parse/');
//set default controller and method for legacy calls
define('DEFAULT_CONTROLLER', 'welcome');
define('DEFAULT_METHOD', 'index');
//set the default template
define('TEMPLATE', 'default');
//set a default language
define('LANGUAGE_CODE', 'en');
//database details ONLY NEEDED IF USING A DATABASE
define('DB_TYPE', 'mysql');
define('DB_HOST', 'localhost:3306');
define('DB_NAME', 'mvc');
define('DB_USER', 'root');
define('DB_PASS', '1234');
define('PREFIX', 'dc_');
//set prefix for sessions
define('SESSION_PREFIX', 'dc_');
//optionall create a constant for the name of the site
define('SITETITLE', 'Demo');
//optionall set a site email address
//define('SITEEMAIL', '');
//turn on custom error handling
set_exception_handler('Core\\Logger::ExceptionHandler');
set_error_handler('Core\\Logger::ErrorHandler');
//set timezone
date_default_timezone_set('Asia/Bangkok');
//start sessions
Session::init();
}
示例2: __construct
public function __construct()
{
//turn on output buffering
ob_start();
//base path
define('DIR', 'http://localhost/docstify/');
//set default controller and method for legacy calls
define('DEFAULT_CONTROLLER', 'welcome');
define('DEFAULT_METHOD', 'index');
//set the default template
define('TEMPLATE', 'default');
//set a default language
define('LANGUAGE_CODE', 'es');
//database details ONLY NEEDED IF USING A DATABASE
define('DB_TYPE', 'mysql');
define('DB_HOST', 'localhost');
define('DB_NAME', 'dbname');
define('DB_USER', 'root');
define('DB_PASS', 'password');
define('PREFIX', 'smvc_');
//set prefix for sessions
define('SESSION_PREFIX', '');
//optionall create a constant for the name of the site
define('SITETITLE', 'Docstify');
//optionall set a site email address
//define('SITEEMAIL', '');
//turn on custom error handling
set_exception_handler('Core\\Logger::ExceptionHandler');
set_error_handler('Core\\Logger::ErrorHandler');
//set timezone
date_default_timezone_set('America/Mexico_City');
//start sessions
Session::init();
}
示例3: __construct
public function __construct()
{
ob_start();
define('DIR', 'http://meteo-colmar.fr/');
define('DEFAULT_CONTROLLER', 'StaticPages');
define('DEFAULT_METHOD', 'index');
define('TEMPLATE', 'default');
define('LANGUAGE_CODE', 'fr');
define('DB_TYPE', 'mysql');
define('DB_HOST', '***');
define('DB_NAME', '***');
define('DB_USER', '***');
define('DB_PASS', '***');
define('SESSION_PREFIX', 'smvc_');
define('SITETITLE', 'Météo Colmar');
define('SITEEMAIL', 'contact@meteo-colmar.fr');
define('CAPTCHA_SITE_KEY', '***');
define('CAPTCHA_SECRET_KEY', '***');
define('NASA_API_KEY', '***');
define('FETE_API_KEY', '***');
set_exception_handler('Core\\Logger::ExceptionHandler');
set_error_handler('Core\\Logger::ErrorHandler');
date_default_timezone_set('Europe/London');
Session::init();
}
示例4: __construct
public function __construct()
{
//turn on output buffering
ob_start();
//site address
define('DIR', getenv('OPENSHIFT_ADDR'));
//set default controller and method for legacy calls
define('DEFAULT_CONTROLLER', 'welcome');
define('DEFAULT_METHOD', 'index');
//set the default template
define('TEMPLATE', 'default');
//set a default language
define('LANGUAGE_CODE', 'en');
//database details ONLY NEEDED IF USING A DATABASE
define('DB_TYPE', 'mysql');
define('DB_HOST', getenv('OPENSHIFT_MYSQL_DB_HOST') . ':' . getenv('OPENSHIFT_MYSQL_DB_PORT'));
define('DB_PORT', getenv('OPENSHIFT_MYSQL_DB_PORT'));
define('DB_NAME', getenv('OPENSHIFT_GEAR_NAME'));
define('DB_USER', getenv('OPENSHIFT_MYSQL_DB_USERNAME'));
define('DB_PASS', getenv('OPENSHIFT_MYSQL_DB_PASSWORD'));
define('PREFIX', 'smvc_');
//set prefix for sessions
define('SESSION_PREFIX', 'smvc_');
//optionall create a constant for the name of the site
define('SITETITLE', 'V2.2');
//optionall set a site email address
//define('SITEEMAIL', '');
//turn on custom error handling
set_exception_handler('Core\\Logger::ExceptionHandler');
set_error_handler('Core\\Logger::ErrorHandler');
//set timezone
date_default_timezone_set('Europe/London');
//start sessions
Session::init();
}
示例5: index
public function index()
{
\helpers\Session::init();
if (\helpers\Session::get('username')) {
if (\helpers\Session::get('admin')) {
\helpers\url::redirect('exec');
} else {
\helpers\url::redirect('welcome');
}
}
if ($_POST['submit']) {
$is_valid = \helpers\gump::is_valid($_POST, array('fname' => 'required|alpha', 'lname' => 'required|alpha', 'dob' => 'required', 'gender' => 'required', 'year' => 'required', 'email' => 'required|valid_email', 'phone' => 'required', 'stunum' => 'required|numeric', 'issue1' => 'required', 'issue2' => 'required', 'issue3' => 'required'));
if ($is_valid === true) {
$this->submit();
} else {
$data['errors'] = $is_valid;
}
}
$data['title'] = "Apply";
$data['questions'] = $this->apply_model->getAllQuestions();
$data['issues'] = $this->apply_model->getAllIssues();
$data['options'] = $this->apply_model->getAllQuestionOptions();
$data['colleges'] = $this->apply_model->getAllColleges();
View::rendertemplate('header', $data);
View::render('apply/apply', $data, $error);
View::rendertemplate('footer', $data);
}
示例6: login
public function login()
{
$data = array();
Session::init();
var_dump(Session::get('user_name'));
if (!Session::get('user_name')) {
if (isset($_POST['username']) && isset($_POST['password'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$users = User::getUser($username, $password);
// Vaildation user
if ($users != null) {
// Set session
Session::set('user_name', $users);
$this->render($data, $users);
} else {
echo "Login false";
echo "<a href='login'> Login Again </a>";
}
} else {
$this->renderLoginForm($data);
}
} else {
$this->render($data, Session::get('user_name'));
}
}
示例7: __construct
public function __construct()
{
/**
* check the configuration file presence
*/
if (!is_readable(SMVC . 'app/config.php')) {
die('No Config.php found, configure and rename config.example.php to config.php in app/.');
}
/**
* Turn on output buffering.
*/
ob_start();
/**
* load config
*/
require SMVC . 'app/config.php';
/**
* Turn on custom error handling.
*/
// set_exception_handler('Core\Logger::ExceptionHandler');
// set_error_handler('Core\Logger::ErrorHandler');
/**
* Start sessions.
*/
Session::init();
$this->applicationSpecificInitializations();
/**
* load routes and call controller/view finally
*/
require SMVC . 'app/routes.php';
}
示例8: __construct
public function __construct()
{
//Ativa o buffer de saída
ob_start();
//Definir controller padrão e método para chamadas legados
define('DEFAULT_CONTROLLER', 'Welcome');
define('DEFAULT_METHOD', 'index');
//Denifir template padrão
define('TEMPLATE', 'default');
define('DB_TYPE', 'mysql');
define('DB_HOST', 'localhost');
define('DB_NAME', 'babita');
define('DB_USER', 'root');
define('DB_PASS', '123456');
define('DB_PORT', '3306');
define('PREFIX', 'bab_');
define('DIR', 'http://localhost/babita');
//Define prefixo de sessão
define('SESSION_PREFIX', 'bab');
//Define coluna datetime de inserção e atualização no banco de dados
define('DATETIME_INSERT', 'datetime_insert');
define('DATETIME_UPDATE', 'datetime_update');
//Define chave de encriptação de dados
define('CHAVE_ENCRYPT', 'bf');
//Define título do site / projeto
define('SITETITLE', 'Babita Framework V1');
//Email do administrador para notificação de erros no sistema
define('SITEEMAIL', 'fabio@fabioassuncao.com.br');
define('MAIL_IS_SMTP', true);
//Habilita envio SMPT
define('MAIL_SMTP_AUTH', true);
// // Enable SMTP authentication
define('MAIL_IS_HTML', true);
// Set email format to HTML
define('MAIL_CHARSET', 'UTF-8');
define('MAIL_SMTP_SECURE', 'tls');
// Enable TLS encryption, `ssl` also accepted
define('MAIL_HOST', 'smtp.gmail.com');
//Servidor de envio
define('MAIL_PORT', '587');
//Porta de envio
define('MAIL_USER', 'fabio@fabioassuncao.com.br');
//Login do email de envio
define('MAIL_PASS', 'secret');
//Senha
//Ativa a manipulação de erro personalizada
set_exception_handler('Core\\Logger::ExceptionHandler');
set_error_handler('Core\\Logger::ErrorHandler');
//Define timezone
date_default_timezone_set('America/Sao_Paulo');
//Inicia sessões
Session::init();
//Habilita os erros em ambiente local
ini_set('display_errors', 1);
ini_set('log_errors', 1);
error_reporting(E_ALL);
}
示例9: __construct
public function __construct()
{
//Turn on output buffering
ob_start();
define('DEBUG', true);
/**
* determins if error should be emailed to SITEEMAIL defined in app/Core/Config.php
* @var boolean
*/
define('MAIL_ERROR', false);
//Set default controller and method for legacy calls
define('DEFAULT_CONTROLLER', 'Welcome');
define('DEFAULT_METHOD', 'index');
//Set default template
define('DEFAULT_TEMPLATE', 'default');
define('DB_TYPE', 'mysql');
define('DB_HOST', 'localhost');
define('DB_NAME', 'babita');
define('DB_USER', 'root');
define('DB_PASS', '123456');
define('DB_PORT', '3306');
define('DB_PREFIX', 'bab_');
define('DIR', 'http://localhost/babita');
//Set session prefix
define('SESSION_PREFIX', 'bab');
//Set datetime column insert and update the database
define('DATETIME_INSERT', 'created_at');
define('DATETIME_UPDATE', 'updated_at');
//Define data encryption key
define('CHAVE_ENCRYPT', 'bf');
//Sets title of the site / project
define('SITETITLE', 'Babita Framework V1');
//Administrator e-mail for error notification system
define('SITEEMAIL', 'fabio@fabioassuncao.com.br');
define('MAIL_SMTP_AUTH', true);
// // Enable SMTP authentication
define('MAIL_IS_HTML', true);
// Set email format to HTML
define('MAIL_CHARSET', 'UTF-8');
define('MAIL_SMTP_SECURE', 'tls');
// Enable TLS encryption, `ssl` also accepted
define('MAIL_HOST', 'smtp.gmail.com');
//Outgoing Server
define('MAIL_PORT', '587');
//Port forwarding
define('MAIL_USER', 'fabiioassuncao@gmail.com');
//Login sending email
define('MAIL_PASS', 'secret');
//Password
//Enables custom error handling
set_exception_handler('Core\\Logger::ExceptionHandler');
set_error_handler('Core\\Logger::ErrorHandler');
//Define timezone
date_default_timezone_set('America/Sao_Paulo');
//Start sessions
Session::init();
}
示例10: __construct
/**
* Executed as soon as the framework runs.
*/
public function __construct()
{
/**
* Turn on output buffering.
*/
ob_start();
/**
* Define relative base path.
*/
define('DIR', '/');
/**
* Set default controller and method for legacy calls.
*/
define('DEFAULT_CONTROLLER', 'welcome');
define('DEFAULT_METHOD', 'index');
/**
* Set the default template.
*/
define('TEMPLATE', 'default');
/**
* Set a default language.
*/
define('LANGUAGE_CODE', 'en');
/**
* PREFER to be used in database calls default is smvc_
*/
define('PREFIX', 'smvc_');
/**
* Set prefix for sessions.
*/
define('SESSION_PREFIX', 'smvc_');
/**
* Optional create a constant for the name of the site.
*/
define('SITETITLE', 'V2.2');
/**
* Optionall set a site email address.
*/
//define('SITEEMAIL', '');
/**
* Turn on custom error handling.
*/
set_exception_handler('Core\\Logger::ExceptionHandler');
set_error_handler('Core\\Logger::ErrorHandler');
/**
* Set timezone.
*/
date_default_timezone_set('Europe/London');
/**
* Start sessions.
*/
Session::init();
}
示例11: __construct
public function __construct()
{
//turn on output buffering
ob_start();
define('DS', DIRECTORY_SEPARATOR);
if (ENVIRONMENT == 'development') {
define('DIR', 'http://localhost/gbedu/');
define('UPLOAD_PATH', BASE_PATH . DS . 'app' . DS . 'templates' . DS . 'default' . DS . 'images' . DS);
define('RESOURCE_PATH', BASE_PATH . DS . 'app' . DS . 'templates' . DS . 'default' . DS);
} else {
define('DIR', 'http://gbedumobile.com/new/');
define('UPLOAD_PATH', BASE_PATH . DS . 'new' . DS . 'app' . DS . 'templates' . DS . 'default' . DS . 'images' . DS);
}
//set default controller and method for legacy calls
define('DEFAULT_CONTROLLER', 'Home');
define('DEFAULT_METHOD', 'index');
//set the default template
define('TEMPLATE', 'default');
//facebook app settings
define('APP_ID', '822756641153927');
define('APP_SECRET', 'bfac2e687036cd8d06c4d75a9b1c127d');
//set a default language
define('LANGUAGE_CODE', 'en');
//database details ONLY NEEDED IF USING A DATABASE
define('DB_TYPE', 'mysql');
define('DB_HOST', '127.0.0.1');
if (ENVIRONMENT == 'development') {
define('DB_NAME', 'gbedu');
define('DB_USER', 'root');
define('DB_PASS', 'root');
} else {
define('DB_NAME', 'gbedumobile');
define('DB_USER', 'gbedu_user');
define('DB_PASS', 'pa55w0rd');
}
define('PREFIX', 'smvc_');
//set prefix for sessions
define('SESSION_PREFIX', 'gbedu_');
//optionall create a constant for the name of the site
define('SITETITLE', 'Gbedu');
//turn on custom error handling
set_exception_handler('Core\\Logger::ExceptionHandler');
set_error_handler('Core\\Logger::ErrorHandler');
//set timezone
date_default_timezone_set('Africa/Lagos');
//start sessions
Session::init();
}
示例12: __construct
public function __construct()
{
//turn on output buffering
ob_start();
define('DS', DIRECTORY_SEPARATOR);
if (ENVIRONMENT == 'development') {
define('DIR', 'http://localhost/gbedu/cms/');
define('ROOT_DIR', 'http://localhost/gbedu/app/templates/default/');
define('UPLOAD_PATH', BASE_PATH . DS . 'app' . DS . 'templates' . DS . 'default' . DS . 'images' . DS);
define('DEL_PATH', BASE_PATH . DS . 'app' . DS . 'templates' . DS . 'default' . DS);
} else {
define('UPLOAD_PATH', BASE_PATH . DS . 'new' . DS . 'app' . DS . 'templates' . DS . 'default' . DS . 'images' . DS);
}
//set default controller and method for legacy calls
define('DEFAULT_CONTROLLER', 'Dashboard');
define('DEFAULT_METHOD', 'index');
//set the default template
define('TEMPLATE', 'default');
//set a default language
define('LANGUAGE_CODE', 'en');
//database details ONLY NEEDED IF USING A DATABASE
define('DB_TYPE', 'mysql');
define('DB_HOST', '127.0.0.1');
if (ENVIRONMENT == 'development') {
define('DB_NAME', 'gbedu');
define('DB_USER', 'root');
define('DB_PASS', 'root');
} else {
define('DB_NAME', 'evetsand_db');
define('DB_USER', 'evetsand_user');
define('DB_PASS', 'pa55w0rd');
}
define('PREFIX', 'smvc_');
//set prefix for sessions
define('SESSION_PREFIX', 'evets_');
//optionall create a constant for the name of the site
define('SITETITLE', 'Gbedu');
//SET UPLOAD PATH FOR FILES AND IMAGES
define('EXCEL_PATH', BASE_PATH . DS . 'app' . DS . 'templates' . DS . 'default' . DS . 'img' . DS);
//turn on custom error handling
set_exception_handler('Core\\Logger::ExceptionHandler');
set_error_handler('Core\\Logger::ErrorHandler');
//set timezone
date_default_timezone_set('Africa/Lagos');
//start sessions
Session::init();
}
示例13: login
public function login()
{
\helpers\Session::init();
if (!isset($_POST['submit'])) {
header("Location: .");
} else {
$pass = $_POST['pass'];
$uname = htmlspecialchars($_POST['username']);
$auth_data = $this->login->get_admin_auth_by_uname($uname);
$admin = true;
if (!$auth_data->userName) {
$auth_data = $this->login->get_trip_auth_by_uname($uname);
$admin = false;
}
if ($auth_data->userName) {
if ($auth_data->pass == $this->password_model->get_hash($pass, $auth_data->salt)) {
if (!$admin) {
\helpers\Session::set('tripId', $auth_data->tripId);
$trip_info = $this->trip->get_trip_information($auth_data->tripId);
$issueId = $trip_info->issueId;
$seasonId = $trip_info->seasonId;
$issue = $this->tripBoard->trip_issue_information($issueId);
$season = $this->tripBoard->season_information($seasonId);
\helpers\Session::set('season', $season[0]->name);
\helpers\Session::set('issue', $issue[0]->issueName);
\helpers\Session::set('issueId', $issue[0]->issueId);
\helpers\Session::set('nickname', $trip_info->nickname);
//children - DHvix4j2bf
//RUSHGM - ww5oJeFtZz
//mickeyds - mW56oQQ4eD
}
\helpers\Session::set('username', $auth_data->userName);
\helpers\Session::set('admin', $admin);
if ($admin) {
\helpers\url::redirect('exec');
} else {
\helpers\url::redirect('welcome');
}
} else {
header('Location: .?error');
}
} else {
header('Location: .?error');
}
}
}
示例14: __construct
public function __construct()
{
//turn on output buffering
ob_start();
//site address
define('DIR', 'http://localhost:8888/simpleblog/');
//set default controller and method for legacy calls
define('DEFAULT_CONTROLLER', 'blog');
define('DEFAULT_METHOD', 'index');
//set images dir
define('IMG_POSTS', 'images/posts/');
define('IMG_CATEGORIES', 'images/categories/');
//set the default template
define('TEMPLATE', 'solid');
//set a default language
define('LANGUAGE_CODE', 'en');
//database details ONLY NEEDED IF USING A DATABASE
define('DB_TYPE', 'mysql');
define('DB_HOST', 'localhost');
define('DB_NAME', 'simpleblog');
define('DB_USER', 'root');
define('DB_PASS', 'root');
define('PREFIX', 'sb_');
//set prefix for sessions
define('SESSION_PREFIX', 'sb_');
//optionall create a constant for the name of the site
define('SITETITLE', 'Simple Blog');
//optionall set a site email address
//define('SITEEMAIL', '');
//turn on custom error handling
set_exception_handler('Core\\Logger::ExceptionHandler');
set_error_handler('Core\\Logger::ErrorHandler');
//set timezone
date_default_timezone_set('Europe/London');
//start sessions
Session::init();
}
示例15: __construct
/**
* Executed as soon as the framework runs.
*/
public function __construct()
{
/**
* Turn on output buffering.
*/
ob_start();
/**
* Define relative base path.
*/
define('DIR', '/');
/**
* Set default controller and method for legacy calls.
*/
define('DEFAULT_CONTROLLER', 'welcome');
define('DEFAULT_METHOD', 'index');
/**
* Set the default template.
*/
define('TEMPLATE', 'default');
/**
* Set a default language.
*/
define('LANGUAGE_CODE', 'es');
//database details ONLY NEEDED IF USING A DATABASE
/**
* Database engine default is mysql.
*/
define('DB_TYPE', 'mysql');
/**
* Database host default is localhost.
*/
define('DB_HOST', 'localhost');
/**
* Database name.
*/
define('DB_NAME', 'entrades');
/**
* Database username.
*/
define('DB_USER', 'bdd');
/**
* Database password.
*/
define('DB_PASS', '(ccg@#).');
/**
* PREFER to be used in database calls default is smvc_
*/
define('PREFIX', 'smvc_');
/**
* Set prefix for sessions.
*/
define('SESSION_PREFIX', 'smvc_');
/**
* Optional create a constant for the name of the site.
*/
define('SITETITLE', 'V2.2');
define('BASEURL', '/var/www/palamos/Entrades/');
/**
* Optionall set a site email address.
*/
//define('SITEEMAIL', '');
/**
* Turn on custom error handling.
*/
//set_exception_handler('Core\MyCore\Error::ExceptionHandler');
//set_error_handler('Core\MyCore\Error::ErrorHandler');
//register_shutdown_function('Core\MyCore\Error::FatalErrorHandler');
/**
* Set timezone.
*/
date_default_timezone_set('Europe/London');
ini_set('default_charset', 'utf-8');
error_reporting(E_ALL);
ini_set("display_errors", 1);
/**
* Start sessions.
*/
Session::init();
}