Plugin writing problems and Questions

fusionictnl

Verified User
Joined
Jun 22, 2004
Messages
1,029
Location
Netherlands
I've created a plugin for Awstats in DA.

It's name shows up as "Hello World" in the CP, but under Plugin Manager it says "AwStats", a bug ???

http://www.directadmin.com/forum/showthread.php?s=&threadid=3901

I have 2 questions about creating a plugin:

1:
When I make a submit form and do a submit. The url shows up correctly CMD_PLUGIN...... ?var=variable, but I can't get the values with PHP as $_POST["var"] or $_ENV["var"] or $_GET["var"], how can I get these posted vars ???

2:
Can a plugin communicate with the CP ? Without letting the user know the plugin what it's usr/pass is ? (Plugins are started as a seperate process?)
Or does some enviroment variable contain the password?? I can get the username but not the password!

I would really like these questions answered so I can expand my plugin to contain extra features for AwStats with DA.

Thx!!
 
I got the answer on my first question :)

Variables can be find in: $_SERVER["QUERY_STRING"];

But the second question :confused:
 
Hello,
fusionictnl said:
2:
Can a plugin communicate with the CP ? Without letting the user know the plugin what it's usr/pass is ? (Plugins are started as a seperate process?)
Or does some enviroment variable contain the password?? I can get the username but not the password!
For Installatron, I use this class to communicate with the DA API. You'll automatically be "logged-in" as the current user.

Phi1.
 
I.e.:
PHP:
$Socket = new HTTPSocket;
$Socket->connect('127.0.0.1',2222);
$Socket->set_login($_SERVER['USER']);

$Socket->query('/CMD_API_SHOW_DOMAINS');
$query_result = $Socket->fetch_parsed_body();

print_r($query_result);
 
Your answer appears to be in the hooks directory. Modify the links before creating your tar.gz file and update your plugin on your hosting server.


oops, posted and then saw you found your own answer.
 
Back
Top