login  Naam:   Wachtwoord: 
Registreer je!
 Scripts:

Scripts > PHP > Oude scripts > Nieuwssysteem 2.1.3 [Reacties en Admin]

Nieuwssysteem 2.1.3 [Reacties en Admin]

Auteur: Joel - 19 augustus 2004 - 00:15 - Gekeurd door: Dennisvb - Hits: 16586 - Aantal punten: 3.83 (12 stemmen)




Dit is een nieuwssysteem met volgende onderwerpen:
-pagina met instellingen (config.php)
-pagina met al het nieuws (nieuws.php)
-pagina met reacties + reactie toevoegen (nieuwscomments.php)
-nieuwstoevoegen (nieuwstoevoegen.php)
-pagina met admin (admin.php)
-nieuwsverwijderen (verwijdernieuws.php)
-nieuwsveranderen (verandernieuws.php)

Je moet ook nog 2 tabellen maken in je database:

  1. #
  2. # Table structure for table 'nieuwscomments'
  3. #
  4.  
  5.  
  6. CREATE TABLE `nieuwscomments` (
  7. `id` int(10) NOT NULL auto_increment,
  8. `nieuwsid` int(10) NOT NULL default '0',
  9. `naam` varchar(20) NOT NULL default '',
  10. `emailadres` varchar(50) NOT NULL default '',
  11. `bericht` text NOT NULL,
  12. `tijd` varchar(10) NOT NULL default '',
  13. `datum` varchar(10) NOT NULL default '',
  14. PRIMARY KEY (`id`)
  15. ) TYPE=MyISAM;
  16.  
  17. #
  18. # Table structure for table 'nieuws'
  19. #
  20.  
  21. CREATE TABLE `nieuws` (
  22. `id` mediumint(10) NOT NULL auto_increment,
  23. `onderwerp` varchar(100) NOT NULL default '',
  24. `naam` varchar(20) NOT NULL default '',
  25. `emailadres` varchar(80) NOT NULL default '',
  26. `bericht` text NOT NULL,
  27. `datum` varchar(30) NOT NULL default '',
  28. PRIMARY KEY (`id`)
  29. ) TYPE=MyISAM;


Veel succes met dit nieuwsscript.

Code:
##########
Config.php
##########

  1. <?php
  2. /* mysql */
  3. mysql_connect ("localhost","jegebruikersnaam","jepassword");
  4. mysql_select_db("databasenaam");
  5. /* algemeen */
  6. $max = 10; //hoeveel berichten er op 1 pagina mag komen
  7. ?>
  8. <style>
  9. a:link { text-decoration: none; }
  10. a:active { text-decoration: none; }
  11. a:visited { text-decoration: none; }
  12. a:hover { text-decoration: none; }
  13. </style>
  14.  
  15. <body bgcolor="#e2e2e2">


