Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <?php include_once "Config.php"; ?>
- <head>
- <title>Registration/Login</title>
- </head>
- <body>
- <center>
- <div>
- <form method="post" action="RegistrationCompletion.php">
- Registration<br><br>
- Username: <input type="text" id="username" name="username" maxlength="20" minlength="4" value="<?php
- if (isset($_POST["username"])) {
- echo $_POST["username"];
- }
- ?>" required> <?php
- // Check if unique username
- ?>
- <br><br>
- Password: <input type="password" id="password" name="password" maxlength="20" minlength="8" value="<?php
- if (isset($_POST["password"])) {
- echo $_POST["password"];
- }
- ?>" required><br><br>
- Repeat password: <input type="password" id="reppassword" name="reppassword" required/><br><br>
- E-mail: <input type="email" id="usermail" name="usermail"value="<?php
- if(isset($_POST["usermail"])){
- echo $_POST['usermail'];
- }
- ?>" required/><?php
- // Check if unique email
- ?>
- <br><br>
- <?php
- if(isset($_POST["password"]) and isset($_POST["reppassword"])) {
- if (trim($_POST["password"]) == "" or trim($_POST["reppassword"]) == "") {
- echo("All fields are required");
- }
- else if (($_POST["password"]) != ($_POST["reppassword"])) {
- echo("Passwords do not match");
- }
- }
- ?>
- <br><br>
- <input type="submit" name="register" value="Submit"/><br><br>
- </form>
- <form method="post" >
- Login<br><br>
- Username: <input type="text" id="logusername" name="logusername" value="<?php
- if(isset($_POST["logusername"])){
- echo $_POST["logusername"];
- }
- ?>" required/><br><br>
- Password: <input type="password" id="logpassword" name="logpassword" required/><br><br>
- <?php
- if(isset($_POST["logusername"])) {
- $logusername = $_POST["logusername"];
- $logpassword = $_POST["logpassword"];
- $querry = $connection->prepare("
- SELECT * FROM users WHERE username=:logusername AND password=md5(:logpassword);
- ");
- $querry->execute(array('logusername' => $logusername, 'logpassword' => $logpassword));
- $exists=$querry->fetch(PDO::FETCH_OBJ);
- if(!$exists){
- echo "Username or password do not match";
- }
- }
- ?><br><br>
- <input type="submit" name="login" value="Submit"/><br><br>
- </form>
- </div>
- <div>
- <a href="Home.php">
- <input type="button" name="back" value="Back"/>
- </a>
- </div>
- </center>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement