Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //$msg = "";
- //SINGLE DOMAIN SIGNUP
- //---------------------------------------
- //MySQL Information:
- $mysql_host = "localhost"; //Host Name
- $mysql_user = "root"; //Username
- $mysql_pass = ""; //Password
- $mysql_db = "mail"; //Database
- //General Configuration:
- $account_max = "10000000"; //Maximum size per account (1000000 = 1MB -> Do not uses spaces or commas!)
- $admin_notify = 1; //1 = yes & 0 = no
- $admin_email = ""; //Administrators email to send notifications)
- $admin_default_activate = 1; //1 = yes & 0 = no -> If no, the administrator has to authorise the account
- $encryption = 2; //Password encryption level
- $url = $_SERVER["HTTP_HOST"];
- $domain = $_SERVER["HTTP_HOST"];
- if (substr($domain,0,4) == "www.")
- {
- $domain = strstr($domain, ".");
- $domain = substr($domain, 1);
- }
- // Protect the Database and MD5 the password.
- $strName = addslashes( $_POST['name'] );
- $strUser = addslashes( $_POST['user'] );
- $strDomain = addslashes( $_POST['domain'] );
- $strPass1 = addslashes( $_POST['pass1'] );
- $strMD5Pass = md5( $strPass1 );
- error_reporting(E_ALL ^ E_NOTICE);
- //Next two lines connect to database using information from above.
- $con = new mysqli('localhost', 'hmailserver', 'hmailserver', 'mail');
- ///$open = mysql_connect($mysql_host, $mysql_user, $mysql_pass);
- ///$select = mysql_select_db($mysql_db);
- IF (!$con)
- {
- echo "Unable to open database, contact your administrator!";
- }
- ELSE
- {
- echo "<font size=\"+2\">$form_title</font><br><br>"; //Display form title from above
- //Decide On What Path To Take
- SWITCH ($_GET['mode'])
- {
- CASE "do":
- //#### PAGE IF FORM FILLED OUT ####//
- $q=mysqli_query("SELECT * FROM `hm_domains` WHERE `domainid` = '{$strDomain}' LIMIT 1"); //Load Domain Into memory (internal use)
- WHILE ($v=mysqli_fetch_array($q))
- {
- $temp_domain = $v['1'];
- } //Apply information
- $q2=mysqli_query("SELECT * FROM `hm_accounts` WHERE `accountaddress` = '{$strUser}@$temp_domain' LIMIT 1"); //Check if account exists
- $v2=mysqli_num_rows($q2); //Gets number of accounts that exist with that profile (should be less than or equal to one)
- IF ($v2 == 1)
- {
- echo "A user with this username already exists! <a href=\"javascript:history.go(-1)\">Go Back</a>";
- }
- ELSE
- {
- IF (!$_POST['pass1'] || !$_POST['pass2'])
- {
- echo "You did not enter both passwords! <a href=\"javascript:history.go(-1)\">Go Back</a>";
- }
- ELSEIF ($_POST['pass1'] <> $_POST['pass2'])
- {
- echo "Your passwords do not match! <a href=\"javascript:history.go(-1)\">Go Back</a>";
- }
- ELSE
- {
- $q3=mysqli_query("INSERT INTO `hm_accounts` (`accountdomainid`,`accountaddress`,`accountpassword`,`accountactive`,`accountisad`,`accountmaxsize`,`accountpwencryption`) VALUES ('$strDomain','$strUser@$temp_domain','$strMD5Pass','$admin_default_activate','0','$account_max','$encryption')") or die(mysql_error());
- }
- }
- IF ($q3)
- {
- IF ($admin_default_activate == 0)
- {
- echo "Your account has been created <b>however requires administrator activation.</b> You should receive a message soon regarding this.";
- }
- ELSE
- {
- echo "Your account has been created and is ready for use!<br><br>Username: $strUser@$temp_domain<br><br>Webmail: <a href=\"$serv_webmail/webmail\">www.$temp_domain/webmail</a><br>POP3: mail.$temp_domain<br>IMAP: mail.$temp_domain<br><br>SMTP: mail.$temp_domain";
- $subject = "Welcome To MYWEBSITE!";
- $message = "This is confirmation that your account has been created.";
- mail("{$_POST['user']}@$temp_domain", $subject, $message); //Send welcome message
- }
- }
- ELSE
- {
- echo "Database error, unable to add account. Please contact your administrator!";
- }
- IF ($admin_default_activate == 0 && $admin_notify == 0)
- {
- $admin_mail_subject = "Account Requires Activation!";
- $admin_mail_message = "{$_POST['user']}@$temp_domain has been created by {$_POST['name']} and needs to be activated!";
- mail($admin_email, $admin_mail_subject, $admin_mail_message);
- }
- ELSEIF ($admin_default_activate == 1 && $admin_notify == 1)
- {
- $admin_mail_subject = "New Account Created!";
- $admin_mail_message = "{$_POST['user']}@$temp_domain has been created by {$_POST['name']}!";
- mail($admin_email, $admin_mail_subject, $admin_mail_message);
- }
- ELSEIF ($admin_default_activate == 1 && $admin_notify == 1)
- {
- $admin_mail_subject = "New Account Created!";
- $admin_mail_message = "{$_POST['user']}@$temp_domain has been created by {$_POST['name']}!";
- mail($admin_email, $admin_mail_subject, $admin_mail_message);
- }
- ELSEIF ($admin_default_activate == 0 && $admin_notify == 1)
- {
- $admin_mail_subject = "New Account Created!";
- $admin_mail_message = "{$_POST['user']}@$temp_domain has been created by {$_POST['name']}!";
- mail($admin_email, $admin_mail_subject, $admin_mail_message);
- }
- break;
- DEFAULT:
- }
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8" />
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <title>Sign Up | MM Security</title>
- <link rel="icon" href="../img/icon.ico">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
- integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
- <link rel="stylesheet" type="text/css" media="screen" href="style/reg.css"/>
- <meta name="description" content="Sign up in MMSecurity">
- </head>
- <body>
- <div class="container" style="margin-top: 100px;">
- <div class="row justify-content-center">
- <div class="col-md-6 col-md-offset-3" align="center">
- <img src="../img/logo.png"><br><br>
- <?php //if ($msg != "") echo $msg . "<br><br>" ?>
- <form method="POST" action="?mode=do">
- <input class="form-control" name="name" type="text" placeholder="Your Name"><br>
- <input class="form-control" name="user" type="text" placeholder="Email" width="300px;"> <br>@ <select name="domain"><?php
- $q2=mysqli_query($con ,"SELECT * FROM `hm_domains` WHERE `domainactive` = '1' ORDER BY `domainname` DESC"); //Load avaliable domains into memory
- WHILE ($v2=mysqli_fetch_array($q2)) //Display avaliable domains
- {
- echo "<option value=\"{$v2['0']}\">$domain</option>";
- }
- ?><br>
- <input class="form-control" name="pass1" type="password" placeholder="Password"><br>
- <input class="form-control" name="pass2" type="password" placeholder="Confirm Password"><br>
- <input class="btn btn-primary" type="submit" name="submit" value="Create Account">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement