create addon to whm with php now

aoc

Member
Nov 9, 2004
9
0
151
hi there,

this post is for php, perl or C programers, that they can create new script and add command link in WHM menu and work as root.

i'll give you an example now, i don't like to talk alot with security matters, there is no security problems because your scripts will work as root and you can't work with it until you log into WHM http://yourserver:2086/ or the ssl link.

let's begin:

first step use SSH to login as root

type this commands

# cd /usr/local/cpanel/whostmgr/docroot/cgi
# mkdir example
# chmod 0755 example

i'll use pico text editor
we will create a file under /usr/local/cpanel/whostmgr/docroot/cgi
called addon_example.cgi

this file will called from WHM menu and will redirect to our example directory

# pico addon_example.cgi

pico will open

copy and paste this code in it

Code:
#!/usr/local/bin/perl

#WHMADDON:example:Example WHM Admin

print "Content-Type: text/html\n\n";
print '<meta http-equiv="refresh" content="0;url=/cgi/example/example.php"/>' ;
and click <Ctrl+O> and <Ctrl+X>

now do this commands

# chmod 0755 addon_example.cgi
# cd example
# pico example.php

now type any php code inside or just text

use this for example

Code:
My Script Is Working
now save the file and exit click <Ctrl+O> and <Ctrl+X>

go to your site whm panel
http//yourserver:2086 or https://yourserver:2087

after login as root to whm scroll the left menu to the last one :)
yes it's the script Example

click it

i hope this start will make programmers do amazing addons for whm

regards
 
Last edited:

aoc

Member
Nov 9, 2004
9
0
151
for Advance use

you can create support script uses can use www script like http://yourdomain/support/

and you can use a database for that you can create complete script that they can post support tickets from the site and stored in a database

and as a root you can connect to it using your own script to manage this tickets inside WHM.


about Accounting.php.inc

here you can include it to your script without any problem for permissions

it's easy to be working inside WHM..

your script not conflect with athor whm you can use your own script connecting to database you can add google inside it :>

its work like iframe

waiting for your addons
 

brianoz

Well-Known Member
Mar 13, 2004
1,146
7
168
Melbourne, Australia
cPanel Access Level
Root Administrator
There's a related extensive tutorial covering adding internal WHM functions, not the same as this (which is about making WHM addons which can be used directly from the WHM user interface) available here:

http://forums.cpanel.net/showthread.php?t=46362 (it's a sticky)