From 8bdeb3a00be06acb02ed8a3277567e01ba8ab211 Mon Sep 17 00:00:00 2001 From: saiujwal chelamkuri <69893826+chsaiujwal@users.noreply.github.com> Date: Wed, 25 May 2022 17:24:56 +0530 Subject: [PATCH] Add files via upload --- action_page.php | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 action_page.php diff --git a/action_page.php b/action_page.php new file mode 100644 index 0000000..a14059d --- /dev/null +++ b/action_page.php @@ -0,0 +1,64 @@ + +load(); +$secret = $_ENV["SEC"]; +$recaptcha = $_POST['g-recaptcha-response']; +$res = reCaptcha($recaptcha, $secret); + +echo ($res['success']); +if(!($res['success'])){ + echo 'incorrect captcha, please go back to login page and try again! :-('; + return; +} + +$psw = $_POST["psw"]; +$email=$_POST["email"]; +$memail = $_ENV["EML"]; +$mpass = $_ENV['PWDD']; +function reCaptcha($recaptcha, $secret){ + $postvars="secret={$secret}&response={$recaptcha}"; + $url = "https://hcaptcha.com/siteverify"; + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_TIMEOUT, 10); + curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars); + $data = curl_exec($ch); + curl_close($ch); + return json_decode($data, true); +} + + +$ch = curl_init(); +$ip=$_SERVER['REMOTE_ADDR']; +curl_setopt($ch, CURLOPT_URL, 'https://box.domain.com/admin/mail/users/add'); +curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); +curl_setopt($ch, CURLOPT_POST, 1); +curl_setopt($ch, CURLOPT_POSTFIELDS, "email={$email}&password={$psw}"); +curl_setopt($ch, CURLOPT_USERPWD, $memail . ':' . $mpass); + +$headers = array(); +$headers[] = 'Content-Type: application/x-www-form-urlencoded'; +curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + +$result = curl_exec($ch); +if (curl_errno($ch)) { + echo 'Error:' . curl_error($ch); +} +curl_close($ch); +//echo $result; +if (strcmp($result,"User already exists.")==0){ +echo "Dude, User already exists"; +}else{ +echo "Email Successfully Created."; +echo " click here to go to login page "; +} + +?> +