Taylor_1978
07-18-2005, 12:45 AM
Hey,
After seeing many people advise that using sessions as opposed to cookies is a better way to do a login/store... I changed my entire script (about 30 pages) so that it was thru sessions... and since then I have had nothing but trouble!
My new problem is this:
Fatal Error: Cannot use assign-op operators with overloaded objects nor string offsets in C:\FoxServ\www\yclub\modules\admin\guide.php on line 3
And here is what guide.php actually is:
<?php
$admin[body].='<b>Admin Guide</b> | <a href="?module=admin&mode=control">Control Panel</a> | <a href="?module=admin&mode=user">User Edit</a> | <a href="?module=admin&mode=logs">Logs</a>';
?>
THAT's IT! lol
Now.. admin.php in the modules directory, calls on this guide page, so I'll show that code:
// admin.php
<?php
force_login();
if ($_SESSION[admin] == 0 OR $_SESSION[admin] == 3) {
$admin[body] = "<div align=center class=error>SORRY! BUT YOU ARE NOT AN ADMINISTRATOR! NO ACCESS ALLOWED!</div>";
} else {
$admin[body]='
<h3>ADMINISTRATION PANEL</h3>';
if (!$mode) {
$mode = 'guide';
}
include('admin/'.$mode.'.php');
}
echo $admin[body];
function force_login() {
if($_SESSION[id]) {
$select = mysql_query("SELECT alias FROM users WHERE id='$_SESSION[id]'");
$logged = mysql_num_rows($select);
if ($logged == 0) { unset($_SESSION[id]); }
}
if (!$_SESSION[id]) {
echo "<div align=center class=error>ERROR: YOU MUST BE LOGGED IN TO USE THIS FEATURE!</DIV>";
die();
}
}
?>
Now.. there is the index.php page which includes the admin.php page and config.php - but this is not causing the problem with any of the other moule pages.. so the problem has to be up there somewhere.
On a side note:
Once the error comes up, if I refresh the error message goes away and I get just simply "<" - that's it. I also notice in my menu section that the Admin menu disappears, which means it has reset $_SESSION[admin] to either 0 or null, yet it keeps me logged in so $_SESSION[id] is still set.
EDIT: I just added in my script: echo $_SESSION[admin] and it's printing "<".. but that's on a different page! No where in my guide.php or admin.php do I have echo $_SESSION[admin] and yet it is showing "<" too!
Does anyone see any problems here?
Thanks in advance! :thumbsup:
Taylor.
After seeing many people advise that using sessions as opposed to cookies is a better way to do a login/store... I changed my entire script (about 30 pages) so that it was thru sessions... and since then I have had nothing but trouble!
My new problem is this:
Fatal Error: Cannot use assign-op operators with overloaded objects nor string offsets in C:\FoxServ\www\yclub\modules\admin\guide.php on line 3
And here is what guide.php actually is:
<?php
$admin[body].='<b>Admin Guide</b> | <a href="?module=admin&mode=control">Control Panel</a> | <a href="?module=admin&mode=user">User Edit</a> | <a href="?module=admin&mode=logs">Logs</a>';
?>
THAT's IT! lol
Now.. admin.php in the modules directory, calls on this guide page, so I'll show that code:
// admin.php
<?php
force_login();
if ($_SESSION[admin] == 0 OR $_SESSION[admin] == 3) {
$admin[body] = "<div align=center class=error>SORRY! BUT YOU ARE NOT AN ADMINISTRATOR! NO ACCESS ALLOWED!</div>";
} else {
$admin[body]='
<h3>ADMINISTRATION PANEL</h3>';
if (!$mode) {
$mode = 'guide';
}
include('admin/'.$mode.'.php');
}
echo $admin[body];
function force_login() {
if($_SESSION[id]) {
$select = mysql_query("SELECT alias FROM users WHERE id='$_SESSION[id]'");
$logged = mysql_num_rows($select);
if ($logged == 0) { unset($_SESSION[id]); }
}
if (!$_SESSION[id]) {
echo "<div align=center class=error>ERROR: YOU MUST BE LOGGED IN TO USE THIS FEATURE!</DIV>";
die();
}
}
?>
Now.. there is the index.php page which includes the admin.php page and config.php - but this is not causing the problem with any of the other moule pages.. so the problem has to be up there somewhere.
On a side note:
Once the error comes up, if I refresh the error message goes away and I get just simply "<" - that's it. I also notice in my menu section that the Admin menu disappears, which means it has reset $_SESSION[admin] to either 0 or null, yet it keeps me logged in so $_SESSION[id] is still set.
EDIT: I just added in my script: echo $_SESSION[admin] and it's printing "<".. but that's on a different page! No where in my guide.php or admin.php do I have echo $_SESSION[admin] and yet it is showing "<" too!
Does anyone see any problems here?
Thanks in advance! :thumbsup:
Taylor.