-
Notifications
You must be signed in to change notification settings - Fork 0
/
notepad_action.php
38 lines (38 loc) · 1.21 KB
/
notepad_action.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
<?php
//echo $_POST["textarea"];
if($_POST["FilePath"]=="")
{
$buffer="\n******************************\n".$_POST["textarea"]."\n";
$myfile = fopen("note.txt", "a") or die("Unable to open file!");
fwrite($myfile, $buffer);
fclose($myfile);
echo "Add Note Scucessfully!<br>";
echo "Now Going To NotePad";
header("Refresh:1;url=index.html");
}
else
{
$buffer="\n******************************\n".$_POST["textarea"]."\n";
if(!file_exists($_POST["FilePath"]))
{
mkdir($_POST["FilePath"]);
}
$filepath=$_POST["FilePath"]."\\note.txt";
$myfile = fopen($filepath, "a") or die("Unable to open file!");
fwrite($myfile, $buffer);
fclose($myfile);
$filepath=$_POST["FilePath"]."\\index.html";
if(!file_exists($filepath))
{
copy("index.html",$_POST["FilePath"]."\\index.html");
copy("get_note.php",$_POST["FilePath"]."\\get_note.php");
copy("modify.html",$_POST["FilePath"]."\\modify.html");
copy("notepad_action.php",$_POST["FilePath"]."\\notepad_action.php");
copy("notepad_modify.php",$_POST["FilePath"]."\\notepad_modify.php");
}
echo "Add Note Scucessfully!<br>";
echo "Now Going To NotePad";
$code="Refresh:1;url=".$_POST["FilePath"]."\\index.html";
header($code);
}
?>