course-participation-report MDL-23603 Optimised SQL, merged from HEAD
[moodle.git] / login / mnet_email.php
blob24db7190329c01c367a52309eb8fa64f58e4491e
1 <?php
3 require_once dirname(dirname(__FILE__)) . '/config.php';
4 httpsrequired();
6 $username = required_param('u', PARAM_ALPHANUM);
7 $sesskey = sesskey();
9 // if you are logged in then you shouldn't be here
10 if (isloggedin() and !isguestuser()) {
11 redirect( $CFG->wwwroot.'/', get_string('loginalready'), 5);
13 $mnetidprovider = get_string('mnetidprovider','mnet');
14 $navigation = build_navigation(array(array('name' => $mnetidprovider, 'link' => null, 'type' => 'misc')));
16 print_header($mnetidprovider, $mnetidprovider, $navigation, 'form.email' );
17 notify(get_string('mnetidproviderdesc', 'mnet'));
19 if ($form = data_submitted() and confirm_sesskey()) {
20 if ($user = get_record_select('user', "username = '$username' AND email = '$form->email' AND mnethostid != $CFG->mnet_localhost_id")) {
21 if (!empty($user->mnethostid) and $host = get_record('mnet_host', 'id', $user->mnethostid)) {
22 $link = "<a href=\"{$host->wwwroot}/login/\">{$host->name}</a>";
23 notice(get_string('mnetidprovidermsg','mnet',$link));
26 if (empty($link)) {
27 notice(get_string('mnetidprovidernotfound', 'mnet'));
31 echo '<p>&nbsp;</p>';
32 print_simple_box_start('center','50%','','20');
35 <form method="post">
36 <input type="hidden" name="sesskey" value="<?php echo $sesskey; ?>">
37 <?php echo get_string('email') ?>:
38 <input type="text" name="email" size="" maxlength="100" />
39 <input type="submit" value="<?php echo get_string('findlogin','mnet'); ?>" />
40 </form>
41 <?php
43 print_simple_box_end();
44 print_footer();