Файл: registr.php
Строк: 549
<?php
session_start();
if(isset($_POST['parent'])):
setcookie("parent", $_POST['parent'], time() + (86400*30));
$_COOKIE['parent'] = mysql_escape_string($_POST['parent']);
endif;
include("header.php");
$aip = 'NO';
$em = 'YES';
$ko = 'YES';
$sk = 'NO';
$te = 'NO';
$urlpage='Регистрация';
$submit=$_POST['submit'];
$login1=mysql_escape_string($_POST['login1']);
$parent=mysql_escape_string($_COOKIE['parent']);
$email=mysql_escape_string($_POST['email']);
$wm_perfektmoney=mysql_escape_string($_POST['wm_perf']);
$wm_alertpay=mysql_escape_string($_POST['wm_li']);
$skype=mysql_escape_string($_POST['skype']);
$icq=mysql_escape_string($_POST['icq']);
$wm=$_POST['wm'];
$rules=$_POST['rules'];
$code=$_POST['code'];
$sql1=mysql_query("select*from ".$db_pref."sysvals");
$row1=mysql_fetch_array($sql1);
$pere=$row1['slogan'];
$sistem=$row1['sistem'];
$currency=$row1['currency'];
$reg1=$lang['reg1'];
$reg2=$lang['reg2'];
$reg3=$lang['reg3'];
$reg4=$lang['reg4'];
$reg5=$lang['reg5'];
$reg6=$lang['reg6'];
$reg7=$lang['reg7'];
$reg36=$lang['reg36'];
$reg8=$lang['reg8'];
$reg12=$lang['reg12'];
$reg13=$lang['reg13'];
$lang['profiles1']=str_replace("{wm}",$row1['currency'],$lang['profiles1']);
$lang['reg16']=str_replace("{wm}",$row1['currency'],$lang['reg16']);
$lang['reg33']=str_replace("{wm}",$row1['currency'],$lang['reg33']);
$lang['reg34']=str_replace("{wm}",$row1['currency'],$lang['reg34']);
$lang['reg35']=str_replace("{wm}",$row1['currency'],$lang['reg35']);
$profiles1=$lang['profiles1'];
$profiles2=$lang['profiles2'];
$profiles18=$lang['profiles18'];
$profiles19=$lang['profiles19'];
$profiles20=$lang['profiles20'];
$wm_perfektmoney = preg_replace("/(s){1,}/",'',$wm_perfektmoney);
$wm_alertpay = preg_replace("/(s){1,}/",'',$wm_alertpay);
$wm = preg_replace("/(s){1,}/",'',$wm);
if(!isset($submit)){
print_form();
}
if (isset($submit)){
$sqlip=mysql_query("select*from ".$db_pref."users where user='$parent'");
$rowip=mysql_fetch_array($sqlip);
$ip_error=$rowip['ip'];
$ip=$_SERVER['REMOTE_ADDR'];
if(($ip_error==$ip)and($aip=='YES')){
?>
<div align="center"><font color="red"><b><?=$lang['reg9'];?></b></font><br><br></div>
<?
print_form();
}else{
$ulength=strlen($login1);
if (($ulength<'5') || ($ulength>'10')||(!preg_match("/^s*[^s]+s*$/", $login1) ) ){
?>
<div align="center"><font color="red"><b><?=$lang['reg11'];?></b></font><br><br></div>
<?
print_form();
}else{
$sql=mysql_query("select*from ".$db_pref."users where user='$login1'");
$num=mysql_num_rows($sql);
if($num!="0"){
?>
<div align="center"><font color="red"><b><?=$lang['reg10'];?></b></font><br><br></div><?
print_form();
}else{
mb_internal_encoding("UTF-8");
$login_admin=mb_strtolower($login1);
if (($login_admin=='ADMIN') || ($login_admin=='Admin') || ($login_admin=='admin') || ($login_admin=='АДМИН') || ($login_admin=='Админ') || ($login_admin=='админ')){
$lang['reg14']=str_replace("{login_admin}",$login1,$lang['reg14']);
?>
<div align='center'><font color='red'><b><?=$lang['reg14'];?></b></font><br><br></div>
<?
print_form();
}else{
if(!preg_match('/^(([^<>()[]\.,;:s@"']+(.[^<>()[]\.,;:s@"']+)*)|("[^"']+"))@(([d{1,3}.d{1,3}.d{1,3}.d{1,3}])|(([a-zA-Zd-]+.)+[a-zA-Z]{2,}))$/', $email))
{
?>
<div align="center"><font color="red"><b><?=$lang['reg15'];?></b></font><br><br></div>
<?
print_form();
}else{
if(($sistem==alertpay) and(!preg_match('/^(([^<>()[]\.,;:s@"']+(.[^<>()[]\.,;:s@"']+)*)|("[^"']+"))@(([d{1,3}.d{1,3}.d{1,3}.d{1,3}])|(([a-zA-Zd-]+.)+[a-zA-Z]{2,}))$/', $wm))){
?>
<div align="center"><font color="red"><b><?=$lang['reg15'];?> Alertpay</b></font><br><br></div>
<?
print_form();
}else{
if(($sistem==multi) and ($wm_alertpay!=='') and (!preg_match('/^(([^<>()[]\.,;:s@"']+(.[^<>()[]\.,;:s@"']+)*)|("[^"']+"))@(([d{1,3}.d{1,3}.d{1,3}.d{1,3}])|(([a-zA-Zd-]+.)+[a-zA-Z]{2,}))$/', $wm_alertpay))){
?>
<div align="center"><font color="red"><b><?=$lang['reg15'];?> Alertpay</b></font><br><br></div>
<?
print_form();
}
else{
$sql1=mysql_query("select*from ".$db_pref."sysvals");
$row1=mysql_fetch_array($sql1);
$currency=$row1['currency'];
$wm_perfektmoney=trim($wm_perfektmoney);
$wm_length_p=strlen($wm_perfektmoney);
$wm_test_p=substr($wm_perfektmoney,0,1);
if (($sistem==multi) and ($wm_perfektmoney!=='') and ($wm_length_p != '8') || ($wm_test_p != "$currency")){
?>
<div align="center"><font color="red"><b><?=$lang['reg34'];?></b></font><br><br></div>
<?
print_form();
}
else{
$sql1=mysql_query("select*from ".$db_pref."sysvals");
$row1=mysql_fetch_array($sql1);
$currency=$row1['currency'];
$wm=trim($wm);
$wm_length=strlen($wm);
$wm_test=substr($wm,0,1);
if (($sistem==perfekt) and ($wm_length != '8') || ($wm_test != "$currency")){
?>
<div align="center"><font color="red"><b><?=$lang['reg34'];?></b></font><br><br></div>
<?
print_form();
}
else{
$ulength=strlen($email);
if (($ulength<'7') || ($ulength>'30')){
?>
<div align="center"><font color="red"><b><?=$lang['reg18'];?></b></font><br><br></div>
<?
print_form();
}else{
$findemail= mysql_query("select * from ".$db_pref."users where email='$email';");
$count1=mysql_num_rows($findemail);
if(($em=="YES")and($count1!=0)){
?>
<div align="center"><font color="red"><b><?=$lang['reg19'];?></b></font><br><br></div>
<?
print_form();
}else{
$sql1=mysql_query("select*from ".$db_pref."sysvals");
$row1=mysql_fetch_array($sql1);
$currency=$row1['currency'];
$wm=trim($wm);
$wm_length=strlen($wm);
$wm_test=substr($wm,0,1);
if (($sistem==webmoney) and ($wm_length <'3') ){
?>
<div align="center"><font color="red"><b><?=$lang['reg16'];?></b></font><br><br></div>
<?
print_form();
}
else{
$sql1=mysql_query("select*from ".$db_pref."sysvals");
$row1=mysql_fetch_array($sql1);
$currency=$row1['currency'];
$wm=trim($wm);
$wm_length=strlen($wm);
$wm_test=substr($wm,0,1);
if (($sistem==liberty) and ($wm_length != '8') || ($wm_test != "$currency")){
?>
<div align="center"><font color="red"><b><?=$lang['reg33'];?><br><?=$currency;?></b></font><br><br></div>
<?
print_form();
}
else{
$sql1=mysql_query("select*from ".$db_pref."sysvals");
$row1=mysql_fetch_array($sql1);
$currency=$row1['currency'];
$wm=trim($wm);
$wm_length=strlen($wm);
$wm_test=substr($wm,0,1);
if (($sistem==multi) and ($wm!=='') and ($wm_length != '8') || ($wm_test != "$currency")){
?>
<div align="center"><font color="red"><b><?=$lang['reg35'];?></b></font><br><br></div>
<?
print_form();
}
else{
if (($sistem==liqpay) and ($wm_length<'11') || ($wm_length>'13')){
?>
<div align="center"><font color="red"><b><?=$lang['reg17'];?></b></font><br><br></div>
<?
print_form();
}
else{
$findwm = mysql_query("select * from ".$db_pref."users where wm='$wm';");
$count1=mysql_num_rows($findwm);
if(($sistem!==multi)and($ko=="YES")and($count1>0)){
?>
<div align="center"><font color="red"><b><?=$lang['reg28'];?></b></font><br><br></div>
<?
print_form();
}else{
$findwm = mysql_query("select * from ".$db_pref."users where wm='$wm';");
$count1=mysql_num_rows($findwm);
if(($sistem==multi)and($wm!=='')and($count1>0)){
?>
<div align="center"><font color="red"><b><?=$lang['reg28'];?><br>LIBERTY RESERVE</b></font><br><br></div>
<? print_form();
}else{
$findwm = mysql_query("select * from ".$db_pref."users where perfektmoney='$wm_perfektmoney';");
$count2=mysql_num_rows($findwm);
if(($sistem==multi)and($wm_perfektmoney!=='')and($count2>0)){
?>
<div align="center"><font color="red"><b><?=$lang['reg28'];?><br>Perfect Money</b></font><br><br></div>
<? print_form();
}else{
$findwm = mysql_query("select * from ".$db_pref."users where alertpay='$wm_alertpay';");
$count3=mysql_num_rows($findwm);
if(($sistem==multi)and($wm_alertpay!=='')and($count3>0)){
?>
<div align="center"><font color="red"><b><?=$lang['reg28'];?><br>ALERTPAY</b></font><br><br></div>
<? print_form();
}else{
$ulength=strlen($icq);
if (($te=="YES")and($ulength<'1')){
?>
<div align="center"><font color="red"><b><?=$lang['reg38'];?> Telefon</b></font><br><br></div>
<?
print_form();
}else{
$ulength=strlen($skype);
if (($sk=="YES")and($ulength<'1')){
?>
<div align="center"><font color="red"><b><?=$lang['reg38'];?> Skype</b></font><br><br></div>
<?
print_form();
}else{
$ulength=strlen($rules);
if (($ulength<'1')){
?>
<div align="center"><font color="red"><b><?=$lang['reg20'];?></b></font><br><br></div>
<?
print_form();
}else{
if( strtolower($_POST['code'])!= strtolower($_SESSION['texto'])){
?>
<div align="center"><font color="red"><b><?=$lang['reg21'];?></b></font><br><br></div>
<?
print_form();
}else{
$parent_ref=$parent;
if($matrix=="YES"){
//$parent= registr_matrix($parent);
$parent= registr_matrix($parent);
}
else{
//$parent= registr($parent);
$parent= registr($parent);
}
$sql=mysql_query("select*from ".$db_pref."users where user='$parent'");
$row=mysql_fetch_array($sql);
$parent2=$row['parent'];
$parent3=$row['parent2'];
$parent4=$row['parent3'];
$parent5=$row['parent4'];
$parent6=$row['parent5'];
$parent7=$row['parent6'];
$parent8=$row['parent7'];
$parent9=$row['parent8'];
$parent10=$row['parent9'];
$pemail=$row['email'];
$str=Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z");
$pass="";
for ($i=0;$i<rand(8,12);$i++) $pass.=$str[rand(0,count($str))];
$ip=$_SERVER['REMOTE_ADDR'];
$date=time();
$password = md5(md5(trim($pass.$sekretkey)));
mysql_query("INSERT INTO ".$db_pref."users set lang='x' , user='$login1',pass='$password',email='$email',skype='$skype',icq='$icq',wm='$wm',alertpay='$wm_alertpay',perfektmoney='$wm_perfektmoney', rang='0',parent='$parent',parent2='$parent2',parent3='$parent3',parent4='$parent4',parent5='$parent5',parent6='$parent6',parent7='$parent7',parent8='$parent8',parent9='$parent9',parent10='$parent10',date_reg='$date',date_active='$date',ip='$ip',ad='0' ,parent_ref='$parent_ref'");
?>
<div align="center">
<div class="s5_mod_h3_l">
<div class="s5_mod_h3_r">
<div class="s5_mod_h3_m">
<h3 class="s5_mod_h3"><span class="s5_h3_first">
<?=$lang['reg27'];?>
</span></h3>
</div>
</div>
</div>
<table class="form" width="90%" border="0" align="center" cellpadding="15" cellspacing="0">
<tr>
<td align="left"><?=$lang['reg23'];?>
</td>
</tr>
<tr>
<td align="left" class="<?=$form;?>">
<?=$lang['reg2'];?> : <?=$login1;?><br>
<?=$lang['reg30'];?> : <?=$pass;?><br>
<?=$lang['reg3'];?> : <?=$email;?><br>
<?=$lang['reg13'];?> : <?=$skype;?><br>
<?=$lang['reg12'];?> : <?=$icq;?><br>
<?if($sistem==liberty){?>
<?=$lang['profiles18'];?> : <?=$wm;?><br>
<?}if($sistem==liqpay){?>
<?=$profiles2;?> : + <?=$wm;?><br>
<?}if($sistem==webmoney){?>
<?=$lang['reg31'];?> : + <?=$wm;?><br>
<?}
if($sistem==alertpay){?>
<?=$lang['profiles19'];?> : <?=$wm;?><br>
<?}?>
<?=$lang['reg4'];?> : <?=$parent;?></td>
</tr>
</table>
<br><?=$lang['reg24'];?><br>
</div>
<?
$sql=mysql_query("select*from ".$db_pref."sysvals");
$row=mysql_fetch_array($sql);
$site_url=$row['site_url'];
$name_title=$row['name_title'];
$sqladmin=mysql_query("select*from ".$db_pref."users where id='1'");
$rowadmin=mysql_fetch_array($sqladmin);
$admin_email=$rowadmin['email'];
$lang['reg_mail']=str_replace("{login}",$login1,$lang['reg_mail']);
$lang['reg_mail']=str_replace("{name_title}",$name_title,$lang['reg_mail']);
$lang['reg_mail']=str_replace("{pass}",$pass,$lang['reg_mail']);
$lang['reg_mail']=str_replace("{email}",$email,$lang['reg_mail']);
$lang['reg_mail']=str_replace("{koshel}",$wm,$lang['reg_mail']);
$lang['reg_mail']=str_replace("{parent}",$parent,$lang['reg_mail']);
$lang['reg_mail']=str_replace("{site_url}",$site_url,$lang['reg_mail']);
$message=$lang['reg_mail'];
$sql_user_mail=mysql_query("select*from ".$db_pref."users where user='$parent'");
$row_user_mail=mysql_fetch_array($sql_user_mail);
$lang_mail=$row_user_mail["lang"];
if($lang_mail=='lv'){
include('language/mail-lv.php');
}
elseif($lang_mail=='ru'){
include('language/mail-ru.php');
}
elseif($lang_mail=='en'){
include('language/mail-en.php');
}
else{
include('language/mail-'.$deflangu.'.php');
}
$lang['reg_mail1']=str_replace("{login}",$login1,$lang['reg_mail1']);
$lang['reg_mail1']=str_replace("{name_title}",$name_title,$lang['reg_mail1']);
$lang['reg_mail1']=str_replace("{email}",$email,$lang['reg_mail1']);
$lang['reg_mail1']=str_replace("{parent}",$parent,$lang['reg_mail1']);
$lang['reg_mail1']=str_replace("{site_url}",$site_url,$lang['reg_mail1']);
$message1=$lang['reg_mail1'];
mail("$email","$reg1 & $name_title","$message","From: $admin_emailn"."Content-type: text/plain; charset=utf-8");
$reg32=$lang['reg_m32'];
mail("$pemail","$reg32 & $name_title","$message1","From: $admin_emailn"."Content-type: text/plain; charset=utf-8");
if($lang_admin==en){ include('language/admin_mail_en.php');}
if($lang_admin==ru){ include('language/admin_mail_ru.php');}
$lang['reg_maila1']=str_replace("{login}",$login1,$lang['reg_maila1']);
$lang['reg_maila1']=str_replace("{ip}",$ip,$lang['reg_maila1']);
$date = date('d.m.Y H:i', $date);
$lang['reg_maila1']=str_replace("{date}",$date,$lang['reg_maila1']);
$lang['reg_maila1']=str_replace("{email}",$email,$lang['reg_maila1']);
$lang['reg_maila1']=str_replace("{parent}",$parent,$lang['reg_maila1']);
$lang['reg_maila1']=str_replace("{site_url}",$site_url,$lang['reg_maila1']);
$adminmessage=$lang['reg_maila1'];
$reg_maila2=$lang['reg_maila2'];
mail("$admin_email","$reg_maila2","$adminmessage","From: $admin_emailn"."Content-type: text/plain; charset=utf-8");
}}}}}}}}}}}}}}}}}}}}}}}}
include("footer.php");
?>