##########
Nieuws.php
##########

  1. <?php
  2. include ('config.php');
  3. $sql = "SELECT * FROM nieuws ORDER BY ID DESC";
  4. $query = mysql_query($sql) or die(mysql_error());
  5. $rtel = mysql_num_rows($query);
  6.  
  7. if ($rtel < 1) {
  8. echo "<div align=center><font face=verdana size=-1>Er zijn nog geen nieuwsberichten</font></div>";
  9.  
  10. } else {
  11.  
  12. $rtel/=$max;
  13. if (empty($pagina)) $pagina=1;
  14. $van=($pagina-1)*$max;
  15. if ($pagina > ceil($rtel)) $pagina=1;
  16. for ($i = 1; $i <= ceil($rtel); $i++) {
  17. if ($pagina == $i)
  18. $paginas[$i] = "<b>".$i."</b>";
  19. else
  20. $paginas[$i] = "<a href=\"".$_SERVER['REQUEST_URI']."?pagina=".$i."\">".$i."</a>";
  21. }
  22.  
  23. $paginas= implode(" | ", $paginas);
  24. $vorige = ($pagina-1) ? "<a href=\"".$_SERVER['REQUEST_URI']."?pagina=" . ($pagina - 1)
  25. . "\">< Vorige</a>" : "";
  26. $volgende = ($pagina-ceil($rtel)) ? "<a href=\"$php_self?pagina=" .
  27. ($pagina + 1) . "\">Volgende ></a>" : "";
  28.  
  29. if ($vorige && $volgende) {
  30.  
  31. $navigatie = ("<font face=\"verdana\" size=\"-1\" color=\"#000000\">
  32. ".$vorige." <font color=\"#000000\">|</font> ".$paginas."
  33. <font face=\"verdana\" size=\"-1\" color=\"#000000\"> |</font> ".$volgende."</font>");
  34.  
  35. } else {
  36.  
  37. $navigatie = ("<font face=\"verdana\" size=\"-1\" color=\"#000000\">
  38. ".$vorige." <font color=\"#000000\">|</font> ".$paginas." <font face=\"verdana\"
  39. size=\"-1\" color=\"#000000\">|</font> ".$volgende."</font>");
  40. }
  41. $query = mysql_query("SELECT * FROM nieuws ORDER BY id DESC LIMIT ".$van.", ".$max);
  42.  
  43. while ($obj = mysql_fetch_object($query)) {
  44. $bericht = htmlspecialchars($obj->bericht);
  45. $bericht = nl2br($bericht);
  46. $bericht = wordwrap($bericht, 60, "\n", 1);
  47.  
  48. $nieuwsid = $obj->id;
  49. $rij = mysql_query("SELECT * FROM nieuwscomments WHERE nieuwsid=".$nieuwsid." ORDER BY id DESC");
  50. $comments = mysql_num_rows($rij);
  51.  
  52. if ($comments == "1")
  53. $commentsnaam ="<a href=\"nieuwscomments.php?nieuwsid=".$nieuwsid."\"><font color=\"#000080\">".$comments." reactie</font></a>";
  54. else
  55. $commentsnaam ="<a href=\"nieuwscomments.php?nieuwsid=".$nieuwsid."\"><font color=\"#000080\">".$comments." reacties</font></a>";
  56.  
  57. if ($comments == "0")
  58. $commentsnaam ="<a href=\"nieuwscomments.php?nieuwsid=".$nieuwsid."\"><font color=\"#000080\">Post een reactie</font></a>";
  59. ?>
  60. <div align="center">
  61. <table width="89%" border="1" cellspacing="1" cellpadding="2" bordercolor="#666666" bgcolor="#000000">
  62. <tr bgcolor="#999999">
  63. <td width="35%"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><b>Onderwerp:</b>
  64. &nbsp;<?php echo $obj->onderwerp; ?></font></td>
  65. <td width="29%"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><b>Gepost
  66. door:</b>&nbsp;<?php echo"<a href=mailto:".$obj->emailadres."><font color=\"#000080\">".$obj->naam."</font></a>"; ?></font></td>
  67. <td width="36%"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><b>Gepost
  68. op:</b>&nbsp;<?= $obj->datum; ?></font></td>
  69. </tr>
  70. <tr bgcolor="#CCCCCC">
  71. <td colspan="3">
  72. <font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><?= $bericht; ?>
  73. </font></td>
  74. </tr>
  75. <tr bgcolor="#999999">
  76. <td colspan="3">
  77. <div align="right">
  78. <font face="Verdana, Arial, Helvetica, sans-serif" size="-1">
  79. [ <?= $commentsnaam; ?> ]
  80. </font>
  81. </div>
  82. </td>
  83. </tr>
  84. </table>
  85. </div>
  86. <br>
  87. <?php } ?>
  88. <div align="center">
  89. <table width="89%" border="1" cellspacing="1" cellpadding="2" bordercolor="#000000" bgcolor="#666666">
  90. <tr>
  91. <td bgcolor="#999999">
  92. <div align="center"><font size="-1"><?= $navigatie; ?></font></div>
  93. </td>
  94. </tr>
  95. </table>
  96. </div>
  97. <?php } ?>


