| 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/penpaleurope.com/backup/app/ |
Upload File : |
<?php
include "general.php";
include "connect.php";
include 'sendmailclient.php';
function rand_string( $length ) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$size = strlen( $chars );
for( $i = 0; $i < $length; $i++ ) {
$str .= $chars[ rand( 0, $size - 1 ) ];
}
return $str;
}
function rand_string2( $length ) {
$chars = "0123456789";
$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 userlogin 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 userlogin 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
//$_SESSION['accounttype']="euro";
// if ($_SESSION['accounttype'] == "" ){
//header('Location: register.php?err=1');
// die();
// }
$username =$_POST["name"];
//echo $username ."<br>";
$location =$_POST["location"];
//echo $location."<br>";
$email =$_POST["email"];
//echo $email."<br>";
$phonenumber =$_POST["phone"];
//echo $phonenumber."<br>";
$profile =$_POST["profile"];
//echo $profile."<br>";
//die();
$country =$_POST["country"];
//echo $country."<br>";
$sex =$_POST["sex"];
//echo $sex."<br>";
$age =$_POST["age"];
//echo $age."<br>";
//$birthmonth =$_POST["birthmonth"];
//echo $birthmonth."<br>";
//$birthyear =$_POST["birthyear"];
//echo $birthyear."<br>";
//$state =$_POST["state"];
//echo $state."<br>";
//$referrer =$_POST["referrer"];
//$accounttype =$_POST["currency"];
// echo $referrer."<br>";
//********************
$_SESSION['username'] =$_POST["name"];
$_SESSION['email'] =$_POST["email"];
$_SESSION['profile'] =$_POST["profile"];
$_SESSION['phone'] =$_POST["phone"];
$_SESSION['sex'] =$_POST["sex"];
$_SESSION['age'] =$_POST["age"];
$_SESSION['location'] =$_POST["location"];
$_SESSION['country'] =$_POST["country"];
//$_SESSION['birthyear'] =$_POST["birthyear"];
//$_SESSION['state'] =$_POST["state"];
//$_SESSION['country'] =$_POST["country"];
//$_SESSION['referrer'] =$_POST["referrer"];
//$_SESSION['accounttype']=$accounttype;
date_default_timezone_set('Europe/London');
if ($username =="" || $profile =="" || $email == "" || $phonenumber =="" || $age =="" || $location =="" || $country ==""){
header('Location: register.php?err=2');
die();
}
if (strlen($username) < 3){
header('Location: register.php?err=3');
die();
}
//echo "nosa";
if (!is_numeric($age)){
header('Location: register.php?err=7');
die();
}elseif ($age < 18) {
header('Location: register.php?err=23');
die();
}
if (strlen($profile) < 10){
header('Location: register.php?err=4');
die();
}
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email)) {
header('Location: register.php?err=5');
die();
}
if (strlen($phonenumber) < 7){
header('Location: register.php?err=6');
die();
}
//if (strlen($address) < 10){
// header('Location: register.php?err=7');
//die();
//}
if ($country=="Nigeria")
{
if( !is_numeric($phonenumber)){
header('Location: register.php?err=26');
die();
}
if ((strlen($phonenumber) < 13) || (strlen($phonenumber) > 13) ){
header('Location: register.php?err=8');
die();
}
if(substr($phonenumber,0,3) != "234"){
header('Location: register.php?err=9');
die();
}
if(substr($phonenumber,0,4) == "2340"){
header('Location: register.php?err=27');
die();
}
}
if ($country=="Ghana")
{
if( !is_numeric($phonenumber)){
header('Location: register.php?err=26');
die();
}
if (strlen($phonenumber) != 12){
header('Location: register.php?err=18');
die();
}
if(substr($phonenumber,0,3) != "233"){
header('Location: register.php?err=19');
die();
}
if(substr($phonenumber,0,4) == "2330"){
header('Location: register.php?err=19');
die();
}
if(substr($phonenumber,0,4) == "233 "){
header('Location: register.php?err=19');
die();
}
}
if ($country=="South Africa")
{
if( !is_numeric($phonenumber)){
header('Location: register.php?err=26');
die();
}
if (strlen($phonenumber) != 11){
header('Location: register.php?err=20');
die();
}
if(substr($phonenumber,0,2) != "27"){
header('Location: register.php?err=21');
die();
}
if(substr($phonenumber,0,3) == "270"){
header('Location: register.php?err=21');
die();
}
if(substr($phonenumber,0,3) != "27 "){
header('Location: register.php?err=21');
die();
}
}
//check if phonenumber already exists
$query = "Select msisdn from penpalsubscriber where msisdn ='$phonenumber'";
$response =getQuery1($query);
if ($response != "#")
{
header('Location: register.php?err=12');
die();
}
//check if email already exists
$query = "Select email from penpalsubscriber where msisdn ='$email'";
$response =getQuery1($query);
if ($response != "#")
{
header('Location: register.php?err=11');
die();
}
//get smscode
$smscode =rand_string2(6);
$emailcode =rand_string(10);
//send sms client
//echo $smscode ."<br>";
//echo $emailcode."<br>";
//die();
$transID= generateTransID();
$mess ="Dear ". $username ." use the smscode: ". $smscode . " to complete your registration";
$cnt1 = 0;
If($country =="Nigeria"){
$engine ="2";
$sender="32811";
$cnt1 ="1";
}
If($country =="Ghana"){
$engine ="1";
$sender="1903";
$cnt1 ="1";
}
If($country =="South Africa"){
$engine ="3";
$sender="Penpal";
$cnt1 ="1";
}
If($cnt1 =="0"){
$engine ="4";
$sender="Penpal";
$cnt1 ="1";
}
$messageout = "'" . $phonenumber . "','" . $sender . "','" . $mess . "','0','" .$engine. "'";
$query = "insert into Penpalmessagesent ( msisdn,sender,message,flag,engine) values (" . $messageout . ")";
$queryresponse = updateQuery($query);
//echo $query;
if ($queryresponse=="0" ){
//$mysub = "Registration Verification Code from " . $domain;
//$myMessage ="Dear <b>". $username. "</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 " . $domain."</b>";
//$mysub = "Registration Verification Code from " . $domain;
//$myMessage2 ="Dear ". $username. ",\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 " . $domain;
//echo $mymail."enough";
//$mymail = sendmailtoclient($email,$myMessage,$myMmessage2,$mysub,$mfrom,$mfromname);
//echo $mymail."moses";
$query ="INSERT INTO Enquiry (username,phonenumber, email,smscode,emailcode,domain, dateused) VALUES ('". $username."','". $phonenumber ."','". $email."','". $sex . "','".$location."','". $domain. "','". date('Y-m-d H:i:s')."')";
$queryresponse = updateQuery($query);
//echo $query;
//if(!$result= mysqli_query($con,$query))
//{
//echo mysqli_error($con);
//echo $email."<br>";
//echo $mfrom;
//echo $mfromname;
//header('Location: register.php?err=1');
//mysqli_close($con);
//die();
//}
$_SESSION['emailcode'] =$emailcode;
$_SESSION['smscode'] =$smscode;
header('Location: registerfinal.php');
die();
}
else
{
header('Location: register.php?err=13');
die();
}
?>