Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $error = '';
- // Form is gesubmit dus let's go on :P
- if (array_key_exists('formSubmit', $_POST) && trim($_POST['formSubmit']) != '')
- {
- // geen username gevonden
- if (!array_key_exists('username', $_POST) || trim($_POST['username']) == '')
- {
- $error = 'Please enter your username!';
- }
- // Geen password gevonden
- else if (!array_key_exists('password', $_POST) || trim($_POST['password']) == '')
- {
- $error = 'Please enter your password!';
- }
- // Beide velden zijn ingevuld we kunnen door
- else
- {
- // Code voor het controleren of inloggen is gelukt
- // ..............
- // ..............
- // Inloggen is gelukt stuur door naar anderepagina.php
- die(header('Location: anderepagina.php'));
- }
- }
- ?>
- <html>
- ...
- ...
- <?php
- if ($error != '')
- {
- echo '<div>ERROR: '.$error.'</div>;
- }
- ?>
- <form name="blaForm" method="post" action="<?php echo $_SERVER["PHP_SELF"]; ?>" >
- Username: <input type="text" name="username" />
- Password: <input type="password" name="password" />
- <input type="submit" name="formSubmit" value="Log in" />
- </form>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement