Advertisement
Guest User

Untitled

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