dongxieli3839 2012-10-12 15:25
浏览 23
已采纳

小型Web应用程序的体系结构/实现所需的建议[关闭]

I was asked to build a website where a company's employees (around 20) could login and fill in their working schedules for a present and past (if needed) month. Employees should ofcourse only be able to see their own schedules, but the manager should have the privilege to access every schedule. I have little experience in web development therefore an advice is needed. I have already created a PHP/MySql login page. Now what? How do I go about it? Just some architectural or implementational(if you will) guidance would be really appreciated.

  • 写回答

3条回答 默认 最新

  • dongyan3562 2012-10-12 15:44
    关注

    I have built applications similar to this in PHP / Mysql and can say that it's a good platform for it, although something like Rails might be quicker to use and require less micromanaging. As Wisdom says, use a framework to cut out some of the grunt work and ensure you're adhering to good security practices.

    A few things come to mind that you'll need.

    • Clarity about what your database structure will look like. Try to identify: a) all the pieces of information you'll need to store (A user's name? login info? "authority" level to see others' entries?), b) what tables they can go in. (Can "name" and "hours worked" go in the same table? If they are different levels of analysis, should they go in different tables? Are those two bits of information connected somehow? If so, how should I represent that connection?) Relational design is your friend, especially if you're building something that might get revised later. Take the time to understand what it's about.
    • A page (view) for each different "type" of activity, would be a good place to start. So have a "Let me see my schedule" page, with links to a "Let me add a time entry" page and a "Let me edit that time entry" page. My experience is that, striving to keep your "view" pages' code as small and easy-to-read as possible, pushes you to better plan your code structure.
    • ANY values that you insert into a query string, should be sanitized. So queries to search or select values should always have any PHP variables filtered through a "cleaning" structure:

      $query = sprintf("SELECT * FROM table1 WHERE identifier = %s", mysql_real_escape_string($id));

      Rather than:

      $query = "SELECT * FROM table1 WHERE identifier = ".$id

      because any text which a user types into a search or insert field online, if it ends up in your query, could be executed as part of the query. A hacker could then use this to make your other security features useless.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?