login  Naam:   Wachtwoord: 
Registreer je!
 Forum

Header probleem [ met JS ]

Offline Explosive - 22/01/2006 23:27
Avatar van ExplosiveLid Hallo,

Ik ben voor een vriend een website aan het maken waar een fotoalbum in zit. Dit album is database gestuurd en de admin werkt door middel van Javascript popups. Voor al deze popups heb ik aparte functions gemaakt.

Nu heb ik een probleem met de functie voor het wissen van een album.

hier de code van index.php
  1. <?php
  2.  
  3. include('includes/db.inc.php');
  4.  
  5. if (isset($_GET['page'])) {
  6. $page = $_GET['page'];
  7. } else {
  8. $page = 1;
  9. }
  10.  
  11. $query = "SELECT * FROM `page` WHERE page_id='$page'";
  12. $result = mysql_query($query);
  13. $array = mysql_fetch_array($result);
  14. $text = $array[text];
  15. $text = htmlentities($text);
  16. $text = nl2br($text);
  17. $text = stripslashes($text);
  18. ?>
  19. <html>
  20. <head>
  21. <title>www.toomie.nl</title>
  22. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  23. <link href="style.css" rel="stylesheet" type="text/css" media="all">
  24. <script language="javascript">
  25. <!--//
  26. function edit() {
  27. window.open("beheer/edit.php?id=<?php echo $page; ?>", "popup", "width=500,height=500");
  28. }
  29. function fadd() {
  30. window.open("beheer/add_photo.php", "popup", "width=400, height=300");
  31. }
  32. function aadd() {
  33. window.open("beheer/add_book.php", "popup", "width=400, height=300");
  34. }
  35. function fotopop() {
  36. window.open("beheer/fotopop.php?photo=<?php echo $foto[0]; ?>", "popup", "width=400, height=300");
  37. }
  38. function delalbum(id) {
  39. var conf = confirm("wilt u het fotoalbum met id "+id+" wissen?")
  40. if (conf == true) {
  41. // true php code
  42. <?php
  43. header("Location:beheer/album_verwijder.php?album="+id);
  44. ?>
  45.  
  46. } else {
  47. // false php code
  48. }
  49. //window.open("beheer/del_album.php?id="+id, "popup", "widht=400, height=300");
  50. }
  51. //-->
  52. </script>
  53. </head>
  54. <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
  55. <center>
  56. <!-- ImageReady Slices (layout1.jpg) -->
  57. <table id="Table_01" width="751" height="551" border="0" cellpadding="0" cellspacing="0">
  58. <tr>
  59. <td colspan="26">&nbsp;</td>
  60. <td>
  61. <img src="images/spacer.gif" width="1" height="16" alt=""></td>
  62. </tr>
  63. <tr>
  64. <td colspan="17">
  65. <img src="images/layout_02.jpg" width="492" height="8" alt=""></td>
  66. <td colspan="8" rowspan="9" align="center" valign="middle" background="images/inlogbg.gif">
  67. <form name="login_form" id="login_form" method="post" action="login.php" enctype="multipart/form-data">
  68. <br>
  69. <br>
  70. <input name="naam" type="text" id="naam" value="Username" style="margin-bottom:3px" onClick="if(this.value=='Username') { this.value=''; }" />
  71. <br>
  72. <input name="pass" type="password" id="pass" value="password" style="margin:0" />
  73. <img src="images/layout_26.jpg" alt="" width="20" height="26" border="0" align="absmiddle" style="cursor:pointer" onClick="return document.getElementById('login_form').submit()" />
  74. </form>
  75. </td>
  76. <td rowspan="10">
  77. <img src="images/layout_05.jpg" width="11" height="120" alt=""></td>
  78. <td>
  79. <img src="images/spacer.gif" width="1" height="8" alt=""></td>
  80. </tr>
  81. <tr>
  82. <td colspan="6" rowspan="2">&nbsp;</td>
  83. <td colspan="7" rowspan="2">
  84. <img src="images/layout_07.jpg" width="199" height="46" alt=""></td>
  85. <td colspan="4" rowspan="2">&nbsp;</td>
  86. <td>
  87. <img src="images/spacer.gif" width="1" height="22" alt=""></td>
  88. </tr>
  89. <tr>
  90. <td>
  91. <img src="images/spacer.gif" width="1" height="24" alt=""></td>
  92. </tr>
  93. <tr>
  94. <td rowspan="7">&nbsp;</td>
  95. <td colspan="3" rowspan="5">
  96. <img src="images/layout_12.jpg" width="64" height="46" alt=""></td>
  97. <td rowspan="2">
  98. <img src="images/layout_13.jpg" width="36" height="12" alt=""></td>
  99. <td colspan="2" rowspan="5">
  100. <img src="images/layout_14.jpg" width="22" height="46" alt=""></td>
  101. <td rowspan="2">
  102. <img src="images/layout_15.jpg" width="58" height="12" alt=""></td>
  103. <td rowspan="5">
  104. <img src="images/layout_16.jpg" width="19" height="46" alt=""></td>
  105. <td rowspan="2">
  106. <img src="images/layout_17.jpg" width="50" height="12" alt=""></td>
  107. <td rowspan="5">
  108. <img src="images/layout_18.jpg" width="19" height="46" alt=""></td>
  109. <td rowspan="2">
  110. <img src="images/layout_19.jpg" width="34" height="12" alt=""></td>
  111. <td colspan="2" rowspan="5">
  112. <img src="images/layout_20.jpg" width="19" height="46" alt=""></td>
  113. <td rowspan="2">
  114. <img src="images/layout_21.jpg" width="48" height="12" alt=""></td>
  115. <td rowspan="5">
  116. <img src="images/layout_22.jpg" width="72" height="46" alt=""></td>
  117. <td rowspan="7">&nbsp;</td>
  118. <td>
  119. <img src="images/spacer.gif" width="1" height="5" alt=""></td>
  120. </tr>
  121. <tr>
  122. <td>
  123. <img src="images/spacer.gif" width="1" height="7" alt=""></form></td>
  124. </tr>
  125. <tr>
  126. <td rowspan="2">
  127. <a href="index.php"><img src="images/layout_28.jpg" alt="" width="36" height="23" border="0"></a></td>
  128. <td rowspan="2">
  129. <a href="index.php?page=2"><img src="images/layout_29.jpg" alt="" width="58" height="23" border="0"></a></td>
  130. <td rowspan="2">
  131. <a href="index.php?page=3"><img src="images/layout_30.jpg" alt="" width="50" height="23" border="0"></a></td>
  132. <td rowspan="2">
  133. <a href="index.php?page=4"><img src="images/layout_31.jpg" alt="" width="34" height="23" border="0"></a></td>
  134. <td rowspan="2">
  135. <a href="index.php?page=5"><img src="images/layout_32.jpg" alt="" width="48" height="23" border="0"></a></td>
  136. <td>
  137. <img src="images/spacer.gif" width="1" height="19" alt=""></td>
  138. </tr>
  139. <tr>
  140. <td>
  141. <img src="images/spacer.gif" width="1" height="4" alt=""></td>
  142. </tr>
  143. <tr>
  144. <td>
  145. <img src="images/layout_34.jpg" width="36" height="11" alt=""></td>
  146. <td>
  147. <img src="images/layout_35.jpg" width="58" height="11" alt=""></td>
  148. <td>
  149. <img src="images/layout_36.jpg" width="50" height="11" alt=""></td>
  150. <td>
  151. <img src="images/layout_37.jpg" width="34" height="11" alt=""></td>
  152. <td>
  153. <img src="images/layout_38.jpg" width="48" height="11" alt=""></td>
  154. <td>
  155. <img src="images/spacer.gif" width="1" height="11" alt=""></td>
  156. </tr>
  157. <tr>
  158. <td colspan="15" rowspan="2">&nbsp;</td>
  159. <td>
  160. <img src="images/spacer.gif" width="1" height="12" alt=""></td>
  161. </tr>
  162. <tr>
  163. <td colspan="8">&nbsp;</td>
  164. <td>
  165. <img src="images/spacer.gif" width="1" height="8" alt=""></td>
  166. </tr>
  167. <tr>
  168. <td colspan="26">
  169. <img src="images/layout_41.jpg" width="750" height="16" alt=""></td>
  170. <td>
  171. <img src="images/spacer.gif" width="1" height="16" alt=""></td>
  172. </tr>
  173. <tr>
  174. <td colspan="2">&nbsp;</td>
  175. <td style="background-image:url(images/layout_43.jpg);"> </td>
  176. <td colspan="18" valign="top">
  177. <div id="main">
  178. <?php
  179. if (file_exists('afbeeldingen/'.$page.'.jpg')) { ?>
  180. <div id="main_af"><img src="afbeeldingen/<?php echo $page;?>.jpg"></div>
  181. <?php } ?>
  182. <?php
  183. if (!isset($_GET['id'])) {
  184. // text opbouwen uit database
  185. echo $text;
  186. }
  187. ?>
  188.  
  189. <?php
  190. if(isset($_GET['page']) && $_GET['page'] == 5) {
  191. include('includes/mail.inc.php');
  192. }
  193. if(isset($_GET['page']) && $_GET['page'] == 3 && !isset($_GET['id'])) {
  194. include('includes/album.inc.php');
  195. } elseif($_GET['page'] == 3 && isset($_GET['id'])) {
  196. include('includes/galerij.inc.php');
  197. }
  198. ?>
  199. </div>
  200. <?php
  201. if($_SESSION['KT_level'] == 1 && !$_GET['id']) {
  202. echo "<img src=\"icoons/1018.gif\" alt=\"bewerken\" onClick=\"javascript:edit()\" style=\"cursor:pointer\"/></div>";
  203. }
  204. if ($_SESSION['KT_level'] == 1 && $_GET['page'] == 3 && !$_GET['id']) {
  205. echo "<img src=\"icoons/1278.gif\" alt=\"foto toevoegen\" onClick=\"javascript:fadd()\" style=\"cursor:pointer\"/>";
  206. echo "<img src=\"icoons/1569.gif\" alt=\"album toevoegen\" onClick=\"javascript:aadd()\" style=\"cursor:pointer\"/>";
  207. } ?>
  208.  
  209. </td>
  210. <td colspan="2" style="background-image:url(images/layout_45.jpg)"> </td>
  211. <td>
  212. <img src="images/layout_46.jpg" width="1" height="347" alt=""></td>
  213. <td colspan="2">&nbsp;</td>
  214. <td>
  215. <img src="images/spacer.gif" width="1" height="347" alt=""></td>
  216. </tr>
  217. <tr>
  218. <td colspan="26">
  219. <img src="images/layout_48.jpg" width="750" height="23" alt=""></td>
  220. <td>
  221. <img src="images/spacer.gif" width="1" height="23" alt=""></td>
  222. </tr>
  223. <tr>
  224. <td colspan="26">
  225. <div id="copyright"> &copy; 2005 by T.
  226. Rodenhuis || &reg; 2005 by <a href="http://www.d-power.nl">D-tec</a> webmanagement </div></td>
  227. <td>
  228. <img src="images/spacer.gif" width="1" height="28" alt=""></td>
  229. </tr>
  230. <tr>
  231. <td>
  232. <img src="images/spacer.gif" width="23" height="1" alt=""></td>
  233. <td>
  234. <img src="images/spacer.gif" width="18" height="1" alt=""></td>
  235. <td>
  236. <img src="images/spacer.gif" width="8" height="1" alt=""></td>
  237. <td>
  238. <img src="images/spacer.gif" width="38" height="1" alt=""></td>
  239. <td>
  240. <img src="images/spacer.gif" width="36" height="1" alt=""></td>
  241. <td>
  242. <img src="images/spacer.gif" width="14" height="1" alt=""></td>
  243. <td>
  244. <img src="images/spacer.gif" width="8" height="1" alt=""></td>
  245. <td>
  246. <img src="images/spacer.gif" width="58" height="1" alt=""></td>
  247. <td>
  248. <img src="images/spacer.gif" width="19" height="1" alt=""></td>
  249. <td>
  250. <img src="images/spacer.gif" width="50" height="1" alt=""></td>
  251. <td>
  252. <img src="images/spacer.gif" width="19" height="1" alt=""></td>
  253. <td>
  254. <img src="images/spacer.gif" width="34" height="1" alt=""></td>
  255. <td>
  256. <img src="images/spacer.gif" width="11" height="1" alt=""></td>
  257. <td>
  258. <img src="images/spacer.gif" width="8" height="1" alt=""></td>
  259. <td>
  260. <img src="images/spacer.gif" width="48" height="1" alt=""></td>
  261. <td>
  262. <img src="images/spacer.gif" width="72" height="1" alt=""></td>
  263. <td>
  264. <img src="images/spacer.gif" width="28" height="1" alt=""></td>
  265. <td>
  266. <img src="images/spacer.gif" width="38" height="1" alt=""></td>
  267. <td>
  268. <img src="images/spacer.gif" width="15" height="1" alt=""></td>
  269. <td>
  270. <img src="images/spacer.gif" width="133" height="1" alt=""></td>
  271. <td>
  272. <img src="images/spacer.gif" width="10" height="1" alt=""></td>
  273. <td>
  274. <img src="images/spacer.gif" width="5" height="1" alt=""></td>
  275. <td>
  276. <img src="images/spacer.gif" width="4" height="1" alt=""></td>
  277. <td>
  278. <img src="images/spacer.gif" width="1" height="1" alt=""></td>
  279. <td>
  280. <img src="images/spacer.gif" width="41" height="1" alt=""></td>
  281. <td>
  282. <img src="images/spacer.gif" width="11" height="1" alt=""></td>
  283. <td></td>
  284. </tr>
  285. </table>
  286. <!-- End ImageReady Slices -->
  287. </center>
  288. </body>
  289. </html>


