Faster Update, fixing bugs
authorborisd93 <borisdanielmm@nauta.cu>
Sat, 1 May 2021 01:25:15 +0000 (21:25 -0400)
committerborisd93 <borisdanielmm@nauta.cu>
Sat, 1 May 2021 01:25:15 +0000 (21:25 -0400)
21 files changed:
README.md [deleted file]
api/login.php
api/server_info.php
css/all.css
css/mailbox.css
css/send.css
index.php
lang/lang_en.ini
lang/lang_es.ini
login.html [deleted file]
login.php
mailbox/change_p.php
mailbox/create_mf.php
mailbox/mailb.php
mailbox/move.php
mailbox/new_user.php
mailbox/raw_mails.php
mailbox/reicive.php
mailbox/remove_mf.php
mailbox/send.php
new_user.php

diff --git a/README.md b/README.md
deleted file mode 100644 (file)
index 5f5d94e..0000000
--- a/README.md
+++ /dev/null
@@ -1,22 +0,0 @@
-# SMail
-
-`SMail the Mail of the future`
-
-**What pretends SMail?**
-
-SMail is a communication method, very different of the classic mail system. 
-
-# Characteristics
-
-- Easy to use and install
-- Secure Mails and, you obligatory need a valid server to send mails, you not can send a message with a non-existing host.
-- Very new and multiplatform
-- Open Source
-- We have now 2 official instance
-- Its a best way for have security and we have compatibility with symbian and other systems
-
-# Donations
-
-[Programmer](https://liberapay.com/edkz)
-
-We need the donations because in my country the internet are very slow and limited
\ No newline at end of file
index 601728f..2786af3 100644 (file)
@@ -47,6 +47,6 @@ if (isset($_POST['mail']) and isset($_POST['password'])){
     }
 }
 else{
-    echo json_encode('{code: 400}');
+    header('Location: ../login.php');
 }
 ?>
index f122429..8ff5307 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-$db_name='mail';
+$db_name='';
 $db_user='';
 $db_password='';
 $db_link='';
index cd23df0..67f6e04 100644 (file)
@@ -15,6 +15,9 @@ h1,text{
     color: white;
     font-family: Bahnschrift;
 }
