Posted on Saturday 16th August 2008 at 05:10 PM |
Vic Vance
Active Member |
I saw UrbanTwitch,tutorail, and I must say thank you soo much. However I found it a bit confusing to understand.I need help on making the tutorail work for me. I tried and to be honest it did not work. No bb codes got inserted into the text area when I clicked the buttons. Pleaase help this is my PMS.php
PHP Code
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<?php
session_start(); //Start session
if(!$logged[id]){ //Check if user is logged in
header("Location: index.php?page=home&i=6");
}else{ //Their loggedin
switch($_GET[act]){ //make some links ?page=case
default: //set up the default page upon going to pms.php
$msgs = mysql_query("SELECT * FROM `privates` WHERE `to` = '" . $logged[username] . "' ORDER BY `pid` ASC") or die(mysql_error()); //get all the messages to the loged in user
echo "<div align='left'><font size='4'><strong>Private Messages</strong></font>
</div>
</div>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='21' align='left' class='row1' scope='col'>Page Location » Private Messages » In Box</td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' cellpadding='2' cellspacing='1' class='box'>
<tr>
<td height='18' align='left' class='row2' scope='col'>Options</td>
</tr>
<tr>
<td height='20' align='left' class='row1' scope='col'><a href=\"?page=pms&act=compose\">» Compose Message</a></td>
</tr>
<tr>
<td height='20' align='left' class='row1' scope='col'><a href=\"?page=pms&act=delall\"> » Delete All Messages</a></td>
</tr>
</table>"; //echo the start5 table and create msg link/delete all links!
if(mysql_num_rows($msgs) == 0){ //check if there are messages or not
echo "<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='18' colspan='5' align='left' class='row2' scope='col'>In Box</td>
</tr>
<tr>
<td width='266' height='15' class='row3' scope='col'><div align='center'>Subject </div></td>
<td width='266' class='row3' scope='col'><div align='center'>From</div></td>
<td width='479' class='row3' scope='col'><div align='center'>Date</div></td>
<td width='266' class='row3' scope='col'><div align='center'>Status</div></td>
<th width='124' class='row3' scope='col'></th>
</tr>
<tr>
<td height='18' colspan='5' align='left' class='row1' scope='col'>You Have No New Messages!</td>
</tr>
</table>
<table width='100%' cellpadding=\'0\' cellspacing=\'0\'>
<tr>
<td align=\'center\' valign=\'middle\' width='100%'>"; //no new messages
}else{ //or if there are messages
echo "<table width='101%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>";
echo "<table width='100%' border='0' cellpadding='3' cellspacing='1'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='18' colspan='5' align='left' class='row2' scope='col'>In Box</td>
</tr>
<tr>
<td width='266' height='15' class='row3' scope='col'><div align='center'>Subject </div></td>
<td width='266' class='row3' scope='col'><div align='center'>From</div></td>
<td width='479' class='row3' scope='col'><div align='center'>Date</div></td>
<td width='266' class='row3' scope='col'><div align='center'>Status</div></td>
<th width='124' class='row3' scope='col'></th>
</tr>";
while($r = mysql_fetch_array($msgs)){ //repeat for all the messages
echo "<tr>
<td align='center' class='row1' scope='col'><a href=\"?page=pms&act=view&id=$r[pid]\">$r[subject]</a></td>
<td align='center' class='row1' scope='col'><a href=\"members.php?user=$r[from]\"><a href=\"members.php?user=$r[from]\">$r[from]</a></td>
<td align='center' class='row1' scope='col'>$r[date]</td>
<td align='center' class='row1' scope='col'>$r[status]</td>
<td align='center' class='row1' scope='col'><a href=\"?page=pms&act=delete&id=$r[pid]\"><img src='images/Icons/delete.png'></a></td>
</tr>"; //echo the messages
} //end while
} //end message amount check echo
echo "</table>"; //end table
break; //end the default page
case 'view': //define the view page
$id = (int)htmlspecialchars(strip_tags($_GET[id])); //make the ID safe
if(!$id){ //if there is no ID to select
header("Location: index.php?page=pms&i=19");
}else{ //or if there is....
$select = mysql_query("SELECT * FROM `privates` WHERE `pid` = '" . $id . "';"); //get the message's info
$msg = mysql_fetch_array($select); //select all data
if($msg[to] != $logged[username]){ //check if the user logged in is the owner of the message
header("Location: index.php?page=pms&i=20");
}else{ //maybe...
if(!$_POST[reply]) { //if the reply was not submitted
$mark = mysql_query("UPDATE `privates` SET `status` = 'Read' WHERE `pid` = '" . $id . "'") or die(mysql_error()); //mark it as Read
$message = nl2br(stripslashes($msg[content])); //make new lines to and strip the slashes
$subject = stripslashes($msg[subject]); //strip the slashes
echo "<div align='left'><font size='4'><strong>Private Messages</strong></font>
</div>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='21' align='left' class='row1' scope='col'>Page Location » Private Messages » Viewing Messages</td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'>
<form method=\"post\">
<table width='100%' border='0' cellpadding='2' cellspacing='1' class='box'>
<tr>
<td height='18' colspan='2' align='left' class='row2' scope='col'>Message</td>
</tr>
<tr>
<td height='18' colspan='2' align='left' class='row1' scope='col'>» Subject: $subject</td>
</tr>
<tr>
<td height='19' colspan='2' align='left' class='row1' scope='row'>» From: $msg[from]</td>
</tr>
<tr>
<td height='18' colspan='2' align='left' class='row3' scope='row'>» The Message: $message</td>
</tr>
<tr>
<td width='64%' align='left' class='row1' scope='row'>» Your Reply</td>
<td width='36%' align='left' class='row1' scope='row'><div align='right'><a href='?page=bbcode'>BB Code Help?</a></div></td>
</tr>
<tr>
<td colspan='2' align='left' class='row1' scope='row'><center>
<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td width='22%' valign='bottom' scope='col'><div align='left'><font size='1'><FONT COLOR='green'> <A href='?page=bbcode'>BBcode</A> » Enabled
</font></div></td>
<td width='100%' scope='col'><center><textarea name=\"msg\"2 cols=\"45\" rows=\"6\" class='input'></textarea></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan='2' align='left' class='row1' scope='row'><input name=\"reply\" type=\"submit\" class='boxbutton' value=\"Reply\"></td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='21' align='left' class='row1' scope='col'><a href='index.php?page=pms'>Go Back?</a></td>
</tr>
</table>
</form
></td>
</tr>
</table>"; //echo the message and reply box.
}else{ //if the form was submitted
$to = $msg[from]; //get who it is to
$from = $logged[username]; //who its from
$subject = "RE: " . $msg[subject]; //new subject
$msg = addslashes($_POST[msg]); //the content
$date = date("F j, Y, g:i a"); //the date sent
$do = mysql_query("INSERT INTO `privates` (`to`,`from`,`date`,`subject`,`content`) VALUES ('" . $to . "','" . $from . "','" . $date . "','" . $subject . "','" . $msg . "')") or die(mysql_error()); //insert into the table!
header("Location: index.php?page=pms&i=21");
} //end reply check
} //end check posession
} //end id check
break;
case 'compose': //create a new message
echo "<div align='left'><font size='4'><strong>Private Messages</strong></font>
</div>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='21' align='left' class='row1' scope='col'>Page Location » Private Messages » Compose Message</td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>";
echo " <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>";
if(!$_POST[send]){ //if the form was not submitted
echo "<form method=\"post\" action=\"\">
<tr>
<td height='20' colspan='2' align='left' class='row2' scope='row'>Compose Message.</td>
</tr>"; //echo some of the form and whatnot
if(isset($_GET[user])){ //check if there is a user in the address bar
echo "<tr>
<td colspan='2' align='left' class='row1' scope='row'>» To User
<input class='input' type=\"text\" name=\"to\" value=\"$_GET[user]\" size=\"15\">
<span class='imp'>* Provided </span></td>
</tr>";
}else{ //or not..
echo "<tr>
<td colspan='2' align='left' class='row1' scope='row'>» To User
<input class='input' type=\"text\" name=\"to\" size=\"15\">
<span class='imp'>* Required </span></td>
</tr>"; //echo the input box without the value of the user!
} //end user check in address bar
echo "<form>
<tr>
<td width='17%' align='left' class='row1' scope='col'>» Subject:</td>
<td width='83%' align='left' class='row1' scope='col'>
<input name=\"title\" type=\"text\" class='input' value=\"Unitiled Message\" size=\"15\" Message\> </td>
</tr>
<tr>
<td width='22%' align='left' class='row1' scope='row'>» Content</td>
<td width='83%' align='left' class='row1' scope='row'><div align='right'><a href='?page=bbcode'>BB Code Help?</a></div></td>
</tr>
<tr>
<td width='17%' valign='bottom' class='row1' scope='col'><div align='left'><font size='1'><FONT COLOR='green'> <A href='?page=bbcode'>BBcode</A> » Enabled </font></div></td>
<td width='83%' class='row1' scope='col'><center>
<textarea name=\"message\" cols=\"45\" rows=\"6\" class='input'></textarea></td>
</tr>
<tr>
<td colspan='2' align='left' class='row1' scope='row'><input name=\"send\" type=\"submit\" class='boxbutton' value=\"Send Message\"> </td>
</tr>
</form>"; //echo the rest of the form
echo "<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>";
echo "<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='21' align='left' class='row1' scope='col'><a href='index.php?page=pms'>Go Back?</a></td>
</tr>";
echo "</table>";
}else{ //or if it was..
echo "</table>";
echo "</table>";
echo "</table>";
$to = stripslashes(htmlspecialchars(strip_tags($_POST[to]))); //who its to
$from = $logged[username]; //who its from
$date = date("F j, Y, g:i a"); //the date sent
$msg = addslashes($_POST[message]); //the message variable
$subject = addslashes($_POST[title]); //the subject
$do = mysql_query("INSERT INTO `privates` (`to`,`from`,`date`,`subject`,`content`) VALUES ('" . $to . "','" . $from . "','" . $date . "','" . $subject . "','" . $msg . "')") or die(mysql_error()); //insert into the table!
header("Location: index.php?page=pms&i=21");
} //end sent check
break; //end make new msg
case 'delall': //delete all page
$get = mysql_query("SELECT * FROM `privates` WHERE `to` = '" . $logged[username] . "'"); //get the private messages
if(mysql_num_rows($get) == "0"){
header("Location: index.php?page=pms&i=23");
}else{
$delete = mysql_query("DELETE FROM `privates` WHERE `to` = '" . $logged[username] . "'"); //delete tehm
if($delete) { //check if theres a mySQL error
header("Location: index.php?page=pms&i=22"); //success
}else{ //or not
header("Location: index.php?page=pms&i=24");
} //end error check
} //end msg check
break; //end page
case 'delete': //start the delete page!
$id = (int)htmlspecialchars(strip_tags($_GET[id])); //make the ID safe
if(!$id){ //if there is no ID to select
echo "<a href=\"?page=pms\">Go Back</a>No ID Selected!"; //echo the error
}else{ //or if there is....
$select = mysql_query("SELECT * FROM `privates` WHERE `pid` = '" . $id . "'"); //get the message's info
$msg = mysql_fetch_array($select); //select all data
if($msg[to] != $logged[username]){ //check if the user logged in is the owner of the message
header("Location: index.php?page=pms&i=20"); //if not
}else{ //maybe...
$do = mysql_query("DELETE FROM `privates` WHERE `pid` = '" . $id . "'") or die(mysql_error());
header("Location: index.php?page=pms&i=25");
} //end check possession
} //end id check
break; //end the delete page!
} //end switch/get
} //end login check
?>
|
Posted on Saturday 16th August 2008 at 06:34 PM |
UrbanTwitch
Senior Member |
Add maybe... this at the very top inside the PHP?
PHP Code
include ("bbcode.php");
|
Posted on Saturday 16th August 2008 at 06:40 PM |
UrbanTwitch
Senior Member |
Also on line 255:
PHP Code
<textarea name=\"message\" cols=\"45\" rows=\"6\" class='input'></textarea></td>
Make sure to add this inside the <textarea>:
|
Posted on Sunday 17th August 2008 at 10:52 AM |
Vic Vance
Active Member |
I did exactly you said and it still wont insrt codes into the text area
this is that I did can you help
PHP Code
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
<?php
include ("bbcodes.php");
session_start(); //Start session
if(!$logged[id]){ //Check if user is logged in
header("Location: index.php?page=home&i=6");
}else{ //Their loggedin
switch($_GET[act]){ //make some links ?page=case
default: //set up the default page upon going to pms.php
$msgs = mysql_query("SELECT * FROM `privates` WHERE `to` = '" . $logged[username] . "' ORDER BY `pid` ASC") or die(mysql_error()); //get all the messages to the loged in user
echo "<div align='left'><font size='4'><strong>Private Messages</strong></font>
</div>
</div>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='21' align='left' class='row1' scope='col'>Page Location » Private Messages » In Box</td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' cellpadding='2' cellspacing='1' class='box'>
<tr>
<td height='18' align='left' class='row2' scope='col'>Options</td>
</tr>
<tr>
<td height='20' align='left' class='row1' scope='col'><a href=\"?page=pms&act=compose\">» Compose Message</a></td>
</tr>
<tr>
<td height='20' align='left' class='row1' scope='col'><a href=\"?page=pms&act=delall\"> » Delete All Messages</a></td>
</tr>
</table>"; //echo the start5 table and create msg link/delete all links!
if(mysql_num_rows($msgs) == 0){ //check if there are messages or not
echo "<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='18' colspan='5' align='left' class='row2' scope='col'>In Box</td>
</tr>
<tr>
<td width='266' height='15' class='row3' scope='col'><div align='center'>Subject </div></td>
<td width='266' class='row3' scope='col'><div align='center'>From</div></td>
<td width='479' class='row3' scope='col'><div align='center'>Date</div></td>
<td width='266' class='row3' scope='col'><div align='center'>Status</div></td>
<th width='124' class='row3' scope='col'></th>
</tr>
<tr>
<td height='18' colspan='5' align='left' class='row1' scope='col'>You Have No New Messages!</td>
</tr>
</table>
<table width='100%' cellpadding=\'0\' cellspacing=\'0\'>
<tr>
<td align=\'center\' valign=\'middle\' width='100%'>"; //no new messages
}else{ //or if there are messages
echo "<table width='101%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>";
echo "<table width='100%' border='0' cellpadding='3' cellspacing='1'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='18' colspan='5' align='left' class='row2' scope='col'>In Box</td>
</tr>
<tr>
<td width='266' height='15' class='row3' scope='col'><div align='center'>Subject </div></td>
<td width='266' class='row3' scope='col'><div align='center'>From</div></td>
<td width='479' class='row3' scope='col'><div align='center'>Date</div></td>
<td width='266' class='row3' scope='col'><div align='center'>Status</div></td>
<th width='124' class='row3' scope='col'></th>
</tr>";
while($r = mysql_fetch_array($msgs)){ //repeat for all the messages
echo "<tr>
<td align='center' class='row1' scope='col'><a href=\"?page=pms&act=view&id=$r[pid]\">$r[subject]</a></td>
<td align='center' class='row1' scope='col'><a href=\"members.php?user=$r[from]\"><a href=\"members.php?user=$r[from]\">$r[from]</a></td>
<td align='center' class='row1' scope='col'>$r[date]</td>
<td align='center' class='row1' scope='col'>$r[status]</td>
<td align='center' class='row1' scope='col'><a href=\"?page=pms&act=delete&id=$r[pid]\"><img src='images/Icons/delete.png'></a></td>
</tr>"; //echo the messages
} //end while
} //end message amount check echo
echo "</table>"; //end table
break; //end the default page
case 'view': //define the view page
$id = (int)htmlspecialchars(strip_tags($_GET[id])); //make the ID safe
if(!$id){ //if there is no ID to select
$bbmsg = BBCODE($message);
header("Location: index.php?page=pms&i=19");
}else{ //or if there is....
$select = mysql_query("SELECT * FROM `privates` WHERE `pid` = '" . $id . "';"); //get the message's info
$msg = mysql_fetch_array($select); //select all data
if($msg[to] != $logged[username]){ //check if the user logged in is the owner of the message
header("Location: index.php?page=pms&i=20");
}else{ //maybe...
if(!$_POST[reply]) { //if the reply was not submitted
$mark = mysql_query("UPDATE `privates` SET `status` = 'Read' WHERE `pid` = '" . $id . "'") or die(mysql_error()); //mark it as Read
$bbmsg = nl2br(stripslashes($msg[content])); //make new lines to and strip the slashes
$subject = stripslashes($msg[subject]); //strip the slashes
echo "<div align='left'><font size='4'><strong>Private Messages</strong></font>
</div>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='21' align='left' class='row1' scope='col'>Page Location » Private Messages » Viewing Messages</td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'>
<form method=\"post\">
<table width='100%' border='0' cellpadding='2' cellspacing='1' class='box'>
<tr>
<td height='18' colspan='2' align='left' class='row2' scope='col'>Message</td>
</tr>
<tr>
<td height='18' colspan='2' align='left' class='row1' scope='col'>» Subject: $subject</td>
</tr>
<tr>
<td height='19' colspan='2' align='left' class='row1' scope='row'>» From: $msg[from]</td>
</tr>
<tr>
<td height='18' colspan='2' align='left' class='row3' scope='row'>» The Message: $message</td>
</tr>
<tr>
<td width='64%' align='left' class='row1' scope='row'>» Your Reply</td>
<td width='36%' align='left' class='row1' scope='row'><div align='right'><a href='?page=bbcode'>BB Code Help?</a></div></td>
</tr>
<tr>
<td colspan='2' align='left' class='row1' scope='row'><center>
<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td width='22%' valign='bottom' scope='col'><div align='left'><font size='1'><FONT COLOR='green'> <A href='?page=bbcode'>BBcode</A> » Enabled
</font></div></td>
<td width='100%' scope='col'><center><textarea name=\"msg\"2 cols=\"45\" rows=\"6\" class='input'></textarea></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan='2' align='left' class='row1' scope='row'><input name=\"reply\" type=\"submit\" class='boxbutton' value=\"Reply\"></td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='21' align='left' class='row1' scope='col'><a href='index.php?page=pms'>Go Back?</a></td>
</tr>
</table>
</form
></td>
</tr>
</table>"; //echo the message and reply box.
}else{ //if the form was submitted
$to = $msg[from]; //get who it is to
$from = $logged[username]; //who its from
$subject = "RE: " . $msg[subject]; //new subject
$msg = addslashes($_POST[msg]); //the content
$date = date("F j, Y, g:i a"); //the date sent
$do = mysql_query("INSERT INTO `privates` (`to`,`from`,`date`,`subject`,`content`) VALUES ('" . $to . "','" . $from . "','" . $date . "','" . $subject . "','" . $msg . "')") or die(mysql_error()); //insert into the table!
header("Location: index.php?page=pms&i=21");
} //end reply check
} //end check posession
} //end id check
break;
case 'compose': //create a new message
echo "<div align='left'><font size='4'><strong>Private Messages</strong></font>
</div>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='21' align='left' class='row1' scope='col'>Page Location » Private Messages » Compose Message</td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>";
echo " <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>";
if(!$_POST[send]){ //if the form was not submitted
echo "<form method=\"post\" action=\"\">
<tr>
<td height='20' colspan='2' align='left' class='row2' scope='row'>Compose Message.</td>
</tr>"; //echo some of the form and whatnot
if(isset($_GET[user])){ //check if there is a user in the address bar
echo "<tr>
<td colspan='2' align='left' class='row1' scope='row'>» To User
<input class='input' type=\"text\" name=\"to\" value=\"$_GET[user]\" size=\"15\">
<span class='imp'>* Provided </span></td>
</tr>";
}else{ //or not..
echo "<tr>
<td colspan='2' align='left' class='row1' scope='row'>» To User
<input class='input' type=\"text\" name=\"to\" size=\"15\">
<span class='imp'>* Required </span></td>
</tr>"; //echo the input box without the value of the user!
} //end user check in address bar
echo "<form>
<tr>
<td width='17%' align='left' class='row1' scope='col'>» Subject:</td>
<td width='83%' align='left' class='row1' scope='col'>
<input name=\"title\" type=\"text\" class='input' value=\"Unitiled Message\" size=\"15\" Message\> </td>
</tr>
<tr>
<td width='22%' align='left' class='row1' scope='row'>» Content</td>
<td width='83%' align='left' class='row1' scope='row'><div align='right'><a href='?page=bbcode'>BB Code Help?</a></div></td>
</tr>
<tr>
<td width='17%' valign='bottom' class='row1' scope='col'><div align='left'><font size='1'><FONT COLOR='green'> <A href='?page=bbcode'>BBcode</A> » Enabled </font></div></td>
<td width='83%' class='row1' scope='col'><center>
<textarea id=\"TheAreaArea\" name=\"message\" cols=\"45\" rows=\"6\" class='input'></textarea>
<br><div style='padding-left: 5px; padding-top:5px;'>
<input type='button' value='B' name='btnBold' onclick='wrapText(document.getElementById('TheTextArea'),'<b>','</b>');'>
<input type='button' value='I' name='btnItalic' onclick='wrapText(document.getElementById('TheTextArea'),'<i>','</i>');'>
<input type='button' value='U' name='btnUnderline' onclick='wrapText(document.getElementById('TheTextArea'),'<u>','</u>');'>
<input type='button' value='IMG' name='btnImg' onclick='wrapText(document.getElementById('TheTextArea'),'<img src=\"','\" />');''>
<input type='button' value='URL' name='btnUrl' onclick='wrapText(document.getElementById('TheTextArea'),'','');'>
<input type='button' value='PHP' name='btnPHP' onclick='wrapText(document.getElementById('TheTextArea'),'[php]','
');'></div></td>
</tr>
<tr>
<td colspan='2' align='left' class='row1' scope='row'><input name=\"send\" type=\"submit\" class='boxbutton' value=\"Send Message\"> </td>
</tr>
</form>"; //echo the rest of the form
echo "<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>";
echo "<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='21' align='left' class='row1' scope='col'><a href='index.php?page=pms'>Go Back?</a></td>
</tr>";
echo "</table>";
}else{ //or if it was..
echo "</table>";
echo "</table>";
echo "</table>";
$to = stripslashes(htmlspecialchars(strip_tags($_POST[to]))); //who its to
$from = $logged[username]; //who its from
$date = date("F j, Y, g:i a"); //the date sent
$msg = addslashes($_POST[message]); //the message variable
$subject = addslashes($_POST[title]); //the subject
$do = mysql_query("INSERT INTO `privates` (`to`,`from`,`date`,`subject`,`content`) VALUES ('" . $to . "','" . $from . "','" . $date . "','" . $subject . "','" . $msg . "')") or die(mysql_error()); //insert into the table!
header("Location: index.php?page=pms&i=21");
} //end sent check
break; //end make new msg
case 'delall': //delete all page
$get = mysql_query("SELECT * FROM `privates` WHERE `to` = '" . $logged[username] . "'"); //get the private messages
if(mysql_num_rows($get) == "0"){
header("Location: index.php?page=pms&i=23");
}else{
$delete = mysql_query("DELETE FROM `privates` WHERE `to` = '" . $logged[username] . "'"); //delete tehm
if($delete) { //check if theres a mySQL error
header("Location: index.php?page=pms&i=22"); //success
}else{ //or not
header("Location: index.php?page=pms&i=24");
} //end error check
} //end msg check
break; //end page
case 'delete': //start the delete page!
$id = (int)htmlspecialchars(strip_tags($_GET[id])); //make the ID safe
if(!$id){ //if there is no ID to select
echo "<a href=\"?page=pms\">Go Back</a>No ID Selected!"; //echo the error
}else{ //or if there is....
$select = mysql_query("SELECT * FROM `privates` WHERE `pid` = '" . $id . "'"); //get the message's info
$msg = mysql_fetch_array($select); //select all data
if($msg[to] != $logged[username]){ //check if the user logged in is the owner of the message
header("Location: index.php?page=pms&i=20"); //if not
}else{ //maybe...
$do = mysql_query("DELETE FROM `privates` WHERE `pid` = '" . $id . "'") or die(mysql_error());
header("Location: index.php?page=pms&i=25");
} //end check possession
} //end id check
break; //end the delete page!
} //end switch/get
} //end login check
?>
|
Posted on Monday 18th August 2008 at 06:19 AM |
UrbanTwitch
Senior Member |
Line 257:
PHP Code
<textarea id=\"TheAreaArea\" name=\"message\" cols=\"45\" rows=\"6\" class='input'></textarea>
You have Area twice. :P It should be TheTextArea |
Posted on Monday 18th August 2008 at 10:23 AM |
Vic Vance
Active Member |
Do you mean "TheAreaArea" should be "TheTextArea"? If so, it doesn't help. |
Posted on Monday 18th August 2008 at 10:34 AM |
Vic Vance
Active Member |
Wait. It works now. I forgot the java BUT now the problem is I cant view my messages in view PLEASEEE HELPPP I messep up now HELLLP
PHP Code
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
function wrapText(el, openTag, closeTag) {
if (el.setSelectionRange) {
// W3C/Mozilla
el.value = el.value.substring(0,el.selectionStart) + openTag + el.value.substring(el.selectionStart,el.selectionEnd) + closeTag + el.value.substring(el.selectionEnd,el.value.length);
}
else if (document.selection && document.selection.createRange) {
// IE code goes here
el.focus(); //or else text is added to the activating control
var range = document.selection.createRange();
range.text = openTag + range.text + closeTag;
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
include ("bbcodes.php");
session_start(); //Start session
if(!$logged[id]){ //Check if user is logged in
header("Location: index.php?page=home&i=6");
}else{ //Their loggedin
switch($_GET[act]){ //make some links ?page=case
default: //set up the default page upon going to pms.php
$msgs = mysql_query("SELECT * FROM `privates` WHERE `to` = '" . $logged[username] . "' ORDER BY `pid` ASC") or die(mysql_error()); //get all the messages to the loged in user
echo "<div align='left'><font size='4'><strong>Private Messages</strong></font>
</div>
</div>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='21' align='left' class='row1' scope='col'>Page Location » Private Messages » In Box</td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' cellpadding='2' cellspacing='1' class='box'>
<tr>
<td height='18' align='left' class='row2' scope='col'>Options</td>
</tr>
<tr>
<td height='20' align='left' class='row1' scope='col'><a href=\"?page=pms&act=compose\">» Compose Message</a></td>
</tr>
<tr>
<td height='20' align='left' class='row1' scope='col'><a href=\"?page=pms&act=delall\"> » Delete All Messages</a></td>
</tr>
</table>"; //echo the start5 table and create msg link/delete all links!
if(mysql_num_rows($msgs) == 0){ //check if there are messages or not
echo "<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='18' colspan='5' align='left' class='row2' scope='col'>In Box</td>
</tr>
<tr>
<td width='266' height='15' class='row3' scope='col'><div align='center'>Subject </div></td>
<td width='266' class='row3' scope='col'><div align='center'>From</div></td>
<td width='479' class='row3' scope='col'><div align='center'>Date</div></td>
<td width='266' class='row3' scope='col'><div align='center'>Status</div></td>
<th width='124' class='row3' scope='col'></th>
</tr>
<tr>
<td height='18' colspan='5' align='left' class='row1' scope='col'>You Have No New Messages!</td>
</tr>
</table>
<table width='100%' cellpadding=\'0\' cellspacing=\'0\'>
<tr>
<td align=\'center\' valign=\'middle\' width='100%'>"; //no new messages
}else{ //or if there are messages
echo "<table width='101%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>";
echo "<table width='100%' border='0' cellpadding='3' cellspacing='1'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='18' colspan='5' align='left' class='row2' scope='col'>In Box</td>
</tr>
<tr>
<td width='266' height='15' class='row3' scope='col'><div align='center'>Subject </div></td>
<td width='266' class='row3' scope='col'><div align='center'>From</div></td>
<td width='479' class='row3' scope='col'><div align='center'>Date</div></td>
<td width='266' class='row3' scope='col'><div align='center'>Status</div></td>
<th width='124' class='row3' scope='col'></th>
</tr>";
while($r = mysql_fetch_array($msgs)){ //repeat for all the messages
echo "<tr>
<td align='center' class='row1' scope='col'><a href=\"?page=pms&act=view&id=$r[pid]\">$r[subject]</a></td>
<td align='center' class='row1' scope='col'><a href=\"members.php?user=$r[from]\"><a href=\"members.php?user=$r[from]\">$r[from]</a></td>
<td align='center' class='row1' scope='col'>$r[date]</td>
<td align='center' class='row1' scope='col'>$r[status]</td>
<td align='center' class='row1' scope='col'><a href=\"?page=pms&act=delete&id=$r[pid]\"><img src='images/Icons/delete.png'></a></td>
</tr>"; //echo the messages
} //end while
} //end message amount check echo
echo "</table>"; //end table
break; //end the default page
case 'view': //define the view page
$id = (int)htmlspecialchars(strip_tags($_GET[id])); //make the ID safe
if(!$id){ //if there is no ID to select
$bbmsg = BBCODE($message);
header("Location: index.php?page=pms&i=19");
}else{ //or if there is....
$select = mysql_query("SELECT * FROM `privates` WHERE `pid` = '" . $id . "';"); //get the message's info
$msg = mysql_fetch_array($select); //select all data
if($msg[to] != $logged[username]){ //check if the user logged in is the owner of the message
header("Location: index.php?page=pms&i=20");
}else{ //maybe...
if(!$_POST[reply]) { //if the reply was not submitted
$mark = mysql_query("UPDATE `privates` SET `status` = 'Read' WHERE `pid` = '" . $id . "'") or die(mysql_error()); //mark it as Read
$bbmsg = nl2br(stripslashes($msg[content])); //make new lines to and strip the slashes
$subject = stripslashes($msg[subject]); //strip the slashes
echo "<div align='left'><font size='4'><strong>Private Messages</strong></font>
</div>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='21' align='left' class='row1' scope='col'>Page Location » Private Messages » Viewing Messages</td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'>
<form method=\"post\">
<table width='100%' border='0' cellpadding='2' cellspacing='1' class='box'>
<tr>
<td height='18' colspan='2' align='left' class='row2' scope='col'>Message</td>
</tr>
<tr>
<td height='18' colspan='2' align='left' class='row1' scope='col'>» Subject: $subject</td>
</tr>
<tr>
<td height='19' colspan='2' align='left' class='row1' scope='row'>» From: $msg[from]</td>
</tr>
<tr>
<td height='18' colspan='2' align='left' class='row3' scope='row'>» The Message: $message</td>
</tr>
<tr>
<td width='64%' align='left' class='row1' scope='row'>» Your Reply</td>
<td width='36%' align='left' class='row1' scope='row'><div align='right'><a href='?page=bbcode'>BB Code Help?</a></div></td>
</tr>
<tr>
<td colspan='2' align='left' class='row1' scope='row'><center>
<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td width='22%' valign='bottom' scope='col'><div align='left'><font size='1'><FONT COLOR='green'> <A href='?page=bbcode'>BBcode</A> » Enabled
</font></div></td>
<td width='100%' scope='col'><center><textarea name=\"msg\"2 cols=\"45\" rows=\"6\" class='input'></textarea></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan='2' align='left' class='row1' scope='row'><input name=\"reply\" type=\"submit\" class='boxbutton' value=\"Reply\"></td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='21' align='left' class='row1' scope='col'><a href='index.php?page=pms'>Go Back?</a></td>
</tr>
</table>
</form
></td>
</tr>
</table>"; //echo the message and reply box.
}else{ //if the form was submitted
$to = $msg[from]; //get who it is to
$from = $logged[username]; //who its from
$subject = "RE: " . $msg[subject]; //new subject
$msg = addslashes($_POST[msg]); //the content
$date = date("F j, Y, g:i a"); //the date sent
$do = mysql_query("INSERT INTO `privates` (`to`,`from`,`date`,`subject`,`content`) VALUES ('" . $to . "','" . $from . "','" . $date . "','" . $subject . "','" . $msg . "')") or die(mysql_error()); //insert into the table!
header("Location: index.php?page=pms&i=21");
} //end reply check
} //end check posession
} //end id check
break;
case 'compose': //create a new message
echo "<div align='left'><font size='4'><strong>Private Messages</strong></font>
</div>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='21' align='left' class='row1' scope='col'>Page Location » Private Messages » Compose Message</td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>
<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>
</table>";
echo " <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>";
if(!$_POST[send]){ //if the form was not submitted
echo "<form method=\"post\" action=\"\">
<tr>
<td height='20' colspan='2' align='left' class='row2' scope='row'>Compose Message.</td>
</tr>"; //echo some of the form and whatnot
if(isset($_GET[user])){ //check if there is a user in the address bar
echo "<tr>
<td colspan='2' align='left' class='row1' scope='row'>» To User
<input class='input' type=\"text\" name=\"to\" value=\"$_GET[user]\" size=\"15\">
<span class='imp'>* Provided </span></td>
</tr>";
}else{ //or not..
echo "<tr>
<td colspan='2' align='left' class='row1' scope='row'>» To User
<input class='input' type=\"text\" name=\"to\" size=\"15\">
<span class='imp'>* Required </span></td>
</tr>"; //echo the input box without the value of the user!
} //end user check in address bar
echo "<form>
<tr>
<td width='17%' align='left' class='row1' scope='col'>» Subject:</td>
<td width='83%' align='left' class='row1' scope='col'>
<input name=\"title\" type=\"text\" class='input' value=\"Unitiled Message\" size=\"15\" Message\> </td>
</tr>
<tr>
<td width='22%' align='left' class='row1' scope='row'>» Content</td>
<td width='83%' align='left' class='row1' scope='row'><div align='right'><a href='?page=bbcode'>BB Code Help?</a></div></td>
</tr>
<tr>
<td width='17%' valign='bottom' class='row1' scope='col'><div align='left'><font size='1'><FONT COLOR='green'> <A href='?page=bbcode'>BBcode</A> » Enabled </font></div></td>
<td width='83%' class='row1' scope='col'><center>
<textarea id=\"TheTextArea\" name=\"message\" cols=\"45\" rows=\"6\" class='input'></textarea>
<br><div style='padding-left: 5px; padding-top:5px;'>
<input type='button' value='B' name='btnBold' onclick='wrapText(document.getElementById('TheTextArea'),'<b>','</b>');'>
<input type='button' value='I' name='btnItalic' onclick='wrapText(document.getElementById('TheTextArea'),'<i>','</i>');'>
<input type='button' value='U' name='btnUnderline' onclick='wrapText(document.getElementById('TheTextArea'),'<u>','</u>');'>
<input type='button' value='IMG' name='btnImg' onclick='wrapText(document.getElementById('TheTextArea'),'<img src=\"','\" />');''>
<input type='button' value='URL' name='btnUrl' onclick='wrapText(document.getElementById('TheTextArea'),'','');'>
<input type='button' value='PHP' name='btnPHP' onclick='wrapText(document.getElementById('TheTextArea'),'[php]','
');'></div></td>
</tr>
<tr>
<td colspan='2' align='left' class='row1' scope='row'><input name=\"send\" type=\"submit\" class='boxbutton' value=\"Send Message\"> </td>
</tr>
</form>"; //echo the rest of the form
echo "<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='5' scope='col'></td>
</tr>";
echo "<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
<tr>
<td height='21' align='left' class='row1' scope='col'><a href='index.php?page=pms'>Go Back?</a></td>
</tr>";
echo "</table>";
}else{ //or if it was..
echo "</table>";
echo "</table>";
echo "</table>";
$to = stripslashes(htmlspecialchars(strip_tags($_POST[to]))); //who its to
$from = $logged[username]; //who its from
$date = date("F j, Y, g:i a"); //the date sent
$msg = addslashes($_POST[message]); //the message variable
$subject = addslashes($_POST[title]); //the subject
$do = mysql_query("INSERT INTO `privates` (`to`,`from`,`date`,`subject`,`content`) VALUES ('" . $to . "','" . $from . "','" . $date . "','" . $subject . "','" . $msg . "')") or die(mysql_error()); //insert into the table!
header("Location: index.php?page=pms&i=21");
} //end sent check
break; //end make new msg
case 'delall': //delete all page
$get = mysql_query("SELECT * FROM `privates` WHERE `to` = '" . $logged[username] . "'"); //get the private messages
if(mysql_num_rows($get) == "0"){
header("Location: index.php?page=pms&i=23");
}else{
$delete = mysql_query("DELETE FROM `privates` WHERE `to` = '" . $logged[username] . "'"); //delete tehm
if($delete) { //check if theres a mySQL error
header("Location: index.php?page=pms&i=22"); //success
}else{ //or not
header("Location: index.php?page=pms&i=24");
} //end error check
} //end msg check
break; //end page
case 'delete': //start the delete page!
$id = (int)htmlspecialchars(strip_tags($_GET[id])); //make the ID safe
if(!$id){ //if there is no ID to select
echo "<a href=\"?page=pms\">Go Back</a>No ID Selected!"; //echo the error
}else{ //or if there is....
$select = mysql_query("SELECT * FROM `privates` WHERE `pid` = '" . $id . "'"); //get the message's info
$msg = mysql_fetch_array($select); //select all data
if($msg[to] != $logged[username]){ //check if the user logged in is the owner of the message
header("Location: index.php?page=pms&i=20"); //if not
}else{ //maybe...
$do = mysql_query("DELETE FROM `privates` WHERE `pid` = '" . $id . "'") or die(mysql_error());
header("Location: index.php?page=pms&i=25");
} //end check possession
} //end id check
break; //end the delete page!
} //end switch/get
} //end login check
?>
</body>
</html>
|
Posted on Monday 18th August 2008 at 02:57 PM |
UrbanTwitch
Senior Member |
Line 138 and 128 have the same variable.
Also... you need to put: $bbmsg = BBCODE($message); on block where the user views the mail and replace $message with $bbmsg |
Posted on Monday 18th August 2008 at 06:18 PM |
Vic Vance
Active Member |
Hey Thank's I want to ask an quetion How can I do emoticons HTML form??? I added then into the BB codes. Another queestion how can I make the buttons into my own images?
this is my bb codes
PHP Code
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
<?
function BBCODE($content){ //define the function of bbcode
$content = nl2br($content); //replaces returns with br's
$match = array(
'#\[b\](.*?)\[\/b\]#se',
'#\[i\](.*?)\[\/i\]#se',
'#\[u\](.*?)\[\/u\]#se',
'#\[url=(.*?)\](.*?)\[\/url\]#se',
'#\[url\](.*?)\[\/url\]#se',
'#\[IMG\](.*?)\[\/IMG\]#se',
'#\[code\](.*?)\[\/code\]#se',
'#\[php\](.*?)\[\/php\]#se',
'#\[print\](.*?)\[\/print\]#se'
PHP:
<?php
function BBCODE($content){ //define the function of bbcode
$content = nl2br($content); //replaces returns with br's
$match = array(
'#\[b\](.*?)\[\/b\]#se',
'#\[i\](.*?)\[\/i\]#se',
'#\[u\](.*?)\[\/u\]#se',
'#\[s\](.*?)\[\/s\]#se',
'#\[url=(.*?)\](.*?)\[\/url\]#se',
'#\[url\](.*?)\[\/url\]#se',
'#\[img\](.*?)\[\/img\]#se',
'#\[code\](.*?)\[\/code\]#se',
'#\[php\](.*?)\[\/php\]#se',
'#\[html\](.*?)\[\/html\]#se',
'#\[print\](.*?)\[\/print\]#se',
'#\[center\](.*?)\[\/center\]#se',
'#\[right\](.*?)\[\/right\]#se',
'#\[left\](.*?)\[\/left\]#se',
'#\[justify\](.*?)\[\/justify\]#se',
'#\:biggrin:#se',
'#\:blink:#se',
'#\:dry:#se',
'#\:mad:#se',
'#\:mellow:#se',
'#\:ninja:#se',
'#\:cry:#se',
'#\:thumbsup:#se',
'#\:unsure:#se',
); //codes used in posts
$replace = array(
"'<b>\\1</b>'",
"'<i>\\1</i>'",
"'<u>\\1</u>'",
"'<a href=\"\\1\" target=\"_BLANK\">\\2</a>'",
"'<a href=\"\\1\" target=\"_BLANK\">\\1</a>'",
"'<img border=\"0\" src=\"\\1\">'",
"'<u><b>Code:</b></u>
<div style=\"border: 1px dotted #000000; background-color: #CCCCCC; overflow: auto;\">
'.highlight_string(stripslashes(str_replace('', '', '$1')), true).'</div>'",
"'<u><b>PHP Code:</b></u>
<div style=\"border: 1px dotted #000000; background-color: #CCCCCC; overflow: auto;\"> '.highlight_string(stripslashes(str_replace('', '', '$1')), true).'</div>'",
"'<u><b>Print Out:</b></u>
<div style=\"border: 1px dotted #000000; background-color: #CCCCCC; overflow: auto;\">
'.highlight_string(stripslashes(str_replace('', '', '$1')), true).'</div>'"
"'<div style=\"text-align:center;\">\\1</div>'",
"'<div style=\"text-align:right;\">\\1</div>'",
"'<div style=\"text-align:left;\">\\1</div>'",
"'<div style=\"text-align:justify;\">\\1</div>'",
"'<img border=\"0\" src=\"images/emoticons/biggrin.gif\">'",
"'<img border=\"0\" src=\"images/emoticons/blink.gif\">'",
"'<img border=\"0\" src=\"images/emoticons/dry.gif\">'",
"'<img border=\"0\" src=\"images/emoticons/mad.gif\">'",
"'<img border=\"0\" src=\"images/emoticons/mellow.gif\">'",
"'<img border=\"0\" src=\"images/emoticons/ninja.gif\">'",
"'<img border=\"0\" src=\"images/emoticons/cry.gif\">'",
"'<img border=\"0\" src=\"images/emoticons/thumbsup.gif\">'",
"'<img border=\"0\" src=\"images/emoticons/unsure.gif\">'",
); //replacements
return preg_replace($match, $replace, $content); //match, and replace
} //end the function
?>
|
Posted on Monday 18th August 2008 at 07:00 PM |
UrbanTwitch
Senior Member |
Go to: images/emoticons/
and replace with yours. |