##################
Nieuwscomments.php
##################

  1. <?php
  2. include ('config.php');
  3. $nieuwsid=$_GET['nieuwsid'];
  4. $query=mysql_query("SELECT * FROM nieuws where id=".$nieuwsid) or die(mysql_error());
  5. $obj=mysql_fetch_object($query);
  6. $bericht = htmlspecialchars($obj->bericht);
  7. $bericht = nl2br($bericht);
  8. $bericht = wordwrap($bericht, 60, "\n", 1 );
  9. ?>
  10. <div align="center">
  11. <table width="89%" border="1" cellspacing="1" cellpadding="2" bordercolor="#666666" bgcolor="#000000">
  12. <tr bgcolor="#999999">
  13. <td width="35%"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><b>Onderwerp:</b>
  14. &nbsp;<?= $obj->onderwerp; ?></font></td>
  15. <td width="29%"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><b>Gepost
  16. door:</b>&nbsp;<?php echo"<a href=mailto:".$obj->emailadres."><font color=\"#000080\">
  17. ".$obj->naam."</font></a>"; ?></font></td>
  18. <td width="36%"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><b>Gepost
  19. op:</b>&nbsp;<?= $obj->datum; ?></font></td>
  20. </tr>
  21. <tr bgcolor="#CCCCCC">
  22. <td colspan="3">
  23. <font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><?= $bericht; ?>
  24. </font></td>
  25. </tr>
  26. </table>
  27. </div>
  28. <br>
  29. <hr width="89%" color="black">
  30. <br>
  31. <?php
  32. $query=mysql_query("SELECT * FROM nieuwscomments WHERE nieuwsid=".$nieuwsid) or die(mysql_error());
  33. while($obj= mysql_fetch_object($query)) {
  34. $bericht = htmlspecialchars($obj->bericht);
  35. $bericht = nl2br($bericht);
  36. $bericht = wordwrap($bericht, 60, "\n", 1 );
  37. $aantal=mysql_num_rows($query);
  38. if ($aantal > 0) {
  39. ?>
  40. <div align="center">
  41. <table width="89%" border="1" cellspacing="1" cellpadding="2" bordercolor="#666666" bgcolor="#000000">
  42. <tr bgcolor="#999999">
  43. <td width="50%"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><b>Gepost
  44. door:</b>&nbsp;
  45. <?php echo"<a href=mailto:".$obj->emailadres."><font color=\"#000080\">
  46. ".$obj->naam."</font></a>"; ?>
  47. </font></td>
  48. <td width="50%"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><b>Gepost
  49. op:</b>&nbsp;
  50. <?php echo $obj->datum." - ".$obj->tijd; ?>
  51. </font></td>
  52. </tr>
  53. <tr bgcolor="#CCCCCC">
  54. <td colspan="2"> <font face="Verdana, Arial, Helvetica, sans-serif" size="-1">
  55. <?= $bericht; ?>
  56. </font></td>
  57. </tr>
  58. </table>
  59. </div>
  60. <br>
  61. <?php
  62. }
  63. }
  64. ?>
  65. <?php
  66. $datum = date("d/m/Y");
  67. $tijd = date("H:i");
  68.  
  69. if (isset($_POST['Submit'])) {
  70.  
  71. if (!isset($_POST['berichtreactie']))
  72. $error = "Je moet een bericht invullen";
  73. if (!isset($_POST['emailadres']))
  74. $error = "Je moet je e-mailadres invullen";
  75. if (!isset($_POST['naam']))
  76. $error = "Je moet je naam invullen";
  77.  
  78. if (!$error) {
  79.  
  80. $query ="INSERT INTO nieuwscomments (naam, tijd, datum, bericht,
  81. nieuwsid, emailadres) VALUES ('".$_POST['naam']."', '".$_POST['tijd']."', '".$_POST['datum']."',
  82. '".$_POST['berichtreactie']."', '".$_POST['nieuwsid']."', '".$_POST['emailadres']."')";
  83.  
  84. mysql_query($query) or die (mysql_error());
  85.  
  86. header("location:".$_SERVER['REQUEST_URI']);
  87.  
  88. } elseif isset($error) {
  89. ?>
  90. <div align="center">
  91. <table width="39%" border="1" cellspacing="3" cellpadding="2" bordercolor="#666666">
  92. <tr>
  93. <td height="22"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><b>Reactie posten:
  94. </b></font>
  95. </td>
  96. </tr>
  97. <tr>
  98. <td height="23">
  99. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  100. <tr>
  101. <td width="97%">
  102. <font face="Arial" color="red" size="-1"><b>Error:</b>
  103. <?= $error; ?>
  104. </font>
  105. </td>
  106. <td width="3%">
  107. <div align="right">
  108. <input onClick="javascript:history.go(-1);" type="button" name="Button" value="Terug">
  109. </div>
  110. </td>
  111. </tr>
  112. </table>
  113. </td>
  114. </tr>
  115. </table>
  116. </div>
  117. <?php
  118. }
  119. } else {
  120. if ($aantal != 0) {
  121. ?>
  122. <hr width="89%" color="black">
  123. <br>
  124. <?php } ?>
  125. <form method="post" action="">
  126. <div align="center">
  127. <table width="44%" border="1" cellpadding="2" cellspacing="1" bordercolor="#666666" bgcolor="#333333">
  128. <tr bgcolor="#666666">
  129. <td colspan="2"><b><font face="Verdana" size="-1">Reactie
  130. posten:</font></b></td>
  131. </tr>
  132. <tr bgcolor="#CCCCCC">
  133. <td width="60%"><font face="Verdana" size="-1">Je naam:</font></td>
  134. <td width="40%">
  135. <input type="text" name="naam" size="30">
  136. </td>
  137. </tr>
  138. <tr bgcolor="#CCCCCC">
  139. <td width="60%"><font face="Verdana" size="-1">Je e-mailadres:</font></td>
  140. <td width="40%">
  141. <input type="text" name="emailadres" size="30">
  142. </td>
  143. </tr>
  144. <tr bgcolor="#CCCCCC">
  145. <td colspan="2">
  146. <div align="center"><font size="-1" face="Verdana">Je bericht: </font> </div>
  147. </td>
  148. </tr>
  149. <tr bgcolor="#CCCCCC">
  150. <td colspan="2">
  151. <div align="center">
  152. <textarea name="berichtreactie" cols="50" rows="5"></textarea>
  153. </div>
  154. </td>
  155. </tr>
  156. <tr bgcolor="#999999">
  157. <td colspan="2">
  158. <div align="center">
  159. <input type="submit" name="Submit" value="Post reactie">
  160. <input type="button" value="Terug naar nieuws" onClick="window.location='nieuws.php' " name="button">
  161. </div>
  162. </td>
  163. </tr>
  164. </table>
  165. </div>
  166. </form>
  167. <?php } ?>



