Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- ?>
- <form action="submit.php" method="POST">
- <input type="text" name="name" value="" placeholder="Username or Email" id="uname">
- <?php if (!empty($_SESSION['name_error'])) { ?>
- <span class="error">* <?= $_SESSION['name_error'] ?></span>
- <?php } ?>
- <input type="password" name="password" value="" placeholder="Password" id="password">
- <?php if (!empty($_SESSION['pass_error'])) { ?>
- <span class="error">* <?= $_SESSION['pass_error'] ?></span>
- <?php } ?>
- <input type="submit" name="save" value="Submit">
- </form>
- <?php
- session_start();
- $x = "typepass";
- if (isset($_POST['save'])) {
- if (empty($_POST['name'])) {
- $_SESSION['name_error'] = "Name is Required";
- } else {
- $name = $_POST['name'];
- }
- if (empty($_POST['password'])) {
- $_SESSION['pass_error'] = "password is required";
- } elseif ($_POST['password'] !== $x) {
- $_SESSION['pass_error'] = "password doesn't match";
- } else {
- $password = $_POST['password'];
- }
- //print "Username :" . " " . $name . "<br>" . "Password :" . " " . $password;
- header("Location:" . $_SERVER['HTTP_REFERER']);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement