Gå til innhold

radiobutton / ikke radiobutton


Anbefalte innlegg

Trenger litt hjelp her.

 

Skal sripte et spill nå, men vil ikke at det skal være slik at man må trykke på en "radiobutton" og så på "ok/utfør".

 

Vil at det bare skal være slik at man trykker 1 gang som på en link.

 

Håper noen er snille og kan forklare litt om hvordan man får det til.

 

Mvh. StylishXx

Lenke til kommentar
Videoannonse
Annonse

Takk for rådet.

Har googlet litt, men finner ingen ting som hjelper meg.

Kan du kanskje hjelpe meg litt a?

 

Her er sriptet. (vet det ligger på nettet, men skal teste med det.)

<?php
session_start();
include_once "includes/db_connect.php";
include_once "includes/functions.php";
include_once "includes/jail_check.php";
include_once"probe.php";
logincheck();
$page="crime.php";
script_check($page);



$username=$_SESSION['username'];
$radiobutton=$_POST['radiobutton'];
$above = mysql_query("SELECT * FROM users WHERE username='$username'");
$info = mysql_fetch_object($above);
$chance = explode("-", $info->crimechance);


if ($info->lastcrime > time()){
$left = $info->lastcrime - time();
echo "You have done a crime recently, you have to wait for $left seconds before you can do another!";
exit();
}



