Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. $title = isset($_POST['title']) ? $_POST['title'] : "";
  2. $content = isset($_POST['content']) ? $_POST['content'] : "";
  3. $img = isset($_POST['img']) ? $_POST['img'] : "";
  4. $source = isset($_POST['source']) ? $_POST['source'] : "";
  5. date_default_timezone_set ("Asia/Tel_Aviv");
  6. if (isset($_POST['title']) && strlen($title)>40)
  7. echo "<u>title must be over 10 digits!</u><br /><br />";
  8. if (isset($_POST['content']) && strlen($content)<=10)
  9. echo "<u>content must be over 10 digits!</u><br /><br />";
  10. if (isset($_POST['title']) || isset($_POST['content']) || isset($_POST['img']) || isset($_POST['souce']))
  11. {
  12. if ((strlen($title)==0) || (strlen($img)<=7) || (strlen($source)<=7))
  13. echo "<u>some fields are empty</u><br /><br />";
  14. }
  15. if ((strlen($title)>0) && (strlen($content)>10) && (strlen($title)<=30) && (strlen($img)>7) && (strlen($source)>7))
  16. {
  17. $statement = $db->prepare("INSERT INTO news VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
  18. $statement->execute(array(null, $content, date('y/n/j, G:i:s'), $_SESSION['id'], 'no', $title, $img, $source));
  19. echo "<u>data has been succefully inserted!</u><br /><br />";
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement