PDA

View Full Version : Auto User Creation


Gadget
09-03-2003, 07:00 AM
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.

l0rdphi1
09-03-2003, 08:55 AM
Yes, you can. Check out the new create account API function (http://www.directadmin.com/features.php?id=167) (which accepts data the same as the old create account method (http://www.directadmin.com/api.html#create)) and my PHP class for communicating with DA (http://www.directadmin.com/forum/showthread.php?s=&threadid=258).

l0rdphi1
09-03-2003, 09:20 AM
Here. :D

<?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

$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 (http://www.l0rdphi1.com/tools/httpsocket/httpgetsocket.phps) to continue in this fashion*

DirectAdmin Support
09-03-2003, 09:27 AM
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

wwwtactics
09-10-2003, 01:34 PM
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 !

DirectAdmin Support
09-10-2003, 02:50 PM
Hello,

Check out http://www.directadmin.com/forum/showthread.php?s=&threadid=258... I'm not sure how much simpler it can get.

John

wwwtactics
09-10-2003, 05:25 PM
thanks but this doesn't seem to work for me, what a pitty.
thanks anywhat.
william !

l0rdphi1
09-11-2003, 06:40 AM
We are here to help if you want to tell us what is not working :)

wwwtactics
10-02-2003, 02:34 AM
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:password@esecuresite3.com: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:password@esecuresite3.com: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:password@esecuresite3.com: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 !

l0rdphi1
10-02-2003, 05:53 AM
I don't think you can login like that anymore. The session system doesn't allow for it.

Check out

dbarton
12-19-2003, 08:28 PM
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.

DirectAdmin Support
12-20-2003, 02:44 PM
Hello,

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

John

l0rdphi1
12-20-2003, 10:43 PM
You'll also want to be using $sock->query("/CMD_API_ACCOUNT_USER","bahblahblah"); I do believe