Your IP : 3.140.195.142


Current Path : /home/lentoinv/believersfamilyfoundation.com/profile/
Upload File :
Current File : /home/lentoinv/believersfamilyfoundation.com/profile/class.php

<?php 
// define("DB_SERVER", "localhost");
// define("DB_USER", "root");//enter your database username
// define("DB_PASS", "");//databse password
// define("DB_NAME", "bff");//database name

define("DB_SERVER", "localhost");
define("DB_USER", "schoejih_bfnetw");//enter your database username
define("DB_PASS", "bfnetw.1");//databse password
define("DB_NAME", "schoejih_bfnet");//database name

define("URL", "https://www.believersfamilynetwork.com/");
define("EMAIL_FROM_NAME", "Believers Family");
define("EMAIL_FROM_ADDR", "no_reply@believersfamilynetwork.com");
define("ADMIN_EMAIL", "admin@believersfamilynetwork.com");
define("EMAIL_WELCOME", true);

$db = new mysqli(DB_SERVER, DB_USER, DB_PASS, DB_NAME);


function userName($id,$col=''){
    global $db;

    $sql = $db->query("SELECT * FROM user WHERE id='$id'");
    $row = $sql->fetch_assoc();
    $val = ($col=='')?$row['firstname'].' '.$row['lastname']:$row[$col];
    return $val;
}


function sqL($table){
	global $db;
$sql=$db->query("SELECT * FROM $table")or die(mysqli_error());	
return mysqli_num_rows($sql); 
}
function sqL1($table,$col,$val){
	global $db;
$sql=$db->query("SELECT * FROM $table WHERE $col='$val' ")or die(mysqli_error());	
return mysqli_num_rows($sql); 
}

function sqL2($table,$col,$val,$col2,$val2){
	global $db;
$sql=$db->query("SELECT * FROM $table WHERE $col='$val' AND $col2='$val2' ")or die(mysqli_error());	
return mysqli_num_rows($sql); 
}
function sqL3($table,$col,$val,$col2,$val2,$col3,$val3){
	global $db;
$sql=$db->query("SELECT * FROM $table WHERE $col='$val' AND $col2='$val2' AND $col3='$val3' ")or die(mysqli_error());	
return mysqli_num_rows($sql); 
}
function sqLx($table,$col,$val,$item){
	global $db;
$sql=$db->query("SELECT * FROM $table WHERE $col='$val' ")or die(mysqli_error());	
$row = mysqli_fetch_assoc($sql); 
return $row[$item];
}
function sqLx2($table,$col,$val,$col2,$val2,$item){
	global $db;
$sql=$db->query("SELECT * FROM $table WHERE $col='$val' AND $col2='$val2' ")or die(mysqli_error());	
$row = mysqli_fetch_assoc($sql); 
return $row[$item];
}

function win_hash($length){
return substr(str_shuffle(str_repeat('1234567890abcdefghijklmnopqrstuvwxyz',$length)),0,$length);	
}





function Alert(){
	global $report,$count;
	if($count != 1){
 echo '<div class="alert alert-success alert-dismissible" style="position:fixed; top:10px; right:10px; z-index:10000">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                <i class="icon fa fa-check"></i> &nbsp;&nbsp;'. $report .'&nbsp;&nbsp;&nbsp;&nbsp;
              </div>';	
	}
	else{
	 echo '<div class="alert alert-danger alert-dismissible" style="position:fixed; top:10px; right:10px; z-index:10000">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                <i class="icon fa fa-ban"></i>  &nbsp;&nbsp;'. $report .' &nbsp;&nbsp;&nbsp;
              </div>';		
	}
	return;
}





	
class Profile{
	var $amount = 10000;  //Registration Fee
	var $pointrate = 1000;// Rate in Naira per point
	var $sponsorpoint = 3;// Each person you sponsor gives you 3 points
	var $downlinepoint = 1; // Each downline gives you 1 point// may not be used
	


private function layerKey(){
return $_SESSION['user_id'];
}
	


