Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSascha Schumacher
14,145 PointsWhat is wrong?
Hello everybody Do you see an error ? I 've been looking all day the error . thanks for helping
login.php : <?php require 'database.php';
if(!empty($_POST['email']) && !empty($_POST['password'])):
$records = $conn->prepare('SELECT vname, nname, email, password FROM users WHERE email = :email');
$records->bindParam(':email', $_POST['email']);
$records->execute();
$results = $records->fetch(PDO::FETCH_ASSOC);
$message = '';
if(count($results) > 0 && password_verify($_POST['password'], $results['password']) ){
$_SESSION['user_id'] = $results['vname'];
} else {
$message = 'Sorry, those credentials do not match';
echo $message;
}
endif;
?>
<!DOCTYPE html> <html > <head> <?php include 'header.html'; ?> <style> body { display: flex; min-height: 100vh; flex-direction: column; }
main {
flex: 1 0 auto;
}
body {
}
.input-field input[type=date]:focus + label,
.input-field input[type=text]:focus + label,
.input-field input[type=email]:focus + label,
.input-field input[type=password]:focus + label {
color: #e91e63;
}
.input-field input[type=date]:focus,
.input-field input[type=text]:focus,
.input-field input[type=email]:focus,
.input-field input[type=password]:focus {
border-bottom: 2px solid #e91e63;
box-shadow: none;
}
</style> </head>
<body> <?php include 'nav.html'; ?> <div class="section"></div> <main> <center>
<div class="section"></div>
<h5 class="indigo-text">Login</h5>
<div class="section"></div>
<div class="container">
<div class="z-depth-1 grey lighten-4 row" style="display: inline-block; padding: 32px 48px 0px 48px; border: 1px solid #EEE;">
<form class="col s12" method="post" action="login.php">
<div class='row'>
<div class='col s12'>
</div>
</div>
<div class='row'>
<div class='input-field col s12'>
<input class='validate' type='email' name='email' id='email' />
<label for='email'>Email</label>
</div>
</div>
<div class='row'>
<div class='input-field col s12'>
<input class='validate' type='password' name='password' id='password' />
<label for='password'>Passwort</label>
</div>
<label style='float: right;'>
<!-- <a class='pink-text' href='#!'><b>Forgot Password?</b></a> !-->
</label>
</div>
<br />
<center>
<div class='row'>
<button type='submit' name='btn_login' class='col s12 btn btn-large waves-effect indigo'>Login</button>
</div>
</center>
</form>
</div>
</div>
<a href="register.php">Account erstellen</a>
</center>
<div class="section"></div>
<div class="section"></div>
</main>
<!-- Scripts-->
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="js/materialize.js"></script>
<script src="js/init.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.1/jquery.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.5/js/materialize.min.js"></script> </body>
</html>
Vicente Armenta
11,037 PointsVicente Armenta
11,037 PointsHello, can you be more specific with the error?
Regards.