| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /HostingSpaces/admin/247sms.com/wwwroot/ |
Upload File : |
```php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start();
header('Content-Type: application/json');
include "general.php";
include "connect.php";
if(!isset($domain))
{
$domain = "247sms.com";
}
/*
|--------------------------------------------------------------------------
| GOOGLE RECAPTCHA SECRET KEY
|--------------------------------------------------------------------------
*/
$secretKey = "6LcongEtAAAAALHYyjJZbZLxMUehcIar_Y8__MSl";
/*
|--------------------------------------------------------------------------
| CHECK RECAPTCHA
|--------------------------------------------------------------------------
*/
if(
!isset($_POST['g-recaptcha-response']) ||
empty($_POST['g-recaptcha-response'])
)
{
echo json_encode([
"status" => "error",
"message" => "Please complete the reCAPTCHA"
]);
exit();
}
$captcha = $_POST['g-recaptcha-response'];
$verifyURL =
"https://www.google.com/recaptcha/api/siteverify".
"?secret=".$secretKey.
"&response=".$captcha;
$verifyResponse = file_get_contents($verifyURL);
if($verifyResponse === false)
{
echo json_encode([
"status" => "error",
"message" => "Unable to connect to Google reCAPTCHA"
]);
exit();
}
$responseData = json_decode($verifyResponse);
if(!$responseData || !$responseData->success)
{
echo json_encode([
"status" => "error",
"message" => "reCAPTCHA verification failed"
]);
exit();
}
/*
|--------------------------------------------------------------------------
| RANDOM CODE GENERATOR
|--------------------------------------------------------------------------
*/
function rand_string2($length)
{
$chars = "0123456789";
$str = "";
for($i = 0; $i < $length; $i++)
{
$str .= $chars[rand(0, strlen($chars)-1)];
}
return $str;
}
/*
|--------------------------------------------------------------------------
| GET FORM VALUES
|--------------------------------------------------------------------------
*/
$username = trim($_POST["username"]);
$pass = trim($_POST["password"]);
$email = trim($_POST["email"]);
$phonenumber = trim($_POST["phone"]);
$address = trim($_POST["address"]);
$fullname = trim($_POST["fullname"]);
$state = trim($_POST["state"]);
$country = trim($_POST["country"]);
$referrer = trim($_POST["referrer"]);
$accounttype = trim($_POST["currency"]);
/*
|--------------------------------------------------------------------------
| VALIDATE REQUIRED FIELDS
|--------------------------------------------------------------------------
*/
if(
$username == "" ||
$pass == "" ||
$email == ""
)
{
echo json_encode([
"status" => "error",
"message" => "Please complete all required fields"
]);
exit();
}
/*
|--------------------------------------------------------------------------
| GENERATE EMAIL CODE
|--------------------------------------------------------------------------
*/
$emailcode = rand_string2(6);
/*
|--------------------------------------------------------------------------
| SAVE TO SESSION
|--------------------------------------------------------------------------
*/
$_SESSION['username'] = $username;
$_SESSION['password'] = $pass;
$_SESSION['email'] = $email;
$_SESSION['phone'] = $phonenumber;
$_SESSION['address'] = $address;
$_SESSION['fullname'] = $fullname;
$_SESSION['state'] = $state;
$_SESSION['country'] = $country;
$_SESSION['referrer'] = $referrer;
$_SESSION['accounttype'] = $accounttype;
$_SESSION['emailcode'] = $emailcode;
/*
|--------------------------------------------------------------------------
| SAVE ENQUIRY
|--------------------------------------------------------------------------
*/
$query = "
INSERT INTO Enquiry
(
username,
phonenumber,
email,
emailcode,
domain,
dateused
)
VALUES
(
'".$username."',
'".$phonenumber."',
'".$email."',
'".$emailcode."',
'".$domain."',
NOW()
)
";
$result = mysqli_query($con, $query);
if(!$result)
{
echo json_encode([
"status" => "error",
"message" => mysqli_error($con)
]);
exit();
}
/*
|--------------------------------------------------------------------------
| SEND EMAIL
|--------------------------------------------------------------------------
*/
$subject = "Registration Verification Code";
$message = "
Dear ".$username.",
<br><br>
Your verification code is:
<br><br>
<b>".$emailcode."</b>
<br><br>
247sms.com
";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= "From: noreply@247sms.com" . "\r\n";
$mailSent = mail(
$email,
$subject,
$message,
$headers
);
if(!$mailSent)
{
echo json_encode([
"status" => "error",
"message" => "Email could not be sent"
]);
exit();
}
/*
|--------------------------------------------------------------------------
| RETURN HTML
|--------------------------------------------------------------------------
*/
$verificationHtml = '
<div id="verificationMessage"></div>
<form id="verifyForm">
<div class="row uniform">
<div class="8u 12u$(small)">
<p>EMAIL CODE</p>
<input
type="text"
name="emailcode"
maxlength="10"
placeholder="Email Code"
required
/>
</div>
<div class="12u$">
<ul class="actions">
<li>
<input
type="submit"
class="special"
id="verifyBtn"
value="Submit"
/>
</li>
</ul>
</div>
</div>
</form>
';
/*
|--------------------------------------------------------------------------
| SUCCESS RESPONSE
|--------------------------------------------------------------------------
*/
echo json_encode([
"status" => "success",
"message" => "Verification code sent to your email",
"html" => $verificationHtml
]);
?>
```