MySQL Security with PHP, javascript, and HTML?
MySQL Security with PHP, javascript, and HTML?
好吧,我对网络编程很陌生。我正在创建自己的数据库驱动网站。我正在尝试设置管理员登录名以更新网站的内容。但是,我担心安全地访问我的mySQL数据库。
我打算让数据库搜索给定的用户名,然后将密码哈希与给定密码的哈希进行比较。
我担心的是建立与mySQL datbase的连接。
据我所知,执行此操作的方法是:
<?php
$myConn=mysqli_connect(host,user,pass,dbName);
>
现在我打算将其传递给javascript以检查所有凭据,但是如果这是在HTML文件中定义的,那么登录详细信息对于所有人都可以看到是吗?
或者,我应该在外部.js文件中定义它以进行检查?我还在担心这是否足够安全?
我想你在那里有点困惑,所以我会试着解释得非常简单。
前端 - 客户端:HTML 、CSS 、JavaScript后端 - 服务器端:PHP,SQL
前端的所有内容...不可信,因为每个人都可以访问它。那我们为什么要用 JavaScript 进行验证呢?只是为了帮助用户有错别字...就这么简单...
您的所有安全性都在后端。使用 PHP 验证从前端提交的所有值,然后使用 SQL 对数据库执行所需的操作。
你永远不应该向JS传递任何你不希望你的用户看到/访问的东西。你应该通过PHP来做到这一点。
这对您/清除事情有所帮助吗?
PS:据我了解,您正在为您的项目创建登录名,对吗?在下面找到一些包含教程的链接,这些链接可能会对您有所帮助。
- http://www.phpeasystep.com/phptu/6.html
- http://php.about.com/od/finishedphp1/ss/php_login_code.htm
- http://www.wikihow.com/Create-a-Basic-Login-Script-in-PHP
- http://www.homeandlearn.co.uk/php/php14p2.html
- http://phpsnips.com/4/Simple-User-Login#.Uk41QYZmi-0
- http://www.html-form-guide.com/php-form/php-login-form.html
相关文章:
- PERL and HTML Forms
- Javascript and html, UI construction
- Jquery append and html
- MySQL Security with PHP, javascript, and HTML?
- PHP and html table, using tablesorter javascript
- Inline SVG and HTML DOM Scope for .getElementById
- Javascript date and HTML
- Javascript and HTML validation
- Javascript and HTML linking
- ng-repeat issue and html table
- Jquery lazyload plugin and html table issue
- P2P Cirrus connection Flash-client and HTML-client
- javascript quiz and html
- GO: javascript and html MIME error
- xpath and html value (javascript)
- combining javascript and html
- angular ng-repeat and html
- Concatenating javascript and html
- Window.confirm and html form
- Windows RT Camera and HTML/JavaScript