home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / admin / synch.php < prev    next >
Encoding:
PHP Script  |  2003-03-16  |  2.0 KB  |  59 lines

  1. <?php
  2.     include("../include/imap.inc");
  3.  
  4. if (isset($submit)){
  5.     header("Content-Type: text/plain");
  6.     $from_conn = iil_Connect($from_host, $from_login, $from_password);
  7.     $to_conn = iil_Connect($to_host, $to_login, $to_password);
  8.     if (($from_conn) && ($to_conn)){
  9.         echo "Connected to $from_host and $to_host !<br>\n"; flush();
  10.         $num = iil_C_CountMessages($from_conn, $from_mbox);
  11.  
  12.         echo "Got {$fromID} to {$toID}\n";
  13.         if (empty($fromID)) $fromID=1;
  14.         if (empty($toID)) $toID=$num;
  15.         echo "Will sync $fromID - $toID messsages in $from_mbox with $to_mbox \n"; flush();
  16.  
  17.         for ($i=$fromID;$i<=$toID;$i++){
  18.             echo "Fetching message $i \n";
  19.             $message = iil_C_FetchPartHeader($from_conn, $from_mbox, $i, "");
  20.             $message .= iil_C_FetchPartBody($from_conn, $from_mbox, $i, "");
  21.             //echo $message."<br>\n";
  22.             if (iil_C_Append($to_conn, $to_mbox, $message)){
  23.                 echo "Moved message $i from $from_host/$from_mbox to $to_host/$to_mbox \n";flush();
  24.             }else{
  25.                 echo "Move failed <br>\n";
  26.             }
  27.         }
  28.         iil_Close($from_conn);
  29.         iil_Close($to_conn);
  30.     }
  31. }else{
  32. ?>
  33. <html>
  34. <body>
  35. <form method="POST" action="synch.php">
  36. <table><tr>
  37.     <td>
  38.     <b>From:</b>
  39.     <br>Host:<input type="text" name="from_host" value="<?php echo $from_host?>">
  40.     <br>Login:<input type="text" name="from_login" value="<?php echo $from_login?>">
  41.     <br>Password:<input type="text" name="from_password" value="<?php echo $from_password?>">
  42.     <br>Mailbox:<input type="text" name="from_mbox" value="<?php echo $from_mbox?>">
  43.     <br>From <input type="text" name="fromID" value="" size=4> TO: <input type="text" name="toID" value="" size=4>
  44.     </td>
  45.     <td>
  46.     <b>To:</b>
  47.     <br>Host:<input type="text" name="to_host" value="<?php echo $to_host?>">
  48.     <br>Login:<input type="text" name="to_login" value="<?php echo $to_login?>">
  49.     <br>Password:<input type="text" name="to_password" value="<?php echo $to_password?>">
  50.     <br>Mailbox:<input type="text" name="to_mbox" value="<?php echo $to_mbox?>"> 
  51.     </td>
  52. </tr></table>
  53. <input type="submit" name="submit" value="Synchronize!">
  54. </form>
  55. </body>
  56. </html>
  57. <?php
  58. }
  59. ?>