Auto User Creation

Gadget

Verified User
Joined
Jun 16, 2003
Messages
50
Location
Alabama, USA
Ok, here is the situation. I use paypal for users to buy my services. I have an IPN script that directs the user to a certain page based on if the payment meets specific requirements (or will be as soon as I can get it up). Is there a way I can use PHP maybe to store values on the paypal form (before you get to the actual paypal page where you submit payment) and use them on the successpayment page to automatically create the user's account using API? I know I have asked a lot of questions here, but im new to a lot of these things and you guys all seem like experts.
 
Last edited:
Here. :D

PHP:
<?php

$obj->request("/CMD_ACCOUNT_USER?username=<username>&email=<email>&passwd=<password>"
	."&passwd2=<password>&domain=<primary_domain>&bandwidth=<megs_bandwidth>"
	."&quota=<megs_storage>&uvdomains=ON&unsubdomains=ON&unemails=ON&unemailf=ON"
	."&unemailml=ON&unemailr=ON&umysql=ON&udomainptr=ON&uftp=ON&aftp=ON&cgi=ON&ssl=ON"
	."&suspend_at_limit=ON&skin=<skin>&ip=<server_ip>&add=Submit&action=create");

?>
That's what I use to create actual accounts right now. It works great, however, it does need coverted over to the new CMP_API_CREATE_ACCOUNT method.

I think the below will work with the CMD_API (untested):

PHP:
<?php

$obj->request("/CMD_API_ACCOUNT_USER?username=<username>&email=<email>&passwd=<password>"
	."&passwd2=<password>&domain=<primary_domain>&bandwidth=<megs_bandwidth>"
	."&quota=<megs_storage>&uvdomains=ON&unsubdomains=ON&unemails=ON&unemailf=ON"
	."&unemailml=ON&unemailr=ON&umysql=ON&udomainptr=ON&uftp=ON&aftp=ON&cgi=ON&ssl=ON"
	."&suspend_at_limit=ON&skin=<skin>&ip=<server_ip>&add=Submit&action=create");

$result = $obj->array_last_parsed();

if ($result[error]) {

	echo "Woo. There was an error.<p>$result[details]";

	exit;
}

echo $result[text];

?>
Note: Rememer to replace my <blah> tags with actual values/variables. :p

*Note: This example uses the version 1.xx of the communication class; you need the wrapper to continue in this fashion*
 
Last edited:
Yes, the CMD_API_ACCOUNT_* commands are exact copies of the regular verions... the only difference is the output it generates, which is nicer to parse.

John
 
a php script to creat account that work pleas

Is there anyone here that can give a real script with a minimum of explanation ??

if yes don't be shy just help, the help on the api is not clear at all, and no exemple can be found, is there any documentation out there ?

thanks
william !
 
automatic member creation

thanks but this doesn't seem to work for me, what a pitty.
thanks anywhat.
william !
 
What doesn't work for me

Hi,

What Does not work for this URL creation.

Whatever I do

1-Using this URL in a browser to create a member shows me the login page

http://login:[email protected]:2222/CMD_ACCOUNT_USER?username=$ndd&email=$alm_email&passwd=pass1234&passwd2=pass1234&domain=$primary_domain&package=aleapay&notify=yes&ip=66.98.138.15&add=Submit&action=create

2-Using this URL in a fsock results in an error
http://login:[email protected]:2222/CMD_ACCOUNT_USER?username=$ndd&email=$alm_email&passwd=pass1234&passwd2=pass1234&domain=$primary_domain&package=aleapay&notify=yes&ip=66.98.138.15&add=Submit&action=create

The only possibility is to
a ) connect to my admin account
http://esecuresite3.com:2222
login
password

b ) copy the URL in the same browser and the accounts are created, but doing this way means that it is not automatic at all.
http://login:[email protected]:2222/CMD_ACCOUNT_USER?username=$ndd&email=$alm_email&passwd=pass1234&passwd2=pass1234&domain=$primary_domain&package=aleapay&notify=yes&ip=66.98.138.15&add=Submit&action=create

So I don't understand why it works for everyone and not for me.
:confused:

thanks
william !
 
Doesn't work

I tried that script for 2.0 for account creations, seems it doesn't work correctly. For result, I keep getting Array, and yes I'm using CMD_API_ACCOUNT_USER. I use $sock->query("/CMD_API_ACCOUNT_USER?bahblahblah");

However, I've tried this remotely, to see if it blocks local connections, and it cannot even establish a connection remotely. I have no other idea on what to do.
 
Hello,

Does it connect at all? try:
Code:
telnet localhost 2222
# or
telnet 1.2.3.4 2222
and then press enter 3 times if it connects..

John
 
Re: Doesn't work

You'll also want to be using
Code:
$sock->query("/CMD_API_ACCOUNT_USER","bahblahblah");
I do believe
 
Automatic user creation

Hello, I want to automate the user creation procces using the signup forms I use for new customers signing up for a hosting account.

I have found the PHP classes with user_create forms in them.
This seems very prommissing, but I keep getting the message that the password is not correct.

Now, I know that the password is correct, because i checked it. Also all other settings in the config.php file are correct...
But, for some reason all the forms from this php class have a problems with my admin password.

"Failed to add new user: Cannot Create Account
Invalid Password"

Can anybody help me?
 
The password is not syntactically allowed by DA, for whatever reason.
Try a simpler password to give the user. (it's not your existing DA account password that DA is talking about)

Or if you've enabled the difficult password checking, then you'd have to satisfy that.

John
 
Thanks for your reply. I tried a lot of different passwords, simple and hard, but none are accepted.

I did not enable the difficult passoword thingy, I'm not realy in to the API yet.
All I am able to do is copy and past php classes that do the job for me.
This is why I need that class to work...

Any other suggestions to what I could do?
 
I checked the sample with the code I got in the 'da-api php class' package and it's all there. It's just a little bit diffirent

Code:
<?php

$username 	= $_POST[username];
$email 		= $_POST[email];
$passwd 	= $_POST[password1];
$passwd2 	= $_POST[password2];
$domain 	= $_POST[domain];
$package 	= $_POST[package];
$notify 	= $_POST[notify];

include '../config/config.php';
include '../protocol/httpsocket.php';
$Socket = new HTTPSocket;

$Socket->connect($siteurl,$siteport);
$Socket->set_login($adminusername,$adminpassword);
// {admin_username} and {admin_password} are not specifically your administrative DA user,
// but rather the user that you want to own this new user.

$Socket->query('/CMD_API_ACCOUNT_USER',
    array(
        'username' => $username, // The User's username. 4-8 characters, alphanumeric
        'email' => $email, // A valid email address
        'passwd' => $password1, // The User's password. 5+ characters, ascii
        'passwd2' => $password2, // Password double check. 5+ characters, ascii
        'domain' => $domain, // A valid domain name in the form: domain.com
        'package' => $package, // One of the User packages created by the Reseller
        'ip' => $ipaddress, // One of the ips which is available for user creation. Only free or shared ips are allowed.
        'notify' => $notify, // yes or no. If yes, an email will be sent to email
        'action' => 'create',
        'add' => 'Submit'
    ));
$result = $Socket->fetch_parsed_body();

if ( $Socket->get_status_code() != 200 || !empty($result['error']) )
{
    // failure.
    echo "Failed to add new user: {$result['text']}<br />{$result['details']}";
} else {
    // new user added.
    print_r('User '.$username.' created...');
}


?>

Then I pasted the code of your sample in a file on my server and tried if it actually is working... Unfortunatily, I got the following order trying:
"Fatal error: Class 'HTTPSocket' not found in graphicscompany.net/public_html/php/forms/sample.php on line 21"
 
Last edited:
Back
Top