本文整理汇总了PHP中helpers\Url类的典型用法代码示例。如果您正苦于以下问题:PHP Url类的具体用法?PHP Url怎么用?PHP Url使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Url类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: handleFirstStep
public function handleFirstStep($post)
{
/*
* @todo: xss security
* @todo: csrf security
* @todo: gump validation
*/
$name = $post['group_name'];
$descr = $post['group_descr'];
if (strlen($name) < 4) {
$error[] = 'Group name is too short.';
} else {
$check = $this->getGroupName($name);
if (strtolower($check[0]->nume) == strtolower($name)) {
$error[] = 'Group name already taken.';
}
}
$tokenString = hash('sha256', mt_rand());
$groupData = array('id_autor' => Session::get('id'), 'nume' => $name, 'descr' => $descr, 'completed' => $tokenString);
if (!isset($error)) {
$this->db->insert('grupuri', $groupData);
setcookie('unfinished_group', $tokenString, time() + COOKIE_RUNTIME);
Url::redirect(DIR . 'teacher/new-group-2', true);
}
return $error;
}
开发者ID:umihnea,项目名称:e-learning.inkdrop,代码行数:26,代码来源:GroupModel.php
示例2: __construct
public function __construct()
{
parent::__construct();
if (!Session::get('loggedin')) {
Url::redirect('login');
}
}
开发者ID:alejandrozepeda,项目名称:reaching-outdoors,代码行数:7,代码来源:Dashboard.php
示例3: register
public function register()
{
if (Session::get('logged')) {
Url::redirect();
}
$data['title'] = 'הרשמה';
if (isset($_POST['submit'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
if ($username == '') {
$error[] = 'שם משתמש הוא שדה נדרש';
}
if ($this->_model->get_user($username)) {
$error[] = 'שם המשתמש תפוס, בעסה';
}
if ($password == '') {
$error[] = 'צריך סיסמא כדי להירשם, אחרת כל אחד יוכל להיכנס במקומך...';
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$error[] = 'כדי להירשם צריך מייל, למקרה ששכחת את הסיסמא';
}
if (!$error) {
$postdata = array('user_name' => $username, 'user_password' => Password::make($password), 'user_email' => $email);
$this->_model->add_user($postdata);
$this->login_user($username);
// Session::set('message','User Added');
Url::redirect();
}
}
View::renderTemplate('header', $data);
View::render('register', $data, $error);
View::renderTemplate('footer', $data);
}
开发者ID:Zed3,项目名称:foodie,代码行数:34,代码来源:Auth.php
示例4: img
public static function img($url, $options = [])
{
if (!array_key_exists('class', $options)) {
$options['class'] = 'img-responsive';
}
return '<img src="' . Url::autoDecide($url) . '"' . static::buildOptions($options) . '>';
}
开发者ID:mgilangjanuar,项目名称:slimedoo,代码行数:7,代码来源:BaseHtml.php
示例5: edit
public function edit($id)
{
$data['title'] = 'Edit Member';
$data['row'] = $this->model->get_member($id);
if (isset($_POST['submit'])) {
if ($_POST['token'] != Session::get('token')) {
Url::redirect('admin/login');
}
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
if ($username == '') {
$error[] = 'Username is required';
}
if ($password == '') {
$error[] = 'Password is required';
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$error[] = 'Email is not valid';
}
if (!$error) {
$postdata = array('member_username' => $username, 'member_password' => Password::make($password), 'member_email' => $email);
$where = array('member_id' => $id);
$this->model->update_member($postdata, $where);
Session::set('message', 'Member Updated');
Url::redirect('admin/members');
}
}
View::renderadmintemplate('header', $data);
View::render('admin/members/edit', $data, $error);
View::renderadmintemplate('footer', $data);
}
开发者ID:T-PHP,项目名称:Simple-MVC-Blog,代码行数:32,代码来源:Members.php
示例6: register
public function register()
{
if (Session::get('loggedin')) {
Url::redirect('');
}
$data['title'] = "Registrace";
$model = new \Models\Users();
if (isset($_POST['submit'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$repeatPassword = $_POST['repeatPassword'];
$email = $_POST['email'];
if ($password == $repeatPassword) {
if (!$model->exists($username)) {
// array of values for new user
$postdata = array('name' => $username, 'pass' => Password::make($password), 'email' => $email);
$model->add($postdata);
Url::redirect('login');
} else {
$error[] = 'Jméno je již zabráno. Zkuste prosím jiné';
}
} else {
$error[] = 'Heslo a ověření hesla se neshodují. Zkuste je prosím vyplnit znovu.';
}
}
View::renderTemplate('header', $data);
View::render('auth\\register', $data, $error);
View::renderTemplate('footer', $data);
}
开发者ID:Lyman88,项目名称:Creepers,代码行数:29,代码来源:Auth.php
示例7: index
public function index()
{
$data['title'] = "Sistema de Administración de Aerolíneas";
$data['page'] = "page2";
if (!is_null(filter_input(INPUT_POST, 'insertar'))) {
$nombre = $_POST['nombre'];
$responsable = $_POST['responsable'];
$numero = $_POST['numero'];
$email = $_POST['correo'];
$datos = array('NOMBRE' => $nombre, 'NOMBRE_RESPONSABLE' => $responsable, 'AVIONES' => $numero, 'EMAIL' => $email);
$this->_model->insertar_aerolinea($datos);
Url::redirect("aerolineas?aer=1");
} elseif (!is_null(filter_input(INPUT_POST, 'eliminar'))) {
$id_aerolinea = $_POST['id_aerolinea'];
$where = array('aerolinea_id' => $id_aerolinea);
$this->_model->eliminar_aerolinea($where);
} elseif (!is_null(filter_input(INPUT_POST, 'editar'))) {
$nombre = $_POST['nombre'];
$responsable = $_POST['responsable'];
$numero = $_POST['numero'];
$email = $_POST['correo'];
$id_aerolinea = $_POST['id_aerolinea'];
$data = array('NOMBRE' => $nombre, 'NOMBRE_RESPONSABLE' => $responsable, 'AVIONES' => $numero, 'EMAIL' => $email);
$where = array('aerolinea_id' => $id_aerolinea);
$this->_model->actualizar_aerolinea($data, $where);
}
$data['aerolineas'] = $this->_model->obtener_aerolineas();
$data['aviones'] = $this->_model->obtener_aviones();
View::renderTemplate('header', $data);
View::render('aerolineas/aerolineas', $data);
View::renderTemplate('footer', $data);
}
开发者ID:alejandrozepeda,项目名称:admin,代码行数:32,代码来源:Aerolineas.php
示例8: index
public function index()
{
if (!Session::get('loggedin')) {
Url::redirect('login');
}
if (isset($_POST['submit']) && $_FILES['fileToUpload']['size'] > 0) {
$name = !isset($_POST['productName']) || trim($_POST['productName']) == '' ? '' : $_POST['productName'];
$price = !isset($_POST['productPrice']) || trim($_POST['productPrice']) == '' ? 0 : floatval($_POST['productPrice']);
$description = !isset($_POST['productDescription']) || trim($_POST['productDescription']) == '' ? '' : $_POST['productDescription'];
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file, PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if (isset($_POST["submit"])) {
$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
if ($check !== false) {
//echo "File is an image - " . $check["mime"] . ".";
$uploadOk = 1;
} else {
//echo "File is not an image.";
$uploadOk = 0;
}
}
// Check if file already exists
if (file_exists($target_file)) {
$error = "Sorry, file already exists." . $error;
$uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
$error = "Sorry, your file is too large." . $error;
$uploadOk = 0;
}
// Allow certain file formats
if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
$error = "Sorry, only JPG, JPEG, PNG & GIF files are allowed." . $error;
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
$error = "Sorry, your file was not uploaded." . $error;
// if everything is ok, try to upload file
} else {
//if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], str_replace(' ','-',strtolower($target_file)))) {
//echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
$product['product'] = array('name' => $name, 'price' => $price, 'description' => $description, 'lastUpdate' => date('Y-m-d G:i:s'));
$product['image'] = array('image' => file_get_contents($_FILES['fileToUpload']['tmp_name']), 'size' => $_FILES["fileToUpload"]["size"], 'type' => $imageFileType);
$this->_model->insertProduct($product);
//unlink(str_replace(' ','-',strtolower($target_file)));
}
}
Hooks::addHook('js', 'Controllers\\menu@indexJS');
Hooks::addHook('css', 'Controllers\\menu@indexCss');
$data['title'] = 'index';
$data['username'] = Session::get('username');
View::rendertemplate('header', $data);
View::render('menu/index', $data, $error);
View::rendertemplate('footer', $data);
}
开发者ID:pacozaa,项目名称:simple-mvc-framework-inventory,代码行数:60,代码来源:menu.php
示例9: index
public function index()
{
$data['title'] = "Sistema de Administración de Aerolíneas";
$data['page'] = "page3";
if (!is_null(filter_input(INPUT_POST, 'insertar'))) {
$matricula = $_POST['matricula'];
$asientos = $_POST['asientos'];
$id_aerolinea = $_POST['id_aerolinea'];
$datos = array('ASIENTOS' => $matricula, 'MATRICULA' => $asientos, 'AEROLINEA_ID' => $id_aerolinea);
$this->_model->insertar_avion($datos);
Url::redirect("aviones?aer=1");
} elseif (!is_null(filter_input(INPUT_POST, 'eliminar'))) {
$id_aerolinea = $_POST['id_avion'];
$where = array('avion_id' => $id_aerolinea);
$this->_model->eliminar_avion($where);
} elseif (!is_null(filter_input(INPUT_POST, 'editar'))) {
$matricula = $_POST['matricula'];
$asientos = $_POST['asientos'];
$id_aerolinea = $_POST['id_aerolinea'];
$id_avion = $_POST['id_avion'];
$datos = array('ASIENTOS' => $matricula, 'MATRICULA' => $asientos, 'AEROLINEA_ID' => $id_aerolinea);
$where = array('avion_id' => $id_avion);
$this->_model->actualizar_avion($datos, $where);
}
$data['aerolineas'] = $this->_model->obtener_aerolineas();
$data['aviones'] = $this->_model->obtener_aviones();
View::renderTemplate('header', $data);
View::render('aviones/aviones', $data);
View::renderTemplate('footer', $data);
}
开发者ID:alejandrozepeda,项目名称:admin,代码行数:30,代码来源:Aviones.php
示例10: logout
/**
* Logs the user out
*
*/
public function logout()
{
Session::destroy();
/* Clear all sessions set for this project */
Url::redirect("http://something.sellerstam.mebokund.com/", true);
/* Goes back to the home page */
}
开发者ID:Trettman,项目名称:Something,代码行数:11,代码来源:Auth.php
示例11: __construct
/**
* Call the parent construct
*/
public function __construct()
{
parent::__construct();
if (!Session::get('loggedin')) {
Url::redirect('login');
}
$this->language->load('Dashboard');
}
开发者ID:zszymczyk,项目名称:intranet,代码行数:11,代码来源:Dashboard.php
示例12: index
/**
* Phone Book - default view
*/
public function index()
{
$data['js'] = array(Url::assetPath('js') . 'plugins/forms/selects/select2.min.js', Url::assetPath('js') . 'plugins/tables/datatables/datatables.min.js', Url::assetPath('js') . 'plugins/tables/datatables/extensions/responsive.js', Url::assetPath('js') . 'plugins/tables/datatables/extensions/buttons.min.js', Url::assetPath('js') . 'plugins/tables/datatables/extensions/jszip/jszip.min.js', Url::assetPath('js') . 'plugins/tables/datatables/extensions/pdfmake/pdfmake.min.js', Url::assetPath('js') . 'plugins/tables/datatables/extensions/pdfmake/vfs_fonts.min.js', Url::assetPath('js') . 'plugins/tables/datatables/extensions/buttons.html5.min.js', Url::assetPath('js') . 'plugins/pickers/moment.min.js', Url::assetPath('js') . 'plugins/pickers/bootstrap-datetimepicker.min.js', Url::assetPath('js') . 'plugins/tables/datatables/extensions/jquery.dataTables.yadcf.js', Url::assetPath('js') . 'pages/phonebook.js');
$data['users'] = $this->phonebook->getPhonebook();
View::renderTemplate('header', $data);
View::render('phonebook/index', $data, $error);
View::renderTemplate('footer', $data);
}
开发者ID:zszymczyk,项目名称:intranet,代码行数:11,代码来源:PhonebookController.php
示例13: search_post
public function search_post()
{
if (isset($_REQUEST['q'])) {
$this->search($_REQUEST['q']);
} else {
Url::redirect();
}
}
开发者ID:Zed3,项目名称:foodie,代码行数:8,代码来源:Search.php
示例14: loguit
public function loguit()
{
//Unset de sessions.
\Helpers\Session::destroy('username');
\Helpers\Session::destroy('id');
\Helpers\Session::destroy('rechten');
//Stuurt je door naar de homepagina.
\Helpers\Url::redirect('home');
}
开发者ID:Aukevanoost,项目名称:zeilschooldewaai,代码行数:9,代码来源:Login.php
示例15: logout
public function logout()
{
session_start();
$_SESSION = array();
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time() - 42000, '/');
}
session_destroy();
\Helpers\Url::redirect('');
}
开发者ID:juancabraal,项目名称:vibesetal,代码行数:10,代码来源:Login.php
示例16: change
/**
* Change the Framework Language.
*/
public function change($language)
{
// Only set language if it's in the Languages array
if (preg_match('/[a-z]/', $language) && in_array($language, CoreLanguage::$codes)) {
Session::set('language', ucfirst($language));
// Store the current Language into Cookie.
Cookie::set(PREFIX . 'language', $language);
}
Url::redirect();
}
开发者ID:sisnox,项目名称:framework,代码行数:13,代码来源:Language.php
示例17: authRole
public static function authRole($role)
{
//CHECK IF USER IS LOGGED IN
self::block();
$user = Session::get('user');
if ($user->role != $role) {
// var_dump($user->role);
Url::redirect('home');
}
}
开发者ID:Oluwafemikorede,项目名称:gbedu,代码行数:10,代码来源:Auth.php
示例18: none
public static function none($level)
{
$sessionLogin = Session::get('loggedin');
if ($sessionLogin) {
if ($level == 'student') {
Url::redirect(DIR, true);
} else {
Url::redirect(DIR . 'teacher', true);
}
}
}
开发者ID:umihnea,项目名称:e-learning.inkdrop,代码行数:11,代码来源:Auth.php
示例19: playLevel
public function playLevel($id)
{
if (Session::get('level') >= $id - 1) {
$data['title'] = "Amusez vous bien sur cette map ! ";
$data['level'] = "Level: " . $id;
View::renderTemplate('header', $data);
View::render('play/playLevel', $data);
View::renderTemplate('footer', $data);
} else {
Url::redirect();
}
}
开发者ID:jordandevolder,项目名称:Algogoal,代码行数:12,代码来源:Play.php
示例20: index
/**
* Define Index page title and load template files
*/
public function index()
{
$sessid = Session::get('us_id');
if ($sessid == null) {
Url::redirect("Login");
}
$data = array();
$data['title'] = 'Billing';
View::renderTemplate('header', $data);
View::renderTemplate('main', $data);
View::renderTemplate('footer');
}
开发者ID:APKO,项目名称:Billing,代码行数:15,代码来源:Main.php
注:本文中的helpers\Url类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论