glennn.php Posted April 1, 2008 Share Posted April 1, 2008 a real estate cms (that's probably old) is returning this error: Fatal error: Using $this when not in object context in /path/to/html/remgmt/admin/pb_events.php on line 29 function DoEvents($this) { global $_CONF , $_TSM; $_TSM["MENU"] = ""; //checking if user is logged in if (!$_SESSION["minibase"]["user"]) { if ($_SERVER["REQUEST_METHOD"] == "POST") { //autentificate $user = $this->db->QFetchArray("select * from {$this->tables[users]} where `user_login` = '{$_POST[user]}' AND `user_password` = '{$_POST[pass]}'"); if (is_array($user)) { $_SESSION["minibase"]["user"] = 1; $_SESSION["minibase"]["raw"] = $user; //redirecing to viuw sites header("Location: $_CONF[default_location]"); exit; } else return $this->templates["login"]->blocks["Login"]->output; } else /* LINE 29 >>> */ return $this->templates["login"]->blocks["Login"]->output; } if ($_SESSION["minibase"]["raw"]["user_level"] == 0) { $_TSM["MENU"] = $this->templates["login"]->blocks["MenuAdmin"]->output; } else { $_TSM["MENU"] = $this->templates["login"]->blocks["MenuUser"]->output; } if (!$_POST["task_user"]) $_POST["task_user"] = $_SESSION["minibase"]["user"]; if($_SESSION["minibase"]["raw"]["user_level"] == 1) { $_CONF["forms"]["adminpath"] = $_CONF["forms"]["userpath"]; } I'm pretty sure i've got PHP5 (on godaddy's server)... anything anyone can help me with? Thanks Much, GN Link to comment https://forums.phpfreaks.com/topic/99027-fatal-error-using-this-when-not-in-object/ Share on other sites More sharing options...
uniflare Posted April 1, 2008 Share Posted April 1, 2008 That fatal error implies you do have OOP Class support (correct me if im wrong ). Are you sure this function is inside a class object? ie: Class classname { function function_name(){ } } Link to comment https://forums.phpfreaks.com/topic/99027-fatal-error-using-this-when-not-in-object/#findComment-506729 Share on other sites More sharing options...
papaface Posted April 1, 2008 Share Posted April 1, 2008 function DoEvents($this) $this is a reserved variable (i think) when using functions because of classes . Chose a different name for your variable. Link to comment https://forums.phpfreaks.com/topic/99027-fatal-error-using-this-when-not-in-object/#findComment-506775 Share on other sites More sharing options...
glennn.php Posted April 2, 2008 Author Share Posted April 2, 2008 thanks to both of you - i was not notified by mail of these replies and just got back to them... Link to comment https://forums.phpfreaks.com/topic/99027-fatal-error-using-this-when-not-in-object/#findComment-507661 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.