summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php28
1 files changed, 23 insertions, 5 deletions
diff --git a/index.php b/index.php
index 3daeb7e..e6213f3 100644
--- a/index.php
+++ b/index.php
@@ -1,13 +1,31 @@
<?php
require_once __DIR__ . '/bootstrap.php';
-$user = "feed@maxmail.xyz";
-$pass = "1234abc";
-#$inbox = array("INBOX", "Trash");
-$inbox = array("INBOX");
-$max_items = 10;
+$user = $_REQUEST['user'];
+$pass = $_REQUEST['token'];
+$inbox = strtoupper($_REQUEST['mailbox']);
+$max_items = intval($_REQUEST['max_items']);
$ttl = 60*60;
+if ( "" === $_REQUEST['user'] || "" === $_REQUEST['token'] ) {
+ header( $_SERVER['SERVER_PROTOCOL'] . ' 400 Invalid Request.');
+ echo "Invalid user or token supplied.";
+ exit;
+}
+
+if ( "" === $_REQUEST['mailbox'] ) {
+ $inbox = "INBOX";
+}
+$inbox = explode(",", $inbox);
+
+if ( 0 <= $_REQUEST['max_items'] ) {
+ $max_items = 10;
+}
+if ( $max_items > 100 ) {
+ $max_items = 100;
+}
+
+#var_dump($user, $pass, $inbox, $max_items); exit;
$mail = getMail($user, $pass, $inbox, $max_items);
$inbox_string = implode(",", $inbox);