// echo "funs.php 成功載入
";
  require_once ("./etc/init.php");
	
  class W_user
  {
    var $operator = "";		// 信件類別 identification、new_password)
    var $user = "";		// 使用者帳號
    var $email = "";		// 使用者註冊 e-mail
    var $new_password = "";	// 新密碼
    var $activate_code = "";	// 認證碼
    var $hadoop_user = "";	// hadoop 帳號
    var $hadoop_password = "";	// hadoop 密碼
    // 重新導向
    function redirect_to($w_url, $message)
    {
      header ("refresh:5 ;url=$w_url");
      echo '"';
      echo "
 此網頁將於 5 秒後重新導向 
";
      echo "
 ======== System Message ========";
      echo "
" . $message;
    }
    // 取得認證信內容
    function get_activate_mailbody()
    {
      global $w_localhost;	// 載入主機位址環境變數
      $str = '
	      
	      
您好:
	      
	      
請點選以下認證碼啟動您的 Hadoop 帳號:
	      
	      
	      ';
      $str .= "
user . "&" . "act=" . $this->activate_code . ">啟動 Hadoop 帳號";
      return $str;
    }
    // 取得密碼信內容
    function get_new_password_mailbody()
    {
      global $w_localhost;        // 載入主機位址環境變數
      $str = '
              
              
您好:
              
              
以下為您新的密碼:
              
              
              ';
      $str .= "
	      
請使用以下設定
	      
帳號:$this->user
	      
密碼:$this->new_password
	      
登入 http://$w_localhost。
	      ";
      return $str;
    }
    // 取得 hadoop 帳號密碼信內容
    function get_hadoop_user_password_mailbody()
    {
      global $w_localhost;        // 載入主機位址環境變數
      $str = '
              
              
您好:
              
              
以下為您所申請的 Hadoop 帳號及密碼:
              
              
              ';
      $str .= "
	      
位址:$w_localhost
              
帳號:$this->hadoop_user
              
密碼:$this->hadoop_password
	      
	      
請用SSH Client登入使用。
	      
Ex. ssh $w_localhost -l $this->hadoop_user
                ";
            return $str;
    }
    // 取得認證碼
    function get_activate_code()
    {
      return md5($this->user . microtime() );	
    }
    // 取得新密碼
    function get_new_password()
    {
      return rand();
    }
    function test()
    {
      echo "
========";
      echo "
this is in W_user->test() 
";
      $str = "
user . "&" . "act=" . $this->activate_code . ">啟動 Hadoop 帳號";
      //echo $this->user;
      //echo $this->activate_code;
      }
    }
?>