ok so here is the code that is being called
<?php
require 'core/init.php';
if(empty($_POST) === false)
{
$username = $_POST['userName'];
$password = $_POST['password'];
if(empty($username) === true || empty($password) === true)
{
$errors[] = 'please enter a username and password';
}else if(user_exists($username) === false)
{
$errors[] = 'we can\'t find that user, please contact AZ Media Production';
}else
{
$login = login($username, $password);
if($login == false)
{
$errors[] = 'That username/password combination is incorrect';
}else
{
$_SESSION[`user_id`] = $login;
header('Location: anounceEdit.php');
exit();
}
}
print_r($errors);
}
?>
now inside of my init.php is the code calling this code page
<?php
//include '../database/conection.php';
//include 'general.php';}these lines are commented out because of a failed attempt to fix my issue
function user_exsists($username)
{
$username = sanitize($username);
$query = mysql_query("SELECT COUNT(`user_id`) FROM `users` WHERE `userName` = '$username'");
return(mysql_result($query, 0) == 1) ? true : false;
}
function user_id_from_username($username)
{
$username = sanitize($username);
$query = mysql_query("SELECT `user_id` FROM `users` WHERE `userName` = '$username'");
return mysql_result($query, 0, 'user_id');
}
function login($username, $password)
{
$user_id = user_id_from_username($username);
$username = sanitize($username);
$password = sha1($password);
$query = mysql_query("SELECT COUNT(`user_id`) FROM `users` WHERE `userName` = '$username' AND `password` = '$password'");
return(mysql_result($query, 0) == 1) ? $user_id : false;
}
?>
i have tried entering
error_reporting(E_ALL);
ini_set('display_errors', 1);
to see if there are any other errors at the root of it all but i still just get:
Fatal error: Call to undefined function user_exists() in /home/traevale/public_html/riseandshine.com/test/login.php on line 12
I know that the function exists and the call looks correct, anyone else see any problem with my code?