WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : cPanel Subdomains Creator - Create cPanel subdomains without logging into cPanel. Let your visitors create their own subdomains without your intervention. Moreover, it will inform if a subdomain is already exists.
Categories : PHP, Web Services, PHP Classes Click here to Update Your Picture
Md. Zakir Hossain
Date : Nov 27th 2006
Grade : 5 of 5 (graded 2 times)
Viewed : 11649
File : 4542.zip
Images : Image 1
Search : More code by Md. Zakir Hossain
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
Like this code?
Show the author your appreciation.
 

cpsubdomain Class
<?php
/*

Class Name: cpsubdomain
Clas Title: cPanel Subdomains Creator
Purpose: Create cPanel subdomains without logging into cPanel.
Version: 1.0
Author: Md. Zakir Hossain (Raju)
URL: http://www.rajuru.xenexbd.com

Company: Xenex Web Solutions
URL: http://www.xenexbd.com

License: LGPL
You can freely use, modify, distribute this script. But a credit line is appreciated.

Installation:
see example.php for details

Compatibility: PHP4
*/

//definding main class
class cpsubdomain{
 
//declare public variables
 
var $cpuser;    // cPanel username
 
var $cppass;        // cPanel password
 
var $cpdomain;      // cPanel domain or IP
 
var $cpskin;        // cPanel skin. Mostly x or x2.
 
  //defining constructor
 
function cpsubdomain($cpuser,$cppass,$cpdomain,$cpskin='x'){
   
$this->cpuser=$cpuser;
   
$this->cppass=$cppass;
   
$this->cpdomain=$cpdomain;
   
$this->cpskin=$cpskin;
   
// See following URL to know how to determine your cPanel skin
    // http://www.zubrag.com/articles/determine-cpanel-skin.php
 
}
 

 
//function for creating subdomain
 
 
function createSD($esubdomain){
     
//checking whether the subdomain is exists
     
$subdomain=$esubdomain.".".$this->cpdomain;
     
$path="http://".$this->cpuser.":".$this->cppass."@".$this->cpdomain.":2082/frontend/".$this->cpskin."/subdomain/index.html";
   
$f = fopen($path,"r");
    if (!
$f) {
      return(
'Can\'t open cPanel');
    }

   
//check if the account exists
   
while (!feof ($f)) {
     
$line = fgets ($f, 1024);
      if (
ereg ($subdomain, $line, $out)) {
        return(
'Such subdomain already exists.');
      }
    }
   
fclose($f); //close the file resource
   
   
    //subdomain does not already exist. So proceed to creating it
   
$path="http://".$this->cpuser.":".$this->cppass."@".$this->cpdomain.":2082/frontend/".$this->cpskin."/subdomain/doadddomain.html?domain=".$esubdomain."&rootdomain=".$this->cpdomain;
   
$f = fopen($path,"r");
    if (!
$f) {
      return(
'Can\'t open cPanel.');
    }

   
//check if the subdomain added
   
while (!feof ($f)) {
     
$line = fgets ($f, 1024);
      if (
ereg ("has been added.", $line, $out)) {
        return(
'Subdomain created successfully');
      }
    }
   
fclose($f); //close the file resource
    //return success message
   
return "There may be some error while creating subdomain.";
   
}
}

?>



Usage Example
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>cPanel Subdomain Creator</title>
</head>
<body>
<p><b><font size="5">Cpanel Subdomain Creator</font></b></p>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">

    <table border="0" width="52%" style="border-collapse: collapse">
        <tr>
            <td colspan="2">
            <p align="left"><b>Create Sub-domain:</b></td>
        </tr>
        <tr>
            <td width="78" style="text-align: right">
            Sub-domain:</td>
            <td>
            <input type="text" name="esubdomain" size="20" style="width: 166px"></td>
        </tr>
        <tr>
            <td width="78"> </td>
            <td>
            <input type="submit" value="Create New Subdomain" name="create" style="width: 165px"></td>
        </tr>
    </table>
</form>
<p> </p>
<?php
if(isset($_POST['create'])){

//include class file
require_once('class.php');

/*
  instanceiate class & pass three arguments cpanelusername, cpanelpassword,yourdomainname,cpanelskin
*/


$cpanel=new cpsubdomain("cpusername","cppass","yourname.com","x");
//cpanel username, cpanel password, domain name, cpanel theme
//cpanel theme may be 'x', 'rvblue' etc.
/*
   See following URL to know how to determine your cPanel skin
  http://www.zubrag.com/articles/determine-cpanel-skin.php
  if you don't pass cpanelskin argument, default will be x. Thanks to this website.
*/
 
//call create function and you have to pass subdomain parameter

echo $cpanel->createSD($_POST['esubdomain']);
}
?>
</body>
</html>



Freshmeat.net XML-RPC - This class is meant to query Freshmeat for information about registered projects.
Categories : PHP, PHP Classes, XML, Web Services
file class , uploade file , download file already uploaded on another website
Categories : PHP, PHP Classes, Filesystem, Web Services
cPanel Email Accounts Creator
Categories : PHP, PHP Classes, Email, Form Processing, Web Services
A class for sending email; it has support for To:, Cc:, Bcc: and Reply-To: headers. It requires that you have sendmail installed.
Categories : Email, PHP Classes, PHP
Image Cache
Categories : Graphics, PHP Classes, PHP
Three Cool Classes and One Trick
Categories : PHP, PHP Classes, Graphics, Email
ADODB Database Wrapper Abstraction Library for PHP: MySQL, MSSQL, Oracle, Interbase,ODBC, Microsoft Access and FoxPro.
Categories : PHP Classes, Databases, PHP, General SQL, ODBC
This class splits the results of the query into multiple pages like what the search engine does.
Categories : PHP Classes, PHP, MySQL, Databases
logger class (PHP5 +)
Categories : PHP, PHP Classes, Log Files, XML
Automatic generation of HTML code for a table. OO interface. Can define colspan, rowspan, table style, cell style, and data style. Simple, but effective.
Categories : PHP, PHP Classes, HTML, HTML and PHP
PHP MIME Decoder. This class decodes Mime Encoded email message. Attachments are stored in a director. Works with Multipart/alternative, multipart/mixed etc. see http://p3mail.com for example.
Categories : PHP, PHP Classes, Email
Mssql database Manager
Categories : PHP, Databases, MS SQL Server, Classes and Objects, PHP Classes
Ajax PHP Tree (Left and Right) with MySQL
Categories : PHP, Databases, MySQL, AJAX, PHP Classes
Search and Replace Text : Searches Files for Specified Text and Replaces It by a Given Text
Categories : PHP, PHP Classes, Search, Filesystem
HTML_Graphs uses PHP to provide a consistent interface for creating HTML based charts. The user of the class sets up arrays that are passed to html_graph() which then takes care of all the messy HTML layout.
Categories : Graphics, Arrays, PHP, PHP Classes, Charts and Graphs