Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('includes/config.php');
- if( $user->is_logged_in() ){ header('Location: index.php'); exit(); }
- if(isset($_POST['submit'])){
- if (!isset($_POST['username'])) $error[] = "No username.";
- if (!isset($_POST['password'])) $error[] = "Type pass.";
- if(!$captcha){
- echo 'Check ReCaptcha';
- exit;
- }
- $secretKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
- $ip = $_SERVER['REMOTE_ADDR'];
- $response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha."&remoteip=".$ip);
- $responseKeys = json_decode($response,true);
- if(intval($responseKeys["success"]) !== 1) {
- echo 'Check ReCaptcha';
- exit;
- } else {
- $username = $_POST['username'];
- if ( $user->isValidUsername($username)){
- if (!isset($_POST['password'])){
- $error[] = 'Type pass';
- }
- $password = $_POST['password'];
- if($user->login($username,$password)){
- $_SESSION['username'] = $username;
- header('Location: memberpage.php');
- exit;
- } else {
- $error[] = 'Wrong pass.';
- }
- }else{
- $error[] = 'Wrong pass.';
- }
- }
- }
Add Comment
Please, Sign In to add comment