Advertisement
GWibisono

original script score bola

Jun 13th, 2012
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.92 KB | None | 0 0
  1. <?php
  2. /*
  3. DIBUTUHKAN PANDUAN dan juga css yg rapi
  4. */
  5. $aIcon=array("pilih", "Kartu Kuning","Kartu Merah",
  6. 10=>"Goal", 11=>"Pinalti");
  7.  
  8. if(!$_POST)
  9. {
  10. ?>
  11.     <form enctype='multipart/form-data' method='post'>
  12.     <div style='width:500px'>
  13.     <fieldset>Tanggal :<input type=text name='tgl' />
  14.     </fieldset>
  15.     <fieldset>Stadion :<input type=text name='stadion' />
  16.     </fieldset>
  17.     <fieldset>Grup :<br>A<input type=text name='grupA' /> vs
  18.      <input type=text name='grupB' />B *
  19.     </fieldset>
  20.     <fieldset>Pelatih :<br>A<input type=text name='coachA' />  
  21.      <input type=text name='coachB' />B
  22.     </fieldset>
  23.     <fieldset>Lineup :<p align=center>A vs B<br>
  24.     <textarea rows="6" cols="20" name=lineUpA></textarea>
  25.      <textarea rows="6" cols="20" name=lineUpB></textarea></p>
  26.     </fieldset>
  27.     </div>
  28.     <input type=submit> <input type=hidden name=stat value=1 />
  29.     </form>
  30. <?php
  31. }
  32.  
  33. if($_POST['stat']=='1')
  34. {
  35. ?><div style='width:500px'>
  36.     <form enctype='multipart/form-data' method='post'>
  37. <?php
  38. foreach($_POST as $nm=>$val) {
  39. $s.="<input type='hidden'
  40. name='$nm' value='$val' />";
  41. }
  42. echo $s;$s='Antara<center>'.$_POST[grupA].'<br>VS<br>'.$_POST[grupB].
  43. '</center><table >';
  44. $time="";
  45.  
  46.  
  47.     $time.="<option>waktu";
  48.     for($i=0;$i<90;$i++)
  49.         $time.="\n<option>$i";
  50.     foreach($aIcon as $id=>$val)
  51.     {
  52.         $icon.="\n<option value=$id>$val";
  53.     }  
  54.        
  55.     $s.="<tr><th>&nbsp;</th><th>Menit</th>
  56.     <th>Pemain</th><th>team</th><th>Icon</th><th>Ket</th></tr>";   
  57.     for($i=0;$i<20;$i++)
  58.     {
  59.         $s.="\n<tr><td>".++$j."</td>";
  60.         //MENIT
  61.         $s.="<td><select name=rep[$i][0]>$time";   
  62.         $s.="</select></td>";
  63.         //Pemain
  64.         $s.="<td><input type=text name=rep[$i][1] /></td>";
  65.         //yang main
  66.         $s.="<td><select name=rep[$i][2]><option>A<option>B</select></td>";
  67.         //icon
  68.         $s.="<td><select name=rep[$i][3]>$icon</select></td>";
  69.         //keterangan
  70.         $s.="<td><input type=text name=rep[$i][4] /></td>";
  71.         $s.="</tr>";
  72.     }
  73.     $s.="</table>";
  74.     echo $s;$s='';
  75. ?>
  76.     <input type=submit value='buat blog'> <input type=hidden name=stat value=2 />
  77.     </form></div>
  78. <?php
  79. }
  80.  
  81. if($_POST['stat']=='2')
  82. {
  83.     $aBg=array('silver','lightblue','BlanchedAlmond','Cornsilk');
  84.      
  85.  
  86.     foreach($_POST as $nm=>$val) {
  87.         if($nm!='rep'){
  88.             $s.="\n<input type='hidden' name='$nm' value='".trim($val)."' />";
  89.         }
  90.         $$nm=$val;
  91.     }
  92.      
  93.     foreach($_POST[rep] as $id=>$ar)
  94.     {
  95.         foreach($ar as $id2=>$val) {         
  96.             $s.="\n<input type='hidden'  name='$nm [$id] [$id2] ' value='$val' />";
  97.             $val2=$ar[2];
  98.             if($id2==3 && ($val==10||$val==11))
  99.                 $aGoal[$val2]++;
  100.         }
  101.         if($ar[0]!='waktu'){
  102.            
  103.             $id3=$id+($ar[0]*100);
  104.             $ar[]=$id3;
  105.             /*
  106.             if($ar[0]<=45){
  107.                 $id4=0;
  108.             }elseif($ar[0]>45&&$ar[0]<=90){
  109.                 $id4=1;
  110.             }elseif($ar[0]>90&&$ar[0]<=105 ){
  111.                 $id4=2;
  112.              
  113.             }elseif($ar[0]>105&&$ar[0]<=120){
  114.                 $id4=3;
  115.             }
  116.             [$id4]
  117.             */
  118.             $ar2=array(
  119.             $ar[0]."'",
  120.            
  121.             );
  122.            
  123.             $aRep[$id3]=$ar;
  124.            
  125.         }
  126.        
  127.        
  128.     }
  129.    
  130.     $s='<table cellpadding=4 cellspacing=0 width=500>';
  131.    
  132.     $a=array();
  133.     $a[]="FULLTIME";   
  134.     $a[]=$_POST[tgl];
  135.     $a[]="<div style=text-align:right>$stadion</div>";
  136.  
  137.     $a[]="<div style=text-align:center>$grupA $aGoal[A] - $aGoal[B] $grupB</div>";
  138.    
  139.     $i=0;
  140.     foreach($a as $v)
  141.     {
  142.         $bg=$aBg[$i%count($aBg)];
  143.         $s.="\n<tr bgcolor='$bg'><td>$v</td></tr>";
  144.         $i++;
  145.     }
  146.    
  147.     $s.="</table><table cellpadding=4 cellspacing=0 width=500>";
  148.    
  149.     if($lineUpA && $lineUpB)
  150.     {
  151.         $a=array();
  152.         $a[]=array(1,"Lineup");
  153.         $a[]=array(2,"$lineUpA [br/]$lineUpB");
  154.         $a[]=array(2,"$coachA [br/]$coachB");
  155.         $i=0;
  156.         foreach($a as $a2){
  157.             $bg=$aBg[$i%count($aBg)];
  158.            
  159.             if($a2[0]==1)
  160.             {
  161.                 $td="<td colspan=3>$a2[1] </td>";
  162.             }
  163.             if($a2[0]==2)
  164.             {
  165.                 $a3=explode("[br/]",$a2[1]);
  166.                 $td="<td>".nl2br(trim($a3[0])).
  167.                     " </td><td>&nbsp;</td><td>".
  168.                     nl2br(trim($a3[1]))."</td>";
  169.             }
  170.            
  171.             $s.="\n<tr bgcolor='$bg'> $td</tr>";
  172.             $i++;
  173.            
  174.         }
  175.         //====HALF TIME====
  176.        
  177.         $s.="</table>";
  178.         /*
  179.         for($i=0;$i<4;$i++)
  180.         {
  181.             $aRep1=$aRep[$i];
  182.             if(count($aRep1)>=1)
  183.             {
  184.         */
  185.                 ksort($aRep ); $aGoalNow=array(A=>0,B=>0);
  186.                 foreach($aRep as $ar)
  187.                 {
  188.                     $a=array();
  189.                     if($ar[3]==10||$ar[3]==11 )
  190.                     {
  191.                         $aGoalNow[$ar[2]]++;
  192.                     }
  193.                
  194.                     $a=array($ar[0]."'");
  195.                     if($ar[2]=='A'){
  196.                         $a[]=$ar[1]." (".$aIcon[$ar[3]].")";
  197.                     }else{
  198.                         $a[]='';
  199.                     }
  200.                      
  201.                     $a[]="( ".$aGoalNow['A']." - ".$aGoalNow['B']." )";
  202.                     if($ar[2]=='B'){
  203.                         $a[]=$ar[1]." (".$aIcon[$ar[3]].")";
  204.                     }else{
  205.                         $a[]='';
  206.                     }
  207.                    
  208.                     $aRep2[]=$a;
  209.                 }
  210.                
  211.                 $s.="<p>  <table cellpadding=4 cellspacing=0 width=500>";
  212.                 foreach($aRep2  as $ar)
  213.                 {
  214.                     $bg=$aBg[$i%count($aBg)];$i++;
  215.                     $s.="\n<tr bgcolor='$bg'> ";
  216.                     for($i2=0 ;$i2<4;$i2++)
  217.                     {
  218.                         $s.="<td>".$ar[$i2]."</td>";
  219.                     }
  220.                    
  221.                     $s.="</tr>";
  222.                 }
  223.                
  224.                 $s.="</table>";
  225.         /* 
  226.             }
  227.        
  228.         }
  229.         */
  230.          
  231.        
  232.        
  233.     }
  234.  
  235.    
  236.     ?><textarea rows="10" cols="80" name=lineUpB><?=$s;?></textarea>
  237.     <?php
  238.     echo $s;
  239.      
  240. ?>
  241.  
  242. <? 
  243. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement