Changeset 98
- Timestamp:
- Jul 8, 2009, 5:19:12 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
hadoop-register/etc/funs.php
r85 r98 1 1 <? 2 // echo "funs.php 成功載入<BR>";3 require_once ("./etc/init.php");2 // echo "funs.php 成功載入<BR>"; 3 require_once ("./etc/init.php"); 4 4 5 class W_user6 {7 var $operator = "";// 信件類別 identification、new_password)8 var $user = "";// 使用者帳號9 var $email = "";// 使用者註冊 e-mail10 var $new_password = "";// 新密碼11 var $activate_code = "";// 認證碼12 var $hadoop_user = "";// hadoop 帳號13 var $hadoop_password = "";// hadoop 密碼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 14 15 // 重新導向16 function redirect_to($w_url, $message)17 {18 19 echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">';20 echo "<BR> 此網頁將於 5 秒後重新導向 <BR>";21 22 23 }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 24 25 // 取得認證信內容26 function get_activate_mailbody()27 {28 29 30 31 32 33 34 35 36 37 38 39 40 }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=" . "$w_localhost" . "/check_activate_code.php?user=" . 38 $this->user . "&" . "act=" . $this->activate_code . ">啟動 Hadoop 帳號</A>"; 39 return $str; 40 } 41 41 42 // 取得密碼信內容43 function get_new_password_mailbody()44 {45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 }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>登入:$w_localhost 59 "; 60 return $str; 61 } 62 62 63 // 取得 hadoop 帳號密碼信內容64 function get_hadoop_user_password_mailbody()65 {66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 }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 85 86 // 取得認證碼87 function get_activate_code()88 {89 90 }86 // 取得認證碼 87 function get_activate_code() 88 { 89 return md5($this->user . microtime() ); 90 } 91 91 92 // 取得新密碼 93 function get_new_password() 94 { 95 return rand(); 96 } 92 // 取得新密碼 93 function get_new_password() 94 { 95 return rand(); 96 } 97 } 97 98 98 function test() 99 { 99 class W_mysql 100 { 101 function connect() 102 { 103 require ("init.php"); 104 // 連結資料庫 105 $link = mysql_connect($mysql_host, $mysql_user, $mysql_password) or die(mysql_error()); 106 mysql_select_db($mysql_database, $link) or die(mysql_error() ); 107 mysql_query("SET NAMES 'utf8'"); 108 return $link; 109 } 110 111 function count_is_active_user($link) 112 { 113 require ("init.php"); 114 $str = sprintf("SELECT COUNT(*) 115 FROM `%s` 116 WHERE `is_activate` = 1 117 GROUP BY `is_activate` 118 ",$mysql_table); 119 $result = mysql_query($str , $link) or die(mysql_error() ); 120 $row = mysql_fetch_row($result); 121 return $row[0]; 122 } 123 function close($link) 124 { 125 mysql_close($link); 126 } 127 } 128 129 function test() 130 { 100 131 echo "<br>========"; 101 132 echo "<br>this is in W_user->test() <br>"; … … 104 135 //echo $this->user; 105 136 //echo $this->activate_code; 106 } 107 } 137 } 108 138 ?>
Note: See TracChangeset
for help on using the changeset viewer.