The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Let Users create their own accounts

Discussion in 'E-mail Discussions' started by nasser110, Dec 13, 2008.

  1. nasser110

    nasser110 Member

    Joined:
    Sep 13, 2007
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    hi
    i have a question , i find out this script for create email account with php program :
    Code:
    
    
    <?php     
        // Domain Logon Details 
        $username = "cpanellogin"; 
        $password = "cpanelpassword"; 
          
        // Domain details 
        $domain = "domainname.com"; 
        $theme = "xpevolution"; 
          
        // Parameters to parse 
        $eDomain = "domainame.com"; 
        $eQuota = "10"; // eg"10"; 
          
        if (isset($delpop)) { 
            print "Account deleted : ".$popuser."@".$eDomain; 
              
            $postfields = "email=$popuser&domain=$eDomain"; 
            $url = "http://$username:$password@$domain:2082/frontend/$theme/mail/realdelpop.html?$postfields"; 
            //print "<hr>"; 
            //print $url; 
            // initialise Curl 
            $popPost = curl_init(); 
            curl_setopt($popPost, CURLOPT_URL, $url); 
            // Set Curl Option: Username:Password 
            curl_setopt($popPost, CURLOPT_POST, 1); 
            // Set Curl Option: Collect result from script 
            curl_setopt($popPost, CURLOPT_RETURNTRANSFER, 1); 
            // Set Curl Option: Set timeout to 15 seconds 
            curl_setopt($popPost, CURLOPT_TIMEOUT, 15); 
            // Set Curl Option: Post data 
            //curl_setopt($popPost, CURLOPT_POSTFIELDS, $postfields); 
            // Execute Request, and store result in $tb_post 
            $popPost_result = curl_exec ($popPost); 
            // Close Curl 
            curl_close ($popPost); 
            $start = strpos($popPost_result, 'Account'); 
            $end = strpos($popPost_result, 'Go'); 
            $subset = substr($popPost_result, $start, $end+8-$start); 
            print $substr; 
        } 
          
        if (isset($eEmail)) { 
            $ePassword = $password2; 
            // Put post fields variable together 
            $postfields = "email=$eEmail&domain=$eDomain&password=$ePassword&quota=$eQuota"; 
            // initialise Curl 
            $popPost = curl_init(); 
            // Set Curl Option: URL 
            $url = "http://$username:$password@$domain:2082/frontend/$theme/mail/doaddpop.html?$postfields"; 
            curl_setopt($popPost, CURLOPT_URL, $url); 
            // Set Curl Option: Username:Password 
            curl_setopt($popPost, CURLOPT_POST, 1); 
            // Set Curl Option: Collect result from script 
            curl_setopt($popPost, CURLOPT_RETURNTRANSFER, 1); 
            // Set Curl Option: Set timeout to 15 seconds 
            curl_setopt($popPost, CURLOPT_TIMEOUT, 15); 
            // Set Curl Option: Post data 
            //curl_setopt($popPost, CURLOPT_POSTFIELDS, $postfields); 
            // Execute Request, and store result in $tb_post 
            $popPost_result = curl_exec ($popPost); 
            // Close Curl 
            curl_close ($popPost); 
              
            //output results 
            $start = strpos($popPost_result, '<b>Account'); 
            $end = strpos($popPost_result, 'created.'); 
            $subset = substr($popPost_result, $start, $end+8-$start); 
            $subset = str_replace('login ', "login<br>", $subset); //for neatness 
            //$subset=str_replace("<!",'<-',$subset); //see the comments 
            if (preg_match ('/Sorry/i', "$subset")) { 
                print "<br><b>&nbsp;&nbsp;&nbsp;Sorry that account already exists.</b><br><br><br><br><br><br><br>"; 
                //print ($subset); 
            } elseif(preg_match ('/You must specify/i', "$subset")) { 
                print "<br><b>&nbsp;&nbsp;&nbsp;You must specify a password.</b><br><br><br><br><br><br><br>"; 
            } else { 
                print ($subset); 
                print "<br><br>You may now use <b>mail.$domain</b> as your POP3 setting in your mail client or access <b>WebMail</b> by selecting <a href=http://$domain/webmail>Here</a>. 
                    <center> 
                    <br><a href=javascript:history.go(-1)>Go Back</a> 
                    </center>"; 
            } 
        } else { 
        ?> 
    
        <form name="emailform" method="post" action="anew.php"> 
          <table border="0" cellspacing="1" align=center cellpadding="0"> 
            <tr> 
              <td>Prefered Email Address:</td> 
              <td colspan="2"><input size=10 value="" name="eEmail" type="text"> 
            @<?= $domain ?></td> 
            </tr> 
            <tr> 
              <td>Password:</td> 
              <td colspan="2"><input size=10 name="password1" value="" type="password"></td> 
            </tr> 
            <tr> 
              <td>Retype Password:</td> 
              <td colspan="2"><input size=10 name="password2" value="" type="password"></td> 
            </tr> 
            <tr> 
              <td>&nbsp;</td> 
              <td colspan="2">&nbsp;</td> 
            </tr> 
            <tr> 
              <td>&nbsp;</td> 
              <td width="344"> <div align="center"> 
                  <input name="signupbtn" type="button" id="signupbtn" value="Signup" onClick="validateform()"> 
                </div></td> 
              <td width="163">&nbsp;</td> 
            </tr> 
          </table> 
          <script language="JavaScript1.2"> 
         
         
        function validateform() { 
            if (checkEmailAddress(document.emailform.eEmail)) { 
                if(document.emailform.password1.value == document.emailform.password2.value) { 
                    document.emailform.submit(); 
                } 
                else 
                { 
                    alert("The passwords you typed do not appear to match"); 
                } 
            } 
        } 
        </script> 
        </form> 
        <? } ?> 
    
    
    

    But This Codes Will Be Create Email And 1 folder for each email in root Directory , if all users become over than 20.000(and Upper) users (Email Account) my server will be Crash And Not rationalize ,AnyBody Help me How Create Email Virtually (Folder Less !) For Too much Users ???
    ////////////
    for create virtually subdomains , i find out a usefull code and now all subdomains in my site are Virtually
    ////////////
    tnx
     
    #1 nasser110, Dec 13, 2008
    Last edited: Dec 13, 2008
  2. nasser110

    nasser110 Member

    Joined:
    Sep 13, 2007
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Please Advise For This Problem (Virtual Create Email)
    heretofore i used Piping Email To a PHP Script But This method Not Supported POP3 Email
    please Help me
    tnx
     
Loading...

Share This Page