Ok, here we go....
I made a very VERY simple login for my site, and I used a function to check if the user is logged in or not, but even if I AM logged in, I get a message saying I'm not logged in.
Here is the code that goes in each file:
//Check to see if user has cookie set for login
pw_cookie($user_name, $usercook, $password, $passcook);
include("header.php");
//Check to make sure password and user name match mysql information
pw_check($pw_sql, $user_name, $result, $mypw);
if($mypw[password] == $password and $user_name != NULL ) {
And here are the functions this bit of code is calling:
//Password cookie set function
function pw_cookie($usercook, $passcook, $user_name, $password)
{
$user_name = $usercook;
$password = $passcook;
setcookie("usercook", $user_name);
setcookie("passcook", $password);
}
//Password check function
function pw_check($pw_sql, $user_name, $result, $mypw)
{
$pw_sql = "SELECT * FROM admin_info WHERE user_name = \"$user_name\"";
$result = @mysql_query($pw_sql);
$mypw = mysql_fetch_array($result);
}
Where am I going wrong? It's not checking to make sure I logged in correctly...either that, or something else is going on...
It works just fine when I put the code into the file, but when I call it as a function, it craps out...