taylorconor
New member
I am curently constructing a login system for my website using php, But I am constantly getting error messages when I try to login. It says: Warning: host '*****' is not allowed to connect to the mysql server in home/a1218553/public_html/members/classes/mysql.php on line 10. I am completely stumped.
Here is the mysql.php file:
<?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;
}
}
}
}
here is the constants.php file:
<?php
// Define constants here
define('DB_NAME', 'a1218553_members');
define('DB_SEVER', 'a1218553_members');
define('DB_USER', 'members');
define('DB_PASSWORD', '*******');
and here is the login.php file:
<?php
session_start();
require_once 'classes/Membership.php';
$membership = new Membership();
// If the user clicks the "Log Out" link on the index page.
if(isset($_GET['status']) && $_GET['status'] == 'loggedout') {
$membership->log_User_Out();
}
// Did the user enter a password/username and click submit?
if($_POST && !empty($_POST['username']) && !empty($_POST['pwd'])) {
$response = $membership->validate_User($_POST['username'], $_POST['pwd']);
}
?>
//there is more irelevent html here
Help please! much appreciated, thanks
Here is the mysql.php file:
<?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;
}
}
}
}
here is the constants.php file:
<?php
// Define constants here
define('DB_NAME', 'a1218553_members');
define('DB_SEVER', 'a1218553_members');
define('DB_USER', 'members');
define('DB_PASSWORD', '*******');
and here is the login.php file:
<?php
session_start();
require_once 'classes/Membership.php';
$membership = new Membership();
// If the user clicks the "Log Out" link on the index page.
if(isset($_GET['status']) && $_GET['status'] == 'loggedout') {
$membership->log_User_Out();
}
// Did the user enter a password/username and click submit?
if($_POST && !empty($_POST['username']) && !empty($_POST['pwd'])) {
$response = $membership->validate_User($_POST['username'], $_POST['pwd']);
}
?>
//there is more irelevent html here
Help please! much appreciated, thanks