This repository has been archived by the owner on Mar 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pam3.php
47 lines (46 loc) · 1.99 KB
/
pam3.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/*
Her blir p�meldingene gjort
stevneID og utoverID blir lagt inn i skjema som bokser man ikke kan editere
Peter E 1108
*/
if ($_SESSION['innlogget'] == 1) {
//Kobler til databse
$con = mysql_connect("REDACTED","REDACTED","REDACTED");
if ($con) {
mysql_select_db("REDACTED",$con);
//Henter variable fra POST
$s = $_POST['stevne'];
$u = $_POST['utover'];
//Starter skjema
echo "<tr><td><form action='?side=pam4.php' method='post'></td></tr>";
//Henter info om stevne
$q = mysql_query("SELECT * FROM stevne WHERE stevneID='$s'");
$a = mysql_fetch_array($q);
printf ("<table><tr><td><input type='text' size='1' readonly name ='stevne' value=%d></td>",$a['stevneID']);
printf ("<td>%s</td></tr>",$a['navn']);
//Henter ut navn p� ut�veren
$q = mysql_query("SELECT * FROM utover WHERE utoverID='$u'");
$a = mysql_fetch_array($q);
printf ("<tr><td><input type='text' size='1' readonly name ='utover' value='%d'></td>",$a['utoverID']);
printf ("<td>%s %s</td></tr>",$a['fornavn'],$a['etternavn']);
echo "<tr><td>F�r inn p�meldingstider</td></tr>";
//antall �velser
$n = 0;
while (list($key,$val) = @each ($box)) {
//Legger inn p�meldinger uten tid
mysql_query("INSERT INTO pamelding (svommer , ovelsepastevne , resreg ) VALUES ('$u' , '$val' , '0')");
//Henter ut id for disse p�meldinger
$k = mysql_query("SELECT pamID FROM pamelding WHERE svommer='$u' AND ovelsepastevne='$val'");
//Henter ut navn p� �velser, $val er n� opsID
$q = mysql_query("SELECT distanse,art FROM ovelse,ovelsepastevne WHERE ovelsepastevne.ovelse=ovelse.ovelseID AND opsID='$val'");
printf ("<tr><td>%d %s</td>",mysql_result($q,0,"distanse"),mysql_result($q,0,"art"));
echo "<td><input type='text' size='2' name='".mysql_result($k,0,"pamID").m."' value='00'><input type='text' size='4' name='".mysql_result($k,0,"pamID").s."' value='00'><td></tr>";
$n++;
}
echo "<tr><td><input type='submit'></form></td></tr></table>";
//Lukker database
mysql_close($con);
}
}
?>