
<?
if ($type = webmoney) {
include("../base.php");
include("../confa2.php");



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= $LMI_PAYMENT_AMOUNT*$perem47;
$first = "$perem48";
$second = "$perem49";
 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){
include "../alg.php";
}

elseif ($num == "2") {
echo "test";
$rn=rand(1,$perem4);
if ($rn == $perem5) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*3;}
elseif ($rn == $perem6) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*4;}
elseif ($rn == $perem7) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*5;}
elseif ($rn == $perem8) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*6;}
elseif ($rn == $perem9) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*7;}
elseif ($rn == $perem10) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*10;}
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; $var="1";}
elseif ($rn == $perem19) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*1; $var="2";}
elseif ($rn == $perem20) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*1; $var="3";}
elseif ($rn == $perem21) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*2; $var="4";}
elseif ($rn == $perem22) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*4; $var="5";}
elseif ($rn == $perem23) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*6; $var="6";}
elseif ($rn == $perem24) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*10; $var="7";}
elseif ($rn == $perem25) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*15; $var="8";}
elseif ($rn == $perem26) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*20; $var="9";}
elseif ($rn == $perem27) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*100; $var="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; $var="1";}
elseif ($rn == $perem30) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*2; $var="2";}
elseif ($rn == $perem31) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*3; $var="3";}
elseif ($rn == $perem32) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*6; $var="4";}
if ($rn == $perem33) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*7; $var="5";}
elseif ($rn == $perem34) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*8; $var="6";}
elseif ($rn == $perem35) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*9; $var="7";}
elseif ($rn == $perem36) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*10; $var="8";}
elseif ($rn == $perem37) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*11; $var="9";}
elseif ($rn == $perem38) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*12; $var="10";}
elseif ($rn == $perem39) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*13; $var="11";}
elseif ($rn == $perem40) {$win_state= "win"; $win_amount= $LMI_PAYMENT_AMOUNT*14; $var="12";}
else { $win_state = "lose"; $win_amount = "0"; }
}




$que=@mysql_query ("SELECT * FROM `superloto` WHERE 1 ORDER BY `ID` DESC LIMIT 0, 5");
$que2=@mysql_fetch_array($que);
$id=$que2[ID]+1;

$ok=@mysql_query ("INSERT INTO `superloto` (`ID`, `DATE`, `ACCOUNT`, `ACCOUNT_`, `SYSNUM`, `STATE`, `STAVKA`, `AMMOUNT`, `BAP`, `GAMENUM`, `TYPE`) 
VALUES ('$id', NOW(), '$LMI_PAYER_WM', '$LMI_PAYER_PURSE', '$LMI_SYS_TRANS_NO', '$win_state', '$LMI_PAYMENT_AMOUNT', '$win_amount', '$chislo', '$num', 'webmoney')"); 
}

echo $win_state;

?>
