function connectSubmit_post() { $msg = array(); $is_register = 0; $post_val = $this->input->post('data'); // for payload var $this->_post_args dump_it($this->input->post('data'), 1); if ($post_val) { $this->form_validation->set_data($post_val); if ($this->form_validation->run('challenge_submit') == FALSE) { $err = $this->form_validation->error_array(); // var_dump($err); if (isset($err['home_location'])) { $msg[] = $err['home_location']; } if (isset($err['pincode'])) { $msg[] = $err['pincode']; } $this->responser($msg, 400); } else { $is_submit = $this->contact_model->connectSubmit(filterParameters($post_val)); $is_submit = 1; if ($is_submit) { $msg[] = CONNECTED_SUCCESSFULLY; $this->responser($msg, 200); } else { $this->responser($msg, 400); } } } //$this->response($message, 200); // 200 being the HTTP response code for success }
function filterParameters($array, $DBEscapeString = true) { if (is_array($array)) { foreach ($array as $key => $value) { $array[$key] = filterParameters($array[$key]); } } elseif (is_string($array)) { if (get_magic_quotes_gpc()) { $array = stripslashes($array); } if ($DBEscapeString) { $array = DB::realEscapeString($array); } } return $array; }
function checkUserLoggedIn() { $return = false; $userCookie = manageCookies::cookieGet('userCookie'); if ($userCookie != '') { list($userEmail, $userSlat) = explode('||', $userCookie); $userEmail = filterParameters($userEmail); if ($userEmail != '' && $userSlat != '') { $userInfo = DB::getRow("?:users", "userID,email,password", "email = '" . trim($userEmail) . "'"); $GLOBALS['userID'] = $userInfo['userID']; $GLOBALS['email'] = strtolower($userInfo['email']); $dbSlat = md5($GLOBALS['email'] . $userInfo['password']); if ($userSlat == $dbSlat) { $return = true; } } } if ($return == false) { userLogout(); } return $return; }
@date_default_timezone_set(@date_default_timezone_get()); } } else { @date_default_timezone_set($getTimeZone); } //session $cookiePath = parse_url(APP_URL, PHP_URL_PATH); //@session_set_cookie_params(0, $cookiePath); //@session_start(); //To prevent SQL Injection $_REQUEST_ORIGINAL = $_REQUEST; $_GET_ORIGINAL = $_GET; $_POST_ORIGINAL = $_POST; $_REQUEST = filterParameters($_REQUEST); $_GET = filterParameters($_GET); $_POST = filterParameters($_POST); include_once APP_ROOT . "/controllers/processManager.php"; Reg::set('dateFormatLong', 'M d, Y @ h:ia'); Reg::set('dateFormatYearLess', 'M d @ h:ia'); clearUncompletedTask(); checkTriggerStatus(); checkBackupTasks(); checkUserLoggedInAndRedirect(); defineAppFullURL(); if (!defined('FORCED_AJAX_CALL_MIN_INTERVAL')) { define('FORCED_AJAX_CALL_MIN_INTERVAL', 1); } //need user id for checkUserLoggedInAndRedirect() so this code move top to here if (!defined('UPDATE_PAGE')) { //addons //reason why it is not used in update page(update process page) is if those addons are loaded, in update process it include the latest file to run particular addon's update process by including its class, which results in fatal error of class already exists. loadActiveAddons();