10
10
if (isloggedin() and !isguestuser()) {
11
11
redirect( $CFG->wwwroot.'/', get_string('loginalready'), 5);
13
$navigation = build_navigation(array(array('name' => 'MNET ID Provider', 'link' => null, 'type' => 'misc')));
13
$mnetidprovider = get_string('mnetidprovider','mnet');
14
$navigation = build_navigation(array(array('name' => $mnetidprovider, 'link' => null, 'type' => 'misc')));
15
print_header('MNET ID Provider', 'MNET ID Provider', $navigation, 'form.email' );
16
print_header($mnetidprovider, $mnetidprovider, $navigation, 'form.email' );
17
notify(get_string('mnetidproviderdesc', 'mnet'));
17
19
if ($form = data_submitted() and confirm_sesskey()) {
18
if ($user = get_record('user', 'username', $username, 'email', $form->email)) {
20
if ($user = get_record_select('user', "username = '$username' AND email = '$form->email' AND mnethostid != $CFG->mnet_localhost_id")) {
19
21
if (!empty($user->mnethostid) and $host = get_record('mnet_host', 'id', $user->mnethostid)) {
20
notice("You should be able to login at your <a href=\"{$host->wwwroot}/login/\">{$host->name}</a> provider.");
22
$link = "<a href=\"{$host->wwwroot}/login/\">{$host->name}</a>";
23
notice(get_string('mnetidprovidermsg','mnet',$link));
27
notice(get_string('mnetidprovidernotfound', 'mnet'));
25
31
echo '<p> </p>';
30
36
<input type="hidden" name="sesskey" value="<?php echo $sesskey; ?>">
31
37
<?php echo get_string('email') ?>:
32
38
<input type="text" name="email" size="" maxlength="100" />
33
<input type="submit" value="Find Login" />
39
<input type="submit" value="<?php echo get_string('findlogin','mnet'); ?>" />