0.4.5 Beta not recomended to production servers
authorborisd93 <borisdanielmm@nauta.cu>
Sat, 8 May 2021 19:42:31 +0000 (15:42 -0400)
committerborisd93 <borisdanielmm@nauta.cu>
Sat, 8 May 2021 19:42:31 +0000 (15:42 -0400)
29 files changed:
DESCRIPTION [new file with mode: 0644]
README.md [new file with mode: 0644]
VERSION [new file with mode: 0644]
api/functions.php
api/server_info.php
ch_p.php
css/all.css
css/index.css
index.php
lang/lang_en.ini
lang/lang_es.ini
mailbox/getmail.php
mailbox/ismch.php [new file with mode: 0644]
mailbox/mailb.php
mailbox/move.php
mailbox/new_channel.php [new file with mode: 0644]
mailbox/new_group.php [new file with mode: 0644]
mailbox/new_user.php
mailbox/raw_mails.php
mailbox/reicive.php
mailbox/remove_mf.php
mailbox/send.php
mailbox/user.php
mailbox/xmlmail.php [new file with mode: 0644]
map.php [new file with mode: 0644]
new_channel.php [new file with mode: 0644]
new_group.php [new file with mode: 0644]
send_m.php
sitemap.xml [new file with mode: 0644]

diff --git a/DESCRIPTION b/DESCRIPTION
new file mode 100644 (file)
index 0000000..f58628c
--- /dev/null
@@ -0,0 +1,9 @@
+The SMail project is a web hosted mail,
+like as the normal email, but with others
+transfer methods, we looking for the user
+privacy and security on the internet.
+
+Our team thanks to you a normal user,
+maybe a new hoster what be using SMail.
+
+Considers your privacy!
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..e940542
--- /dev/null
+++ b/README.md
@@ -0,0 +1,13 @@
+# SMAIL
+
+The SMail project is a web hosted mail,
+like as the normal email, but with others
+transfer methods, we looking for the user
+privacy and security on the internet.
+
+Our team thanks to you a normal user,
+maybe a new hoster what be using SMail.
+
+Considers your privacy!
+
+# Licensed by GNU Public License Version 3
\ No newline at end of file
diff --git a/VERSION b/VERSION
new file mode 100644 (file)
index 0000000..ae06347
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.4.5 Beta
\ No newline at end of file
index f27d40a..dff334e 100644 (file)
@@ -38,4 +38,35 @@ function isloged(){
         return 0;
     }
 }
+
+function return_plant($info,$date,$channelname){
+       $date=str_replace('-','/',$date);
+       echo "
+       <html>
+       <head>
+               <link rel='stylesheet' type='text/css' href='../../../css/all.css'>
+               <link rel='stylesheet' type='text/css' href='../../../css/channel.css'>
+       </head>
+       <body>
+               <text>Channel: $channelname</text><br>
+               <text>$date</text><br>
+               <text>$info</text><br>
+       </body>
+       </html>";
+}
+function return_plant_group($info,$date,$channelname){
+       $date=str_replace('-','/',$date);
+       echo "
+       <html>
+       <head>
+               <link rel='stylesheet' type='text/css' href='../../../css/all.css'>
+               <link rel='stylesheet' type='text/css' href='../../../css/channel.css'>
+       </head>
+       <body>
+               <text>User: $channelname</text><br>
+               <text>$date</text><br>
+               <text>$info</text><br>
+       </body>
+       </html>";
+}
 ?>
index 8ff5307..414dcbd 100644 (file)
@@ -1,6 +1,6 @@
 <?php
-$db_name='';
-$db_user='';
-$db_password='';
-$db_link='';
+$db_name='mail';
+$db_user='dania';
+$db_password='balbinotA12.';
+$db_link='localhost';
 ?>
index f27bcb4..632f651 100644 (file)
--- a/ch_p.php
+++ b/ch_p.php
@@ -2,12 +2,13 @@
 include 'api/functions.php';
 session_issruning();
 if (isLoged()==0){
-    header('Location: login.html');
+    header('Location: login.php');
 }
 ?><html>
     <head>
         <title>Login Smail</title>
         <link type='text/css' rel='stylesheet' href='css/all.css'/>
+        <link type='text/css' rel='stylesheet' href='css/send.css'/>
         <style type='text/css'>
         input{
             display: block;
@@ -17,8 +18,8 @@ if (isLoged()==0){
     <body>
         <form action='mailbox/change_p.php' method='POST'>
             <input type="text" name="old" id="old" placeholder="Old">
-            <input type="text" name="new" id="new" placeholder="New">
-            <input type="submit" value="Change">
+            <input type="text" name="new" id="new" placeholder="New" class="center">
+            <input type="submit" value="Change" class="submit">
         </form>
     </body>
-</html>
\ No newline at end of file
+</html>
index 67f6e04..da4f538 100644 (file)
@@ -2,24 +2,24 @@ html{
     background: #30303c;
 }
 input,textarea{
-    font-family: Bahnschrift;
+    font-family: Verdana;
     border: none;
 }
 h1{
-    font-size: 60px;
+    font-size: 50px;
 }
 .mail,text,a{
     font-size: 30px;
 }
 h1,text{
     color: white;
-    font-family: Bahnschrift;
+    font-family: Verdana;
 }
 text{
     font-size: 25px;
 }
 a{
-    font-family: Bahnschrift;
+    font-family: Verdana;
     color: yellowgreen;
     text-decoration: none;
 }
index fc81562..5638ebf 100644 (file)
@@ -6,5 +6,18 @@ a:hover{
     color: greenyellow;
 }
 text,h1{
-    font-family: Bahnschrift;
+    font-family: Verdana;
+}
+.tag{
+    color: white;
+    background: #30303c;
+    padding: 5%;
+    padding-top: 1%;
+    padding-bottom: 1%;
+}
+.sitemap{
+    padding: 5%;
+    padding-top: 1%;
+    padding-bottom: 1%;
+    color: white
 }
\ No newline at end of file
index 75c315e..b3084f4 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,9 +1,9 @@
-<!-- {instance:Smail,version:0.2} --->
+<!-- {version:<?php echo file_get_contents('VERSION');?>} --->
 <?php include 'i18n.class.php'; $i18n = new i18n(); $i18n->init();?>
 <html>
     <head>
         <title>SecureMail</title>
-        <link rel='stylesheet' type='text/css' href='css/index.css'>
+        <link rel='stylesheet' type='text/css' href='css/index.css?v=1'>
         <link type='text/css' rel='stylesheet' href='css/all.css?v=1'/>
     </head>
     <body style='margin: 0px;'>
             <h1 style='margin: 0px;'><?php echo L::index_welcome;?></h1>
             <hr>
         </div>
-        <div style='color: white; background: #30303c; padding: 1%;'>
-            <h1 style='margin: 0px;'><?php echo L::index_register;?></h1>
-            <hr>
-            <text><?php echo L::index_register_c;?></text>
-        </div>
-        <div style='color: white; background: #30303c; padding: 1%;'>
+        <div class="sitemap"><a href='map.php'>SiteMap</a> - <a href='map.php'>Login</a> - <a href='map.php'>Register</a> - <a href="https://reisub.nsupdate.info/git/?p=smail.git/">Git</a> - <a href="https://reisub.nsupdate.info/bugs/">Bugs</a></div>
+        <div class="tag">
             <h1 style='margin: 0px;'><?php echo L::index_about;?></h1>
             <hr>
             <text><?php echo L::index_about_c;?></text>
         </div>
-        <div style='color: white; background: #30303c; padding: 1%;'>
-            <h1 style='margin: 0px;'><?php echo L::index_how;?></h1>
-            <hr>
-            <text><?php echo L::index_how_c;?></text>
-        </div>
-        <div style='color: white; background: #30303c; padding: 1%;'>
-            <h1 style='margin: 0px;'><?php echo L::index_where;?></h1>
-            <hr>
-            <text><?php echo L::index_where_c;?></text>
-        </div>
-        <div style='color: white; background: #30303c; padding: 1%;'>
+        <div class="tag">
             <h1 style='margin: 0px;'><?php echo L::index_license;?></h1>
             <hr>
             <text><?php echo L::index_license_c;?></text>
index 6adeaf0..aac1501 100644 (file)
@@ -1,5 +1,5 @@
 [index]
-welcome = "SecureMail"
+welcome = "Welcome to the first SMail instance"
 register = 'How i can create my own account?'
 about = "What is SMail?"
 how = "How i can use it?"
@@ -36,10 +36,11 @@ or = "/"
 [new]
 already = "This user was already taken"
 user = "User created, your new smail are "
-aroba = "User was not created because you put an @, you only need to put the user"
+invalidchar = "You have inputed an invalid char"
+aroba = "User was not created because you put invalid characters"
 [reg]
 submit = "Sign up"
 [errors]
 nonerror = "This SMail sended"
-iderror_not = "This SMail dont exists"
+iderror_not = "This SMail dont exists or if is a channel them not exists or not is yours"
 sslerror = "A error as ocurred while sending message because the server was invalid or haves an bad ssl"
index 14aea58..bf06317 100644 (file)
@@ -1,5 +1,5 @@
 [index]
-welcome = "SecureMail"
+welcome = "Bienvenido a la primera instancia de SMail"
 register = "¿Como me registro?"
 about = "¿Que es SMail?"
 how = "¿Como puedo usar SMail?"
@@ -35,10 +35,11 @@ or = "o"
 [new]
 already = "Este usuario ya esta tomado"
 user= "Usuario creado, tu nuevo smail es "
-aroba = "Usuario no creado porque pusiste una @, solo necesitas poner el usuario"
+invalidchar = "Introduciste un caracter invalido"
+aroba = "Usuario no creado porque pusiste caracteres no permitidos"
 [reg]
 submit = "Registrar"
 [errors]
 nonerror = "SMail enviado"
-iderror_not = "SMail no enviado porque el id no existe"
+iderror_not = "SMail no enviado porque el id no existe, o si es un canal no es tuyo"
 sslerror = "SMail no enviado porque el servidor receptor no existe o no tiene ssl"
index 38d53b6..f41e30f 100644 (file)
@@ -29,7 +29,7 @@
                     }
                 }
                 elseif(isset($_GET['id'])){
-                    try{include preg_split('/@/',$_SESSION['m_user'])[0].'/mails/'.$_GET['id'];echo '<text>'.L::gmail_sender.': '.$sender.'</text><br>';echo '<text>'.L::gmail_content.': '.$html;echo '</text><br><a href="mailb.php">'.L::gmail_return.'</a><text> '.L::gmail_or.' </text><a href="move.php?&from=mails&to=readed&id='.$_GET['id'].'">'.L::gmail_read.'</a>';}catch (Exception $e){echo L::gmail_invalid_id;}
+                    try{include preg_split('/@/',$_SESSION['m_user'])[0].'/mails/'.$_GET['id'];echo '<text>'.L::gmail_sender.': '.$sender.'</text><br>';echo '<text>'.L::gmail_content.': '.str_replace('\n','<br>',$html);echo '</text><br><a href="mailb.php">'.L::gmail_return.'</a><text> '.L::gmail_or.' </text><a href="move.php?&from=mails&to=readed&id='.$_GET['id'].'">'.L::gmail_read.'</a>';}catch (Exception $e){echo L::gmail_invalid_id;}
                 }
             }
         }
