/
put.php
36 lines (35 loc) · 1.12 KB
/
put.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
include_once 'App.php';
class put{
const USER_NAME = '=4A=NAA4T96Mh3aG';//hhz1084
const PASS_WORD = '=9TYN2M0j2xME2YW';//aa123456
const INDEX_FILE = 'db/index';
public static function run()
{
self::checkUser();
self::data();
}
private static function checkUser()
{
$userName = Http::getParam('username');
$passWord = Http::getParam('password');
if (Crypt::DeCrypt($userName, null) != Crypt::DeCrypt(self::USER_NAME, null) || Crypt::DeCrypt($passWord, null) != Crypt::DeCrypt(self::PASS_WORD, null))
{
die('x');
}
}
private static function data()
{
$title = Http::getParam('title');
$content = Http::getParam('content');
$title = Crypt::EnCrypt($title, uniqid());
Article::putArticle(self::getIndex(), json_encode(array('title'=>$title,'content'=>Crypt::EnCrypt($content, uniqid()))));
}
private static function getIndex()
{
$index = File::read(ROOT_PATH.self::INDEX_FILE);
File::write(ROOT_PATH, self::INDEX_FILE, ++$index);
return $index;
}
}
put::run();