This repository was archived by the owner on Feb 26, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemailNotice.php
More file actions
62 lines (45 loc) · 1.48 KB
/
emailNotice.php
File metadata and controls
62 lines (45 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
$adminEmail = 'admin@example.edu';
$emailAddresses = 'eresources@example.edu,admin@example.edu';
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
$protocol = 'https://';
}else {
$protocol = 'http://';
}
function ignoreMail(){
$message = "Someone went directly to this form: ". htmlspecialchars($_POST['url']);
mail($adminEmail, 'EZProxy Host warning triggered erroneously', $message);
exit;
}
$thisServer = $protocol . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
if ($_POST) {
switch ($_POST['url']){
case $thisServer:
ignoreMail();
default:
$message = 'Someone tried to access this address which is not in the host list: '. htmlspecialchars($_POST['url']);
mail($emailAddresses, 'EZProxy Host needed', $message);
}
}else{
?>
<html>
<head>
<script language="javascript">
function SubmitForm()
{
var url = (window.location != window.parent.location) ? document.referrer: document.location;
document.getElementById('url').value=url;
document.getElementById('frmID').submit();
}
</script>
</head>
<body onload="SubmitForm()">
<form name="frmID" id="frmID" method="post" action="emailNotice.php">
<input type="hidden" name="url" id="url" value="" />
<input type="submit" name="emailNoticeSubmit" id="emailNoticeSubmit" />
</form>
<script type="text/javascript">
</script>
<?php
}
?>