Help on BB codes

Posted on Saturday 16th August 2008 at 05:10 PM
VicVance
VicVance's Avatar
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. <?php
  2. session_start(); //Start session
  3. if(!$logged[id]){ //Check if user is logged in
  4. header("Location: index.php?page=home&i=6");
  5. }else{ //Their loggedin
  6. switch($_GET[act]){ //make some links ?page=case
  7. default: //set up the default page upon going to pms.php
  8. $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
  9. echo "<div align='left'><font size='4'><strong>Private Messages</strong></font>
  10. </div>
  11. </div>
  12. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  13. <tr>
  14. <td height='5' scope='col'></td>
  15. </tr>
  16. </table>
  17. <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
  18. <tr>
  19. <td height='21' align='left' class='row1' scope='col'>Page Location &raquo; Private Messages &raquo; In Box</td>
  20. </tr>
  21. </table>
  22. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  23. <tr>
  24. <td height='5' scope='col'></td>
  25. </tr>
  26. </table>
  27. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  28. <tr>
  29. <td height='5' scope='col'></td>
  30. </tr>
  31. </table>
  32. <table width='100%' border='0' cellpadding='2' cellspacing='1' class='box'>
  33. <tr>
  34. <td height='18' align='left' class='row2' scope='col'>Options</td>
  35. </tr>
  36. <tr>
  37. <td height='20' align='left' class='row1' scope='col'><a href="?page=pms&act=compose">&raquo; Compose Message</a></td>
  38. </tr>
  39. <tr>
  40. <td height='20' align='left' class='row1' scope='col'><a href="?page=pms&act=delall"> &raquo; Delete All Messages</a></td>
  41. </tr>
  42. </table>"; //echo the start5 table and create msg link/delete all links!
  43. if(mysql_num_rows($msgs) == 0){ //check if there are messages or not
  44. echo "<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  45. <tr>
  46. <td height='5' scope='col'></td>
  47. </tr>
  48. </table>
  49. <table width='100%' border='0' cellpadding='1' cellspacing='1' class='box'>
  50. <tr>
  51. <td height='18' colspan='5' align='left' class='row2' scope='col'>In Box</td>
  52. </tr>
  53. <tr>
  54. <td width='266' height='15' class='row3' scope='col'><div align='center'>Subject </div></td>
  55. <td width='266' class='row3' scope='col'><div align='center'>From</div></td>
  56. <td width='479' class='row3' scope='col'><div align='center'>Date</div></td>
  57. <td width='266' class='row3' scope='col'><div align='center'>Status</div></td>
  58. <th width='124' class='row3' scope='col'></th>
  59. </tr>
  60. <tr>
  61. <td height='18' colspan='5' align='left' class='row1' scope='col'>You Have No New Messages!</td>
  62. </tr>
  63. </table>
  64. <table width='100%' cellpadding='0' cellspacing='0'>
  65. <tr>
  66. <td align='center' valign='middle' width='100%'>"; //no new messages
  67.  
  68. }else{ //or if there are messages
  69. echo "<table width='101%' border='0' align='center' cellpadding='0' cellspacing='0'>
  70. <tr>
  71. <td height='5' scope='col'></td>
  72. </tr>
  73. </table>";
  74. echo "<table width='100%' border='0' cellpadding='3' cellspacing='1'>
  75. <tr>
  76. <td height='5' scope='col'></td>
  77. </tr>
  78. </table>
  79. <table width='100%' border='0' cellpadding='1' cellspacing='1' class='box'>
  80. <tr>
  81. <td height='18' colspan='5' align='left' class='row2' scope='col'>In Box</td>
  82. </tr>
  83. <tr>
  84. <td width='266' height='15' class='row3' scope='col'><div align='center'>Subject </div></td>
  85. <td width='266' class='row3' scope='col'><div align='center'>From</div></td>
  86. <td width='479' class='row3' scope='col'><div align='center'>Date</div></td>
  87. <td width='266' class='row3' scope='col'><div align='center'>Status</div></td>
  88. <th width='124' class='row3' scope='col'></th>
  89. </tr>";
  90. while($r = mysql_fetch_array($msgs)){ //repeat for all the messages
  91. echo "<tr>
  92. <td align='center' class='row1' scope='col'><a href="?page=pms&act=view&id=$r[pid]">$r[subject]</a></td>
  93. <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>
  94. <td align='center' class='row1' scope='col'>$r[date]</td>
  95. <td align='center' class='row1' scope='col'>$r[status]</td>
  96. <td align='center' class='row1' scope='col'><a href="?page=pms&act=delete&id=$r[pid]"><img src='images/Icons/delete.png'></a></td>
  97. </tr>"; //echo the messages
  98. } //end while
  99. } //end message amount check echo
  100. echo "</table>"; //end table
  101. break; //end the default page
  102. case 'view': //define the view page
  103. $id = (int)htmlspecialchars(strip_tags($_GET[id])); //make the ID safe
  104. if(!$id){ //if there is no ID to select
  105. header("Location: index.php?page=pms&i=19");
  106. }else{ //or if there is....
  107. $select = mysql_query("SELECT * FROM `privates` WHERE `pid` = '" . $id . "';"); //get the message's info
  108. $msg = mysql_fetch_array($select); //select all data
  109. if($msg[to] != $logged[username]){ //check if the user logged in is the owner of the message
  110. header("Location: index.php?page=pms&i=20");
  111. }else{ //maybe...
  112. if(!$_POST[reply]) { //if the reply was not submitted
  113. $mark = mysql_query("UPDATE `privates` SET `status` = 'Read' WHERE `pid` = '" . $id . "'") or die(mysql_error()); //mark it as Read
  114. $message = nl2br(stripslashes($msg[content])); //make new lines to and strip the slashes
  115. $subject = stripslashes($msg[subject]); //strip the slashes
  116. echo "<div align='left'><font size='4'><strong>Private Messages</strong></font>
  117. </div>
  118. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  119. <tr>
  120. <td height='5' scope='col'></td>
  121. </tr>
  122. </table>
  123. <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
  124. <tr>
  125. <td height='21' align='left' class='row1' scope='col'>Page Location &raquo; Private Messages &raquo; Viewing Messages</td>
  126. </tr>
  127. </table>
  128. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  129. <tr>
  130. <td height='5' scope='col'></td>
  131. </tr>
  132. </table>
  133. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  134. <tr>
  135. <td height='5' scope='col'></td>
  136. </tr>
  137. </table>
  138. <table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>
  139. <tr>
  140. <td height='5' scope='col'>
  141. <form method="post">
  142. <table width='100%' border='0' cellpadding='2' cellspacing='1' class='box'>
  143. <tr>
  144. <td height='18' colspan='2' align='left' class='row2' scope='col'>Message</td>
  145. </tr>
  146. <tr>
  147. <td height='18' colspan='2' align='left' class='row1' scope='col'>&raquo; Subject: $subject</td>
  148. </tr>
  149. <tr>
  150. <td height='19' colspan='2' align='left' class='row1' scope='row'>&raquo; From: $msg[from]</td>
  151. </tr>
  152. <tr>
  153. <td height='18' colspan='2' align='left' class='row3' scope='row'>&raquo; The Message: $message</td>
  154. </tr>
  155. <tr>
  156. <td width='64%' align='left' class='row1' scope='row'>&raquo; Your Reply</td>
  157. <td width='36%' align='left' class='row1' scope='row'><div align='right'><a href='?page=bbcode'>BB Code Help?</a></div></td>
  158. </tr>
  159. <tr>
  160. <td colspan='2' align='left' class='row1' scope='row'><center>
  161. <table width='100%' border='0' cellspacing='0' cellpadding='0'>
  162. <tr>
  163. <td width='22%' valign='bottom' scope='col'><div align='left'><font size='1'><FONT COLOR='green'> <A href='?page=bbcode'>BBcode</A> &raquo; Enabled
  164. </font></div></td>
  165. <td width='100%' scope='col'><center><textarea name="msg"2 cols="45" rows="6" class='input'></textarea></td>
  166. </tr>
  167. </table></td>
  168. </tr>
  169. <tr>
  170. <td colspan='2' align='left' class='row1' scope='row'><input name="reply" type="submit" class='boxbutton' value="Reply"></td>
  171. </tr>
  172. </table>
  173. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  174. <tr>
  175. <td height='5' scope='col'></td>
  176. </tr>
  177. </table>
  178. <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
  179. <tr>
  180. <td height='21' align='left' class='row1' scope='col'><a href='index.php?page=pms'>Go Back?</a></td>
  181. </tr>
  182. </table>
  183. </form
  184. ></td>
  185. </tr>
  186. </table>"; //echo the message and reply box.
  187. }else{ //if the form was submitted
  188. $to = $msg[from]; //get who it is to
  189. $from = $logged[username]; //who its from
  190. $subject = "RE: " . $msg[subject]; //new subject
  191. $msg = addslashes($_POST[msg]); //the content
  192. $date = date("F j, Y, g:i a"); //the date sent
  193. $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!
  194. header("Location: index.php?page=pms&i=21");
  195. } //end reply check
  196. } //end check posession
  197. } //end id check
  198. break;
  199.  
  200. case 'compose': //create a new message
  201. echo "<div align='left'><font size='4'><strong>Private Messages</strong></font>
  202. </div>
  203. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  204. <tr>
  205. <td height='5' scope='col'></td>
  206. </tr>
  207. </table>
  208. <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
  209. <tr>
  210. <td height='21' align='left' class='row1' scope='col'>Page Location &raquo; Private Messages &raquo; Compose Message</td>
  211. </tr>
  212. </table>
  213. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  214. <tr>
  215. <td height='5' scope='col'></td>
  216. </tr>
  217. </table>
  218. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  219. <tr>
  220. <td height='5' scope='col'></td>
  221. </tr>
  222. </table>";
  223. echo " <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>";
  224. if(!$_POST[send]){ //if the form was not submitted
  225. echo "<form method="post" action="">
  226. <tr>
  227. <td height='20' colspan='2' align='left' class='row2' scope='row'>Compose Message.</td>
  228. </tr>"; //echo some of the form and whatnot
  229. if(isset($_GET[user])){ //check if there is a user in the address bar
  230. echo "<tr>
  231. <td colspan='2' align='left' class='row1' scope='row'>&raquo; To User
  232. <input class='input' type="text" name="to" value="$_GET[user]" size="15">
  233. <span class='imp'>* Provided </span></td>
  234. </tr>";
  235. }else{ //or not..
  236. echo "<tr>
  237. <td colspan='2' align='left' class='row1' scope='row'>&raquo; To User
  238. <input class='input' type="text" name="to" size="15">
  239. <span class='imp'>* Required </span></td>
  240. </tr>"; //echo the input box without the value of the user!
  241. } //end user check in address bar
  242. echo "<form>
  243. <tr>
  244. <td width='17%' align='left' class='row1' scope='col'>&raquo; Subject:</td>
  245. <td width='83%' align='left' class='row1' scope='col'>
  246. &nbsp;&nbsp;&nbsp;&nbsp;<input name="title" type="text" class='input' value="Unitiled Message" size="15" Message> </td>
  247. </tr>
  248. <tr>
  249. <td width='22%' align='left' class='row1' scope='row'>&raquo; Content</td>
  250. <td width='83%' align='left' class='row1' scope='row'><div align='right'><a href='?page=bbcode'>BB Code Help?</a></div></td>
  251. </tr>
  252. <tr>
  253. <td width='17%' valign='bottom' class='row1' scope='col'><div align='left'><font size='1'><FONT COLOR='green'> <A href='?page=bbcode'>BBcode</A> &raquo; Enabled </font></div></td>
  254. <td width='83%' class='row1' scope='col'><center>
  255. <textarea name="message" cols="45" rows="6" class='input'></textarea></td>
  256. </tr>
  257. <tr>
  258. <td colspan='2' align='left' class='row1' scope='row'><input name="send" type="submit" class='boxbutton' value="Send Message"> </td>
  259. </tr>
  260. </form>"; //echo the rest of the form
  261. echo "<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  262. <tr>
  263. <td height='5' scope='col'></td>
  264. </tr>";
  265. echo "<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
  266. <tr>
  267. <td height='21' align='left' class='row1' scope='col'><a href='index.php?page=pms'>Go Back?</a></td>
  268. </tr>";
  269. echo "</table>";
  270. }else{ //or if it was..
  271. echo "</table>";
  272. echo "</table>";
  273. echo "</table>";
  274. $to = stripslashes(htmlspecialchars(strip_tags($_POST[to]))); //who its to
  275. $from = $logged[username]; //who its from
  276. $date = date("F j, Y, g:i a"); //the date sent
  277. $msg = addslashes($_POST[message]); //the message variable
  278. $subject = addslashes($_POST[title]); //the subject
  279. $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!
  280. header("Location: index.php?page=pms&i=21");
  281. } //end sent check
  282. break; //end make new msg
  283. case 'delall': //delete all page
  284. $get = mysql_query("SELECT * FROM `privates` WHERE `to` = '" . $logged[username] . "'"); //get the private messages
  285. if(mysql_num_rows($get) == "0"){
  286. header("Location: index.php?page=pms&i=23");
  287. }else{
  288. $delete = mysql_query("DELETE FROM `privates` WHERE `to` = '" . $logged[username] . "'"); //delete tehm
  289. if($delete) { //check if theres a mySQL error
  290. header("Location: index.php?page=pms&i=22"); //success
  291. }else{ //or not
  292. header("Location: index.php?page=pms&i=24");
  293. } //end error check
  294. } //end msg check
  295. break; //end page
  296. case 'delete': //start the delete page!
  297. $id = (int)htmlspecialchars(strip_tags($_GET[id])); //make the ID safe
  298. if(!$id){ //if there is no ID to select
  299. echo "<a href="?page=pms">Go Back</a>No ID Selected!"; //echo the error
  300. }else{ //or if there is....
  301. $select = mysql_query("SELECT * FROM `privates` WHERE `pid` = '" . $id . "'"); //get the message's info
  302. $msg = mysql_fetch_array($select); //select all data
  303. if($msg[to] != $logged[username]){ //check if the user logged in is the owner of the message
  304. header("Location: index.php?page=pms&i=20"); //if not
  305. }else{ //maybe...
  306. $do = mysql_query("DELETE FROM `privates` WHERE `pid` = '" . $id . "'") or die(mysql_error());
  307. header("Location: index.php?page=pms&i=25");
  308. } //end check possession
  309. } //end id check
  310. break; //end the delete page!
  311. } //end switch/get
  312. } //end login check
  313. ?>
Posted on Saturday 16th August 2008 at 06:34 PM
UrbanTwitch
UrbanTwitch's Avatar
Add maybe... this at the very top inside the PHP?

PHP Code
  1. include ("bbcode.php");
Posted on Saturday 16th August 2008 at 06:40 PM
UrbanTwitch
UrbanTwitch's Avatar
Also on line 255:

PHP Code
  1. <textarea name="message" cols="45" rows="6" class='input'></textarea></td>


Make sure to add this inside the <textarea>:

Code
id="TheAreaArea"
Posted on Sunday 17th August 2008 at 10:52 AM
VicVance
VicVance's Avatar
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. <?php
  2. include ("bbcodes.php");
  3. session_start(); //Start session
  4. if(!$logged[id]){ //Check if user is logged in
  5. header("Location: index.php?page=home&i=6");
  6. }else{ //Their loggedin
  7. switch($_GET[act]){ //make some links ?page=case
  8. default: //set up the default page upon going to pms.php
  9. $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
  10. echo "<div align='left'><font size='4'><strong>Private Messages</strong></font>
  11. </div>
  12. </div>
  13. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  14. <tr>
  15. <td height='5' scope='col'></td>
  16. </tr>
  17. </table>
  18. <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
  19. <tr>
  20. <td height='21' align='left' class='row1' scope='col'>Page Location &raquo; Private Messages &raquo; In Box</td>
  21. </tr>
  22. </table>
  23. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  24. <tr>
  25. <td height='5' scope='col'></td>
  26. </tr>
  27. </table>
  28. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  29. <tr>
  30. <td height='5' scope='col'></td>
  31. </tr>
  32. </table>
  33. <table width='100%' border='0' cellpadding='2' cellspacing='1' class='box'>
  34. <tr>
  35. <td height='18' align='left' class='row2' scope='col'>Options</td>
  36. </tr>
  37. <tr>
  38. <td height='20' align='left' class='row1' scope='col'><a href="?page=pms&act=compose">&raquo; Compose Message</a></td>
  39. </tr>
  40. <tr>
  41. <td height='20' align='left' class='row1' scope='col'><a href="?page=pms&act=delall"> &raquo; Delete All Messages</a></td>
  42. </tr>
  43. </table>"; //echo the start5 table and create msg link/delete all links!
  44. if(mysql_num_rows($msgs) == 0){ //check if there are messages or not
  45. echo "<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  46. <tr>
  47. <td height='5' scope='col'></td>
  48. </tr>
  49. </table>
  50. <table width='100%' border='0' cellpadding='1' cellspacing='1' class='box'>
  51. <tr>
  52. <td height='18' colspan='5' align='left' class='row2' scope='col'>In Box</td>
  53. </tr>
  54. <tr>
  55. <td width='266' height='15' class='row3' scope='col'><div align='center'>Subject </div></td>
  56. <td width='266' class='row3' scope='col'><div align='center'>From</div></td>
  57. <td width='479' class='row3' scope='col'><div align='center'>Date</div></td>
  58. <td width='266' class='row3' scope='col'><div align='center'>Status</div></td>
  59. <th width='124' class='row3' scope='col'></th>
  60. </tr>
  61. <tr>
  62. <td height='18' colspan='5' align='left' class='row1' scope='col'>You Have No New Messages!</td>
  63. </tr>
  64. </table>
  65. <table width='100%' cellpadding='0' cellspacing='0'>
  66. <tr>
  67. <td align='center' valign='middle' width='100%'>"; //no new messages
  68.  
  69. }else{ //or if there are messages
  70. echo "<table width='101%' border='0' align='center' cellpadding='0' cellspacing='0'>
  71. <tr>
  72. <td height='5' scope='col'></td>
  73. </tr>
  74. </table>";
  75. echo "<table width='100%' border='0' cellpadding='3' cellspacing='1'>
  76. <tr>
  77. <td height='5' scope='col'></td>
  78. </tr>
  79. </table>
  80. <table width='100%' border='0' cellpadding='1' cellspacing='1' class='box'>
  81. <tr>
  82. <td height='18' colspan='5' align='left' class='row2' scope='col'>In Box</td>
  83. </tr>
  84. <tr>
  85. <td width='266' height='15' class='row3' scope='col'><div align='center'>Subject </div></td>
  86. <td width='266' class='row3' scope='col'><div align='center'>From</div></td>
  87. <td width='479' class='row3' scope='col'><div align='center'>Date</div></td>
  88. <td width='266' class='row3' scope='col'><div align='center'>Status</div></td>
  89. <th width='124' class='row3' scope='col'></th>
  90. </tr>";
  91. while($r = mysql_fetch_array($msgs)){ //repeat for all the messages
  92. echo "<tr>
  93. <td align='center' class='row1' scope='col'><a href="?page=pms&act=view&id=$r[pid]">$r[subject]</a></td>
  94. <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>
  95. <td align='center' class='row1' scope='col'>$r[date]</td>
  96. <td align='center' class='row1' scope='col'>$r[status]</td>
  97. <td align='center' class='row1' scope='col'><a href="?page=pms&act=delete&id=$r[pid]"><img src='images/Icons/delete.png'></a></td>
  98. </tr>"; //echo the messages
  99. } //end while
  100. } //end message amount check echo
  101. echo "</table>"; //end table
  102. break; //end the default page
  103. case 'view': //define the view page
  104. $id = (int)htmlspecialchars(strip_tags($_GET[id])); //make the ID safe
  105. if(!$id){ //if there is no ID to select
  106. $bbmsg = BBCODE($message);
  107. header("Location: index.php?page=pms&i=19");
  108. }else{ //or if there is....
  109. $select = mysql_query("SELECT * FROM `privates` WHERE `pid` = '" . $id . "';"); //get the message's info
  110. $msg = mysql_fetch_array($select); //select all data
  111. if($msg[to] != $logged[username]){ //check if the user logged in is the owner of the message
  112. header("Location: index.php?page=pms&i=20");
  113. }else{ //maybe...
  114. if(!$_POST[reply]) { //if the reply was not submitted
  115. $mark = mysql_query("UPDATE `privates` SET `status` = 'Read' WHERE `pid` = '" . $id . "'") or die(mysql_error()); //mark it as Read
  116. $bbmsg = nl2br(stripslashes($msg[content])); //make new lines to and strip the slashes
  117. $subject = stripslashes($msg[subject]); //strip the slashes
  118. echo "<div align='left'><font size='4'><strong>Private Messages</strong></font>
  119. </div>
  120. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  121. <tr>
  122. <td height='5' scope='col'></td>
  123. </tr>
  124. </table>
  125. <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
  126. <tr>
  127. <td height='21' align='left' class='row1' scope='col'>Page Location &raquo; Private Messages &raquo; Viewing Messages</td>
  128. </tr>
  129. </table>
  130. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  131. <tr>
  132. <td height='5' scope='col'></td>
  133. </tr>
  134. </table>
  135. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  136. <tr>
  137. <td height='5' scope='col'></td>
  138. </tr>
  139. </table>
  140. <table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>
  141. <tr>
  142. <td height='5' scope='col'>
  143. <form method="post">
  144. <table width='100%' border='0' cellpadding='2' cellspacing='1' class='box'>
  145. <tr>
  146. <td height='18' colspan='2' align='left' class='row2' scope='col'>Message</td>
  147. </tr>
  148. <tr>
  149. <td height='18' colspan='2' align='left' class='row1' scope='col'>&raquo; Subject: $subject</td>
  150. </tr>
  151. <tr>
  152. <td height='19' colspan='2' align='left' class='row1' scope='row'>&raquo; From: $msg[from]</td>
  153. </tr>
  154. <tr>
  155. <td height='18' colspan='2' align='left' class='row3' scope='row'>&raquo; The Message: $message</td>
  156. </tr>
  157. <tr>
  158. <td width='64%' align='left' class='row1' scope='row'>&raquo; Your Reply</td>
  159. <td width='36%' align='left' class='row1' scope='row'><div align='right'><a href='?page=bbcode'>BB Code Help?</a></div></td>
  160. </tr>
  161. <tr>
  162. <td colspan='2' align='left' class='row1' scope='row'><center>
  163. <table width='100%' border='0' cellspacing='0' cellpadding='0'>
  164. <tr>
  165. <td width='22%' valign='bottom' scope='col'><div align='left'><font size='1'><FONT COLOR='green'> <A href='?page=bbcode'>BBcode</A> &raquo; Enabled
  166. </font></div></td>
  167. <td width='100%' scope='col'><center><textarea name="msg"2 cols="45" rows="6" class='input'></textarea></td>
  168. </tr>
  169. </table></td>
  170. </tr>
  171. <tr>
  172. <td colspan='2' align='left' class='row1' scope='row'><input name="reply" type="submit" class='boxbutton' value="Reply"></td>
  173. </tr>
  174. </table>
  175. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  176. <tr>
  177. <td height='5' scope='col'></td>
  178. </tr>
  179. </table>
  180. <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
  181. <tr>
  182. <td height='21' align='left' class='row1' scope='col'><a href='index.php?page=pms'>Go Back?</a></td>
  183. </tr>
  184. </table>
  185. </form
  186. ></td>
  187. </tr>
  188. </table>"; //echo the message and reply box.
  189. }else{ //if the form was submitted
  190. $to = $msg[from]; //get who it is to
  191. $from = $logged[username]; //who its from
  192. $subject = "RE: " . $msg[subject]; //new subject
  193. $msg = addslashes($_POST[msg]); //the content
  194. $date = date("F j, Y, g:i a"); //the date sent
  195. $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!
  196. header("Location: index.php?page=pms&i=21");
  197. } //end reply check
  198. } //end check posession
  199. } //end id check
  200. break;
  201.  
  202. case 'compose': //create a new message
  203. echo "<div align='left'><font size='4'><strong>Private Messages</strong></font>
  204. </div>
  205. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  206. <tr>
  207. <td height='5' scope='col'></td>
  208. </tr>
  209. </table>
  210. <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
  211. <tr>
  212. <td height='21' align='left' class='row1' scope='col'>Page Location &raquo; Private Messages &raquo; Compose Message</td>
  213. </tr>
  214. </table>
  215. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  216. <tr>
  217. <td height='5' scope='col'></td>
  218. </tr>
  219. </table>
  220. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  221. <tr>
  222. <td height='5' scope='col'></td>
  223. </tr>
  224. </table>";
  225. echo " <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>";
  226. if(!$_POST[send]){ //if the form was not submitted
  227. echo "<form method="post" action="">
  228. <tr>
  229. <td height='20' colspan='2' align='left' class='row2' scope='row'>Compose Message.</td>
  230. </tr>"; //echo some of the form and whatnot
  231. if(isset($_GET[user])){ //check if there is a user in the address bar
  232. echo "<tr>
  233. <td colspan='2' align='left' class='row1' scope='row'>&raquo; To User
  234. <input class='input' type="text" name="to" value="$_GET[user]" size="15">
  235. <span class='imp'>* Provided </span></td>
  236. </tr>";
  237. }else{ //or not..
  238. echo "<tr>
  239. <td colspan='2' align='left' class='row1' scope='row'>&raquo; To User
  240. <input class='input' type="text" name="to" size="15">
  241. <span class='imp'>* Required </span></td>
  242. </tr>"; //echo the input box without the value of the user!
  243. } //end user check in address bar
  244. echo "<form>
  245. <tr>
  246. <td width='17%' align='left' class='row1' scope='col'>&raquo; Subject:</td>
  247. <td width='83%' align='left' class='row1' scope='col'>
  248. &nbsp;&nbsp;&nbsp;&nbsp;<input name="title" type="text" class='input' value="Unitiled Message" size="15" Message> </td>
  249. </tr>
  250. <tr>
  251. <td width='22%' align='left' class='row1' scope='row'>&raquo; Content</td>
  252. <td width='83%' align='left' class='row1' scope='row'><div align='right'><a href='?page=bbcode'>BB Code Help?</a></div></td>
  253. </tr>
  254. <tr>
  255. <td width='17%' valign='bottom' class='row1' scope='col'><div align='left'><font size='1'><FONT COLOR='green'> <A href='?page=bbcode'>BBcode</A> &raquo; Enabled </font></div></td>
  256. <td width='83%' class='row1' scope='col'><center>
  257. <textarea id="TheAreaArea" name="message" cols="45" rows="6" class='input'></textarea>
  258. <br><div style='padding-left: 5px; padding-top:5px;'>
  259. <input type='button' value='B' name='btnBold' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;<b>&#39;,&#39;</b>&#39;);'>
  260. <input type='button' value='I' name='btnItalic' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;<i>&#39;,&#39;</i>&#39;);'>
  261. <input type='button' value='U' name='btnUnderline' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;<u>&#39;,&#39;</u>&#39;);'>
  262. <input type='button' value='IMG' name='btnImg' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;<img src="&#39;,&#39;" />&#39;);''>
  263. <input type='button' value='URL' name='btnUrl' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;&#39;,&#39;&#39;);'>
  264. <input type='button' value='PHP' name='btnPHP' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;[php]&#39;,&#39;
  265. &#39;);'></div></td>
  266. </tr>
  267. <tr>
  268. <td colspan='2' align='left' class='row1' scope='row'><input name="send" type="submit" class='boxbutton' value="Send Message"> </td>
  269. </tr>
  270. </form>"; //echo the rest of the form
  271. echo "<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  272. <tr>
  273. <td height='5' scope='col'></td>
  274. </tr>";
  275. echo "<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
  276. <tr>
  277. <td height='21' align='left' class='row1' scope='col'><a href='index.php?page=pms'>Go Back?</a></td>
  278. </tr>";
  279. echo "</table>";
  280. }else{ //or if it was..
  281. echo "</table>";
  282. echo "</table>";
  283. echo "</table>";
  284. $to = stripslashes(htmlspecialchars(strip_tags($_POST[to]))); //who its to
  285. $from = $logged[username]; //who its from
  286. $date = date("F j, Y, g:i a"); //the date sent
  287. $msg = addslashes($_POST[message]); //the message variable
  288. $subject = addslashes($_POST[title]); //the subject
  289. $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!
  290. header("Location: index.php?page=pms&i=21");
  291. } //end sent check
  292. break; //end make new msg
  293. case 'delall': //delete all page
  294. $get = mysql_query("SELECT * FROM `privates` WHERE `to` = '" . $logged[username] . "'"); //get the private messages
  295. if(mysql_num_rows($get) == "0"){
  296. header("Location: index.php?page=pms&i=23");
  297. }else{
  298. $delete = mysql_query("DELETE FROM `privates` WHERE `to` = '" . $logged[username] . "'"); //delete tehm
  299. if($delete) { //check if theres a mySQL error
  300. header("Location: index.php?page=pms&i=22"); //success
  301. }else{ //or not
  302. header("Location: index.php?page=pms&i=24");
  303. } //end error check
  304. } //end msg check
  305. break; //end page
  306. case 'delete': //start the delete page!
  307. $id = (int)htmlspecialchars(strip_tags($_GET[id])); //make the ID safe
  308. if(!$id){ //if there is no ID to select
  309. echo "<a href="?page=pms">Go Back</a>No ID Selected!"; //echo the error
  310. }else{ //or if there is....
  311. $select = mysql_query("SELECT * FROM `privates` WHERE `pid` = '" . $id . "'"); //get the message's info
  312. $msg = mysql_fetch_array($select); //select all data
  313. if($msg[to] != $logged[username]){ //check if the user logged in is the owner of the message
  314. header("Location: index.php?page=pms&i=20"); //if not
  315. }else{ //maybe...
  316. $do = mysql_query("DELETE FROM `privates` WHERE `pid` = '" . $id . "'") or die(mysql_error());
  317. header("Location: index.php?page=pms&i=25");
  318. } //end check possession
  319. } //end id check
  320. break; //end the delete page!
  321. } //end switch/get
  322. } //end login check
  323. ?>
Posted on Monday 18th August 2008 at 06:19 AM
UrbanTwitch
UrbanTwitch's Avatar
Line 257:

PHP Code
  1. <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
VicVance
VicVance's Avatar
Do you mean "TheAreaArea" should be "TheTextArea"? If so, it doesn't help.
Posted on Monday 18th August 2008 at 10:34 AM
VicVance
VicVance's Avatar
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. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="https://www.w3.org/1999/xhtml">
  3. <head>
  4. <script>
  5. function wrapText(el, openTag, closeTag) {
  6. if (el.setSelectionRange) {
  7. // W3C/Mozilla
  8. 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);
  9. }
  10. else if (document.selection && document.selection.createRange) {
  11. // IE code goes here
  12. el.focus(); //or else text is added to the activating control
  13. var range = document.selection.createRange();
  14. range.text = openTag + range.text + closeTag;
  15. }
  16. }
  17. </script>
  18. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  19. <title>Untitled Document</title>
  20. </head>
  21.  
  22. <body>
  23. <?php
  24. include ("bbcodes.php");
  25. session_start(); //Start session
  26. if(!$logged[id]){ //Check if user is logged in
  27. header("Location: index.php?page=home&i=6");
  28. }else{ //Their loggedin
  29. switch($_GET[act]){ //make some links ?page=case
  30. default: //set up the default page upon going to pms.php
  31. $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
  32. echo "<div align='left'><font size='4'><strong>Private Messages</strong></font>
  33. </div>
  34. </div>
  35. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  36. <tr>
  37. <td height='5' scope='col'></td>
  38. </tr>
  39. </table>
  40. <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
  41. <tr>
  42. <td height='21' align='left' class='row1' scope='col'>Page Location &raquo; Private Messages &raquo; In Box</td>
  43. </tr>
  44. </table>
  45. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  46. <tr>
  47. <td height='5' scope='col'></td>
  48. </tr>
  49. </table>
  50. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  51. <tr>
  52. <td height='5' scope='col'></td>
  53. </tr>
  54. </table>
  55. <table width='100%' border='0' cellpadding='2' cellspacing='1' class='box'>
  56. <tr>
  57. <td height='18' align='left' class='row2' scope='col'>Options</td>
  58. </tr>
  59. <tr>
  60. <td height='20' align='left' class='row1' scope='col'><a href="?page=pms&act=compose">&raquo; Compose Message</a></td>
  61. </tr>
  62. <tr>
  63. <td height='20' align='left' class='row1' scope='col'><a href="?page=pms&act=delall"> &raquo; Delete All Messages</a></td>
  64. </tr>
  65. </table>"; //echo the start5 table and create msg link/delete all links!
  66. if(mysql_num_rows($msgs) == 0){ //check if there are messages or not
  67. echo "<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  68. <tr>
  69. <td height='5' scope='col'></td>
  70. </tr>
  71. </table>
  72. <table width='100%' border='0' cellpadding='1' cellspacing='1' class='box'>
  73. <tr>
  74. <td height='18' colspan='5' align='left' class='row2' scope='col'>In Box</td>
  75. </tr>
  76. <tr>
  77. <td width='266' height='15' class='row3' scope='col'><div align='center'>Subject </div></td>
  78. <td width='266' class='row3' scope='col'><div align='center'>From</div></td>
  79. <td width='479' class='row3' scope='col'><div align='center'>Date</div></td>
  80. <td width='266' class='row3' scope='col'><div align='center'>Status</div></td>
  81. <th width='124' class='row3' scope='col'></th>
  82. </tr>
  83. <tr>
  84. <td height='18' colspan='5' align='left' class='row1' scope='col'>You Have No New Messages!</td>
  85. </tr>
  86. </table>
  87. <table width='100%' cellpadding='0' cellspacing='0'>
  88. <tr>
  89. <td align='center' valign='middle' width='100%'>"; //no new messages
  90.  
  91. }else{ //or if there are messages
  92. echo "<table width='101%' border='0' align='center' cellpadding='0' cellspacing='0'>
  93. <tr>
  94. <td height='5' scope='col'></td>
  95. </tr>
  96. </table>";
  97. echo "<table width='100%' border='0' cellpadding='3' cellspacing='1'>
  98. <tr>
  99. <td height='5' scope='col'></td>
  100. </tr>
  101. </table>
  102. <table width='100%' border='0' cellpadding='1' cellspacing='1' class='box'>
  103. <tr>
  104. <td height='18' colspan='5' align='left' class='row2' scope='col'>In Box</td>
  105. </tr>
  106. <tr>
  107. <td width='266' height='15' class='row3' scope='col'><div align='center'>Subject </div></td>
  108. <td width='266' class='row3' scope='col'><div align='center'>From</div></td>
  109. <td width='479' class='row3' scope='col'><div align='center'>Date</div></td>
  110. <td width='266' class='row3' scope='col'><div align='center'>Status</div></td>
  111. <th width='124' class='row3' scope='col'></th>
  112. </tr>";
  113. while($r = mysql_fetch_array($msgs)){ //repeat for all the messages
  114. echo "<tr>
  115. <td align='center' class='row1' scope='col'><a href="?page=pms&act=view&id=$r[pid]">$r[subject]</a></td>
  116. <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>
  117. <td align='center' class='row1' scope='col'>$r[date]</td>
  118. <td align='center' class='row1' scope='col'>$r[status]</td>
  119. <td align='center' class='row1' scope='col'><a href="?page=pms&act=delete&id=$r[pid]"><img src='images/Icons/delete.png'></a></td>
  120. </tr>"; //echo the messages
  121. } //end while
  122. } //end message amount check echo
  123. echo "</table>"; //end table
  124. break; //end the default page
  125. case 'view': //define the view page
  126. $id = (int)htmlspecialchars(strip_tags($_GET[id])); //make the ID safe
  127. if(!$id){ //if there is no ID to select
  128. $bbmsg = BBCODE($message);
  129. header("Location: index.php?page=pms&i=19");
  130. }else{ //or if there is....
  131. $select = mysql_query("SELECT * FROM `privates` WHERE `pid` = '" . $id . "';"); //get the message's info
  132. $msg = mysql_fetch_array($select); //select all data
  133. if($msg[to] != $logged[username]){ //check if the user logged in is the owner of the message
  134. header("Location: index.php?page=pms&i=20");
  135. }else{ //maybe...
  136. if(!$_POST[reply]) { //if the reply was not submitted
  137. $mark = mysql_query("UPDATE `privates` SET `status` = 'Read' WHERE `pid` = '" . $id . "'") or die(mysql_error()); //mark it as Read
  138. $bbmsg = nl2br(stripslashes($msg[content])); //make new lines to and strip the slashes
  139. $subject = stripslashes($msg[subject]); //strip the slashes
  140. echo "<div align='left'><font size='4'><strong>Private Messages</strong></font>
  141. </div>
  142. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  143. <tr>
  144. <td height='5' scope='col'></td>
  145. </tr>
  146. </table>
  147. <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
  148. <tr>
  149. <td height='21' align='left' class='row1' scope='col'>Page Location &raquo; Private Messages &raquo; Viewing Messages</td>
  150. </tr>
  151. </table>
  152. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  153. <tr>
  154. <td height='5' scope='col'></td>
  155. </tr>
  156. </table>
  157. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  158. <tr>
  159. <td height='5' scope='col'></td>
  160. </tr>
  161. </table>
  162. <table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>
  163. <tr>
  164. <td height='5' scope='col'>
  165. <form method="post">
  166. <table width='100%' border='0' cellpadding='2' cellspacing='1' class='box'>
  167. <tr>
  168. <td height='18' colspan='2' align='left' class='row2' scope='col'>Message</td>
  169. </tr>
  170. <tr>
  171. <td height='18' colspan='2' align='left' class='row1' scope='col'>&raquo; Subject: $subject</td>
  172. </tr>
  173. <tr>
  174. <td height='19' colspan='2' align='left' class='row1' scope='row'>&raquo; From: $msg[from]</td>
  175. </tr>
  176. <tr>
  177. <td height='18' colspan='2' align='left' class='row3' scope='row'>&raquo; The Message: $message</td>
  178. </tr>
  179. <tr>
  180. <td width='64%' align='left' class='row1' scope='row'>&raquo; Your Reply</td>
  181. <td width='36%' align='left' class='row1' scope='row'><div align='right'><a href='?page=bbcode'>BB Code Help?</a></div></td>
  182. </tr>
  183. <tr>
  184. <td colspan='2' align='left' class='row1' scope='row'><center>
  185. <table width='100%' border='0' cellspacing='0' cellpadding='0'>
  186. <tr>
  187. <td width='22%' valign='bottom' scope='col'><div align='left'><font size='1'><FONT COLOR='green'> <A href='?page=bbcode'>BBcode</A> &raquo; Enabled
  188. </font></div></td>
  189. <td width='100%' scope='col'><center><textarea name="msg"2 cols="45" rows="6" class='input'></textarea></td>
  190. </tr>
  191. </table></td>
  192. </tr>
  193. <tr>
  194. <td colspan='2' align='left' class='row1' scope='row'><input name="reply" type="submit" class='boxbutton' value="Reply"></td>
  195. </tr>
  196. </table>
  197. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  198. <tr>
  199. <td height='5' scope='col'></td>
  200. </tr>
  201. </table>
  202. <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
  203. <tr>
  204. <td height='21' align='left' class='row1' scope='col'><a href='index.php?page=pms'>Go Back?</a></td>
  205. </tr>
  206. </table>
  207. </form
  208. ></td>
  209. </tr>
  210. </table>"; //echo the message and reply box.
  211. }else{ //if the form was submitted
  212. $to = $msg[from]; //get who it is to
  213. $from = $logged[username]; //who its from
  214. $subject = "RE: " . $msg[subject]; //new subject
  215. $msg = addslashes($_POST[msg]); //the content
  216. $date = date("F j, Y, g:i a"); //the date sent
  217. $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!
  218. header("Location: index.php?page=pms&i=21");
  219. } //end reply check
  220. } //end check posession
  221. } //end id check
  222. break;
  223.  
  224. case 'compose': //create a new message
  225. echo "<div align='left'><font size='4'><strong>Private Messages</strong></font>
  226. </div>
  227. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  228. <tr>
  229. <td height='5' scope='col'></td>
  230. </tr>
  231. </table>
  232. <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
  233. <tr>
  234. <td height='21' align='left' class='row1' scope='col'>Page Location &raquo; Private Messages &raquo; Compose Message</td>
  235. </tr>
  236. </table>
  237. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  238. <tr>
  239. <td height='5' scope='col'></td>
  240. </tr>
  241. </table>
  242. <table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  243. <tr>
  244. <td height='5' scope='col'></td>
  245. </tr>
  246. </table>";
  247. echo " <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>";
  248. if(!$_POST[send]){ //if the form was not submitted
  249. echo "<form method="post" action="">
  250. <tr>
  251. <td height='20' colspan='2' align='left' class='row2' scope='row'>Compose Message.</td>
  252. </tr>"; //echo some of the form and whatnot
  253. if(isset($_GET[user])){ //check if there is a user in the address bar
  254. echo "<tr>
  255. <td colspan='2' align='left' class='row1' scope='row'>&raquo; To User
  256. <input class='input' type="text" name="to" value="$_GET[user]" size="15">
  257. <span class='imp'>* Provided </span></td>
  258. </tr>";
  259. }else{ //or not..
  260. echo "<tr>
  261. <td colspan='2' align='left' class='row1' scope='row'>&raquo; To User
  262. <input class='input' type="text" name="to" size="15">
  263. <span class='imp'>* Required </span></td>
  264. </tr>"; //echo the input box without the value of the user!
  265. } //end user check in address bar
  266. echo "<form>
  267. <tr>
  268. <td width='17%' align='left' class='row1' scope='col'>&raquo; Subject:</td>
  269. <td width='83%' align='left' class='row1' scope='col'>
  270. &nbsp;&nbsp;&nbsp;&nbsp;<input name="title" type="text" class='input' value="Unitiled Message" size="15" Message> </td>
  271. </tr>
  272. <tr>
  273. <td width='22%' align='left' class='row1' scope='row'>&raquo; Content</td>
  274. <td width='83%' align='left' class='row1' scope='row'><div align='right'><a href='?page=bbcode'>BB Code Help?</a></div></td>
  275. </tr>
  276. <tr>
  277. <td width='17%' valign='bottom' class='row1' scope='col'><div align='left'><font size='1'><FONT COLOR='green'> <A href='?page=bbcode'>BBcode</A> &raquo; Enabled </font></div></td>
  278. <td width='83%' class='row1' scope='col'><center>
  279. <textarea id="TheTextArea" name="message" cols="45" rows="6" class='input'></textarea>
  280. <br><div style='padding-left: 5px; padding-top:5px;'>
  281. <input type='button' value='B' name='btnBold' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;<b>&#39;,&#39;</b>&#39;);'>
  282. <input type='button' value='I' name='btnItalic' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;<i>&#39;,&#39;</i>&#39;);'>
  283. <input type='button' value='U' name='btnUnderline' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;<u>&#39;,&#39;</u>&#39;);'>
  284. <input type='button' value='IMG' name='btnImg' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;<img src="&#39;,&#39;" />&#39;);''>
  285. <input type='button' value='URL' name='btnUrl' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;&#39;,&#39;&#39;);'>
  286. <input type='button' value='PHP' name='btnPHP' onclick='wrapText(document.getElementById(&#39;TheTextArea&#39;),&#39;[php]&#39;,&#39;
  287. &#39;);'></div></td>
  288. </tr>
  289. <tr>
  290. <td colspan='2' align='left' class='row1' scope='row'><input name="send" type="submit" class='boxbutton' value="Send Message"> </td>
  291. </tr>
  292. </form>"; //echo the rest of the form
  293. echo "<table width='99%' border='0' align='center' cellpadding='0' cellspacing='0'>
  294. <tr>
  295. <td height='5' scope='col'></td>
  296. </tr>";
  297. echo "<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='box'>
  298. <tr>
  299. <td height='21' align='left' class='row1' scope='col'><a href='index.php?page=pms'>Go Back?</a></td>
  300. </tr>";
  301. echo "</table>";
  302. }else{ //or if it was..
  303. echo "</table>";
  304. echo "</table>";
  305. echo "</table>";
  306. $to = stripslashes(htmlspecialchars(strip_tags($_POST[to]))); //who its to
  307. $from = $logged[username]; //who its from
  308. $date = date("F j, Y, g:i a"); //the date sent
  309. $msg = addslashes($_POST[message]); //the message variable
  310. $subject = addslashes($_POST[title]); //the subject
  311. $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!
  312. header("Location: index.php?page=pms&i=21");
  313. } //end sent check
  314. break; //end make new msg
  315. case 'delall': //delete all page
  316. $get = mysql_query("SELECT * FROM `privates` WHERE `to` = '" . $logged[username] . "'"); //get the private messages
  317. if(mysql_num_rows($get) == "0"){
  318. header("Location: index.php?page=pms&i=23");
  319. }else{
  320. $delete = mysql_query("DELETE FROM `privates` WHERE `to` = '" . $logged[username] . "'"); //delete tehm
  321. if($delete) { //check if theres a mySQL error
  322. header("Location: index.php?page=pms&i=22"); //success
  323. }else{ //or not
  324. header("Location: index.php?page=pms&i=24");
  325. } //end error check
  326. } //end msg check
  327. break; //end page
  328. case 'delete': //start the delete page!
  329. $id = (int)htmlspecialchars(strip_tags($_GET[id])); //make the ID safe
  330. if(!$id){ //if there is no ID to select
  331. echo "<a href="?page=pms">Go Back</a>No ID Selected!"; //echo the error
  332. }else{ //or if there is....
  333. $select = mysql_query("SELECT * FROM `privates` WHERE `pid` = '" . $id . "'"); //get the message's info
  334. $msg = mysql_fetch_array($select); //select all data
  335. if($msg[to] != $logged[username]){ //check if the user logged in is the owner of the message
  336. header("Location: index.php?page=pms&i=20"); //if not
  337. }else{ //maybe...
  338. $do = mysql_query("DELETE FROM `privates` WHERE `pid` = '" . $id . "'") or die(mysql_error());
  339. header("Location: index.php?page=pms&i=25");
  340. } //end check possession
  341. } //end id check
  342. break; //end the delete page!
  343. } //end switch/get
  344. } //end login check
  345. ?>
  346. </body>
  347. </html>