###################
Nieuwstoevoegen.php
###################

  1. <?php
  2. include ('config.php');
  3.  
  4. $arraymaand = array("Januari","Februari","Maart","April","Mei","Juni",
  5. "Juli","Augustus","September","Oktober","November","December");
  6.  
  7. $maand = date("n") - 1;
  8. $datum = date("j ") . $arraymaand[$maand] . date(" Y");
  9.  
  10. if (isset($_POST['submit'])) {
  11. if (!isset($bericht))
  12. $error="Je moet een bericht invullen!";
  13. if (!isset($naam))
  14. $error="Je moet je naam invullen!";
  15. if (!isset($emailadres))
  16. $error="Je moet je e-mailadres invullen!";
  17. if (!isset($onderwerp))
  18. $error="Je moet een onderwerp invullen!";
  19.  
  20. if (!isset($error)) {
  21.  
  22. mysql_query("INSERT INTO nieuws (datum,bericht,emailadres,onderwerp,naam) VALUES
  23. ('".$_POST['datum']."','".$_POST['bericht']."','".$_POST['emailadres']."',
  24. '".$_POST['onderwerp']."','".$_POST['naam']."')") or die (mysql_error());
  25. ?>
  26. <div align="center">
  27. <table width="39%" border="1" cellspacing="3" cellpadding="2" bordercolor="#999999" bgcolor="#666666">
  28. <tr>
  29.  
  30. <td height="22" bgcolor="#999999"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><b>Nieuws
  31. toevoegen: </b></font></td>
  32. </tr>
  33. <tr>
  34.  
  35. <td height="46" bgcolor="#CCCCCC">
  36. <div align="left"><font face="Arial, Helvetica, sans-serif" size="-1">Het
  37. nieuws is <b>succesvol</b> toegevoegd!</font></div>
  38. </td>
  39. </tr>
  40. <tr>
  41.  
  42. <td height="21" bgcolor="#999999">
  43. <div align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">[
  44. Terug naar <a href="nieuws.php">nieuws</a> ]</font></div>
  45. </td>
  46. </tr>
  47. </table>
  48. </div>
  49. <?php
  50. } elseif isset($error)) {
  51. ?>
  52. <div align="center">
  53. <table width="39%" border="1" cellspacing="3" cellpadding="2" bordercolor="#999999" bgcolor="#666666">
  54. <tr>
  55. <td height="22" bgcolor="#999999"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><b>Nieuws
  56. toevoegen: </b></font> </td>
  57. </tr>
  58. <tr>
  59. <td height="23" bgcolor="#CCCCCC">
  60. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  61. <tr>
  62. <td width="97%">
  63. <font face="Arial" color="red" size="-1"><b>Error:</b>
  64. <?= $error; ?>
  65. </font>
  66. </td>
  67. <td width="3%">
  68. <div align="right">
  69. <input onClick="javascript:history.go(-1);" type="button" name="Button" value="Terug">
  70. </div>
  71. </td>
  72. </tr>
  73. </table>
  74. </td>
  75. </tr>
  76. </table>
  77. </div>
  78. <?php
  79. }
  80. } else {
  81. ?>
  82. <form action="" method="post">
  83. <div align="center">
  84. <table width="39%" border="1" cellspacing="2" cellpadding="2" bordercolor="#999999" bgcolor="#666666">
  85. <tr bgcolor="#999999">
  86. <td colspan="2" height="22"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><b>Nieuws
  87. toevoegen: </b></font></td>
  88. </tr>
  89. <tr bgcolor="#CCCCCC">
  90. <td width="58%">
  91. <div align="left"><font size="-1" face="Verdana, Arial, Helvetica,
  92. sans-serif">Je naam: </font></div>
  93. </td>
  94. <td width="42%"><font size="-1"><font size="-1"><font face="Verdana, Arial, Helvetica, sans-serif">
  95. <input type="text" name="naam" size="30">
  96. </font></font></font></td>
  97. </tr>
  98. <tr bgcolor="#CCCCCC">
  99. <td width="58%">
  100. <div align="left"><font size="-1"><font size="-1"> <font face="Verdana, Arial, Helvetica, sans-serif">
  101. </font></font><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">Je
  102. e-mailadres: </font><font face="Verdana, Arial, Helvetica, sans-serif">
  103. </font></font></div>
  104. </td>
  105. <td width="42%"><font size="-1"><font size="-1"><font face="Verdana, Arial, Helvetica, sans-serif">
  106. <input type="text" name="emailadres" size="30">
  107. </font></font></font></td>
  108. </tr>
  109. <tr bgcolor="#CCCCCC">
  110. <td width="58%">
  111. <div align="left"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">Het
  112. onderwerp: </font></div>
  113. </td>
  114. <td width="42%"><font size="-1"><font size="-1"><font face="Verdana, Arial, Helvetica, sans-serif">
  115. <input type="text" name="onderwerp" size="30">
  116. </font></font></font></td>
  117. </tr>
  118. <tr bgcolor="#CCCCCC">
  119. <td colspan="2">
  120. <div align="center"><font face="Verdana, Arial, Helvetica,
  121. sans-serif" size="-1">Bericht: </font><font size="-1"
  122. face="Verdana, Arial, Helvetica, sans-serif"> </font></div>
  123. </td>
  124. </tr>
  125. <tr bgcolor="#CCCCCC">
  126. <td colspan="2">
  127. <div align="center"><font size="-1"><font size="-1"> <font face="Verdana, Arial, Helvetica, sans-serif">
  128. </font></font><font face="Verdana, Arial, Helvetica, sans-serif">
  129. <textarea name="bericht" cols="50" rows="20" wrap="VIRTUAL"></textarea>
  130. </font></font></div>
  131. </td>
  132. </tr>
  133. <tr bgcolor="#CCCCCC">
  134. <td colspan="2">&nbsp; </td>
  135. </tr>
  136. <tr bgcolor="#999999">
  137. <td colspan="2" height="20">
  138. <div align="center">
  139. <input type="submit" value="Post nieuws" name="submit">
  140. <input type="reset" value="Wis velden" name="reset">
  141. <input type="button" value="Terug naar nieuws"
  142. onClick="window.location='nieuws.php' " name="button">
  143. </div>
  144. </td>
  145. </tr>
  146. </table>
  147. </div>
  148. </form>
  149. <?php } ?>



