All pastes #773831 Raw Edit

Stuff

public text v1 · immutable
·published 2007-11-14 20:22 UTC
rendered paste body
[php] include("config.php"); [/php]
<form method="POST">
<u><b>Motstander Info</b></u><br>
Motstanders Tag:<br>
<input type="text" name="tag" size="8"><br>
<br>
Motstanders Navn:<br>
<input type="text" name="navn" size="20">
<br>
<br>
Mostanders Hjemmeside:<br>
<input type="text" name="moturl" size="20"><br>
<br>
Motstanders Land:<br>
<input type="text" name="land" size="20"><br>
<br>
<u><b>Match Info</b></u><br>
<br>
Match Rounds<br>
<select size="1" name="mr">
<option selected>12</option>
<option>15</option>
</select><br>
<br>
Resultat<br>
 <table border="0" cellpadding="0" cellspacing="0" width="70%">
	<tr>
		<td>Map</td>
		<td>TeamSvett Total Score</td>
		<td>Motstander Total Score</td>
	</tr>
	<tr>
<td><br>
<select size="1" name="map">
<option selected value="nomap">-Velg Map-</option>
<option>de_dust</option>
<option>de_dust2</option>
<option>de_cpl_mill</option>
<option>de_inferno</option>
<option>de_train</option>
<option>de_nuke</option>
<option>de_cbble</option>
</select></td>
		<td>
[php]
 print("<select name='tsscore'>");
 for ($i = 0; $i < 31; $i++)
 {
   print("<option value='" . $i . "' />" . $i . "");
 }
 print("</select>");
[/php]
</td>
		<td>
[php]
 print("<select name='motscore'>");
 for ($i = 0; $i < 31; $i++)
 {
   print("<option value='" . $i . "' />" . $i . "");
 }
 print("</select>");
[/php]</td>
	</tr>
</table>
<p><br>
TeamSvett Spillere:<br>
#1
<input type="text" name="spiller1" size="20"><br>
#2
<input type="text" name="spiller2" size="20"><br>
#3
<input type="text" name="spiller3" size="20"><br>
#4
<input type="text" name="spiller4" size="20"><br>
#5
<input type="text" name="spiller5" size="20"></p>
<p>Kommentar til kampen:<br>
<textarea rows="8" name="kommentar" cols="62"></textarea><br>
<br>
 <input type="submit" value="Legg til" name="leggtil">
</p>
</form>
[php]
	
	if(isset($_POST['leggtil']))
	{	
		// Generel Info
		$tag = $_POST['tag'];
		$navn = $_POST['navn'];
		$moturl = $_POST['moturl'];
		$land = $_POST['land'];
		$dato = date(d.".".m.".".y);
		
		// Match Info
		$mr = $_POST['mr'];
		$map = $_POST['map'];
		$tsscore = $_POST['tsscore'];
		$motscore = $_POST['motscore'];
		
		// Spillere
		$spiller1 = $_POST['spiller1'];
		$spiller2 = $_POST['spiller2'];
		$spiller3 = $_POST['spiller3'];
		$spiller4 = $_POST['spiller4'];
		$spiller5 = $_POST['spiller5'];
		
		$kommentar = $_POST['kommentar'];
		$kommentar = nl2br($kommentar);
		
		if($tag == NULL || $navn == NULL || $land == NULL || $map == nomap || $tsscore == NULL || $motscore == NULL)
		{
			echo "Obligatoriske felter mangler";
		}
		else
		{
			if(!is_numeric($tsscore) OR !is_numeric($motscore))
			{
				echo "Score kan kun inneholde tall!";
			}
			else
			{
				mysql_query("INSERT 
							 INTO tsmatch (tag, navn, land, dato, mr, map, tsscore, motscore, spiller1, spiller2, spiller3, spiller4, spiller5, kommentar, moturl) 
							 VALUES('$tag', '$navn', '$land', '$dato', '$mr', '$map', '$tsscore', '$motscore', '$spiller1', ',$spiller2', ',$spiller3', ',$spiller4', ',$spiller5', '$kommentar', '$moturl')") or die(mysql_error());							
							echo "Match mot $tag er registret i databasen!";
			}
		}
	}
[/php]