1 <?php include '../i18n.class.php'; $i18n = new i18n('../lang/lang_{LANGUAGE}.ini'); $i18n->init();?>
4 include '../api/server_info.php';
6 if (isset($_POST['mail']) and isset($_POST['password'])){
7 $conn=mysqli_connect($db_link,$db_user,$db_password,$db_name);
8 $selfUrl=$_SERVER['HTTP_HOST'].preg_replace('/mailbox\/new_user.php/','',$_SERVER['PHP_SELF']);
9 $query=mysqli_query($conn,'SELECT mail_user FROM mail WHERE mail_user="'.$_POST['mail'].'@'.$selfUrl.'"');
11 if (mysqli_connect_error()){
12 http_response_code(500);
14 elseif (mysqli_num_rows($query)==0){
15 mkdir($_POST['mail']);
16 mkdir($_POST['mail'].'/mails');
17 mkdir($_POST['mail'].'/readed');
18 $query=mysqli_query($conn,'INSERT INTO mail(mail_user,mail_password) VALUES("'.$_POST['mail']."@".$selfUrl.'","'.password_hash($_POST['password'],PASSWORD_DEFAULT).'")');
19 header('Location: ../login.php?info=<text>'.L::new_user.' '.$_POST['mail'].'@'.$selfUrl.'</text>');
22 header('Location: ../new_user.php?info=<text>'.L::new_already.' '.$_POST['mail'].'@'.$selfUrl.'</text>');
26 header('Location: ../index.php');