Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
  1. #1
    Banned
    Join Date
    May 2011
    Location
    Fairfax, CA
    Posts
    2,036
    Member #
    28003
    Liked
    126 times
    I was looking at this (I already have the keys)
    http://code.google.com/apis/recaptcha/docs/php.html
    But it's way too complicated.
    I need this form:
    http://portaloftheweb.com/mail/cpanelemail.php
    to have the thing.
    Where would I add it in the code?
    Thanks.

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    You need a script to process your form too ....

    This line:
    <form name="frmEmail" method="post" action="process.php">

    Can you show us that script?
    You can call it whatever you want, but it has to be specified.
    I don't recommend using the same script as the form itself, that makes it too complicated.

    .


  4. #3
    Banned
    Join Date
    May 2011
    Location
    Fairfax, CA
    Posts
    2,036
    Member #
    28003
    Liked
    126 times
    Well there is already another script. I think it's called xmlapi.php or something...Is that the one?
    Because the account creation works perfectly!

  5. #4
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    1) Have you uploaded "recaptchalib.php" to your website?
    That has to be done.

    2) You then insert the PHP scripting shown, into your form ....
    Also, your form has no "action", so I'm not sure how you can say it's working.
    PHP Code:
    <html>
    <head><title>Create a free email account!</title></head>
    <body>
    <p>Portaloftheweb.com provides a fast and reliable free email service. It includes plenty of storage space and it has an intuitive interface (based on Roundcube).</p>
    <p>By signing up for an email address with Portaloftheweb.com, you agree to the <a href="http://portaloftheweb.com/mail/terms.html">Terms of Service/Privacy Policy</a>. Enjoy!</p>
    <p> If you already have an account, please sign in <a href="http://portaloftheweb.com/mail/">here</a><br />
    <b>Important: in the "User Name" field please do it in this format: xxxxxxxxx@portaloftheweb.com, where xxxxxxxxx is an address of your choice.</b><br />
    <div style="color:red"></div><h1>Create a Free Email Account...</h1>

    <form name="frmEmail" method="post">
    <table width="400" border="0">
    <tr><td>Username:</td><td><input name="user" size="20" type="text" /></td></tr>
    <tr><td>Password:</td><td><input name="pass" size="20" type="password" /></td></tr>
    <tr><td>Verify Password:</td><td><input name="vpass" size="20" type="password" /></td></tr>
    <tr><td>
    <?php
    require_once('recaptchalib.php');
    $publickey "your_public_key"// you got this from the signup page
    echo recaptcha_get_html($publickey);
    ?>
    </td></tr>
    <tr><td colspan="2" align="center"><hr /><input name="submit" type="submit" value="Create Email" /></td></tr>
    </table>
    </form>
    </body>
    </html>

    Tell me how your form sends data to a script that you say is working.
    Let's get this much figured-out first.


    .


  6. #5
    Banned
    Join Date
    May 2011
    Location
    Fairfax, CA
    Posts
    2,036
    Member #
    28003
    Liked
    126 times
    Well here's how I do it:

  7. #6
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    Below is a script you can test.
    I'm just taking a stab at it, since I have no way of testing anything myself.

    Make a safe copy of existing "cpanelemail.php" and save the script below as the same name.

    You have to download "recaptchalib.php" from the captcha website and upload that to your website also.

    important!
    There are 2 places in this script ... you have to enter 1)your private key, and 2)your public key ...


    Try this script as "cpanelemail.php":
    PHP Code:
    <?php

    /*
      Yi Xu  08/17/2010  Ver 1.0
      This is a simple script for creating cpanel email accounts using cPanel XML API Client Class
      I got the idea from http://www.zubrag.com/scripts/ cpanel email creator script.
      However, their script uses fopen access cpanel directly and it doesn't work anymore.
      Cpanel updated their version. It is better to use their client class to access cpanel functions externally.
      Got any suggestions. please email me at andy3dfx@yahoo.com
    */
    include("./xmlapi.php");   //XMLAPI cpanel client class

    // Default whm/cpanel account info

    $ip "localhost";           // should be WHM ip address
    $account "myaccount";        // cpanel user account name
    $passwd ="mypassword!";        // cpanel user password
    $port =2083;                 // cpanel secure authentication port unsecure port# 2082

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


    require_once('recaptchalib.php');


    /*************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);

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

      
    $privatekey "your_private_key";
      
    $resp recaptcha_check_answer ($privatekey,
                                    
    $_SERVER["REMOTE_ADDR"],
                                    
    $_POST["recaptcha_challenge_field"],
                                    
    $_POST["recaptcha_response_field"]);

      if (!
    $resp->is_valid) {
        
    // What happens when the CAPTCHA was entered incorrectly
        
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
             
    "(reCAPTCHA said: " $resp->error ")");
      } else {
        
    // Do nothing, captcha is good.
      
    }

    if (
    $email_pass !== $email_vpass){       //check password
    $msg "Email password does not match";
    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_domainemail=>$email_userpassword=>$email_passquota=>$email_quota);

    $xmlapi->set_debug(0);      //output to error file  set to 1 to see error_log.

    $result $xmlapi->api2_query($account"Email""addpop"$call ); // making call to cpanel api

    //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.' account created';

    } else {
    $msg $result->data->reason;
      break;
    }

    break;
    }

    ?>
    <html>
    <head><title>cPanel Email Account Creator</title></head>
    <body>
    <?php echo '<div style="color:red">'.$msg.'</div>'?>
    <h1>cPanel Email Account Creator</h1>
    <form name="frmEmail" method="post">
    <table width="400" border="0">
    <tr><td>Username:</td><td><input name="user" size="20" type="text" /></td></tr>
    <tr><td>Password:</td><td><input name="pass" size="20" type="password" /></td></tr>
    <tr><td>Verify Password:</td><td><input name="vpass" size="20" type="password" /></td></tr>
    <?php
    $publickey 
    "your_public_key"// you got this from the signup page
    echo recaptcha_get_html($publickey);
    ?>
    <tr><td colspan="2" align="center"><hr /><input name="submit" type="submit" value="Create Email" /></td></tr>
    </table>
    </form>
    </body>
    </html>
    If it fails miserably, restore your saved version of "cpanelemail.php".


    .


  8. #7
    Banned
    Join Date
    May 2011
    Location
    Fairfax, CA
    Posts
    2,036
    Member #
    28003
    Liked
    126 times
    That's amazing! It worked! Thank you so much!
    It worked fine for me but now one last thing I need to do:
    AJAX or something so that it puts a little check mark or x next to each thing, as they finish each field!

  9. #8
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    Oooo ... that's going to be a bit tougher to do.

    You need to find an AJAX script that has a demo ...
    picking out one that displays the way you like.

    Some are "on-the-fly", others display errors after clicking submit.
    Some display text messages, others display red or green checkmarks.

    First step: Search around the internet for an AJAX form validator that you like.
    Make sure it supports comparing one password to another.


    EDIT:
    On the ReCaptcha thing, you can also change the "look" of the recaptcha box.
    http://code.google.com/apis/recaptch...omization.html


    .


  10. #9
    Banned
    Join Date
    May 2011
    Location
    Fairfax, CA
    Posts
    2,036
    Member #
    28003
    Liked
    126 times
    Lol. Are you "sdfsd@portaloftheweb.com"?

  11. #10
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    Yes, that was me.

    And I'm curious what the site is supposed to do.
    Why wouldn't I just use Yahoo to get a free email account?
    Would I feel comfortable trusting my emails to someone that is building a website?
    Technically, you have access to all of the emails that reside on your website.

    .



Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:34 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com