public function verify()
 {
     if (Input::exists('post') && Token::check('csrf_token', Input::get('csrf_token'))) {
         $login = app('Auth')->login(Input::get('username'), Input::get('password'), Input::get('remember'));
         if ($login) {
             redirect();
         }
     }
 }
 public function validateInput()
 {
     $v = Validator::load();
     $v->checkPost($_POST, array('editor' => array('required' => true, 'min' => 1)));
     if (!$v->passed()) {
         //            Session::set($title, Input::get($title));
         foreach ($v->errors() as $error) {
             $_SESSION['ERRORS'][] = $error;
         }
         Redirect::to(Input::get('current_url'));
         exit;
     }
 }
 public function delete($type)
 {
     if (Input::exists()) {
         $source = PATH_ROOT . 'public/uploads/source/';
         $thumbs = PATH_ROOT . 'public/uploads/thumbs/';
         $upload = DB::load()->select(array('ID, Slug'), 'Uploads', null, array(array('ID', '=', Input::get('ID'))))->results();
         $file = $upload[0]->Slug;
         Upload::load($source)->remove($file);
         Upload::load($source)->remove($file, $thumbs);
         DB::load()->delete('Uploads', array(array('ID', '=', Input::get('ID'))));
         Session::set('SUCCESS', I18n::get('SYSTEM_CRUD_SUCCESS'));
     }
     Redirect::to($this->data['project_url'] . 'admin/read/uploads');
 }
 public function create()
 {
     if (Input::exists()) {
         Redirect::to($this->data['project_url'] . 'users/create');
     }
 }
 public function favorite()
 {
     if (Input::exists()) {
         $check = DB::load()->query('SELECT Meta_ID, Item_ID
                 FROM Meta_items 
                 WHERE Meta_ID = ?
                 AND Item_ID = ?
                 AND Type = ?', array(Input::get('post_id'), Input::get('user_id'), 'favorite'));
         if ($check->results() && $check->_error == false) {
             Session::set('INFO', 'Favorit eksitere allerede.');
             Redirect::to(Input::get('current_url'));
         }
         DB::load()->insert('Meta_items', array('Meta_ID' => Input::get('post_id'), 'Item_ID' => Input::get('user_id'), 'Type' => 'favorite'));
         Session::set('SUCCESS', 'Favorit gemt!');
         Redirect::to(Input::get('current_url'));
     }
 }
 public function validateInput()
 {
     $validate = Validator::load(DB::load());
     $validation = $validate->checkPost($_POST, array('username' => array('required' => true, 'min' => 3, 'max' => 32, 'notTaken' => 'Users'), 'full_name' => array('required' => true, 'min' => 3, 'max' => 50), 'org' => array('required' => false, 'max' => 32), 'password' => array('required' => true, 'min' => 3, 'max' => 64, 'ValidPass' => Input::get('password')), 'email' => array('required' => true, 'min' => 3, 'max' => 32, 'validEmail' => Input::get('email'))));
     if (!$v->passed()) {
         foreach ($v->errors() as $error) {
             Session::addKey('WARNINGS', $error, $error);
         }
         Redirect::to(Input::get('current'));
         exit;
     }
 }
Example #7
0
<?php

// load class
require_once '../src/Input.php';
//use class
use WebSupportDK\PHPHttp\Input;
// get input from posts,get or files. Item is the name form the form or url query string.
//  If it has more than one array, you can use $info to get that
Input::get($item = 'username', $info = null);
// check if input exists in form of posts, get or files.
Input::exists($type = 'post', $data = null);
// in combination with Input::get(), you can return input to a input field
Input::exists($type = 'post', Input::get($item = 'username', $info = null));
// strip a string form tags
Input::strip($string, $tags);
// escape a string for unwanted things
Input::escape($string);
// serialize a string
Input::serialize($input);
// unserialize as string
Input::unserialize($input);
// make a string to a slug, what to replace and what delimiter to use
Input::toSlug($string, $replace = array(), $delimiter = '-');
// create a jsqon string from input
Input::jsonEncode($input);
// create a array from json string
Input::jsonDecode($json);