Вход Регистрация
Файл: DarkAge/casino.php
Строк: 277
<?
Error_Reporting
(E_ALL & ~E_NOTICE);
$log htmlspecialchars(stripslashes($log));
$pas htmlspecialchars(stripslashes($pas));
/////////////////////////////////////////////////////

/*
echo "Ваша ставка(от <b>1</b> до <b>$max</b>) :</small><br/>n";
echo "<form method=post action=casino.php?log=$log&amp;pas=$pas&amp;$ses>";
echo "<input type="log" name="mn$ref" maxlength="$maxlen" title="pass" format="*N"/><br/>n";
echo "<input type="submit" value="Играть" />n";
echo "</form>n";
*/

$text = @file("data/reg/$log.dat"); 
if (
$text!=""){
$udata explode(":||:",$text[0]);
$login=trim($udata[0]);
$password=trim($udata[1]);
$aden=trim($udata[8]);}
////////////////////////////////////////////////////////
if (md5($pas)==$password && $log==$login && $log!=="" && md5($pas)!=="") {
ini_set('session.use_cookies','0');
ini_set('session.use_trans_sid','0');
ini_set('url_rewriter.tags','');
session_name("stw");
session_start();
header("Cache-Control: no-cache");
header("Content-type:text/vnd.wap.wml");
if(!
session_is_registered("session")){
$session['round']=0;
$session['money']=$udata[8];
$session['con']=0;
$session['histuser']="";
session_register("session");
$ref=rand(100,99999);
$ses=SID;
$ses="$ses&amp;$ref";
function 
cards_score($str){
if(
$str==1||$str==2||$str==3||$str==4){
$num 6;                 }
if(
$str==5||$str==6||$str==7||$str==8){
$num 7;                 }
if(
$str==9||$str==10||$str==11||$str==12){
$num 8;                 }
if(
$str==13||$str==14||$str==15||$str==16){
$num 9;                 }
if(
$str==17||$str==18||$str==19||$str==20){
$num 10;                 }
if(
$str==21||$str==22||$str==23||$str==24){
$num 2;                 }
if(
$str==25||$str==26||$str==27||$str==28){
$num 3;                 }
if(
$str==29||$str==30||$str==31||$str==32){
$num 4;                 }
if(
$str==33||$str==34||$str==35||$str==36){
$num 11;                 }
return 
$num;                 }
if(
$session['round']==0){
$max $session['money'];
if(
$max==0){ session_unregister("session");
echo 
"<?xml version="1.0" encoding="UTF-8"?>n";
echo 
"<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml12.dtd">n";
echo "<wml>n";
echo 
"<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>n";
echo 
"<card id="index" title="21">n";
echo 
"<p align="center"><small>n";
echo 
"У Вас на счету не осталось средств для продолжения текущей игры!<br/>n";
echo 
"<a href="bank.php?log=$log&amp;pas=$pas">В банк</a><br/></small>n";
echo 
"</p>n";
echo 
"</card>n";
echo 
"</wml>n";
exit; }
if (isset(
$faq)){include "games/casino/faq.php"; exit;}
echo 
"<?xml version="1.0" encoding="UTF-8"?>n";
echo 
"<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml12.dtd">n";
echo "<wml>n";
echo 
"<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>n";
echo 
"<card id="index" title="21">n";
echo 
"<p><small>n";
echo 
"У Вас $max$$<br/>n";
$ru rand(1,36);
if(
$session['histuser']!=="")$ru=trim(str_replace("|",""$session['histuser']));
echo 
"<b>Ваши карты:</b><br/><img src="games/casino/cards/$ru.gif" alt="cards"/><br/>n";
$uscore=cards_score($ru);
$pstr "очков";
if(
$uscore==2||$uscore==3||$uscore==4)$pstr "очка";
echo 
"$uscore $pstr<br/>n"$maxlen=strlen($max);
echo 
"Ваша ставка(1-$max):</small><br/>n";
echo 
"<input name="mn$ref" maxlength="$maxlen" title="pass" format="*N"/><br/>n";
echo 
"<small><anchor title="go">Играть<go href="casino.php?log=$log&amp;pas=$pas&amp;$ses" method="post">n";
echo 
"<postfield name="mn" value="$(mn$ref)"/>n";
echo 
"</go></anchor><br/>n";
echo 
"*******<br/>n";
echo 
"<a href="casino.php?faq&amp;log=$log&amp;pas=$pas">правила игры</a><br/>n";
echo 
"<a href="bank.php?log=$log&amp;pas=$pas">выход</a><br/></small>n";
echo 
"</p>n";
echo 
"</card>n";
echo 
"</wml>n";
$session['histuser']="|$ru";
$session['round']=1; }
else { if(
$session['con']==0){
if(
$mn>$session['money']||$mn===""||!isset($mn)||$mn<1){
echo 
"<?xml version="1.0" encoding="UTF-8"?>n";
echo 
"<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml12.dtd">n";
echo "<wml>n";
echo 
"<card id="error" title="error" ontimer="casino.php?log=$log&amp;pas=$pas&amp;$ses"><timer value="15"/>n";
echo 
"<p align="center">n";
if(
$mn===""||$mn<1)echo "Вы не указали ставку!n";
else echo 
"На Вашем счету недостаточно средств для подобной ставки!n";
echo 
"</p>n";
echo 
"</card>n";
echo 
"</wml>n";
$session['round']=0;
exit; }
$session['con']=round($mn);
$session['money']=$session['money']-$session['con'];
 } 
$rate=$session['con']*2$histuser=split("|",$session['histuser']);
 if(!isset(
$end)){ do{$randgen=1$ru rand(1,36);
 for(
$i=1;$i count($histuser);$i++){ if($ru==$histuser[$i]){ $randgen=0;
break; } } } while(
$randgen==0);
$session['histuser']=$session['histuser']."|$ru";
$countus count($histuser); $histuser[$countus] = $ru; }
for(
$i=1;$i count($histuser);$i++){ $ustemp=cards_score($histuser[$i]); @$uscore=@$uscore+$ustemp; }
$udoublet=0; if((count($histuser)==3)&&($uscore==22)){ $tone=0$ttwo=0;
if(
$histuser[1]==33||$histuser[1]==34||$histuser[1]==35||$histuser[1]==36)$tone=1;
if(
$histuser[2]==33||$histuser[2]==34||$histuser[2]==35||$histuser[2]==36)$ttwo=1;
if(
$tone==1&&$ttwo==1)$udoublet=1; } if($uscore>21&&$udoublet==0)$close=1;
if(
$udoublet==1||$uscore==21||$uscore==20)$end=1;
echo 
"<?xml version="1.0" encoding="UTF-8"?>n";
echo 
"<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml12.dtd">n";
echo "<wml>n";
echo 
"<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>n";
echo 
"<card id="index" title="21">n";
echo 
"<p><small>n"$max $session['money'];
echo 
"У Вас $max$$<br/>n";
if(isset(
$close))
echo 
"<b>перебор!</b><br/>n";
$win=0; if(isset($end)){ $histbot[0]=""$hist=$histuser;
for(
$i=1;$i 10;$i++){ do{$randgen=1$rb rand(1,36);
for(
$i=1;$i count($hist);$i++){ if($rb==$hist[$i]){ $randgen=0; break; } } }
while(
$randgen==0);  $histbot[]=$rb$hist[]=$rb$btemp=cards_score($rb);
@
$bcore=@$bcore+$btemp;
if(
$bcore==20)break;
if(
$bcore==21)break;
if(
$bcore==$uscore)break;
if(
$bcore>$uscore)break;
if(
$bcore>21)break; }
echo 
"<b>Банкир открылся:</b><br/>n";
for(
$i=1;$i count($histbot);$i++){
echo 
"<img src="games/casino/cards/$histbot[$i].gif" alt="cards"/>"; }
$pstr "очков"; if($bcore==2||$uscore==3||$bcore==4||$bcore==22||$bcore==23||$bcore==24)$pstr "очка";
if(
$bcore==21)$pstr "<b>очко!!!</b>";
echo 
"<br/>$bcore $pstr<br/>n"$bdoublet=0;
if((
count($histbot)==3)&&($bcore==22)){ $tone=0;
$ttwo=0; if($histbot[1]==33||$histbot[1]==34||$histbot[1]==35||$histbot[1]==36)$tone=1;
if(
$histbot[2]==33||$histbot[2]==34||$histbot[2]==35||$histbot[2]==36)$ttwo=1;
if(
$tone==1&&$ttwo==1)$bdoublet=1; }
if(
$bcore>21&&$bdoublet==0)$win=1;
if(
$bcore<$uscore)$win=1;
if(
$udoublet==1)$win=1;
if(
$bdoublet==1)$win=0;
if(
$uscore==21)$win=1;
if(
$bcore==21)$win=0$close=1; }
echo 
"<b>Ваши карты:</b><br/>n";
for(
$i=1;$i count($histuser);$i++){
echo 
"<img src="games/casino/cards/$histuser[$i].gif" alt="cards"/>"; }
$pstr "очков"; if($uscore==2||$uscore==3||$uscore==4||$uscore==22||$uscore==23||$uscore==24)$pstr "очка";
if(
$uscore==21)$pstr "<b>очко!!!</b>";
echo 
"<br/>$uscore $pstr<br/>n";
if(isset(
$close)){ $session['round']=0$session['histuser']="";
if(
$win==0){
echo 
"<b>Вы проиграли</b><br/>n";
$session['con']=0
$loser=$udata[8]-$rate/2;
$text=$udata[0].':||:'.$udata[1].':||:'.$udata[2].':||:'.$udata[3].':||:'.$udata[4].':||:'.$udata[5].':||:'.$udata[6].':||:'.$udata[7].':||:'.$loser.':||:'.$udata[9].':||:'.$udata[10].':||:'.$udata[11].':||:'.$udata[12].':||:'.$udata[13].':||:'.$udata[14].':||:'.$udata[15].':||:'.$udata[16].':||:'.$udata[17].':||:'.$udata[18].':||:'.$udata[19].':||:'.$udata[20].':||:'.$udata[21].':||:'.$udata[22].':||:'.$udata[23].':||:'.$udata[24].':||:'.$udata[25].':||:'.$udata[26].':||:'.$udata[27].':||:'.$udata[28].':||:'.$udata[29].':||:'.$udata[30].':||:'.$udata[31].':||:'.$udata[32].':||:'.$udata[33].':||:'.$udata[34].':||:'.$udata[35].':||:'.$udata[36].':||:'.$udata[37].':||:'.$udata[38].':||:'.$udata[39].':||:'.$udata[40].':||:'.$udata[41].':||:'.$udata[42].':||:'.$udata[43].':||:'.$udata[44].':||:'.$udata[45].':||:'.$udata[46].':||:'.$udata[47].':||:'.$udata[48].':||:'.$udata[49].':||:'.$udata[50].':||:'.$udata[51].':||:'.$udata[52].':||:'.$udata[53].':||:'.$udata[54].':||:'.$udata[55].':||:'.$udata[56].':||:'.$udata[57].':||:'.$udata[58].':||:'.$udata[59].':||:'.$udata[60].':||:'.$udata[61].':||:'.$udata[62].':||:'.$udata[63].':||:'.$udata[64].':||:'.$udata[65].':||:'.$udata[66].':||:'.$udata[67].':||:'.$udata[68].':||:'.$udata[69].':||:'.$udata[70].':||:'.$udata[71].':||:'.$udata[72].':||:'.$udata[73].':||:'.$udata[74].':||:'.$udata[75].':||:'.$udata[76].':||:'.$udata[77].':||:'.$udata[78].':||:'.$udata[79].':||:'.$udata[80].':||:'.$udata[81].':||:'.$udata[82].':||:'.$udata[83].':||:'.$udata[84].':||:'.$udata[85].':||:'.$udata[86].':||:'.$udata[87].':||:'.$udata[88].':||:'.$udata[89].':||:'.$udata[90].':||:'.$udata[91].':||:'.$udata[92].':||:'.$udata[93].':||:'.$udata[94].':||:'.$udata[95].':||:'.$udata[96].':||:'.$udata[97].':||:'.$udata[98].':||:'.$udata[99].':||:'.$udata[100].':||:';
$fp=fopen("data/reg/$log.dat","a+");    
flock($fp,LOCK_EX);           
ftruncate($fp,0);                                                                
fputs($fp,"$text");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);
}
else { echo 
"<b>Вы выиграли!</b><br/>n";
$session['money']=$udata[8]+$rate-$con;
$session['con']=0;
echo 
"Ваш выигрыш $rate$$<br/>n"
$win=$udata[8]+$rate;
$text=$udata[0].':||:'.$udata[1].':||:'.$udata[2].':||:'.$udata[3].':||:'.$udata[4].':||:'.$udata[5].':||:'.$udata[6].':||:'.$udata[7].':||:'.$win.':||:'.$udata[9].':||:'.$udata[10].':||:'.$udata[11].':||:'.$udata[12].':||:'.$udata[13].':||:'.$udata[14].':||:'.$udata[15].':||:'.$udata[16].':||:'.$udata[17].':||:'.$udata[18].':||:'.$udata[19].':||:'.$udata[20].':||:'.$udata[21].':||:'.$udata[22].':||:'.$udata[23].':||:'.$udata[24].':||:'.$udata[25].':||:'.$udata[26].':||:'.$udata[27].':||:'.$udata[28].':||:'.$udata[29].':||:'.$udata[30].':||:'.$udata[31].':||:'.$udata[32].':||:'.$udata[33].':||:'.$udata[34].':||:'.$udata[35].':||:'.$udata[36].':||:'.$udata[37].':||:'.$udata[38].':||:'.$udata[39].':||:'.$udata[40].':||:'.$udata[41].':||:'.$udata[42].':||:'.$udata[43].':||:'.$udata[44].':||:'.$udata[45].':||:'.$udata[46].':||:'.$udata[47].':||:'.$udata[48].':||:'.$udata[49].':||:'.$udata[50].':||:'.$udata[51].':||:'.$udata[52].':||:'.$udata[53].':||:'.$udata[54].':||:'.$udata[55].':||:'.$udata[56].':||:'.$udata[57].':||:'.$udata[58].':||:'.$udata[59].':||:'.$udata[60].':||:'.$udata[61].':||:'.$udata[62].':||:'.$udata[63].':||:'.$udata[64].':||:'.$udata[65].':||:'.$udata[66].':||:'.$udata[67].':||:'.$udata[68].':||:'.$udata[69].':||:'.$udata[70].':||:'.$udata[71].':||:'.$udata[72].':||:'.$udata[73].':||:'.$udata[74].':||:'.$udata[75].':||:'.$udata[76].':||:'.$udata[77].':||:'.$udata[78].':||:'.$udata[79].':||:'.$udata[80].':||:'.$udata[81].':||:'.$udata[82].':||:'.$udata[83].':||:'.$udata[84].':||:'.$udata[85].':||:'.$udata[86].':||:'.$udata[87].':||:'.$udata[88].':||:'.$udata[89].':||:'.$udata[90].':||:'.$udata[91].':||:'.$udata[92].':||:'.$udata[93].':||:'.$udata[94].':||:'.$udata[95].':||:'.$udata[96].':||:'.$udata[97].':||:'.$udata[98].':||:'.$udata[99].':||:'.$udata[100].':||:';
$fp=fopen("data/reg/$log.dat","a+");    
flock($fp,LOCK_EX);           
ftruncate($fp,0);                                                                
fputs($fp,"$text");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);
}
echo 
"<a href="casino.php?log=$log&amp;pas=$pas&amp;$ses">Сыграть ещё</a><br/>n"; }
else { echo 
"на кону $rate$$<br/><a href="casino.php?log=$log&amp;pas=$pas&amp;$ses">ещё</a>&lt;или&gt;<a href="casino.php?log=$log&amp;pas=$pas&amp;$ses&amp;end">Открыть</a><br/>n"; }
echo 
"*******<br/>n";
echo 
"<a href="bank.php?log=$log&amp;pas=$pas">выход</a><br/></small>n";
echo 
"</p>n";
echo 
"</card>n";
echo 
"</wml>n";  }

}else{echo
"Пароль или логин неверен!";}
?>
Онлайн: 0
Реклама