$skindata['pagename'] = 'signup';
require_once("include.html");
if (!$selfcreate) {header("Location: index.html"); exit;}
require_once("inc/function.accounts.php");
//title
$skindata['title'] = $otherconfig["TITLETEXT"] .' - '. $lang[MSG_CREATEERROR] ;
//pagetitle
$skindata['pagetitle']= $lang[MSG_CREATEERROR];
if (!$selfcreate) {header("Location: index.html"); exit;}
unset($account);
$accounts = getaccounts();
$message=$message2= "";
if(ereg("@",$accountname)) $accountname=substr($accountname,0,strpos($accountname,"@"));
if($integrate && !$otherconfig["DISABLEVERIFICATION"])
{
unset($cook);
if($_COOKIE[webmailsignup]!="")
{
$wordtest = str_replace(' ','',$wordtest);
ereg("(.+)-([0-9]+)",$_COOKIE[webmailsignup],$cook);
setcookie(webmailsignup,"", -3600);
}
if($integrate && (!is_array($cook) || !$cook[2] || strcmp(md5(strtoupper($wordtest).$cook[2]),$cook[1])))
$message2 = $lang[MSG_VERIFICATIONERR]."
";
}
if(trim($accountname)=="")
$message = ", \"$lang[MSG_USERNAME]\"";
elseif(!eregi("^[a-z0-9\_\-\.]+$", $accountname))
$message2 .= $lang[MSG_INCORECTUNAME]."
";
if ($password == "") $message .= ", \"$lang[MSG_PASSWORD]\"";
if ($passwordconfirm == "") $message .= ", \"$lang[MSG_PASSWORD_CONFIRM]\"";
if (!$integrate && $email == "") $message .= ", \"$lang[MSG_EMAILADDR]\"";
if ($message2.$message !== "")
{
$message = $message2.($message?$emptyfields["MESSAGE"] . substr($message, 2, strlen($message) - 2):'');
$skindata['message'] = showmessage($message,'','', true, $showmessage_errorcolor, true);
include_once("self.html");
die();
}
if ($ddomain) $accountname = "$ddomain/$accountname";
$account["USER"] = $accountname;
$accountpass = $password;
if ($password <> $passwordconfirm)
{
$skindata['message'] = showmessage($passwordnotconfirmed,'','', true, $showmessage_errorcolor, true);
include_once("self.html");
die();
}
$account["PASS"] = $accountpass;
if ($integrate)
{
$add = "";
list($fdomain, $username) = explode("/", $accountname);
if (!$username)
{
list($fdomain) = explode(";", $domain);
$username = $accountname;
}
if (!strpos($username, "@")) $add = "@" . $fdomain;
$account["EMAIL"] = $username . $add;
$account["HOSTUSER"] = $accountname;
$account["HOSTPASS"] = $accountpass;
$account["HOST"] = $mailserver;
}
else
{
$account["EMAIL"] = $email;
$account["HOSTUSER"] = $hostuser;
$account["HOSTPASS"] = $hostpass;
$account["HOST"] = $host?$host:$mailserver;
}
$account["DELETE"] = !($dleavemessages);
$account["DELETESERVER"] = $otherconfig["DELETEMESSAGES"];
$account["UIDLDELETE"] = $otherconfig["DELETEDELETED"];
$account["FULLNAME"] = $fullname;
$account["ADMIN"] = false;
$account["REPLYTO"] = "";
$account["FULLHEADER"] = "";
$account["MULTI"] = "";
$account["ATTACH"] = "";
$account["ALTEMAIL"] = $altemail;
if (getnewaccountid($accounts, $account["USER"]))
$accounts[] = $account;
else
{
$skindata['message'] = showmessage($alreadyexists,'','', true, $showmessage_errorcolor, true);
include_once("self.html");
exit;
}
if (!$integrate)
{
saveaccounts($accounts);
$username = $accountname;
$password = $accountpass;
$accountcreated = true;
include_once("index.html");
}
else
{
if ($otherconfig["FULLMERAK"])
{
include_once("integrateinclude.html");
$xdomain = "";
if ($fdomain) $xdomain = "@" . $fdomain;
$result = integrateadduser($username . $xdomain, $fullname, $accountpass);
}
if (!$result)
{
$nocreateuser = true;
include_once("self.html");
die();
}
else
{
// Alternate Email
if($altemail) {
mkdirtree(usersdir . $account["USER"]);
saveuserconfig($account["USER"], $account);
}
if (!$otherconfig["FULLMERAK"]) saveaccounts($accounts);
$accountcreated = true;
if($otherconfig[SENDCREATE] && $otherconfig[SENDCREATEMAIL])
{
$from= getemail($otherconfig[SENDCREATEMAIL]);
$to2[]=$from;
include_once("smtppop3.html");
if ($smtphost) $smtp = new smtp($smtphost, $smtpport, $connected);
$ncdate= Date("D, d M Y H:i:s");
$body= sprintf (newaccountmail,$account["EMAIL"],$ncdate);
$message = "Date: $ncdate +0100\r\n";
$message .= "From: $from\r\n";
$message .= "To: $from\r\n";
$message .= "Subject: " . putheader($body) . "\r\n";
$message .= "Message-ID: <" . md5(uniqid("")) . strstr($otherconfig[SENDCREATEMAIL],"@"). ">\r\n";
$message .= "X-Mailer: " . webmail . "\r\n";
$message .= "X-Originating-IP: " . $REMOTE_ADDR . "\r\n";
$message .= "\r\n";
$message.= dotconvert($body);
$smtp->smtpmail($from, $to2, $message);
$smtp->status["LASTRESULTTXT"];
$smtp->close();
$smtp = null;
}
include_once("index.html");
}
}
?>