0.3 First Public Versiob
authorborisd93 <borisdanielmm@nauta.cu>
Sun, 25 Apr 2021 13:56:22 +0000 (09:56 -0400)
committerborisd93 <borisdanielmm@nauta.cu>
Sun, 25 Apr 2021 13:56:22 +0000 (09:56 -0400)
30 files changed:
.none [deleted file]
README.md
api/functions.php [new file with mode: 0644]
api/login.php [new file with mode: 0644]
api/server_info.php [new file with mode: 0644]
ch_p.php [new file with mode: 0644]
css/all.css [new file with mode: 0644]
css/index.css [new file with mode: 0644]
css/mailbox.css [new file with mode: 0644]
css/send.css [new file with mode: 0644]
i18n.class.php [new file with mode: 0644]
index.php [new file with mode: 0644]
lang/lang_en.ini [new file with mode: 0644]
lang/lang_es.ini [new file with mode: 0644]
login.html [new file with mode: 0644]
login.php [new file with mode: 0644]
mailbox/change_p.php [new file with mode: 0644]
mailbox/create_mf.php [new file with mode: 0644]
mailbox/getmail.php [new file with mode: 0644]
mailbox/index.php [new file with mode: 0644]
mailbox/mailb.php [new file with mode: 0644]
mailbox/move.php [new file with mode: 0644]
mailbox/new_user.php [new file with mode: 0644]
mailbox/raw_mails.php [new file with mode: 0644]
mailbox/reicive.php [new file with mode: 0644]
mailbox/remove_mf.php [new file with mode: 0644]
mailbox/send.php [new file with mode: 0644]
mailbox/user.php [new file with mode: 0644]
new_user.php [new file with mode: 0644]
send_m.php [new file with mode: 0644]

diff --git a/.none b/.none
deleted file mode 100644 (file)
index 621e94f..0000000
--- a/.none
+++ /dev/null
@@ -1 +0,0 @@
-none
index ddaf173..5f5d94e 100644 (file)
--- a/README.md
+++ b/README.md
@@ -12,5 +12,11 @@ SMail is a communication method, very different of the classic mail system.
 - 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
 - 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 1 official instance
+- 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
diff --git a/api/functions.php b/api/functions.php
new file mode 100644 (file)
index 0000000..f27d40a
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+include 'server_info.php';
+
+function session_issruning(){
+    if ((isset($_SESSION['m_user']))==False){
+        session_start();
+    }
+}
+
+function isloged(){
+    global $conn;global $db_name,$db_user,$db_password,$db_link;
+    if (isset($_SESSION['m_user']) and isset($_SESSION['m_password'])){
+        $conn=mysqli_connect($db_link,$db_user,$db_password,$db_name);
+        $query=mysqli_query($conn,'SELECT mail_user,mail_password FROM mail');
+        $cnt=mysqli_num_rows($query);
+        $count=0;
+        $count=0;
+        $selfUrl=$_SERVER['HTTP_HOST'].preg_split('/mailbox|send_m.php/',$_SERVER['PHP_SELF'])[0];
+        while ($i=mysqli_fetch_array($query,MYSQLI_ASSOC)){
+            if ($_SESSION['m_user']==$i['mail_user'] or $_SESSION['m_user'].'@'.$selfUrl==$i['mail_user']){
+                if (password_verify($_SESSION['m_password'],$i['mail_password'])){
+                    return 1;
+                }
+                else{
+                    return 0;
+                }
+            }
+            else{
+                $count=$count+1;
+                if ($count==$cnt){
+                    return 0;
+                    break;
+                }
+            }
+        }
+    }
+    else{
+        return 0;
+    }
+}
+?>
diff --git a/api/login.php b/api/login.php
new file mode 100644 (file)
index 0000000..601728f
--- /dev/null
@@ -0,0 +1,52 @@
+<?php
+include 'functions.php';
+include 'server_info.php';
+session_issruning();
+if (isset($_POST['mail']) and isset($_POST['password'])){
+    $conn=mysqli_connect($db_link,$db_user,$db_password,$db_name);
+    $query=mysqli_query($conn,'SELECT mail_user,mail_password FROM mail');
+    $cnt=mysqli_num_rows($query);
+    $count=0;
+    $selfUrl=$_SERVER['HTTP_HOST'].preg_replace('/api\/login.php/','',$_SERVER['PHP_SELF']);
+    while ($i=mysqli_fetch_array($query,MYSQLI_ASSOC)){
+        if($_POST['mail'].'@'.$selfUrl==$i['mail_user']){
+            if (password_verify($_POST['password'],$i['mail_password'])){
+                echo json_encode('{password:200}');
+                $_SESSION['m_user']=$_POST['mail'].'@'.$selfUrl;
+                $_SESSION['m_password']=$_POST['password'];
+                header('Location: ../mailbox/mailb.php?info=<text>Succefully_Loged</text>');
+            }
+            else{
+                http_response_code(404);
+                echo json_encode('{password:404}');
+                header('Location: ../login.php?info=<text>The_user_or_password_was_incorrect</text>');
+            }
+        }
+        elseif ($_POST['mail']==$i['mail_user']){
+            if (password_verify($_POST['password'],$i['mail_password'])){
+                echo json_encode('{password:200}');
+                $_SESSION['m_user']=$_POST['mail'];
+                $_SESSION['m_password']=$_POST['password'];
+                               header('Location: ../mailbox/mailb.php?info=<text>Succefully_Loged</text>');
+            }
+            else{
+                http_response_code(404);
+                echo json_encode('{password:404}');
+                header('Location: ../login.php?info=<text>The_user_or_password_was_incorrect</text>');
+            }
+        }
+        else{
+            $count=$count+1;
+            if ($count==$cnt){
+                http_response_code(500);
+                echo json_encode('{user: 500}');
+                break;
+                header('Location: ../login.php?info=<text>The_user_or_password_was_incorrect</text>');
+            }
+        }
+    }
+}
+else{
+    echo json_encode('{code: 400}');
+}
+?>
diff --git a/api/server_info.php b/api/server_info.php
new file mode 100644 (file)
index 0000000..f122429
--- /dev/null
@@ -0,0 +1,6 @@
+<?php
+$db_name='mail';
+$db_user='';
+$db_password='';
+$db_link='';
+?>
diff --git a/ch_p.php b/ch_p.php
new file mode 100644 (file)
index 0000000..f27bcb4
--- /dev/null
+++ b/ch_p.php
@@ -0,0 +1,24 @@
+<?php
+include 'api/functions.php';
+session_issruning();
+if (isLoged()==0){
+    header('Location: login.html');
+}
+?><html>
+    <head>
+        <title>Login Smail</title>
+        <link type='text/css' rel='stylesheet' href='css/all.css'/>
+        <style type='text/css'>
+        input{
+            display: block;
+        }
+        </style>
+    </head>
+    <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">
+        </form>
+    </body>
+</html>
\ No newline at end of file
diff --git a/css/all.css b/css/all.css
new file mode 100644 (file)
index 0000000..cd23df0
--- /dev/null
@@ -0,0 +1,31 @@
+html{
+    background: #30303c;
+}
+input,textarea{
+    font-family: Bahnschrift;
+    border: none;
+}
+h1{
+    font-size: 60px;
+}
+.mail,text,a{
+    font-size: 30px;
+}
+h1,text{
+    color: white;
+    font-family: Bahnschrift;
+}
+a{
+    font-family: Bahnschrift;
+    color: yellowgreen;
+    text-decoration: none;
+}
+a:hover{
+    color: aliceblue;
+    text-decoration: none;
+}
+@media (orientation: portrait){
+    text,h1,a,input,textarea{
+        font-size: 40px;
+    }
+}
\ No newline at end of file
diff --git a/css/index.css b/css/index.css
new file mode 100644 (file)
index 0000000..fc81562
--- /dev/null
@@ -0,0 +1,10 @@
+a{
+    text-decoration: none;
+    color: aliceblue;
+}
+a:hover{
+    color: greenyellow;
+}
+text,h1{
+    font-family: Bahnschrift;
+}
\ No newline at end of file
diff --git a/css/mailbox.css b/css/mailbox.css
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/css/send.css b/css/send.css
new file mode 100644 (file)
index 0000000..ab77d60
--- /dev/null
@@ -0,0 +1,20 @@
+textarea{
+    width: 100%;
+    display: flex;
+    justify-content: center;
+    border-radius: 0px;
+    height: 40%;
+    resize: none;
+    margin: 0px;
+}
+input{
+    border-radius: 10px 10px 0px 0px;
+    width: 100%;
+    padding: 3px;
+}
+.submit{
+    border-radius: 0px 0px 10px 10px;
+}
+.center{
+    border-radius: 0px;
+}
\ No newline at end of file
diff --git a/i18n.class.php b/i18n.class.php
new file mode 100644 (file)
index 0000000..bde9e3b
--- /dev/null
@@ -0,0 +1,347 @@
+<?php
+
+/*
+ * Fork this project on GitHub!
+ * https://github.com/Philipp15b/php-i18n
+ *
+ * License: MIT
+ */
+
+class i18n {
+
+    /**
+     * Language file path
+     * This is the path for the language files. You must use the '{LANGUAGE}' placeholder for the language or the script wont find any language files.
+     *
+     * @var string
+     */
+    protected $filePath = './lang/lang_{LANGUAGE}.ini';
+
+    /**
+     * Cache file path
+     * This is the path for all the cache files. Best is an empty directory with no other files in it.
+     *
+     * @var string
+     */
+    protected $cachePath = './langcache/';
+
+    /**
+     * Fallback language
+     * This is the language which is used when there is no language file for all other user languages. It has the lowest priority.
+     * Remember to create a language file for the fallback!!
+     *
+     * @var string
+     */
+    protected $fallbackLang = 'en';
+
+    /**
+     * Merge in fallback language
+     * Whether to merge current language's strings with the strings of the fallback language ($fallbackLang).
+     *
+     * @var bool
+     */
+    protected $mergeFallback = false;
+
+    /**
+     * The class name of the compiled class that contains the translated texts.
+     * @var string
+     */
+    protected $prefix = 'L';
+
+    /**
+     * Forced language
+     * If you want to force a specific language define it here.
+     *
+     * @var string
+     */
+    protected $forcedLang = NULL;
+
+    /**
+     * This is the separator used if you use sections in your ini-file.
+     * For example, if you have a string 'greeting' in a section 'welcomepage' you will can access it via 'L::welcomepage_greeting'.
+     * If you changed it to 'ABC' you could access your string via 'L::welcomepageABCgreeting'
+     *
+     * @var string
+     */
+    protected $sectionSeparator = '_';
+
+
+    /*
+     * The following properties are only available after calling init().
+     */
+
+    /**
+     * User languages
+     * These are the languages the user uses.
+     * Normally, if you use the getUserLangs-method this array will be filled in like this:
+     * 1. Forced language
+     * 2. Language in $_GET['lang']
+     * 3. Language in $_SESSION['lang']
+     * 4. HTTP_ACCEPT_LANGUAGE
+     * 5. Language in $_COOKIE['lang']
+     * 6. Fallback language
+     *
+     * @var array
+     */
+    protected $userLangs = array();
+
+    protected $appliedLang = NULL;
+    protected $langFilePath = NULL;
+    protected $cacheFilePath = NULL;
+    protected $isInitialized = false;
+
+
+    /**
+     * Constructor
+     * The constructor sets all important settings. All params are optional, you can set the options via extra functions too.
+     *
+     * @param string [$filePath] This is the path for the language files. You must use the '{LANGUAGE}' placeholder for the language.
+     * @param string [$cachePath] This is the path for all the cache files. Best is an empty directory with no other files in it. No placeholders.
+     * @param string [$fallbackLang] This is the language which is used when there is no language file for all other user languages. It has the lowest priority.
+     * @param string [$prefix] The class name of the compiled class that contains the translated texts. Defaults to 'L'.
+     */
+    public function __construct($filePath = NULL, $cachePath = NULL, $fallbackLang = NULL, $prefix = NULL) {
+        // Apply settings
+        if ($filePath != NULL) {
+            $this->filePath = $filePath;
+        }
+
+        if ($cachePath != NULL) {
+            $this->cachePath = $cachePath;
+        }
+
+        if ($fallbackLang != NULL) {
+            $this->fallbackLang = $fallbackLang;
+        }
+
+        if ($prefix != NULL) {
+            $this->prefix = $prefix;
+        }
+    }
+
+    public function init() {
+        if ($this->isInitialized()) {
+            throw new BadMethodCallException('This object from class ' . __CLASS__ . ' is already initialized. It is not possible to init one object twice!');
+        }
+
+        $this->isInitialized = true;
+
+        $this->userLangs = $this->getUserLangs();
+
+        // search for language file
+        $this->appliedLang = NULL;
+        foreach ($this->userLangs as $priority => $langcode) {
+            $this->langFilePath = $this->getConfigFilename($langcode);
+            if (file_exists($this->langFilePath)) {
+                $this->appliedLang = $langcode;
+                break;
+            }
+        }
+        if ($this->appliedLang == NULL) {
+            throw new RuntimeException('No language file was found.');
+        }
+
+        // search for cache file
+        $this->cacheFilePath = $this->cachePath . '/php_i18n_' . md5_file(__FILE__) . '_' . $this->prefix . '_' . $this->appliedLang . '.cache.php';
+
+        // whether we need to create a new cache file
+        $outdated = !file_exists($this->cacheFilePath) ||
+            filemtime($this->cacheFilePath) < filemtime($this->langFilePath) || // the language config was updated
+            ($this->mergeFallback && filemtime($this->cacheFilePath) < filemtime($this->getConfigFilename($this->fallbackLang))); // the fallback language config was updated
+
+        if ($outdated) {
+            $config = $this->load($this->langFilePath);
+            if ($this->mergeFallback)
+                $config = array_replace_recursive($this->load($this->getConfigFilename($this->fallbackLang)), $config);
+
+            $compiled = "<?php class " . $this->prefix . " {\n"
+               . $this->compile($config)
+               . 'public static function __callStatic($string, $args) {' . "\n"
+               . '    return vsprintf(constant("self::" . $string), $args);'
+               . "\n}\n}\n"
+               . "function ".$this->prefix .'($string, $args=NULL) {'."\n"
+               . '    $return = constant("'.$this->prefix.'::".$string);'."\n"
+               . '    return $args ? vsprintf($return,$args) : $return;'
+               . "\n}";
+
+                       if( ! is_dir($this->cachePath))
+                               mkdir($this->cachePath, 0755, true);
+
+            if (file_put_contents($this->cacheFilePath, $compiled) === FALSE) {
+                throw new Exception("Could not write cache file to path '" . $this->cacheFilePath . "'. Is it writable?");
+            }
+            chmod($this->cacheFilePath, 0755);
+
+        }
+
+        require_once $this->cacheFilePath;
+    }
+
+    public function isInitialized() {
+        return $this->isInitialized;
+    }
+
+    public function getAppliedLang() {
+        return $this->appliedLang;
+    }
+
+    public function getCachePath() {
+        return $this->cachePath;
+    }
+
+    public function getFallbackLang() {
+        return $this->fallbackLang;
+    }
+
+    public function setFilePath($filePath) {
+        $this->fail_after_init();
+        $this->filePath = $filePath;
+    }
+
+    public function setCachePath($cachePath) {
+        $this->fail_after_init();
+        $this->cachePath = $cachePath;
+    }
+
+    public function setFallbackLang($fallbackLang) {
+        $this->fail_after_init();
+        $this->fallbackLang = $fallbackLang;
+    }
+
+    public function setMergeFallback($mergeFallback) {
+        $this->fail_after_init();
+        $this->mergeFallback = $mergeFallback;
+    }
+
+    public function setPrefix($prefix) {
+        $this->fail_after_init();
+        $this->prefix = $prefix;
+    }
+
+    public function setForcedLang($forcedLang) {
+        $this->fail_after_init();
+        $this->forcedLang = $forcedLang;
+    }
+
+    public function setSectionSeparator($sectionSeparator) {
+        $this->fail_after_init();
+        $this->sectionSeparator = $sectionSeparator;
+    }
+
+    /**
+     * @deprecated Use setSectionSeparator.
+     */
+    public function setSectionSeperator($sectionSeparator) {
+        $this->setSectionSeparator($sectionSeparator);
+    }
+
+    /**
+     * getUserLangs()
+     * Returns the user languages
+     * Normally it returns an array like this:
+     * 1. Forced language
+     * 2. Language in $_GET['lang']
+     * 3. Language in $_SESSION['lang']
+     * 4. HTTP_ACCEPT_LANGUAGE
+     * 5. Language in $_COOKIE['lang']
+     * 6. Fallback language
+     * Note: duplicate values are deleted.
+     *
+     * @return array with the user languages sorted by priority.
+     */
+    public function getUserLangs() {
+        $userLangs = array();
+
+        // Highest priority: forced language
+        if ($this->forcedLang != NULL) {
+            $userLangs[] = $this->forcedLang;
+        }
+
+        // 2nd highest priority: GET parameter 'lang'
+        if (isset($_GET['lang']) && is_string($_GET['lang'])) {
+            $userLangs[] = $_GET['lang'];
+        }
+
+        // 3rd highest priority: SESSION parameter 'lang'
+        if (isset($_SESSION['lang']) && is_string($_SESSION['lang'])) {
+            $userLangs[] = $_SESSION['lang'];
+        }
+
+        // 4th highest priority: HTTP_ACCEPT_LANGUAGE
+        if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
+            foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $part) {
+                $userLangs[] = strtolower(substr($part, 0, 2));
+            }
+        }
+
+        // 5th highest priority: COOKIE
+        if (isset($_COOKIE['lang'])) {
+          $userLangs[] = $_COOKIE['lang'];
+        }
+
+        // Lowest priority: fallback
+        $userLangs[] = $this->fallbackLang;
+
+        // remove duplicate elements
+        $userLangs = array_unique($userLangs);
+
+        // remove illegal userLangs
+        $userLangs2 = array();
+        foreach ($userLangs as $key => $value) {
+            // only allow a-z, A-Z and 0-9 and _ and -
+            if (preg_match('/^[a-zA-Z0-9_-]*$/', $value) === 1)
+                $userLangs2[$key] = $value;
+        }
+
+        return $userLangs2;
+    }
+
+    protected function getConfigFilename($langcode) {
+        return str_replace('{LANGUAGE}', $langcode, $this->filePath);
+    }
+
+    protected function load($filename) {
+        $ext = substr(strrchr($filename, '.'), 1);
+        switch ($ext) {
+            case 'properties':
+            case 'ini':
+                $config = parse_ini_file($filename, true);
+                break;
+            case 'yml':
+            case 'yaml':
+                $config = spyc_load_file($filename);
+                break;
+            case 'json':
+                $config = json_decode(file_get_contents($filename), true);
+                break;
+            default:
+                throw new InvalidArgumentException($ext . " is not a valid extension!");
+        }
+        return $config;
+    }
+
+    /**
+     * Recursively compile an associative array to PHP code.
+     */
+    protected function compile($config, $prefix = '') {
+        $code = '';
+        foreach ($config as $key => $value) {
+            if (is_array($value)) {
+                $code .= $this->compile($value, $prefix . $key . $this->sectionSeparator);
+            } else {
+                $fullName = $prefix . $key;
+                if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $fullName)) {
+                    throw new InvalidArgumentException(__CLASS__ . ": Cannot compile translation key " . $fullName . " because it is not a valid PHP identifier.");
+                }
+                $code .= 'const ' . $fullName . ' = \'' . str_replace('\'', '\\\'', $value) . "';\n";
+            }
+        }
+        return $code;
+    }
+
+    protected function fail_after_init() {
+        if ($this->isInitialized()) {
+            throw new BadMethodCallException('This ' . __CLASS__ . ' object is already initalized, so you can not change any settings.');
+        }
+    }
+}
diff --git a/index.php b/index.php
new file mode 100644 (file)
index 0000000..85eb192
--- /dev/null
+++ b/index.php
@@ -0,0 +1,40 @@
+<!-- {instance:Smail,version:0.3} --->
+<?php include 'i18n.class.php'; $i18n = new i18n(); $i18n->init(); include 'api/server_info.php';?>
+<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'/>
+    </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>
+            <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%;'>
+            <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%;'>
+            <h1 style='margin: 0px;'><?php echo L::index_license;?></h1>
+            <hr>
+            <text><?php echo L::index_license_c;?></text>
+        </div>
+    </body>
+</html>
\ No newline at end of file
diff --git a/lang/lang_en.ini b/lang/lang_en.ini
new file mode 100644 (file)
index 0000000..cdc0456
--- /dev/null
@@ -0,0 +1,38 @@
+[index]
+welcome = "Welcome to the instance"
+register = 'How i can create my own account?'
+about = "What is SMail?"
+how = "How i can use it?"
+where = "Where i found the code?"
+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>"
+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"
+[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"
+change = "Change password"
+or = "or"
+[gmail]
+sender = "Sender"
+content = "Contenido"
+success = "Success"
+return = "Return"
+read = "Mark as read"
+invalid_id = "Invalid ID"
+or = "or"
+[new]
+already = "This user was already taken"
+user = "User created, your new smail are "
+[reg]
+submit = "Sign up"
\ No newline at end of file
diff --git a/lang/lang_es.ini b/lang/lang_es.ini
new file mode 100644 (file)
index 0000000..5ebeaa6
--- /dev/null
@@ -0,0 +1,37 @@
+[index]
+welcome = "Bienvenido a la instancia"
+register = "¿Como me registro?"
+about = "¿Que es SMail?"
+how = "¿Como puedo usar SMail?"
+where = "¿Donde puedo encontrar el codigo?"
+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>"
+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"
+[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"
+change = "Cambiar contraseña"
+or = "o"
+[gmail]
+sender = "Desde"
+content = "Contenido"
+success = "Finalizado Correctamente"
+return = "Volver"
+read = "Marcar como leido"
+or = "o"
+[new]
+already = "Este usuario ya esta tomado"
+user= "Usuario creado, tu nuevo smail es "
+[reg]
+submit = "Registrar"
\ No newline at end of file
diff --git a/login.html b/login.html
new file mode 100644 (file)
index 0000000..caa37ee
--- /dev/null
@@ -0,0 +1,19 @@
+<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
diff --git a/login.php b/login.php
new file mode 100644 (file)
index 0000000..1f34477
--- /dev/null
+++ b/login.php
@@ -0,0 +1,25 @@
+<?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'/>
+        <style type='text/css'>
+        input{
+            display: block;
+        }
+        </style>
+    </head>
+    <body>
+        <?php
+            if (isset($_GET['info'])){
+                echo str_replace('_',' ',$_GET['info']);
+            }
+        ?>
+        <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'>
+        </form>
+    </body>
+</html>
\ No newline at end of file
diff --git a/mailbox/change_p.php b/mailbox/change_p.php
new file mode 100644 (file)
index 0000000..530e80e
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+include '../api/server_info.php';
+include '../api/functions.php';
+session_issruning();
+if (isset($_POST['old']) and isset($_POST['new'])){
+    $conn=mysqli_connect($db_link,$db_user,$db_password,$db_name);
+    $query=mysqli_query($conn,'SELECT mail_password FROM mail WHERE mail_user="'.$_SESSION['m_user'].'"');
+    $i=mysqli_fetch_array($query,MYSQLI_ASSOC);
+    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');
+    }
+    else{
+        echo 'F';
+        http_response_code(404);
+    }
+}
+else{
+    http_response_code(404);
+}
+
+?>
\ No newline at end of file
diff --git a/mailbox/create_mf.php b/mailbox/create_mf.php
new file mode 100644 (file)
index 0000000..3d27ba3
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+include '../api/functions.php';
+session_issruning();
+$log=isloged();
+if ($log==1 and isset($_GET['folder'])){
+    if (!is_dir(preg_split('/@/',$_SESSION['m_user'])[0].'/'.$_GET['folder'])){
+        mkdir(preg_split('/@/',$_SESSION['m_user'])[0].'/'.$_GET['folder']);
+    }
+    else{
+        echo 'Folder already exists';
+    }
+}
+else{
+    if ($log==0){
+        header('Location: ../login.html');
+    }
+    else{}
+}
\ No newline at end of file
diff --git a/mailbox/getmail.php b/mailbox/getmail.php
new file mode 100644 (file)
index 0000000..38d53b6
--- /dev/null
@@ -0,0 +1,42 @@
+<?php include '../i18n.class.php'; $i18n = new i18n('../lang/lang_{LANGUAGE}.ini'); $i18n->init();?>
+<html>
+    <head>
+        <link type='text/css' rel='stylesheet' href='../css/all.css'/>
+        <link type='text/css' rel='stylesheet' href='../css/mailbox.css'/>
+    </head>
+    <body>
+        <?php
+
+        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 '<text>'.L::gmail_success.', </text><a href="mailb.php">'.L::gmail_return.'</a>';}catch(Exception $e){echo '<a href="mailb.php">'.L::gmail_return.'</a>';}
+                    }
+                }
+                elseif(isset($_GET['id'])){
+                    try{include preg_split('/@/',$_SESSION['m_user'])[0].'/'.$_GET['box'].'/'.$_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> or </text><a href="move.php?&from='.$_GET['box'].'&to=readed&id='.$_GET['id'].'">'.L::gmail_read.'</a>';}catch (Exception $e){echo L::gmail_invalid_id;}
+                }
+            }
+            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 '<text>'.L::gmail_success.', </text><a href="mailb.php">'.L::gmail_return.'</a>';}catch(Exception $e){echo '<a href="mailb.php">'.L::gmail_return.'</a>';}
+                    }
+                }
+                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;}
+                }
+            }
+        }
+        else{
+            http_response_code(404);
+        }
+
+        ?>
+    </body>
+</html>
diff --git a/mailbox/index.php b/mailbox/index.php
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/mailbox/mailb.php b/mailbox/mailb.php
new file mode 100644 (file)
index 0000000..d75f06a
--- /dev/null
@@ -0,0 +1,70 @@
+<?php
+require '../api/functions.php';
+session_issruning();
+if (isloged()==0){
+    header('Location: ../login.html');
+    die();
+}
+?>
+<?php include '../i18n.class.php'; $i18n = new i18n('../lang/lang_{LANGUAGE}.ini'); $i18n->init();?>
+<html>
+    <head>
+        <link type='text/css' rel='stylesheet' href='../css/all.css'/>
+        <link type='text/css' rel='stylesheet' href='../css/mailbox.css'/>
+    </head>
+    <body>
+        <h1>Mail Box <?php if(isset($_GET['box'])==true){echo $_GET['box'];}?></h1>
+        <?php
+        if (isset($_GET['info'])){
+            echo str_replace('_',' ',$_GET['info']);
+                       echo '<br>';
+        }
+        function scan_dir($dir) {
+            $ignored = array('.', '..', '.htaccess','mailb.php','getmail.php');
+            $files = array();
+            foreach (scandir($dir) as $file) {
+                if (in_array($file, $ignored)) continue;
+                    $files[$file] = filemtime($dir . '/' . $file);
+                }
+                arsort($files);
+                $files = array_keys($files);
+                return ($files) ? $files : false;
+        }
+        if (isloged()==1){
+            if (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){
+                        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>
+';
+                        }
+                    }
+                }
+            }
+            else{
+                $dirs=scan_dir(getcwd().'/'.preg_split('/@/',$_SESSION['m_user'])[0].'/mails/');
+                if (($dirs==false)==false){
+                    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>
+';
+                    }
+                }
+                else{
+                    echo '<text>'.L::mbox_dhave.'<br></text>';
+                }
+            }
+        }
+        else{
+            http_response_code(404);
+        }
+
+        ?>
+       <text><?php echo L::mbox_note;?></text>
+    <br><a href='../send_m.php'><?php echo L::mbox_send;?></a><text> <?php echo L::mbox_or;?> </text><a href='../ch_p.php'><?php echo L::mbox_change;?></a>
+       </body>
+</html>
diff --git a/mailbox/move.php b/mailbox/move.php
new file mode 100644 (file)
index 0000000..9043d73
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+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';
+            }
+            else{
+                http_response_code(500);
+                echo 'Parameter "From" was incorrect';
+            }
+        }
+        else{
+            http_response_code(500);
+            echo $_GET['from'].' box dont exists';
+        }
+    }
+    else{
+        http_response_code(500);
+        echo 'We dont have all the required information';
+        print_r($_GET);
+    }
+}
+else{
+    header('Location: ../login.html');
+}
\ No newline at end of file
diff --git a/mailbox/new_user.php b/mailbox/new_user.php
new file mode 100644 (file)
index 0000000..ba1cec2
--- /dev/null
@@ -0,0 +1,28 @@
+<?php include '../i18n.class.php'; $i18n = new i18n('../lang/lang_{LANGUAGE}.ini'); $i18n->init();?>
+<?php
+
+include '../api/server_info.php';
+
+if (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);
+    }
+    elseif (mysqli_num_rows($query)==0){
+        mkdir($_POST['mail']);
+        mkdir($_POST['mail'].'/mails');
+        mkdir($_POST['mail'].'/readed');
+        $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>');
+    }
+    else{
+        header('Location: ../new_user.php?info=<text>'.L::new_already.' '.$_POST['mail'].'@'.$selfUrl.'</text>');
+    }
+}
+else{
+    header('Location: ../index.php');
+}
+?>
\ No newline at end of file
diff --git a/mailbox/raw_mails.php b/mailbox/raw_mails.php
new file mode 100644 (file)
index 0000000..47eea72
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+function scan_dir($dir) {
+    $ignored = array('.', '..', '.htaccess','index.php','getmail.php');
+    $files = array();    
+    foreach (scandir($dir) as $file) {
+        if (in_array($file, $ignored)) continue;
+            $files[$file] = filemtime($dir . '/' . $file);
+        }
+        arsort($files);
+        $files = array_keys($files);
+        return ($files) ? $files : false;
+}
+include '../api/functions.php';
+session_issruning();
+if (isloged()==1){
+    if (isset($_GET['box'])){
+        if (strpos($_GET['box'],'/') or strpos($_GET['box'],'..') or strpos($_GET['box'],'\\')){}
+        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>';}
+            }
+        }
+    }
+    else{
+        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> ';
+            }
+        }
+    }
+}
+else{
+    header('Location: ../login.html');
+}
+?>
\ No newline at end of file
diff --git a/mailbox/reicive.php b/mailbox/reicive.php
new file mode 100644 (file)
index 0000000..6c00a17
--- /dev/null
@@ -0,0 +1,47 @@
+<?php 
+function string($length = 30) {
+    return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);} 
+
+if (isset($_POST['mail']) and $_POST['to'] and isset($_POST['html']) and isset($_POST['hash'])){
+    $mail=['mail'=>$_POST['mail'], 'hash'=>$_POST['hash']];
+    $other=array(
+        CURLOPT_URL => 'https://'.preg_split('/@/',$_POST['mail'])[1].'/mailbox/user.php',
+        CURLOPT_POST => true,
+        CURLOPT_POSTFIELDS => $mail,
+        CURLOPT_RETURNTRANSFER => true
+    );
+    $curl=curl_init();
+    curl_setopt_array($curl, ($other));
+    $out=curl_exec($curl);
+    if (curl_error($curl)){
+        http_response_code(400);
+    }
+    else{
+        $info=curl_getinfo($curl,CURLINFO_HTTP_CODE);
+               echo $info;
+           if ($info==200){
+            if (file_exists($_POST['to'].'/index.php')){
+                               $date=date('Y-m-d H:i:s');
+                $content='<?php
+$html="'.'<!version=0.1>'.str_replace("'",'"',$_POST['html']).'";
+$sender="'.$_POST['mail'].'";
+$date="'.$date.'";
+?>';
+                file_put_contents($_POST['to'].'/mails/'.string().'.php',$content);
+                http_response_code(200);
+            }
+            else{
+                http_response_code(404);
+            }
+        }
+        else{
+            echo $out;
+            http_response_code(500);
+        }
+    }
+    curl_close($curl);
+}
+else{
+    http_response_code(404);
+}
+?>
diff --git a/mailbox/remove_mf.php b/mailbox/remove_mf.php
new file mode 100644 (file)
index 0000000..93d7071
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+include '../api/functions.php';
+session_issruning();
+$log=isloged();
+if ($log==1 and isset($_GET['folder'])){
+    if ($_GET['folder']=='mails' or $_GET['folder']=='readed'){
+        echo 'You cannot delete the mailbox '.$_GET['folder'];
+    }
+    elseif (is_dir(preg_split('/@/',$_SESSION['m_user'])[0].'/'.$_GET['folder'])){
+        $dir=preg_split('/@/',$_SESSION['m_user'])[0].'/'.$_GET['folder'];
+        $it = new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS);
+        $files = new RecursiveIteratorIterator($it,
+                    RecursiveIteratorIterator::CHILD_FIRST);
+        foreach($files as $file) {
+            if ($file->isDir()){
+                rmdir($file->getRealPath());
+            } else {
+                unlink($file->getRealPath());
+            }
+        }
+        rmdir($dir);
+        echo 'Folder deleted';
+    }
+    else{
+        echo 'Folder not exists';
+    }
+}
+else{
+    if ($log==0){
+        header('Location: ../login.html');
+    }
+    else{}
+}
\ No newline at end of file
diff --git a/mailbox/send.php b/mailbox/send.php
new file mode 100644 (file)
index 0000000..da04d1e
--- /dev/null
@@ -0,0 +1,77 @@
+<?php
+include '../api/functions.php';
+if (isset($_POST['content']) and isset($_POST['mail_r'])){
+    session_issruning();
+    if (isloged()==1){
+        $split=preg_split('/@/',$_POST['mail_r']);
+        $cnt=count($split);
+        if ($cnt==2){
+            $query=mysqli_query($conn,'SELECT mail_password FROM mail WHERE mail_user="'.$_SESSION['m_user'].'"');
+            $hash=mysqli_fetch_array($query,MYSQLI_ASSOC)['mail_password'];
+            $mail=['mail'=>$_SESSION['m_user'],'html'=>$_POST['content'],'hash'=>$hash,'to'=>preg_split('/@/',$_POST['mail_r'])[0]];
+            $other=array(
+                CURLOPT_URL => 'https://'.$split[1].'mailbox/reicive.php',
+                CURLOPT_POST => true,
+                CURLOPT_POSTFIELDS => $mail,
+                CURLOPT_RETURNTRANSFER => true
+            );
+            echo 'Sending sm to the url '.$split[1];
+            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);
+            if (curl_error($curl)){
+                echo json_encode('{end: 400}');
+            }
+            else{
+                $info=curl_getinfo($curl,CURLINFO_HTTP_CODE);
+                               echo $info;
+                if ($info==200){
+                    echo json_encode('{code:200, detail=mail sended}');
+                }
+                else{
+                    echo json_encode('{code:404, detail=error}');
+                }
+            }
+        }
+        elseif ($cnt==1){
+            $selfUrl=$_SERVER['HTTP_HOST'].preg_replace('/mailbox\/send.php/','',$_SERVER['PHP_SELF']);
+            $query=mysqli_query($conn,'SELECT mail_password FROM mail WHERE mail_user="'.$_SESSION['m_user'].'"');
+            $hash=mysqli_fetch_array($query,MYSQLI_ASSOC)['mail_password'];
+            $mail=['mail'=>$_SESSION['m_user'],'html'=>$_POST['content'],'hash'=>$hash,'to'=>$split[0]];
+            $other=array(
+                CURLOPT_URL => 'https://'.$selfUrl.'mailbox/reicive.php',
+                CURLOPT_POST => true,
+                CURLOPT_POSTFIELDS => $mail,
+                CURLOPT_RETURNTRANSFER => true
+            );
+            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);
+            if (curl_error($curl)){
+                echo json_encode('{end: 400}');
+            }
+            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}');
+                }
+                else{
+                    echo json_encode('{code:404, detail=error}');
+                }
+            }
+        }
+    }
+    else{
+        echo json_encode('{code:500, detail=unknow login}');
+    }
+}
+
+?>
diff --git a/mailbox/user.php b/mailbox/user.php
new file mode 100644 (file)
index 0000000..94876a3
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+include '../api/server_info.php';
+if (isset($_POST['mail'])){
+    if (file_exists(preg_split('/@/',$_POST['mail'])[0].'/index.php')){
+               $conn=mysqli_connect($db_link,$db_user,$db_password,$db_name);
+        echo $_POST['mail'];
+               $query=mysqli_query($conn,'SELECT mail_password FROM mail where mail_user="'.$_POST['mail'].'"');
+               $i=mysqli_fetch_array($query,MYSQLI_ASSOC);
+        if ($_POST['hash']==$i['mail_password']){
+            http_response_code(200);
+        }
+        else{
+            http_response_code(400);
+        }
+    }
+    else{
+        http_response_code(500);
+    }
+}
+else{
+    http_response_code(400);
+}
+
+?>
\ No newline at end of file
diff --git a/new_user.php b/new_user.php
new file mode 100644 (file)
index 0000000..9a8d31f
--- /dev/null
@@ -0,0 +1,28 @@
+<?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>
+        <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>
+        <?php
+            if (isset($_GET['info'])){
+                echo str_replace('_',' ',$_GET['info']);
+            }
+        ?>
+        <form action='mailbox/new_user.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::reg_submit;?> class='submit'>
+        </form>
+    </body>
+</html>
\ No newline at end of file
diff --git a/send_m.php b/send_m.php
new file mode 100644 (file)
index 0000000..a7caecd
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+include 'api/functions.php';
+session_issruning();
+if (isloged()==0){
+    header('Location: login.html');
+}
+
+?>
+<?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/send.php' method='POST'>
+            <input type="text" name="mail_r" placeholder="SMail">
+            <textarea type="text" name="content" placeholder=<?php echo L::send_content;?>></textarea>
+            <input class='submit' type="submit" value=<?php echo L::send_send;?>>
+        </form>
+    </body>
+</html>