Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>DBEntry</title>
- <meta name="description" content="Database entry test">
- </head>
- <body>
- <!use a table to align stuff and crap>
- <h1>This is my website</h1>
- <b>Login:</b>
- <form name="form1" method="POST" action="">
- <input type="text" name="box1"><br>
- <input type="password" name="box2"><br>
- <input type="submit" value="Go!" name="go1">
- </form>
- <?php
- $con = mysqli_connect("localhost","root","","db");
- if (mysqli_connect_errno()) {
- echo "<p>Failed to connect to server</p>";
- }
- if ($_POST) {
- if ($_POST["box1"]) {
- $ip = $_SERVER["REMOTE_ADDR"];
- $val = mysql_real_escape_string($_POST["box1"]);
- $sql = "INSERT INTO `db`.`input` (`input_id`, `ip`, `value`)
- VALUES (NULL, '$ip', '$val')";
- mysqli_query($con, $sql);
- } else {
- echo "<p>You need to type something in!</p>";
- }
- }
- ?>
- <br><br><br>
- <b>Register:</b>
- <form name="form2" method="POST" action="">
- <input type="text" name="box1"><br>
- <input type="password" name="box2"><br>
- <input type="password" name="box2check"><br>
- <input type="submit" value="Go!" name="go1">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement