Ok so i've got to websites running side by side and am trying to build a master login but its giving me a blank screen on one site (errors turned on) but works perfectly on the other.
Here are the two files that are all that is on one site that errors out, but when put atop the code of another works perfectly:
indy.init.php
<?php
session_start();
date_default_timezone_set("America/Chicago");
require('.../includes/connect.php');
$res = mysql_query("SELECT * FROM `user_logged` WHERE `ip` = '".$_SERVER['REMOTE_ADDR']."' LIMIT 1");
$que = mysql_fetch_array($res);
if( ( !( isset( $_COOKIE['id'] ) ) ) && ( mysql_num_rows( $res ) < 1 ) )
{
$user_logged = 'N';
$user = 1;
setcookie("id", "", time()-3600);
} else if( ( !( isset( $_COOKIE['id'] ) ) ) && ( mysql_num_rows( $res ) > 0 ) )
{
setcookie("id", $que['id'], time()+3600);
header("Location: /index.php");
exit;
} else if( isset( $_COOKIE['id'] ) && ( mysql_num_rows( $res ) > 0 ) )
{
$user_logged = $_COOKIE['id'];
$result[0] = mysql_query("SELECT * FROM `indy_users` WHERE `id` = '" . $_COOKIE['id'] . "' LIMIT 1");
$row[0] = mysql_fetch_array( $result[0] );
$user = array(
"name" => $row[0]['name'],
"email" => $row[0]['email'],
"class" => $row[0]['class']
);
} else if( isset( $_COOKIE['id'] ) && ( mysql_num_rows( $res ) < 1 ) && ( $que['logout'] == FALSE ) ) // Logout Bug, Fixed
{
$user_logged = 'N';
$user = 1;
setcookie("id", "", time()-3600);
} else if( isset( $_COOKIE['id'] ) && ( mysql_num_rows( $res ) < 1 ) && ( $que['logout'] == TRUE ) )
{
mysql_query("INSERT INTO `user_logged` (`id` ,`ip` ,`user_id`) VALUES (NULL , '".$_SERVER['REMOTE_ADDR']."', '".$row['id']."')");
header("Location: /index.php");
exit;
}
function getUserData($arg1,$arg2)
{
$result[0] = mysql_query("SELECT * FROM `indy_users` WHERE `id` = '" . $arg1 . "' LIMIT 1");
$row[0] = mysql_fetch_array( $result[0] );
return $row[0][$arg2];
}
// Make Sure Their is No God Damned Cache Storing my !@#$%
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
?>
Check.login.php
<div id="user_log" align="left">
<?php
if( $user_logged == 'N')
{
print "<form action=\"http://board.indyprogramming.co/user.login.php\" method=\"post\">\n";
print "Username: <input type=\"text\" name=\"name\" /> \n";
print "Password: <input type=\"password\" name=\"pass\" /> \n";
print "<input type=\"submit\" value=\"Go!\" />\n";
print " .:. <a href=\"main.register.php\">Register</a></form>\n";
} else
{
print $user['name'] . "\n";
print " .:. <a href=\"http://".$_SERVER['HTTP_HOST']."/main.logout.php\">Logout</a>\n";
}
?>
</div>
No errors at all, so i'm guessing a theory error but i'm so tired right now I can't see it. I figured i'd post it up and hope someone can help.
Oh and on the error site the only page is like this:
<?php
include ".../connect.php";
include ".../indy.init.php";
include ".../check.login.php";
?>
?>
[/code]