PHP表单验证! [英] PHP Form validating!

查看:66
本文介绍了PHP表单验证!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我想为我的网站创建一个本地系统时,如何使用存储了用户详细信息及其密码的MySQL数据库来验证数据?例如,输入的用户名和密码应使用数据库表中的密码和用户名进行检查.如果用户名和密码正确,则将授予访问该网站的权限!否则访问将被拒绝!请帮我解决这个问题!

问候
Chiranthaka

When I want to create a lo gin system for my web site, how can I use a MySQL database that had stored the details of users and their passwords to validate data? As an example entered username and password should check using the password and username in the database table. If the username and the password is correct the access to the web site will be granted! If not the access will be denied! Please help me to solve this!

Regards
Chiranthaka

推荐答案

这里有很多注意事项……一个不错的选择是将散列的用户名和密码存储到数据库中……一个小的哈希函数可以节省您将用户名和密码存储为纯文本格式...

无论如何,请记住您将需要用户名和密码才能连接到数据库,因此它始终将依赖于同一服务器上的保护.

看看那些与我所谈论的内容保持联系的链接:

如何有人可以窃取我的PHP文件? [ ^ ]

密码存储的操作方法 [哈希用户名和密码以及此后的两个问题... [ ^ ]

为了执行您想要的操作,您应该遵循此处的先前建议,并使用
There are plenty of considerations here... a good option would be to store the hashed username and password into the database... in that way, having a small hashing function would save you to store the username and passwords in plain text...

Anyway, keep in mind that you will need the username and password to connect to the database so it will always rely on the protection on the same server.

Take a look at those links that keep a relation to what I was talking about:

How some one can Steal my PHP file?[^]

Password Storage How to do it[^]

Hash username and password and two questions from that point...[^]

In order to do what you want, you should follow the previous advices here and use


_POST或


_GET来读取以下形式的用户输入然后必须连接到数据库才能查询值...

因此,为了对其进行概括,请看一下这些链接(或扩展您在Google中的搜索以获得更多结果):

http://www.freewebmasterhelp.com/tutorials/phpmysql [ http://www.webdatabasebook.com/2nd-edition/examples/index.html [ ^ ]

http://www.tizag.com/mysqlTutorial/ [ http://www.roscripts.com/PHP_MySQL_by_examples-193.html [
_GET to read the user input in the form and then you will have to connect to the database in order to query the values...

So in order to summarize it, take a look at those links (or extend your search in Google to get more results):

http://www.freewebmasterhelp.com/tutorials/phpmysql[^]

http://www.webdatabasebook.com/2nd-edition/examples/index.html[^]

http://www.tizag.com/mysqlTutorial/[^]

http://www.roscripts.com/PHP_MySQL_by_examples-193.html[^]

Well...

I hope this helps you...


这篇关于PHP表单验证!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