post() public méthode

Fetch an item from the POST array
public post ( mixed $index = NULL, boolean $xss_clean = NULL ) : mixed
$index mixed Index for item to be fetched from $_POST
$xss_clean boolean Whether to apply XSS filtering
Résultat mixed
 function employee_login(CI_Input $input)
 {
     $ci = get_instance();
     $ci->load->model('Employees');
     $result = $ci->Employees->employee_login($input->post('employeenumber'), $input->post('password'));
     if (isset($result) && count($result) != 0) {
         $ci->session->set_userdata(array('employeenumber' => $result[0]->EmployeeNumber, 'campaignid' => $result[0]->Campaignid, 'department' => $result[0]->Department, 'positionid' => $result[0]->PositionID));
         employee_redirect($result[0]->Department);
     } else {
         return "Employee is either inactive or does not exist.";
     }
 }
Exemple #2
0
 public function index()
 {
     $items = $this->input->post('items');
     $data = $this->vaola->prepareData($items);
     try {
         $this->vaola->sync($data);
         $message = 'Saved';
     } catch (\Exception $exc) {
         $message = $exc->getMessage();
     }
     $args = ['message' => $message, 'boxes' => count($data)];
     $this->load->view('layout/header.php');
     $this->load->view('page/save', $args);
     $this->load->view('layout/footer.php');
 }
	function post($index = '', $xss_clean = FALSE)
	{
		if($index === '')
			return ($_SERVER['REQUEST_METHOD'] === 'POST');

		return parent::post($index, $xss_clean);
	}
 /**
  * {@inherit}
  */
 public function post($index = NULL, $xss_clean = NULL)
 {
     if ($this->mock_state) {
         return $this->_fetch_from_array($this->mock_POST, $index, $xss_clean);
     }
     return parent::post($index, $xss_clean);
 }
Exemple #5
0
 function post($index = '', $xss_clean = FALSE)
 {
     if ($index === '') {
         $return = $_POST ? TRUE : FALSE;
         return $return;
     }
     return parent::post($index, $xss_clean);
 }
 public function post($index = null, $xss_clean = TRUE)
 {
     if (!$xss_clean) {
         //if asked for raw post data -eg. post('key', false)-, return raw data. Use with caution.
         return $this->_POST_RAW[$index];
     }
     return parent::post($index, $xss_clean);
 }
Exemple #7
0
 public function post($index = NULL, $xss_clean = NULL, $default_value = NULL)
 {
     $value = parent::post($index, $xss_clean);
     if (empty($value) && $default_value !== NULL) {
         $value = $default_value;
     }
     return $value;
 }
Exemple #8
0
 /**
  * @param null $index
  * @param bool $xss_clean
  * @param null $default_value
  * @return array|null|string
  */
 function post($index = NULL, $xss_clean = FALSE, $default_value = NULL)
 {
     $ret_val = parent::post($index, $xss_clean);
     if ($ret_val === false && isset($default_value)) {
         $ret_val = $default_value;
     }
     return $ret_val;
 }
 public function register()
 {
     $data = $this->input->post(['email', 'password']);
     $response = $this->moneyzaurus->userRegister($data['email'], $data['password']);
     if ($response['code'] == 200) {
         if (!$response['data']['success']) {
             $this->session->set_flashdata('message', $response['data']['message']);
             redirect('');
         }
         $message = sprintf('Hi %s', $response['data']['data']['email']);
         $this->session->set_flashdata('message', $message);
         if ($this->loginCustomer($data['email'], $data['password'])) {
             redirect('/transaction');
         }
     }
     redirect('');
 }
Exemple #10
0
 public function __construct()
 {
     parent::__construct();
     $this->load->model('user_model');
     $this->load->helper('url_helper');
     $input = new CI_Input();
     $this->params = array_merge($input->get(), $input->post());
     $this->checkLogin();
 }
Exemple #11
0
 function post($index = '', $xss_clean = FALSE)
 {
     // this will be true if post() is called without arguments
     if ($index === '') {
         return $_SERVER['REQUEST_METHOD'] === 'POST';
     }
     // otherwise do as normally
     return parent::post($index, $xss_clean);
 }
