„auth.php“ löschen

This commit is contained in:
Givou 2023-02-06 20:28:59 +01:00
parent 2b204b18f9
commit 18321d86cd

View File

@ -1,50 +0,0 @@
<?php
session_start();
$DATABASE_HOST = 'censored';
$DATABASE_USER = 'censored';
$DATABASE_PASS = 'censored';
$DATABASE_NAME = 'censored';
$con = mysqli_connect($DATABASE_HOST, $DATABASE_USER, $DATABASE_PASS, $DATABASE_NAME);
if ( mysqli_connect_errno() ) {
exit('MySQl Connection failed with error: ' . mysqli_connect_error());
}
if ( !isset($_POST['username'], $_POST['password']) ) {
exit('Please fill both the username and password fields!');
}
if ($stmt = $con->prepare('SELECT id, password FROM accounts WHERE username = ?')) {
$stmt->bind_param('s', $_POST['username']);
$stmt->execute();
$stmt->store_result();
if ($stmt->num_rows > 0) {
$stmt->bind_result($id, $password);
$stmt->fetch();
if (password_verify($_POST['password'], $password)) {
session_regenerate_id();
$_SESSION['loggedin'] = TRUE;
$_SESSION['name'] = $_POST['username'];
$_SESSION['id'] = $id;
header("Location: admin.php");
} else {
//Incorrect Data
echo 'Incorrect username and/or password!';
}
} else {
//Incorrect Data
echo 'Incorrect username and/or password!';
}
$stmt->close();
}
?>