[57] | 1 | <? |
---|
[59] | 2 | // echo "funs.php 成功載入<BR>"; |
---|
| 3 | require_once ("./etc/init.php"); |
---|
[57] | 4 | |
---|
[59] | 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 密碼 |
---|
[57] | 14 | |
---|
[59] | 15 | // 重新導向 |
---|
| 16 | function redirect_to($w_url, $message) |
---|
| 17 | { |
---|
| 18 | header ("refresh:5 ;url=$w_url"); |
---|
[85] | 19 | echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">'; |
---|
[59] | 20 | echo "<BR> 此網頁將於 5 秒後重新導向 <BR>"; |
---|
| 21 | echo "<BR> ======== System Message ========"; |
---|
| 22 | echo "<BR>" . $message; |
---|
| 23 | } |
---|
[57] | 24 | |
---|
[59] | 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 | '; |
---|
[85] | 37 | $str .= "<br><A href=" . "$w_localhost" . "/check_activate_code.php?user=" . |
---|
[59] | 38 | $this->user . "&" . "act=" . $this->activate_code . ">啟動 Hadoop 帳號</A>"; |
---|
| 39 | return $str; |
---|
| 40 | } |
---|
[57] | 41 | |
---|
[59] | 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 |
---|
[85] | 58 | <br>登入:$w_localhost |
---|
[59] | 59 | "; |
---|
| 60 | return $str; |
---|
| 61 | } |
---|
[57] | 62 | |
---|
[59] | 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 |
---|
[57] | 82 | "; |
---|
| 83 | return $str; |
---|
[59] | 84 | } |
---|
[57] | 85 | |
---|
[59] | 86 | // 取得認證碼 |
---|
| 87 | function get_activate_code() |
---|
| 88 | { |
---|
| 89 | return md5($this->user . microtime() ); |
---|
| 90 | } |
---|
[57] | 91 | |
---|
[59] | 92 | // 取得新密碼 |
---|
| 93 | function get_new_password() |
---|
| 94 | { |
---|
[63] | 95 | return rand(); |
---|
| 96 | } |
---|
[57] | 97 | |
---|
[63] | 98 | function test() |
---|
| 99 | { |
---|
| 100 | echo "<br>========"; |
---|
| 101 | echo "<br>this is in W_user->test() <br>"; |
---|
[85] | 102 | $str = "<br><A href=" . "$w_localhost" . "/check_activate_code.php?user=" . |
---|
[63] | 103 | $this->user . "&" . "act=" . $this->activate_code . ">啟動 Hadoop 帳號</A>"; |
---|
| 104 | //echo $this->user; |
---|
| 105 | //echo $this->activate_code; |
---|
| 106 | } |
---|
| 107 | } |
---|
[57] | 108 | ?> |
---|