het probleem is dat ik al headers heb verstuurd. met de inlog pagina.

hier de include voor het album overzicht:
  1. <?php
  2. $query = "SELECT * FROM `fotoalbum` WHERE actief=1";
  3. $result = mysql_query($query);
  4.  
  5. while($album = mysql_fetch_array($result)) {
  6. $qfoto = "SELECT * FROM `fotoboek` WHERE `album_id`='$album[0]' LIMIT 1";
  7. $qresult = mysql_query($qfoto);
  8. $farray = mysql_fetch_array($qresult);
  9. ?>
  10. <table width="259" border="0" cellpadding="0" cellspacing="0" id="album_box">
  11. <tr>
  12. <td width="150" rowspan="3"><a href="index.php?page=<?php echo $page?>&amp;id=<?php print $album[0]; ?>"><img src="foto/thumb/<?php echo $farray[2]; ?>" width="150" height="113" border="0" /></a></td>
  13. <th width="109" height="27"><?php print $album[1]; ?></th>
  14. </tr>
  15. <tr>
  16. <td height="66"><?php print $album[2]; ?></td>
  17. </tr>
  18. <tr>
  19. <td>
  20. <?php
  21. print date("d-m-Y",$album[6]);
  22. if($_SESSION['KT_level'] == 1 && $_GET['page'] == 3) {
  23. echo '<img src="icoons/del.png" onclick="javascript:delalbum('.$album[0].')" style="cursor:pointer" />';
  24. }
  25. ?></td>
  26. </tr>
  27. </table>
  28. <br />
  29. <? } ?>


de site kan gevonden worden op http://212.182.138.216/T/www.toomie.nl/index.php ( testserver )

Ik heb al geprobeert om Ob_start() te gebruiken maar ook dan heb ik nix. iemand die nog een idee heeft? Ik loop helemaal vast op dit probleem.

2 antwoorden

Gesponsorde links
Offline Thomas - 23/01/2006 07:42
Avatar van Thomas Moderator Die header-code wordt gewoon uitgevoerd meteen als je pagina wordt geladen.

Probeer het eens met:
  1. // true php code
  2. window.location = 'beheer/album_verwijder.php?album='+id;
Offline Explosive - 23/01/2006 19:01
Avatar van Explosive Lid Hartelijk bedankt voor je reactie 
Het werkt nu, mijn post kan op slot 
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.222s