warscript
je kan het script ook downloaden op http://www.members.lycos.nl/djstarlight/clanwarscript/clanwarscript.zip
----includes/config.php---
<link rel="stylesheet" href="style.css" type="text/css">
Code (php)
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
<?php
$hostname = "localhost";
$username = "db gebruikersnaam";
$password = "db wachtwoord";
$database = "db";
$clannaam = "Je t'aime";
mysql_connect($hostname,$username,$password) or die(mysql_error());
mysql_select_db($database);
?>
$hostname = "localhost";
$username = "db gebruikersnaam";
$password = "db wachtwoord";
$database = "db";
$clannaam = "Je t'aime";
mysql_connect($hostname,$username,$password) or die(mysql_error());
mysql_select_db($database);
?>
---wars.php---
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
include("includes/config.php");
echo ("<font face='Arial Black' size='4'>Clanwars</font><br>");
$war = "SELECT * FROM wars ORDER BY id DESC";
$result_war = mysql_query($war) or die(mysql_error());
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=\"850\">\n";
echo "<tr style=\ bgcolor='#ebebeb' color: White; font-weight: Bold;\">\n<td>War</td>\n<td>Author</td>\n<td>Datum</td>\n</tr>\n";
while ($row_war = mysql_fetch_assoc($result_war)) {
echo "<tr>\n";
echo "<td><a href=\"warsread.php?warid=".$row_war['id']."\">".$clannaam." vs ".$row_war['opponent']."</a></td>\n";
echo "<td>".$row_war['author']."</a></td>\n";
echo "<td>".$row_war['date']." om ".$row_war['time']."</td>\n";
echo "</tr>\n";
}
echo "</table><p>\n";
?>
include("includes/config.php");
echo ("<font face='Arial Black' size='4'>Clanwars</font><br>");
$war = "SELECT * FROM wars ORDER BY id DESC";
$result_war = mysql_query($war) or die(mysql_error());
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=\"850\">\n";
echo "<tr style=\ bgcolor='#ebebeb' color: White; font-weight: Bold;\">\n<td>War</td>\n<td>Author</td>\n<td>Datum</td>\n</tr>\n";
while ($row_war = mysql_fetch_assoc($result_war)) {
echo "<tr>\n";
echo "<td><a href=\"warsread.php?warid=".$row_war['id']."\">".$clannaam." vs ".$row_war['opponent']."</a></td>\n";
echo "<td>".$row_war['author']."</a></td>\n";
echo "<td>".$row_war['date']." om ".$row_war['time']."</td>\n";
echo "</tr>\n";
}
echo "</table><p>\n";
?>
---warsread.php---
Code (php)
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
<?php
include("includes/config.php");
$warid = $_GET['warid'];
$wars = "SELECT * FROM wars WHERE id= '$warid'";
$result_wars = mysql_query($wars) or die(mysql_error());
$row_wars = mysql_fetch_assoc($result_wars);
?>
include("includes/config.php");
$warid = $_GET['warid'];
$wars = "SELECT * FROM wars WHERE id= '$warid'";
$result_wars = mysql_query($wars) or die(mysql_error());
$row_wars = mysql_fetch_assoc($result_wars);
?>
<table border="0" cellpadding="0" cellspacing="0" width="748" height="461">
<tr>
<td valign="top" colspan="5" height="38">
</td>
</tr>
<tr>
<td valign="top" colspan="2" height="58">
<h4> vs </h3></td>
<td rowspan="6" width="131" align="center">
<img border="0" src="images/maps/">
</td>
<td rowspan="6" width="11" align="center"> <p></td>
<td rowspan="6" width="156" align="center">
<img border="0" src="images/maps/">
</td>
</tr>
<tr>
<td valign="top" width="224">
<font class="text">Opponent:</font> </td>
<td valign="top" height="20" width="226">
</td>
</tr>
<tr>
<td valign="top" width="224">
<font class="text">Opponent Tag:</font></td>
<td valign="top" height="20" width="226">
</td>
</tr>
<tr>
<td valign="top" width="224">
Date:</td>
<td valign="top" height="20" width="226">
</td>
</tr>
<tr>
<td valign="top" width="224">
<font class="text">Time:</font> </td>
<td valign="top" height="20" width="226">
</td>
</tr>
<tr>
<td valign="top" width="224">
First map:</td>
<td valign="top" height="20" width="226">
</td>
</tr>
<tr>
<td valign="top" width="224">
Second map:</td>
<td valign="top" width="226">
</td>
<td valign="top" width="131">
</td>
<td valign="top" height="20" width="167" colspan="2">
</td>
</tr>
<tr>
<td valign="top" width="224">
Our score:</td>
<td valign="top" width="226">
</td>
<td valign="top" width="131">
</td>
<td valign="top" height="20" width="167" colspan="2">
</td>
</tr>
<tr>
<td valign="top" width="224">
Opponent score:</td>
<td valign="top" width="226">
</td>
<td valign="top" width="131">
line-up</td>
<td valign="top" height="20" width="167" colspan="2">
</td>
</tr>
<tr>
<td valign="top" colspan="2" height="73">
Extra information:<br><br>
</td>
<td valign="top" width="131" height="73">
</td>
<td valign="top" width="167" height="73" colspan="2">
</td>
</tr>
<tr>
<td width="748" colspan="5" valign="top"><br>War report:<br><br>
</td>
</tr>
</table>
--- toevoegen.php---
Code (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?
session_start();
if (session_is_registered("sess_loginnaam") && session_is_registered("sess_id"))
{
error_reporting(0); // E_ALL voor error reporting aan 0 voor uit
include("includes/config.php");
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
{
$insert = "
INSERT
INTO wars
(
`author`,
`opponent`,
`opponenttag`,
`date`,
`time`,
`map1`,
`map2`,
`ourscore`,
`opponentscore`,
`xpilineup`,
`opponentlineup`,
`extrainfo`,
`report`
)
VALUES
(
'".$_POST['author']."',
'".$_POST['opponent']."',
'".$_POST['opponenttag']."',
'".$_POST['date']."',
'".$_POST['time']."',
'".$_POST['map1']."',
'".$_POST['map2']."',
'".$_POST['ourscore']."',
'".$_POST['opponentscore']."',
'".$_POST['xpilineup']."',
'".$_POST['opponentlineup']."',
'".$_POST['extrainfo']."',
'".$_POST['report']."'
)
";
$query = mysql_query($insert) or die(mysql_error());
}
}
echo "<h2>War toevoegen</h2>
<form method='post' action=''>
<table border='1'>
<tr>
<td>auteur:</td>
<td><input type='text' name='author' value='".$_POST['author']."'></td>
</tr> <tr>
<td>tegenstander:</td>
<td><input type='text' name='opponent' value='".$_POST['opponent']."'></td>
</tr> <tr>
<td>tag tegenstander:</td>
<td><input type='text' name='opponenttag' value='".$_POST['opponenttag']."'></td>
</tr> <tr>
<td>datum:</td>
<td><input type='text' name='date' value='".$_POST['date']."'></td>
</tr> <tr>
<td>tijd:</td>
<td><input type='text' name='time' value='".$_POST['time']."'></td>
</tr> <tr>
<td>map1:</td>
<td><input type='text' name='map1' value='".$_POST['map1']."'></td>
</tr> <tr>
<td>map2:</td>
<td><input type='text' name='map2' value='".$_POST['map2']."'></td>
</tr> <tr>
<td>eigenscore:</td>
<td><input type='text' name='ourscore' value='".$_POST['ourscore']."'></td>
</tr> <tr>
<td>scoretegenstander:</td>
<td><input type='text' name='opponentscore' value='".$_POST['opponentscore']."'></td>
</tr> <tr>
<td>eigen reactie:</td>
<td><input type='text' name='xpilineup' value='".$_POST['xpilineup']."'></td>
</tr> <tr>
<td>reactie tegenstander:</td>
<td><input type='text' name='opponentlineup' value='".$_POST['opponentlineup']."'></td>
</tr>
<tr>
<td>extra info:</td>
<td><input type='text' name='extrainfo' value='".$_POST['extrainfo']."'></td>
</tr>
<tr>
<td>raport:</td>
<td><input type='text' name='report' value='".$_POST['report']."'></td>
</tr>
<tr>
<td> </td>
<td><input type='submit' name='Toevoegen' value='Toevoegen'></td>
</tr>
</table>
</form>";
}
else
{
echo "je heb geen rechten";
}
?>
session_start();
if (session_is_registered("sess_loginnaam") && session_is_registered("sess_id"))
{
error_reporting(0); // E_ALL voor error reporting aan 0 voor uit
include("includes/config.php");
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
{
$insert = "
INSERT
INTO wars
(
`author`,
`opponent`,
`opponenttag`,
`date`,
`time`,
`map1`,
`map2`,
`ourscore`,
`opponentscore`,
`xpilineup`,
`opponentlineup`,
`extrainfo`,
`report`
)
VALUES
(
'".$_POST['author']."',
'".$_POST['opponent']."',
'".$_POST['opponenttag']."',
'".$_POST['date']."',
'".$_POST['time']."',
'".$_POST['map1']."',
'".$_POST['map2']."',
'".$_POST['ourscore']."',
'".$_POST['opponentscore']."',
'".$_POST['xpilineup']."',
'".$_POST['opponentlineup']."',
'".$_POST['extrainfo']."',
'".$_POST['report']."'
)
";
$query = mysql_query($insert) or die(mysql_error());
}
}
echo "<h2>War toevoegen</h2>
<form method='post' action=''>
<table border='1'>
<tr>
<td>auteur:</td>
<td><input type='text' name='author' value='".$_POST['author']."'></td>
</tr> <tr>
<td>tegenstander:</td>
<td><input type='text' name='opponent' value='".$_POST['opponent']."'></td>
</tr> <tr>
<td>tag tegenstander:</td>
<td><input type='text' name='opponenttag' value='".$_POST['opponenttag']."'></td>
</tr> <tr>
<td>datum:</td>
<td><input type='text' name='date' value='".$_POST['date']."'></td>
</tr> <tr>
<td>tijd:</td>
<td><input type='text' name='time' value='".$_POST['time']."'></td>
</tr> <tr>
<td>map1:</td>
<td><input type='text' name='map1' value='".$_POST['map1']."'></td>
</tr> <tr>
<td>map2:</td>
<td><input type='text' name='map2' value='".$_POST['map2']."'></td>
</tr> <tr>
<td>eigenscore:</td>
<td><input type='text' name='ourscore' value='".$_POST['ourscore']."'></td>
</tr> <tr>
<td>scoretegenstander:</td>
<td><input type='text' name='opponentscore' value='".$_POST['opponentscore']."'></td>
</tr> <tr>
<td>eigen reactie:</td>
<td><input type='text' name='xpilineup' value='".$_POST['xpilineup']."'></td>
</tr> <tr>
<td>reactie tegenstander:</td>
<td><input type='text' name='opponentlineup' value='".$_POST['opponentlineup']."'></td>
</tr>
<tr>
<td>extra info:</td>
<td><input type='text' name='extrainfo' value='".$_POST['extrainfo']."'></td>
</tr>
<tr>
<td>raport:</td>
<td><input type='text' name='report' value='".$_POST['report']."'></td>
</tr>
<tr>
<td> </td>
<td><input type='submit' name='Toevoegen' value='Toevoegen'></td>
</tr>
</table>
</form>";
}
else
{
echo "je heb geen rechten";
}
?>
---admin.php
Code (php)
1
2
3
4
5
2
3
4
5
<?
session_start();
if (session_is_registered("sess_loginnaam") && session_is_registered("sess_id"))
{
?>
session_start();
if (session_is_registered("sess_loginnaam") && session_is_registered("sess_id"))
{
?>
<html>
<head>
<meta http-equiv="Content-Language" content="nl">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>admin</title>
</head>
<body>
<p><a href="toevoegen.php">klik hier </a>om naar toevoegen.php te gaan let op je
moet maar 1 keer op verzenden klikken dan is het al toegevoegd</p>
</body>
</html>
---login.php---
Code (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?
// start de sessions
session_start();
// we beginnen met de mysql connectie
// verander deze gegevens natuurlijk met je eigen
$user = "db gebruikersnaam";
$pass = "db passwoord";
$host = "localhost";
$dbdb = "db naam";
$table = "gebruikers";
$nextpage = "admin.php";
if (!mysql_select_db($dbdb, mysql_connect($host, $user, $pass)))
{
echo "Connectie met database mislukt.";
exit();
}
// check of de user op de 'login' knop heeft gedrukt en of $loginnaam en $paswoord niet leeg zijn
if ($HTTP_POST_VARS["loginnaam"] && $HTTP_POST_VARS["paswoord"])
{
$sql_db = "SELECT id, loginnaam, paswoord FROM $table WHERE loginnaam = '$HTTP_POST_VARS[loginnaam]' AND paswoord = '$HTTP_POST_VARS[paswoord]'";
$res_db = mysql_query($sql_db);
if (mysql_num_rows($res_db) >= 1)
{
$row = mysql_fetch_array($res_db);
$sess_id = $row[id];
$sess_loginnaam = $row[loginnaam];
session_register(sess_id);
session_register(sess_loginnaam);
echo "Je bent nu ingelogd. Klik <a href=$nextpage>hier</a> om verder te gaan.";
}
else
{
echo "Verkeerde loginnaam of paswoord<p>";
echo "Ga <a href=\"$PHP_SELF\">terug</a> en probeer het opnieuw.";
}
}
else
{
// formulier
echo "<table border=0 cellspacing=0 cellpadding=5>";
echo "<form method=POST action=$PHP_SELF>";
echo "<tr><td>Loginnaam:</td></tr>";
echo "<tr><td><input type=text name=loginnaam></td></tr>";
echo "<tr><td> </td></tr>";
echo "<tr><td>Paswoord:</td></tr>";
echo "<tr><td><input type=password name=paswoord></td></tr>";
echo "<tr><td> </td></tr>";
echo "<input type=submit name=submit value=Login>";
echo "</form>";
echo "</table>";
}
?>
// start de sessions
session_start();
// we beginnen met de mysql connectie
// verander deze gegevens natuurlijk met je eigen
$user = "db gebruikersnaam";
$pass = "db passwoord";
$host = "localhost";
$dbdb = "db naam";
$table = "gebruikers";
$nextpage = "admin.php";
if (!mysql_select_db($dbdb, mysql_connect($host, $user, $pass)))
{
echo "Connectie met database mislukt.";
exit();
}
// check of de user op de 'login' knop heeft gedrukt en of $loginnaam en $paswoord niet leeg zijn
if ($HTTP_POST_VARS["loginnaam"] && $HTTP_POST_VARS["paswoord"])
{
$sql_db = "SELECT id, loginnaam, paswoord FROM $table WHERE loginnaam = '$HTTP_POST_VARS[loginnaam]' AND paswoord = '$HTTP_POST_VARS[paswoord]'";
$res_db = mysql_query($sql_db);
if (mysql_num_rows($res_db) >= 1)
{
$row = mysql_fetch_array($res_db);
$sess_id = $row[id];
$sess_loginnaam = $row[loginnaam];
session_register(sess_id);
session_register(sess_loginnaam);
echo "Je bent nu ingelogd. Klik <a href=$nextpage>hier</a> om verder te gaan.";
}
else
{
echo "Verkeerde loginnaam of paswoord<p>";
echo "Ga <a href=\"$PHP_SELF\">terug</a> en probeer het opnieuw.";
}
}
else
{
// formulier
echo "<table border=0 cellspacing=0 cellpadding=5>";
echo "<form method=POST action=$PHP_SELF>";
echo "<tr><td>Loginnaam:</td></tr>";
echo "<tr><td><input type=text name=loginnaam></td></tr>";
echo "<tr><td> </td></tr>";
echo "<tr><td>Paswoord:</td></tr>";
echo "<tr><td><input type=password name=paswoord></td></tr>";
echo "<tr><td> </td></tr>";
echo "<input type=submit name=submit value=Login>";
echo "</form>";
echo "</table>";
}
?>