Advertisement
gitlez

Untitled

Jun 2nd, 2011
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. <?php
  2. require_once('connect.php');
  3. if (isset($_SESSION['user_id'])) { ;
  4. $user_id = $_SESSION['user_id'];
  5. } else {
  6. $user_id = 0;
  7. }
  8. // Look into SQL injection protection
  9. $title = $_POST['title'];
  10. $content = $_POST['content'];
  11.  
  12. $addTestimonial = mysql_query("INSERT INTO testimonial (title, content, user_id, date_created) VALUES ('$title', '$content', '$user_id', NOW())");
  13. if($addTestimonial) {
  14. echo 'Testimonial Added Succesfully.';
  15. echo '<meta http-equiv="refresh" content="2;url=testimonial.php">';
  16. } else {
  17. echo 'Error adding testimonial.';
  18. echo '<meta http-equiv="refresh" content="2;url=addTestimonial.php">';
  19. }
  20. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement