Advertisement
Guest User

Untitled

a guest
Aug 14th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. <html>
  2. <body>
  3.  
  4.  
  5. <?PHP
  6. $server = '72.14.188.135';
  7. $username = 'catz';
  8. $password = '12345';
  9. $database = 'All_Your_Base_Are_Belong_to_ME';
  10.  
  11. $db = mysql_connect($server, $username, $password, true);
  12. if(!$db){
  13. die('The grim reaper is going to come eat you'.mysql_error());
  14. }
  15. mysql_select_db($database);
  16.  
  17.  
  18. if(isset($_POST['submit'])){
  19. $comment = strip_tags(mysql_real_escape_string($_POST['comment']), '<b><u><i><em>');
  20. $name = strip_tags(mysql_real_escape_string($_POST['name']), '<b><u><i><em>');
  21. if($name == ''){
  22. $name = 'Anonymous';
  23. }
  24. if($comment == ''){
  25. echo '<b> Enter a comment and/or your name </b><br />';
  26. }else{
  27. $sqlcomment = "INSERT INTO Guestbook (comment, name) VALUES ('$comment', '$name')";
  28. if(mysql_query($sqlcomment)){
  29. echo '<b> Commented! <br /></b>';
  30. }
  31. }
  32. }
  33.  
  34. $sqlComDisp = "SELECT comment, name, timestamp FROM Guestbook";
  35.  
  36. $comQuery = mysql_query($sqlComDisp);
  37. while($commentDisp = mysql_fetch_assoc($comQuery)){
  38. echo '"'.$commentDisp['comment'].'"','<br />';
  39. echo '&nbsp&nbsp&nbsp&nbsp&nbsp-', $commentDisp['name'], '<font size="2"> ('.date('F j, Y, g:i a',strtotime($comment['timestamp'])).')</font>';
  40.  
  41. echo '<br /><br />';
  42. }
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. //mysql_fetch_assoc();
  53. //mysql_real_escape_string();
  54.  
  55.  
  56.  
  57. ?>
  58.  
  59. <form method="post" target="_self">
  60. Comment
  61. <br />
  62. <textarea name="comment" rows="5" cols="70"></textarea>
  63. <br />
  64. Name:
  65. <br /><input type="text" maxlength="30" size="30" name="name" />
  66. <br />
  67. <input type="submit" name="submit" value="Comment" />
  68. </form>
  69.  
  70. </body>
  71. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement