Rev 123 | Rev 125 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 100 | freddie | 1 | <?php |
| 2 | |||
| 3 | require '../_taios.php'; |
||
| 4 | |||
| 5 | $page = new Taios_Page('Blog Posts', '../'); |
||
| 6 | |||
| 120 | tom | 7 | $error = ''; |
| 103 | freddie | 8 | |
| 120 | tom | 9 | $title = $_POST['title']; |
| 10 | $content = $_POST['content']; |
||
| 11 | $parentID = $_POST['parentID']; |
||
| 12 | $category = $_POST['category']; |
||
| 13 | |||
| 14 | if (empty($title)) |
||
| 100 | freddie | 15 | { |
| 120 | tom | 16 | $error = "No Title Specified"; |
| 17 | } |
||
| 18 | else if (empty($content)) |
||
| 19 | { |
||
| 20 | $error = "No Content Specified"; |
||
| 21 | } |
||
| 22 | else if (empty($parentID)) |
||
| 23 | { |
||
| 24 | $error = "No Parent ID Specified"; |
||
| 25 | } |
||
| 26 | else |
||
| 27 | { |
||
| 28 | $page->query('INSERT INTO BlogPosts VALUES(0, ' . $parentID . ', "' . $page->getLoggedInUser()->ID . '", "' . $title . '", "' . $content . '", NOW(), "' . $category . '", 0)'); |
||
| 100 | freddie | 29 | $page->redirect('index.php'); |
| 30 | } |
||
| 31 | |||
| 32 | $page->drawHeader(); |
||
| 33 | $page->drawBlogCategoriesMenu(); |
||
| 34 | $page->drawMiddle(); |
||
| 35 | |||
| 36 | ?> |
||
| 37 | |||
| 120 | tom | 38 | <form action="post-add.php" method="post"> |
| 100 | freddie | 39 | <table> |
| 40 | <tr> |
||
| 41 | <td class="bold">Title: </td> |
||
| 42 | <td><input type="text" name="title" /></td> |
||
| 43 | </tr> |
||
| 44 | <tr> |
||
| 45 | <td class="bold">Content: </td> |
||
| 124 | tom | 46 | <td><textarea name="content" style="width: 500px; height: 300px;"></textarea></td> |
| 100 | freddie | 47 | </tr> |
| 48 | <tr> |
||
| 49 | <td class="bold">Catagory: </td> |
||
| 120 | tom | 50 | <td><input type="text" name="category" /></td> |
| 100 | freddie | 51 | </tr> |
| 52 | |||
| 53 | <?php |
||
| 54 | write('<input type="hidden" name="parentID" value="' . $_GET['id'] . '"/>'); |
||
| 55 | ?> |
||
| 56 | |||
| 57 | <tr> |
||
| 58 | <td class="bold"></td> |
||
| 59 | <td><input type="submit" value="Post" /></td> |
||
| 60 | </tr> |
||
| 61 | </table> |
||
| 62 | </form> |
||
| 63 | |||
| 64 | <?php |
||
| 65 | |||
| 66 | $page->drawFooter(); |
||
| 67 | |||
| 68 | ?> |