function do_logout($user) { $wsid = $user->id; mysql_query(sprintf("DELETE FROM contact WHERE wsid='%s'", mysql_real_escape_string($wsid))); mysql_query(sprintf("DELETE FROM subscribe WHERE wsid='%s'", mysql_real_escape_string($wsid))); $new_request = do_whoisonline($user); unset($new_request['code']); $new_request['email'] = '*'; do_notify($new_request, $user); return array('code' => 'success'); }
function do_delete($user, $request) { $resource = $request['resource']; // disable delete if the child resource exists $result = mysql_query(sprintf("SELECT rid FROM resource WHERE prid='%s'", mysql_real_escape_string($resource))); $result_count = mysql_num_rows($result); //mysql_freeresult($result); if ($result_count) { return array('code' => 'failed', 'reason' => 'this parent resource has children'); } // remove the specific resource. mysql_command(sprintf("DELETE FROM resource WHERE rid='%s'", mysql_real_escape_string($resource))); do_notify($user, $resource, "DELETE"); return array('code' => 'success'); }