Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html id= "movie-color">
- <head>
- <title> Movie Xpress </title>
- <link rel="stylesheet" type="text/css" href="../css/site.css">
- </head>
- <body>
- <h3><a href="../index.html">ePortfolio</a></h3>
- <center>
- <h2 id="movie-title"> myMovies Xpress! </h2>
- <h4 id="login-direct"> Welcome to myMoviesXpress! <br>Please type in your login credentials in order to access the movie database.</h4>
- <hr>
- </center>
- <div class="row" style="padding-top: 25px;">
- <form action="logon.php" method="POST" id=movieForm>
- <label name="username-input">
- <font class=movie-username>Username: </font>
- </label>
- <input type="text" id="username-input" class="movie-login" name="username-input">
- <br>
- <br>
- <label name="password-input">
- <font class=movie-username>Password: </font>
- </label>
- <input type="password" id="password-input" class="movie-login" name="user-input">
- <br>
- <div class="row" style="padding-top: 15px;">
- <button type="submit" value="Submit">Login</button>
- <button type="reset" value="Reset">Clear</button>
- </div>
- </form>
- </div>
- <script src="script.js"></script>
- </body>
- </html>
- <?php
- session_start();
- if(empty($_POST['username-input'])){
- $this->HandleError("UserName is empty!");
- return false;
- }
- if(empty($_POST['password-input'])){
- $this->HandleError("Password is empty!");
- return false;
- }
- $filepath = 'data/credentials';
- $fp = fopen($filepath, 'r');
- $username = $_POST['username-input'];
- $password = $_POST['password-input'];
- if($username != ""){
- if($password != ""){
- $loginCredentials = $username." ".$password;
- while($line = fgets($fp)){
- $dbLoginCredentials = strtok($line, ':');
- $dbDisplayName = strtok(':',' ');
- if($loginCredentials = $dbLoginCredentials){
- $_SESSION['displayName'] = $dbDisplayName;
- header('location: index.php');
- break;
- }else{
- $this->HandleError("Invalid Username or Password!");
- header('location: login.php');
- return false;
- }
- }
- }
- }
- fclose($fp);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement