made register secure (hopefuly) and added the actual forms
This commit is contained in:
		@@ -9,7 +9,8 @@
 | 
				
			|||||||
<body>
 | 
					<body>
 | 
				
			||||||
    <h2>Login</h2>
 | 
					    <h2>Login</h2>
 | 
				
			||||||
    <form action="../login.php" method="post">
 | 
					    <form action="../login.php" method="post">
 | 
				
			||||||
        <!-- Add your login form fields here (e.g., username, password) -->
 | 
					        <input type="email" name="email" id="email-field" required>
 | 
				
			||||||
 | 
					        <input type="password" name="password" id="password-field" required>
 | 
				
			||||||
        <input type="submit" value="Login">
 | 
					        <input type="submit" value="Login">
 | 
				
			||||||
    </form>
 | 
					    </form>
 | 
				
			||||||
</body>
 | 
					</body>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,9 @@
 | 
				
			|||||||
<body>
 | 
					<body>
 | 
				
			||||||
    <h2>Register</h2>
 | 
					    <h2>Register</h2>
 | 
				
			||||||
    <form action="../register.php" method="post">
 | 
					    <form action="../register.php" method="post">
 | 
				
			||||||
        <!-- Add your registration form fields here (e.g., username, email, password) -->
 | 
					        <input type="text" name="username" id="username-field" required>
 | 
				
			||||||
 | 
					        <input type="email" name="email" id="email-field" required>
 | 
				
			||||||
 | 
					        <input type="password" name="password" id="password-field" required>
 | 
				
			||||||
        <input type="submit" value="Register">
 | 
					        <input type="submit" value="Register">
 | 
				
			||||||
    </form>
 | 
					    </form>
 | 
				
			||||||
</body>
 | 
					</body>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,10 @@ require_once 'config.php';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Handle registration form submission
 | 
					// Handle registration form submission
 | 
				
			||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
 | 
					if ($_SERVER["REQUEST_METHOD"] == "POST") {
 | 
				
			||||||
 | 
					    // Validate that required fields are provided
 | 
				
			||||||
 | 
					    if (empty($_POST['username']) || empty($_POST['email']) || empty($_POST['password'])) {
 | 
				
			||||||
 | 
					        echo "Please provide all required fields (username, email, and password).";
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
        $username = $_POST['username'];
 | 
					        $username = $_POST['username'];
 | 
				
			||||||
        $email = $_POST['email'];
 | 
					        $email = $_POST['email'];
 | 
				
			||||||
        $password = $_POST['password'];
 | 
					        $password = $_POST['password'];
 | 
				
			||||||
@@ -28,4 +32,5 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
 | 
				
			|||||||
        // Close the statement
 | 
					        // Close the statement
 | 
				
			||||||
        $stmt->close();
 | 
					        $stmt->close();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user