Changeset 85
- Timestamp:
- Jun 23, 2009, 11:56:24 AM (15 years ago)
- Location:
- hadoop-register
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
hadoop-register/adduser.php
r57 r85 28 28 $my_user->operator = "identification"; // user 需要發認證信服務 29 29 include ("smtp_mail.php"); 30 $my_user->redirect_to(" http://$w_localhost", "認證信寄送完畢");30 $my_user->redirect_to("$w_localhost", "認證信寄送完畢"); 31 31 ?> -
hadoop-register/check_activate_code.php
r58 r85 1 1 <? 2 3 4 2 /* 3 * 驗證使用者身份及信箱是否正確 4 */ 5 5 6 7 6 require_once ("./etc/init.php"); 7 include_once ("./etc/funs.php"); 8 8 9 9 $receiver_user = $_GET["user"]; 10 10 $receiver_act = $_GET["act"]; 11 11 12 13 14 15 12 // 連結資料庫 13 $link = mysql_connect($mysql_host, $mysql_user, $mysql_password) or die(mysql_error() ); 14 mysql_select_db($mysql_database, $link) or die(mysql_error() ); 15 mysql_query("SET NAMES 'utf8'"); 16 16 17 18 $str = sprintf("SELECT `activate_code`, ` email` FROM `%s` WHERE `user` LIKE '%s' limit 1", $mysql_table, $receiver_user);17 // 抓取使用者認證碼 18 $str = sprintf("SELECT `activate_code`, `is_activate`, `email` FROM `%s` WHERE `user` LIKE '%s' limit 1", $mysql_table, $receiver_user); 19 19 $result = mysql_query($str , $link); 20 21 20 $row = mysql_fetch_assoc($result); 22 21 23 22 $my_user = new W_user; 24 23 25 // 如果通過驗證 26 if ( ($row["activate_code"] == $receiver_act) && ($receiver_act != null) ) 27 { 28 $my_user->email = $row["email"]; 29 // 分配一組 hadoop 帳號密碼給 user 30 $str = sprintf("SELECT `hadoop_user` , `hadoop_password` 31 FROM `%s` 32 WHERE `hadoop_owner` LIKE '' 33 LIMIT 1 ",$mysql_table_owner ); 34 $result = mysql_query($str, $link) or die(mysql_error() ); 35 $row = mysql_fetch_assoc($result); 36 $my_user->hadoop_user = $row["hadoop_user"]; 37 $my_user->hadoop_password = $row["hadoop_password"]; 38 // 更新 hadoop 帳號擁有者資料庫 39 $str = sprintf("UPDATE `%s` SET `hadoop_owner` = '%s' 40 WHERE `hadoop_user` LIKE '%s' limit 1", 41 $mysql_table_owner, $receiver_user, $my_user->hadoop_user); 24 // 如果已認證就不再寄認證信 25 if ($row["is_activate"] == 1) 26 { 27 $my_user->redirect_to("$w_localhost", "你已經通過驗證"); 28 } 29 // 如果通過驗證 30 else if ( ($row["activate_code"] == $receiver_act) && ($receiver_act != null) ) 31 { 32 $my_user->email = $row["email"]; 33 // 分配一組 hadoop 帳號密碼給 user 34 $str = sprintf("SELECT `hadoop_user` , `hadoop_password` 35 FROM `%s` 36 WHERE `hadoop_owner` LIKE '' 37 LIMIT 1 ",$mysql_table_owner ); 38 $result = mysql_query($str, $link) or die(mysql_error() ); 39 $row = mysql_fetch_assoc($result); 40 $my_user->hadoop_user = $row["hadoop_user"]; 41 $my_user->hadoop_password = $row["hadoop_password"]; 42 // 更新 hadoop 帳號擁有者資料庫 43 $str = sprintf("UPDATE `%s` SET `hadoop_owner` = '%s' 44 WHERE `hadoop_user` LIKE '%s' limit 1", 45 $mysql_table_owner, $receiver_user, $my_user->hadoop_user); 42 46 mysql_query($str, $link) or die(mysql_error() ); 43 // 寄送 hadoop 帳號密碼信至使用者信箱 44 $my_user->operator = "hadoop_user_password"; 45 include ("smtp_mail.php"); 47 48 // 寄送 hadoop 帳號密碼信至使用者信箱 49 $my_user->operator = "hadoop_user_password"; 50 include ("smtp_mail.php"); 46 51 47 // 將使用者設為已認證 48 $str = sprintf("UPDATE `%s` SET `is_activate` = 1 49 WHERE `user` LIKE '%s' limit 1", $mysql_table, $receiver_user); 50 mysql_query($str, $link) or die(mysql_error() ); 51 52 // 重新導向 localhost 53 $my_user->redirect_to("http://$w_localhost", "驗證成功"); 54 } 55 // 沒有通過驗證 56 else 57 { 58 // 重新導向 localhost 59 $my_user->redirect_to("http://$w_localhost", "驗證碼錯誤"); 60 } 61 mysql_close($link); 52 // 將使用者設為已認證 53 $str = sprintf("UPDATE `%s` SET `is_activate` = 1 54 WHERE `user` LIKE '%s' limit 1", $mysql_table, $receiver_user); 55 mysql_query($str, $link) or die(mysql_error() ); 56 57 // 重新導向 localhost 58 $my_user->redirect_to("$w_localhost", "驗證成功"); 59 } 60 // 沒有通過驗證 61 else 62 { 63 // 重新導向 localhost 64 $my_user->redirect_to("$w_localhost", "驗證碼錯誤"); 65 } 66 67 mysql_close($link); 62 68 ?> -
hadoop-register/check_user_identification.php
r82 r85 85 85 { 86 86 $my_user = new W_user(); 87 $my_user->redirect_to(" http://$w_localhost", "帳號密碼錯誤");87 $my_user->redirect_to("$w_localhost", "帳號密碼錯誤"); 88 88 } 89 89 mysql_close($link); -
hadoop-register/etc/funs.php
r84 r85 17 17 { 18 18 header ("refresh:5 ;url=$w_url"); 19 echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> "';19 echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">'; 20 20 echo "<BR> 此網頁將於 5 秒後重新導向 <BR>"; 21 21 echo "<BR> ======== System Message ========"; … … 35 35 <br> 36 36 '; 37 $str .= "<br><A href= http://" . "$w_localhost" . "check_activate_code.php?user=" .37 $str .= "<br><A href=" . "$w_localhost" . "/check_activate_code.php?user=" . 38 38 $this->user . "&" . "act=" . $this->activate_code . ">啟動 Hadoop 帳號</A>"; 39 39 return $str; … … 56 56 <br>帳號:$this->user 57 57 <br>密碼:$this->new_password 58 <br>登入 http://$w_localhost。58 <br>登入:$w_localhost 59 59 "; 60 60 return $str; … … 100 100 echo "<br>========"; 101 101 echo "<br>this is in W_user->test() <br>"; 102 $str = "<br><A href= http://" . "$w_localhost" . "check_activate_code.php?user=" .102 $str = "<br><A href=" . "$w_localhost" . "/check_activate_code.php?user=" . 103 103 $this->user . "&" . "act=" . $this->activate_code . ">啟動 Hadoop 帳號</A>"; 104 104 //echo $this->user; -
hadoop-register/etc/init.php
r84 r85 6 6 */ 7 7 8 9 10 $w_localhost = "hadoop.nchc.org.tw/";8 // [本機設定] 9 // 設定主機網址 10 $w_localhost = "http://hadoop.nchc.org.tw"; 11 11 12 12 13 13 // [mysql 設定] 14 14 // mysql 主機位址 15 15 $mysql_host = 'localhost'; … … 25 25 26 26 // mysql 資料表 27 $mysql_table = 'hadoop_reg'; 28 27 $mysql_table = 'hadoop_reg'; // 基本使用者資料表 28 $mysql_table_owner = 'hadoop_owner'; // hadoop 帳號分配擁有者 29 29 30 30 // [mail 設定] 31 32 31 // mail server host 32 $mail_server_host = 'smtp.gmail.com'; 33 33 34 35 34 // mail account 35 $mail_account = 'nchcdrbl@gmail.com'; 36 36 $mail_account_name = 'Hadoop admin'; 37 37 -
hadoop-register/forget_password.php
r63 r85 88 88 $my_user->operator = "new_password"; // user 需要更新密碼 89 89 include ("smtp_mail.php"); 90 $my_user->redirect_to(" http://$w_localhost", "新密碼寄送完畢");90 $my_user->redirect_to("$w_localhost", "新密碼寄送完畢"); 91 91 } 92 92 else 93 93 { 94 $my_user->redirect_to(" http://$w_localhost", "帳號與密碼不符合");94 $my_user->redirect_to("$w_localhost", "帳號與密碼不符合"); 95 95 } 96 96 } -
hadoop-register/re_send_activate_code.php
r58 r85 29 29 $my_user->operator = "identification"; // user 需要發認證信服務 30 30 include ("smtp_mail.php"); 31 $my_user->redirect_to(" http://$w_localhost", "認證碼更新完畢");31 $my_user->redirect_to("$w_localhost", "認證碼更新完畢"); 32 32 ?> 33 33 -
hadoop-register/smtp_mail.php
r57 r85 71 71 $message = "Mailer Error: " . $mail->ErrorInfo; 72 72 echo "<BR>" . $message; 73 // $my_user->redirect_to(" http://$w_localhost", $message);73 // $my_user->redirect_to("$w_localhost", $message); 74 74 } else { 75 75 // $message = "Message sent!"; 76 // $my_user->redirect_to(" http://$w_localhost", $error_message);76 // $my_user->redirect_to("$w_localhost", $error_message); 77 77 } 78 78
Note: See TracChangeset
for help on using the changeset viewer.