if ($_POST['submit']){

$suc = $chance[$radiobutton];
$ran = rand(1,60);


       if ($ran <= $suc){


if ($radiobutton == "0"){
 $win = rand(1,5);
 $success = $chance[0];
 $quote="The bum got up and ran off spilling hes spare cash on the floor";
}elseif ($radiobutton == "1"){
 $win = rand(20,40);
 $success = $chance[1];
 $quote="You waited untill your mate was looking away, then you stole hes wallet!";

}elseif ($radiobutton == "2"){
 $win = rand(500,1000);
 $success = $chance[2];
 $quote="You get there in time, stealing a suitcase holding cash";
}elseif ($radiobutton == "3"){
 $win = rand(100,600);
 $success = $chance[3];
 $quote="The supermarket owner Does whatever you say.";
}elseif ($radiobutton == "4"){
 $win = rand(2000,4000);
 $success = $chance[4];
 $quote="You demand the cash and run";
}elseif ($radiobutton == "5"){
 $win = rand(300,500);
 $success = $chance[5];
 $quote="The bank owner starts Shaking, You blow his Kneecaps Off and walk out.";
}elseif ($radiobutton == "6"){
 $win = rand(1000,1100);
 $success = $chance[6];
 $quote="You hacked into PC World and orderd software selling them for.";
}elseif ($radiobutton == "7"){
 $win = rand(6000,8000);
 $success = $chance[7];
 $quote="You walked into the rich mans house crack open he's safe, You got away with.";
}elseif ($radiobutton == "8"){
 $win = rand(20000,30000);
 $success = $chance[9];
 $quote="You broke into parliament and stole a ton of gold bars, You managed to sell them on for.";
}

$item_rand = rand(1,100);

$new_item = array('Weed seeds','Bandanna','Black boots','Bling','Chain','Yellow Pages','Tracking Device','Cheese Burger','Fries','Chicken Nuggets','Crisps','Curry','Fish');
$rand_item = rand(0,12);
$item_get=$new_item[$rand_item];
if ($item_rand >= "90"){

if ($item_get == "Weed seeds"){
$value="4000";
}elseif ($item_get == "Bandanna"){
$value="500";
}elseif ($item_get == "Black boots"){
$value="300";
}elseif ($item_get == "Bling"){
$value="3000";
}elseif ($item_get == "Chain"){
$value="3000";
}elseif ($item_get == "Yellow Pages"){
$value="10000";
}elseif ($item_get == "Tracking Device"){
$value="20000";
}elseif ($item_get == "Cheese Burger"){
$value="200";
}elseif ($item_get == "Fries"){
$value="110";
}elseif ($item_get == "Chicken Nuggets"){
$value="180";
}elseif ($item_get == "Crisps"){
$value="100";
}elseif ($item_get == "Curry"){
$value="500";
}elseif ($item_get == "Fish"){
$value="250";
}




echo "Congratulations you got away with $item_get";
mysql_query("INSERT INTO `items` ( `id` , `item` , `value`,`owner` ) 
VALUES (
'', '$item_get', '$value','$username'
)");

}else{
echo "$quote well done! you got away with £$win!!";
rankcheck();
$time= time() + 120;
$newrank=rand(1,10);

$n_money=$info->money+$win;

$new_rank=$info->rankpoints + rand(2,10);
mysql_query("UPDATE users SET money='$n_money', rankpoints='$new_rank' WHERE username='$username'");
mysql_query("UPDATE user_info SET crimes=crimes+1 WHERE username='$username'");
}



 }else{
 if ($radiobutton == "0"){
 $quote="The bum wakes up and runs!";
}elseif ($radiobutton == "1"){
$quote="Your mates dad see's you, he throws you out of the house";
}elseif ($radiobutton == "2"){

 $quote="The plane just takes off just as you get there";
}elseif ($radiobutton == "3"){

 $quote="You get there and the store is shut";
}elseif ($radiobutton == "4"){

 $quote="The security gueards pounce on you";
}elseif ($radiobutton == "5"){

 $quote="The shop keeper laughs in your face";
}elseif ($radiobutton == "6"){

 $quote="You got past the main firewall, but the battery on your laptop died.";
}elseif ($radiobutton == "7"){

 $quote="The rich mans alarm went off,";
}elseif ($radiobutton == "8"){

 $quote="You couldnt break in, You forgot to get ammo for your gun!.";
}
rankcheck();



echo "$quote Bad luck, you got away with nothing!";
$new_rank = $info->rankpoints + rand(0,3);
mysql_query("UPDATE users SET rankpoints='$new_rank' WHERE username='$username'");
mysql_query("UPDATE user_info SET crimes=crimes+1 WHERE username='$username'"); 
$reason = "Crime";
require_once"includes/failed.php";
}

if($chance[0] == 1){$chance[1] = 1;}
       elseif(($chance[0] >= 1) && ($chance[0] <= 2)){$chance[0] = rand(1,$chance[0]);}
       elseif(($chance[0] >= 2) && ($chance[0] <= 10)){$chance[0] = rand(10,$chance[0]);}
       elseif(($chance[0] >= 5) && ($chance[0] <= 25)){$chance[0] = rand(25,$chance[0]);}
       elseif(($chance[0] >= 18) && ($chance[0] <= 36)){$chance[0] = rand(36,$chance[0]);}
       elseif(($chance[0] >= 25) && ($chance[0] <= 49)){$chance[0] = rand(49,$chance[0]);}
               elseif(($chance[0] >= 36) && ($chance[0] <= 58)){$chance[0] = rand(58,$chance[0]);}
               elseif(($chance[0] >= 49) && ($chance[0] <= 55)){$chance[0] = rand(55,$chance[0]);}
       elseif($chance[0] >= 55){$chance[0] = rand(55,$chance[0]);}


       if($chance[0] == 1){$chance[1] = 0;}
       elseif(($chance[0] >= 1) && ($chance[0] <= 2)){$chance[1] = rand(0,$chance[0]);}
       elseif(($chance[0] >= 3) && ($chance[0] <= 8)){$chance[1] = rand(7,$chance[0]);}
       elseif(($chance[0] >= 9) && ($chance[0] <= 15)){$chance[1] = rand(14,$chance[0]);}
       elseif(($chance[0] >= 16) && ($chance[0] <= 34)){$chance[1] = rand(33,$chance[0]);}
       elseif(($chance[0] >= 35) && ($chance[0] <= 74)){$chance[1] = rand(45,$chance[0]);}
       elseif($chance[0] >= 75){$chance[1] = rand(50,$chance[0]);}

       if($chance[0] == 1){$chance[2] = 0;}
       elseif(($chance[0] >= 1) && ($chance[0] <= 2)){$chance[2] = rand(0,$chance[0]);}
       elseif(($chance[0] >= 3) && ($chance[0] <= 8)){$chance[2] = rand(6,$chance[0]);}
       elseif(($chance[0] >= 9) && ($chance[0] <= 15)){$chance[2] = rand(13,$chance[0]);}
       elseif(($chance[0] >= 16) && ($chance[0] <= 34)){$chance[2] = rand(32,$chance[0]);}
       elseif(($chance[0] >= 35) && ($chance[0] <= 74)){$chance[2] = rand(60,$chance[0]);}
       elseif($chance[0] >= 75){$chance[2] = rand(85,$chance[0]);}

       if($chance[0] == 1){$chance[3] = 0;}
       elseif(($chance[0] >= 1) && ($chance[0] <= 2)){$chance[3] = rand(0,$chance[0]);}
       elseif(($chance[0] >= 3) && ($chance[0] <= 9)){$chance[3] = rand(7,$chance[0]);}
       elseif(($chance[0] >= 10) && ($chance[0] <= 17)){$chance[3] = rand(14,$chance[0]);}
       elseif(($chance[0] >= 18) && ($chance[0] <= 37)){$chance[3] = rand(35,$chance[0]);}
       elseif(($chance[0] >= 38) && ($chance[0] <= 76)){$chance[3] = rand(60,$chance[0]);}
       elseif($chance[0] >= 77){$chance[3] = rand(70,$chance[0]);}
//echo
       if($chance[0] == 1){$chance[4] = 0;}
       elseif(($chance[0] >= 1) && ($chance[0] <= 3)){$chance[4] = rand(0,$chance[0]);}
       elseif(($chance[0] >= 4) && ($chance[0] <= 11)){$chance[4] = rand(9,$chance[0]);}
       elseif(($chance[0] >= 12) && ($chance[0] <= 19)){$chance[4] = rand(16,$chance[0])-14;}
       elseif(($chance[0] >= 20) && ($chance[0] <= 39)){$chance[4] = rand(28,$chance[0])-14;}
       elseif(($chance[0] >= 40) && ($chance[0] <= 79)){$chance[4] = rand(69,$chance[0])-14;}
       elseif($chance[0] >= 80){$chance[4] = rand(75,$chance[0])-14;}


//echo
       if($chance[0] == 1){$chance[5] = 0;}
       elseif(($chance[0] >= 1) && ($chance[0] <= 3)){$chance[5] = rand(0,$chance[0]);}
       elseif(($chance[0] >= 4) && ($chance[0] <= 11)){$chance[5] = rand(9,$chance[0]);}
       elseif(($chance[0] >= 12) && ($chance[0] <= 19)){$chance[5] = rand(16,$chance[0])-14;}
       elseif(($chance[0] >= 20) && ($chance[0] <= 39)){$chance[5] = rand(28,$chance[0])-14;}
       elseif(($chance[0] >= 40) && ($chance[0] <= 79)){$chance[5] = rand(69,$chance[0])-14;}
       elseif($chance[0] >= 80){$chance[5] = rand(75,$chance[0])-14;}

//echo
       if($chance[0] == 1){$chance[6] = 0;}
       elseif(($chance[0] >= 1) && ($chance[0] <= 3)){$chance[6] = rand(0,$chance[0]);}
       elseif(($chance[0] >= 4) && ($chance[0] <= 11)){$chance[6] = rand(9,$chance[0]);}
       elseif(($chance[0] >= 12) && ($chance[0] <= 19)){$chance[6] = rand(16,$chance[0])-14;}
       elseif(($chance[0] >= 20) && ($chance[0] <= 39)){$chance[6] = rand(28,$chance[0])-14;}
       elseif(($chance[0] >= 40) && ($chance[0] <= 79)){$chance[6] = rand(69,$chance[0])-14;}
       elseif($chance[0] >= 80){$chance[6] = rand(75,$chance[0])-14;}

//echo
       if($chance[0] == 1){$chance[7] = 0;}
       elseif(($chance[0] >= 1) && ($chance[0] <= 3)){$chance[7] = rand(0,$chance[0]);}
       elseif(($chance[0] >= 4) && ($chance[0] <= 11)){$chance[7] = rand(9,$chance[0]);}
       elseif(($chance[0] >= 12) && ($chance[0] <= 19)){$chance[7] = rand(16,$chance[0])-14;}
       elseif(($chance[0] >= 20) && ($chance[0] <= 39)){$chance[7] = rand(28,$chance[0])-14;}
       elseif(($chance[0] >= 40) && ($chance[0] <= 79)){$chance[7] = rand(69,$chance[0])-14;}
       elseif($chance[0] >= 80){$chance[7] = rand(75,$chance[0])-14;}

//echo
       if($chance[0] == 1){$chance[8] = 0;}
       elseif(($chance[0] >= 1) && ($chance[0] <= 3)){$chance[8] = rand(0,$chance[0]);}
       elseif(($chance[0] >= 4) && ($chance[0] <= 11)){$chance[8] = rand(9,$chance[0]);}
       elseif(($chance[0] >= 12) && ($chance[0] <= 19)){$chance[8] = rand(16,$chance[0])-14;}
       elseif(($chance[0] >= 20) && ($chance[0] <= 39)){$chance[8] = rand(28,$chance[0])-14;}
       elseif(($chance[0] >= 40) && ($chance[0] <= 79)){$chance[8] = rand(69,$chance[0])-14;}
       elseif($chance[0] >= 80){$chance[8] = rand(75,$chance[0])-14;}


if($chance[0] > 100){
               $chance[0] = 100;
       }       
       if($chance[1] > 100){
               $chance[1] = 100;
       }       
       if($chance[2] > 100){
               $chance[2] = 100;
       }       
       if($chance[3] > 100){
               $chance[3] = 100;
       }
       if($chance[4] > 100){
               $chance[4] = 100;
       }       
       if($chance[5] > 100){
               $chance[5] = 100;
       }
                               if($chance[6] > 100){
               $chance[6] = 100;
       }
                               if($chance[7] > 100){
               $chance[7] = 100;
       }
                               if($chance[8] > 100){
               $chance[8] = 100;
       }       



       $chance[0]++;
       if ($chance[0] > 110){
               $chance[0] = 110;
       }

$arrayrates = array($chance[0], $chance[1], $chance[2], $chance[3], $chance[4], $chance[5], $chance[6], $chance[7], $chance[8]);
       $newrates = implode("-", $arrayrates);
       $tim = time() + rand(60,200);
       mysql_query("UPDATE users SET crimechance='$newrates',lastcrime='$tim' WHERE username='$username'");
               exit;



}

?>






<html><head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel=stylesheet href=includes/in.css type=text/css>
</head>


<center> <body> 
<form name="form1" method="post" action="">
 <p> </p>
 <table width="35%" height="127" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor=black class=main>
       <!--DWLayoutTable-->
       <tr> 
         <td colspan="3" class=tableheading><center>
                 <strong>Crimes</strong> </center></td>
       </tr>
       <tr> 
         <td class=tablearea height="8" colspan="2" valign="top" > <div align="center"><img src="/images/crime.jpg" border="0" />
         </div></td>
       </tr>
       <tr> 
         <td class=tablearea width="67%" height="9" valign="top"  > <input type="radio" name="radiobutton" value="0" onclick="this.document.img.src='images/crimes/phone_boy.jpg'">
               Mug a bum </td>
         <td class=tablearea width="33%" valign="top" ><?php echo "$chance[0]"; ?> %</td>
       </tr>
       <tr> 
         <td class=tablearea height="17" valign="top" ><input type="radio" name="radiobutton" value="1" onclick="this.document.img.src='images/crimes/coffee.jpg'">
               Steal from your mate</td>
         <td class=tablearea width="33%" valign="top"><?php echo "$chance[1]"; ?>%</td>
       </tr>
       <tr> 
         <td class=tablearea height="4" valign="top"  > <input type="radio" name="radiobutton" value="2" onclick="this.document.img.src='images/crimes/old_lady.jpg'">
               Rob an airport </td>
         <td class=tablearea width="33%" valign="top" ><?php echo "$chance[2]"; ?>%</td>
       </tr>
       <tr> 
         <td class=tablearea height="4" valign="top"  > <input type="radio" name="radiobutton" value="3" onclick="this.document.img.src='images/crimes/tesco.jpg'">
               Hold up a supermarket</td>
         <td class=tablearea width="33%" valign="top" ><?php echo "$chance[3]"; ?>%</td>
       </tr>
       <tr> 
         <td class=tablearea height="4" valign="top"  ><input type="radio" name="radiobutton" value="4" onclick="this.document.img.src='images/crimes/ass.jpg'">
               Rob a bank</td>
         <td class=tablearea width="33%" valign="top" ><?php echo "$chance[4]"; ?>%</td>
       </tr>
       <tr > 
         <td class=tablearea height="4" valign="top"  > <input type="radio" name="radiobutton" value="5" onclick="this.document.img.src='images/crimes/bank_vault.jpg'">
               Rob a shop</td>
         <td class=tablearea width="33%" valign="top" ><?php echo "$chance[5]"; ?>%</td>
       </tr>
<tr> 
         <td class=tablearea height="4" valign="top"  ><input type="radio" name="radiobutton" value="6" onclick="this.document.img.src='images/crimes/NEEDIMAGE.jpg'">
               Hack into PC World</td>
         <td class=tablearea width="33%" valign="top" ><?php echo "$chance[6]"; ?>%</td>
       </tr>
       <tr> 
         <td class=tablearea height="29" valign="top" ><!--DWLayoutEmptyCell--> </td>
         <td class=tablearea width="33%" valign="top"> <input name="submit" class=button type="submit" id="submit" value="Commit"> 
         </td>
       </tr>
 </table>
 <p> </p>
 <p> </p>
</form>
</html>
<?php require_once "footer.php"; ?>

Endret av StylishXx
Lenke til kommentar

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
×
×
  • Opprett ny...