Click here to Skip to main content
15,887,083 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
These are the two main sources of my problem I think,

From my functions.php page:

function sanitize_string(string $var)
{
$var = strip_tags($var);
$var = htmlentities($var);
$var = stripslashes($var);
$var = trim($var);
return mysqli_real_escape_string($var);
}



From my users.php page:

function authenticate_user($email, $password,$connection) {
$connection = mysqli_connect('localhost','root','','database');
$s_email = functions\sanitize_string($email);
$query = "SELECT * FROM ".USER_TABLE." WHERE email_address='$_email'";
$result = mysqli_query($connection,$query,MYSQLI_USE_RESULT);
if (!$result) die("Database access failed: " . mysqli_error($connection));
elseif (mysql_num_rows($result)) {
$row = mysql_fetch_assoc($result);
$input_token = encrypt_password($password);
if ($row['password'] == $input_token) {
$_SESSION['user_id'] = $row['id'];
$_SESSION['email_address'] = $row['email_address'];
$_SESSION['first_name'] = $row['first_name'];
return $row;
} else {

What I have tried:

Googled everything and everywhere for people with similar problems. Tried figuring out what I was doing wrong in terms of sanitizing the variables. I don't know
Posted
Comments
Sergey Alexandrovich Kryukov 17-Jun-16 0:35am    
It's just undefined, that's all. You did not show the any common context of this function and the place where it is called. If I cannot see it, no wonder the PHP interpreter might not see it. :-)
I wonder what you Googled for. All you need to find is how one PHP file can use another one (require, require_once, etc.) and how file path names work — one suspicious point is backslash (\). Path names use slash (/).
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900