Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Custom WHM Addon

hello world

  • Please log in to reply
2 replies to this topic

#1 phpforfun

phpforfun

    Speaks fluent binary

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1056 posts

Posted 12 January 2009 - 12:12 PM

Here is my example of the Hello World WHM Addon for the admins and resellers.

Its easy! Simply make a CGI Script, name it addon_Hello_World.cgi

Upload it here: /usr/local/cpanel/whostmgr/docroot/cgi/

Here is the code to put in it
#!/usr/bin/perl
#WHMADDON:helloworld:Hello World, by <b>Justin</b>
###############################################################################
# This is an example hello world WHM plugin feel free to modify it as you see fit
###############################################################################
# Load general use case perl modules
use lib '/usr/local/cpanel';
use Cpanel::cPanelFunctions ();
use Cpanel::Form ();
use Cpanel::Config ();
use Whostmgr::HTMLInterface ();
use Whostmgr::ACLS ();
###############################################################################

print "Content-type: text/html\r\n\r\n";

# Check user has root permissions
Whostmgr::ACLS::init_acls();
if ( !Whostmgr::ACLS::hasroot() ) {
# User is not root, tell them where to go
print "You need to be root to see execute this script.\n";
exit();
}

# Parse input parameters from GET and POST into $FORM{} for later use
my %FORM = Cpanel::Form::parseform();

# Print a WHM Header
Whostmgr::HTMLInterface::defheader( "Custom Addon Hello World",'/path/to/logo.gif', '/cgi/addon_Hello_World.cgi' );

# Print General Output
print "This is the hello world addon, you can also put a meta refresh tag in here to forward to a php page, make sure its chmod and chowned to the right permissions!";

# End Example

1;

I will post one on how to make a cpanel addon when I learn
  • 0

#2 Grub

Grub

    CC Resident

  • Just Joined
  • PipPipPipPip
  • 55 posts

Posted 15 January 2009 - 04:04 PM

What language is this in?
  • 0

#3 imported_Affix

imported_Affix

    CC Newcomer

  • Just Joined
  • PipPip
  • 11 posts

Posted 25 February 2009 - 01:22 PM

What language is this in?



its written in perl
  • 0





Also tagged with one or more of these keywords: hello world

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download