diff --git a/mailbox/ismch.php b/mailbox/ismch.php
new file mode 100644 (file)
index 0000000..05737f5
--- /dev/null
@@ -0,0 +1,54 @@
+<?php
+
+/**
+ * Is my Channel?
+ * Internal Module
+ * Version: 0.1
+ * 
+ * Requisites:
+ * MYSQL TABLE CALLED
+ * mail_lists
+ * 
+ * AND ALL THE 
+ * CHANNELS MODULES
+*/
+
+/** Basic Start */
+include '../api/server_info.php';
+include '../api/functions.php';
+/** Finish */
+
+/** Create $conn var */
+$conn=mysqli_connect($db_link,$db_user,$db_password,$db_name);
+
+/** Verifyng the sended data */
+if (isset($_POST['mail']) and isset($_POST['channel']) and isset($_POST['hash'])){
+    /** Query */
+    $query=mysqli_query($conn,'SELECT * FROM mail_lists WHERE channel_name="'.$_POST['channel'].'" AND channel_admin="'.$_POST['mail'].'"');
+    /** Verifyng the query */
+    if (!(gettype($query)=='boolean')){
+        if (!(mysqli_num_rows($query)==0)){
+            /** Extracting the data */
+            $data=mysqli_fetch_array($query,MYSQLI_ASSOC);
+            if ($data['channel_name']==$_POST['channel']){
+                http_response_code(200);
+                echo '200';
+            }
+            else{
+                http_response_code(500);
+            }
+        }
+        else{
+            http_response_code(500);
+        }
+    }
+    else{
+        http_response_code(500);
+    }
+}
+else{
+    http_response_code(500);
+}
+
+/** ALL THE 500 RESPONSES ARE RECOGNIZED AT reicive.php */
+?>
\ No newline at end of file
index 4209568..7138742 100644 (file)
@@ -16,7 +16,7 @@ if (isloged()==0){
         <link type='text/css' rel='stylesheet' href='../css/mailbox.css?v=1'/>
     </head>
     <body>
-        <h1>Mail Box <?php if(isset($_GET['box'])==true){echo $_GET['box'];}?></h1>
+        <h1><?php if (isset($_GET['channel'])){?>Mail Box - Special<?php } else{ ?>Mail Box<?php } ?> <?php if(isset($_GET['box'])==true){echo $_GET['box'];}?></h1>
         <?php
         if (isset($_GET['info'])){
             echo str_replace('_',' ',$_GET['info']);
@@ -34,7 +34,19 @@ if (isloged()==0){
                 return ($files) ? $files : false;
         }
         if (isloged()==1){
-            if (isset($_GET['box'])){
+            if (isset($_GET['channel'])){
+                if (is_dir($_GET['channel']) and strpos($_GET['channel'],'/')==false and strpos($_GET['channel'],'..')==false or strpos($_GET['channel'],'\\')==false){
+                    $dirs=scan_dir(getcwd().'/'.$_GET['channel'].'/mails/');
+                    if (($dirs==false)==false){
+                        foreach ($dirs as $files){
+                            include getcwd().'/'.$_GET['channel'].'/mails/'.$files;
+                            echo '<span class="mail"><a href="'.$_GET['channel'].'/mails/'.$files.'">'.substr($content,0,20).'...</a> <text>'.str_replace('-','/',$date).'</text> </span><br>
+';  
+                        }
+                    }
+                }
+            }
+            elseif (isset($_GET['box'])){
                 if (is_dir(preg_split('/@/',$_SESSION['m_user'])[0].'/'.$_GET['box']) and strpos($_GET['box'],'/')==false and strpos($_GET['box'],'..')==false or strpos($_GET['box'],'\\')==false){
                     $dirs=scan_dir(getcwd().'/'.preg_split('/@/',$_SESSION['m_user'])[0].'/'.$_GET['box']);
                     if (($dirs==false)==false){
index 3bfa86e..1cd8f93 100644 (file)
@@ -3,10 +3,10 @@ include '../api/functions.php';
 session_issruning();
 if (isloged()==1){
     if (isset($_GET['id']) and  isset($_GET['to']) and isset($_GET['from'])){
-        if (is_dir($_SESSION['m_user'].'/'.$_GET['from'])){
-            if (file_exists($_SESSION['m_user'].'/'.$_GET['from']).$_GET['id'] and strpos($_GET['to'],'..')==false and strpos($_GET['to'],'/')==false and strpos($_GET['to'],'\\')==false and strpos($_GET['from'],'..')==false and strpos($_GET['from'],'\\')==false and strpos($_GET['from'],'/')==false){
-                rename($_SESSION['m_user'].'/'.$_GET['from'].'/'.$_GET['id'],$_SESSION['m_user'].'/'.$_GET['to'].'/'.$_GET['id']);
-                echo 'Success';
+        if (is_dir(preg_split('/@/',$_SESSION['m_user'])[0].'/'.$_GET['from'])){
+            if (file_exists(preg_split('/@/',$_SESSION['m_user'])[0].'/'.$_GET['from']).$_GET['id'] and strpos($_GET['to'],'..')==false and strpos($_GET['to'],'/')==false and strpos($_GET['to'],'\\')==false and strpos($_GET['from'],'..')==false and strpos($_GET['from'],'\\')==false and strpos($_GET['from'],'/')==false){
+                try{rename(preg_split('/@/',$_SESSION['m_user'])[0].'/'.$_GET['from'].'/'.$_GET['id'],preg_split('/@/',$_SESSION['m_user'])[0].'/'.$_GET['to'].'/'.$_GET['id']);echo 'Success';}catch (Exception $error){echo 'ID not exists';}
+                
             }
             else{
                 http_response_code(500);
@@ -26,4 +26,4 @@ if (isloged()==1){
 }
 else{
     header('Location: ../login.php');
-}
\ No newline at end of file
+}
diff --git a/mailbox/new_channel.php b/mailbox/new_channel.php
new file mode 100644 (file)
index 0000000..4c57d7b
--- /dev/null
@@ -0,0 +1,60 @@
+<?php
+
+/**
+ * Create Channel Script
+ * Internal Module
+ * Version: 0.1
+ * 
+ * Requisites:
+ * MYSQL TABLE CALLED
+ * mail_lists
+*/
+
+$about='
+The channels are mailing 
+list, you can create one,
+you can join, see a exacly
+message etc...
+';
+
+include '../api/server_info.php';
+include '../api/functions.php';
+
+session_issruning();
+
+$conn=mysqli_connect($db_link,$db_user,$db_password,$db_name);
+$query=mysqli_query($conn,'CREATE TABLE mail_lists(channel_name VARCHAR(20), channel_admin VARCHAR(150), channel_users VARCHAR(10000))');
+
+if (isLoged()==1){
+       if (isset($_POST['newname'])){
+               $query=mysqli_query($conn,'SELECT channel_name FROM mail_lists WHERE channel_name="'.$_POST['newname'].'"');
+               if (mysqli_num_rows($query)==0){
+                       echo 'Name Avaible';
+                       if (isset($_POST['admin'])){
+                               if (is_dir(preg_split('/@/',$_POST['admin'])[0])){
+                                       echo '<br>All Ok';
+                                       mysqli_query($conn,'INSERT INTO mail_lists(channel_name,channel_admin,channel_users) values("'.$_POST['newname'].'","'.$_POST['admin'].'","")');
+                                       echo '<br>Created';
+                                       mkdir($_POST['newname']);
+                                       mkdir($_POST['newname'].'/mails');
+                                       touch($_POST['newname'].'/index.php');
+                                       file_put_contents($_POST['newname'].'/index.php','<?php $type="CHANNEL"; ?>');
+                               }
+                               else{
+                                       header('Location: ../login.php');
+                               }
+                       }
+               }
+               else{
+                       echo 'Name is already using';
+               }
+       }
+       else{
+               header('Location: ../new_channel.php?info=<text>Please_provide_a_name</text>');
+       }
+}
+else{
+       header('Location: ../login.php');
+}
+
+?>
diff --git a/mailbox/new_group.php b/mailbox/new_group.php
new file mode 100644 (file)
index 0000000..44c7f88
--- /dev/null
@@ -0,0 +1,60 @@
+<?php
+
+/**
+ * Create Channel Script
+ * Internal Module
+ * Version: 0.1
+ * 
+ * Requisites:
+ * MYSQL TABLE CALLED
+ * mail_lists
+*/
+
+$about='
+The groupd are mailing 
+list, you can create one,
+you can join, see a exacly
+message etc...
+';
+
+include '../api/server_info.php';
+include '../api/functions.php';
+
+session_issruning();
+
+$conn=mysqli_connect($db_link,$db_user,$db_password,$db_name);
+$query=mysqli_query($conn,'CREATE TABLE mail_lists(channel_name VARCHAR(20), channel_admin VARCHAR(150), channel_users VARCHAR(10000))');
+
+if (isLoged()==1){
+       if (isset($_POST['newname'])){
+               $query=mysqli_query($conn,'SELECT channel_name FROM mail_lists WHERE channel_name="'.$_POST['newname'].'"');
+               if (mysqli_num_rows($query)==0){
+                       echo 'Name Avaible';
+                       if (isset($_POST['admin'])){
+                               if (is_dir(preg_split('/@/',$_POST['admin'])[0])){
+                                       echo '<br>All Ok';
+                                       mysqli_query($conn,'INSERT INTO mail_lists(channel_name,channel_admin,channel_users) values("'.$_POST['newname'].'","'.$_POST['admin'].'","")');
+                                       echo '<br>Created';
+                                       mkdir($_POST['newname']);
+                                       mkdir($_POST['newname'].'/mails');
+                                       touch($_POST['newname'].'/index.php');
+                                       file_put_contents($_POST['newname'].'/index.php','<?php $type="GROUP"; ?>');
+                               }
+                               else{
+                                       header('Location: ../login.php');
+                               }
+                       }
+               }
+               else{
+                       echo 'Name is already using';
+               }
+       }
+       else{
+               header('Location: ../new_channel.php?info=<text>Please_provide_a_name</text>');
+       }
+}
+else{
+       header('Location: ../login.php');
+}
+
+?>
index 06a6837..08b915b 100644 (file)
@@ -6,18 +6,22 @@ error_reporting(E_ALL);
 
 include '../api/server_info.php';
 
-if (strpos('@',$_POST['mail'])){
-    header('../new_user.php?info='.L::new_aroba);
+if (strpos($_POST['mail'],'@') or strpos($_POST['mail'],'.') or strpos($_POST['mail'],'/')){
+    header('Location: ../new_user.php?info='.L::new_aroba);
 }
 elseif (isset($_POST['mail']) and isset($_POST['password'])){
     $conn=mysqli_connect($db_link,$db_user,$db_password,$db_name);
     $selfUrl=$_SERVER['HTTP_HOST'].preg_replace('/mailbox\/new_user.php/','',$_SERVER['PHP_SELF']);
+    $query=mysqli_query($conn,'CREATE TABLE mail (mail_user VARCHAR(150),mail_password VARCHAR(300))');
     $query=mysqli_query($conn,'SELECT mail_user FROM mail WHERE mail_user="'.$_POST['mail'].'@'.$selfUrl.'"');
     print_r($query);
     if (mysqli_connect_error()){
         http_response_code(500);
                header('Location: new_user.php?info=<text>DB_error</text>');
     }
+    elseif (strpos('.',$_POST['mail']) AND strpos('$',$_POST['mail']) AND strpos('@',$_POST['mail'])){
+        header('Location: new_user.php?info=<text>'.L::new_invalidchar.'</text>');
+    }
     elseif (mysqli_num_rows($query)==0){
         mkdir($_POST['mail']);
         mkdir($_POST['mail'].'/mails');
index c7f0844..24216f0 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+ini_set('display_errors',0);
+ini_set('display_initial_errors',0);
+header('Content-type: application/xml');
 function scan_dir($dir) {
     $ignored = array('.', '..', '.htaccess','index.php','getmail.php');
     $files = array();    
@@ -11,16 +14,21 @@ function scan_dir($dir) {
         return ($files) ? $files : false;
 }
 include '../api/functions.php';
+
 session_issruning();
 if (isloged()==1){
+    echo '<xml>';
     if (isset($_GET['box'])){
-        if (strpos($_GET['box'],'/') or strpos($_GET['box'],'..') or strpos($_GET['box'],'\\')){}
+        if (strpos($_GET['box'],'/')==True or strpos($_GET['box'],'.')==True or strpos($_GET['box'],'\\')==True){echo 'Dont make this hard';}
         else{
             if ($_GET['box']==''){$_GET['box']=='mails';}
-            echo 'Raw Box of '.preg_split('/@/',$_SESSION['m_user'])[0].'\\'.$_GET['box'].'\\<br>';
             foreach (scan_dir(getcwd().'\\'.preg_split('/@/',$_SESSION['m_user'])[0].'\\'.$_GET['box'].'\\') as $d){
                 include preg_split('/@/',$_SESSION['m_user'])[0].'\\'.$_GET['box'].'\\'.$d;
-                try{echo '<a href="getmail.php?box='.$_GET['box'].'&id='.$d.'">'.$sender.'</a> '.$date.'<br>';}catch (Exception $e){echo '<a href="getmail.php?id='.$d.'">'.$sender.'</a> <br>';}
+                echo '  <id id="'.$d.'">';
+                echo '      <box>'.$_GET['box'].'</box>';
+                echo '      <date>'.$date.'</date>';
+                echo '      <sender>'.$sender.'</sender>';
+                echo '  </id>';
             }
         }
     }
@@ -28,12 +36,16 @@ if (isloged()==1){
         foreach (scan_dir(getcwd().'\\'.preg_split('/@/',$_SESSION['m_user'])[0]) as $d){
             foreach (scan_dir(getcwd().'\\'.preg_split('/@/',$_SESSION['m_user'])[0].'\\'.$d.'\\') as $i){
                 include preg_split('/@/',$_SESSION['m_user'])[0].'\\'.$d.'\\'.$i;
-                echo '<a href="getmail.php?id='.$i.'">'.$sender.'</a> '.$date.' '.$d.'<br> ';
+                echo '  <id id="'.$i.'">';
+                echo '      <box>'.$d.'</box>';
+                echo '      <date>'.$date.'</date>'; 
+                echo '      <sender>'.$sender.'</sender>';
+                echo '  </id>';
             }
         }
     }
+    echo '</xml>';
 }
 else{
     header('Location: ../login.php');
-}
-?>
\ No newline at end of file
+}
\ No newline at end of file
index 5f37fa4..a1d5182 100644 (file)
 <?php 
+/** CREATES THE STRING ID */
 function string($length = 30) {
-    return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);} 
+    return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
+}
+/** INTERNAL MODULE */
+
+/** INCLUDING THE USER INFO */
+require $_POST['to'].'/index.php';
 
-if (isset($_POST['mail']) and $_POST['to'] and isset($_POST['html']) and isset($_POST['hash'])){
+/** Verifing the posted data */
+if (isset($_POST['mail']) and $_POST['to'] and isset($_POST['html']) and isset($_POST['hash']) and $type=='GROUP'){
+        /** Creating an array for send the data to the supposed server */
+    $mail=['mail'=>$_POST['mail'], 'hash'=>$_POST['hash'],'channel'=>preg_split('/@/',$_POST['to'])[0]];
+    /** Configuring cURL with an array */
+    $other=array(
+        CURLOPT_URL => 'https://'.preg_split('/@/',$_POST['mail'])[1].'/mailbox/user.php',
+        CURLOPT_POST => true,
+        CURLOPT_POSTFIELDS => $mail,
+        CURLOPT_RETURNTRANSFER => true,
+        CURLOPT_SSL_VERIFYPEER => false
+    );
+    /** INIT CURL */
+    $curl=curl_init();
+    /** SETTING THE ARRAY */
+    curl_setopt_array($curl, ($other));
+    /** RUN */
+    $out=curl_exec($curl);
+    /** CHEKING RESPONSE */
+    if (curl_error($curl)){
+        http_response_code(400);
+    }
+    else{
+        /** GETTING CODE */
+        $info=curl_getinfo($curl,CURLINFO_HTTP_CODE);
+           if ($info==200){
+            if (file_exists($_POST['to'].'/index.php')){
+                /** SAVING FILE */
+                               $date=date('d/m/Y H:i:s');
+                $content=$date=date('d/m/Y H:i:s');
+                file_put_contents(preg_split('/@/',$_POST['to'])[0].'/mails/'.(string()).'.php','<?php
+$date="'.$date.'";
+$chname="'.preg_split('/@/',$_POST['mail'])[0].'";
+$content="'.$_POST['html'].'";
+if (basename(__FILE__)==basename($_SERVER["SCRIPT_FILENAME"])){
+    include "../../../api/functions.php";
+    return_plant_group($content,$date,$chname);
+}
+?>');
+                http_response_code(200);
+            }
+            else{
+                http_response_code(404);
+            }
+        }
+        else{
+            echo $out;
+            http_response_code(500);
+        }
+    }
+    /** CLOSING */
+    curl_close($curl);
+}
+elseif (isset($_POST['mail']) and $_POST['to'] and isset($_POST['html']) and isset($_POST['hash']) and $type=='CHANNEL'){
+    /** Creating an array for send the data to the supposed server */
+    $mail=['mail'=>$_POST['mail'], 'hash'=>$_POST['hash'],'channel'=>preg_split('/@/',$_POST['to'])[0]];
+    /** Configuring cURL with an array */
+    $other=array(
+        CURLOPT_URL => 'https://'.preg_split('/@/',$_POST['mail'])[1].'/mailbox/ismch.php',
+        CURLOPT_POST => true,
+        CURLOPT_POSTFIELDS => $mail,
+        CURLOPT_RETURNTRANSFER => true,
+        CURLOPT_SSL_VERIFYPEER => false
+    );
+    /** INIT CURL */
+    $curl=curl_init();
+    /** SETTING THE ARRAY */
+    curl_setopt_array($curl, ($other));
+    /** RUN */
+    $out=curl_exec($curl);
+    /** CHEKING RESPONSE */
+    if (curl_error($curl)){
+        http_response_code(400);
+    }
+    else{
+        /** GETTING CODE */
+        $info=curl_getinfo($curl,CURLINFO_HTTP_CODE);
+           if ($info==200){
+            if (file_exists($_POST['to'].'/index.php')){
+                /** SAVING FILE */
+                               $date=date('d/m/Y H:i:s');
+                $content=$date=date('d/m/Y H:i:s');
+                file_put_contents(preg_split('/@/',$_POST['to'])[0].'/mails/'.(string()).'.php','<?php
+$date="'.$date.'";
+$chname="'.preg_split('/@/',$_POST['mail'])[0].'";
+$content="'.$_POST['html'].'";
+if (basename(__FILE__)==basename($_SERVER["SCRIPT_FILENAME"])){
+    include "../../../api/functions.php";
+    return_plant($content,$date,$chname);
+}
+?>');
+                http_response_code(200);
+            }
+            else{
+                http_response_code(404);
+            }
+        }
+        else{
+            echo $out;
+            http_response_code(500);
+        }
+    }
+    /** CLOSING */
+    curl_close($curl);
+}
+elseif (isset($_POST['mail']) and $_POST['to'] and isset($_POST['html']) and isset($_POST['hash'])){
+    /** Creating an array for send the data to the supposed server */
     $mail=['mail'=>$_POST['mail'], 'hash'=>$_POST['hash']];
+    /** Configuring cURL with an array */
     $other=array(
         CURLOPT_URL => 'https://'.preg_split('/@/',$_POST['mail'])[1].'/mailbox/user.php',
         CURLOPT_POST => true,
-        CURLOPT_SSLCERT => '',
         CURLOPT_POSTFIELDS => $mail,
-        CURLOPT_RETURNTRANSFER => true
+        CURLOPT_RETURNTRANSFER => true,
+        CURLOPT_SSL_VERIFYPEER => false
     );
+    /** INIT CURL */
     $curl=curl_init();
+    /** SETTING THE ARRAY */
     curl_setopt_array($curl, ($other));
+    /** RUN */
     $out=curl_exec($curl);
+    /** CHEKING RESPONSE */
     if (curl_error($curl)){
         http_response_code(400);
     }
     else{
+        /** GETTING CODE */
         $info=curl_getinfo($curl,CURLINFO_HTTP_CODE);
                echo $info;
            if ($info==200){
             if (file_exists($_POST['to'].'/index.php')){
+                /** SAVING FILE */
                                $date=date('d/m/Y H:i:s');
                 $content='<?php
-$html="'.'<!version=0.1>'.str_replace('"',"'",$_POST['html']).'";
+$html="'.str_replace('"',"'",$_POST['html']).'";
 $sender="'.$_POST['mail'].'";
 $date="'.$date.'";
 ?>';
@@ -40,6 +159,7 @@ $date="'.$date.'";
             http_response_code(500);
         }
     }
+    /** CLOSING */
     curl_close($curl);
 }
 else{
index 45e882d..e7ac54f 100644 (file)
@@ -1,12 +1,15 @@
 <?php
+/** BASIC INIT */
 include '../api/functions.php';
 session_issruning();
 $log=isloged();
 if ($log==1 and isset($_GET['folder'])){
     if ($_GET['folder']=='mails' or $_GET['folder']=='readed'){
+        /** Protected Folders */
         echo 'You cannot delete the mailbox '.$_GET['folder'];
     }
     elseif (is_dir(preg_split('/@/',$_SESSION['m_user'])[0].'/'.$_GET['folder'])){
+        /** Recursive deletion to the folder */
         $dir=preg_split('/@/',$_SESSION['m_user'])[0].'/'.$_GET['folder'];
         $it = new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS);
         $files = new RecursiveIteratorIterator($it,
@@ -22,11 +25,13 @@ if ($log==1 and isset($_GET['folder'])){
         echo 'Folder deleted';
     }
     else{
+        /** Informs to the user, what that folder not exists */
         echo 'Folder not exists';
     }
 }
 else{
     if ($log==0){
+        /** If you not are login redirect or more knowledge with 301-302 HTTP ERROR*/
         header('Location: ../login.php');
     }
     else{}
index d073457..347274f 100644 (file)
@@ -8,6 +8,7 @@ include '../i18n.class.php'; $i18n = new i18n('../lang/lang_{LANGUAGE}.ini'); $i
 include '../api/functions.php';
 if (isset($_POST['content']) and isset($_POST['mail_r'])){
     session_issruning();
+    $_POST['content']=str_replace('\n','<br>',$_POST['content']);
     if (isloged()==1){
         $split=preg_split('/@/',$_POST['mail_r']);
         $cnt=count($split);
@@ -19,7 +20,8 @@ if (isset($_POST['content']) and isset($_POST['mail_r'])){
                 CURLOPT_URL => 'https://'.$split[1].'mailbox/reicive.php',
                 CURLOPT_POST => true,
                 CURLOPT_POSTFIELDS => $mail,
-                CURLOPT_RETURNTRANSFER => true
+                CURLOPT_RETURNTRANSFER => true,
+                CURLOPT_SSL_VERIFYPEER => false
             );
             echo 'Sending sm to the url '.$split[1];
             echo '<br> and to the mail id '.$split[0];
@@ -49,14 +51,15 @@ if (isset($_POST['content']) and isset($_POST['mail_r'])){
                 CURLOPT_URL => 'https://'.$selfUrl.'mailbox/reicive.php',
                 CURLOPT_POST => true,
                 CURLOPT_POSTFIELDS => $mail,
-                CURLOPT_RETURNTRANSFER => true
+                CURLOPT_RETURNTRANSFER => true,
+                CURLOPT_SSL_VERIFYPEER => false
             );
             echo 'Sending sm to the url '.$selfUrl;
             echo '<br> and to the mail id '.$split[0];
             $curl=curl_init();
             curl_setopt_array($curl, ($other));
             $out=curl_exec($curl);
-            echo curl_error($curl);
+            echo $out;
             if (curl_error($curl)){
                 header('Location: mailb.php?info=<text>'.L::errors_sslerror.'</text>');
             }
@@ -66,7 +69,7 @@ if (isset($_POST['content']) and isset($_POST['mail_r'])){
                                        header('Location: mailb.php?info=<text>'.L::errors_nonerror.'</text>');
                 }
                 else{
-                       header('Location: mailb.php?info=<text>'.L::errors_iderror_not.'</text>');
+                       header('Location: mailb.php?info=<text>'.L::errors_iderror_not.'</text>'.$out);
                 }
             }
         }
index 94876a3..65155d2 100644 (file)
@@ -10,7 +10,13 @@ if (isset($_POST['mail'])){
             http_response_code(200);
         }
         else{
-            http_response_code(400);
+                       $query=mysqli_query($conn,'SELECT channel_name FROM mail_lists WHERE channel_name="'.$_POST['mail'].'"');
+                       if (gettype($query=='boolean')){
+                               http_response_code(400);
+                       }
+                       else{
+                               http_response_code(200);
+                       }
         }
     }
     else{
@@ -21,4 +27,4 @@ else{
     http_response_code(400);
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/mailbox/xmlmail.php b/mailbox/xmlmail.php
new file mode 100644 (file)
index 0000000..75bdf91
--- /dev/null
@@ -0,0 +1,35 @@
+<xml>
+        <?php
+        header('Content-type: application/xml');
+        require '../api/functions.php';
+        session_issruning();
+        if (isloged()==1){
+            if (isset($_GET['box']) and strpos($_GET['box'],'..')==false and strpos($_GET['box'],'\\')==false and strpos($_GET['box'],'/')==false){
+                if (isset($_GET['delthem'])){
+                    if (strpos($_GET['delthem'],'/') or strpos($_GET['delthem'],'..') or strpos($_GET['delthem'],'\\')){}
+                    else{
+                        try{unlink(preg_split('/@/',$_SESSION['m_user'])[0].'/'.$_GET['box'].'/'.$_GET['delthem']);echo '   <info>Deleted</info>';}catch(Exception $e){echo '   <info>ID Invalid</info>';}
+                    }
+                }
+                elseif(isset($_GET['id'])){
+                    try{include preg_split('/@/',$_SESSION['m_user'])[0].'/'.$_GET['box'].'/'.$_GET['id']; echo '<box>'.$_GET['box'].'</box>';echo '   <data>'.str_replace('<','&lt;',$html).'</data>';echo '  <sender>'.$sender.'</sender>';echo '  <date>'.$date.'</date>';}catch (Exception $e){echo '   <info>ID Invalid</info>';}
+                }
+            }
+            else{
+                if (isset($_GET['delthem'])){
+                    if (strpos($_GET['delthem'],'/') or strpos($_GET['delthem'],'..') or strpos($_GET['delthem'],'\\')){}
+                    else{
+                        try{unlink(preg_split('/@/',$_SESSION['m_user'])[0].'/mails/'.$_GET['delthem']);echo '  <info>Succes</info>';}catch(Exception $e){echo '    <info>ID Invalid</info>';}
+                    }
+                }
+                elseif(isset($_GET['id'])){
+                    try{include preg_split('/@/',$_SESSION['m_user'])[0].'/mails/'.$_GET['id'];echo '   <data>'.str_replace('<','&lt;',$html).'</data>';echo '  <sender>'.$sender.'</sender>';echo '  <date>'.$date.'</date>';}catch (Exception $e){echo '  <info>ID Invalid</info>';}
+                }
+            }
+        }
+        else{
+            http_response_code(404);
+        }
+
+        ?>
+</xml>
diff --git a/map.php b/map.php
new file mode 100644 (file)
index 0000000..4b10738
--- /dev/null
+++ b/map.php
@@ -0,0 +1,12 @@
+    <head>
+        <link rel='stylesheet' type='text/css' href='css/all.css'>
+    </head>
+    <body>
+        <?php
+        $xmlDoc=simplexml_load_file('sitemap.xml');
+        foreach ($xmlDoc as $node){
+            echo '<a href="'.$node->link.'">'.$node->name.'</a><br>';
+        }
+        ?>
+    </body>
+</html>
\ No newline at end of file
diff --git a/new_channel.php b/new_channel.php
new file mode 100644 (file)
index 0000000..cfc42f6
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+include 'api/functions.php';
+session_issruning();
+if (isloged()==0){
+    header('Location: login.php');
+}
+
+?>
+<?php include 'i18n.class.php'; $i18n = new i18n(); $i18n->init();?>
+<html>
+    <head>
+        <link type='text/css' rel='stylesheet' href='css/all.css'/>
+        <link type='text/css' rel='stylesheet' href='css/send.css'/>
+        <style type='text/css'>
+        input{
+            display: block;
+        }
+        </style>
+    </head>
+    <body>
+        <form action='mailbox/new_channel.php' method='POST'>
+            <input type="text" name="newname" placeholder="Name">
+            <input type="hidden" name="admin" value="<?php echo $_SESSION['m_user'];?>">
+            <input class='submit' type="submit" value=<?php echo L::send_send;?>>
+        </form>
+    </body>
+</html>
diff --git a/new_group.php b/new_group.php
new file mode 100644 (file)
index 0000000..bc7c86c
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+include 'api/functions.php';
+session_issruning();
+if (isloged()==0){
+    header('Location: login.php');
+}
+
+?>
+<?php include 'i18n.class.php'; $i18n = new i18n(); $i18n->init();?>
+<html>
+    <head>
+        <link type='text/css' rel='stylesheet' href='css/all.css'/>
+        <link type='text/css' rel='stylesheet' href='css/send.css'/>
+        <style type='text/css'>
+        input{
+            display: block;
+        }
+        </style>
+    </head>
+    <body>
+        <form action='mailbox/new_group.php' method='POST'>
+            <input type="text" name="newname" placeholder="Name">
+            <input type="hidden" name="admin" value="<?php echo $_SESSION['m_user'];?>">
+            <input class='submit' type="submit" value=<?php echo L::send_send;?>>
+        </form>
+    </body>
+</html>
index a7caecd..00ae4ac 100644 (file)
@@ -2,7 +2,7 @@
 include 'api/functions.php';
 session_issruning();
 if (isloged()==0){
-    header('Location: login.html');
+    header('Location: login.php');
 }
 
 ?>
diff --git a/sitemap.xml b/sitemap.xml
new file mode 100644 (file)
index 0000000..6f56604
--- /dev/null
@@ -0,0 +1,78 @@
+<xml>
+    <page>
+        <name>Index</name>
+        <link>index.php</link>
+    </page>
+    <page>
+        <name>MailB Web SMail Manager</name>
+        <link>mailbox/mailb.php</link>
+    </page>
+    <page>
+        <name>Register User</name>
+        <link>new_user.php</link>
+    </page>
+    <page>
+        <name>Change Password</name>
+        <link>ch_p.php</link>
+    </page>
+    <page>
+        <name>Register Channel</name>
+        <link>new_channel.php</link>
+    </page>
+    <page>
+        <name>Register Group</name>
+        <link>new_group.php</link>
+    </page>
+    <page>
+        <name>Send Message</name>
+        <link>send_m.php</link>
+    </page>
+    <page>
+        <name>Login</name>
+        <link>login.php</link>
+    </page>
+    <page> 
+        <name>User Exists Script</name>
+        <link>mailbox/user.php</link>
+    </page>
+    <page>
+        <name>Send Script</name>
+        <link>mailbox/send.php</link>
+    </page>
+    <page>
+        <name>Remove Mailbox Script</name>
+        <link>mailbox/remove_mf.php</link>
+    </page>
+    <page>
+        <name>XMLMail Script</name>
+        <link>mailbox/xmlmail.php</link>
+    </page>
+    <page>
+        <name>Reicive Script</name>
+        <link>mailbox/reicive.php</link>
+    </page>
+    <page>
+        <name>XML Raw Mails Script</name>
+        <link>mailbox/raw_mails.php</link>
+    </page>
+    <page>
+        <name>Move Script</name>
+        <link>mailbox/move.php</link>
+    </page>
+    <page>
+        <name>ISMYCHANNEL Script</name>
+        <link>mailbox/ismch.php</link>
+    </page>
+    <page>
+        <name>XMLGETMAIL Script</name>
+        <link>mailbox/getmail.php</link>
+    </page>
+    <page>
+        <name>Create Mailbox Folder Script</name>
+        <link>mailbox/create_mf.php</link>
+    </page>
+    <page>
+        <name>Change Password Script</name>
+        <link>mailbox/change_p.php</link>
+    </page>
+</xml>
\ No newline at end of file