Skip to content

Commit

Permalink
fix my previous incorrect short tag fix, fixed register globals, IP a…
Browse files Browse the repository at this point in the history
…ddress used as mail user when not logged in; merged from MOODLE_16_STABLE
  • Loading branch information
skodak committed May 15, 2006
1 parent e7a8d28 commit 4ca5b47
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions error/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@

require('../config.php');

if (!empty($text)) { // form submitted
if ($form = data_submitted('nomatch')) { // form submitted, do not check referer (origal page unknown)!
if (!$admin = get_admin() ) {
error('Could not find the admin user to mail to!');
}

email_to_user($admin, $USER, 'Error: '. $referer .' -> '. $requested, $text);
if (empty($USER->id)) {
$user = getremoteaddr(); // user not logged in, use IP address as name
} else {
$user = $USER;
}
email_to_user($admin, $user, 'Error: '. $form->referer .' -> '. $form->requested, $form->text);

redirect($CFG->wwwroot .'/course/', 'Message sent, thanks', 3);
die;
Expand All @@ -24,12 +29,12 @@
?>

<center>
<p><?php get_string('pleasereport', 'error'); ?>
<p><?php echo get_string('pleasereport', 'error'); ?>
<p><form action="<?php echo $CFG->wwwroot ?>/error/index.php" name="form" method="post">
<textarea rows="3" cols="50" name="text"></textarea><br />
<input type="hidden" name="referer" value="<?php p($httpreferer) ?>">
<input type="hidden" name="requested" value="<?php p($requesturi) ?>">
<input type="submit" value="<?php get_string('sendmessage', 'error'); ?>">
<input type="submit" value="<?php echo get_string('sendmessage', 'error'); ?>">
</form>
<?php

Expand Down

0 comments on commit 4ca5b47

Please sign in to comment.