trappedatuf Posted August 19, 2008 Share Posted August 19, 2008 I did a search but couldn't find anything on how to upload an index.htm file that has a "Coming Soon" message for a newly created account. I am new to WHMCS and it's awesome so far, just need to tweak it to meet my exact needs and work like my old system. My old system used to write out an index.htm file specific for that domain (said something like "blahblah.com is coming soon) and then upload it to the account automatically, that's the writeWelcomeIndexPage() function in the code below. Here's the code I used to use: // UPLOAD INITIAL HTML FILES (COMING SOON PAGE) // =============================================================================== if ($extraControl != "NO_UPLOAD_HTML") { echof("<p><B>Configuring welcome page files (Step 4/7)...</B>"); $ftp_server = "XXX.XXX.XXX.XXX"; // IP Address of my WHM/cPanel server $ftp_user_name = $acctuser; $ftp_user_pass = $acctpass; $www_dir = "public_html"; $source_file1 = "index.htm"; $destination_file1 = "index.htm"; $source_file2 = "coming_soon_logo.gif"; $destination_file2 = "coming_soon_logo.gif"; $conn_id = ftp_connect($ftp_server); // set up basic connection $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // login with username and password // check connection if ((!$conn_id) || (!$login_result)) { echof("<BR> - FTP connection has failed!"); write2log("Error: FTP connection failed. Server: $ftp_server Username: $ftp_user_name\n");} else { echof("<BR> - Connected to $ftp_server, username: $ftp_user_name"); } // try to change the directory to public_html if (ftp_chdir($conn_id, $www_dir)) { echof("<BR> - Current directory is now: $www_dir"); } else { echof("<BR> - Error in chdir to public_html\n"); write2log("Error: Changing directories to public_html\n");} writeWelcomeIndexPage("index.htm", $acctdomain); // write new welcome index file for the domain $upload = ftp_put($conn_id, $destination_file1, $source_file1, FTP_BINARY); // upload files $upload = ftp_put($conn_id, $destination_file2, $source_file2, FTP_BINARY); // check upload status if (!$upload) { echof("<BR> - Domain park page not written correctly."); write2log("Upload unsuccessful\n");} else { echof("<BR> - Domain park pages successfully installed."); write2log("Success in uploading initial HTML files.\n");} ftp_close($conn_id); // close the FTP stream } else { echof("<p><B>Configuring welcome page files (SKIPPED Step 4/7)...</B>"); } So that's the code I was using. Now after searching on the forums here, I found that in the file actionhooks.php has a function I can use function actionhook_AfterModuleCreate($vars) to call my custom code. I just need to know what variables I should use to get the newly created username/password to put in for $ftp_user_name, and $ftp_user_pass. Can someone let me know how to "WHMCS-alize" this code so I can have the new coming soon page be auto-uploaded upon new account creation. Thanks! 0 Quote Link to comment Share on other sites More sharing options...
mobile Posted August 19, 2008 Share Posted August 19, 2008 We use the built in feauture in WHM. We use that because even if we were to recreate the account manually, the index page will be automatically created. Steps I take are below: In the Skeleton Directory is where you would install a basic index.html page that would be installed on all new domains after you have installed them - automatically. If you want to use this feature, you must first click on this link to create the cpanel3-skel directory on your reseller domain. 1 - Create a simple index.html page - Hosted by ______________________ or something a little more feature rich. If you are using images, host the images somewhere else and use full url links to the images IMG SRC="http://yourdomain.com/images/welcome.gif". 2 - FTP into your main domain and open the /cpanel3-skel folder. Then open the /public_html folder. 3 - Upload your basic index.html page into this folder. THAT'S IT! Everytime you install an account, this index page will be installed onto that domain. Once the domain resolves, your page will be seen. The user can delete or replace them at their own desire. Hope this helps, Eddie 0 Quote Link to comment Share on other sites More sharing options...
trappedatuf Posted August 19, 2008 Author Share Posted August 19, 2008 Eddie, thanks for the quick reply but the reason I do it the other way is because I like to write their domain name into the coming soon page (ie: Coming Soon: http://www.customersnewdomain.com) and the way you explain would only allow me to have a static coming soon page that's the same for all users. It's more work doing it my way but it adds a little bit extra. 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted August 19, 2008 Share Posted August 19, 2008 Doing what mobile said but put www.<!--#echo var="HTTP_HOST" --> in the index.shtml where you want the new accounts domain to appear. Would this work for you? 0 Quote Link to comment Share on other sites More sharing options...
bear Posted August 19, 2008 Share Posted August 19, 2008 You could also do this with PHP. <?php echo $HTTP_HOST; ?> Name it index.php, as "index.shtml" might not be in the list of 'default' pages in httpd.conf, but 'php' most likely is on most servers. 0 Quote Link to comment Share on other sites More sharing options...
trappedatuf Posted August 20, 2008 Author Share Posted August 20, 2008 Thanks guys, that is a MUCH more simple and elegant solution than what I was doing before! 0 Quote Link to comment Share on other sites More sharing options...
meeven Posted August 21, 2008 Share Posted August 21, 2008 If you are using images, host the images somewhere else and use full url links to the images IMG SRC="http://yourdomain.com/images/welcome.gif". Is there a specific reason for the images to be hosted somewhere else? 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted August 21, 2008 Share Posted August 21, 2008 You can add the image in the dir also but I prefer to have my images on my main account. 0 Quote Link to comment Share on other sites More sharing options...
mobile Posted August 21, 2008 Share Posted August 21, 2008 Is there a specific reason for the images to be hosted somewhere else? Just a preference as I use the main logo on my site and it becomes easier if you have many servers & later on you wish to change the logo. One change and you done instead of uploading the image to every single server. Thanks, Eddie 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.