Posted on Monday 18th August 2008 at 02:57 PM
UrbanTwitch
UrbanTwitch's Avatar
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
VicVance
VicVance's Avatar
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. function BBCODE($content){ //define the function of bbcode
  3. $content = nl2br($content); //replaces returns with br's
  4. $match = array(
  5. '#[b](.*?)[/b]#se',
  6. '#[i](.*?)[/i]#se',
  7. '#[u](.*?)[/u]#se',
  8. '#[url=(.*?)](.*?)[/url]#se',
  9. '#[url](.*?)[/url]#se',
  10. '#[IMG](.*?)[/IMG]#se',
  11. '#[code](.*?)[/code]#se',
  12. '#[php](.*?)[/php]#se',
  13. '#[print](.*?)[/print]#se'
  14. PHP:
  15. <?php
  16.  
  17. function BBCODE($content){ //define the function of bbcode
  18. $content = nl2br($content); //replaces returns with br's
  19. $match = array(
  20. '#[b](.*?)[/b]#se',
  21. '#[i](.*?)[/i]#se',
  22. '#[u](.*?)[/u]#se',
  23. '#[s](.*?)[/s]#se',
  24. '#[url=(.*?)](.*?)[/url]#se',
  25. '#[url](.*?)[/url]#se',
  26. '#[img](.*?)[/img]#se',
  27. '#[code](.*?)[/code]#se',
  28. '#[php](.*?)[/php]#se',
  29. '#[html](.*?)[/html]#se',
  30. '#[print](.*?)[/print]#se',
  31. '#[center](.*?)[/center]#se',
  32. '#[right](.*?)[/right]#se',
  33. '#[left](.*?)[/left]#se',
  34. '#[justify](.*?)[/justify]#se',
  35. '#:biggrin:#se',
  36. '#:blink:#se',
  37. '#:dry:#se',
  38. '#:mad:#se',
  39. '#:mellow:#se',
  40. '#:ninja:#se',
  41. '#:cry:#se',
  42. '#:thumbsup:#se',
  43. '#:unsure:#se',
  44. ); //codes used in posts
  45. $replace = array(
  46. "'<b>\1</b>'",
  47. "'<i>\1</i>'",
  48. "'<u>\1</u>'",
  49. "'<a href="\1" target="_BLANK">\2</a>'",
  50. "'<a href="\1" target="_BLANK">\1</a>'",
  51. "'<img border="0" src="\1">'",
  52. "'<u><b>Code:</b></u>
  53. <div style="border: 1px dotted #000000; background-color: #CCCCCC; overflow: auto;">
  54. '.highlight_string(stripslashes(str_replace('', '', '$1')), true).'</div>'",
  55. "'<u><b>PHP Code:</b></u>
  56. <div style="border: 1px dotted #000000; background-color: #CCCCCC; overflow: auto;"> '.highlight_string(stripslashes(str_replace('', '', '$1')), true).'</div>'",
  57. "'<u><b>Print Out:</b></u>
  58. <div style="border: 1px dotted #000000; background-color: #CCCCCC; overflow: auto;">
  59. '.highlight_string(stripslashes(str_replace('', '', '$1')), true).'</div>'"
  60. "'<div style="text-align:center;">\1</div>'",
  61. "'<div style="text-align:right;">\1</div>'",
  62. "'<div style="text-align:left;">\1</div>'",
  63. "'<div style="text-align:justify;">\1</div>'",
  64. "'<img border="0" src="images/emoticons/biggrin.gif">'",
  65. "'<img border="0" src="images/emoticons/blink.gif">'",
  66. "'<img border="0" src="images/emoticons/dry.gif">'",
  67. "'<img border="0" src="images/emoticons/mad.gif">'",
  68. "'<img border="0" src="images/emoticons/mellow.gif">'",
  69. "'<img border="0" src="images/emoticons/ninja.gif">'",
  70. "'<img border="0" src="images/emoticons/cry.gif">'",
  71. "'<img border="0" src="images/emoticons/thumbsup.gif">'",
  72. "'<img border="0" src="images/emoticons/unsure.gif">'",
  73. ); //replacements
  74. return preg_replace($match, $replace, $content); //match, and replace
  75. } //end the function
  76. ?>
Posted on Monday 18th August 2008 at 07:00 PM
UrbanTwitch
UrbanTwitch's Avatar
Go to: images/emoticons/

and replace with yours.
Login or register to respond to this forum topic.