Advertisement
Guest User

Untitled

a guest
Apr 16th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. if (empty( $_GET['name'] ) )
  5. {
  6. echo "Name can not be empty, redirecting back to homepage...";
  7. echo '<META HTTP-EQUIV="Refresh" CONTENT="3;URL=sign.php">';
  8. exit;
  9. }
  10.  
  11. echo"<br /><br /><center>";
  12.  
  13. if (isset( $_GET['LANG'] ) ) { $lang = $_GET['LANG'];}
  14. else { $lang = 'en';}
  15. include( $lang . '.php' );
  16.  
  17.  
  18. $host="localhost"; // Host name
  19. $username="root"; // Mysql username
  20. $password=""; // Mysql password
  21. $db_name="webappdb"; // Database name
  22. $tbl_name="guestbook"; // Table name
  23.  
  24. // Connect to server and select database.
  25. mysql_connect("$host", "$username", "$password")or die("cannot connect server ");
  26. mysql_select_db("$db_name")or die("cannot select DB");
  27.  
  28. $datetime=date("y-m-d h:i:s"); //date time
  29. $name = $_GET['name'];
  30. $comment = $_GET['comment'];
  31. $sql="INSERT INTO $tbl_name(name, comment, datetime)VALUES('$name', '$comment', '$datetime')";
  32.  
  33. $result=mysql_query($sql) or die(mysql_error());
  34.  
  35. //check if query successful
  36.  
  37. mysql_close();
  38.  
  39. ?>
  40. <!--
  41. <META HTTP-EQUIV="Refresh" CONTENT="3;URL=index.php">
  42. -->
  43. <br /><br />
  44. <form name="back" method="post" action="sign.php">
  45. <input type="submit" name="back" id="back" value="Submit another">
  46. </form>
  47. <form name="back" method="post" action="index.php">
  48. <input type="submit" name="back" id="back" value="Comments Page">
  49. </form>
  50.  
  51. </center>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement