Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Member
    Join Date
    Jul 2011
    Posts
    6

    Default clear cookies all the time with form related to email creation

    Hello There

    We have created a form to create email accounts and forwarders from outside cPanel... so that some moderators can create these accounts without accessing to cPanel...

    This is the form...

    /http://regidordigital.com/email_create/index.php

    It's in Spanish
    User = Usuario
    Contraseña = Password
    Repite Contraseña: = Repeat Password
    Redireccionado a: Forwarder

    Now at first we create the emails alright. But once we exit the browser and come back again, the form appears with the message "Las contraseñas no coinciden" (passwords don't match) and if we try to create an email account, it won't allow us to do it...

    If I go to options in the browser and clear cookies... then refresh... the passwords don't match message don't appear and I can create accounts properly again...

    This issue is taking place at least a IE, FF and chrome... And I was wondering if you could help me with it... My server provider hasn't been able to help me further with the issue and has recommended me to post in the forum....

    If you have any idea as to why this takes place, it'd be great...

    Thanks very much in advance
    Alberto

  2. #2
    Member
    Join Date
    Jul 2011
    Location
    /dev/null
    Posts
    26
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: clear cookies all the time with form related to email creation

    Hello.

    What's source code?

  3. #3
    Member
    Join Date
    Jul 2011
    Posts
    6

    Default Re: clear cookies all the time with form related to email creation

    This is the code at index.php

    <?php

    include("./xmlapi.php"); //XMLAPI cpanel client class

    // Default whm/cpanel account info

    $ip = "127.0.0.1"; // should be server IP address or 127.0.0.1 if local server
    $account = "username"; // cpanel user account name
    $passwd ="password"; // cpanel user password
    $port =2083; // cpanel secure authentication port unsecure port# 2082

    $email_domain = 'regidordigital.com'; // email domain (usually same as cPanel domain)
    $email_quota = 50; // default amount of space in megabytes


    /*************End of Setting***********************/

    function getVar($name, $def = '') {
    if (isset($_REQUEST[$name]))
    return $_REQUEST[$name];
    else
    return $def;
    }
    // check if overrides passed
    $email_user = getVar('user', '');
    $email_pass = getVar('pass', $passwd);
    $email_vpass = getVar('vpass', $vpasswd);
    $email_domain = getVar('domain', $email_domain);
    $email_quota = getVar('quota', $email_quota);
    $dest_email = getVar('forward', '');

    $msg = '';
    if (!empty($email_user))
    while(true) {


    if ($email_pass !== $email_vpass){ //check password
    $msg = "Las contrase&ntilde;as no coinciden";
    break;
    }

    $xmlapi = new xmlapi($ip);

    $xmlapi->set_port($port); //set port number. cpanel client class allow you to access WHM as well using WHM port.

    $xmlapi->password_auth($account, $passwd); // authorization with password. not as secure as hash.

    // cpanel email addpop function Parameters
    $call = array(domain=>$email_domain, email=>$email_user, password=>$email_pass, quota=>$email_quota);
    // cpanel email fwdopt function Parameters
    $call_f = array(domain=>$email_domain, email=>$email_user, fwdopt=>"fwd", fwdemail=>$dest_email);
    $xmlapi->set_debug(0); //output to error file set to 1 to see error_log.

    // making call to cpanel api
    $result = $xmlapi->api2_query($account, "Email", "addpop", $call );
    $result_forward = $xmlapi->api2_query($account, "Email", "addforward", $call_f); //create a forward
    //for debugging purposes. uncomment to see output
    //echo 'Result\n<pre>';
    //print_r($result);
    //echo '</pre>';

    if ($result->data->result == 1){
    $msg = $email_user.'@'.$email_domain.' ha sido creada';
    if ($result_forward->data->result == 1){
    $msg = $email_user.'@'.$email_domain.' redireccionada a '.$dest_email;
    }
    } else {
    $msg = $result->data->reason;
    break;
    }

    break;
    }

    ?>
    <html>
    <head><title>CREA CUENTAS DE EMAIL</title></head>
    <body>
    <?php echo '<div style="color:red">'.$msg.'</div>'; ?>
    <h1>CREA CUENTAS DE EMAIL</h1>
    <form name="frmEmail" method="post">
    <table width="400" border="0">
    <tr><td>Usuario:</td><td><input name="user" size="20" type="text" /></td></tr>
    <tr><td>Contrase&ntilde;a:</td><td><input name="pass" size="20" type="password" /></td></tr>
    <tr><td>Repite Contrase&ntilde;a:</td><td><input name="vpass" size="20" type="password" /></td></tr>
    <tr><td>Redireccionado a:</td><td><input name="forward" size="20" type="text" /></td></tr>
    <tr><td colspan="2" align="center"><hr /><input name="submit" type="submit" value="Crea Email" /></td></tr>
    </table>
    </form>
    </body>
    </html>
    <html><body></body></html>


    ............................................

    Thx very much
    Alberto

  4. #4
    Member
    Join Date
    Jul 2011
    Posts
    6

    Default Re: clear cookies all the time with form related to email creation

    Quote Originally Posted by kalid View Post
    Hello.

    What's source code?
    Is it being moderated or I cannot publish code?
    thx very much
    alberto

  5. #5
    Member
    Join Date
    Jul 2011
    Posts
    6

    Default Re: clear cookies all the time with form related to email creation

    Quote Originally Posted by regidoor View Post
    Is it being moderated or I cannot publish code?
    thx very much
    alberto
    <?php

    include("./xmlapi.php"); //XMLAPI cpanel client class

    // Default whm/cpanel account info

    $ip = "127.0.0.1"; // should be server IP address or 127.0.0.1 if local server
    $account = "username"; // cpanel user account name
    $passwd ="password"; // cpanel user password
    $port =2083; // cpanel secure authentication port unsecure port# 2082

    $email_domain = 'regidordigital.com'; // email domain (usually same as cPanel domain)
    $email_quota = 50; // default amount of space in megabytes


    /*************End of Setting***********************/

    function getVar($name, $def = '') {
    if (isset($_REQUEST[$name]))
    return $_REQUEST[$name];
    else
    return $def;
    }
    // check if overrides passed
    $email_user = getVar('user', '');
    $email_pass = getVar('pass', $passwd);
    $email_vpass = getVar('vpass', $vpasswd);
    $email_domain = getVar('domain', $email_domain);
    $email_quota = getVar('quota', $email_quota);
    $dest_email = getVar('forward', '');

    $msg = '';
    if (!empty($email_user))
    while(true) {


    if ($email_pass !== $email_vpass){ //check password
    $msg = "Las contrase&ntilde;as no coinciden";
    break;
    }

    $xmlapi = new xmlapi($ip);

    $xmlapi->set_port($port); //set port number. cpanel client class allow you to access WHM as well using WHM port.

    $xmlapi->password_auth($account, $passwd); // authorization with password. not as secure as hash.

    // cpanel email addpop function Parameters
    $call = array(domain=>$email_domain, email=>$email_user, password=>$email_pass, quota=>$email_quota);
    // cpanel email fwdopt function Parameters
    $call_f = array(domain=>$email_domain, email=>$email_user, fwdopt=>"fwd", fwdemail=>$dest_email);
    $xmlapi->set_debug(0); //output to error file set to 1 to see error_log.

    // making call to cpanel api
    $result = $xmlapi->api2_query($account, "Email", "addpop", $call );
    $result_forward = $xmlapi->api2_query($account, "Email", "addforward", $call_f); //create a forward
    //for debugging purposes. uncomment to see output
    //echo 'Result\n<pre>';
    //print_r($result);
    //echo '</pre>';

    if ($result->data->result == 1){
    $msg = $email_user.'@'.$email_domain.' ha sido creada';
    if ($result_forward->data->result == 1){
    $msg = $email_user.'@'.$email_domain.' redireccionada a '.$dest_email;
    }
    } else {
    $msg = $result->data->reason;
    break;
    }

    break;
    }

    ?>
    <html>
    <head><title>CREA CUENTAS DE EMAIL</title></head>
    <body>
    <?php echo '<div style="color:red">'.$msg.'</div>'; ?>
    <h1>CREA CUENTAS DE EMAIL</h1>
    <form name="frmEmail" method="post">
    <table width="400" border="0">
    <tr><td>Usuario:</td><td><input name="user" size="20" type="text" /></td></tr>
    <tr><td>Contrase&ntilde;a:</td><td><input name="pass" size="20" type="password" /></td></tr>
    <tr><td>Repite Contrase&ntilde;a:</td><td><input name="vpass" size="20" type="password" /></td></tr>
    <tr><td>Redireccionado a:</td><td><input name="forward" size="20" type="text" /></td></tr>
    <tr><td colspan="2" align="center"><hr /><input name="submit" type="submit" value="Crea Email" /></td></tr>
    </table>
    </form>
    </body>
    </html>
    <html><body></body></html>

  6. #6
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: clear cookies all the time with form related to email creation

    If a post has a sufficiently high enough spam score, it will end up moderated prior to being approved. This did indeed happen with the code you've posted, so I've gone ahead and approved your posts.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  7. #7
    Member
    Join Date
    Jul 2011
    Posts
    6

    Default Re: clear cookies all the time with form related to email creation

    Ok... Thx very much... I see that it has been published...
    Was that the code you meant?'

    Thanks a lot
    Alberto

  8. #8
    Member
    Join Date
    Jul 2011
    Posts
    6

    Default Re: clear cookies all the time with form related to email creation

    Hello... Any hint as to why this cookie issue takes place with the form at

    CREA CUENTAS DE EMAIL

    Thank you
    Alberto

Similar Threads & Tags
Similar threads

  1. 3 email related questions
    By baboo in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 01-05-2006, 05:39 AM
  2. Email related difficulties
    By customdesign in forum cPanel and WHM Discussions
    Replies: 16
    Last Post: 04-30-2005, 10:07 AM
  3. security related email? please help
    By fog in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 11-12-2003, 04:07 AM
  4. The Thread "account creation form" by Kiwi was moved
    By Brownie in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 09-29-2001, 06:36 AM
  5. Account Creation Form
    By Kiwi in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 08-30-2001, 06:09 PM
Tags for this Thread
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube