我的意思是,即使用户选择了相对简单的密码,实际上很难利用它?除了使用额外的加密功能之外,我无法想到任何东西.
我正在组建一个网站,(我们已经在客户端使用javascript进行预验证).但是厌倦了每隔一行编写mysql_real_escape_string.我写了这个类只有两个函数,主要集中在用户输入/ sql中清理数据.我的问题是,有哪些方法可以实现更轻松的输入消毒并提高代码可读性?
<?php
class Safe {
function userinput($string){
$string = strip_tags($string);
$string = htmlspecialchars($string);
return $string;
}
function sql ($string){
$sqlstuff = Array("union", "select", "update", "delete", "outfile", "create");
$string = Safe::str($string);
$string = mysql_escape_string($string);
$string = str_ireplace($sqlstuff, "", $string);
return $string;
}
}
?>
Run Code Online (Sandbox Code Playgroud) 我已将此幻灯片机制应用于页面,并且它运行良好一段时间.我记不起任何改变,但现在它将无法正常运作.
这是代码:
$(document).ready(function () {
var hash = window.location.hash.substr(1);
var href = $('#nav li a').each(function () {
var href = $(this).attr('href');
if (hash == href.substr(0, href.length)) {
var toLoad = hash + '.html #content';
$('#content').load(toLoad)
}
});
$('#nav li a').click(function () {
$("#story_pane").animate({
marginLeft: 360
}, 250);
$("#main_content").animate({
marginLeft: -600,
opacity: 0.3
}, 250);
$("#main_content").css();
});
alert("test");
var toLoad = $(this).attr('href') + ' #content';
$('#content').hide(1, loadContent);
$('#load').remove();
$('#story_pane').css("display", "block");
$('#story_pane').append('<span id="load"></span>');
$('#load').fadeIn(1);
window.location.hash = $(this).attr('href').substr(0, $(this).attr('href').length - 5);
function loadContent() …Run Code Online (Sandbox Code Playgroud) security ×2
class ×1
cryptography ×1
hash ×1
javascript ×1
jquery ×1
md5 ×1
php ×1
sanitization ×1
sql ×1