This blob has been accessed 388 times via Git panel.
- <?php
- session_start();
- if (!isset($_SESSION['logged_uid']) or !isset($_SESSION['logged_lvl']) or !isset($_SESSION['logged_key']) or ($_SESSION['logged_lvl'] != "subscriber")) {
- exit;
- }
- if (!isset($_POST['box']) or empty($_POST['box'])) {
- $folder = "INBOX";
- }
- else {
- $folder = trim(strip_tags($_POST['box']));
- }
- $conn = '{127.0.0.1:143/imap/notls/norsh}';
- $mbox = imap_open($conn, $_SESSION['logged_uid'], $_SESSION['logged_key'], OP_HALFOPEN) or die("can't connect: " . imap_last_error());
- $search_folders = imap_list($mbox,$conn,"*");
- if (is_array($search_folders)) {
- reset($search_folders);
- sort($search_folders);
- echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr>";
- echo "<form method=\"post\">";
- echo "<td><select class=\"input\" name=\"box\">";
- foreach ($search_folders as $search_folder) {
- $search_folder = str_replace($conn,"",$search_folder);
- if ($folder == $search_folder) {
- echo "<option selected>$search_folder</option>";
- }
- else {
- echo "<option>$search_folder</option>";
- }
- }
- echo "</select></td>";
- echo "<td width=\"2\"></td>";
- echo "<td><select class=\"input\" name=\"imap_search_where\">";
- echo "<option value=\"FROM\">From:</option>";
- if (strtolower($folder) == strtolower("Sent")) {
- echo "<option value=\"TO\" selected>To:</option>";
- }
- else {
- echo "<option value=\"TO\">To:</option>";
- }
- echo "<option value=\"CC\">Cc:</option>";
- echo "<option value=\"SUBJECT\">Subject</option>";
- echo "<option value=\"TEXT\">Text</option>";
- echo "<option value=\"BODY\">Body</option>";
- echo "</select></td>";
- echo "<td width=\"2\"></td>";
- echo "<td><input type=\"text\" class=\"input\" name=\"imap_search_query\"></td>";
- echo "<td width=\"2\"></td>";
- echo "<td width=\"40\"><input type=\"submit\" value=\"search\"></td>";
- echo "</form>";
- echo "</tr></table>";
- }
- imap_close($mbox);
- ?>