Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function signIn(){
- $allowed = ['user', 'password'];
- $success = false;
- if($_POST){
- foreach($allowed as $a){
- if(isset($_POST[$a])){
- $success = !empty($_POST[$a]) ? true : false;
- break;
- }else{
- $success = false;
- break;
- }
- }
- if($success){
- $user = stripslashes(strip_tags(rtrim($_POST[$allowed['user']])));
- $pass = hash('sha512', stripslashes(strip_tags(r_trim($_POST[$allowed['password']]))));
- echo 'ok';
- }else{
- $errors[] = 'User or password incorrect, please retry!';
- }
- }else{
- $errors[] = 'Post data are invalid, refresh page and try i!';
- }
- }else{
- $errors[] = "Post data are empty, refresh page and try i!";
- }
- echo $errors[0];
- }
Add Comment
Please, Sign In to add comment