If this can help, I have a file with such functions somewhere.
The code is almost broken, but the cyrus part (imap, in fact) work well...

It's an old thing I made (and maybe copied frome someone else, that I 
need to refresh :)

Cheers,

Prune

Adi Linden wrote:

> Hi,
> 
> This is great! So I can use php scripts to do the same without having to
> invoke cyradm...
> 
> TTYL,
> Adi
> 
> On Mon, 16 Jul 2001, Scott Adkins wrote:
> 
>> In addition to that, it should be stated that the difference between
>> administrative commands and non-administrative commands is purely one
>> of access rights.  You must be logged into an adminstrative account
>> to do anything useful to user accounts.  In any the case, the command
>> set is the same... just how much you can do with those commands is the
>> question.
>> 
>> Scott
>> 
>> --On Monday, July 16, 2001 4:59 PM -0400 "Michael T. Bacon" 
>> <[EMAIL PROTECTED]> wrote:
>> 
>>> Cyradm is simply a tool for issuing commands to the IMAP port.  As such,
>>> all of the commands in cyradm are just cleaned up IMAP commands, and
>>> could be issued by some other program or a human with a telnet connection
>>> to port 143.
>>> 
>>> Michael
>>> 
>>> Adi Linden wrote:
>>> 
>>>> Hi,
>>>> 
>>>> What commands are available to administer cyrus-imap via connection on
>>>> the imap port instead of using cyradm?
>>>> 
>>>> TTYL,
>>>> Adi
>>> 
>> 
>> --
>>  +-=-=-=-=-=-=-=-=-=+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+=-=-=-=-=-=-=-=-+
>>       Scott W. Adkins                http://www.cns.ohiou.edu/~sadkins/
>>    UNIX Systems Engineer                  mailto:[EMAIL PROTECTED]
>>         ICQ 7626282                 Work (740)593-9478 Fax (740)593-1944
>>  +-=-=-=-=-=-=-=-=-=+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+=-=-=-=-=-=-=-=-+
>>      CNS, HDL Center, Suite 301, Ohio University, Athens, OH 45701-2979
>> 

-- 
    - le Centre - 
a Mad Cow Tribe product

(Very uncommon, but we should please everybody anyway, even disturbed minds)

<?php

include ("config.inc");
include ("fonctions.php");
require "lang/$default_lang.lang";

session_start();

      if (!session_is_registered('user_is_logged_in') || !isset($login)) {
      //if (!session_is_registered('user_is_logged_in') || !isset($login) || 
$access_level !="admin") {
        print_bad_login ();
        session_destroy();
        exit;  
}

   echo "<HEAD><TITLE>";
   echo $login . " - Admin";
   echo "</TITLE></HEAD>\n";
   echo "<BODY TEXT=000000 BGCOLOR=#FFFFFF LINK=0000CC VLINK=0000CC ALINK=0000CC>\n";

echo "welcome ".$login."<br>";

//if (!session_is_registered('user_created') || !$user_created) {
//      session_register("user_created");
//      $user_created=1;
if (!isset($boite)) {
        get_info();
}
else {
        echo "<BR> creation de la boite $boite <BR>";
        $mbox = imap_open ("{localhost:143}user", "cyrus", "password", OP_HALFOPEN) || 
die("can t connect: ".imap_last_error());
        echo "<BR> connection a imap ok <BR>";
        $toto = imap_utf7_encode("{localhost:143}user.$boite");
        echo "<BR> $toto <BR>";
        if(imap_createmailbox($mbox,imap_utf7_encode("{localhost:143}user.$boite"))) { 
                
                $status = 
imap_status($mbox,imap_utf7_encode("{localhost:143}user.$boite"),SA_ALL); 
                if($status) { 
                        print("your new mailbox  $boite  has the following 
status:<br>\n"); 
                        print("Messages: ". $status->messages )."<br>\n"; 
                        print("Recent: ". $status->recent )."<br>\n"; 
                        print("Unseen: ". $status->unseen )."<br>\n"; 
                        print("UIDnext: ". $status->uidnext )."<br>\n"; 
                        print("UIDvalidity:". $status->uidvalidity)."<br>\n";
                        }
                else print "<BR>imap_status failed: ".imap_lasterror()."<BR>\n";
                        
        }
//      else echo "probleme pour la creation de la boite $boite<BR>";

        echo "<BR>done<BR>";

//      $toto=imap_createmailbox($mbox,"{localhost:143}user.".$boite);
//      echo "le resultat est ".$toto."<BR>";
//session_unregister("user_created");
        unset ($boite);
        imap_close($mbox);

//      get_info();
}

function get_info () {

echo "<FORM ACTION=\"create_cyrus_user.php\" METHOD=\"POST\" NAME=f>\n";
echo "<BR>boite : <INPUT TYPE=TEXT NAME=\"boite\">\n";

echo "<CENTER><INPUT TYPE=SUBMIT VALUE=\"Creation\"";
 echo "\"></CENTER>\n";
echo "</FORM>\n";
}

function print_result() {
        echo $title;
        echo 
$title."<BR>".$cn.$sn."<BR>".$registeredAddress."<BR>".$postalCode."<BR>".$l."<BR>".$st."<BR>".$departmentNumber."<BR>".$c."<BR>".$telephoneNumber."<BR>".$celularTelephoneNumber."<BR>".$domaine."<BR>";
}
?>


Reply via email to