IneedHelp

Alles, was MariaDB und MySQL betrifft, kann hier besprochen werden.

IneedHelp

Postby fahad » 23. August 2021 10:12

Good day,
I need help and I have made a login system and with the login system when I enter my name and the password always comes as an answer: Eror !: SQLSTATE [HY000] [2002] php_network_getaddresses: getaddrinfo failed: The specified host is unknown: What would be the reason?


This is the code:

index.php:
<!DOCTYPE html>
<!-- saved from url=(0042)http://holdirbootstrap.de/examples/signin/ -->
<html lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Die 3 Meta-Tags oben *müssen* zuerst im head stehen; jeglicher sonstiger head-Inhalt muss *nach* diesen Tags kommen -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="http://holdirbootstrap.de/favicon.ico">

<title>Login/Bootstrap</title>

<!-- Bootstrap-CSS -->
<link href="./index_files/bootstrap.min.css" rel="stylesheet">

<!-- Besondere Stile für diese Vorlage -->
<link href="./index_files/signin.css" rel="stylesheet">

<!-- Nur für Testzwecke. Kopiere diese Zeilen nicht in echte Projekte! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="./index_files/ie-emulation-modes-warning.js.Download"></script>

<!-- Unterstützung für Media Queries und HTML5-Elemente in IE8 über HTML5 shim und Respond.js -->
<!--[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>
<div class="container">
<form class="form-signin" action="func/login.php" method="POST">
<h2 class="form-signin-heading">Login</h2>
<label for="frm_user" class="sr-only">Benutzer</label>
<input type="text" name="frm_user" id="frm_user" class="form-control" placeholder="Benutzer" required autofocus>
<label for="frm_psw" class="sr-only">Passwort</label>
<input type="password" name="frm_psw" id="frm_psw" class="form-control" placeholder="Passwort" required>
<div class="checkbox">
<label>
<input type="checkbox" value="remember-me"> Anmeldung speichern
</label>
</div>
<button class="btn btn-lg btn-primary btn-block" name="btn_login" type="submit">Login</button>
</form>

</div> <!-- /container -->


<!-- IE10-Anzeigefenster-Hack für Fehler auf Surface und Desktop-Windows-8 -->
<script src="./index_files/ie10-viewport-bug-workaround.js.Download"></script>


</body>
</html>

login.php:
<?php
if(isset($_POST['btn_login'], $_POST['frm_user'], $_POST['frm_psw']))
{
include("../inc/db_connect.php");

$frm_user = trim($_POST['frm_user']);
$frm_psw = trim($_POST['frm_psw']);

$stmt = $dbh->prepare("SELECT password, admin FROM tbl_users u WHERE u.username = :frm_user LIMIT1");
$stmt->bindParam(' :frm_user', $frm_user);
$stmt->execute();

while ($row = $stmt->fetch())
{
echo $db_psw = $row['password'];



if(password_verify($frm_psw, $db_psw))
{
session_start();

$_SESSION['user'] = $frm_user;
$_SESSION['logged_in'] = TRUE;
$_SESSION['admin'] = $row['admin'];

header('Location: ../pages/dashboard.php');
exit;
}
else
{
echo "Das Kennwort ist falsch";
}
}
}
?>

db_connect:
<?php
include("../inc/config.php");

try
{
$dbh = new PDO('mysql:host='.HOST.'dbname='.DATABASE.'', USER, PASSWORD);
}
catch(PDOException $e)
{
print "Eror!: " . $e->getMessage() . "</br>";
die();
}
?>

config.php:
<?php
define("HOST", "localhost");
define("USER", "sec");
define("PASSWORD", "2z[g5o@4dwdYg/Tr");
define("DATABASE", "secure_login");

define("INC_PATH", $_SERVER['DOCUMENT_ROOT'] . "/Login System/"); // C:xampp/htdocs/Login System/
//--> include(INC_PATH . "inc/config.php");
?>

dasboard.php:
<?php
session_start();
if(!isset($_SESSION['user'], $_SESSION['logged_in']))
{
header('Location: ../index.php');
exit;
}
?>
<!DOCTYPE html>
<!-- saved from url=(0046)http://holdirbootstrap.de/examples/dashboard/# -->
<html lang="de"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Die 3 Meta-Tags oben *müssen* zuerst im head stehen; jeglicher sonstiger head-Inhalt muss *nach* diesen Tags kommen -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="http://holdirbootstrap.de/favicon.ico">

<title>Dashboard-Vorlage für Bootstrap</title>

<!-- Bootstrap-CSS -->
<link href="./dashboard_files/bootstrap.min.css" rel="stylesheet">

<!-- Besondere Stile für diese Vorlage -->
<link href="./dashboard_files/dashboard.css" rel="stylesheet">

<!-- Nur für Testzwecke. Kopiere diese Zeilen nicht in echte Projekte! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="./dashboard_files/ie-emulation-modes-warning.js.Download"></script>

<!-- Unterstützung für Media Queries und HTML5-Elemente in IE8 über HTML5 shim und Respond.js -->
<!--[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>

<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="true" aria-controls="navbar">
<span class="sr-only">Navigation ein-/ausblenden</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="http://holdirbootstrap.de/examples/dashboard/#">Projekt-Titel</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="http://holdirbootstrap.de/examples/dashboard/#">Dashboard</a></li>
<li><a href="http://holdirbootstrap.de/examples/dashboard/#">Einstellungen</a></li>
<li><a href="http://holdirbootstrap.de/examples/dashboard/#">Profil</a></li>
<li><a href="http://holdirbootstrap.de/examples/dashboard/#">Hilfe</a></li>
</ul>
<form class="navbar-form navbar-right">
<input type="text" class="form-control" placeholder="Suchen...">
</form>
</div>
</div>
</nav>

<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li class="active"><a href="http://holdirbootstrap.de/examples/dashboard/#">Überblick <span class="sr-only">(aktuell)</span></a></li>
<li><a href="http://holdirbootstrap.de/examples/dashboard/#">Berichte</a></li>
<li><a href="http://holdirbootstrap.de/examples/dashboard/#">Analysen</a></li>
<li><a href="http://holdirbootstrap.de/examples/dashboard/#">Exportieren</a></li>
</ul>
<ul class="nav nav-sidebar">
<li><a href="http://holdirbootstrap.de/examples/dashboard/">Nav-Eintrag</a></li>
<li><a href="http://holdirbootstrap.de/examples/dashboard/">Noch ein Nav-Eintrag</a></li>
<li><a href="http://holdirbootstrap.de/examples/dashboard/">Und noch einer</a></li>
<li><a href="http://holdirbootstrap.de/examples/dashboard/">Anderer Nav-Eintrag</a></li>
<li><a href="http://holdirbootstrap.de/examples/dashboard/">Mehr Navigation</a></li>
</ul>
<ul class="nav nav-sidebar">
<li><a href="http://holdirbootstrap.de/examples/dashboard/">Noch ein Nav-Eintrag</a></li>
<li><a href="http://holdirbootstrap.de/examples/dashboard/">Und noch einer</a></li>
<li><a href="http://holdirbootstrap.de/examples/dashboard/">Anderer Nav-Eintrag</a></li>
</ul>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<h1 class="page-header">Dashboard</h1>

<div class="row placeholders">
<div class="col-xs-6 col-sm-3 placeholder">
<img data-src="holder.js/200x200/auto/sky" class="img-responsive" alt="Generisches Platzhalter-Bild">
<h4>Label</h4>
<span class="text-muted">Etwas anderes</span>
</div>
<div class="col-xs-6 col-sm-3 placeholder">
<img data-src="holder.js/200x200/auto/vine" class="img-responsive" alt="Generisches Platzhalter-Bild">
<h4>Label</h4>
<span class="text-muted">Etwas anderes</span>
</div>
<div class="col-xs-6 col-sm-3 placeholder">
<img data-src="holder.js/200x200/auto/sky" class="img-responsive" alt="Generisches Platzhalter-Bild">
<h4>Label</h4>
<span class="text-muted">Etwas anderes</span>
</div>
<div class="col-xs-6 col-sm-3 placeholder">
<img data-src="holder.js/200x200/auto/vine" class="img-responsive" alt="Generisches Platzhalter-Bild">
<h4>Label</h4>
<span class="text-muted">Etwas anderes</span>
</div>
</div>
</div>
</div>
</div>
</div>

<!-- Bootstrap-JavaScript
================================================== -->
<!-- Am Ende des Dokuments platziert, damit Seiten schneller laden -->
<script src="./dashboard_files/jquery.min.js.Download"></script>
<script src="./dashboard_files/bootstrap.min.js.Download"></script>
<!-- Nur, um unsere Platzhalter-Bilder zum Laufen zu bringen. Die nächste Zeile nicht wirklich kopieren! -->
<script src="./dashboard_files/holder.min.js.Download"></script>
<!-- IE10-Anzeigefenster-Hack für Fehler auf Surface und Desktop-Windows-8 -->
<script src="./dashboard_files/ie10-viewport-bug-workaround.js.Download"></script>


</body></html>
fahad
 
Posts: 6
Joined: 13. August 2021 20:06
XAMPP version: 8.0.9
Operating System: Windows 10 pro

Return to MariaDB - MySQL

Who is online

Users browsing this forum: No registered users and 29 guests