I am just started working with php and im following a login and registration guide on youtube. Problem is he is use the "old" code such as mysql insted of mysql / pod so I run into alot of errors that he don't and have trobble resolving everything. You have been nice with some assistance / guidance. Some error you may think "was it even worth a post for just google" But I have tried alot adding functions and $var for my self and put in extra text and my head is tierd after loong time of codeing. So I am little out of options / ideas.
ERROR: Fatal error: Function name must be a string in C:\wamp\www\core\functions\users.php on line 6
users.php
<?php
function user_exists ($username) {
global $mysqli_pekare;
$username = sanitize($username);
return (mysql_result($mysqli_pekare("SELECT COUNT('user_id') FROM 'users' WHERE 'username' = '$username'"), 0) == 1) ? true : false;
}
function user_active ($username) {
global $mysqli_pekare;
$username = sanitize($username);
return (mysql_result($mysqli_pekare("SELECT COUNT('user_id') FROM 'users' WHERE 'username' = '$username' AND 'active' = 1"), 0) == 1) ? true : false;
}
?>
login.php
<?php include 'core/init.php'; ?>
<!DOCTYPE HTML>
<html lang="sv">
<?php include 'includes/head/head.php'; ?>
<body>
<div id="wrapper">
<?php include 'includes/section/section.php'; ?>
<div id="content">
<h3>Skapa Konto</h3>
<?php include 'includes/meny/login.php'; ?>
<?php
if (user_exists('patrik') === true) {
echo 'It's working';
}
die("It's not working");
if (empty($POST) === false) {
$username = $POST['username'];
$password = $_POST['password'];
if(empty($username) == true || empty($password) === true) {
$errors[] = 'You need to enter a username and password'; //if the username or password is empty, display the code
} else if(user_exists($username) === false) { //WORKFLOW: we are checking if the user exists, which is calling the user_exists fucntion user_exists in users.php, which then passes in the username, sanitizing it by calling the sanitize function in the general.php, and then we run our query.
$errors[] = "We can't find the username. Have you registered?";
} else if (user_active($username) === false) {
$errors[] = "You haven\'t activated your account!";
} else
//here
{
print_r($errors);
}
}
?>
</div>
<?php include 'includes/article/article.php'; ?>
<?php include 'includes/footer/footer.php'; ?>
</div>
</body>
</html>