Joc de curse folosind session
Scris: Joi Oct 27, 2011
va rog.....am nevoie de ajutorul vostru:( din nou
scuzati:(
indexcurse.php
curse.php
reset.php
nu stiu de ce nu merge:(
http://www.testinfo.webuda.com/indexcurse.php
imi zice ca am ales calul 18:|
bani nu mi arata dupa fiecare castig sau pierderer:(?
va rog frumos sa ma ajutati daca se poate...multumesc mult
scuzati:(
indexcurse.php
Cod: Selectaţi tot
<?php
session_start();
echo '<center>';
echo '<h2>Home</h2>';
if(!isset($_SESSION['nume'])){ $_SESSION['nume']=" "; }
if(!isset($_SESSION['bani'])){ $_SESSION['bani']=10; }
echo '<form method=post action=" ">
Nume:<input type=text name=nume><br>
<input type=submit name=submit value=inscrie-te></form>';
if(isset($_POST['submit'])){
$_SESSION['nume']=$_POST['nume'];
echo 'Bun venit';
echo $_SESSION['nume'];
echo '<br>';
echo 'Banii tai sunt:';
echo $_SESSION['bani'];
echo '<br>';
echo '<a href="curse.php">Spre curse</a>';
}
?>
Cod: Selectaţi tot
<?php
session_start();
echo '<center>';
echo '<h2>Curse de cai</h2>';
echo '<form method=post action=" ">
Pariaza:<input type=text name=suma><br>
Alege calul:<input type="radio" name="cal" value="1" /> <img src="cal1.jpg" height=46 width=46><br />
<input type="radio" name="cal" value="2" /> <img src="cal2.jpg" height=46 width=46><br />
<input type="radio" name="cal" value="3" /> <img src="cal3.jpg" height=46 width=46><br />
<input type=submit name=da value=pariaza></form>';
if(isset($_POST['da'])) {
if(!isset($_SESSION['cal1'])){ $_SESSION['cal1']=rand(0,10); }
if(!isset($_SESSION['cal2'])){ $_SESSION['cal2']=rand(0,16);}
if(!isset($_SESSION['cal3'])){ $_SESSION['cal3']=rand(0,30);}
if(!isset($_SESSION['suma'])){ $_SESSION['suma']=$_POST['suma'];}
if(!isset($_SESSION['cal'])){ $_SESSION['cal']=$_POST['cal'];}
echo 'Tu ai ales calul:';
echo $_SESSION['cal'];
echo '<br>';
if($_SESSION['cal']==1) { $_SESSION['cal']=$_SESSION['cal1'];}
if($_SESSION['cal']==2) { $_SESSION['cal']=$_SESSION['cal2'];}
if($_SESSION['cal']==3) { $_SESSION['cal']=$_SESSION['cal3'];}
if($_SESSION['cal']>=$_SESSION['cal1'] && $_SESSION['cal']>=$_SESSION['cal2'] && $_SESSION['cal']>=$_SESSION['cal3']) { echo 'calul tau a castigat'; $_SESSION['bani']=$_SESSION['bani']+$_SESSION['suma'];}
else { echo 'calul tau a pierdut'; $_SESSION['bani']=$_SESSION['bani']-$_SESSION['suma'];}
echo 'Mai ai:';
echo $_SESSION['bani'];
echo "<marquee DIRECTION=RIGHT SCROLLAMOUNT="; echo $_SESSION['cal1']; echo"><img src='cal1.jpg' height=46 width=46></marquee>"; echo '<br>';
echo "<marquee DIRECTION=RIGHT SCROLLAMOUNT="; echo $_SESSION['cal2']; echo"><img src='cal2.jpg' height=46 width=46></marquee>"; echo '<br>';
echo "<marquee DIRECTION=RIGHT SCROLLAMOUNT="; echo $_SESSION['cal3']; echo"><img src='cal3.jpg' height=46 width=46></marquee>"; echo '<br>';
}
?>
Cod: Selectaţi tot
<?php
session_start();
unset($_SESSION);
?>
http://www.testinfo.webuda.com/indexcurse.php
imi zice ca am ales calul 18:|
bani nu mi arata dupa fiecare castig sau pierderer:(?
va rog frumos sa ma ajutati daca se poate...multumesc mult