We are checking to see if a subdomain exists before creating it, using the cPanel subdomain functions. Ideas on how to fix this?
//NOTE: Check to see if the subdomain exists...
$subdomain = $DOMAIN . $EXTENSION; //'.domain1.com';
$path = null;
if ($EXTENSION === '.domain1.com') {
$path = "https://domain1:$userPW@$configServer:2083/frontend/paper_lantern/subdomain/index.html";
} else if ($EXTENSION === '.domain2.net') {
$path = "https://domain2:$userPW@$configServer:2083/frontend/paper_lantern/subdomain/index.html";
} else if ($EXTENSION === '.domain3.com') {
$path = "https://domain3:$userPW@$configServer:2083/frontend/paper_lantern/subdomain/index.html";
} else if ($EXTENSION === '.domain4.com') {
$path = "https://domain4:$userPW@$configServer:2083/frontend/paper_lantern/subdomain/index.html";
} else if ($EXTENSION === '.domain5.com') {
$path = "https://domain5:$userPW@$configServer:2083/frontend/paper_lantern/subdomain/index.html";
} else if ($EXTENSION === '.domain6.com') {
$path = "https://domain6:$userPW@$configServer:2083/frontend/paper_lantern/subdomain/index.html";
}
$f = fopen($path, "r");
$status = 0;
if (!$f) {
$status = 1;
} else {
//check if the account exists
while (!feof($f)) {
$line = fgets($f, 1024);
//NOTE: Was -- if (ereg($subdomain, $line, $out)) {
if (stristr($line, $subdomain)) {
$status = 2;
}
}
fclose($f); //close the file resource
}
if ($status == 1) {
echo '<div class="error_message">We are sorry, there was an error. Please try again.</div>';
exit();
} else if ($status == 2) {
echo '<div class="error_message">We are sorry, but that domain already exists.</div>';
exit();
} else {