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

Last change on this file since 57 was 57, checked in by jazz, 15 years ago
  • 第一版 Hadoop 叢集之帳號申請網頁 by Wade
File size: 2.9 KB
Line 
1<?
2  // echo "funs.php 成功載入<BR>";
3
4  require_once ("./etc/init.php");
5 
6  class W_user
7  {
8    var $operator = "";       // 信件類別 identification、new_password)
9    var $user = "";         // 使用者帳號
10    var $email = "";        // 使用者註冊 e-mail
11    var $new_password = "";     // 新密碼
12    var $activate_code = "";      // 認證碼
13    var $hadoop_user = "";      // hadoop 帳號
14    var $hadoop_password = "";    // hadoop 密碼
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    function get_new_password()
92    {
93      return rand();
94    }
95
96    function test()
97    {
98      echo "<br>========";
99      echo "<br>this is in W_user->test() <br>";
100            $str = "<br><A href=http://" . "$w_localhost" . "check_activate_code.php?user=" .
101               $this->user . "&" . "act=" . $this->activate_code . ">啟動 Hadoop 帳號</A>";
102      //echo $this->user;
103      //echo $this->activate_code;
104    }
105  }
106?>
Note: See TracBrowser for help on using the repository browser.