Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
!function ($) {
"use strict";
document.querySelector('button.passwd-reset').onclick = function () {
swal({
title: "<small>Passwort zurücksetzen</small>",
text: 'Sie haben hier die Möglichkeit ein neues Passwort anzufordern',
type: 'input',
html: true,
showCancelButton: true,
closeOnConfirm: true,
animation: "slide-from-top",
inputPlaceholder: "Benutzername oder E-Mail Adresse",
},
function (inputValue) {
if (inputValue === false)
return false;
if (inputValue === "") {
swal.showInputError("Bitte geben Sie Ihre E-Mail Adresse oder Benutzernamen ein!");
return false;
}
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", "../login.php?methode=passwd_reset&user="+inputValue, true );
xmlHttp.send();
});
};
}(window.jQuery);
function user_passwd_reset_fail()
{
swal("Fehler", "Es konnte kein neues Passwort generiert werden, bitte versuchen Sie es später erneut!", "error");
}
function user_passwd_reset_success()
{
alert("test");
swal("Erledigt!", "Bitte kontrollieren Sie Ihr E-Mail Postfach!", "success");
}
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Login</title>
<!-- Bootstrap -->
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="css/waves.min.css" type="text/css" rel="stylesheet"><link rel="stylesheet" href="css/nanoscroller.css">
<!-- <link rel="stylesheet" href="css/nanoscroller.css">-->
<link href="css/menu-light.css" type="text/css" rel="stylesheet">
<link href="css/style.css" type="text/css" rel="stylesheet">
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="css/themify-icons.css" rel="stylesheet">
<link href="css/color.css" rel="stylesheet">
<link rel="stylesheet" href="dist/sweetalert.css">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="account">
<div class="container">
<div class="row">
<div class="account-col text-center">
<img src="img/logo_login.png" width="150px" height="150px">
<h1>TL-Systems</h1>
<h3>Bitte einloggen!</h3>
<form class="m-t" role="form" action="login.php?methode=login" method="post">
<div class="form-group">
<input type="text" class="form-control" placeholder="Benutzername" required="" name="username">
</div>
<div class="form-group">
<input type="password" class="form-control" placeholder="Passwort" required="" name="password">
</div>
<input type="hidden" value="1" name="submit">
<button type="submit" class="btn btn-primary btn-block ">Login</button>
<!--<a class="passwd_recover" name="passwd_recover"><small>Passwort vergessen?</small></a> -->
</form>
<button class="btn btn-primary btn-block passwd-reset ">Passwort vergessen?</button>
<!-- <p class=" text-center"><small>Do not have an account?</small></p>
<a class="btn btn-default btn-block" href="register.html">Create an account</a> -->
<p>© TL-Systems - <?php echo date("Y"); ?></p>
</div>
</div>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>
<script src="js/metisMenu.min.js"></script><script src="js/jquery.nanoscroller.min.js"></script>
<script src="js/jquery-jvectormap-1.2.2.min.js"></script>
<script src="js/jquery.flot.min.js"></script>
<script src="js/jquery.flot.resize.min.js"></script>
<script src="js/jquery.flot.time.min.js"></script>
<script src="js/jquery.flot.threshold.js"></script>
<script src="js/jquery.flot.axislabels.js"></script>
<script src="js/pace.min.js"></script>
<script src="js/waves.min.js"></script>
<script src="js/jquery-jvectormap-world-mill-en.js"></script>
<!-- <script src="js/jquery.nanoscroller.min.js"></script>-->
<script type="text/javascript" src="js/custom.js"></script>
<script src="dist/sweetalert-dev.js"></script>
<script src="js/alert-popup.js"></script>
</body>
</html>
<?php
error_reporting(-1); // Alle Bits setzen = alle Fehler anzeigen
ini_set('display_errors', 1);
require_once 'dist/database_engine.php';
require_once 'dist/config.php';
DB::$user = $mysql_db_user;
DB::$password = $mysql_db_pass;
DB::$dbName = $mysql_db_name;
DB::$host = $mysql_db_host;
DB::$port = $mysql_db_port;
DB::$encoding = $mysql_encoding;
$methode = htmlentities($_GET["methode"]);
if($methode == "passwd_reset")
{
$user = htmlentities($_GET["user"]);
$mail_sender_address_query = DB::queryFirstRow("SELECT value FROM settings WHERE setting=%s", 'email_sender_address');
$mail_sender_address = $mail_sender_address_query['value'];
$mail_sender_name_query = DB::queryFirstRow("SELECT value FROM settings WHERE setting=%s", 'email_sender_name');
$mail_sender_name = $mail_sender_name_query['value'];
$mail_passwd_recovery_subj_query = DB::queryFirstRow("SELECT value FROM settings WHERE setting=%s", 'email_passwd_recovery_subj');
$mail_passwd_recovery_subj = $mail_passwd_recovery_subj_query['value'];
$mail_passwd_recovery_msg_query = DB::queryFirstRow("SELECT value FROM settings WHERE setting=%s", 'email_passwd_msg_subj');
$mail_passwd_recovery_msg = $mail_passwd_recovery_msg_query['value'];
DB::query("SELECT email FROM users WHERE email=%s OR username=%s", $user, $user);
$counter = DB::count();
if($counter == 1)
{
// Benutzer gefunden --> Passwort erstellen --> EMail versenden --> Success PopUp oeffnen
echo "<script type='text/javascript'>user_passwd_reset_success();</script>";// <<<<-------------------
$user_email_query = DB::queryFirstRow("SELECT email FROM users WHERE email=%s OR username=%s", $user, $user);
$user_email = $user_email_query['email'];
mail($user_email, $mail_passwd_recovery_subj, $mail_passwd_recovery_msg, "From: " .$mail_sender_name. " <".$mail_sender_address.">");
}
else
{
// Fehlermeldung wenn kein Benutzer gefunden wurde!
echo "<script type='text/javascript'>user_passwd_reset_fail();</script>"; // <<<<-------------------
}
}
if($methode == "login")
{
$username = htmlentities($_POST["username"]);
$password = htmlentities($_POST["password"]);
$submit = htmlentities($_POST["submit"]);
if(!empty($username) && !empty($password) && $submit == "1")
{
echo "ok";
}
}
?>
Der PHP-Code ja, die ganze Datei nicht unbedingt.Und: Muss eine PHP-Datei nicht mit "<?php" beginnen? Oder war das nur früher?
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Login</title>
<!-- Bootstrap -->
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="css/waves.min.css" type="text/css" rel="stylesheet"><link rel="stylesheet" href="css/nanoscroller.css">
<!-- <link rel="stylesheet" href="css/nanoscroller.css">-->
<link href="css/menu-light.css" type="text/css" rel="stylesheet">
<link href="css/style.css" type="text/css" rel="stylesheet">
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="css/themify-icons.css" rel="stylesheet">
<link href="css/color.css" rel="stylesheet">
<link rel="stylesheet" href="dist/sweetalert.css">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="account">
<?php
error_reporting(-1); // Alle Bits setzen = alle Fehler anzeigen
ini_set('display_errors', 1);
require_once 'dist/database_engine.php';
require_once 'dist/config.php';
DB::$user = $mysql_db_user;
DB::$password = $mysql_db_pass;
DB::$dbName = $mysql_db_name;
DB::$host = $mysql_db_host;
DB::$port = $mysql_db_port;
DB::$encoding = $mysql_encoding;
$methode = htmlentities($_GET["methode"]);
if($methode == "passwd_reset")
{
$user = htmlentities($_GET["user"]);
$mail_sender_address_query = DB::queryFirstRow("SELECT value FROM settings WHERE setting=%s", 'email_sender_address');
$mail_sender_address = $mail_sender_address_query['value'];
$mail_sender_name_query = DB::queryFirstRow("SELECT value FROM settings WHERE setting=%s", 'email_sender_name');
$mail_sender_name = $mail_sender_name_query['value'];
$mail_passwd_recovery_subj_query = DB::queryFirstRow("SELECT value FROM settings WHERE setting=%s", 'email_passwd_recovery_subj');
$mail_passwd_recovery_subj = $mail_passwd_recovery_subj_query['value'];
$mail_passwd_recovery_msg_query = DB::queryFirstRow("SELECT value FROM settings WHERE setting=%s", 'email_passwd_msg_subj');
$mail_passwd_recovery_msg = $mail_passwd_recovery_msg_query['value'];
DB::query("SELECT email FROM users WHERE email=%s OR username=%s", $user, $user);
$counter = DB::count();
if($counter == 1)
{
// Benutzer gefunden --> Passwort erstellen --> EMail versenden --> Success PopUp oeffnen
echo "<script type='text/javascript'>user_passwd_reset_success();</script>";// <<<<-------------------
$user_email_query = DB::queryFirstRow("SELECT email FROM users WHERE email=%s OR username=%s", $user, $user);
$user_email = $user_email_query['email'];
mail($user_email, $mail_passwd_recovery_subj, $mail_passwd_recovery_msg, "From: " .$mail_sender_name. " <".$mail_sender_address.">");
}
else
{
// Fehlermeldung wenn kein Benutzer gefunden wurde!
echo "<script type='text/javascript'>user_passwd_reset_fail();</script>"; // <<<<-------------------
}
}
if($methode == "login")
{
$username = htmlentities($_POST["username"]);
$password = htmlentities($_POST["password"]);
$submit = htmlentities($_POST["submit"]);
if(!empty($username) && !empty($password) && $submit == "1")
{
echo "ok";
}
}
?>
<div class="container">
<div class="row">
<div class="account-col text-center">
<img src="img/logo_login.png" width="150px" height="150px">
<h1>TL-Systems</h1>
<h3>Bitte einloggen!</h3>
<form class="m-t" role="form" action="login.php?methode=login" method="post">
<div class="form-group">
<input type="text" class="form-control" placeholder="Benutzername" required="" name="username">
</div>
<div class="form-group">
<input type="password" class="form-control" placeholder="Passwort" required="" name="password">
</div>
<input type="hidden" value="1" name="submit">
<button type="submit" class="btn btn-primary btn-block ">Login</button>
<!--<a class="passwd_recover" name="passwd_recover"><small>Passwort vergessen?</small></a> -->
</form>
<button class="btn btn-primary btn-block passwd-reset ">Passwort vergessen?</button>
<!-- <p class=" text-center"><small>Do not have an account?</small></p>
<a class="btn btn-default btn-block" href="register.html">Create an account</a> -->
<p>© TL-Systems - <?php echo date("Y"); ?></p>
</div>
</div>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>
<script src="js/metisMenu.min.js"></script><script src="js/jquery.nanoscroller.min.js"></script>
<script src="js/jquery-jvectormap-1.2.2.min.js"></script>
<script src="js/jquery.flot.min.js"></script>
<script src="js/jquery.flot.resize.min.js"></script>
<script src="js/jquery.flot.time.min.js"></script>
<script src="js/jquery.flot.threshold.js"></script>
<script src="js/jquery.flot.axislabels.js"></script>
<script src="js/pace.min.js"></script>
<script src="js/waves.min.js"></script>
<script src="js/jquery-jvectormap-world-mill-en.js"></script>
<!-- <script src="js/jquery.nanoscroller.min.js"></script>-->
<script type="text/javascript" src="js/custom.js"></script>
<script src="dist/sweetalert-dev.js"></script>
<script src="js/alert-popup.js"></script>
</body>
</html>
Setz mal deinen PHP-Tag zwischen <html<body> & </body></html>
Beispiel:
PHP:<!DOCTYPE html> <html lang="de"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <title>Login</title> <!-- Bootstrap --> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet"> <link href="css/waves.min.css" type="text/css" rel="stylesheet"><link rel="stylesheet" href="css/nanoscroller.css"> <!-- <link rel="stylesheet" href="css/nanoscroller.css">--> <link href="css/menu-light.css" type="text/css" rel="stylesheet"> <link href="css/style.css" type="text/css" rel="stylesheet"> <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet"> <link href="css/themify-icons.css" rel="stylesheet"> <link href="css/color.css" rel="stylesheet"> <link rel="stylesheet" href="dist/sweetalert.css"> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body class="account"> <?php error_reporting(-1); // Alle Bits setzen = alle Fehler anzeigen ini_set('display_errors', 1); require_once 'dist/database_engine.php'; require_once 'dist/config.php'; DB::$user = $mysql_db_user; DB::$password = $mysql_db_pass; DB::$dbName = $mysql_db_name; DB::$host = $mysql_db_host; DB::$port = $mysql_db_port; DB::$encoding = $mysql_encoding; $methode = htmlentities($_GET["methode"]); if($methode == "passwd_reset") { $user = htmlentities($_GET["user"]); $mail_sender_address_query = DB::queryFirstRow("SELECT value FROM settings WHERE setting=%s", 'email_sender_address'); $mail_sender_address = $mail_sender_address_query['value']; $mail_sender_name_query = DB::queryFirstRow("SELECT value FROM settings WHERE setting=%s", 'email_sender_name'); $mail_sender_name = $mail_sender_name_query['value']; $mail_passwd_recovery_subj_query = DB::queryFirstRow("SELECT value FROM settings WHERE setting=%s", 'email_passwd_recovery_subj'); $mail_passwd_recovery_subj = $mail_passwd_recovery_subj_query['value']; $mail_passwd_recovery_msg_query = DB::queryFirstRow("SELECT value FROM settings WHERE setting=%s", 'email_passwd_msg_subj'); $mail_passwd_recovery_msg = $mail_passwd_recovery_msg_query['value']; DB::query("SELECT email FROM users WHERE email=%s OR username=%s", $user, $user); $counter = DB::count(); if($counter == 1) { // Benutzer gefunden --> Passwort erstellen --> EMail versenden --> Success PopUp oeffnen echo "<script type='text/javascript'>user_passwd_reset_success();</script>";// <<<<------------------- $user_email_query = DB::queryFirstRow("SELECT email FROM users WHERE email=%s OR username=%s", $user, $user); $user_email = $user_email_query['email']; mail($user_email, $mail_passwd_recovery_subj, $mail_passwd_recovery_msg, "From: " .$mail_sender_name. " <".$mail_sender_address.">"); } else { // Fehlermeldung wenn kein Benutzer gefunden wurde! echo "<script type='text/javascript'>user_passwd_reset_fail();</script>"; // <<<<------------------- } } if($methode == "login") { $username = htmlentities($_POST["username"]); $password = htmlentities($_POST["password"]); $submit = htmlentities($_POST["submit"]); if(!empty($username) && !empty($password) && $submit == "1") { echo "ok"; } } ?> <div class="container"> <div class="row"> <div class="account-col text-center"> <img src="img/logo_login.png" width="150px" height="150px"> <h1>TL-Systems</h1> <h3>Bitte einloggen!</h3> <form class="m-t" role="form" action="login.php?methode=login" method="post"> <div class="form-group"> <input type="text" class="form-control" placeholder="Benutzername" required="" name="username"> </div> <div class="form-group"> <input type="password" class="form-control" placeholder="Passwort" required="" name="password"> </div> <input type="hidden" value="1" name="submit"> <button type="submit" class="btn btn-primary btn-block ">Login</button> <!--<a class="passwd_recover" name="passwd_recover"><small>Passwort vergessen?</small></a> --> </form> <button class="btn btn-primary btn-block passwd-reset ">Passwort vergessen?</button> <!-- <p class=" text-center"><small>Do not have an account?</small></p> <a class="btn btn-default btn-block" href="register.html">Create an account</a> --> <p>© TL-Systems - <?php echo date("Y"); ?></p> </div> </div> </div> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script> <script src="js/metisMenu.min.js"></script><script src="js/jquery.nanoscroller.min.js"></script> <script src="js/jquery-jvectormap-1.2.2.min.js"></script> <script src="js/jquery.flot.min.js"></script> <script src="js/jquery.flot.resize.min.js"></script> <script src="js/jquery.flot.time.min.js"></script> <script src="js/jquery.flot.threshold.js"></script> <script src="js/jquery.flot.axislabels.js"></script> <script src="js/pace.min.js"></script> <script src="js/waves.min.js"></script> <script src="js/jquery-jvectormap-world-mill-en.js"></script> <!-- <script src="js/jquery.nanoscroller.min.js"></script>--> <script type="text/javascript" src="js/custom.js"></script> <script src="dist/sweetalert-dev.js"></script> <script src="js/alert-popup.js"></script> </body> </html>