mirror of
https://github.com/codeguy/php-the-right-way.git
synced 2025-08-12 16:54:00 +02:00
coding style fix
This commit is contained in:
committed by
Josh Lockhart
parent
b41eeca6da
commit
ff25a697d4
@@ -45,7 +45,7 @@ which will delete all of your users! Instead, you should sanitize the ID input u
|
|||||||
<?php
|
<?php
|
||||||
$pdo = new PDO('sqlite:users.db');
|
$pdo = new PDO('sqlite:users.db');
|
||||||
$stmt = $pdo->prepare('SELECT name FROM users WHERE id = :id');
|
$stmt = $pdo->prepare('SELECT name FROM users WHERE id = :id');
|
||||||
$stmt->bindParam(':id', $_GET['id'], PDO::PARAM_INT); //<-- Automatically sanitized by PDO
|
$stmt->bindParam(':id', $_GET['id'], PDO::PARAM_INT); // <-- Automatically sanitized by PDO
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
|
@@ -22,9 +22,9 @@ require 'password.php';
|
|||||||
$passwordHash = password_hash('secret-password', PASSWORD_DEFAULT);
|
$passwordHash = password_hash('secret-password', PASSWORD_DEFAULT);
|
||||||
|
|
||||||
if (password_verify('bad-password', $passwordHash)) {
|
if (password_verify('bad-password', $passwordHash)) {
|
||||||
//Correct Password
|
// Correct Password
|
||||||
} else {
|
} else {
|
||||||
//Wrong password
|
// Wrong password
|
||||||
}
|
}
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user