| 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 : C:/HostingSpaces/admin/plainmotors.net/wwwroot/ |
Upload File : |
<?php
include "general.php";
include "connect.php";
include 'sendmailclient.php';
function rand_string( $length ) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$str="";
$size = strlen( $chars );
for( $i = 0; $i < $length; $i++ ) {
$str .= $chars[ rand( 0, $size - 1 ) ];
}
return $str;
}
function rand_string2( $length ) {
$chars = "0123456789";
$str="";
$size = strlen( $chars );
for( $i = 0; $i < $length; $i++ ) {
$str .= $chars[ rand( 0, $size - 1 ) ];
}
return $str;
}
function getUsername( $musername,$domain)
{
include "connect.php";
$cnt ="";
// $con=mysqli_connect("127.0.0.1","smsEngine","guEnaR28T","smartsmsrouter");
// Check connection
//if (mysqli_connect_errno())
//{
// echo mysqli_error($con);
//echo "-1";
// die();
// }
$query ="select * from userlogin where username='". $musername ."' and domain='".$domain."'";
//echo $query;
if(!$result= mysqli_query($con,$query))
{
//echo mysqli_error($con);
echo "Database error please try again";
var_dump( mysqli_error($con));
//echo "me";
mysqli_close($con);
exit();
}
$cnt= "";
while($row = mysqli_fetch_array($result))
{
//$cnt = $row['balairtime'];
$cnt="yes";
//echo "nosa";
}
//echo $cnt."kate";
mysqli_close($con);
return $cnt;
}
function getPhone( $phonenumber,$domain)
{
include "connect.php";
$cnt ="";
// $con=mysqli_connect("127.0.0.1","smsEngine","guEnaR28T","smartsmsrouter");
// Check connection
//if (mysqli_connect_errno())
//{
// echo mysqli_error($con);
//echo "-1";
// die();
// }
$query ="select * from plainmotorsinvestors where phonenumber='". $phonenumber ."' and domain='".$domain."'";
//echo $query;
if(!$result= mysqli_query($con,$query))
{
//echo mysqli_error($con);
echo "Database error please try again";
mysqli_close($con);
exit();
}
$cnt= "";
while($row = mysqli_fetch_array($result))
{
//$cnt = $row['balairtime'];
$cnt="yes";
}
//echo $cnt;
mysqli_close($con);
return $cnt;
}
function getEmail( $memail,$domain)
{
$cnt ="";
include "connect.php";
//$con=mysqli_connect("127.0.0.1","smsEngine","guEnaR28T","smartsmsrouter");
// Check connection
//if (mysqli_connect_errno())
//{
// echo mysqli_error($con);
//echo "-1";
// die();
// }
$query ="select * from plainmotorsinvestors where email='". $memail ."' and domain='". $domain."'";
//echo $query;
if(!$result= mysqli_query($con,$query))
{
//echo mysqli_error($con);
echo "Database error please try again";
mysqli_close($con);
exit();
}
$cnt= "";
while($row = mysqli_fetch_array($result))
{
//$cnt = $row['balairtime'];
$cnt="yes";
}
//echo $cnt;
mysqli_close($con);
return $cnt;
}
//**************************
//**************************
// end of function
$password =$_POST["password"];
echo $password."<br>";
// die();
$email =$_POST["email"];
//echo $email."<br>";
$phonenumber =$_POST["phonenumber"];
//echo $phonenumber."<br>";
$fullname =$_POST["fullname"];
//echo $fullname."<br>";
$referrer =$_POST["referrer"];
//echo $fullname."<br>";
//die(); //********************
$_SESSION['password'] =$_POST["password"];
$_SESSION['email'] =$_POST["email"];
$_SESSION['fullname'] =$_POST["fullname"];
$_SESSION['referrer'] =$_POST["referrer"];
//phone number with +2340
if (substr($phonenumber,0,5) == "+2340"){
if (strlen($phonenumber) != 15){
header('Location: newuser.php?err=2');
die();
}else
{
$phonenumber= "234".substr($phonenumber,5,10);
echo $phonenumber;
}
}
//phone number with 2340
if (substr($phonenumber,0,4) == "2340"){
if (strlen($phonenumber) != 14){
header('Location: newuser.php?err=2');
die();
}else
{
$phonenumber= "234".substr($phonenumber,4,10);
echo $phonenumber;
}
}
//phone number with 234
if (substr($phonenumber,0,3) == "234"){
if (strlen($phonenumber) != 13){
header('Location: newuser.php?err=2');
die();
}
}
//phone number with a leading zero
if (substr($phonenumber,0,1) == "0"){
if (strlen($phonenumber) != 11){
header('Location: newuser.php?err=2');
die();
}else{
$phonenumber= "234".substr($phonenumber,1,10);
echo $phonenumber;
}
}
//phone number with a leading plus
if (substr($phonenumber,0,1) == "+"){
if (strlen($phonenumber) != 14){
header('Location: newuser.php?err=2');
die();
}else{
if (substr($phonenumber,1,3) != "234"){
header('Location: newuser.php?err=2');
die();
}
else
{
$phonenumber= substr($phonenumber,1,13);
echo $phonenumber;
}
}
}
$_SESSION['phonenumber'] =$phonenumber;
//echo "last";
//echo $phonenumber;
//die();
//if (substr($phonenumber,0,3) != "234"){
//if (strlen($phonenumber) != 11){
// header('Location: newuser.php?err=2');
//echo "success";
//die();
// }
//}
//die();
date_default_timezone_set('Europe/London');
if ($fullname =="" || $password =="" || $email == "" || $phonenumber ==""){
header('Location: newuser.php?err=8');
die();
}
if (strlen($fullname) < 3){
header('Location: newuser.php?err=3');
die();
}
if (strlen($fullname) > 60){
header('Location: newuser.php?err=7');
die();
}
if (strlen($password) < 6){
header('Location: newuser.php?err=4');
die();
}
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email)) {
header('Location: newuser.php?err=5');
die();
}
if (strlen($phonenumber) < 7){
header('Location: newuser.php?err=6');
die();
}
//check if email already exists
$response =getEmail($email,$domain);
if ($response=="yes")
{
header('Location: newuser.php?err=11');
die();
}
//check if phonenumber already exists
$response =getPhone($phonenumber,$domain);
if ($response=="yes")
{
header('Location: newuser.php?err=12');
die();
}
//get smscode
$smscode =rand_string2(6);
$emailcode =rand_string(6);
//send sms client
$transID= generateTransID();
$mess ="Dear ". $fullname ." use the sms_OTP: ". $smscode . " to complete your registration";
$mtype ="1";
$response =sendSMS( $fullname,$phonenumber, $transID, $domain,$mess,$sender,$mtype);
//echo "nosa ********";
//die();
if ($response=="0" ){
$mysub = "Plain Motors Verification";
$myMessage ="Dear <b>". $fullname. "</b>,<br><br>";
$myMessage .= "Below is the Email Code to complete your Registration<br><br>";
$myMessage .= "Email Code : <b>" . $emailcode . "</b><br><br>";
$myMessage .= "Thanks for your interest in our service. " . "<br>";
$myMessage .= "<b>Support Team <br> Plain Motors Limited</b>";
$mysub = "Plain Motors Verification";
$myMessage2 ="Dear ". $fullname. ",\n\n";
$myMessage2 .= "Below is the Email Code to complete your Registration\n\n";
$myMessage2 .= "Email Code : " . $emailcode . "\n\n";
$myMessage2 .= "Thanks for your interest in our service. " . "\n";
$myMessage2 .= "Support Team <br> Plain Motors Limited";
//echo $mymail."enough";
$mymail = sendmailtoclient($email,$myMessage,$myMessage2,$mysub,$mfrom,$mfromname);
//echo $mymail."moses";
$query ="INSERT INTO Enquiry (username,phonenumber, email,smscode,emailcode,domain, dateused) VALUES ('". $fullname."','". $phonenumber ."','". $email."','". $smscode . "','".$emailcode."','". $domain. "','". date('Y-m-d H:i:s')."')";
echo @query;
if(!$result= mysqli_query($con,$query))
{
//echo mysqli_error($con);
echo $email."<br>";
echo $mfrom;
echo $mfromname;
header('Location: newuser.php?err=1');
mysqli_close($con);
die();
}
$_SESSION['accounttype']="100";
$_SESSION['emailcode'] =$emailcode;
$_SESSION['smscode'] =$smscode;
header('Location: registerfinal.php');
die();
}
else
{
header('Location: newuser.php?err=13');
die();
}
?>