Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function sanitizeFormField($inputText, $toLower = false) {
- $inputText = strip_tags($inputText);
- $inputText = str_replace(" ", "", $inputText);
- if($toLower)
- $inputText = ucfirst(strtolower($inputText));
- return $inputText;
- }
- if(isset($_POST['loginButton'])) {
- //Register button has been pressed
- }
- if(isset($_POST["registerButton"])) {
- //Register button has been pressed
- $userName = sanitizeFormField($_POST['userName']);
- $firstName = sanitizeFormField($_POST['firstName'], true);
- $lastName = sanitizeFormField($_POST['lastName'], true);
- $email = sanitizeFormField($_POST['email'], true);
- $confirmEmail = sanitizeFormField($_POST['confirmEmail'], true);
- $password = sanitizeFormField($_POST['password']);
- $confirmPassword = sanitizeFormField($_POST['confirmPassword']);
- }
- ?>
- <html>
- <head>
- <title></title>
- </head>
- <body>
- <div id="inputContainer">
- <form id="loginForm" action="register.php" method="POST">
- <h2>Login to your account</h2>
- <p>
- <label for="loginUsername">Username</label>
- <input id="loginUsername" name="loginUsername" type="text" placeholder="e.g. Pr3k0" required>
- </p>
- <p>
- <label for="loginPassword">Password</label>
- <input id="loginPassword" name="loginPassword" type="password" placeholder="Your password" required>
- </p>
- <button type="submit" name="loginButton">LOG IN</button>
- </form>
- <form id="registerForm" action="register.php" method="POST">
- <h2>Create your account</h2>
- <p>
- <label for="userName">Username</label>
- <input id="userName" name="userName" type="text" placeholder="e.g. Pr3k0" required>
- </p>
- <p>
- <label for="firstName">First name</label>
- <input id="firstName" name="firstName" type="text" placeholder="e.g. Istvan" required>
- </p>
- <p>
- <label for="lastName">Last name</label>
- <input id="lastName" name="lastName" type="text" placeholder="e.g. Orban" required>
- </p>
- <p>
- <label for="email">Email address</label>
- <input id="email" name="email" type="email" placeholder="e.g. istvanorban@gmail.com" required>
- </p>
- <p>
- <label for="confirmEmail">Confirm email address</label>
- <input id="confirmEmail" name="confirmEmail" type="email" placeholder="e.g. istvanorban@gmail.com" required>
- </p>
- <p>
- <label for="password">Password</label>
- <input id="password" name="password" type="password" placeholder="Your password" required>
- </p>
- <p>
- <label for="confrimPassword">Password</label>
- <input id="confirmPassword" name="password" type="password" placeholder="Your password" required>
- </p>
- <button type="submit" name="registerButton">SIGN UP</button>
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement