Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require_once('dbauth.php');
- if(isset($_POST['id'])) {
- // Registration or Login has been sumbitted.
- if(isset($_POST['checkbox'])) {
- // Register user.
- // There's no nice way to break out of nested if statements in PHP...
- switch(true) {
- case true:
- // so I cheat and break out of switch cases instead.
- if(!isset($_POST['confirm'])) {
- echo '<div class="error">Password Confirmation field is empty.</div>';
- break;
- }
- if($_POST['pass'] != $_POST['confirm']) {
- echo '<div class="error">Passwords do not match.</div>';
- break;
- }
- break;
- }
- register_user( $_POST['id'], $_POST['pass'] );
- }
- else {
- // Login.
- login_user( $_POST['id'], $_POST['pass'] );
- }
- }
- if(isset($_SESSION['userid'])) {
- header('Location:http://s.scon.es/');
- }
- ?>
- <form>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement