/** * ตรวจสอบค่าเริ่มต้นของคลาส * @param null * @return null */ function __construct() { //global $my_cfg; parent::__construct(); /* * 1. $val_ รับค่าที่ส่งมาจากการ $_GET หรือ $_POST จาก OrSysvalue * 2. $my_sec ตรวจสอบสิทธิ์การใช้งาน * 3. $my_db เข้าใช้งานฐานข้อมูล */ $val_ = new OrSysvalue(); if ($val_->message[content_key_value] == 'accept') { if ($val_->message[my_note_id] > 0) { $this->accept_note($val_->message[my_note_id]); } else { $this->set_body('คุณได้เคยอ่านประกาศล่าสุดไปแล้ว'); } } else { $this->last_note($val_->message[content_key_value]); } //$my_sec = new OrSec(); $this->show(); }
function content($content_key_value) { global $my_cfg; $my_sec = new OrSec(); $my_db = new OrMysql($my_cfg[db]); //(กำหนด Object ฐานข้อมูลที่จะใช้) $sql = "SELECT concat(`prefix`,`fname`, ' ' , `lname`) AS `name` FROM `my_user` WHERE `user` = '" . $content_key_value . "'"; //(กำหนด SQL ตามเงื่อนไขที่ต้องการ) $my_db->get_query($sql); if ($my_db->get_record()) { $my_value = $my_db->record[name]; } else { //$my_value = $content_key_value; $my_value = 'not found!'; } unset($my_db); $my_content = new OrContent($my_value); $my_content->show(); }
<?php require_once '../../orr_lib/Or.php'; require_once 'config.inc.php'; $my_content = new OrContent("Hello {$_GET['name']}, welcome to the world of Dojo!\n"); $my_content->show();