Problem with add new email account to the DA

M.a.T.a.N

New member
Joined
Mar 25, 2011
Messages
12
Hellow, at last time I start to be involved with API in DA.
I try to find a php script that add a new email account to my DA.
Anyway I search anywhere from anywhere, and that what i found.

First, I have a file that called that name httpsocket.php, that the file http://files.directadmin.com/services/all/httpsocket/httpsocket.php

I have second file that just called the above file (httpsocket.php), and this is the source:
PHP:
<?

$server_ip="myipaddress";
$server_login="myusername";
$server_pass="mypasswd";
$server_ssl="N";


$username=$_POST['username'];
$domain=$_POST['domain'];
$email=$_POST['email'];
$pass=$_POST['pass'];
$package=$_POST['package'];


if (isset($_POST['action']) && $_POST['action'] == "add")
{

echo "Creating user $username on server $server_ip.... <br>\n";
include 'httpsocket.php';  
 $sock = new HTTPSocket;
 if ($server_ssl == 'Y')
 {
  $sock->connect("ssl://".$server_ip, 2222);
 }
 else
 { 
  $sock->connect($server_ip, 2222);
 }
 
 $sock->set_login($server_login,$server_pass);
 
 $sock->query('/CMD_API_POP',
     array(
  'action' => 'create',
  'domain' => $domain,  
  'user' => $username,
  'passwd' => $pass,
  'quota' => $package
     ));
 
 $result = $sock->fetch_parsed_body();
 
 if ($result['error'] != "0")
 {
  echo "<b>Error Creating user $username on server $server_ip:<br>\n";
  echo $result['text']."<br>\n";
  echo $result['details']."<br></b>\n";
 }
 else
 {
  echo "User $username created on server $server_ip<br>\n";
 }

 exit;
}

?>


<form action="?" method="POST">
<input type=hidden name=action value="add">
Username: <input type=text name=username><br>
Domain:<input type=text name=domain><br>
Pass: <input type=password name=pass><br>
Packge: <input type=text name=package><br>
<input type="submit" name="submit" value="send" />
</form>

Anyway I try to do anything, like give "777" arttibute permission, change some text in the script and search in any forum and in google.
Of courseג that I set the real parameters in the variables that need the detail.

I really need a simple sample script that add a new email account.
Thank you very much!
 
its dont give me a problem, its just dont give me any result.
I run this script couple times and its dont open me email account.
a
i thougt that script should open a new email account.
 
It is dont change anything, its just write "Creating user here comes my user on server here comes my domain...." like before.

there is no result.
Please I need any script that work and could open me a new email account!

Thank's!
 
Soory, I dont understand.
do I need to change the file "httpsocket.php" to "pop_create.php"?
or the other file (index.php) to "pop_create.php"?

and after I downloaded the file you give me, what name I called him?

if I try to get from browesr to file "pop_create.php" and the "pop_create.php" its the "httpsocket.php" file, I get this error.

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request bestempemail.com
Error 500.

But I dont think its what you want me to do...
 
In your first Post#1, you wrote

I have second file that just called the above file (httpsocket.php), and this is the source:

and below comes its content.

Is it a mistake? Or the code, you've posted there in the Post#1, is the source of the file called httpsocket.php?

If the code is in the file with name httpsocket.php — that's the problem. So you need to rename it and get original httpsocket.php.
 
No, the file that I wrote his code here called name "index.php",
and I have second file, the same file you give me in link called name "httpsocket.php".

Anyway, I dont have 2 files with thw same name if its what you thougt, so it is not the problem :(
 
1. Ensure you've got correct and valid data in here:

PHP:
$server_ip="myipaddress"; 
$server_login="myusername"; 
$server_pass="mypasswd"; 
$server_ssl="N";

If everything is good here, then

2. Change

PHP:
$result = $sock->fetch_parsed_body();

with

PHP:
var_dump($sock);
$result = $sock->fetch_parsed_body();
var_dump($result);


var_dump() would show some debugging information. Without that I'm out of ideas.
 
That would not make the code working. It's a way to learn some more information, so called debugging info. Why don't you post here the output? Without that, I won't help you.
 
About error 500 check with apache error log for that domain.

About the first issue, something is really messed up. So, without FTP access, there is nothing I can do for you. Send me a PM if you need more help.
 
ohhh Yea~!!!
its just got work, I just needed to define it with ssl !

thank you for your support!!
 
Back
Top