-
Notifications
You must be signed in to change notification settings - Fork 2
/
forumListEditExecute.php
44 lines (40 loc) · 1.24 KB
/
forumListEditExecute.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
37
38
39
40
41
42
43
44
<?php
include("common.php");
$name = stripslashes($_POST['name']);
$name = str_replace("\n","",$name);
$name = str_replace("\r\n","",$name);
$name = str_replace("\r","",$name);
$name = str_replace("~","",$name);
$description = stripslashes($_POST['description']);
$description = str_replace("\n","",$description);
$description = str_replace("\r\n","",$description);
$description = str_replace("\r","",$description);
$description = str_replace("~","",$description);
$description = substr($description,3,strlen($description)-7);
if (trim($name) == "")
{
header("Location: forumListEdit.php?forumId=".$_GET['forumId']."&error=1");
exit();
}
if (trim($description) == "")
{
header("Location: forumListEdit.php?forumId=".$_GET['forumId']."&error=2");
exit();
}
$fileC = file("db/forumList.dat",FILE_IGNORE_NEW_LINES);
$str = "";
foreach ($fileC as $statistic)
{
$temp = new Forum($statistic);
if ($temp->getForumId() == $_GET['forumId'])
{
$str .= $temp->getForumId()."~".$name."~".$description."~".$temp->getTotalTopics()."~".$temp->getTotalPosts()."\n";
}
else
{
$str .= $statistic."\n";
}
}
file_put_contents("db/forumList.dat",$str);
header("Location: index.php");
?>