Jump to content

Fatal error: $this & object context, missing argument in custom function... help


lilwing

Recommended Posts

I am trying to make a set session function for a backend CMS application. Really need to get this working, and I am not sure what I have done wrong. It's probably because I am new to $this variables.

 


<?php

function _setSession() {
$this->id = $values->id;
$_SESSION['uid'] = $this->id;
$_SESSION['username'] = htmlspecialchars($values->username);
$_SESSION['logged'] = true;

if ($init) {
$session = $this->db->quote(session_id());
$ip = $this->db->quote($_SERVER['REMOTE_ADDR']);

mysql_select_db('sfisdb');

$sql = "UPDATE users SET session = $session, IP = $ip WHERE " .
"id = $this->id";
$this->db->query($sql);
}
} 

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.