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