Jump to content

Error?


unidox

Recommended Posts

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.