soort van forum
ik ga een keer met een action van een form naar deze pagina terug en dan komt dit
action="gameforum.php?action="' . $_GET['action'] . '"
maar als action 9 moet zijn om te werken komt er in de link '9' te staan waardoor het niet werkt.
wat er ook vaag is, is dat bij de lijst van alle topics alle topics even vaak worde herhaald als het aantal posts die zijn gemaakt. waarom dat is zou ik ook niet weten. dus jullie hulp is erg handig nu.
de code van de pagina staat hieronder:
ps. ik zou het graag in 1 pagina houden als dat mogelijk is. als dat ni kan moete jullie dat maar zeggen
ow en title en content worden gelinkt naar een layout pagina dus in die 2 variabelen staat wat er te zien wordt
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
110
111
112
113
114
115
116
117
118
119
120
121
122
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
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
include("../connect.php");
if ( !isset( $_SESSION['clearance'] ) )
{
header("location: ../index.php");
}
//include statusbar with the player array
include ("statusbar.php");
//checks if its a reply
if(!empty($_GET['action']))
{
$title = 'Replys';
//when placed a message put info in database
if ( isset($_POST['replymessage']) )
{
mysql_query("INSERT INTO gameforumreply (gameforum_reply_from, gameforum_reply_time, gameforum_reply_message, gameforum_id)
VALUES('" . $_SESSION['username'] . "','" . time() . "','" . $_POST['replymessage'] . "','" . $_GET['action'] . "')")
or die(mysql_error());
unset($_POST['replymessage']);
header("Location: gameforum.php?action='" . $_GET['action'] . "'");
}
//give the info from replys
else
{
$replys = mysql_query("SELECT * FROM gameforumreply WHERE gameforum_id= '" . $_GET['action'] . "'")or die(mysql_error());
$gettopic = mysql_query("SELECT * FROM gameforum WHERE gameforum_id='" . $_GET['action'] . "'")or die(mysql_error());
$topicinfo = mysql_fetch_array($gettopic);
$content = '<table border =1>
<tr>
<td><div style="width:300px;">' . $topicinfo['gameforum_topic_title'] . '</div></td>
<td><div style="width:150px;">' . $topicinfo['username'] . '</div></td>
<td><div style="width:100px;">' . date("d-m-Y H:i:s",$topicinfo['gameforum_time']) . '</div></td>
</tr>
<tr>
<td colspan="3"><div style="text-align:left;">' . $topicinfo['gameforum_message'] . '</div></td>
</tr>
</table><br />
';
while( $replylist = mysql_fetch_array( $replys ) )
{
$content .= '<table border="1">
<tr>
<td colspan="2">' . $replylist['gameforum_reply_from'] . '</td>
<td>' . date("d-m-Y H:i:s" ,$replylist['gameforum_reply_time']) . '</td>
</tr>
<tr>
<td colspan="3"><div style="text-align:left;width:600px;">' . $replylist['gameforum_reply_message'] . '
</a></div></td>
</tr>
</table><br />
';
}
$content .= '<form name="gameforumreply" method="post" action="gameforum.php?action="' . $_GET['action'] . '"">
New Reply :<br />
<textarea rows="7" cols="60" name="replymessage"></textarea><br />
<input type="submit" value="Place" /><input type="reset" value="empty" />
</form>';
}
}
//end reply
else
//start topic
{
//checks for new topic and adds it in database
if ( isset($_POST['topic']) )
{
mysql_query("INSERT INTO gameforum (username, gameforum_topic_title, gameforum_time, gameforum_message)
VALUES('" . $_SESSION['username'] . "', '" . $_POST['topic'] . "','" . time() . "','" . $_POST['topicmessage'] . "')")
or die(mysql_error());
$last_id = mysql_insert_id();
header("Location: gameforum.php?action='" . $last_id . "'");
}
//else give list for topics with posibility to start one
else
{
$title = 'topics';
//gets title, timefrom topic, time from last reply and the id of topic
$topics = mysql_query("SELECT gameforum.gameforum_topic_title, gameforum.gameforum_time, gameforum.gameforum_id,
gameforumreply.gameforum_reply_time
FROM gameforum, gameforumreply ORDER BY gameforum.gameforum_important DESC,
gameforumreply.gameforum_reply_time DESC, gameforum.gameforum_time DESC")
or die(mysql_error());
$content = '<div style="font-size: 12px;"><table border = "1">';
//makes the list of topics
while( $topiclist = mysql_fetch_array( $topics ) )
{
$content .= ' <tr>
<td><div style="text-align:left;width:500px;"><a href="gameforum.php?action=
' . $topiclist['gameforum_id'] . '">' . $topiclist['gameforum_topic_title'] . '</a></div></td>
</tr>
';
}
$content .= '</table></div>
<br />
<form name="gameforumtopic" method="post" action="gameforum.php">
New Topic :<br />
<input name="topic" type="text" size="70" maxlength="70" /><br />
Message:<br />
<textarea rows="7" cols="60" name="topicmessage"></textarea><br />
<input type="submit" value="Place" /><input type="reset" value="empty" />
</form>';
}
}
include("forumlayout.php");
?>
include("../connect.php");
if ( !isset( $_SESSION['clearance'] ) )
{
header("location: ../index.php");
}
//include statusbar with the player array
include ("statusbar.php");
//checks if its a reply
if(!empty($_GET['action']))
{
$title = 'Replys';
//when placed a message put info in database
if ( isset($_POST['replymessage']) )
{
mysql_query("INSERT INTO gameforumreply (gameforum_reply_from, gameforum_reply_time, gameforum_reply_message, gameforum_id)
VALUES('" . $_SESSION['username'] . "','" . time() . "','" . $_POST['replymessage'] . "','" . $_GET['action'] . "')")
or die(mysql_error());
unset($_POST['replymessage']);
header("Location: gameforum.php?action='" . $_GET['action'] . "'");
}
//give the info from replys
else
{
$replys = mysql_query("SELECT * FROM gameforumreply WHERE gameforum_id= '" . $_GET['action'] . "'")or die(mysql_error());
$gettopic = mysql_query("SELECT * FROM gameforum WHERE gameforum_id='" . $_GET['action'] . "'")or die(mysql_error());
$topicinfo = mysql_fetch_array($gettopic);
$content = '<table border =1>
<tr>
<td><div style="width:300px;">' . $topicinfo['gameforum_topic_title'] . '</div></td>
<td><div style="width:150px;">' . $topicinfo['username'] . '</div></td>
<td><div style="width:100px;">' . date("d-m-Y H:i:s",$topicinfo['gameforum_time']) . '</div></td>
</tr>
<tr>
<td colspan="3"><div style="text-align:left;">' . $topicinfo['gameforum_message'] . '</div></td>
</tr>
</table><br />
';
while( $replylist = mysql_fetch_array( $replys ) )
{
$content .= '<table border="1">
<tr>
<td colspan="2">' . $replylist['gameforum_reply_from'] . '</td>
<td>' . date("d-m-Y H:i:s" ,$replylist['gameforum_reply_time']) . '</td>
</tr>
<tr>
<td colspan="3"><div style="text-align:left;width:600px;">' . $replylist['gameforum_reply_message'] . '
</a></div></td>
</tr>
</table><br />
';
}
$content .= '<form name="gameforumreply" method="post" action="gameforum.php?action="' . $_GET['action'] . '"">
New Reply :<br />
<textarea rows="7" cols="60" name="replymessage"></textarea><br />
<input type="submit" value="Place" /><input type="reset" value="empty" />
</form>';
}
}
//end reply
else
//start topic
{
//checks for new topic and adds it in database
if ( isset($_POST['topic']) )
{
mysql_query("INSERT INTO gameforum (username, gameforum_topic_title, gameforum_time, gameforum_message)
VALUES('" . $_SESSION['username'] . "', '" . $_POST['topic'] . "','" . time() . "','" . $_POST['topicmessage'] . "')")
or die(mysql_error());
$last_id = mysql_insert_id();
header("Location: gameforum.php?action='" . $last_id . "'");
}
//else give list for topics with posibility to start one
else
{
$title = 'topics';
//gets title, timefrom topic, time from last reply and the id of topic
$topics = mysql_query("SELECT gameforum.gameforum_topic_title, gameforum.gameforum_time, gameforum.gameforum_id,
gameforumreply.gameforum_reply_time
FROM gameforum, gameforumreply ORDER BY gameforum.gameforum_important DESC,
gameforumreply.gameforum_reply_time DESC, gameforum.gameforum_time DESC")
or die(mysql_error());
$content = '<div style="font-size: 12px;"><table border = "1">';
//makes the list of topics
while( $topiclist = mysql_fetch_array( $topics ) )
{
$content .= ' <tr>
<td><div style="text-align:left;width:500px;"><a href="gameforum.php?action=
' . $topiclist['gameforum_id'] . '">' . $topiclist['gameforum_topic_title'] . '</a></div></td>
</tr>
';
}
$content .= '</table></div>
<br />
<form name="gameforumtopic" method="post" action="gameforum.php">
New Topic :<br />
<input name="topic" type="text" size="70" maxlength="70" /><br />
Message:<br />
<textarea rows="7" cols="60" name="topicmessage"></textarea><br />
<input type="submit" value="Place" /><input type="reset" value="empty" />
</form>';
}
}
include("forumlayout.php");
?>
Gewijzigd op 01/01/1970 01:00:00 door Tim
stond in je verhaaltje hier boven, ik ga je code niet lezen. maar lees die regel is goed en bedenk dan hoe het komt.
maarja ik maak et nu in 2 paginas en dat doorsturen lukt nu wel
ik heb nog 1 probleem nu en dat is met de volgorde van de topiclijst.
ik probeer et zelf eerst nog ff en daarna kom ik miss naar jullie met nog een vraagje