Initial commit
[2ch-be.git] / dev-test / bak / inf_back.php
blob37349293276f46cb4e5bd8389ea87b76e5fdd156
1 <?php
2 if(count($_POST)>0){
3 if (isset($_POST['info']) && !empty($_POST['info'])) {
4 if(isset($_POST['isca'])){
5 header('location:status.php');
6 exit;
8 $inf = $_POST['info'];
9 if (strlen($inf) > 250) {
10 $echo = "Content too long";
11 }else{
12 $inf = str_replace("<", "&lt;", $inf);
13 $inf = str_replace(">", "&gt;", $inf);
14 $inf = str_replace("\n", "<br>", $inf);
15 $inf = str_replace(" ", "&nbsp;", $inf);
16 $inf = urlencode($inf);
17 $email = Decrypt($_COOKIE['DMDM'],KEY);
18 $email = filter_var($email, FILTER_SANITIZE_EMAIL);
19 if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
20 $echo = "Invalid email";
21 }else{
22 $fdir = substr($email, 0, 1);
23 $sdir = substr($email, 1, 1);
24 $data = @file(DB_PATH."$fdir/$sdir/$email");
25 if(count($data)>3) {
26 for ($i=0; $i < count($data); $i++) {
27 $data[$i] = trim($data[$i]);
29 $writeData = $data[0]."\n".$data[1]."\n".$data[2]."\n".$data[3]."\n".$data[4]."\n".$data[5]."\n".$inf."\n";
30 if(file_put_contents(DB_PATH."$fdir/$sdir/$email", $writeData)) {
31 $echo = "Successfully updated";
32 } else {
33 $echo = "Error while updating database";
35 } else {
36 echo "User doesn't Exists";
40 } else {
41 echo "Error 1";