unidox Posted April 29, 2008 Share Posted April 29, 2008 I need some help, I keep getting this error popping up. Here is my login.php: if (($_COOKIE['user']) && ($_COOKIE['pass'])) { $user = $_COOKIE['user']; $pass = $_COOKIE['pass']; $admin = LEVEL_ADMIN; $ip = $_SERVER["REMOTE_ADDR"]; $date = "" . date('l dS \of F Y h:i:s A') . " EST"; //MySQL Query $q = mysql_query("SELECT * FROM `pcp_users` WHERE password = '$pass' AND username = '$user'"); $r = mysql_fetch_array($q); $group = $r['group']; $q2 = mysql_query("SELECT * FROM `pcp_groups` WHERE `name` = '$group'"); $r2 = mysql_fetch_array($q2); $lvl_array = $r2['pages']; $lvl_array = split(":", $lvl_array); if ((mysql_num_rows($q) == 1) && (in_array("admin", $lvl_array))) { mysql_query("UPDATE `pcp_users` SET ip = '$ip', date = '$date' WHERE password = '$pass' AND username = '$user'"); $_SESSION['admin'] = 1; $_SESSION['user'] = $r['username']; header("Location: index.php"); } else { setcookie("user", "", time()-60*60*24*100, "/"); setcookie("pass", "", time()-60*60*24*100, "/"); header("Location: login.php"); } That checks a users cookie to make sure they are logged in. But I keep getting this error: Catchable fatal error: Object of class stdClass could not be converted to string in /home/purecp/public_html/beta/admin/process.php on line 23 This is index.php: include ('../incs/conf.inc.php'); include("process.php"); session_start(); if ($_SESSION['admin'] != '1') { header("Location: login.php"); } else { $user = $_SESSION['user']; $q = mysql_query("SELECT * FROM `pcp_users` WHERE username = '$user'") or die(mysql_error()); $r = mysql_fetch_array($q); $usergroup = $r['group']; $viewer = getenv('HTTP_USER_AGENT'); $browser = 'An Unidentified Browser.'; if (preg_match("/MSIE/i", "$viewer")) { $browser = 'Internet Explorer'; } if (preg_match("/Netscape/i", "$viewer")) { $browser = 'Netscape'; } if (preg_match("/Opera/i", "$viewer")) { $browser = 'Opera'; } if (preg_match("/Firefox/i", "$viewer")) { $browser = 'Mozilla Firefox'; } $platform = 'An Unidentified Platform.'; if (preg_match("/Windows/i", "$viewer")) { $platform = 'Windows'; } if (preg_match("/Linux/i", "$viewer")) { $platform = 'Linux'; } and the 1st few lines of process.php: session_start(); if ($_SESSION['admin'] != '1') { header("Location: login.php"); } else { if (!isset($path)) { exit(); } $q = mysql_query("SELECT * FROM `pcp_users` WHERE username = '$user'") or die (mysql_error()); // Line 22 <------ $r = mysql_fetch_array($q); $lvl = $r['level']; // Find the users level. $date = date("F jS, g:i a"); Whats wrong? Quote Link to comment Share on other sites More sharing options...
DarkWater Posted April 29, 2008 Share Posted April 29, 2008 Show us line 23 of process.php..... >_>And 5 lines above and below it. Quote Link to comment Share on other sites More sharing options...
unidox Posted April 29, 2008 Author Share Posted April 29, 2008 I did, the lines above it are just comments that I removed. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.