html - Strato HTTP Error 500 after uploading my profile.php
one text
I hope you can give me a lead how uploading my profile.php suddenly made it invalid to the server to proceed (?). I'm running my website online on Strato.de so I can check out if it works in a live environment. I renamed the file from reset.php to profile.php and suddenly became unable to be reached.
Test account: id: user | pw: test123
profile.php
<?php
session_start();
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title id="txt_white">Welcome</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
<link rel="stylesheet" href="/styles.css">
<style type="text/css">
body{ font: 14px sans-serif; text-align: center; }
</style>
</head>
<body>
<div>
<ul class="navfont">
<li><a href="http://saurusflex.de/">Home</a></li>
<li><a href="http://saurusflex.de/login.php">Login</a></li>
</ul>
<div class="date">
<?php echo "Last Update: " . date("d/m/Y h:i:sa"); ?>
</div>
</div>
<div class="page-header">
<h1 id="txt_white">Hi, <b><?php echo htmlspecialchars($_SESSION["username"]); ?></h1></b>. <p>Edit account</p>
</div>
<p id="txt_white">
<a href="reset.php" class="btn btn-warning">Reset Your Password</a>
<a href="logout.php" class="btn btn-danger">Sign Out of Your Account</a>
</p>
</body>
</html>
index.php
<?php
session_start();
if(isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true){
header("location: home.php");
exit;
}
require_once "config.php";
$username = $password = "";
$username_err = $password_err = "";
if($_SERVER["REQUEST_METHOD"] == "POST"){
if(empty(trim($_POST["username"]))){
$username_err = "Please enter username.";
} else{
$username = trim($_POST["username"]);
}
if(empty(trim($_POST["password"]))){
$password_err = "Please enter your password.";
} else{
$password = trim($_POST["password"]);
}
if(empty($username_err) && empty($password_err)){
$sql = "SELECT id, username, password FROM users WHERE username = ?";
if($stmt = mysqli_prepare($link, $sql)){
mysqli_stmt_bind_param($stmt, "s", $param_username);
$param_username = $username;
if(mysqli_stmt_execute($stmt)){
mysqli_stmt_store_result($stmt);
if(mysqli_stmt_num_rows($stmt) == 1){
mysqli_stmt_bind_result($stmt, $id, $username, $hashed_password);
if(mysqli_stmt_fetch($stmt)){
if(password_verify($password, $hashed_password)){
session_start();
$_SESSION["loggedin"] = true;
$_SESSION["id"] = $id;
$_SESSION["username"] = $username;
header("location: home.php");
} else{
$password_err = "The password you entered was not valid.";
}
}
} else{
$username_err = "The username you entered was not valid.";
}
} else{
echo "Oops! Something went wrong. Please try again later.";
}
mysqli_stmt_close($stmt);
}
}
mysqli_close($link);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Login</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
<link rel="stylesheet" href="styles.css"/>
<style type="text/css">
body{ font: 14px sans-serif; }
.wrapper{ width: 350px; padding: 20px; }
</style>
</head>
<body>
<div>
<ul class="navfont">
<li><a href="http://saurusflex.de/">Home</a></li>
</ul>
<div class="date">
<?php echo "Last Update: " . date("d/m/Y h:i:sa"); ?>
</div>
</div>
<div class="wrapper">
<h2 id="txt_white">Login</h2>
<p id="txt_white">Please fill in your credentials to login.</p>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
<div id="txt_white" class="form-group <?php echo (!empty($username_err)) ? 'has-error' : ''; ?>">
<label>Username</label>
<input type="text" name="username" class="form-control" value="<?php echo $username; ?>">
<span class="help-block"><?php echo $username_err; ?></span>
</div>
<div id="txt_white" class="form-group <?php echo (!empty($password_err)) ? 'has-error' : ''; ?>">
<label>Password</label>
<input type="password" name="password" class="form-control">
<span class="help-block"><?php echo $password_err; ?></span>
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" value="Login">
</div>
</form>
</div>
</body>
</html>
home.php
<?php session_start(); ?>
<?php
if(!isset($_SESSION['id'])){
die(header("location: 404.php"));
}
?>
<!DOCTYPE html>
<html lang="de-DE">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="styles.css"/>
<link rel=stylesheet href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<title>Home</title>
</head>
<body>
<div>
<ul class="navfont">
<li><a href="http://saurusflex.de/">Home</a></li>
<div class="btn float-right">
<a href="profile.php" class="btn btn-warning">Accountsettings</a>
<a href="logout.php" class="btn btn-danger">Sign Out</a>
</div>
</ul>
<div class="date">
<?php echo "Last Update: " . date("d/m/Y h:i:sa"); ?>
</div>
</div>
<div class="hello">
<h1>Welcome, <?php echo htmlspecialchars($_SESSION["username"]); ?></h1>
</div>
<div class="container">
<h2>Verzeichnis-Browser</h2>
<p>Ein Abbild vom Verzeichnis-Browser //Upload-Funktion kommt noch</p>
<table class="table table-hover">
<thead>
<tr>
<th>Filename</th>
<th>Last Change</th>
<th>Filesize</th>
</tr>
</thead>
<tbody>
<tr>
<td>test.docx</td>
<td>01.12.2020 04:22</td>
<td>23 KB</td>
</tr>
<tr>
<td>teller.xml</td>
<td>12.12.2020 14:11</td>
<td>41 MB</td>
</tr>
</tbody>
</table>
</div>
<footer class="footer">Copyright 2020</footer>
</body>
</html>
Source