I'm new to all of this but I do know a decent amount of HTML/CSS. I want to create a login server and I got most of the code from a video. If someone could help me and explain thoroughly so I can understand it would be greatly appreciated. If any other stuff is needed I will gladly post it.
<?php
require_once 'includes/constants.php';
class Mysql {
private $conn;
function _construct() {
$this->conn = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME) or die('There was a problem connecting to the database.');
}
function verify_Username_and_Pass($un, $pwd) {
$query = "SELECT *
FROM users
WHERE username = ? AND password = ?
LIMIT 1";
if($stmt = $this->conn->prepare($query)) {
$stmt->bind_param('ss', $un, $pwd);
$stmt->execute();
if($stmt->fetch()) {
$stmt->close();
return true;
}
}
}
}
You need to grant permissions to the user@host in mysql. The grant command looks like
grant all privileges on YOURDB.* to
'YOURUSER'@'localhost' identified by 'YOURPASSWORD';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With