mirror of
https://gitlab.com/CodeSolutionsProject/CodeShare.git
synced 2026-02-14 09:01:33 +01:00
MI update
This commit is contained in:
@@ -295,9 +295,11 @@ function loginRegister($default){
|
||||
"title" => ucfirst($default),
|
||||
"description" => "Start now in CodeShare",
|
||||
"page" => $default,
|
||||
"state" => 0, //0=no logged, 1 login fail, 2 register fail, 3 all correct (render home)
|
||||
"state" => 0, //0=no logged, 1 login fail, 2 register fail, 3 all correct (render home), 4 captcha failed
|
||||
);
|
||||
|
||||
$response = checkCaptcha($_POST['g-recaptcha-response']);
|
||||
|
||||
if(array_key_exists('email',$_POST) or array_key_exists('emailre',$_POST)){
|
||||
if($_POST["email"]){
|
||||
$bool=checklogin($_POST['email'],$_POST['pwd']);
|
||||
@@ -312,6 +314,8 @@ function loginRegister($default){
|
||||
}
|
||||
}
|
||||
|
||||
if($response)
|
||||
|
||||
if($bool) {
|
||||
header("Location: index.php");
|
||||
}else
|
||||
|
||||
@@ -77,4 +77,19 @@ function groupByCategory(&$supported){
|
||||
array_push($grouped[$val[1]][0],[$key,$val[0]]);
|
||||
}
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
function checkCaptcha($response){
|
||||
$url = "https://www.google.com/recaptcha/api/siteverify";
|
||||
$post = 'secret='.'6Lc7gXAUAAAAAOTbo2u3IXoSB6KlhtVmUHTzpcGY&response='. $response;
|
||||
|
||||
$ch = curl_init( $url );
|
||||
curl_setopt( $ch, CURLOPT_POST, 1);
|
||||
curl_setopt( $ch, CURLOPT_POSTFIELDS, $post);
|
||||
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt( $ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
$response = curl_exec( $ch );
|
||||
return json_decode($response)["success"];
|
||||
}
|
||||
Reference in New Issue
Block a user