Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <?php
- echo "<form action='oneFile.php' method='post'>";
- echo "<table border='0'>";
- echo "<tr bgcolor='#cccccc'>";
- echo "<td width='150'>Username: </td>";
- echo "<td width='20'><input type='text' name='username' size='15'
- maxlength='15'></td>";
- echo "</tr><tr><tr bgcolor='#cccccc'>";
- echo "<td width='150'>Password: </td>";
- echo "<td width='20'><input type='password' name='password' size='15'
- maxlength='15'></td>";
- echo "</tr></tr><tr><td colspan='2' align='center'>
- <input type='submit' value='Login'></td>
- </tr>
- </table>
- </form>
- </body>
- </html>";
- ?>
- <?php
- $usernameArr = array( 1 => "elliez",
- 2 => "greatGuy",
- 3 => "blogger",
- 4 => "bob",
- 5 => "mike",
- 6 => "jane",
- 7 => "joe",
- 8 => "rachel",
- 9 => "james",
- 10 => "pizzaman2000");
- $passwordArr = array( 1 => "tr789ial",
- 2 => "abc123",
- 3 => "23seventeen23",
- 4 => "12345",
- 5 => "Password123",
- 6 => "P@ssword123",
- 7 => "pass123",
- 8 => "123pass",
- 9 => "123P@ssword",
- 10 => "54321");
- $varBool = false;
- if(isset($_POST['submit'])){
- $username = htmlspecialchars(trim($_POST['username']));
- $password = htmlspecialchars(trim($_POST['password']));
- trim($username);
- trim($password);
- }
- for ( $i = 1; $i <= 10; $i++){
- if ($username == $usernameArr[$i] && $password === $passwordArr[$i]){
- $varBool = true;
- }
- }
- If ($varBool){
- echo "You have successfully logged in!";
- }
- else{
- echo "Oops something went wrong try again!";
- }
- ?>
Add Comment
Please, Sign In to add comment