ich benötige ein wenig Hilfe beim programmieren einer Slot Machine.
Derzeitiger Stand:
bm_slots.php

PHP Code:
<?php
require_once "header.php";
require_once "maincore.php";
$smarty->assign('username',$userdet['username']);
$smarty->assign('slots_bet',$userdet['slots_bet']);
$randomnumber = rand(1,9);
$smarty->assign('randomnumber',$randomnumber);
$randomnumber2 = rand(1,9);
$smarty->assign('randomnumber2',$randomnumber2);
$randomnumber3 = rand(1,9);
$smarty->assign('randomnumber3',$randomnumber3);
$invest = $userdet['slots_bet'];
$userid = $userdet['user_id'];
if ($_POST['betvalue'] > 0){
$db->query("update tbl_user set slots_bet='$invest' where user_id='$userid'");
}
$mal1 = 10;
$mal2 = 15;
$mal3 = 25;
$mal4 = 35;
$mal5 = 40;
$mal6 = 45;
$mal7 = 50;
$mal8 = 75;
$mal9 = 100;
if ($randomnumber == 1){
if ($randomnumber2 == 1){
if ($randomnumber3 == 1){
$lose = 1;
$wincalc = $invest*$mal1;
$win = $wincalc;
if ($_POST['play'] == $_POST['play']){
if ($userdet['credit'] < $userdet['slots_bet']){
$smarty->assign('cashcheck','Sorry, you got not enaught BTC to play.');
} else {
if ($lose == 1){
$smarty->assign('winorlosetest','Dude, you win!');
} else {
$smarty->assign('winorlosetest','Oh no, you lose!');
}
}
}
}
}
}
if ($randomnumber == 2){
if ($randomnumber2 == 2){
if ($randomnumber3 == 2){
$lose = 1;
$wincalc = $invest * $mal1;
$win = $wincalc;
if ($_POST['play'] == $_POST['play']){
if ($userdet['credit'] < $userdet['slots_bet']){
$smarty->assign('cashcheck','Sorry, you got not enaught BTC to play.');
} else {
if ($lose == 1){
$smarty->assign('winorlosetest','Dude, you win!');
} else {
$smarty->assign('winorlosetest','Oh no, you lose!');
}
}
}
}
}
}
if ($randomnumber == 3){
if ($randomnumber2 == 3){
if ($randomnumber3 == 3){
$lose = 1;
$wincalc = $invest * $mal2;
$win = $wincalc;
if ($_POST['play'] == $_POST['play']){
if ($userdet['credit'] < $userdet['slots_bet']){
$smarty->assign('cashcheck','Sorry, you got not enaught BTC to play.');
} else {
if ($lose == 1){
$smarty->assign('winorlosetest','Dude, you win!');
} else {
$smarty->assign('winorlosetest','Oh no, you lose!');
}
}
}
}
}
}
if ($randomnumber == 4){
if ($randomnumber2 == 4){
if ($randomnumber3 == 4){
$lose = 1;
$wincalc = $invest * $mal4;
$win = $wincalc;
if ($_POST['play'] == $_POST['play']){
if ($userdet['credit'] < $userdet['slots_bet']){
$smarty->assign('cashcheck','Sorry, you got not enaught BTC to play.');
} else {
if ($lose == 1){
$smarty->assign('winorlosetest','Dude, you win!');
} else {
$smarty->assign('winorlosetest','Oh no, you lose!');
}
}
}
}
}
}
if ($randomnumber == 5){
if ($randomnumber2 == 5){
if ($randomnumber3 == 5){
$lose = 1;
$wincalc = $invest * $mal5;
$win = $wincalc;
if ($_POST['play'] == $_POST['play']){
if ($userdet['credit'] < $userdet['slots_bet']){
$smarty->assign('cashcheck','Sorry, you got not enaught BTC to play.');
} else {
if ($lose == 1){
$smarty->assign('winorlosetest','Dude, you win!');
} else {
$smarty->assign('winorlosetest','Oh no, you lose!');
}
}
}
}
}
}
if ($randomnumber == 6){
if ($randomnumber2 == 6){
if ($randomnumber3 == 6){
$lose = 1;
$wincalc = $invest * $mal6;
$win = $wincalc;
if ($_POST['play'] == $_POST['play']){
if ($userdet['credit'] < $userdet['slots_bet']){
$smarty->assign('cashcheck','Sorry, you got not enaught BTC to play.');
} else {
if ($lose == 1){
$smarty->assign('winorlosetest','Dude, you win!');
} else {
$smarty->assign('winorlosetest','Oh no, you lose!');
}
}
}
}
}
}
if ($randomnumber == 7){
if ($randomnumber2 == 7){
if ($randomnumber3 == 7){
$lose = 1;
$wincalc = $invest * $mal7;
$win = $wincalc;
if ($_POST['play'] == $_POST['play']){
if ($userdet['credit'] < $userdet['slots_bet']){
$smarty->assign('cashcheck','Sorry, you got not enaught BTC to play.');
} else {
if ($lose == 1){
$smarty->assign('winorlosetest','Dude, you win!');
} else {
$smarty->assign('winorlosetest','Oh no, you lose!');
}
}
}
}
}
}
if ($randomnumber == 8){
if ($randomnumber2 == 8){
if ($randomnumber3 == 8){
$lose = 1;
$wincalc = $invest * $mal8;
$win = $wincalc;
if ($_POST['play'] == $_POST['play']){
if ($userdet['credit'] < $userdet['slots_bet']){
$smarty->assign('cashcheck','Sorry, you got not enaught BTC to play.');
} else {
if ($lose == 1){
$smarty->assign('winorlosetest','Dude, you win!');
} else {
$smarty->assign('winorlosetest','Oh no, you lose!');
}
}
}
}
}
}
if ($randomnumber == 9){
if ($randomnumber2 == 9){
if ($randomnumber3 == 9){
$lose = 1;
$win = $invest*$mal9;
if ($_POST['play'] == $_POST['play']){
if ($userdet['credit'] < $userdet['slots_bet']){
$smarty->assign('cashcheck','Sorry, you got not enaught BTC to play.');
} else {
if ($lose == 1){
$smarty->assign('winorlosetest','Dude, you win!');
} else {
$smarty->assign('winorlosetest','Oh no, you lose!');
}
}
}
}
}
}
if ($lose == 1){
$smarty->assign('winorlose','You win $win BTC!');
}
else {
$smarty->assign('winorlose','You lose, try again!');
}
require_once "includes/solvemedialib.php";
require_once "includes/dbconnector.class.php";
$db=new DbConnector;
if(isset($_POST['claim'])){
$solvemedia_response = solvemedia_check_answer($verkey,$_SERVER["REMOTE_ADDR"],$_POST['adcopy_challenge'],$_POST['adcopy_response'],$hashkey);
if($solvemedia_response->is_valid ){
$db2->query("select * from tbl_prize order by chance desc ");
while($res2=$db2->fetchArray()){
$prize.=$res2['prize'].'*'.$res2['chance'].',';
}
if(!isset($_SESSION['prize']))
$_SESSION['prize']=chance_creator($prize);
$db->queryres("select * from tbl_config where header='timer'");
$timer=NOW+($db->res['value']*60);
$db->query("update tbl_user set credit=credit+'".$_SESSION['prize']."',reset='$timer',ip='$ip' where user_id='$uid'");
$rid=$userdet['parent_id'];
if($rid){
$db->queryres("select * from tbl_config where header='referral_percent'");
$profit=($_SESSION['prize']*$db->res['value'])/100;
$db->query("update tbl_user set credit=credit+'$profit' where user_id='$rid'");
}
$_SESSION['user']['win']=$_SESSION['prize'];
unset($_SESSION['prize']);
header('Location:index.php');
}else{
unset($_SESSION['succ']);
unset($_SESSION['error']);
$_SESSION['error']['capt']=true;
header('Location:index.php?er=captcha');
}
}else{
if(isset($uid)){
if(isset($_SESSION['user']['win'])){
$db->queryres("select * from tbl_config where header='currency'");
$smarty->assign('prize',$_SESSION['user']['win']);
$smarty->assign('curency',$db->res['value']);
}
if(isset($_SESSION['error']['capt'])){
$smarty->assign('capt',true);
unset($_SESSION['error']);
}
$db->queryres("select reset from tbl_user where user_id='$uid' or ip='$ip' order by reset desc");
if($db->res['reset']-time() > 0){
$smarty->assign('timer',true);
$smarty->assign('timer_amount',$db->res['reset']-time());
}
$with=array();
$db->query("select * from tbl_donate where status=2 order by rand() limit 20");
while($res=$db->fetchArray()){
$ar=array('link'=>$res['link']);
array_push($with,$ar);
}
$smarty->assign('with',$with);
$smarty->assign('captcha',solvemedia_get_html($privkey));
}else{
$smarty->assign('notlogged',true);
}
$smarty->display('template/bm_slots.tpl');
}
?>
PHP Code:
{include file='template/header.tpl'}
<div id="blue">
<div class="container">
<div class="row"><h3>Bitcoin Millionaire Slots</h3></div><!-- /row -->
</div> <!-- /container -->
</div>
<div class="navbar navbar-default">
<div class="row">
<div class="col-md-2 text-center" style="width:135px;">
</div>
<Div class="col-md-9">
<Div class="row text-center">
</Div>
{if !$notlogged}
<center>
This is only to demonstrate the game. The full version of this will be online soon!<br>Information: If you visit this game in a new Session, it will automatically show you, that you lost; but no Credits are gone.<br>_________________________________________________________________________<br><br>
<table >
<tr>
<td width="40%">
<center>
<div class="alert alert-info"><h3>You roll:</h3><br><img src='img/slots_{$randomnumber}.png' ><img src='img/slots_{$randomnumber2}.png' ><img src='img/slots_{$randomnumber3}.png' ><br></div>
</center>
</td>
<td width="20%">
</td>
<td width="40%">
<center>
<div class="alert alert-info"><b>{$winorlose}</b></div>
<b>Bet:</b> {$slots_bet}<br><br>
<form action="bm_slots.php" method="post">
<input name="betvalue" type="text" class="btn btn-success" size="10" placeholder="0.00000000">
<button type="submit" name="bet" class="btn btn-success">Set new bet</button>
</form><br><br>
<form>
<button type="submit" value="play" name="play" class="btn btn-success">Roll!</button>
</form>
<br><br><br>{$cashcheck}<br>{$winorlosetest}
</center>
</td>
</tr>
</table>
<table >
<tr>
<td>
<center>
<b>Wintable:</b><br>
<img src="img/slots_1.png" width="25px" height="25px"><img src="img/slots_1.png" width="25px" height="25px"><img src="img/slots_1.png" width="25px" height="25px"> = x10 <img src="img/slots_5.png" width="25px" height="25px"><img src="img/slots_5.png" width="25px" height="25px"><img src="img/slots_5.png" width="25px" height="25px"> = x40<br>
<img src="img/slots_2.png" width="25px" height="25px"><img src="img/slots_2.png" width="25px" height="25px"><img src="img/slots_2.png" width="25px" height="25px"> = x15 <img src="img/slots_6.png" width="25px" height="25px"><img src="img/slots_6.png" width="25px" height="25px"><img src="img/slots_6.png" width="25px" height="25px"> = x45<br>
<img src="img/slots_3.png" width="25px" height="25px"><img src="img/slots_3.png" width="25px" height="25px"><img src="img/slots_3.png" width="25px" height="25px"> = x25 <img src="img/slots_7.png" width="25px" height="25px"><img src="img/slots_7.png" width="25px" height="25px"><img src="img/slots_7.png" width="25px" height="25px"> = x50<br>
<img src="img/slots_4.png" width="25px" height="25px"><img src="img/slots_4.png" width="25px" height="25px"><img src="img/slots_4.png" width="25px" height="25px"> = x35 <img src="img/slots_8.png" width="25px" height="25px"><img src="img/slots_8.png" width="25px" height="25px"><img src="img/slots_8.png" width="25px" height="25px"> = x75<br>
<img src="img/slots_9.png" width="35px" height="35px"><img src="img/slots_9.png" width="35px" height="35px"><img src="img/slots_9.png" width="35px" height="35px"><b> = x100</b><br>
</center>
</td>
</tr>
</table>
</center>
{else}<br><div class="alert alert-info">You are not logged in, Earn free Bitcoin by <a href="register.php">opening account</a></div>{/if}
</Div>
<div class="col-md-2 text-center" style="width:135px;"> </div>
</div>
<div class="clearfix"></div></div>
{include file='template/footer.tpl'}
Oder in einem kleineren Format?
Ich lerne das programmieren erst seit kurzer Zeit und auch nur aus Spaß weil mich das ganze interessiert.
Über jede Hilfe würde ich mich freuen.
Gruß,
TramaLP






