
<?
$peremen2 = "0.50"; // какой процент

if ($type = webmoney) {
include("base.php");
include("confa2.php");
include("wm.inc");
unset ($podpis);
unset ($md5);


$dateiname = "pot.txt";
$fp = fopen($dateiname, "r");
while ( ! feof ($fp) ) {
	$zeile = fgets ($fp,1024);
}
$aktuell=$zeile + $LMI_PAYMENT_AMOUNT * $peremen2;
fclose($fp);

$fp2 = fopen($dateiname, "w");
fwrite($fp2,$aktuell);
fclose($fp2);



switch($num)
{
 case 1:
$win_amount= $LMI_PAYMENT_AMOUNT*$perem1;
$first = "$perem2";
$second = "$perem3";
echo "test";
 break;
 case 3:
$win_amount= $LMI_PAYMENT_AMOUNT*$perem11;
$first = "$perem12";
$second = "$perem13";
 break;
 case 4:
$win_amount= $LMI_PAYMENT_AMOUNT*$perem14;
$first = "$perem15";
$second = "$perem16";
 break;
 case 7:
$win_amount= $LMI_PAYMENT_AMOUNT*$perem41;
$first = "$perem42";
$second = "$perem43";
 break;
 case 8:
$win_amount= $LMI_PAYMENT_AMOUNT*$perem44;
$first = "$perem45";
$second = "$perem46";
 break;
 case 9:
$win_amount= "0.5";
$win_state = "win";

 break;
 case 10:
$win_amount= $LMI_PAYMENT_AMOUNT*$perem50;
$first = "$perem51";
$second = "$perem52";
 break;
 case 11:
$win_amount= $LMI_PAYMENT_AMOUNT*$perem53;
$first = "$perem54";
$second = "$perem55";
 break;
 case 12:
$win_amount= $LMI_PAYMENT_AMOUNT*$perem56;
$first = "$perem57";
$second = "$perem58";
 break;
}

if($num!=2 && $num!=5 && $num!=6 && $num!=9){
include "alg.php";
}

elseif ($num == "2") {
echo "test";
$rn=rand(1,$perem4);
if ($rn == $perem5) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*3; $chislo="1";}
elseif ($rn == $perem6) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*4; $chislo="2";}
elseif ($rn == $perem7) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*5; $chislo="3";}
elseif ($rn == $perem8) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*6; $chislo="4";}
elseif ($rn == $perem9) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*7; $chislo="5";}
elseif ($rn == $perem10) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*10; $chislo="6";}
else { $win_state = "lose"; $win_amount = "0"; }
}

elseif ($num == "5") {
$rn=rand(1,$perem17);
if ($rn == $perem18) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*0.5; $chislo="1";}
elseif ($rn == $perem19) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*1; $chislo="2";}
elseif ($rn == $perem20) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*1; $chislo="3";}
elseif ($rn == $perem21) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*2; $chislo="4";}
elseif ($rn == $perem22) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*4; $chislo="5";}
elseif ($rn == $perem23) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*6; $chislo="6";}
elseif ($rn == $perem24) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*10; $chislo="7";}
elseif ($rn == $perem25) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*15; $chislo="8";}
elseif ($rn == $perem26) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*20; $chislo="9";}
elseif ($rn == $perem27) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*100; $chislo="10";}
else { $win_state = "lose"; $win_amount = "0"; }
}
elseif ($num == "6") {
$rn=rand(1,$perem28);
if ($rn == $perem29) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*1; $chislo="1";}
elseif ($rn == $perem30) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*2; $chislo="2";}
elseif ($rn == $perem31) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*3; $chislo="3";}
elseif ($rn == $perem32) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*6; $chislo="4";}
if ($rn == $perem33) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*7; $chislo="5";}
elseif ($rn == $perem34) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*8; $chislo="6";}
elseif ($rn == $perem35) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*9; $chislo="7";}
elseif ($rn == $perem36) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*10; $chislo="8";}
elseif ($rn == $perem37) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*11; $chislo="9";}
elseif ($rn == $perem38) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*12; $chislo="10";}
elseif ($rn == $perem39) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*13; $chislo="11";}
elseif ($rn == $perem40) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*14; $chislo="12";}
else { $win_state = "lose"; $win_amount = "0"; }
}
}
$hash = strtolower ($LMI_HASH);
$md5res = md5($LMI_PAYEE_PURSE.$LMI_PAYMENT_AMOUNT.$LMI_PAYMENT_NO.$LMI_MODE.$LMI_SYS_INVS_NO.$LMI_SYS_TRANS_NO.$LMI_SYS_TRANS_DATE.$key.$LMI_PAYER_PURSE.$LMI_PAYER_WM);