Exemple #12
0
 public function post($index = null, $xss_clean = TRUE)
 {
     if (!$xss_clean) {
         // if asked for raw post data (eg. post('key', false) ) return the raw data.
         // this is required for raw password strings that we need to output to the command line
         // escaping these strings when they have unusual characters will break the funciton
         return $this->_POST_RAW[$index];
     }
     return parent::post($index, $xss_clean);
 }
 public function save()
 {
     $data = $this->input->post(['id', 'item', 'group', 'price', 'date']);
     if (!empty($data['id'])) {
         $response = $this->moneyzaurus->transactionsUpdate($data['id'], $data['item'], $data['group'], $data['price'], 'EUR', $data['date']);
     } else {
         $response = $this->moneyzaurus->transactionsAdd($data['item'], $data['group'], $data['price'], 'EUR', $data['date']);
     }
     if ($response['code'] == 200) {
         if (!$response['data']['success']) {
             $this->session->set_flashdata('message', $response['data']['message']);
         } else {
             $data = ['success' => $response['data']['data']['id'], 'date' => $data['date']];
         }
         redirect('/transaction?' . http_build_query($data));
     }
     $this->session->set_flashdata('message', 'Error');
     redirect('/transaction?' . http_build_query($data));
 }
Exemple #14
0
 public function __construct()
 {
     parent::__construct();
     //$this->load = load_class('Loader', 'core');
     //$this->load->initialize();
     $this->load->model('user_model');
     //$/this->load->helper('url_helper');
     //$this->user_model = new User_Model();
     //load_class('');
     $input = new CI_Input();
     $this->params = array_merge($input->get(), $input->post());
 }
 public function declineConnection()
 {
     $id = $this->input->post('id');
     $response = $this->moneyzaurus->connectionReject($id);
     if ($response['code'] == 200) {
         if (!$response['data']['success']) {
             $this->session->set_flashdata('message', $response['data']['message']);
         } else {
             $this->session->set_flashdata('message', 'Connection rejected');
         }
     }
     redirect('/profile');
 }
 /**
  * @param $object
  * @param $fieldNames
  */
 protected function setStringDataFromPost(&$object, $fieldNames)
 {
     if (isset($this->ModelName) && !is_null($this->ModelName) && $this->ModelName !== '') {
         if (is_array($fieldNames) && count($fieldNames) > 0) {
             foreach ($fieldNames as $fieldName) {
                 if (class_exists($this->ModelName) && property_exists($this->ModelName, $fieldName)) {
                     $value = addslashes($this->security->xss_clean($this->input->post(strtolower($fieldName))));
                     $object->{'set' . $fieldName}($value);
                 }
             }
         }
     }
 }
Exemple #17
0
 /**
  * 继承post方法,处理post数组
  * 现可如下访问:
  * $this->input->post('submit/newcase')
  */
 function post($index = NULL, $xss_clean = FALSE)
 {
     if (is_null($index)) {
         return parent::post($index, $xss_clean);
     } else {
         if (parent::post($index, $xss_clean) !== false) {
             return parent::post($index, $xss_clean);
         }
         $index_array = explode('/', $index);
         $post = parent::post($index_array[0], $xss_clean);
         for ($i = 1; $i < count($index_array); $i++) {
             if (isset($post[$index_array[$i]])) {
                 $post = $post[$index_array[$i]];
             } else {
                 return false;
             }
         }
         return $post;
     }
 }
Exemple #18
0
 public function post($xss_clean = TRUE, $index = null)
 {
     return parent::post($index, $xss_clean);
 }
Exemple #19
0
 function post($index = '', $xss_clean = TRUE)
 {
     return parent::post($index, $xss_clean);
 }
Exemple #20
0
 /**
  * Retrieve POST values with defaults if the POST variable doesn't exist.
  *
  * Arrays can be passed to the function to execute it multiple times.
  * There are 3 possibilities when using arrays:
  *
  * $index is associative in the form field => default,
  * $index is an array of fields and default is an array of the same size with defaults,
  * $index is an array of fields and default is a string
  *
  * @param mixed $index
  * @param mixed $default { default : FALSE }
  * @param boolean $xss_clean { default : TRUE }
  * @return array
  */
 public function post_default($index, $default = FALSE, $xss_clean = TRUE)
 {
     if (!is_array($index)) {
         $ret = parent::post($index, $xss_clean);
         if ($ret === FALSE) {
             $ret = $default;
         }
         return $ret;
     }
     if (!is_assoc($index)) {
         if (is_array($default)) {
             $index = array_combine($index, $default);
         } else {
             $index = array_fill_keys($index, $default);
         }
     }
     $ret = array();
     foreach ($index as $field => $default) {
         $ret[$field] = $this->post_default($field, $default, $xss_clean);
     }
     return $ret;
 }