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"> 
<?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); 
?> 



---wars.php---

<?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"; 

?> 



---warsread.php---

<?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); 

?> 
<table border="0" cellpadding="0" cellspacing="0" width="748" height="461"> 
        <tr> 
                <td valign="top" colspan="5" height="38"> 
                &nbsp;</td> 
        </tr> 
        <tr> 
                <td valign="top" colspan="2" height="58"> 
                <h4><?php echo $clannaam; ?> vs <?php echo $row_wars['opponent']; ?></h3></td> 
                <td rowspan="6" width="131" align="center"> 
                <img border="0" src="images/maps/<?php echo $row_wars['map1'].".jpg"?>"> 
                </td> 
                <td rowspan="6" width="11" align="center">&nbsp;<p></td> 
                <td rowspan="6" width="156" align="center"> 
                <img border="0" src="images/maps/<?php echo $row_wars['map2'].".jpg"?>"> 
                </td> 
        </tr> 
        <tr> 
                <td valign="top" width="224"> 
                <font class="text">Opponent:</font> </td> 
                <td valign="top" height="20" width="226"> 
                <?php echo $row_wars['opponent'] ?></td> 
        </tr> 
        <tr> 
                <td valign="top" width="224"> 
                <font class="text">Opponent Tag:</font></td> 
                <td valign="top" height="20" width="226"> 
                <?php echo $row_wars['opponenttag'] ?></td> 
        </tr> 
        <tr> 
                <td valign="top" width="224"> 
                Date:</td> 
                <td valign="top" height="20" width="226"> 
                <?php echo $row_wars['date'] ?></td> 
        </tr> 
        <tr> 
                <td valign="top" width="224"> 
                <font class="text">Time:</font> </td> 
                <td valign="top" height="20" width="226"> 
                <?php echo $row_wars['time'] ?></td> 
        </tr> 
        <tr> 
                <td valign="top" width="224"> 
                First map:</td> 
                <td valign="top" height="20" width="226"> 
                <?php echo $row_wars['map1'] ?></td> 
        </tr> 
        <tr> 
                <td valign="top" width="224"> 
                Second map:</td> 
                <td valign="top" width="226"> 
                <?php echo $row_wars['map2'] ?></td> 
                <td valign="top" width="131"> 
                &nbsp;</td> 
                <td valign="top" height="20" width="167" colspan="2"> 
                &nbsp;</td> 
        </tr> 
        <tr> 
                <td valign="top" width="224"> 
                Our score:</td> 
                <td valign="top" width="226"> 
                <?php echo $row_wars['ourscore'] ?></td> 
                <td valign="top" width="131"> 
                &nbsp;</td> 
                <td valign="top" height="20" width="167" colspan="2"> 
                &nbsp;</td> 
        </tr> 
        <tr> 
                <td valign="top" width="224"> 
                Opponent score:</td> 
                <td valign="top" width="226"> 
                <?php echo $row_wars['opponentscore'] ?></td> 
                <td valign="top" width="131"> 
                <?php echo $clannaam; ?> line-up</td> 
                <td valign="top" height="20" width="167" colspan="2"> 
                <?php echo $row_wars['opponent'] ?></td> 
        </tr> 
        <tr> 
                <td valign="top" colspan="2" height="73"> 
                Extra information:<br><br> 
                <?php echo $row_wars['extrainfo'] ?></td> 
                <td valign="top" width="131" height="73"> 
                <?php echo $row_wars['xpilineup'] ?></td> 
                <td valign="top" width="167" height="73" colspan="2"> 
                <?php echo $row_wars['opponentlineup'] ?></td> 
        </tr> 
        <tr> 
                <td width="748" colspan="5" valign="top"><br>War report:<br><br> 
                <?php echo $row_wars['report'] ?></td> 
        </tr> 
</table> 


--- toevoegen.php---
<? 
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>&nbsp;</td> 
      <td><input type='submit' name='Toevoegen' value='Toevoegen'></td> 
    </tr> 
  </table> 
</form>"; 

} 
else 
{ 
echo "je heb geen rechten"; 
} 
?> 


---admin.php
<? 
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>
<?PHP
} 
else 
{ 
echo "je hebt geen rechten om deze pagina te bekijken";
} 
?> 

---login.php---
<? 
// 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>"; 
} 

?> 
