| [ Index ] |
PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008] |
[Summary view] [Print] [Text view]
1 <?php // $Id: confirm.php,v 1.29.2.1 2008/04/02 06:10:02 dongsheng Exp $ 2 3 require_once("../config.php"); 4 5 $data = optional_param('data', '', PARAM_CLEAN); // Formatted as: secret/username 6 7 $p = optional_param('p', '', PARAM_ALPHANUM); // Old parameter: secret 8 $s = optional_param('s', '', PARAM_CLEAN); // Old parameter: username 9 10 if (empty($CFG->registerauth)) { 11 error("Sorry, you may not use this page."); 12 } 13 $authplugin = get_auth_plugin($CFG->registerauth); 14 15 if (!$authplugin->can_confirm()) { 16 error("Sorry, you may not use this page."); 17 } 18 19 if (!empty($data) || (!empty($p) && !empty($s))) { 20 21 if (!empty($data)) { 22 $dataelements = explode('/',$data); 23 $usersecret = $dataelements[0]; 24 $username = $dataelements[1]; 25 } else { 26 $usersecret = $p; 27 $username = $s; 28 } 29 30 $confirmed = $authplugin->user_confirm($username, $usersecret); 31 32 if ($confirmed == AUTH_CONFIRM_ALREADY) { 33 $user = get_complete_user_data('username', $username); 34 print_header(get_string("alreadyconfirmed"), get_string("alreadyconfirmed"), array(), ""); 35 print_box_start('generalbox centerpara boxwidthnormal boxaligncenter'); 36 echo "<h3>".get_string("thanks").", ". fullname($user) . "</h3>\n"; 37 echo "<p>".get_string("alreadyconfirmed")."</p>\n"; 38 print_single_button("$CFG->wwwroot/course/", null, get_string('courses')); 39 print_box_end(); 40 print_footer(); 41 exit; 42 43 } else if ($confirmed == AUTH_CONFIRM_OK) { 44 45 // The user has confirmed successfully, let's log them in 46 47 if (!$USER = get_complete_user_data('username', $username)) { 48 error("Something serious is wrong with the database"); 49 } 50 51 set_moodle_cookie($USER->username); 52 53 if ( ! empty($SESSION->wantsurl) ) { // Send them where they were going 54 $goto = $SESSION->wantsurl; 55 unset($SESSION->wantsurl); 56 redirect($goto); 57 } 58 59 print_header(get_string("confirmed"), get_string("confirmed"), array(), ""); 60 print_box_start('generalbox centerpara boxwidthnormal boxaligncenter'); 61 echo "<h3>".get_string("thanks").", ". fullname($USER) . "</h3>\n"; 62 echo "<p>".get_string("confirmed")."</p>\n"; 63 print_single_button("$CFG->wwwroot/course/", null, get_string('courses')); 64 print_box_end(); 65 print_footer(); 66 exit; 67 } else { 68 error("Invalid confirmation data"); 69 } 70 } else { 71 print_error("errorwhenconfirming"); 72 } 73 74 redirect("$CFG->wwwroot/"); 75 76 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jan 14 11:33:29 2009 | Cross-referenced by PHPXref 0.7 |