This is it!!

DealthRune DealthRune is offline Offline Aug 16th, 2009, 7:19 am |
0
This is it, I've completed my forum script and I'm sharing it with you!!!!!!!

:O


Hope you like it, if you find any bugs, please post it here


Oh yea, and the first registered person will be the admin
Quick reply to this message  
PHP Syntax
  1. <?php
  2. //save this as style.css
  3. ?>
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11. body {
  12. background-color: #666666;
  13. border: 10px solid #000000;
  14. color: #300000;
  15. text-align: center;
  16. padding: 5px;
  17. }
  18. #page {
  19. border: 1px solid #000000;
  20. color: #300000;
  21. background-color: #C0C0C0;
  22. text-align: center;
  23. padding: 5px;
  24. }
  25. #login {
  26. position: absolute;
  27. border: 1px solid black;
  28. color: #300000;
  29. background-color: #C0C0C0;
  30. text-align: center;
  31. padding: 5px;
  32. left: 50px;
  33. margin-top:5px;
  34. }
  35. #register {
  36. position: absolute;
  37. border: 1px solid black;
  38. color: #300000;
  39. background-color: #C0C0C0;
  40. text-align: center;
  41. padding: 5px;
  42. right: 50px;
  43. margin-top:5px;
  44. }
  45. #user_info {
  46. border: 1px solid black;
  47. margin: 5px;
  48. padding: 2px;
  49. text-align: right;
  50. }
  51. #page2 {
  52. border: 1px solid black;
  53. margin: 5px;
  54. padding: 2px;
  55. }
  56. #post {
  57. border: 1px solid black;
  58. }
  59. a {
  60. color: #000;
  61. text-decoration: underline;
  62. }
  63. a:hover {
  64. text-decoration: none;
  65. color: #000;
  66. }
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75. <?php
  76. //Save This Page as index.php
  77. ?>
  78.  
  79. <?php
  80. session_start();
  81. include("global.php");
  82. echo "<link href='style.css' rel='stylesheet' type='text/css' />";
  83. ?>
  84. <title>Main Forums Page</title>
  85. <div id="page">
  86. <?php
  87. if($_SESSION['username']){
  88. echo "<div id='user_info'>";
  89. echo "<h6>Welcome ".$_SESSION['username']."!";
  90. $result = mysql_query("SELECT `admin` FROM `users` WHERE `username` = '".$_SESSION['username']."'");
  91. while($row = mysql_fetch_array($result)){
  92. if($row['admin'] == 1){
  93. echo "<br><a href='new_cat.php'>New Catagory</a>";
  94. }
  95. }
  96. echo "<br>\n<a href='userchange.php'>Edit User Info</a>\n";
  97. echo "<br>\n<a href='logout.php'>Logout</a></h6>";
  98. echo "</div>";
  99. echo "<div id='page2'>\n";
  100. echo "<h2>Categories</h2>\n";
  101. echo "<hr size='1' width='75%'>\n";
  102. $result0 = mysql_query("SELECT * FROM forum_cats ORDER BY date");
  103. while($row = mysql_fetch_array($result0)){
  104. echo "<a href='forums.php?id=".$row['id']."'>".$row['cat_name']."</a><br>Date Added: ".$row['date']."<hr size='1' width='50%'><br>\n";
  105. }
  106. echo "<br>\n";
  107. echo "</div>";
  108. }else{
  109. echo "Welcome Guest! Please login or register to start viewing the categories, topics, and to start posting!";
  110. ?>
  111. <div id="login">
  112. <table border=0>
  113. <form action='./index.php' method='post'>
  114. <tr><td colspan="2" align="center" bgcolor="#333333"><font color="#ffffff">Login Form</font></td></tr>
  115. <tr><td>Username:</td><td><input type=text name=user maxsize=20></td></tr>
  116. <tr><td>Password:</td><td><input type=password name=pass maxsize=20></td></tr>
  117. <tr><td colspan="2"><input type="submit" value="Login" name="submit2"/></td></tr>
  118. </form>
  119. </table>
  120. <?php
  121. $sub = $_POST['submit2'];
  122. $u = $_POST['user'];
  123. $p = $_POST['pass'];
  124. if($sub){
  125. $sql = mysql_query("SELECT count(id) FROM users WHERE username='$u' AND password='$p'");
  126. $result = mysql_result($sql, 0);
  127. if($result!=1){
  128. print "<br>Invalid Login Information";
  129. }else{
  130. $result1 = mysql_query("SELECT * FROM users");
  131. while($row = mysql_fetch_array($result1)){
  132. mysql_query("UPDATE users SET admin = '1' WHERE id = '1'") or die(mysql_error());
  133. }
  134. $_SESSION['username'] = $u;
  135. echo "<br>You are now logged in ".$_SESSION['username']."!";
  136. }
  137. }
  138. ?>
  139. </div>
  140.  
  141. <div id="register">
  142. <table border="0" cellspacing="3" cellpadding="3">
  143. <form method="post" action="index.php">
  144. <tr><td colspan="2" align="center" bgcolor="#333333"><font color="#ffffff">Registration Form</font></td></tr>
  145. <tr><td>Username</td><td><input type="text" name="username"></td></tr>
  146. <tr><td>Password</td><td><input type="password" name="password"></td></tr>
  147. <tr><td>Confirm</td><td><input type="password" name="passconf"></td></tr>
  148. <tr><td>E-Mail</td><td><input type="text" name="email"></td></tr>
  149. <tr><td colspan="2" align="center"><input type="submit" name="submit" value="Register"></td></tr>
  150. </form>
  151. </table>
  152. </div>
  153. <?php
  154. if($_POST['submit']){
  155.  
  156. function protect($string){
  157. $string = mysql_real_escape_string($string);
  158. $string = strip_tags($string);
  159. $string = addslashes($string);
  160.  
  161. return $string;
  162. }
  163. $username = protect($_POST['username']);
  164. $password = protect($_POST['password']);
  165. $confirm = protect($_POST['passconf']);
  166. $email = protect($_POST['email']);
  167.  
  168. $errors = array();
  169.  
  170. if(!$username){
  171. $errors[] = "<br>Username is not defined!";
  172. }
  173.  
  174. if(!$password){
  175. $errors[] = "<br>Password is not defined!";
  176. }
  177.  
  178. if($password){
  179. if(!$confirm){
  180. $errors[] = "<br>Confirmation password is not defined!";
  181. }
  182. }
  183.  
  184. if(!$email){
  185. $errors[] = "<br>E-mail is not defined!";
  186. }
  187.  
  188.  
  189.  
  190. if($username){
  191. if(!ctype_alnum($username)){
  192. $errors[] = "<br>Username can only contain numbers and letters!";
  193. }
  194.  
  195. $range = range(1,32);
  196. if(!in_array(strlen($username),$range)){
  197. $errors[] = "<br>Username must be between 1 and 32 characters!";
  198. }
  199. }
  200.  
  201. if($password && $confirm){
  202. if($password != $confirm){
  203. $errors[] = "<br>Passwords do not match!";
  204. }
  205. }
  206.  
  207. if($email){
  208. $checkemail = "/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i";
  209. if(!preg_match($checkemail, $email)){
  210. $errors[] = "<br>E-mail is not valid, must be name@server.tld!";
  211. }
  212. }
  213.  
  214.  
  215. if($username){
  216. $sql = "SELECT * FROM `users` WHERE `username`='".$username."'";
  217. $res = mysql_query($sql) or die(mysql_error());
  218.  
  219. if(mysql_num_rows($res) > 0){
  220. $errors[] = "<br>The username you supplied is already in use!";
  221. }
  222. }
  223.  
  224. if($email){
  225. $sql2 = "SELECT * FROM `users` WHERE `email`='".$email."'";
  226. $res2 = mysql_query($sql2) or die(mysql_error());
  227.  
  228. if(mysql_num_rows($res2) > 0){
  229. $errors[] = "<br>The e-mail address you supplied is already in use of another user!";
  230. }
  231.  
  232. }
  233.  
  234. if(count($errors) > 0){
  235. foreach($errors AS $error){
  236. echo $error . "<br>\n";
  237. }
  238. }else {
  239. $ip = $_SERVER['REMOTE_ADDR'];
  240. $sql4 = "INSERT INTO `users`
  241. (`username`,`password`,`email`, `admin`, `ip`, `displaypic`, `ban`)
  242. VALUES ('".$username."','".$password."','".$email."','0', '$ip', 'None!', 'no')";
  243. $res4 = mysql_query($sql4) or die(mysql_error());
  244. echo "<font align=\"center\"><br><br>You have successfully<br>\n registered with the username <br>\n<b>".$username."</b> and the <br>\npassword <b>".$password."</b>!</font>";
  245. echo "</div>";
  246. }
  247. }
  248. }
  249. ?>
  250. </div>
  251.  
  252.  
  253.  
  254.  
  255. <?php
  256. //Save This As new_cat.php
  257. ?>
  258.  
  259.  
  260.  
  261.  
  262. <?php
  263. session_start();
  264. include("global.php");
  265. echo "<link href='style.css' rel='stylesheet' type='text/css' />";
  266. ?>
  267. <title>Adding Category</title>
  268. <div id="page">
  269. <?php
  270. $result000 = mysql_query("SELECT * FROM users WHERE username = '".$_SESSION['username']."'");
  271. while($row = mysql_fetch_array($result000)){
  272. if($row['ban'] == 'yes'){
  273. echo "<a href='logout.php'>logout</a><br>\n";
  274. die("I'm sorry, but you are currently banned and may not view the site.");
  275. }
  276. }
  277. if(!$_SESSION['username']){
  278. header("Location: index.php");
  279. }
  280. $query = mysql_query("SELECT admin FROM users WHERE username = '".$_SESSION['username']."'");
  281. while($row = mysql_fetch_array($query)){
  282. $admin = $row['admin'];
  283. }
  284. if($admin != 1){
  285. die("You are not authorized to be here.");
  286. }
  287. echo "<div id='user_info'>";
  288. echo "<h6>Logged in as: ".$_SESSION['username'].".<br><a href='userchange.php'>Edit User Info</a> | Click here to <a href='logout.php'>logout</a> | <a href='index.php'>Main Page</a></h6>";
  289. ?>
  290. </div>
  291. <div id='page2'><center><h2>Adding New Category</h2>
  292. <form action='new_cat.php' method='POST'>
  293. <p>Category Name: <input type='text' name='cat_name'></p>
  294. <p><input type='submit' value='Create Category' name='submit'></p>
  295. </form>
  296. <?php
  297. $sub = $_POST['submit'];
  298. $name = $_POST['cat_name'];
  299. if($sub){
  300. mysql_query("INSERT INTO forum_cats (cat_name) VALUES ('$name')");
  301. echo "Created category <b>".$name."</b>!";
  302. }
  303. ?>
  304. </div>
  305.  
  306.  
  307.  
  308.  
  309. <?php
  310. //Save This as forums.php
  311. ?>
  312.  
  313.  
  314.  
  315.  
  316.  
  317. <?php
  318. session_start();
  319. include("global.php");
  320. echo "<link href='style.css' rel='stylesheet' type='text/css' />\n";
  321. ?>
  322. <title>Forums Page</title>
  323. <div id="page">
  324. <?php
  325. $result000 = mysql_query("SELECT * FROM users WHERE username = '".$_SESSION['username']."'");
  326. while($row = mysql_fetch_array($result000)){
  327. if($row['ban'] == 'yes'){
  328. echo "<a href='logout.php'>logout</a><br>\n";
  329. die("I'm sorry, but you are currently banned and may not view the site.");
  330. }
  331. }
  332. if(!$_SESSION['username']){
  333. die("You must login to view the topics!");
  334. }
  335. echo "<div id='user_info'>\n";
  336. $id = $_GET['id'];
  337. $result2 = mysql_query("SELECT * FROM forum_cats WHERE id = '".$id."'");
  338. while($row = mysql_fetch_array($result2)){
  339. $cat = $row['cat_name'];
  340. }
  341. echo "<h6>Logged in as: ".$_SESSION['username'].".<br><a href='userchange.php'>Edit User Info</a> | Click here to <a href='logout.php'>logout</a> | <a href='index.php'>Main Page</a></h6>";
  342. ?>
  343. </div>
  344. <div id='page2'><center><h3>Topics In Category: <?php
  345. echo "<b>".$cat."</b>";
  346. ?>.</h3>
  347. <form action='?id=<?php echo $id; ?>' method='POST'>
  348. <input type='submit' value='New Topic' name='submit'>
  349. </form>
  350. <hr size='1' width='75%'>
  351. <?php
  352. $result = mysql_query("SELECT * FROM forum_sub_cats WHERE forum_cat_name = '".$cat."'");
  353. while($row = mysql_fetch_array($result)){
  354. echo "<a href='./topic.php?id=".$row['id']."'>".$row['sub_cat_name']."</a><br>\nDescription: <b>".$row['desc']."</b><br>\nDate Added: ".$row['date']."<hr size='1' width='50%'>\n<br>";
  355. }
  356. $sub = $_POST['submit'];
  357. if($sub){
  358. ?>
  359. <table border='0' cellpadding='5'>
  360. <tr><th colspan='2'>New Topic</th></tr>
  361. <form action='?id=<?php echo $id; ?>' method='POST'>
  362. <tr><td>Topic Name: </td><td><input type='text' name='sub_name'></td><tr>
  363. <tr><td>Topic Description: </td><td><input type='text' name='sub_desc'></td></tr>
  364. <tr><td colspan='2' align='right'><input type='submit' value='Create Topic' name='submit2'></td></tr>
  365. </form>
  366. </table>
  367. <?php
  368. }
  369. $sub2 = $_POST['submit2'];
  370. $name = $_POST['sub_name'];
  371. $desc = $_POST['sub_desc'];
  372. if($sub2){
  373. mysql_query("INSERT INTO forum_sub_cats (`sub_cat_name`, `forum_cat_name`, `desc`) VALUES ('$name', '$cat', '$desc')") or die(mysql_error());
  374. echo "Added Topic <b>".$name."</b>!";
  375. }
  376. ?>
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383. <?php
  384. //Save this as topic.php
  385. ?>
  386.  
  387.  
  388.  
  389.  
  390.  
  391. <?php
  392. session_start();
  393. include("global.php");
  394. echo "<link href='style.css' rel='stylesheet' type='text/css' />\n";
  395. ?>
  396. <title>Forums Page</title>
  397. <div id="page">
  398. <?php
  399. $result000 = mysql_query("SELECT * FROM users WHERE username = '".$_SESSION['username']."'");
  400. while($row = mysql_fetch_array($result000)){
  401. if($row['ban'] == 'yes'){
  402. echo "<a href='logout.php'>logout</a><br>\n";
  403. die("I'm sorry, but you are currently banned and may not view the site.");
  404. }
  405. }
  406. if(!$_SESSION['username']){
  407. die("You must login to view the posts!");
  408. }
  409. $result = mysql_query("SELECT * FROM users");
  410. while($row = mysql_fetch_array($result)){
  411. $uslevel = $row['admin'];
  412. }
  413. echo "<div id='user_info'>\n";
  414. $id = $_GET['id'];
  415. $result2 = mysql_query("SELECT * FROM forum_sub_cats WHERE id = '".$id."'");
  416. while($row = mysql_fetch_array($result2)){
  417. $cat = $row['sub_cat_name'];
  418. }
  419. $result1 = mysql_query("SELECT admin FROM users WHERE username = '".$_SESSION['username']."'");
  420. while($row = mysql_fetch_array($result1)){
  421. $ulevel = $row['admin'];
  422. }
  423. echo "<h6>Logged in as: ".$_SESSION['username'].".<br><a href='userchange.php'>Edit User Info</a> | Click here to <a href='logout.php'>logout</a> | <a href='index.php'>Main Page</a></h6>";
  424. ?>
  425. </div>
  426. <div id='page2'><center><h3>Posts In Topic: <?php
  427. echo "<b>".$cat."</b>";
  428. ?>.</h3>
  429. <form action='?id=<?php echo $id; ?>' method='POST'>
  430. </form>
  431. <hr size='1' width='75%'>
  432. <p>Posts:</p>
  433. <?php
  434. echo "<table border='0' cellpadding='5' cellspacing='5'>";
  435. $result3 = mysql_query("SELECT * FROM posts WHERE forum_sub_cat_name = '".$cat."'");
  436. while($row = mysql_fetch_array($result3)){
  437. $user = $row['user'];
  438. $post = $row['post'];
  439. echo "<tr><td colspan='3'><hr size='1'></td></tr>";
  440. echo "<tr align='left'><td colspan='2' align='center' bgcolor='#333333'><font color='#ffffff'>Username: <b>".$user."</b>&nbsp;&nbsp;&nbsp;Userlevel: ";
  441. if($uslevel == 0){
  442. echo "<b>Memeber</b>";
  443. if($ulevel == 1){
  444. echo " <br>\n<center><form action='?id=".$id."' method='POST'><input type='submit' name='edit' value='Edit'></form><form action='?id=".$id."' method='POST'><input type='submit' name='ban' value='Ban'></form>";
  445. }
  446. echo "</font></td></tr><tr><td align='left'>User Forum Pic: <br>\n".$row['display']."</td><td align='center'>Post: <br>\n<textarea rows='15' cols='20' readonly='readonly'>".$post."</textarea></td></tr>\n";
  447. }else if($uslevel == 1){
  448. echo "<b>Administrator</b>";
  449. if($ulevel == 1){
  450. echo " <br>\n<center><form action='?id=".$id."' method='POST'><input type='submit' name='edit' value='Edit'></form><form action='?id=".$id."' method='POST'><input type='submit' name='ban' value='Ban'></form>";
  451. }
  452. echo "</font></td></tr><tr><td align='left'>User Forum Pic: <br>\n".$row['display']."</td><td align='center'><textarea rows='15' cols='15' readonly='readonly'>".$post."</textarea></td></tr>\n";
  453. }
  454. echo "<tr><td bgcolor='#333333'><font color='#ffffff'>Posted: ".$row['date']."</font></td><td bgcolor='#333333'><font color='#ffffff'>Subject: ".$row['subject']."</font></td></tr>";
  455. echo "<tr><td colspan='3'><hr size='1'></td></tr>";
  456. }
  457. echo "</table>";
  458. ?>
  459. <hr size='1' width='75%'>
  460. <form action='?id=<?php echo $id; ?>' method='POST'>
  461. <table border='0' align='center' cellspacing='5'>
  462. <tr><th colspan='2'>Add A Post</th></tr>
  463. <tr><td>Subject: </td><td><input type='text' name='sub' size='20'></td></tr>
  464. <tr><td>Comment: </td><td><textarea name='comment' rows='5' cols='20'></textarea></td></tr>
  465. </tr><td colspan='2' align='right'><input type='submit' value='Add Post' name='submit'></td></tr>
  466. </table>
  467. </form>
  468. <?php
  469. $result3 = mysql_query("SELECT displaypic FROM users WHERE username = '".$_SESSION['username']."'");
  470. while($row = mysql_fetch_array($result3)){
  471. $display = $row['displaypic'];
  472. }
  473.  
  474. $sub = $_POST['submit'];
  475. $subj = $_POST['sub'];
  476. $com = $_POST['comment'];
  477. if($sub){
  478. if(($subj == '') || ($com == '')){
  479. die("You did not enter a Subject and/or a Post!");
  480. }
  481. mysql_query("INSERT INTO posts (`user`, `post`, `subject`, `forum_sub_cat_name`, `display`) VALUES ('".$_SESSION['username']."', '$com', '$subj', '$cat', '<img src=$display width=150 height=150/>')") or die(mysql_error());
  482. echo "Post Added!";
  483. }
  484. $sub2 = $_POST['edit'];
  485. $sub3 = $_POST['ban'];
  486. if($sub2){
  487. ?>
  488. <form action='?id=<?php echo $id; ?>' method='POST'>
  489. <p>Current Post: <textarea rows='15' cols='20' readonly='readonly'><?php echo $post; ?></textarea></p>
  490. <p>New Post: <textarea name='npost' rows='5' cols='20'></textarea></p>
  491. <p><input type='submit' name='edit2' value='Edit Post'></p>
  492. </form>
  493. <?php
  494. }
  495. $sub4 = $_POST['edit2'];
  496. $npost = $_POST['npost'];
  497. if($sub4){
  498. mysql_query("UPDATE posts SET post = '".$npost."'") or die(mysql_error());
  499. echo "Post Edited!";
  500. }
  501. if($sub3){
  502. mysql_query("UPDATE users SET ban = 'yes' WHERE username = '".$user."'") or die(mysql_error());
  503. echo "User Banned!";
  504. }
  505. ?>
  506.  
  507.  
  508.  
  509.  
  510. <?php
  511. //Save this as logout.php
  512. ?>
  513.  
  514.  
  515.  
  516.  
  517. <?php
  518. session_start();
  519. session_unset();
  520. session_destroy();
  521. header("Location: index.php");
  522. ?>
  523.  
  524.  
  525.  
  526.  
  527.  
  528. <?php
  529. //Save this as global.php
  530. //Make sure to edit the database names
  531. ?>
  532.  
  533.  
  534.  
  535. <?php
  536. $connect = mysql_connect('localhost', 'username', 'password') OR die("Error: ".mysql_error());
  537. $db = mysql_select_db('forum', $connect) OR die("Error: ".mysql_error());
  538. ?>
  539.  
  540.  
  541.  
  542.  
  543.  
  544. <?php
  545. //Save this as userchange.php
  546. ?>
  547.  
  548.  
  549.  
  550.  
  551. <?php
  552. session_start();
  553. include("global.php");
  554. echo "<link href='style.css' rel='stylesheet' type='text/css' />\n";
  555. ?>
  556. <title>User Administration</title>
  557. <div id="page">
  558. <?php
  559. $result000 = mysql_query("SELECT * FROM users WHERE username = '".$_SESSION['username']."'");
  560. while($row = mysql_fetch_array($result000)){
  561. if($row['ban'] == 'yes'){
  562. echo "<a href='logout.php'>logout</a><br>\n";
  563. die("I'm sorry, but you are currently banned and may not view the site.");
  564. }
  565. }
  566. if(!$_SESSION['username']){
  567. die("You must login to view this page!");
  568. }
  569. echo "<div id='user_info'>\n";
  570. echo "<h6>Logged in as: ".$_SESSION['username'].".<br><a href='userchange.php'>Edit User Info</a> | Click here to <a href='logout.php'>logout</a> | <a href='index.php'>Main Page</a></h6>";
  571. ?>
  572. </div>
  573. <div id='page2'><center><h2>User Administration</h2>
  574. <form action='userchange.php' method='POST'>
  575. <table border='0'>
  576. <tr><th>Change Password | </th><th>Current Pass:
  577. <?php
  578. $result = mysql_query("SELECT password FROM users WHERE username = '".$_SESSION['username']."'");
  579. while($row = mysql_fetch_array($result)){
  580. echo $row['password'];
  581. }
  582. ?></th></tr>
  583. <tr><td>New Pass</td><td><input type='password' name='pass' maxsize=20 /></td></tr>
  584. <tr><td>Confirm Pass</td><td><input type='password' name='pass2' maxsize=20 /></td></tr>
  585. <tr><td colspan=2><input type="submit" value="Change Pass" name="submit"/></td></tr>
  586. </table>
  587. </form>
  588. <?php
  589. $np = $_POST['submit'];
  590. $p = $_POST['pass'];
  591. $p2 = $_POST['pass2'];
  592.  
  593. if($np){
  594. if($p!=$p2){
  595. die("Passwords Don't Match!<br>");
  596. }
  597. if(($p=='') || ($p2=='')){
  598. die("Passwords Are Blank!<br>");
  599. }
  600. mysql_query("UPDATE users SET password = '".$p."' WHERE username = '".$_SESSION['username']."'") or die(mysql_error());
  601. echo "Password Changed!";
  602. }
  603. ?>
  604. <form action='userchange.php' method='POST'>
  605. <table border='0'>
  606. <tr><th>Change Forum Display Pic </th><th>(Note, this will be resized to 150 x 150)</th></tr>
  607. <tr><td>Forum Pic URL: </td><td><input type='text' name='url'></td></tr>
  608. <tr><td colspan='2'><input type='submit' value='Change Pic' name='submit0'></td></tr>
  609. </table>
  610. </form>
  611. <?php
  612. $sub2 = $_POST['submit0'];
  613. $url = $_POST['url'];
  614. if($sub2){
  615. mysql_query("UPDATE users SET displaypic = '".$url."' WHERE username = '".$_SESSION['username']."'");
  616. echo "Forum Pic Changed!";
  617. }
  618. ?>
  619. </div>
  620.  
  621.  
  622.  
  623.  
  624.  
  625. <?php
  626. //And finally, import this sql to your database
  627. ?>
  628.  
  629.  
  630.  
  631.  
  632.  
  633. CREATE TABLE IF NOT EXISTS `users` (
  634. `id` int(255) NOT NULL AUTO_INCREMENT,
  635. `username` varchar(20) NOT NULL,
  636. `password` varchar(20) NOT NULL,
  637. `email` varchar(50) NOT NULL,
  638. `admin` varchar(1) NOT NULL,
  639. `joined` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  640. `displaypic` varchar(500) NOT NULL,
  641. `ip` varchar(60) NOT NULL,
  642. `ban` varchar(10) NOT NULL,
  643. PRIMARY KEY (`id`)
  644. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  645.  
  646. CREATE TABLE IF NOT EXISTS `posts` (
  647. `id` int(255) NOT NULL AUTO_INCREMENT,
  648. `user` varchar(20) NOT NULL,
  649. `post` text NOT NULL,
  650. `subject` varchar(20) NOT NULL,
  651. `forum_sub_cat_name` varchar(60) NOT NULL,
  652. `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  653. `display` varchar(500) NOT NULL,
  654. PRIMARY KEY (`id`)
  655. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  656.  
  657. CREATE TABLE IF NOT EXISTS `forum_sub_cats` (
  658. `id` int(255) NOT NULL AUTO_INCREMENT,
  659. `sub_cat_name` varchar(60) NOT NULL,
  660. `forum_cat_name` varchar(60) NOT NULL,
  661. `desc` varchar(100) NOT NULL,
  662. `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  663. PRIMARY KEY (`id`)
  664. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  665.  
  666. CREATE TABLE IF NOT EXISTS `forum_cats` (
  667. `id` int(255) NOT NULL AUTO_INCREMENT,
  668. `cat_name` varchar(60) NOT NULL,
  669. `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  670. `admin` varchar(1) NOT NULL,
  671. PRIMARY KEY (`id`)
  672. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
0
DealthRune DealthRune is offline Offline | Aug 16th, 2009
Hopes you like it
 
0
kkeith29 kkeith29 is offline Offline | Aug 23rd, 2009
This code is horribly insecure. There are sql injection and xss holes. The code is a mess and very hard to follow. You should add some comments.

The way it stands now, I could delete your tables in your database and hijack sessions (there is a lot more I can do as well).

NO ONE USE THIS UNTIL THE ISSUES ARE FIXED!
 
0
LloydFarrell LloydFarrell is offline Offline | 2 Days Ago
This is dissapointing as I have been looking for a forum script to use for my site,

Would it be possible to add security to this to make this script secure ??

Hoping to hear a reply
 
 

Message:


Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC