source: hadoop-register/etc/funs.php @ 84

Last change on this file since 84 was 84, checked in by wade, 15 years ago
  • 2009-06-22 將錯誤訊息頁面增加 utf8 meta data
File size: 3.0 KB
Line 
1<?
2  // echo "funs.php 成功載入<BR>";
3  require_once ("./etc/init.php");
4 
5  class W_user
6  {
7    var $operator = "";   // 信件類別 identification、new_password)
8    var $user = "";   // 使用者帳號
9    var $email = "";    // 使用者註冊 e-mail
10    var $new_password = ""; // 新密碼
11    var $activate_code = "";  // 認證碼
12    var $hadoop_user = "";  // hadoop 帳號
13    var $hadoop_password = "";  // hadoop 密碼
14
15    // 重新導向
16    function redirect_to($w_url, $message)
17    {
18      header ("refresh:5 ;url=$w_url");
19      echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">"';
20      echo "<BR> 此網頁將於 5 秒後重新導向 <BR>";
21      echo "<BR> ======== System Message ========";
22      echo "<BR>" . $message;
23    }
24
25    // 取得認證信內容
26    function get_activate_mailbody()
27    {
28      global $w_localhost;  // 載入主機位址環境變數
29      $str = '
30        <br>
31        <br>您好:
32        <br>
33        <br>請點選以下認證碼啟動您的 Hadoop 帳號:
34        <br>
35        <br>
36        ';
37      $str .= "<br><A href=http://" . "$w_localhost" . "check_activate_code.php?user=" .
38      $this->user . "&" . "act=" . $this->activate_code . ">啟動 Hadoop 帳號</A>";
39      return $str;
40    }
41
42    // 取得密碼信內容
43    function get_new_password_mailbody()
44    {
45      global $w_localhost;        // 載入主機位址環境變數
46      $str = '
47              <br>
48              <br>您好:
49              <br>
50              <br>以下為您新的密碼:
51              <br>
52              <br>
53              ';
54      $str .= "
55        <br>請使用以下設定
56        <br>帳號:$this->user
57        <br>密碼:$this->new_password
58        <br>登入 http://$w_localhost。
59        ";
60      return $str;
61    }
62
63    // 取得 hadoop 帳號密碼信內容
64    function get_hadoop_user_password_mailbody()
65    {
66      global $w_localhost;        // 載入主機位址環境變數
67      $str = '
68              <br>
69              <br>您好:
70              <br>
71              <br>以下為您所申請的 Hadoop 帳號及密碼:
72              <br>
73              <br>
74              ';
75      $str .= "
76        <br>位址:$w_localhost
77              <br>帳號:$this->hadoop_user
78              <br>密碼:$this->hadoop_password
79        <br>
80        <br>請用<a href=\"http://www.csie.ntu.edu.tw/~piaip/pietty/\">SSH Client</a>登入使用。
81        <br>Ex. ssh $w_localhost -l $this->hadoop_user
82                ";
83            return $str;
84    }
85
86    // 取得認證碼
87    function get_activate_code()
88    {
89      return md5($this->user . microtime() ); 
90    }
91
92    // 取得新密碼
93    function get_new_password()
94    {
95      return rand();
96    }
97
98    function test()
99    {
100      echo "<br>========";
101      echo "<br>this is in W_user->test() <br>";
102      $str = "<br><A href=http://" . "$w_localhost" . "check_activate_code.php?user=" .
103      $this->user . "&" . "act=" . $this->activate_code . ">啟動 Hadoop 帳號</A>";
104      //echo $this->user;
105      //echo $this->activate_code;
106      }
107    }
108?>
Note: See TracBrowser for help on using the repository browser.