Advertisement
Guest User

Untitled

a guest
Aug 14th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 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. session_start();
  18. if(isset($_POST['color'])){
  19. $color = strip_tags(mysql_real_escape_string($_POST['color']), '<b><u><i><em>');
  20. $_SESSION['color'] = $color;
  21. echo '<style type="text/css">
  22. body{
  23. background-color:'.$color.';
  24. }
  25. </style>';
  26. }
  27.  
  28.  
  29.  
  30.  
  31. if(isset($_POST['submit'])){
  32. $comment = strip_tags(mysql_real_escape_string($_POST['comment']), '<b><u><i><em>');
  33. $name = strip_tags(mysql_real_escape_string($_POST['name']), '<b><u><i><em>');
  34. if($name == ''){
  35. $name = 'Anonymous';
  36. }
  37. if($comment == ''){
  38. echo '<b> Enter a comment and/or your name </b><br />';
  39. }else{
  40. $sqlcomment = "INSERT INTO Guestbook (comment, name) VALUES ('$comment', '$name')";
  41. if(mysql_query($sqlcomment)){
  42. echo '<b> Commented! <br /></b>';
  43. }
  44. }
  45. }
  46.  
  47. $sqlComDisp = "SELECT comment, name, timestamp FROM Guestbook ORDER BY id DESC";
  48.  
  49. $comQuery = mysql_query($sqlComDisp);
  50. while($commentDisp = mysql_fetch_assoc($comQuery)){
  51. echo '"'.$commentDisp['comment'].'"','<br />';
  52. echo '&nbsp&nbsp&nbsp&nbsp&nbsp-', $commentDisp['name'], '<font size="2"> ('.date('F j, Y, g:i a',strtotime($commentDisp['timestamp'])).')</font>';
  53.  
  54. echo '<br /><br />';
  55. }
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65. //mysql_fetch_assoc();
  66. //mysql_real_escape_string();
  67.  
  68.  
  69.  
  70. ?>
  71.  
  72. <form method="post" target="_self">
  73. Comment
  74. <br />
  75. <textarea name="comment" rows="5" cols="70"></textarea>
  76. <br />
  77. Name:
  78. <br /><input type="text" maxlength="30" size="30" name="name" />
  79. <br />
  80. <input type="submit" name="submit" value="Comment" />
  81. <br />
  82. <br /><br /><br /><br /><br />Choose a background color!:
  83. <br />
  84. <input type="text" maxlength="10" size="10" name="color" />
  85. <br />
  86. <input type="submit" name="colorSubmit" value="Change Color" />
  87.  
  88. </form>
  89.  
  90. </body>
  91. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement