Ik heb voor een gastenboek (onder andere) dit scriptje 'geleend' van hotscripts:
Wat er dus gebeurd is dat het eerder ingevulde bericht in de DB wordt gezet. Dan krijg je een link met 'ga terug'. Dit wil ik echter niet, ik wil dat de user automatisch teruggaat. Dit zou kunnen met een META-refresh, maar als ik die bovenaan zet dan wordt de code niet uitgevoerd (toch?) zodat het bericht niet geplaatst wordt. Wat ik dus eigenlijk wil is dat er op of na deze regel:
iets komt, waardoor de user naar een ander php document wordt verwezen, wat geplaatst wordt over 'dit document heen' (target="_self") in het iframe waar het in staat.
Het script in de praktijk is te vinden op www.supersop.nl onder het kopje "sop-outs".
Alvast bedankt!
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
| <?php /* Aplomb Guestbook - Version 2.0 Copyright (C) 2002 Aplomb Scripts http://www.global-centre.com/aplomb/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // Include the Configuration require "config.php"; // Include the Header require "templates/header.inc"; // Checks if the user wants to view the form or add a entry if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) { // Make sure the script works if register_globals is off $name = $HTTP_POST_VARS['name']; $post = $HTTP_POST_VARS['post']; // Process the Information Entered and Remove Stuff $post = strip_tags($post, $allowed_html_tags); // Strip HTML $post = stripslashes($post); // Strip Slashes // Define the Time and the IP $time = date("F jS Y, h:iA"); $ip = $REMOTE_ADDR; if ($addtotop == "0" ) { // Writes the user's entry to a file $fp = fopen("db/posts.php", "a"); fputs($fp, "<p><span class=\"post\"><b>Gepost door: " . $name . "</b><br>" . $post . "</span></p><p></p>"); fclose($fp); } if ($addtotop == "1" ) { // Get all the current entries and put it in a string $att1 = "db/posts.php"; $att2 = fopen ($att1, "rb"); $currententries = fread ($att2, filesize ($att1)); fclose ($att2); // Writes the user's post to a file $fp = fopen("db/posts.php", "w+"); fputs($fp, "<p><span class=\"post\"><b>Gepost door: " . $name . "</b><br>" . $post . "</span></p><p></p>".$currententries); fclose($fp); } // Thank user for post echo "Bericht geplaatst<br><a href=\"view.php\"><br>Ga terug</a><br><br>"; } else { require "templates/post_form.inc"; } // Include the Footer require "templates/footer.inc" ?> |
Wat er dus gebeurd is dat het eerder ingevulde bericht in de DB wordt gezet. Dan krijg je een link met 'ga terug'. Dit wil ik echter niet, ik wil dat de user automatisch teruggaat. Dit zou kunnen met een META-refresh, maar als ik die bovenaan zet dan wordt de code niet uitgevoerd (toch?) zodat het bericht niet geplaatst wordt. Wat ik dus eigenlijk wil is dat er op of na deze regel:
PHP:
1
| echo "Bericht geplaatst<br><a href=\"view.php\"><br>Ga terug</a><br><br>"; |
iets komt, waardoor de user naar een ander php document wordt verwezen, wat geplaatst wordt over 'dit document heen' (target="_self") in het iframe waar het in staat.
Het script in de praktijk is te vinden op www.supersop.nl onder het kopje "sop-outs".
Alvast bedankt!
leoaq.fm // Jeune Loop