RaggedClinic13
New member
This is my code. I'm creating a game. The address to the game or shall I say, this page, is ecolina.eu/r.php; I have not decided yet if it's going to be a game about horses or cats. But I need help with my code. There is something wrong with the if-statements! When I use this if-statement (in the beginning of the page), it posts the same sentence twice "New record created successfully". But the text doesn't disappear when you enter the game again.
PHP:
<?php
require_once 'dg/connect.php';
$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$Username = $_POST['Username'];
$Password = $_POST['Password'];
$Email = $_POST['Email'];
$Link = "INSERT INTO Users (FirstName, LastName, Username, Password, Email, REG_DATE) VALUES ('$FirstName', '$LastName', '$Username', '$Password', '$Email', NOW())";
if (!mysqli_query($Conn, $Link)) {
echo "New record created successfully";
} else {
echo "Error: " . $Link . "<br>" . mysqli_error($Conn);
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Ecolina.eu // Epic Horse Game!</title>
<meta http-equiv="content-type" charset="UTF-8">
<link rel="stylesheet" type="text/css" href="sandwich-has-style.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div id="Container">
<div id="Header">
<h1><a href="#">Ecolina.eu</a></h1>
</div>
<!-- Att dom är IS-terrorister -->
<div id="Wrapper">
<div id="Content">
<div id="Extra">
<p><strong>More stuff here.</strong></p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec nec nibh gravida, porta dolor et, eleifend ante. Nullam placerat neque a blandit ultrices. Vestibulum at diam in dolor interdum placerat. Sed nunc arcu, mattis a bibendum vel, tincidunt dictum nisl. Aliquam erat volutpat. Mauris est dui, consectetur eget euismod ac, finibus accumsan velit. Phasellus suscipit posuere lorem quis dictum. Vestibulum pharetra pellentesque arcu, sed congue nunc mattis at.
</div>
<p><strong>Heading #1</strong></p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec nec nibh gravida, porta dolor et, eleifend ante. Nullam placerat neque a blandit ultrices. Vestibulum at diam in dolor interdum placerat. Sed nunc arcu, mattis a bibendum vel, tincidunt dictum nisl. Aliquam erat volutpat. Mauris est dui, consectetur eget euismod ac, finibus accumsan velit. Phasellus suscipit posuere lorem quis dictum. Vestibulum pharetra pellentesque arcu, sed congue nunc mattis at.
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec nec nibh gravida, porta dolor et, eleifend ante. Nullam placerat neque a blandit ultrices. Vestibulum at diam in dolor interdum placerat. Sed nunc arcu, mattis a bibendum vel, tincidunt dictum nisl. Aliquam erat volutpat. Mauris est dui, consectetur eget euismod ac, finibus accumsan velit. Phasellus suscipit posuere lorem quis dictum. Vestibulum pharetra pellentesque arcu, sed congue nunc mattis at.
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec nec nibh gravida, porta dolor et, eleifend ante. Nullam placerat neque a blandit ultrices. Vestibulum at diam in dolor interdum placerat. Sed nunc arcu, mattis a bibendum vel, tincidunt dictum nisl. Aliquam erat volutpat. Mauris est dui, consectetur eget euismod ac, finibus accumsan velit. Phasellus suscipit posuere lorem quis dictum. Vestibulum pharetra pellentesque arcu, sed congue nunc mattis at.
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec nec nibh gravida, porta dolor et, eleifend ante. Nullam placerat neque a blandit ultrices. Vestibulum at diam in dolor interdum placerat. Sed nunc arcu, mattis a bibendum vel, tincidunt dictum nisl. Aliquam erat volutpat. Mauris est dui, consectetur eget euismod ac, finibus accumsan velit. Phasellus suscipit posuere lorem quis dictum. Vestibulum pharetra pellentesque arcu, sed congue nunc mattis at.
</div>
</div>
<div id="Navigation">
<p><strong>Register An Account! Accountability</strong></p>
<ul>
<form id="Gurkis" method="POST" action="r.php">
Användarnamn: <input type="text" name="Username"> <?php if (empty($_POST['Username'])) { echo $Sql; } ?><br>
Förnamn: <input type="text" name="FirstName"> <?php if (empty($_POST['FirstName'])) { echo $Sql; } ?><br>
Efternamn: <input type="text" name="LastName"> <?php if (empty($_POST['LastName'])) { echo $Sql; } ?><br>
Lösenord: <input type="password" name="Password"> <?php if (empty($_POST['Password'])) { echo $Sql; } ?><br>
Email: <input type="email" name="Email"><br><br>
<input type="checkbox" id="Roots" value="Agree">
<label for="Roots">Jag Godkänner spelets Regler & Villkor!*</label><br><br>
<!-- Hi there. Phew! This has been quite a journey. I am in the middle of creating a game. I am very thrilled, but I can't stand the fact that Josefine's mamma is trying to spoil my code. I have, however, removed the evil code from my script. -->
<input type="submit" value="Registrera konto!*"><br><br>
<sub>*128-bit Encryption</sub>
</form>
</ul>
</div>
<div id="Footer">
<p><?php echo "Copyright © Lurking Games AB";?></p></table>
<!-- With 128 AES-encryption* -->
<!-- Jag tar gärna ett glas rött med dig -->
<!-- 3.60 GhZ -->
</div>
</div>
<!-- Signed Eilis -->
</body>
</html> <!-- End of file -->