diff options
author | cflip <36554078+cflip@users.noreply.github.com> | 2021-04-24 09:40:20 -0600 |
---|---|---|
committer | cflip <36554078+cflip@users.noreply.github.com> | 2021-04-24 09:40:20 -0600 |
commit | 7c3f2e348c015ea93563d866f89ec8cea9159ea0 (patch) | |
tree | b7b6b18cf9087f42300f621d15101628a8d214e4 /signin.php | |
parent | 6c9369ad85f2fb3dc61234b54db7e7079cdc0c4e (diff) |
Refactoring part 2
Starting to move some functionality such as the session and database connection into singleton classes to manage them. Functions for modifying posts and threads are being put in one place as well.
Diffstat (limited to 'signin.php')
-rw-r--r-- | signin.php | 31 |
1 files changed, 16 insertions, 15 deletions
@@ -1,26 +1,27 @@ -<?php session_start()?> +<?php session_start() ?> <!DOCTYPE html> -<html> +<html lang="en"> <head> - <title>Sign in - cflip.net forum</title> - <link rel="stylesheet" href="styles/style.css"> + <title>Sign in - cflip.net forum</title> + <link rel="stylesheet" href="styles/style.css"> </head> <body> - <?php include_once 'templates/header.php' ?> - <h2>Sign in</h2> - <form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post"> - <label for="user_name">Username: </label><br> - <input type="text" name="user_name"><br> - <label for="user_pass">Password: </label><br> - <input type="password" name="user_pass"><br> - <input type="submit" name="submit"> - </form> +<?php include_once './includes/templates/header.php' ?> +<h2>Sign in</h2> +<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post"> + <label for="user_name">Username: </label><br> + <input type="text" name="user_name"><br> + <label for="user_pass">Password: </label><br> + <input type="password" name="user_pass"><br> + <input type="submit" name="submit"> +</form> <?php include_once 'includes/db_inc.php'; -function validate($data) { +function validate($data) +{ $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); @@ -29,7 +30,7 @@ function validate($data) { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $errors = array(); - + if (empty($_POST['user_name'])) { $errors[] = 'Please provide a username.'; } else { |