document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. <?php
  2.  
  3. session_start() ;
  4.  
  5. //error_reporting(-1);
  6.  
  7. error_reporting( 0 ) ;
  8.  
  9. // DEFINE VARIABLES.
  10.  
  11. $pass = "ZZZZZ" ; // password to access this page.
  12.  
  13. $gmail_username = "myusername@gmail.com" ; // your google account username.
  14.  
  15. $gmail_password = "mypassword" ; //  your google account password.
  16.  
  17. $perpage = 20 ; // number of mails to be display per page.
  18.  
  19. if ( isset( $_POST[\'pass\'] ) )
  20. {
  21.  
  22.     if ( $pass == $_POST[\'pass\'] )
  23.     {
  24.  
  25.         $_SESSION[\'logged\'] = 1 ;
  26.  
  27.     }
  28.  
  29.     else
  30.     {
  31.  
  32.         echo "Invalid Login Details !" ;
  33.  
  34.     }
  35.  
  36. }
  37.  
  38. ?>
  39.  
  40. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  41.  
  42. <html xmlns="http://www.w3.org/1999/xhtml">
  43.  
  44. <head>
  45.  
  46. <title>FETCH MAIL</title>
  47.  
  48. <style type="text/css">
  49.  
  50. body{font:12px sans-serif;background:rgb(210,210,250);}
  51.  
  52.     .topbar{background:rgb(150,0,250);font:15px cursive;font-weight:bold;color:white;border:1px solid silver;padding:5px;}
  53.  
  54.         .message{background:rgb(255,255,255);border:1px solid rgb(0,0,155);padding:5px;}
  55.  
  56.         .mailbox{border:1px dashed silver;padding:5px;}
  57.  
  58.     input,submit,select{padding:3px;font:12px cursive;font-weight:bold;background:transparent;border:1px solid rgb(50,50,50);}
  59.  
  60. .header{font:40px \'script mt bold\';font-weight:bold;color:purple;}
  61.  
  62. </style>
  63.  
  64. </head>
  65.  
  66. <body>
  67.  
  68. <?php
  69.  
  70. if ( ! isset( $_SESSION[\'logged\'] ) && ! isset( $_POST[\'pass\'] ) )
  71. {
  72.  
  73.     exit( "Please Log In<form method=\'post\'><input type=\'password\' name=\'pass\'><input type=\'submit\' value=\'Go\'></form>" ) ;
  74.  
  75. }
  76.  
  77. $link = imap_open( "{imap.gmail.com:993/imap/ssl}INBOX", $gmail_username, $gmail_password ) or exit( "Connection  aborted: " . imap_last_error() ) ;
  78.  
  79. $mails = imap_search( $link, \'ALL\' ) ;
  80.  
  81. rsort( $mails ) ;
  82.  
  83. $total = count( $mails ) ;
  84.  
  85. if ( isset( $_GET[\'page\'] ) )
  86. {
  87.  
  88.     if ( is_numeric( $_GET[\'page\'] ) )
  89.     {
  90.  
  91.         $begin = round( $_GET[\'page\'], 0 ) * $perpage ;
  92.  
  93.     }
  94.  
  95.     else
  96.     {
  97.  
  98.         $begin = $total ;
  99.  
  100.     }
  101.  
  102. }
  103. else
  104. {
  105.  
  106.     $begin = $total ;
  107.  
  108. }
  109.  
  110. echo "<table class=\'main\'><tr><td><h2 class=\'header\'>FETCH EMAIL</h2></td></tr><tr><td>" ;
  111.  
  112. for ( $i = $begin; $i >= $begin - $perpage; $i-- )
  113. {
  114.  
  115.     if ( $i <= $total )
  116.     {
  117.  
  118.         $overview = imap_fetch_overview( $link, $i, 0 ) ;
  119.  
  120.         $message = imap_fetchbody( $link, $i, 2 ) ;
  121.  
  122.         $message = preg_replace( "@<style.+?</style>@is", "", $message ) ;
  123.  
  124.         $message = strip_tags( $message ) ;
  125.  
  126.         $read = ( $overview[0]->seen == 0 ) ? \'NOT READ YET\' : \'ALREADY READ\' ;
  127.  
  128.         echo "
  129. <div class=\'mailbox\'>
  130.  
  131. <br/>
  132.  
  133. <div class=\'topbar\'>
  134.  
  135. [ $i ]. SUBJECT : {$overview[0]->subject} || SENT FROM: {$overview[0]->from} || SENT AT: {$overview[0]->date} || $read
  136.  
  137. </div>
  138.  
  139. <br/>
  140.  
  141. <div class=\'message\'>
  142.  
  143. <pre>{$message}</pre>
  144.  
  145. </div>
  146.  
  147. </div>
  148. " ;
  149.     }
  150.  
  151. }
  152.  
  153. echo "</td></tr></table>" ;
  154.  
  155. // pagination
  156.  
  157. echo "<table class=\'nav\'><tr><td>" ;
  158.  
  159. if ( $begin > 0 )
  160. {
  161.     $pre = $begin - 1 ;
  162.  
  163.     echo "<form method=\'get\' action=\'\'>
  164.  
  165.        <input type=\'hidden\' name=\'page\' value=\'{$pre}\' />
  166.  
  167.        <input type=\'submit\' value=\'Previous\' />
  168.  
  169.        </form>" ;
  170.  
  171. }
  172.  
  173. echo "</td><td>" ;
  174.  
  175. if ( $begin < $total )
  176. {
  177.  
  178.     $nxt = $begin + 1 ;
  179.  
  180.     echo "<form method=\'get\' action=\'\'>
  181.  
  182.    <input type=\'hidden\' name=\'page\' value=\'{$nxt}\' />
  183.  
  184.    <input type=\'submit\' value=\'Previous\' />
  185.  
  186.    </form>" ;
  187.  
  188. }
  189.  
  190. echo "</td><td>" ;
  191.  
  192. $factor = round( $total / $perpage, 0 ) ;
  193.  
  194. echo "<form method=\'get\' action=\'\'>
  195.  
  196. <select name=\'page\'>
  197. " ;
  198.  
  199. while ( $factor >= 0 )
  200. {
  201.     echo "<option value=\'{$factor}\'>{$factor}</option>" ;
  202.     $factor-- ;
  203. }
  204.  
  205. echo "</select> <input type=\'submit\' value=\'Goto Page\'></form>" ;
  206.  
  207. echo "</td></tr></table>" ;
  208.  
  209. ?>
  210.  
  211.  
  212. </body>
  213.  
  214. </html>
');