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

Last change on this file since 59 was 59, checked in by wade, 15 years ago
  • 重新排版
File size: 2.9 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 "<BR> 此網頁將於 5 秒後重新導向 <BR>";
20      echo "<BR> ======== System Message ========";
21      echo "<BR>" . $message;
22    }
23
24    // 取得認證信內容
25    function get_activate_mailbody()
26    {
27      global $w_localhost;  // 載入主機位址環境變數
28      $str = '
29        <br>
30        <br>您好:
31        <br>
32        <br>請點選以下認證碼啟動您的 Hadoop 帳號:
33        <br>
34        <br>
35        ';
36      $str .= "<br><A href=http://" . "$w_localhost" . "check_activate_code.php?user=" .
37      $this->user . "&" . "act=" . $this->activate_code . ">啟動 Hadoop 帳號</A>";
38      return $str;
39    }
40
41    // 取得密碼信內容
42    function get_new_password_mailbody()
43    {
44      global $w_localhost;        // 載入主機位址環境變數
45      $str = '
46              <br>
47              <br>您好:
48              <br>
49              <br>以下為您新的密碼:
50              <br>
51              <br>
52              ';
53      $str .= "
54        <br>請使用以下設定
55        <br>帳號:$this->user
56        <br>密碼:$this->new_password
57        <br>登入 http://$w_localhost。
58        ";
59      return $str;
60    }
61
62    // 取得 hadoop 帳號密碼信內容
63    function get_hadoop_user_password_mailbody()
64    {
65      global $w_localhost;        // 載入主機位址環境變數
66      $str = '
67              <br>
68              <br>您好:
69              <br>
70              <br>以下為您所申請的 Hadoop 帳號及密碼:
71              <br>
72              <br>
73              ';
74      $str .= "
75        <br>位址:$w_localhost
76              <br>帳號:$this->hadoop_user
77              <br>密碼:$this->hadoop_password
78        <br>
79        <br>請用<a href=\"http://www.csie.ntu.edu.tw/~piaip/pietty/\">SSH Client</a>登入使用。
80        <br>Ex. ssh $w_localhost -l $this->hadoop_user
81                ";
82            return $str;
83    }
84
85    // 取得認證碼
86    function get_activate_code()
87    {
88      return md5($this->user . microtime() ); 
89    }
90
91    // 取得新密碼
92    function get_new_password()
93    {
94      return rand();
95    }
96
97    function test()
98    {
99      echo "<br>========";
100      echo "<br>this is in W_user->test() <br>";
101            $str = "<br><A href=http://" . "$w_localhost" . "check_activate_code.php?user=" .
102               $this->user . "&" . "act=" . $this->activate_code . ">啟動 Hadoop 帳號</A>";
103      //echo $this->user;
104      //echo $this->activate_code;
105    }
106  }
107?>
Note: See TracBrowser for help on using the repository browser.