<?php
// If it's going to need the database, then it's
// probably smart to require it before we start.
//error_reporting(0);
require_once("initializer.php");

class SecureReply extends DatabaseObject {

  protected static $table_name="BVIS_SecureReply";

  //we will populate this array of attribure dynamically
	//protected static $db_fields = array('id','Username','Privilege','First_Name','Last_Name','Password');

  protected static $db_fields;
  protected static $exclu_fields = array ("");

	// public  $id;
	// public $Username;
	// public $Privilege;
	// public $Last_Name;
  // public $First_Name;
  // public $Password;

  public function __construct($options=""){
    if ($options=="Blank") {
      $myFields = static::Get_Object_Fields ();
      foreach($myFields as $field) {
        $this->{$field} = "";
      }
    }

   // unset ($this->id);

   

  }


  public static function find_by_SecureCode($codeP=0, $com="") {
    //self::Get_Object_Fields ()
    $result_array = self::find_by_sql("SELECT * FROM BVIS_SecureReply WHERE `Code`='{$codeP}' LIMIT 1",$com);
        return !empty($result_array) ? array_shift($result_array) : false;
  }

  

  public static function GetSecureCode () {
    $code =  new self ("Blank");
    $code->Code =  md5(uniqid());
    $code->save();

     return $code->Code;
   

  }



}

?>