public function report($params) { $this->resetStatus(); $inputs = array('height' => array('name' => 'height', 'required' => true, 'number' => true), 'weight' => array('name' => 'weight', 'required' => true, 'number' => true), 'neck' => array('name' => 'neck', 'required' => true, 'number' => true), 'waist' => array('name' => 'waist', 'required' => true, 'number' => true), 'extras' => array('name' => 'extras', 'alfanum' => true)); Session::get('gender') == 2 ? $inputs['hip'] = array('required' => true, 'numeric' => true) : ($params['hip'] = ''); $v = Validation::check($inputs); if ($v == false) { $this->status['errors'] = Flash::showMessages(); $this->return_json($this->status); return false; } else { $r = new MfrUserReport(); $r->last_updated = time(); $r->user_id = Session::get('id'); $r->height = $params['height']; $r->weight = $params['weight']; $r->neck_measurement = $params['neck']; $r->waist_measurement = $params['waist']; $r->waist_measurement = $params['waist']; $r->hip_measurement = $params['hip']; $r->waist_measurement = $params['waist']; $r->observations = $params['extras']; $r->save(); $this->status['success'] = 'ok'; } return $this->return_json($this->status); }
<?php } ?> <div> <button onclick="login()" type="submit"><b>Login</b></button> <small ><a onclick="recovery()">Forgot your password?</a></small> <br> <small><span ><ul id="recovery_errors"></ul></span></small> <small> <span > <ul id="login_errors"> <?php if (\Mariana\Framework\Session\Flash::showMessages()) { ?> <?php foreach (\Mariana\Framework\Session\Flash::showMessages() as $flash) { ?> <p><?php echo $flash; ?> </p> <?php } ?> <?php } ?> </ul> </span> </small> </div>
public function signup($params = array()) { # Requirements $this->load(); $this->status['status'] = 'fail'; # Params $user_login = $params['username']; $user_name = $params['name']; $user_email = $params['email']; $user_password = $params['password']; $user_password_2 = $params['password_confirm']; $brought_by = $params['code']; $brought_by = str_replace('#mfr_', '', strtolower($brought_by)); # Validation if (!Session::csrf($params['mariana-csrf'])) { $this->status['errors'] = array(Lang::get('csrf-check-fail')); $this->return_json($this->status); return header('HTTP/1.0 200 OK'); } $inputs = array('username' => array('name' => 'username', 'required' => true, 'alfanum' => true), 'password' => array('name' => 'password', 'required' => true, 'alfanum' => true, 'min' => 3, 'max' => 32), 'password_confirm' => array('name' => 'password_confirm', 'matches' => 'password', 'required' => true), 'email' => array('required' => true, 'email' => true)); if (Validation::check($inputs) === false) { $this->status['errors'] = Framework\Session\Flash::showMessages(); $this->return_json($this->status); return header('HTTP/1.0 200 OK'); } $check_if_username_exists = WpUsers::wp_unique_user($user_login, $user_email); if ($check_if_username_exists) { $this->status['errors'] = $check_if_username_exists; $this->return_json($this->status); return header('HTTP/1.0 200 OK'); } # Create entry on both databases $user_id = wp_create_user($user_login, $user_password, $user_email); MfrUsers::wp_create_user($user_id, $user_name, $brought_by); # Notify wp_new_user_notification($user_id, $user_password); # Sign the user in $params = array(); $params['username'] = $user_login; $params['password'] = $user_password; $this->login($params); $this->return_json($this->status); # Forcing code 200 - Dunno why but keeps failing on this specific function return header('HTTP/1.0 200 OK'); }