	//User Array Keys 
	/* Class constructor */
	   function __construct(){
	 if(array_key_exists('changePassword', $_POST)){ $this->changePassword(); }
	  elseif(array_key_exists('updateUser', $_POST)){ $this->updateUser(); }
	   elseif(array_key_exists('updatePhoto', $_POST)){ $this->updatePhoto(); }
	      elseif(array_key_exists('updatePhotoWild', $_POST)){ $this->updatePhotoWild(); }
	   elseif(array_key_exists('LoginUsers', $_POST)){ $this->LoginUsers(); }
	   elseif(array_key_exists('LogoutUser', $_POST)){ $this->LogoutUser(); }
	   elseif(array_key_exists('RegisterNewUser', $_POST)){ $this->RegisterNewUser(); }


	 return;
	  }
	  


function LogoutUser(){
session_destroy();
header('location: .');
}

function LoginUsers(){
	global $db,$report,$signup,$count;
	$username = strtolower(trim($_POST['email']));
	$password = $_POST['pwd'];
	$sql = $db->query("SELECT * FROM user WHERE email='$username' ");
	$num = mysqli_num_rows($sql);

	if($num==1){
		$row = mysqli_fetch_array($sql);
		$pass = $row['pass'];
		//if($pass==$password)
		if(password_verify($password, $pass)){
		
		$_SESSION['user_id'] = $row['id']; 
		$_SESSION['signup'] = '';
		header('location: .'); 
	}else{$report='Invalid Login details, Try again'; $count=1;}
	}else{$report='Invalid Login details, Try again'; $count=1;}
 
  
  return;
}


	
		function RegisterNewUser(){
		global $db,$report,$count;
		
if(isset($_GET['ref']) AND sqL1('user','sn',$_GET['ref'])==1){$ref = $_GET['ref']; }
elseif(isset($_POST['ref'])){$ref = $_POST['ref']; }
else{$ref = 1001; }
if(sqL1('user','sn',$ref)==0){$ref=1001;}


$upline = $this->findUpline($ref);

$que=$db->query("SELECT * FROM user WHERE sn = '$upline' " )or die(mysqli_error());
					$ro=mysqli_fetch_array($que);
					$a1 = $ro['sn'];
					$a2 = $ro['a1'];
					$a3 = $ro['a2'];
					$a4 = $ro['a3'];
					$a5 = $ro['a4'];
					$a6 = $ro['a5'];
					$a7 = $ro['a6'];
					$a8 = $ro['a7'];
					$a9 = $ro['a8'];
					$a10 = $ro['a9'];
					$id = win_hash(12);

					$firstname = $_POST['firstname'];
					$lastname = $_POST['lastname'];
					$sex = $_POST['sex'];
					$dob = $_POST['dob'];
					$phone = $_POST['phone'];
					$whatsapp = $_POST['whatsapp'];
					$address = $_POST['address'];
					$city = $_POST['city'];
					$state = $_POST['state'];
					$email = $_POST['email'];
					$password =  $pwd = password_hash($_POST['pwd'], PASSWORD_BCRYPT);

					//Validations
					if(sqL1('user','email',$email)>0){
						$report = 'A user with this e-mail already exixt. Check it and try again or request password reset'; $count=1;
					}
					elseif($_POST['pwd'] != $_POST['pwd2']){
					$report = 'Password confirmation miss-match. Check it and try again'; $count=1;	
					}
					else{



				$reg = $db->query("INSERT INTO user (id,sponsor,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,email,pass,firstname,lastname,sex,dob,phone,whatsapp,address,city,state)
VALUES('$id','$ref','$a1','$a2','$a3','$a4','$a5','$a6','$a7','$a8','$a9','$a10','$email','$password','$firstname','$lastname','$sex','$dob','$phone','$whatsapp','$address','$city','$state')") or die('Cannot Connect to Server');
 $_SESSION['user_id'] = $id;
$down=$db->query("SELECT * FROM user WHERE a1 = '$upline' " )or die(mysqli_error());
$nd=mysqli_num_rows($down);
$upd = $db->query("UPDATE user SET active = '$nd' WHERE sn = '$upline' ");

$subject = 'Welcome to Believers Family';
$msg = 'You have successfully registred with the Believers Family Network. Welcome to the team of people who believe in the vision of rebuilding Nigeria! The effort towards Nation Building is a collective responsibility and we need to join hands together to achieve this common goal to make our country a better place to stay. Join us to rebuild Nigeria and eradicate poverty through business and financial empowerment.<br>The Believers Family Network thrives on the principle of equality and firness through stragegic and continuous sharing of resources. <br> To grow your network faster, ensure you signup people who are likely to actively refer others. <br>
Login Information<br>
Email: '.$email.'<br>
Password: '.$_POST['pwd'].'<br><br>

Send your referral link: https://believersfamilyfoundation.com/profile/signup?ref='.$ref.' to friends and family members to join the Believers Family Foundation.
<br>We hope to have a fruitful business relationship with you.<br><br>

From the President<br><b>Florence Ojogo</b>';

$ref = sqLx('user','id',$id,'sn');
$sms = 'WELCOME TO BFN/100,000,000 TRNP. CONGRATULATIONS. YOU ARE NOW AN AMBASSADOR. YOU ARE REQUIRED TO NOMINATE 10 PEOPLE TODAY USING YOUR REFERRAL LINK: https://believersfamilyfoundation.com/profile/signup?ref='.$ref.'  Call 07069111552 for more information';

$this->sendSms($phone,$sms);
$this->emailer($email,$msg,$subject);
header('location: .');

}

return;
	}




    function findUpline($key){
        global $db;

        $sql = $db->query("SELECT * FROM user WHERE (sn='$key' OR a1='$key' OR a2='$key' OR a3='$key' OR a4='$key' OR a5='$key' OR a6='$key' OR a7='$key' OR a8='$key' OR a9='$key' OR a10='$key') AND active < 5 ORDER BY a1 ASC, sn ASC LIMIT 1") or die(mysqli_error());
        $row = mysqli_fetch_assoc($sql);
        return $row['sn'];
    }
   

    function myTeam($key){
        global $db;

        $sql = $db->query("SELECT * FROM user WHERE a1='$key' OR a2='$key' OR a3='$key' OR a4='$key' OR a5='$key' OR a6='$key' OR a7='$key' OR a8='$key' OR a9='$key' OR a10='$key' ") or die(mysqli_error());
       return mysqli_num_rows($sql);
     
    }
   


function emailer($email,$message,$subject){
	global $firstname;
$headers = 'From: BELIEVERS FAMILY FOUNDATION <admin@believersfamilyfoundation.com>' . "\r\n";
$headers .= 'Reply-To: admin@believersfamilyfoundation.com' . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";

$send =mail($email,$subject,$message,$headers);
return;
	}	



function sendSms($recipient,$message){
//global $report, $count;

$message=urlencode($message);
//$sender=urlencode(SENDERID);

$api = 'https://flexrecharge.com/api/v1/http.php?api_key=8c3fd7e1&recipient='.$recipient.'&message='.$message.'&sender=BFF&route=2';
$send = file($api);
return;
}








}



$pro = new Profile; 
$id = $_SESSION['user_id']??'';
$key = sqLx('user','id',$id,'sn');


?>

?>