Page MenuHomeCode

profile.php
No OneTemporary

profile.php

This document is not UTF8. It was detected as Shift JIS and converted to UTF8 for display.
<?php
/*
* Zed
* (c) 2010, Dereckson, some rights reserved
* Released under BSD license
*
* Profile class.
*
* 0.1 2010-01-02 16:49 Autogenerated by Pluton Scaffolding
Import from Azh灑
*
*/
class Profile {
public $perso_id;
public $text;
public $updated;
public $fixedwidth;
function __construct ($perso_id) {
$this->perso_id = $perso_id;
$this->load_from_database();
}
//Loads the object Profile (ie fill the properties) from the $_POST array
function load_from_form ($read_boolean = true) {
if (array_key_exists('perso_id', $_POST)) $this->perso_id = $_POST['perso_id'];
if (array_key_exists('text', $_POST)) $this->text = $_POST['text'];
if (array_key_exists('updated', $_POST)) $this->updated = $_POST['updated'];
if ($read_boolean) {
if (array_key_exists('fixedwidth', $_POST)) $this->fixedwidth = $_POST['fixedwidth'];
}
}
//Loads the object Profile (ie fill the properties) from the database
function load_from_database () {
global $db;
$id = $db->sql_escape($this->perso_id);
$sql = "SELECT * FROM " . TABLE_PROFILES . " WHERE perso_id = '$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->perso_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 save_to_database () {
global $db;
$perso_id = $db->sql_escape($this->perso_id);
$text = $db->sql_escape($this->text);
$updated = $db->sql_escape($this->updated);
$fixedwidth = $this->fixedwidth ? 1 : 0;
$sql = "REPLACE INTO " . TABLE_PROFILES . " (`perso_id`, `profile_text`, `profile_updated`, `profile_fixedwidth`) VALUES ('$perso_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
Thu, Apr 3, 19:33 (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23575
Default Alt Text
profile.php (2 KB)

Event Timeline