在线“日记” - 现有脚本/mysql/fwrite()?
我正在寻找一个可以满足我的需求的 PHP 网络脚本。我准备写它,但我想它已经完成了,所以我想我应该先在这里问。
我想要的是有一个可以实时编辑的网页(就像etherpad一样),但这基本上永远不会完成。在etherpad中,人们在完成工作后将其导出,并且没有人关心几个月后pad是否被破坏。就我而言,这些笔记很重要,我将花很长时间来研究它们。这意味着我需要:
a)确保托管网站不会突然关闭 - 这就是为什么我决定在我自己的托管上托管它。
b) 使用密码保护我的数据的能力。 (将使用 htaccess 完成)
c) 能够定期向我的电子邮件地址发送备份。 (只有几行PHP代码)
etherpad确实离完美不远了,但我认为它是用java编写的(?)而且我只懂一点PHP,所以我不认为我能够添加这些其特点。更不用说我什至无法将它安装在我的共享主机上。
另一方面,我真的不介意多个用户的文本格式化或同时编辑。有一个简单的黑白形式,只有一个“更新”按钮,就可以了。
这绝对是我能够做的事情。这引出了我的问题 2:
如果我写这个脚本,我的页面上就只有一堵巨大的文本墙,其中包含了一个月的这些笔记的工作量。我担心的是,它会非常频繁地更新。如果mysql出现一次错误,如何确保数据永远不会丢失?写入文件会更安全吗?我应该同时执行 mysql 和 fwrite() 以避免任何错误吗?
感谢您的帮助。希望我的英语足够清楚!
i am looking for a PHP web script that could suit my needs. i am ready to write it but i suppose it has already been done, so i thought i'd ask here first.
what i want is to have a web page that i can edit in real time (just like etherpad), but that basically is never finished. in etherpad people export their work when they are done with it and no one cares if the pad is destroyed a few months later. in my case these notes are important and i'll be working on them for a really long time. which means that i need:
a) to be sure the hosting website won't close its doors abruptly - this is why i have decided to host this on my own hosting.
b) the ability to protect my data with a password. (will be done with a htaccess)
c) the ability to send a backup regularly to my e-mail address. (just a few lines of PHP code)
etherpad is really not far from being perfect but it's written in java i think (?) and i only know a bit of PHP, so i don't think i'll be able to add those features to it. not to mention i wouldn't even be able to install it on my shared hosting.
on the other hand, i really don't mind the text formating or simultaneous editing by multiple users. had i a simple black and white form with just an "update" button, it'd be fine.
and that's definitely something i would be able to do. which leads me to question 2:
had i to write this script, there would be only one huge wall of text on my page, containing a months worth of work on these notes. my worry is, it's going to be updated very frequently. how can i make sure that the data will never be lost if there is say a mysql error once? would writing to a file be more secure? should i do both mysql and fwrite() to avoid any mistake?
thank you for any help. hope my english was clear enough!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您打算做的事情听起来非常像 wiki...如果您想查看轻量级 PHP wiki,请查看 DokuWiki。它甚至不需要数据库(使用纯文本文件)并且可以跟踪更改。
What you intend to do sounds an awful lot like a wiki... If you want to checkout a lightweight PHP wiki, then have a look at DokuWiki. It doesn't even require a DB (uses plain textfiles) and changes can be tracked.
您可以做的是在 MySQL 数据库中添加一个额外字段来跟踪笔记的版本号。每次编辑和保存笔记时,只需让数据库自动增加版本号(应该可以设置为 MySQL 中的“版本”字段,称为“自动增量”和“唯一”)。
这样,您就有了备份,并且还可以实施一种方法来浏览您的历史记录。
What you can do is have an extra field in your MySQL database that keeps track of the version number of your notes. Every time you edit and save your notes, just have the database automatically increment the version number (should be something you can set to the "version" field in the MySQL called "autoincrement" and "unique").
That way, you have backups and you can implement a way to go through your history as well.