类似 note.ms 但极简,就一页,打开就显示后台的一个 TXT 文本内容, 然后网页上可修改内容,保存更改到后台 TXT 文件
<html> <head> <title>My Notes</title> </head> <body><?php
if(isset($_POST['save'])) {
$note = $_POST['note'];
$file = fopen("my_note.txt", "w") or die("Unable to open file!");
fwrite($file, $note);
fclose($file);
echo "<p>Note saved successfully!</p>";
}
?>
<h2>Edit Note</h2>
<form method="post">
<textarea name="note" rows="10" cols="50"><?php echo file_get_contents("my_note.txt"); ?></textarea><br>
<input type="submit" name="save" value="Save">
</form>
</body>
</html> 1
baiduyixia 298 天前
??
|
2
Soar360 298 天前
这个实现非常的简洁。
|
3
dddys 298 天前
可以
|
4
solopython 297 天前 1
data:text/html,<html contenteditable>
试试这个,以上代码放到浏览器地址栏 |
5
lizhenda 297 天前
这还要用 PHP ???
|
6
redsun368573607 297 天前 1
你这个 submit 还被显示了就离谱
|
7
ellermister 297 天前 via Android
这个 submit 离谱,有趣!
我也想写一个简易的笔记分享网页! |
8
SparkQiu 297 天前
谢谢分享的创意!
配合上弹出层,很具有实用性,已经实现并用上了。 |
9
zhishixiang 297 天前
怎么连 xss 注入都来了
|
10
zhishixiang 297 天前
|
11
lewiet OP @solopython 不太明白,详说。。
@redsun368573607 哈,V2EX 自动激活。。 @zhishixiang 新手,各位请改正,指教,分享给大家 本意就是有一个在线记事本,记一些常用的网址密码。。随手拿来用,现成的各种 PASTEBIN 都太大太臃肿。 我也不太满意,请大家修改补充完善。。。 |
12
lewiet OP 还有就是可以 0 成本部署在一个只有自己知道的 URL ,连密码都省了
|
13
redsun368573607 293 天前
@zhishixiang 插了一个 submit 而已,js 应该插不了
|
14
xiaokeplus 284 天前
这网站没有 htmlspecialchars...
|
15
xiaokeplus 284 天前
<script>alert(1);</script>
@xiaokeplus |
16
g001 220 天前
<html>
<head> <title>My Notes</title> </head> <body> <h1>My Notes</h1> <form method="post"> <textarea name="note" rows="10" cols="50"></textarea><br/> <script>alert(/1/)</script> </form> <?php if(isset($_POST['save'])) { $note = $_POST['note']; $file = fopen("my_note.txt", "w") or die("Unable to open file!"); fwrite($file, $note); fclose($file); echo "<p>Note saved successfully!</p>"; } ?> <h2>Edit Note</h2> <form method="post"> <textarea name="note" rows="10" cols="50"><?php echo file_get_contents("my_note.txt"); ?></textarea> <input type="submit" name="save" value="Save"> </form> </body> </html> |