if ($hash <> $md5res) {
exit;
}

if ($LMI_PAYMENT_AMOUNT > "0.5") {
$win_state = "lose";}


if ($access == insert) {
$que=@mysql_query ("SELECT * FROM `superloto` ORDER BY `ID` DESC"); 
$ida = mysql_num_rows($que);
$id = $ida+1;
$ok=@mysql_query ("INSERT INTO superloto values ('$id', NOW(), '$LMI_PAYER_WM', '$LMI_PAYER_PURSE', '$LMI_SYS_TRANS_NO', '$win_state', '$LMI_PAYMENT_AMOUNT', '$win_amount', '$chislo', '$num', '$type', '$hash')"); 
}

echo $win_state;





$char=substr($LMI_PAYER_PURSE,0,1);

if ($win_state == win) {
if ($char=='Z') {
$ourpurse = Z674418139487;
srand((double)microtime()*1000000);$trn_id  = rand(1, 100000000000000);$wmpurse = $LMI_PAYER_PURSE; $amount    = $win_amount;$dsc     = "Поздравляем!!! Cool-WM.ru";list($wmtrn_n, $err) = TransCreate($ourpurse, $wmpurse, $amount, $trn_id, $dsc);}

elseif ($char=='R') {
$ourpurse = R096831064511;
 srand((double)microtime()*1000000);$trn_id  = rand(1, 100000000000000);$wmpurse = $LMI_PAYER_PURSE; $amount    = $win_amount;$dsc     = "Поздравляем!!! Cool-WM.ru";list($wmtrn_n, $err) = TransCreate($ourpurse, $wmpurse, $amount, $trn_id, $dsc);}

elseif ($char=='E') {
$ourpurse = E386962586541;
 srand((double)microtime()*1000000);$trn_id  = rand(1, 100000000000000);$wmpurse = $LMI_PAYER_PURSE; $amount    = $win_amount;$dsc     = "Поздравляем!!! Cool-WM.ru";list($wmtrn_n, $err) = TransCreate($ourpurse, $wmpurse, $amount, $trn_id, $dsc); }
}





elseif ($win_state == "lose") { include("base.php");
$LMI_PAYMENT_AMOUNT2=$LMI_PAYMENT_AMOUNT/2;


if ($p==$LMI_PAYER_PURSE) {exit;}
if ($LMI_PAYMENT_AMOUNT < "0.1") {exit;}

if ($char=='Z')
if ($p<>'') {
if ($p<>$LMI_PAYER_PURSE) {
$ourpurse = Z674418139487;

srand((double)microtime()*1000000);$trn_id  = rand(1, 100000000000000);$wmpurse = $p; $amount    = $LMI_PAYMENT_AMOUNT2;$dsc     = "Перевод партнёрских с сайта Cool-WM.ru";list($wmtrn_n, $err) = TransCreate($ourpurse, $wmpurse, $amount, $trn_id, $dsc);}}
if ($char=='R')
if ($p<>'') {
if ($p<>'$LMI_PAYER_PURSE')
{
$ourpurse = R096831064511;

srand((double)microtime()*1000000);$trn_id  = rand(1, 100000000000000);$wmpurse = $p; $amount    = $LMI_PAYMENT_AMOUNT2;$dsc     = "Перевод партнёрских с сайта Cool-WM.ru";list($wmtrn_n, $err) = TransCreate($ourpurse, $wmpurse, $amount, $trn_id, $dsc);}}
if ($char=='E')
if ($p<>'') {
if ($p<>'$LMI_PAYER_PURSE'){

$ourpurse = E386962586541;

srand((double)microtime()*1000000);$trn_id  = rand(1, 100000000000000);$wmpurse = $p; $amount    = $LMI_PAYMENT_AMOUNT2;$dsc     = "Перевод партнёрских с сайта Cool-WM.ru";list($wmtrn_n, $err) = TransCreate($ourpurse, $wmpurse, $amount, $trn_id, $dsc);} }}




?>
