<?
//*********************************************************************************
// Original Website By : Niadesain.com Di Jual melalui http://niadesain.com
// Please Call / SMS : 081384745483 (support@niadesain.com)
// Niadesain.com - Jasa Pembuatan Website Paling Murah dan Paling Lengkap
//*********************************************************************************
?>
<title>Konfirmasi Data Pendaftaran </title>
<?PHP 
$warna="red";
	$db->select("username", "banner_kanan", "username='$username'");
	$chkd_user = $db->num_rows();
if ($chkd_user!= "") {
	 	 echo "<H5><center><Font color=$warna>Maaf. Username yang anda masukkan sudah terdaftar dalam database kami.</center></font>";
    echo "<center><Font color=$warna>Silahkan menggunakan username lain. <br></center></font></h5>";
	if($referer == "admin") {
		$sp=$sponsore;
		$up = $upline;
	}
	include "form.php";
} else {
$a=preg_match("/^.+@.+..+$/",$email);
if((!$nama) || (!$alamat) || (!$kota) || (!$email) || (!$a) || (!$username) || (!preg_match('/^[a-zA-Z0-9_]+$/', $username)) || (strlen($username) < 4 ) || (!$password2) || (!preg_match('/^[a-zA-Z0-9_]+$/', $password2)) || (strlen($password2) <  6) || ($password1 <> $password2)) { 
 include "cekerror.php";
} else {
$by = explode("|", $db->config("biaya"));
	$biaya = $by[0];
	srand((double)microtime()*1000000); 
	$seed = rand(8000,9999); 
	srand((double)microtime()*$seed); 
	$yadda = rand (666,999); 
	if ($yadda < 10 )
	{
		$acak="00$yadda";
	} else {
		$acak = "0$yadda";
	}
$rpadmin = $biaya + $acak;
//---------masukkan data new member ke dalam database---------------
	$id_up = $db->result(0, "id");		
		$tlahir = "$th-$bl-$tg";
		$pass=($password2);
		$levele = $level + 1;
	for($i=0;$i<$paket;$i++) {	
		$pk = $i + 1;
			$user = $username;
			$uplinep = $upline;
			$id_upx = $id_up;
		}	
		if(is_odd($i) == 1 and $i > 0) {
			$pos = "KIRI";
		} elseif($i == 0) {
			$pos = $posisi;
		} else {	
			$pos = "KANAN";
		} 	
$db->insert("banner_kanan", "", "'', '$username', '$pass', '$nama', '$sponsore', '$upline', '$email', '$ym', '', '',  '', '$alamat', '$kota', '$propinsi', '$kodepos', '', '$hp', '$namaahliwaris', '', '$bank', '$norek', '$REMOTE_ADDR', '$sprp', '$rpadmin', '$clientdate', '','1','$pakej', '$harga','$oid','1', '0','0','0','0','0','0','0','0'");
//$db->insert("ewalet", "", "'', '$username', '$pass', '$clientdate', '1'");

//-------------------masukkan ke tabel upline--------------
$db->insert("upline", "", "'', '$username', '$sponsore', '$posisi', '$kiri', '$kanan', '$upline', '$upline0', '$upline1', '$upline2', '$upline3', '$upline4', '$upline5', '$upline6', '$upline7', '$upline8', '$upline9', '$upline10', '$upline11', '$upline12', '$upline13', '$upline14', '$upline15', '$upline16', '$upline17', '$upline18', '$upline19', '$upline20', '$upline21', '$upline22', '$upline23', '$upline24', '$upline25', '$upline26', '$upline27', '$upline28', '$upline29', '$upline30', '$upline31', '$upline32', '$upline33', '$upline34', '$upline35', '$upline36', '$upline37', '$upline38', '$upline39', '$upline40', '$upline41', '$upline42', '$upline44', '$upline44', '$upline45', '$upline46', '$upline47', '$upline48', '$upline49', '$upline50', '$upline51', '$upline52', '$upline53', '$upline54', '$upline55', '$upline56', '$upline57', '$upline58', '$upline59', '$upline60', '$upline61', '$upline62', '$upline63', '$upline64', '$upline65', '$upline66', '$upline67', '$upline68', '$upline69', '$upline70', '$upline71', '$upline72', '$upline73', '$upline74', '$upline75', '$upline76', '$upline77', '$upline78', '$upline79', '$upline80', '$upline81', '$upline82', '$upline83', '$upline84', '$upline85', '$upline86', '$upline87', '$upline88', '$upline89', '$upline90', '$upline91', '$upline92', '$upline93', '$upline94', '$upline95', '$upline96', '$upline97', '$upline98', '$upline99', '$upline100', '$upline101', '$upline102', '$upline103', '$upline104', '$upline105', '$upline106', '$upline107', '$upline108', '$upline109', '$upline110', '$upline111', '$upline112', '$upline113', '$upline114', '$upline115', '$upline116', '$upline117', '$upline118', '$upline119', '$upline120', '$upline121', '$upline122', '$upline123', '$upline124', '$upline125', '$upline126', '$upline127', '$upline128', '$upline129', '$upline130', '$upline131', '$upline132', '$upline133', '$upline134', '$upline135', '$upline136', '$upline137', '$upline138', '$upline139', '$upline140', '$upline141', '$upline142', '$upline143', '$upline144', '$upline145', '$upline146', '$upline147', '$upline148', '$upline149', '$upline150', '$upline151', '$upline152', '$upline153', '$upline154', '$upline155', '$upline156', '$upline157', '$upline158', '$upline159', '$upline160', '$upline161', '$upline162', '$upline163', '$upline164', '$upline165', '$upline166', '$upline167', '$upline168', '$upline169', '$upline170', '$upline171', '$upline172', '$upline173', '$upline174', '$upline175', '$upline176', '$upline177', '$upline178', '$upline179', '$upline180', '$upline181', '$upline182', '$upline183', '$upline184', '$upline185', '$upline186', '$upline187', '$upline188', '$upline189', '$upline190', '$upline191', '$upline192', '$upline193', '$upline194', '$upline195', '$upline196', '$upline197', '$upline198', '$upline199', '$upline200', '$upline201', '$upline202', '$upline203', '$upline204', '$upline205', '$upline206', '$upline207', '$upline208', '$upline209', '$levele', '0', '0', '0', '1'");
//--------update upline-------	
$db->update("card", "status='1', tgl_aktivasi='$clientdate'", "idmlm='$username'");

	if($posisi == "KIRI") {
			$db->update("upline", "kiri='$username'", "username='$upline'");
		} else {
			$db->update("upline", "kanan='$username'", "username='$upline'");
		}	
	
$domain= $db->config("domain");
$emailadmin = $db->config("email");	
$from = "$emailadmin";    
$to = "$email";    
$subject = "Konfrimasi Pendaftaran";    
$message = "
Hallo $nama, 
Terima kasih telah bergabung dengan program kami, berikut detail login Anda:
	
Username: $username
Password: $pass
    
Terimakasih,
	
Administrator
https://$domain
    ";   
$headers = "From:" . $from;    
mail($to,$subject,$message, $headers); 
	
	
		$domain= $db->config("domain");
		$emailadmin = $db->config("email");
		$isimail="Berikut data Member Baru di $domain :\n"
				."User ID         : $username\n"
				."Password        : $password2\n"
				."Nama            : $nama\n"
				."Alamat          : $alamat\n"
				."Kota            : $kota\n"
				."Propinsi        : $propinsi\n"
				."Telepon         : $telepon\n"
				."No. HP          : $hp\n"
				."E-mail          : $email\n"
				."Jumlah DP       : $rpadmin\n"
				."Sponsor         : $ref (".$db->dataku("nama", $ref).")\n"
				."Tanggal Daftar  : $clientdate\n\n"
			

				."Segera lakukan follow up kepada member tersebut.";
		$headers = "From: $nama<$email>\nX-Sender: $emailadmin\n";
		$subject = "[Pendaftaran Member Baru di $domain] - New Member"; 

	    $emailsponsor = $db->dataku("email", $sponsor);
		$isimailsp = "Berikut data Member Baru Atas Sponsoran anda di $domain :\n"
				."User ID         : $username\n"
				."Nama            : $nama\n"
				."Alamat          : $alamat\n"
				."Kota            : $kota\n"
				."Propinsi        : $propinsi\n"
				."Telepon         : $telepon\n"
				."No. HP          : $hp\n"
				."E-mail          : $email\n"
				."Jumlah DP       : $rpadmin\n"
				."Sponsor         : $ref (".$db->dataku("nama", $ref).")\n"
				."Tanggal Daftar  : $clientdate\n\n"
			

				."Segera lakukan follow up kepada member tersebut.";
		
		$subjectsp = "[Selamat Anda Mendapat Downline Member Baru di $domain] - New Member"; 
		$headersp="From: $domain<".$emailsponsor.">\nX-Sender: ".$emailadmin."\n";
         

//----- email ke member
$emailmember = $email;
		$isimailmember = "Hallo rekan $nama, terimakasih telah bergabung di program kami, berikut adalah data diri anda :\n"
				."Username        : $username\n"
				."Password        : $password2\n"
				."Nama            : $nama\n"
				."Alamat          : $alamat\n"
				."Kota            : $kota\n"
				."Propinsi        : $propinsi\n"
				."Telepon         : $telepon\n"
				."No. HP          : $hp\n"
				."E-mail          : $email\n"
				."Sponsor         : $ref (".$db->dataku("nama", $ref).")\n"
				."Tanggal Daftar  : $clientdate\n\n"
			

				."Untuk masuk ke member area silahkan ke http://www.webmlm.my.id/member";
		
		$subjectmember = "[Konfirmasi Pendaftaran] - New Member"; 
		@mail($emailmember, $subjectmember, $isimailmember, "From: Admininistrator<$emailadmin>\n"); 
         
//--------bank admin----------



$bank_admin = $db->config("bank");



$bank_admin = $bank_admin . "\nData bank pengelola:\n";

$data = preg_replace("{BANKADMIN}", $bank_admin, $data);

	//$aemailbody = $data;

$duit = rupiah($rpadmin);

$spon_nama = $db->dataku("nama", $sponsor);

$spon_mail = $db->dataku("email", $sponsor);

$spon_telp = $db->dataku("phone", $sponsor);

$spon_hp = $db->dataku("hp", $sponsor);

$bank_sp = $db->dataku("bank", $sponsor);	   

$hpadmin = $db->config("hpsms");    

$bankadmin = $db->config("bank");  

$bankadmin1 = $db->config("bank1");  

$pengelola = $db->config("name");  

$rp_admin = rupiah($rpadmin);

//$rp_spon = rupiah($rpreferer);

//$rp_spon2 = rupiah($rpreferer2);

$sponsor2 = $db->dataku("sponsor", $sponsor);

$spon_nama2 = $db->dataku("nama", $upline);

$spon_mail2 = $db->dataku("email", $upline);

$spon_telp2 = $db->dataku("phone", $upline);

$bank_sp2 = $db->dataku("bank", $upline);   



$hp2 = $db->dataku("hp", $sponsor2);  //--------------- email ke new member--------
        $emailadm = $db->config("email");
  		$subject2 ="Selamat Datang di $domain";
		$headers2="From: $domain<".$emailadmin.">\nX-Sender: ".$emailadmin."\n";

 	if($off == 1) {

		$filename = "../thankyou.txt";	

	} else {	

		$filename = "thankyou.txt";

	}	

	$fp = fopen($filename, "r");

	$data = fread($fp, filesize($filename));

	fclose($fp);

	$data = preg_replace("{USERNAME}", $username, $data);

	$data = preg_replace("{EMAIL}", $email, $data);

	$data = preg_replace("{ALAMAT}", $alamat, $data);

	$data = preg_replace("{PASSWORD}", $password2, $data);

	$data = preg_replace("{KOTA}", $kota, $data);

	$data = preg_replace("{PROPINSI}", $propinsi, $data);

	$data = preg_replace("{DPRP}", $duit, $data);

	$data = preg_replace("{HP}", $hp, $data);

	$data = preg_replace("{NAMA}", $nama, $data);

	$data = preg_replace("{SPONSORID}", $sponsore, $data);

	$data = preg_replace("{NAMASPON}", $spon_nama, $data);

	$data = preg_replace("{SPON_MAIL}", $spon_mail, $data);

	$data = preg_replace("{SPON_HP}", $spon_hp, $data);

	

	$data = preg_replace("{HPADMIN}", $hpadmin, $data);

	$data = preg_replace("{BANKADMIN}", $bankadmin, $data);

	$data = preg_replace("{BANKADMIN1}", $bankadmin1, $data);

	$data = preg_replace("{RPADMIN}", $rp_admin, $data);

	$data = preg_replace("{PENGELOLA}", $pengelola, $data);

//--------bank admin----------

$bank_admin = "$bank_admin";

$data = preg_replace("{BANKADMIN}", $bank_admin, $data);	

	

	$aemailbody = $data;

		

        @mail($email, $subject, $aemailbody, $headers); 

//------------- email ke Admin

		@mail($emailadmin, $subject, $isimail, $headers);



//------------- email ke sponsor

		@mail($emailsponsor, $subjectsp, $isimailsp, $headersp);

	// begin ---- kirim sms notifikasi 
			// www.niadesain.com 
			//require_once('smsclass.php'); // panggil class  
			//$nohp  = $hp;
			//$pesan = "Terimakasih anda telah bergabung di komunitas www.webmlm.my.id username: ".$username." ,Pass: ".$password2.".";
			//$sms = new smsreguler();
			//$sms->username = 'webmlm.my.id';
			//$sms->password = 'kgu65ryt5';
			//$sms->apikey   = 'fb9d9aec4124cb47caa3ae51ff4a534d';
			//$sms->setTo($nohp);
			//$sms->setText($pesan);
			//$sts=$sms->smssend();
			// end ----	

		include "thankyou.php";

	} 

	?>
<?

}

?> 