+text{
+    font-size: 25px;
+}
 a{
     font-family: Bahnschrift;
     color: yellowgreen;
@@ -28,4 +31,7 @@ a:hover{
     text,h1,a,input,textarea{
         font-size: 40px;
     }
+}
+body{
+    padding: 20px;
 }
\ No newline at end of file
index e69de29..3fb74cc 100644 (file)
@@ -0,0 +1,27 @@
+body{
+    padding: 1%;
+}
+h1{
+    padding: 0px;
+    margin: 0px;
+}
+.go{
+    float: right;
+    padding-right: 1%;
+}
+
+/** Mobile **/
+@media (orientation:portrait){
+    h1{
+        font-size: 20px;
+    }
+    .go{
+        float: none;
+    }
+    text{
+        font-size: 20px;
+    }
+    .mail text,a{
+        font-size: 20px;
+    }
+}
index ab77d60..2c1b778 100644 (file)
@@ -17,4 +17,19 @@ input{
 }
 .center{
     border-radius: 0px;
+}
+@media (orientation: portrait){
+    body{
+        padding-left: 10%;
+        padding-right: 10%;
+    }
+    text{
+        font-size: 20px;
+    }
+}
+@media (orientation: landscape){
+    body{
+        padding-left: 40%;
+        padding-right: 40%;
+    }
 }
\ No newline at end of file
index 85eb192..75c315e 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,14 +1,14 @@
-<!-- {instance:Smail,version:0.3} --->
-<?php include 'i18n.class.php'; $i18n = new i18n(); $i18n->init(); include 'api/server_info.php';?>
+<!-- {instance:Smail,version:0.2} --->
+<?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 type='text/css' rel='stylesheet' href='css/all.css'/>
+        <link type='text/css' rel='stylesheet' href='css/all.css?v=1'/>
     </head>
     <body style='margin: 0px;'>
         <div style='color: white; background: #30303c; padding: 1%;'>
-            <h1 style='margin: 0px;'><?php echo L::index_welcome; echo " ". $instance_name;?></h1>
+            <h1 style='margin: 0px;'><?php echo L::index_welcome;?></h1>
             <hr>
         </div>
         <div style='color: white; background: #30303c; padding: 1%;'>
index cdc0456..6adeaf0 100644 (file)
@@ -1,38 +1,45 @@
 [index]
-welcome = "Welcome to the instance"
+welcome = "SecureMail"
 register = 'How i can create my own account?'
 about = "What is SMail?"
 how = "How i can use it?"
 where = "Where i found the code?"
+bug = "I founded an error, where i can report it?"
 license = "What's its the license of SMail"
 register_c = "You can register your own account <a href='new_user.php'>here</a>"
 about_c = "SMail is a web based mail, easy to install and use"
 how_c = "You can login here <a href='login.php'>here</a> and if you now are login you can send messages <a href='send_m.php'>here</a> and see your mailbox <a href='mailbox/mailb.php'>here</a>"
 where_c= "Project Code on <a href='https://reisub.nsupdate.info/git/?p=smail.git/.git;a=summary'>Git</a>"
+bug_c = "If you founded an error report it <a href='https://reisub.nsupdate.info/bugs/'>here</a>"
 license_c = "SMail was Licensed by GPL V3, The complete name of the project is Secure Mail."
 [login]
 incorrect = "The_user_or_the_password_are_incorrect"
 correct = "Loged succefully"
-postlogin_submit = "Sign in"
+submit = "Sign in"
 [send]
 content = "Content"
 send = "Send"
 [mbox]
 dhave = "You dont have any message's"
-note = "<b>Note:</b> The horarie zone of this server are UTC 3"
-send = "Send a message"
+note = "<b>Note:</b> The horarie zone of this server are UTC-3"
+send = "New SMail"
 change = "Change password"
 or = "or"
-[gmail]
+[gmail] # Getmail not Google Mail
 sender = "Sender"
 content = "Contenido"
 success = "Success"
 return = "Return"
 read = "Mark as read"
 invalid_id = "Invalid ID"
-or = "or"
+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"
 [reg]
-submit = "Sign up"
\ No newline at end of file
+submit = "Sign up"
+[errors]
+nonerror = "This SMail sended"
+iderror_not = "This SMail dont exists"
+sslerror = "A error as ocurred while sending message because the server was invalid or haves an bad ssl"
index 5ebeaa6..14aea58 100644 (file)
@@ -1,29 +1,31 @@
 [index]
-welcome = "Bienvenido a la instancia"
+welcome = "SecureMail"
 register = "¿Como me registro?"
 about = "¿Que es SMail?"
 how = "¿Como puedo usar SMail?"
 where = "¿Donde puedo encontrar el codigo?"
+bug = "¿Encontre un error, donde lo reporto?"
 license = "¿Cual es la licencia de SMail?"
 register_c = "Puedes registrarte <a href='new_user.php'>aqui</a>"
 about_c = "SMail es un protocolo de email basado en web, facil de instalar y usar"
 how_c = "Puedes iniciar sesion <a href='login.php'>aqui</a> y si ya estas logeado puedes mandar mensajes <a href='send_m.php'>aqui</a> y ver tu mailbox <a href='mailbox/mailb.php'>aqui</a>"
 where_c= "Codigo del proyecto en <a href='https://reisub.nsupdate.info/git/?p=smail.git/.git;a=summary'>Git</a>"
+bug_c = "Si has encontrado un error reportalo aqui, <a href='https://reisub.nsupdate.info/bugs/'>bugs</a>"
 license_c = "SMail esta licenciado bajo GPL Version 3, el nombre completo del proyecto es Secure Mail"
 [login]
 incorrect = "El_usuario_o_la_contraseña_no_son_correctos"
 correct = "Logeado correctamente"
-postlogin_submit = "Iniciar sesion"
+submit="Iniciar sesion"
 [send]
 content = "Contenido"
 send = "Enviar"
 [mbox]
 dhave = "No tienes ningun mensaje"
-note = "<b>Nota:</b> La zona horaria de este servidor es UTC 3"
-send = "Mandar un mensaje"
+note = "<b>Nota:</b> La zona horaria de este servidor es UTC-3"
+send = "Nuevo SMail"
 change = "Cambiar contraseña"
-or = "o"
-[gmail]
+or = "/"
+[gmail] # Getmail no gmail de google
 sender = "Desde"
 content = "Contenido"
 success = "Finalizado Correctamente"
@@ -33,5 +35,10 @@ 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"
 [reg]
-submit = "Registrar"
\ No newline at end of file
+submit = "Registrar"
+[errors]
+nonerror = "SMail enviado"
+iderror_not = "SMail no enviado porque el id no existe"
+sslerror = "SMail no enviado porque el servidor receptor no existe o no tiene ssl"
diff --git a/login.html b/login.html
deleted file mode 100644 (file)
index caa37ee..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<html>
-    <head>
-        <title>Login Smail</title>
-        <link type='text/css' rel='stylesheet' href='css/send.css?v=1'/>
-        <link type='text/css' rel='stylesheet' href='css/all.css?v=2'/>
-        <style type='text/css'>
-        input{
-            display: block;
-        }
-        </style>
-    </head>
-    <body>
-        <form action='api/login.php' method='POST'>
-            <input type="text" name="mail" id="mail" placeholder="Mail">
-            <input type="password" name="password" class='center' id="" placeholder="Password">
-            <input type="submit" value="Sign in" class='submit'>
-        </form>
-    </body>
-</html>
\ No newline at end of file
index 1f34477..ca835eb 100644 (file)
--- a/login.php
+++ b/login.php
@@ -1,9 +1,15 @@
+<?php
+ini_set('display_errors',1);
+ini_set('display_initial_errors',1);
+error_reporting(E_ALL);?>
 <?php include 'i18n.class.php'; $i18n = new i18n(); $i18n->init();?>
 <html>
     <head>
         <title>Login Smail</title>
-        <link type='text/css' rel='stylesheet' href='css/send.css?v=1'/>
-        <link type='text/css' rel='stylesheet' href='css/all.css?v=2'/>
+        <!-----Alls------>
+        <link type='text/css' rel='stylesheet' href='css/all.css?v=4'/>
+        <!--Sends Pages-->
+        <link type='text/css' rel='stylesheet' href='css/send.css?v=2'/>
         <style type='text/css'>
         input{
             display: block;
@@ -19,7 +25,7 @@
         <form action='api/login.php' method='POST'>
             <input type="text" name="mail" id="mail" placeholder="Mail">
             <input type="password" name="password" class='center' id="" placeholder="Password">
-            <input type="submit" value=<?php echo L::login_postlogin_submit;?> class='submit'>
+            <input type="submit" value=<?php echo L::login_submit;?> class='submit'>
         </form>
     </body>
-</html>
\ No newline at end of file
+</html>
index 530e80e..b1e3eb6 100644 (file)
@@ -9,15 +9,14 @@ if (isset($_POST['old']) and isset($_POST['new'])){
     print_r($i);
     if (password_verify($_POST['old'],$i['mail_password'])){
         $query=mysqli_query($conn,'UPDATE mail SET mail_password="'.password_hash($_POST['new'],PASSWORD_DEFAULT).'" where mail_user="'.$_SESSION['m_user'].'"');
-        header('Location: ../login.html');
+        header('Location: ../login.php');
     }
     else{
-        echo 'F';
-        http_response_code(404);
+        header('Location: ../ch_p.php');
     }
 }
 else{
-    http_response_code(404);
+    header('Location: ../ch_p.php');
 }
 
 ?>
\ No newline at end of file
index 3d27ba3..a0aa9e8 100644 (file)
@@ -12,7 +12,7 @@ if ($log==1 and isset($_GET['folder'])){
 }
 else{
     if ($log==0){
-        header('Location: ../login.html');
+        header('Location: ../login.php');
     }
     else{}
 }
\ No newline at end of file
index d75f06a..4209568 100644 (file)
@@ -1,8 +1,11 @@
 <?php
+ini_set('display_errors',1);
+ini_set('display_initial_errors',1);
+error_reporting(E_ALL);
 require '../api/functions.php';
 session_issruning();
 if (isloged()==0){
-    header('Location: ../login.html');
+    header('Location: ../login.php');
     die();
 }
 ?>
@@ -10,7 +13,7 @@ if (isloged()==0){
 <html>
     <head>
         <link type='text/css' rel='stylesheet' href='../css/all.css'/>
-        <link type='text/css' rel='stylesheet' href='../css/mailbox.css'/>
+        <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>
@@ -38,7 +41,7 @@ if (isloged()==0){
                         foreach ($dirs as $i){
                             $date='';
                             include preg_split('/@/',$_SESSION['m_user'])[0].'/mails/'.$i;
-                            echo '<span class="mail"><a href="getmail.php?box='.$_GET['box'].'&id='.$i.'">'.$sender.'</a> <text>'.$date.'</text> <a href="getmail.php?delthem='.$i.'">Delete</a></span><br>
+                            echo '<span class="mail"><a href="getmail.php?box='.$_GET['box'].'&id='.$i.'">'.$sender.'</a> <text>'.str_replace('-','/',$date).'</text> <a href="getmail.php?delthem='.$i.'">Delete</a></span><br>
 ';
                         }
                     }
@@ -50,7 +53,7 @@ if (isloged()==0){
                     foreach ($dirs as $i){
                         $date='';
                         include preg_split('/@/',$_SESSION['m_user'])[0].'/mails/'.$i;
-                        echo '<span class="mail"><a href="getmail.php?id='.$i.'">'.$sender.'</a> <text>'.$date.'</text> <a href="getmail.php?delthem='.$i.'">Delete</a></span><br>
+                        echo '<span class="mail"><a href="getmail.php?id='.$i.'">'.$sender.'</a> <div class="go"><text>'.str_replace('-','/',$date).'</text> <a href="getmail.php?delthem='.$i.'">Delete</a></div></span><br>
 ';
                     }
                 }
index 9043d73..3bfa86e 100644 (file)
@@ -25,5 +25,5 @@ if (isloged()==1){
     }
 }
 else{
-    header('Location: ../login.html');
+    header('Location: ../login.php');
 }
\ No newline at end of file
index ba1cec2..06a6837 100644 (file)
@@ -1,20 +1,28 @@
 <?php include '../i18n.class.php'; $i18n = new i18n('../lang/lang_{LANGUAGE}.ini'); $i18n->init();?>
 <?php
+ini_set('display_errors',1);
+ini_set('display_initial_errors',1);
+error_reporting(E_ALL);
 
 include '../api/server_info.php';
 
-if (isset($_POST['mail']) and isset($_POST['password'])){
+if (strpos('@',$_POST['mail'])){
+    header('../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,'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 (mysqli_num_rows($query)==0){
         mkdir($_POST['mail']);
         mkdir($_POST['mail'].'/mails');
         mkdir($_POST['mail'].'/readed');
+               touch($_POST['mail'].'/index.php');
         $query=mysqli_query($conn,'INSERT INTO mail(mail_user,mail_password) VALUES("'.$_POST['mail']."@".$selfUrl.'","'.password_hash($_POST['password'],PASSWORD_DEFAULT).'")');
         header('Location: ../login.php?info=<text>'.L::new_user.' '.$_POST['mail'].'@'.$selfUrl.'</text>');
     }
@@ -25,4 +33,4 @@ if (isset($_POST['mail']) and isset($_POST['password'])){
 else{
     header('Location: ../index.php');
 }
-?>
\ No newline at end of file
+?>
index 47eea72..c7f0844 100644 (file)
@@ -34,6 +34,6 @@ if (isloged()==1){
     }
 }
 else{
-    header('Location: ../login.html');
+    header('Location: ../login.php');
 }
 ?>
\ No newline at end of file
index 6c00a17..5f37fa4 100644 (file)
@@ -7,6 +7,7 @@ if (isset($_POST['mail']) and $_POST['to'] and isset($_POST['html']) and isset($
     $other=array(
         CURLOPT_URL => 'https://'.preg_split('/@/',$_POST['mail'])[1].'/mailbox/user.php',
         CURLOPT_POST => true,
+        CURLOPT_SSLCERT => '',
         CURLOPT_POSTFIELDS => $mail,
         CURLOPT_RETURNTRANSFER => true
     );
@@ -21,9 +22,9 @@ if (isset($_POST['mail']) and $_POST['to'] and isset($_POST['html']) and isset($
                echo $info;
            if ($info==200){
             if (file_exists($_POST['to'].'/index.php')){
-                               $date=date('Y-m-d H:i:s');
+                               $date=date('d/m/Y H:i:s');
                 $content='<?php
-$html="'.'<!version=0.1>'.str_replace("'",'"',$_POST['html']).'";
+$html="'.'<!version=0.1>'.str_replace('"',"'",$_POST['html']).'";
 $sender="'.$_POST['mail'].'";
 $date="'.$date.'";
 ?>';
index 93d7071..45e882d 100644 (file)
@@ -27,7 +27,7 @@ if ($log==1 and isset($_GET['folder'])){
 }
 else{
     if ($log==0){
-        header('Location: ../login.html');
+        header('Location: ../login.php');
     }
     else{}
 }
\ No newline at end of file
index da04d1e..d073457 100644 (file)
@@ -1,4 +1,10 @@
 <?php
+ini_set('display_errors',1);
+ini_set('display_initial_errors',1);
+error_reporting(E_ALL);
+include '../i18n.class.php'; $i18n = new i18n('../lang/lang_{LANGUAGE}.ini'); $i18n->init();
+?>
+<?php
 include '../api/functions.php';
 if (isset($_POST['content']) and isset($_POST['mail_r'])){
     session_issruning();
@@ -22,16 +28,15 @@ if (isset($_POST['content']) and isset($_POST['mail_r'])){
             $out=curl_exec($curl);
             echo curl_error($curl);
             if (curl_error($curl)){
-                echo json_encode('{end: 400}');
+                header('Location: mailb.php?info=<text>'.L::errors_sslerror.'</text> '.curl_error($curl));
             }
             else{
                 $info=curl_getinfo($curl,CURLINFO_HTTP_CODE);
-                               echo $info;
                 if ($info==200){
-                    echo json_encode('{code:200, detail=mail sended}');
+                       header('Location: mailb.php?info=<text>'.L::errors_nonerror.'</text>');
                 }
                 else{
-                    echo json_encode('{code:404, detail=error}');
+                                       header('Location: mailb.php?info=<text>'.L::errors_iderror_not.'</text>');
                 }
             }
         }
@@ -53,24 +58,21 @@ if (isset($_POST['content']) and isset($_POST['mail_r'])){
             $out=curl_exec($curl);
             echo curl_error($curl);
             if (curl_error($curl)){
-                echo json_encode('{end: 400}');
+                header('Location: mailb.php?info=<text>'.L::errors_sslerror.'</text>');
             }
             else{
-                echo $out;
                 $info=curl_getinfo($curl,CURLINFO_HTTP_CODE);
-                echo $info;
-                echo $out;
                 if ($info==200){
-                    echo json_encode('{code:200, detail=mail sended}');
+                                       header('Location: mailb.php?info=<text>'.L::errors_nonerror.'</text>');
                 }
                 else{
-                    echo json_encode('{code:404, detail=error}');
+                       header('Location: mailb.php?info=<text>'.L::errors_iderror_not.'</text>');
                 }
             }
         }
     }
     else{
-        echo json_encode('{code:500, detail=unknow login}');
+        header('Location: ../login.php');
     }
 }
 
index 9a8d31f..bf97df0 100644 (file)
@@ -1,7 +1,4 @@
 <?php include 'i18n.class.php'; $i18n = new i18n(); $i18n->init();?>
-<?php include 'api/server_info.php';
-$conn=mysqli_connect($db_link,$db_user,$db_password,$db_name);
-$query=mysqli_query($conn,"CREATE TABLE mail(mail_user,mail_password)");?>
 <html>
     <head>
         <title>Register Smail</title>