#########
Admin.php
#########

  1. <div align="center">
  2. <table width="89%" border="1" cellspacing="2" cellpadding="2"
  3. bordercolor="#999999" bgcolor="#666666">
  4. <tr bgcolor="#999999">
  5. <td colspan="3"><font face="Verdana" size="-1"><b>Admin
  6. pagina:</b></font></td>
  7. </tr>
  8. <tr bgcolor="#CCCCCC">
  9. <td width="5%">
  10. <div align="center"><font face="Verdana" size="-1"><b>Id:</b></font></div>
  11. </td>
  12. <td width="56%">
  13. <div align="center"><font size="-1" face="Verdana"><b>Onderwerp:</b></font></div>
  14. </td>
  15. <td width="39%">
  16. <div align="center"><font size="-1" face="Verdana"><b>Opties:</b></font></div>
  17. </td>
  18. </tr>
  19. <?php
  20. include ('config.php');
  21. $query = "SELECT * FROM nieuws ORDER BY id DESC";
  22. $resultaat = mysql_query($query) or die (mysql_error());
  23. while ($rij = mysql_fetch_object($resultaat)){
  24. echo "
  25. <tr bgcolor=\"#E2E2E2\">
  26. <td width=\"3%\">
  27. <div align=\"center\">&nbsp;<font face=\"Verdana, Arial,
  28. Helvetica, sans-serif\" size=\"-1\">".$rij->id."</font></div>
  29. </td><td width=\"58%\">
  30. <div align=\"center\"><font face=\"Verdana, Arial, Helvetica,
  31. sans-serif\" size=\"-1\">&nbsp;".$rij->onderwerp."</font></div>
  32. </td><td width=\"39%\">
  33. <div align=\"center\"><font face=\"Verdana, Arial, Helvetica,
  34. sans-serif\" size=\"-1\">
  35. [<a href=\"verandernieuws.php?id=".$rij->id."\">Verander</a>]
  36. [<a href=\"verwijdernieuws.php?id=".$rij->id."\">Verwijder</a>]
  37. </font></div></td></tr>
  38. ";} ?>
  39. </table>
  40. </div>


##################
Verandernieuws.php
##################

  1. <?php
  2. include ('config.php');
  3.  
  4. if (isset($_POST['Veranderen'])) {
  5.  
  6. if (!isset($_POST['bericht']))
  7. $error="Het bericht mag niet leeg zijn";
  8. if (!isset($_POST['naam']))
  9. $error="De naam mag niet leeg zijn";
  10. if (!isset($_POST['emailadres']))
  11. $error="Het e-mailadres mag niet leeg zijn";
  12.  
  13. if (!isset($error)) {
  14.  
  15. $query = "UPDATE nieuws SET naam='".$_POST['naam']."', bericht='".$_POST['bericht']."',
  16. emailadres='".$_POST['emailadres']."', onderwerp='".$_POST['onderwerp']."' WHERE id = ".$_GET['id'];
  17. mysql_query($query) or die (mysql_error());
  18. ?>
  19. <div align="center">
  20. <table width="39%" border="1" cellspacing="2" cellpadding="2" bordercolor="#999999" bgcolor="#666666">
  21. <tr bgcolor="#999999">
  22. <td colspan="2" height="22"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><b>Nieuws
  23. veranderen: </b></font></td>
  24. </tr>
  25. <tr bgcolor="#999999">
  26. <td colspan="2" height="68" bgcolor="#CCCCCC">
  27. <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">Het
  28. nieuws is succesvol veranderd<br>
  29. </font>
  30. <hr color="black">
  31. <font face="Verdana, Arial, Helvetica, sans-serif" size="-1">[ Terug
  32. naar <a href="admin.php">admin pagina</a> ]<br>
  33. [ Terug naar <a href="nieuws.php">nieuws</a> ] </font></div>
  34. </td>
  35. </tr>
  36. </table>
  37. </div>
  38. <?php
  39.  
  40. } elseif ($error) {
  41.  
  42. echo"
  43. <div align=\"center\"><table width=\"50%\" border=\"1\"
  44. cellspacing=\"0\" cellpadding=\"2\">
  45. <tr bordercolor=\"#000000\">
  46. <td bordercolor=\"#000000\" bgcolor=\"#CCCCCC\" height=\"36\">
  47. <div align=\"center\"><font color=\"#000000\" face=\"Verdana,
  48. Arial, Helvetica, sans-serif\" size=\"-1\"><div align=center>
  49. <font color=black size=-1 face=verdana><b>".$error."</b><br>
  50. </font></div></font></div>
  51. <form method=\"post\" action=\"javascript:history.go(-1)\">
  52. <div align=center><input type=\"submit\" name=\"Terug\"
  53. value=\"Terug\"></div>
  54. </form></td></tr></table></div>
  55. ";
  56. }
  57.  
  58. } else {
  59.  
  60. $query = "SELECT * FROM nieuws WHERE id = ".$_GET['id'];
  61. $resultaat = mysql_query($query) or die (mysql_error());
  62.  
  63. while ($obj = mysql_fetch_object($resultaat)) {
  64.  
  65. $v_bericht = $obj->bericht;
  66. $v_naam = $obj->naam;
  67. $v_emailadres= $obj->emailadres;
  68. $v_onderwerp= $obj->onderwerp;
  69. ?>
  70. <form action="" method="post">
  71. <div align="center">
  72. <table width="39%" border="1" cellspacing="2" cellpadding="2" bordercolor="#999999" bgcolor="#666666">
  73. <tr bgcolor="#999999">
  74. <td colspan="2" height="22"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><b>Nieuws
  75. veranderen: </b></font></td>
  76. </tr>
  77. <tr bgcolor="#CCCCCC">
  78. <td width="58%">
  79. <div align="left"><font size="-1" face="Verdana, Arial, Helvetica,
  80. sans-serif">Je naam: </font></div>
  81. </td>
  82. <td width="42%"><font size="-1"><font size="-1"><font face="Verdana, Arial, Helvetica, sans-serif">
  83. <input type="text" name="naam" size="30" value="<?= $v_naam; ?>">
  84. </font></font></font></td>
  85. </tr>
  86. <tr bgcolor="#CCCCCC">
  87. <td width="58%">
  88. <div align="left"><font size="-1"><font size="-1"> <font face="Verdana, Arial, Helvetica, sans-serif">
  89. </font></font><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">Je
  90. e-mailadres: </font><font face="Verdana, Arial, Helvetica, sans-serif">
  91. </font></font></div>
  92. </td>
  93. <td width="42%"><font size="-1"><font size="-1"><font face="Verdana, Arial, Helvetica, sans-serif">
  94. <input type="text" name="emailadres" size="30" value="<?= $v_emailadres; ?>">
  95. </font></font></font></td>
  96. </tr>
  97. <tr bgcolor="#CCCCCC">
  98. <td width="58%">
  99. <div align="left"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">Het
  100. onderwerp: </font></div>
  101. </td>
  102. <td width="42%"><font size="-1"><font size="-1"><font face="Verdana, Arial, Helvetica, sans-serif">
  103. <input type="text" name="onderwerp" size="30" value="<?= $v_onderwerp; ?>">
  104. </font></font></font></td>
  105. </tr>
  106. <tr bgcolor="#CCCCCC">
  107. <td colspan="2">
  108. <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">Bericht: </font><font size="-1" face="Verdana, Arial, Helvetica, sans-serif"> </font></div>
  109. </td>
  110. </tr>
  111. <tr bgcolor="#CCCCCC">
  112. <td colspan="2">
  113. <div align="center"><font size="-1"><font size="-1"> <font face="Verdana, Arial, Helvetica, sans-serif">
  114. </font></font><font face="Verdana, Arial, Helvetica, sans-serif">
  115. <textarea name="bericht" cols="50" rows="20" wrap="VIRTUAL"><?= $v_bericht; ?></textarea>
  116. </font></font></div>
  117. </td>
  118. </tr>
  119. <tr bgcolor="#CCCCCC">
  120. <td colspan="2">&nbsp; </td>
  121. </tr>
  122. <tr bgcolor="#999999">
  123. <td colspan="2" height="20">
  124. <div align="center">
  125. <input type="submit" value="Verander nieuws" name="Veranderen">
  126. <input type="button" value="Terug naar admin" onClick="window.location='admin.php'" name="button">
  127. </div>
  128. </td>
  129. </tr>
  130. </table>
  131. </div>
  132. </form>
  133.  
  134. <?php
  135. }
  136. }
  137. ?>


###################
Verwijdernieuws.php
###################

  1. <?php
  2. if (!isset($_POST['Ja'])) {
  3. ?>
  4. <div align="center">
  5. <table width="50%" border="1" cellspacing="2" cellpadding="2" bordercolor="#999999" bgcolor="#666666">
  6. <tr bgcolor="#999999">
  7. <td colspan="2" height="43">
  8. <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><b>Ben
  9. je zeker dat je het nieuws wilt verwijderen ?</b></font></div>
  10. </td>
  11. </tr>
  12. <tr bgcolor="#CCCCCC">
  13. <td valign="middle" width="50%" height="75">
  14. <div align="center">
  15. <form action="admin.php" method="post">
  16. <input type="submit" name="Neen" value="Neen, ik wil het niet verwijderen">
  17. </form>
  18. </div>
  19. </td>
  20. <td valign="middle" width="50%" height="75">
  21. <div align="center">
  22. <form action="" method="post">
  23. <input type="submit" name="Ja" value="Ja, ik wil het verwijderen">
  24. </form>
  25. </div>
  26. </td>
  27. </tr>
  28. <tr valign="bottom" bgcolor="#999999">
  29. <td width="50%" height="33"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">[
  30. Terug naar <a href="admin.php">admin</a> pagina ]</font></td>
  31. <td width="50%" height="33">
  32. <div align="right"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">[
  33. Terug naar <a href="nieuws.php">nieuws</a> pagina ]</font></div>
  34. </td>
  35. </tr>
  36. </table>
  37. </div>
  38. <?php
  39. }
  40. elseif (isset($_POST['Ja'])) {
  41.  
  42. include ('config.php');
  43. mysql_query("DELETE FROM nieuws WHERE id = ".$_GET['id']) or die (mysql_error());
  44. mysql_query("DELETE FROM nieuwscomments WHERE nieuwsid=".$_GET['id']) or die (mysql_error());
  45.  
  46. ?>
  47. <div align="center">
  48. <table width="50%" border="1" cellspacing="2" cellpadding="2" bgcolor="#666666" bordercolor="#999999">
  49. <tr bgcolor="#999999">
  50. <td colspan="2" height="43">
  51. <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1"><b>Het
  52. nieuws is succesvol verwijderd !</b></font></div>
  53. </td>
  54. </tr>
  55. <tr valign="bottom" bgcolor="#CCCCCC">
  56. <td width="50%" height="33"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">[
  57. Terug naar <a href="admin.php">admin</a> pagina ]</font></td>
  58. <td width="50%" height="33">
  59. <div align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">[
  60. Terug naar <a href="nieuws.php">nieuws</a> pagina ]</font></div>
  61. </td>
  62. </tr>
  63. </table>
  64. </div>
  65. <?php } ?>
Download code! Download code (.txt)

 Stemmen
Niet ingelogd.

 Reacties
Post een reactie
Lees de reacties (20)
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.127s