0.4.5 Beta not recomended to production servers
[smail.git/.git] / mailbox / user.php
1 <?php
2 include '../api/server_info.php';
3 if (isset($_POST['mail'])){
4     if (file_exists(preg_split('/@/',$_POST['mail'])[0].'/index.php')){
5                 $conn=mysqli_connect($db_link,$db_user,$db_password,$db_name);
6         echo $_POST['mail'];
7                 $query=mysqli_query($conn,'SELECT mail_password FROM mail where mail_user="'.$_POST['mail'].'"');
8                 $i=mysqli_fetch_array($query,MYSQLI_ASSOC);
9         if ($_POST['hash']==$i['mail_password']){
10             http_response_code(200);
11         }
12         else{
13                         $query=mysqli_query($conn,'SELECT channel_name FROM mail_lists WHERE channel_name="'.$_POST['mail'].'"');
14                         if (gettype($query=='boolean')){
15                                 http_response_code(400);
16                         }
17                         else{
18                                 http_response_code(200);
19                         }
20         }
21     }
22     else{
23         http_response_code(500);
24     }
25 }
26 else{
27     http_response_code(400);
28 }
29
30 ?>