Page MenuHomeCode

azhar_profile.php
No OneTemporary

azhar_profile.php

This document is not UTF8. It was detected as Shift JIS and converted to UTF8 for display.
<?php
/*
* Azh灑, faeries intranet
* (c) 2010, Wolf諍m, some rights reserved
* Released under BSD license
*
* Profile class.
*
* 0.1 2010-01-02 16:49 Autogenerated by Pluton Scaffolding
*
*/
class Profile {
public $user_id;
public $text;
public $updated;
public $fixedwidth;
function __construct ($user_id = '') {
if ($user_id) {
$this->user_id = $user_id;
$this->loadFromDatabase();
}
}
//Loads the object Profile (ie fill the properties) from the $_POST array
function loadFromForm () {
if (array_key_exists('user_id', $_POST)) $this->user_id = $_POST['user_id'];
if (array_key_exists('text', $_POST)) $this->text = $_POST['text'];
if (array_key_exists('updated', $_POST)) $this->updated = $_POST['updated'];
if (array_key_exists('fixedwidth', $_POST)) $this->fixedwidth = $_POST['fixedwidth'];
}
//Loads the object Profile (ie fill the properties) from the database
function loadFromDatabase () {
global $db;
$sql = "SELECT * FROM " . TABLE_PROFILES . " WHERE user_id = '" . $this->user_id . "'";
if ( !($result = $db->sql_query($sql)) ) message_die(SQL_ERROR, "Unable to query azhar_profiles", '', __LINE__, __FILE__, $sql);
if (!$row = $db->sql_fetchrow($result)) {
$this->lastError = "Profile unkwown: " . $this->user_id;
return false;
}
$this->text = $row['profile_text'];
$this->updated = $row['profile_updated'];
$this->fixedwidth = $row['profile_fixedwidth'];
return true;
}
//Saves the object to the database
function saveToDatabase () {
global $db;
$user_id = $db->sql_escape($this->user_id);
$text = $db->sql_escape($this->text);
$updated = $db->sql_escape($this->updated);
$fixedwidth = $this->fixedwidth ? 1 : 0;
$sql = "REPLACE INTO " . TABLE_PROFILES . " (`user_id`, `profile_text`, `profile_updated`, `profile_fixedwidth`) VALUES ('$user_id', '$text', '$updated', '$fixedwidth')";
if (!$db->sql_query($sql)) {
message_die(SQL_ERROR, "Unable to save", '', __LINE__, __FILE__, $sql);
}
}
}
?>

File Metadata

Mime Type
text/x-php
Expires
Sat, Feb 22, 20:21 (1 h, 59 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26260
Default Alt Text
azhar_profile.php (2 KB)

Event Timeline