angelfire Posted September 6, 2008 Share Posted September 6, 2008 THIS IS URGENT SOMEONE HELP ME OUT HERE!! I PREVIOUSLY POSTED A DAY AGO ON A DIFFRENT FORUMS SITE AND GOT NO RESPONSE! Can some one help me out!! i found this free sub domain + ftp user creation script on the internet so i tested it out, It created the sub domain part then gave me this error when attempting to create the ftp user account "Subdomain created successfully There may be some error while creating FTP account." (what does that mean i tried logging into the ftp account and i couldn't)? yes it did create the ftp account but i dont kno the password i inputed my desired password but it didn't register that? I have the script code if you want to look at it Code for index.php <?php /* This is the example script for cpsubdomain class */ ?> <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 style="text-align: right; width: 92px;"> Sub-domain:</td> <td> <input type="text" name="subdomain" size="20" style="width: 166px"></td> </tr> <tr> <td style="width: 92px">FTP Password</td> <td> <input type="text" name="ftppass" size="20" style="width: 166px"></td> </tr> <tr> <td style="width: 92px"></td> <td> <input type="submit" value="Create New Subdomain" name="create" style="width: 165px"></td> </tr> </table> </form> <?php if(isset($_POST['create'])){ //you can implement some security measure to ensure that the form is submitted from your domain //include class file require_once('class.php'); /* instanciate class & pass three arguments cpanelusername, cpanelpassword,yourdomainname,cpanelskin */ $cpanel=new cpsubdomain("my_user","my_pass","my_site","rvblue"); //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['subdomain']); echo '<br/>'; //call createFTP method and provide params ftp username,ftp password, quota. //if quota is not passed or blank, default is 20MB echo $cpanel->createFTP($_POST['subdomain'],$_POST['ftppass'],"20"); } ?> </body> </html> Code for class.php <?php //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; } //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. Subdomain Creation aborted.'); } } 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."; } //end of function function createFTP($ftpuser,$ftppass,$ftpquota=20) { //login=testing&password=12345"a=20&homedir=testing //for security purpose, I set homedirectory to the same name of ftpuser //if you want to provide access to root directory, set $homedir="/" $params="login=$ftpuser&password=$ftppass"a=$ftpquota&homedir=$ftpuser"; //checking whether the subdomain is exists $ftp=$ftpuser."@".$this->cpdomain; $path="http://".$this->cpuser.":".$this->cppass."@".$this->cpdomain.":2082/frontend/".$this->cpskin."/ftp/accounts.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 ($ftp, $line, $out)) { return('Such FTP account already exists. FTP Creation aborted.'); } } fclose($f); //close the file resource //not duplicate FTP account, so proceed to creating it $path="http://".$this->cpuser.":".$this->cppass."@".$this->cpdomain.":2082/frontend/".$this->cpskin."/ftp/doaddftp.html?$params"; $f = fopen($path,"r"); if (!$f) { return('Can\'t open cPanel.'); } //check if the FTP account added while (!feof ($f)) { $line = fgets ($f, 1024); if (ereg ("was sucessfully created", $line, $out)) { return('The FTP account was created successfully'); } } fclose($f); //close the file resource //return success message return "There may be some error while creating FTP account."; }//end of createFTP function } ?> Link to comment https://forums.phpfreaks.com/topic/123057-please-respond-i-so-freakin-want-to-host-people-asap/ Share on other sites More sharing options...
BlueSkyIS Posted September 6, 2008 Share Posted September 6, 2008 if you're planning on hosting websites by downloading and installing free scripts on your server, yet you have no programming experience, you are asking for a pile of headaches. if i were you and i wanted to set up my dedicated server to provide hosting, i would look into CPanel/WHM, preferably a hosting company that can provide a dedicated server with CPanel/WHM already installed. one: superb.net Link to comment https://forums.phpfreaks.com/topic/123057-please-respond-i-so-freakin-want-to-host-people-asap/#findComment-635471 Share on other sites More sharing options...
angelfire Posted September 7, 2008 Author Share Posted September 7, 2008 i already have a dedicated server the reason why im asking is because i have to manually go into my cpanel create the ftp and then go and create the subdomain all by hand no fun! this script is suppost to do that automatic i just send them to this script and they will be able to decide what they want to name there subdomain. just wish the script would work cause i have tested it. Link to comment https://forums.phpfreaks.com/topic/123057-please-respond-i-so-freakin-want-to-host-people-asap/#findComment-635658 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.