Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $title = isset($_POST['title']) ? $_POST['title'] : "";
- $content = isset($_POST['content']) ? $_POST['content'] : "";
- $img = isset($_POST['img']) ? $_POST['img'] : "";
- $source = isset($_POST['source']) ? $_POST['source'] : "";
- date_default_timezone_set ("Asia/Tel_Aviv");
- if (isset($_POST['title']) && strlen($title)>40)
- echo "<u>title must be over 10 digits!</u><br /><br />";
- if (isset($_POST['content']) && strlen($content)<=10)
- echo "<u>content must be over 10 digits!</u><br /><br />";
- if (isset($_POST['title']) || isset($_POST['content']) || isset($_POST['img']) || isset($_POST['souce']))
- {
- if ((strlen($title)==0) || (strlen($img)<=7) || (strlen($source)<=7))
- echo "<u>some fields are empty</u><br /><br />";
- }
- if ((strlen($title)>0) && (strlen($content)>10) && (strlen($title)<=30) && (strlen($img)>7) && (strlen($source)>7))
- {
- $statement = $db->prepare("INSERT INTO news VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
- $statement->execute(array(null, $content, date('y/n/j, G:i:s'), $_SESSION['id'], 'no', $title, $img, $source));
- echo "<u>data has been succefully inserted!</u><br /><br />";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement