|
|
|
12-15-2009, 10:49 PM
|
Postid: 176815
|
|
Site Owner
Join Date: Nov 2000
Location: Birmingham, AL, US
Posts: 1,231
|
Fq Cnc Api
Following is code that we have used to automate the management of e-mail accounts on FutureQuest. Additional information in a follow-up post.
PHP Code:
<?php // Include settings include_once("../settings.php");
global $root; global $domain; global $content; global $cnc_user; global $cnc_pass; global $base_path; global $url_path; global $cnc_url; global $used_pops; global $total_pops;
// ---------------------------------------------------------- // Functions responsible for checking password validity // ---------------------------------------------------------- function isAlphaAndNumeric($input) { if (preg_match('/[a-zA-Z]/', $input) && preg_match('/[0-9]/', $input)) return 1; else return 0; } function isEmailValid($input) { if (!eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$", $input)) return 0; else return 1; } function isPasswordValid($input) { // Verify password is valid length if (strlen($input)<8 || strlen($input)>20) { return "Password must be 8 to 20 characters in length"; }
// New passwords cannot have leading or trailing spaces if ($input != trim($input)) { return "Password cannot contain leading or trailing spaces"; }
// If password is 8 characters, cannot contain spaces if ((strlen($input)==8) && (strstr($input," "))) { return "Eight character passwords cannot contain spaces"; }
// Password cannot contain two or more consecutive spaces if (strstr($input," ")) { return "Password cannot contain two or more consecutive spaces"; }
// Check that the new password contains both letters and digits if (!isAlphaAndNumeric($input)) { return "Password must contain letters and at least one number"; }
// Control characters and `|() not allowed in password if (!preg_match('/[\x00-\x1F\x7F`|()]/', '', $input)) { return "valid"; } else { return "Password contains invalid characters"; } }
function getErrorString($data) { // Errors are delimted as follows: <blockquote>Some error text</blockquote> $find_str = '<blockquote>'; $str_len = strlen($find_str); $location = strpos($data, $find_str); if ($location === false) { return "An error occurred"; } $counter = 0; $char = $data[$location + $str_len + $counter]; $value = ''; while ($char != '<') { $value .= $char; $counter++; $char = $data[$location + $str_len + $counter]; } return $value; } function initializeEmail() { global $root; global $domain; global $base_path; global $cnc_url; global $content; global $cnc_user; global $cnc_pass; global $url_path; global $used_pops; global $total_pops; $errors = ''; //echo "cnc_user = $cnc_user <br />"; //echo "cnc_pass = $cnc_pass <br />"; //echo "url_path = $url_path <br />"; $cnc_url = 'http://' . $cnc_user . ':' . $cnc_pass . '@' . $url_path . '/CNC/emailmgr.cgi'; //echo "cnc_url = $cnc_url <br />"; $fp = @fopen($cnc_url, 'r') or die("Error opening CNC");
while ($line = @fgets($fp, 1024)) { $content .= "$line"; } fclose($fp);
$content = strtolower(strip_tags($content));
// Initialize # of POP3 accounts available and taken // Delimiters.. these may change if FQ changes CNC text $begin = "pop3 mailboxes ("; $end = " allowed)"; $separator = " of "; // \Q = quote (disable) pattern metacharacters till \E if (preg_match("/\Q" . $begin . "\E.*?\Q" . $end . "\E/", $content, $array)) { // Retrieve the string: pop3 mailboxes (x of y allowed //echo $array[0] . '<br />'; $pop3_str = $array[0]; $pop3_str = str_replace($begin, "", $pop3_str); //echo $pop3_str . '<br />'; $pop3_str = str_replace($end, "", $pop3_str); //echo $pop3_str . '<br />'; list($used_pops, $total_pops) = split($separator, $pop3_str); //echo "Used: $used <br />"; //echo "Available: $available <br />"; return $errors; } } function getFormValue($data, $var, $type="hidden") { // <input type="hidden" name="uniqueid" value="PsALcD@XcAMAABJ4Uv0228561052773233"> if ($type == "hidden") { $find_str = '<input type="hidden" name="' . $var . '" value="'; } elseif ($type == "text") { $find_str = '<input type="text" class="text" name="' . $var . '" value="'; } else { // Unknown type specified return ""; } $str_len = strlen($find_str); $location = strpos($data, $find_str); if ($location === false) { return ''; } $counter = 0; $char = $data[$location + $str_len + $counter]; $value = ''; while ($char != '"') { $value .= $char; $counter++; $char = $data[$location + $str_len + $counter]; } return $value; } function getEmailUsername() { global $cnc_user; return $cnc_user; } function getPOPAccountsTotal() { global $total_pops; return $total_pops; }
function getPOPAccountsTaken() { global $used_pops; return $used_pops; }
function getPOPAccountsAvailable() { global $total_pops; global $used_pops; return $total_pops - $used_pops; }
function getPOP3ServerName() { global $domain; return 'pop.' . $domain; }
function getSMTPServerName() { global $domain; return 'mail.' . $domain; }
function doCreatePOPAccount($user, $pass1, $pass2) { global $cnc_url; global $cnc_user; global $cnc_pass; global $root; global $domain; // Verify that requested username is valid if (!isUsernameValid($user)) { return "Username contains invalid characters"; } // Verify that passwords are valid if ($pass1 != $pass2) { return "Passwords do not match"; } $result = isPasswordValid($pass1); if ($result != "valid") { return $result; } // Step 1: Request new POP user $ch = curl_init($cnc_url); if (!$ch) { return "Couldn't make connection to script"; } else { $submit = array("username" => $cnc_user, "name" => $user, "root" => $root, "script" => "emailmgr", "version" => "3.0", "domain" => $domain, "xdom" => 'x' . $cnc_user, "referer" => $cnc_url, "do" => "addpop"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $submit); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); if (!$data) { return "No data returned"; } } // Step 2: Check whether the requested username is available if (strpos($data, "You already have an account set up for") === false) { // Username is available, so get identifier from: // <input type="hidden" name="uniqueid" value="PsALcD@XcAMAABJ4Uv0228561052773233"> $identifier = getFormValue($data, "uniqueid", "hidden"); if ($identifier <= '') { return "Couldn't retrieve uniqueid"; } } else { return "This username has been taken"; } // Step 3: Attempt to create account $ch = curl_init($cnc_url); if (!$ch) { return "Couldn't make connection to script"; } else { $submit = array("name" => $user, "pass1" => $pass1, "pass2" => $pass2, "uniqueid" => $identifier, "do" => "createpop"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $submit); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); if (!$data) { return "No data returned"; } } // Step 4: Verify that account was successfully created if (strpos($data, "Mailbox Created") === false) { return "Mailbox creation unsuccessful"; } else { return "success"; } }
function doCreateForwardingAccount($user, $email1='', $email2='', $email3='', $email4='', $email5='', $email6='', $email7='', $email8='', $email9='', $email10='') { global $cnc_url; global $cnc_user; global $cnc_pass; global $root; global $domain; // Verify that requested username is valid if (!isUsernameValid($user)) { return "Username contains invalid characters"; } if (((strlen($email1) > 0) && (!isEmailValid($email1))) || ((strlen($email2) > 0) && (!isEmailValid($email2))) || ((strlen($email3) > 0) && (!isEmailValid($email3))) || ((strlen($email4) > 0) && (!isEmailValid($email4))) || ((strlen($email5) > 0) && (!isEmailValid($email5))) || ((strlen($email6) > 0) && (!isEmailValid($email6))) || ((strlen($email7) > 0) && (!isEmailValid($email7))) || ((strlen($email8) > 0) && (!isEmailValid($email8))) || ((strlen($email9) > 0) && (!isEmailValid($email9))) || ((strlen($email10) > 0) && (!isEmailValid($email10)))) { return "E-mail address(es) invalid."; } // Step 1: Request new forwarding user $ch = curl_init($cnc_url); if (!$ch) { return "Couldn't make connection to script"; } else { $submit = array("username" => $cnc_user, "name" => $user, "root" => $root, "script" => "emailmgr", "version" => "3.0", "domain" => $domain, "xdom" => 'x' . $cnc_user, "referer" => $cnc_url, "do" => "addalias"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $submit); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); if (!$data) { return "No data returned"; } } // Step 2: Check whether the requested username is available if (strpos($data, "You already have an account set up for") === false) { // Username is available, so get identifier from: // <input type="hidden" name="uniqueid" value="PsALcD@XcAMAABJ4Uv0228561052773233"> $identifier = getFormValue($data, "uniqueid", "hidden"); if ($identifier <= '') { return "Couldn't retrieve uniqueid"; } } else { return "This username has been taken"; } // Step 3: Attempt to create account $ch = curl_init($cnc_url); if (!$ch) { return "Couldn't make connection to script"; } else { $submit = array("name" => $user, "uniqueid" => $identifier, "do" => "createalias", "TO_1" => "$email1", "TO_2" => "$email2", "TO_3" => "$email3", "TO_4" => "$email4", "TO_5" => "$email5", "TO_6" => "$email6", "TO_7" => "$email7", "TO_8" => "$email8", "TO_9" => "$email9", "TO_10" => "$email10", ); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $submit); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); if (!$data) { return "No data returned"; } } // Step 4: Verify that account was successfully created if (strpos($data, "Alias Created") === false) { return "Mailbox creation unsuccessful"; //echo $data; } else { return "success"; } }
function doRemovePOPAccount($user, $email='') { global $cnc_url; global $cnc_user; global $cnc_pass; global $root; global $domain; // Step 1: Load delete form $ch = curl_init($cnc_url); if (!$ch) { die ("Couldn't make connection to script"); } else { $submit = array("name" => $user, "DELETE" => " Delete Box ", "do" => "edit"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $submit); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); if (!$data) { die("No data returned"); } } // echo $data; $identifier = getFormValue($data, "uniqueid", "hidden"); if ($identifier <= '') { die("Couldn't retrieve uniqueid"); }
// Step 2: Attempt to delete account $ch = curl_init($cnc_url); if (!$ch) { die ("Couldn't make connection to script"); } else { if (strlen($email) > 0) { $forward = '1'; } else { $forward = '0'; } $submit = array("name" => $user, "CONFIRM" => "1", "uniqueid" => $identifier, "forward_existing" => $forward, "forward" => $email, "do" => "delete"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $submit); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); if (!$data) { die("No data returned"); } } //echo $data; // Step 4: Verify that account was successfully created if (strpos($data, "Invalid forwarding address.")) { die("Invalid forwarding address"); } if (strpos($data, "Mailbox Deleted") || strpos($data, "Alias Deleted")) { return "success"; } else { die("Error deleting mailbox"); } }
function doChangePOPPass($accountname, $oldpass, $newpass, $newpass2) { // Verify that passwords are valid if ($newpass != $newpass2) { return "Passwords do not match"; } $result = isPasswordValid($newpass); if ($result != "valid") { return $result; } // ---------------------------------------------------------- // Now verify that username and old password authenticate // ---------------------------------------------------------- $command = "vauthenticate '$accountname'";
$descriptorspec = array( 0 => array("pipe", "r"), // stdin is a pipe that the child will read from 1 => array("pipe", "w"), // stdout is a pipe that the child will write to 2 => array("file", "/tmp/error-output.txt", "a") // stderr is a file to write to ); $process = proc_open($command, $descriptorspec, $pipes); if (is_resource($process)) { // $pipes now looks like this: // 0 => writeable handle connected to child stdin // 1 => readable handle connected to child stdout // Any error output will be appended to /tmp/error-output.txt
fwrite($pipes[0], $oldpass . "\n"); fclose($pipes[0]); fclose($pipes[1]); // It is important that you close any pipes before calling // proc_close in order to avoid a deadlock $return_value = proc_close($process);
if ($return_value) { return "Password stored in database is corrupted. Password update failed."; } }
// ---------------------------------------------------------- // Username/ old password authenticated; change to new password // ---------------------------------------------------------- $command = "vpasswd '$accountname'"; $process = proc_open($command, $descriptorspec, $pipes); if (is_resource($process)) { fwrite($pipes[0], $newpass . "\n"); fclose($pipes[0]); fclose($pipes[1]); // It is important that you close any pipes before calling // proc_close in order to avoid a deadlock $return_value = proc_close($process);
if (!$return_value) { return "success"; } else { return "Password change unsuccessful"; } } }
function doFilterExecutables($user, $filter) { global $cnc_url; global $cnc_user; global $cnc_pass; global $root; global $domain; // $filter is either 1=true or 0=false // If true, enable Executable Filter // If false, disable // Desired action: delete, bounce, or forward $action = "bounce"; $bounce_msg = ""; $recipient = ""; if ($action == "bounce") { $bounce_msg = "The specified recipient does not accept executable attachments"; } elseif ($action == "forward") { // Specify desired recipient here: $recipient = ""; } // Step 1: Load executable filter form $ch = curl_init($cnc_url); if (!$ch) { die ("Couldn't make connection to script"); } else { $submit = array("name" => $user, "filter" => "ea", "do" => "editfilterbuiltin"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $submit); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); if (!$data) { die("No data returned"); } } //echo $data;
// Step 2: Attempt to delete account $ch = curl_init($cnc_url); if (!$ch) { die ("Couldn't make connection to script"); } else { $submit = array("do" => "savefilterbuiltin", "filter" => "ea", "name" => $user, "filterenable" => $filter, "action" => $action, "bounce" => $bounce_msg, "redirect" => $recipient); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $submit); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); if (!$data) { die("No data returned"); } } //echo $data;
// Step 4: Verify that account was successfully created if (strpos($data, "Settings Saved")) { return "success"; } else { die("Error setting filter"); } }
function doSpamProtection($user, $filter, $action="tag") { global $cnc_url; global $cnc_user; global $cnc_pass; global $root; global $domain; // $filter is either 1=true or 0=false // If true, enable Executable Filter // If false, disable // Currently only support "tag" and "delete" // $action can be "delete", "bounce", "redirect", or "tag", // Step 1: Load spam assassin filter form $ch = curl_init($cnc_url); if (!$ch) { die ("Couldn't make connection to script"); } else { $submit = array("do" => "editfiltersa", "name" => $user); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $submit); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); if (!$data) { die("No data returned"); } } $subject_tag = getFormValue($data, "subject_tag", "text"); $score = getFormValue($data, "filter_4", "text"); //echo $data;
// Step 2: Attempt to activate/ deactivate spam assassin $ch = curl_init($cnc_url); if (!$ch) { die ("Couldn't make connection to script"); } else { $submit = array("do" => "savefiltersa", "name" => $user, "type_1" => $filter, "action" => $action, "subject_tag" => $subject_tag, "filter_4" => $score); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $submit); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); if (!$data) { die("No data returned"); } }
if (strpos($data, "an error has occurred")) { echo getErrorString($data); } //echo $data;
// Step 4: Verify that requested settings were made if (strpos($data, "Settings Saved")) { return "success"; } else { if ($action=="delete") { // FQ has added a confirmation step here that we have to deal with // Get all the invisible values from confirmation form: $uniqueid = getFormValue($data, "uniqueid", "hidden"); $name = getFormValue($data, "name", "hidden"); $type_1 = getFormValue($data, "type_1", "hidden"); $do = getFormValue($data, "do", "hidden"); $filter_1 = getFormValue($data, "filter_1", "hidden"); $filter_2 = getFormValue($data, "filter_2", "hidden"); $filter_3 = getFormValue($data, "filter_3", "hidden"); $filter_4 = getFormValue($data, "filter_4", "hidden"); $subject_tag = getFormValue($data, "subject_tag", "hidden"); $action = getFormValue($data, "action", "hidden"); $numberofboxes = getFormValue($data, "numberofboxes", "hidden"); // Now fill array with values $submit = array("uniqueid" => $uniqueid, "name" => $name, "type_1" => $type_1, "do" => $do, "filter_1" => $filter_1, "filter_2" => $filter_2, "filter_3" => $filter_3, "filter_4" => $filter_4, "subject_tag" => $subject_tag, "action" => $action, "numberofboxes" => $numberofboxes); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $submit); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); if (strpos($data, "Settings Saved")) { return "success"; } else { reportError($data); die("Error setting filter. Problem has been reported! <a href=\"index.php\">Back to Module</a>"); } } else { reportError($data); die("Error setting filter. Problem has been reported! <a href=\"index.php\">Back to Module</a>"); } } } function doVirusProtection($user, $filter, $action="tag") { global $cnc_url; global $cnc_user; global $cnc_pass; global $root; global $domain; // $filter is either 1=true or 0=false // If true, enable Executable Filter // If false, disable if (($filter != 0) && ($filter != 1)) $filter = 0; // Currently support "tag" and "delete" for $action if (($action != "tag") && ($action != "delete")) $action = "tag"; // Step 1: Submit virus protection preferences $ch = curl_init($cnc_url); if (!$ch) { die ("Couldn't make connection to script"); } else { $submit = array("do" => "savefilterbuiltin", "filter" => "virus", "name" => $user, "filterenable" => $filter, "action" => $action, "includelines" => "", "prefixsubject" => "*{virus detected}*"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $submit); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); if (!$data) { die("No data returned"); } } if (strpos($data, "an error has occurred")) { echo getErrorString($data); } //echo $data;
// Verify that requested settings were made if (strpos($data, "Settings Saved")) { return "success"; } else { if ($action=="delete") { // FQ has added a confirmation step here that we have to deal with // Get all the invisible values from confirmation form: $uniqueid = getFormValue($data, "uniqueid", "hidden"); $name = getFormValue($data, "name", "hidden"); $do = getFormValue($data, "do", "hidden"); $filterenable = getFormValue($data, "filterenable", "hidden"); $action = getFormValue($data, "action", "hidden"); $filter = getFormValue($data, "filter", "hidden"); // Now fill array with values $submit = array("uniqueid" => $uniqueid, "name" => $name, "do" => $do, "filterenable" => $filterenable, "action" => $action, "filter" => $filter); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $submit); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); if (strpos($data, "Settings Saved")) { return "success"; } else { reportError($data); die("Error setting filter. Problem has been reported! <a href=\"index.php\">Back to Module</a>"); } } else { reportError($data); die("Error setting filter. Problem has been reported! <a href=\"index.php\">Back to Module</a>"); } } } function doEmailForwarding($user, $enable, $recipient) { global $cnc_url; global $cnc_user; global $cnc_pass; global $root; global $domain; // $enable is either 1=true or 0=false // If true, enable forwarding // If false, disable if (($enable != 0) && ($enable != 1)) $enable = 0; } ?>
|
|
|
12-15-2009, 11:04 PM
|
Postid: 176816
|
|
Site Owner
Join Date: Nov 2000
Location: Birmingham, AL, US
Posts: 1,231
|
Re: Fq Cnc Api
Copyright 2009 Webspace Enterprises, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.
THIS SOFTWARE IS PROVIDED BY WEBSPACE ENTERPRISES, INC. "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those of the
authors and should not be interpreted as representing official policies, either expressed
or implied, of Webspace Enterprises, Inc.
|
|
|
12-15-2009, 11:23 PM
|
Postid: 176817
|
|
|
Re: Fq Cnc Api
Matt - for the un-initiated and those who have accounts with hosts other than Fquest, what does your script accomplish or remedy - a defect or lack of features in this host's control panel? Any guarantee against spyware / malware?
Is your disclaimer applicable worldwide?
Terra - does FutureQuest Endorse / Recommend the script?
|
|
|
|
12-15-2009, 11:23 PM
|
Postid: 176818
|
|
Site Owner
Join Date: Nov 2000
Location: Birmingham, AL, US
Posts: 1,231
|
Re: Fq Cnc Api
I ran across this code that we have used in the past to enable API-like access to FutureQuest's CNC e-mail manager. It is a bit outdated as you might guess from the call to enable/ disable virus scanning (FutureQuest removed this option from CNC years ago) and it's entirely possible that some forms may have changed slightly (which will break some or all of the code). However, the CNC hasn't changed that much and it is likely the code is still mostly functional (and would require only a little tweaking to get it 100% functional). This code also forms the framework that can be used to automate virtually any other function in the CNC.
I am putting this code into the public domain so that it might benefit others, rather than lapse into obsolescence. Also, e-mail is one of those features you might want users to be able to access on an individual basis without providing full access to the CNC. This code allows you to address this issue.
It would be appropriate to post your tweaks / improvements to the forum to assist others if the code has helped you, but it is not a requirement. I will be willing to provide support on a billable hourly basis if you would like, but I cannot volunteer any further effort other than to say:
settings.php is what defines the global variables, nothing more (values should be pretty obvious based on variable names, but I will make an effort to provide a skeleton settings.php file in the next day or so)
In actual usage scenarios, we cached CNC data to a database to avoid the overhead / delays that would come with having to access and parse CNC results each time. For example, if you create an e-mail address, the information should be cached to the database during the provisioning call. This prevents having to pull the information from the CNC at a later date (and also allows you to do things that aren't possible in the CNC, such as retrieving the user's e-mail account password).
Hope this is helpful to someone. -Matt
|
|
|
12-15-2009, 11:30 PM
|
Postid: 176819
|
|
Site Owner
Join Date: Nov 2000
Location: Birmingham, AL, US
Posts: 1,231
|
Re: Fq Cnc Api
Quote:
|
for the un-initiated and those who have accounts with hosts other than Fquest, what does your script accomplish or remedy
|
This remedies the lack of an API and is relevant only to FQ resellers (thus the reason for posting it to the resellers forum). It could also be used to address the lack of a user-level e-mail manager, but would require coding to build that interface.
Quote:
|
Any guarantee against spyware / malware?
|
Nope. No guarantees at all. This is entirely "use at your own risk." The source is in the open and it's pretty straightforward, so if there is a security hole, it should be pretty obvious. Also, this code was written years ago, has not been maintained, and may have some security flaw that went unrecognized.
Quote:
|
Is your disclaimer applicable worldwide?
|
This is the Simplified BSD License, so I suppose it applies anywhere that this particular license is honored.
Quote:
|
Terra - does FutureQuest Endorse / Recommend the script?
|
I don't endorse this script and I doubt FutureQuest can endorse any third party script for the reasons you mention.
Last edited by Matt : 12-15-2009 at 11:41 PM.
|
|
|
12-15-2009, 11:38 PM
|
Postid: 176820
|
|
|
Re: Fq Cnc Api
Matt - thanks for your prompt and forthright response.
FutureQuest may want to look at the script and maybe work with you to integrate it into the control panel which in IMHO needs to be modernised to keep up with the times........
|
|
|
|
12-17-2009, 10:49 AM
|
Postid: 176838
|
|
Site Owner
Join Date: Nov 2000
Location: Birmingham, AL, US
Posts: 1,231
|
Re: Fq Cnc Api
Following is a sample settings.php file. Based on code above, this would need to go one directory higher than where the CNC code is stored.
PHP Code:
<?php
// Adjust the following settings to match your FQ credentials
$root = '/big/dom/xdomain';
$domain = 'domain.tld';
$cnc_user = 'username';
$cnc_pass = 'password';
$db_user = 'db_username';
$db_pass = 'db_password';
// No need to modify anything below this line
$db_name = 'xdomain_1';
$base_path = $root . '/www';
$url_path = 'www.' . $domain;
$web_address = 'http://' . $url_path;
$db_host = 'MySQL.' . $domain;
$timeout = '20';
?>
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 visitors)
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 12:26 AM.
|
| |
|
|
|