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.

addpop

Discussion in 'General Discussion' started by ipab, Nov 24, 2005.

  1. ipab

    ipab Member

    Joined:
    Oct 27, 2005
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    this is something I found on the internet that is supposed to allow me to make emails using a form, but something is going horribly wrong as it doesnt make the email. Can someone please check it out and tell me what is the problem.

    Please and thank you.
     

    Attached Files:

  2. dalem

    dalem Well-Known Member
    PartnerNOC

    Joined:
    Oct 24, 2003
    Messages:
    2,577
    Likes Received:
    40
    Trophy Points:
    48
    Location:
    SLC
    cPanel Access Level:
    DataCenter Provider
    could not tell you as it works just fine :confused:

    check your config file
     
  3. ipab

    ipab Member

    Joined:
    Oct 27, 2005
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    it reports that it has made the email, but when one accesses the mail accounts in cpanel the usrname isnt there.
     
  4. fwwebs

    fwwebs Well-Known Member

    Joined:
    Feb 16, 2004
    Messages:
    329
    Likes Received:
    0
    Trophy Points:
    16
    Set $debug=1; in the config.php to see the output.

    Check out the cP Account Creator script at http://scripts.freemans-web.com. The script you're using has some of the same code as the earlier versions of cP Account Creator. The later versions have checks for duplicate entries and many more functions.
     
  5. ipab

    ipab Member

    Joined:
    Oct 27, 2005
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    PHP:
    <?

    $host="mad-skinning.net";//your url
    $domain="mad-skinning.net";//your domain without the www

    //Cpanel options:
    $cpaneluser="blah";//your cpanel username
    $cpanelpass="blah2";//your cpanel password
    $cpaneltheme="x2"//this is the word after frontend/ and the next / when you login to cpanel
    $port="2083"//this is the cpanel port

    //Database options:
    $dbhost="localhost"//Usually localhost
    $dbuser="blah_mail";//mysql username
    $dbpass="mailtesties";//mysql password

    $dbname="blah_mail";//The name of the database for mail
    $dbusertbl="mailusers";//Name of the table for users
    $dbadmintbl="mailadmin";//name of the table for admin


    $quota="120";//how much space in kb you want to give the user
    $mailurl="mail/index.php";//The url for your web based mail program
    ?>
    PHP:
    <?php
    include("config.php");
    if(isset(
    $newuser))
    {
    $newemail "$newuser@$domain";
    $mpassword $password2;

    $link mysql_connect($dbhost$dbuser$dbpass);
    mysql_select_db($dbname) or die("Could not select database");
    $query="SELECT username FROM $dbusertbl WHERE((username = '$newuser'))";
    $resultmysql_query($query,$link);
    if(
    mysql_num_rows($result) == 0)
    {
    $query="INSERT INTO $dbusertbl(name,username,password,email) VALUES ('$name','$newuser','$password1','$replymail');";
    mysql_query($query,$link);
    $socket fsockopen($host,$port);
    $authstr "$cpaneluser:$cpanelpass";
    $pass base64_encode($authstr);
    $in "GET /frontend/$cpaneltheme/mail/doaddpop.html?email=$newemail&domain=$domain&password=$mpassword&quota=$quota\r\n HTTP/1.0\r\nAuthorization: Basic $pass \r\n";
    fputs($socket,$in);
    fclose$socket );
    ?> Your account has been setup successfully please login <a href="mail/index.php">here</a>
    <?
    }
    else {
    echo "Username already in use please try another one.<br><a href=signup.php>Back</a>";
    }
    mysql_close($link);
    }

    else { ?>
    <form name="orderform" method="post" action="signup.php">
    <table border="0" cellspacing="1" cellpadding="0">
    <tr>
    <td>Your full Name:</td>
    <td colspan="2"><input name="name" type="text"></td>
    </tr>
    <tr>
    <td width="147">Other Email Address:</td>
    <td colspan="2"><input name="replymail" type="text">
    (In case you forget your password)</td>
    </tr>
    <tr>
    <td>Prefered Email Address:</td>
    <td colspan="2"><input name="newuser" type="text">
    @<? echo($domain) ?></td>
    </tr>
    <tr>
    <td>Password:</td>
    <td colspan="2"><input name="password1" type="password"></td>
    </tr>
    <tr>
    <td>Retype Password:</td>
    <td colspan="2"><input name="password2" 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.orderform.replymail))
    {
    if(document.orderform.password1.value == document.orderform.password2.value)
    {
    document.orderform.submit();
    }
    else
    {
    alert("The passwords you typed do not appear to match");
    }
    }
    }

    function checkEmailAddress(field) {
    var good;
    var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.go v)|(\.org)|(\..{2,2}))$)\b/gi);

    if (goodEmail){
    good = true
    } else {
    alert('Please enter a valid e-mail address.')
    field.focus()
    field.select()
    good = false
    }
    return good;
    }

    </script>
    </form>

    <? } ?>

    can someone please check this over as it doesn't work for me. (i found this code on the forums)

    the mysql query works, but no user is added to the pop, no errors are shown either.
     
  6. ipab

    ipab Member

    Joined:
    Oct 27, 2005
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    anyone? Any help would be appreciated, perhaps even testing it on your server.
     
  7. dalem

    dalem Well-Known Member
    PartnerNOC

    Joined:
    Oct 24, 2003
    Messages:
    2,577
    Likes Received:
    40
    Trophy Points:
    48
    Location:
    SLC
    cPanel Access Level:
    DataCenter Provider
    I all ready tested it on my server it works just fine

    try switching themes (i used the x theme)
     

Share This Page