Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- w8_view_startpage.php:
- <div id='signin' class='modal-window'>
- <h2 style='text-align:center'>Sign In</h2>
- <br>
- <form method='post' action='w4_controller.php'>
- <input type='hidden' name='page' value='StartPage'></input>
- <input type='hidden' name='command' value='SignIn'></input>
- <label class='modal-label'>Username:</label>
- <input type='text' name='username' placeholder='Enter username' required></input>
- <br>
- <label class='modal-label'>Password:</label>
- <input type='password' name='password' placeholder='Enter password' required></input>
- <br>
- <br>
- <button type='submit' value='Submit'>Submit</button>
- <button type='reset' value='Reset'>Reset</button>
- <button id='cancel-signin' type='cancel' value='Cancel'>Cancel</button>
- </form>
- </div>
- <div id='join' class='modal-window'>
- <h2 style='text-align:center'>Join</h2>
- <br>
- <form method='post' action='w4_controller.php'>
- <input type='hidden' name='page' value='StartPage'></input>
- <input type='hidden' name='command' value='Join'></input>
- <label class='modal-label'>Username:</label>
- <input type='text' name='username' placeholder='Enter username' required></input>
- <br>
- <label class='modal-label'>Password:</label>
- <input type='password' name='password' placeholder='Enter password' required></input>
- <br>
- <label class='modal-label'>Email:</label>
- <input type='text' name='email' placeholder='Enter email address' required></input>
- <br>
- <br>
- <button type='submit' value='Submit'>Submit</button>
- <button type='reset' value='Reset'>Reset</button>
- <button id='cancel-join' type='cancel' value='Cancel'>Cancel</button>
- </form>
- </div>
- w4_controller.php
- <?php
- require('w4_model.php'); // This file includes some routines to use DB.
- // E.g., is_valid() to check the validity of username and password.
- //...
- // When commands come from StartPage
- if ($_POST['page'] == 'StartPage') // Check the page value
- {
- $command = $_POST['page'];
- switch($command) { // When a command is sent from the client
- case 'SignIn': // With username and password
- // if (there is an error in username and password) {
- if (!is_valid($_POST['username'], $_POST['password'])) { // This function is defined in Model.
- include('w4_view_startpage.php'); // Include the start page
- } else
- include('w4_view_mainpage.php') // Include the main page
- exit();
- case 'Join': // With username, password, email, some other information
- //...
- exit();
- //...
- default:
- exit();
- }
- }
- // When commands come from 'MainPage'
- // Not implemented yet
- else {
- //...
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement