Guest User

Untitled

a guest
May 24th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. <title>Logging you in... | Project Club</title>
  2. <?php
  3. if (session_status() == PHP_SESSION_NONE){session_start();}
  4. $servername = "censored";
  5. $serverusername = "censored";
  6. $serverpassword = "censored";
  7. $serverdbname = "censored";
  8. $usernamemail = $_POST['usernamemail'];
  9. $password = $_POST['password'];
  10. $conn = new mysqli($servername, $serverusername, $serverpassword, $serverdbname);
  11. if (isset($_POST['username']) and isset($_POST['password'])){
  12. $sql = "SELECT * FROM login WHERE username='$usernamemail' OR email='$usernamemail'";
  13. $result = mysqli_query($conn, $sql);
  14. if ($row = mysqli_fetch_assoc($result)){
  15. $hashpwdcheck = password_verify($password, $row['password']);
  16. echo $hashpwdcheck;
  17. if ($hashpwdcheck){
  18. $backbtn = "<br><input type="button" value="Go Back" onclick="window.history.back()" /><style>input{padding:16px 32px;text-align:center;text-decoration:none;display:inline-block;font-size:16px;margin:4px 2px;transition-duration:0.4s;background-color:white;color:black;border:2px solid #f44336;}input:hover{background-color:#f44336;color:white;}html{margin:auto;width:60%;background-color:#d3d3d3;}p{color:black;}</style>";
  19. $_SESSION['username'] = $row['username'];
  20. echo "<center><p>You are successfully logged in.</p>" . $backbtn . "</center>";
  21. }else{
  22. echo "<center><p>Invalid Login Credentials.</p>" . $backbtn . "</center>";}}
  23. mysqli_close($conn);
  24. }else{echo "<center><p>Invalid Login Credentials.</p><br><input type="button" value="Go Back" onclick="window.history.back()" /></center><style>input{padding:16px 32px;text-align:center;text-decoration:none;display:inline-block;font-size:16px;margin:4px 2px;transition-duration:0.4s;background-color:white;color:black;border:2px solid #f44336;}input:hover{background-color:#f44336;color:white;}html{margin:auto;width:60%;background-color:#d3d3d3;}p{color:black;}</style>";};
  25. ?>
Add Comment
Please, Sign In to add comment