Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (empty( $_GET['name'] ) )
- {
- echo "Name can not be empty, redirecting back to homepage...";
- echo '<META HTTP-EQUIV="Refresh" CONTENT="3;URL=sign.php">';
- exit;
- }
- echo"<br /><br /><center>";
- if (isset( $_GET['LANG'] ) ) { $lang = $_GET['LANG'];}
- else { $lang = 'en';}
- include( $lang . '.php' );
- $host="localhost"; // Host name
- $username="root"; // Mysql username
- $password=""; // Mysql password
- $db_name="webappdb"; // Database name
- $tbl_name="guestbook"; // Table name
- // Connect to server and select database.
- mysql_connect("$host", "$username", "$password")or die("cannot connect server ");
- mysql_select_db("$db_name")or die("cannot select DB");
- $datetime=date("y-m-d h:i:s"); //date time
- $name = $_GET['name'];
- $comment = $_GET['comment'];
- $sql="INSERT INTO $tbl_name(name, comment, datetime)VALUES('$name', '$comment', '$datetime')";
- $result=mysql_query($sql) or die(mysql_error());
- //check if query successful
- mysql_close();
- ?>
- <!--
- <META HTTP-EQUIV="Refresh" CONTENT="3;URL=index.php">
- -->
- <br /><br />
- <form name="back" method="post" action="sign.php">
- <input type="submit" name="back" id="back" value="Submit another">
- </form>
- <form name="back" method="post" action="index.php">
- <input type="submit" name="back" id="back" value="Comments Page">
- </form>
- </center>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement