I'm xcsoft, A Full Stack Developer. I have development experience in back-end, web, Flutter mobile software, WeChat applet, etc.
soxft / lovewall Goto Github PK
View Code? Open in Web Editor NEWA simple confession wall
License: Apache License 2.0
A simple confession wall
License: Apache License 2.0
当前版本在add.php存在xss和sql注入的可能性
增加了一个防止xss和sql注入的JS特殊字符过滤正则函数
在提交的时候可以暂时过滤一下,
但是如果对方直接发送post请求仍然存在着注入可能性,需要在php后端处理
<script>
function stripscript(s)
{
var pattern = new RegExp("[%--`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]") //格式 RegExp("[在中间定义特殊过滤字符]")
var rs = "";
for (var i = 0; i < s.length; i++) {
rs = rs+s.substr(i, 1).replace(pattern, '');
}
return rs;
}
function Submit() {
document.getElementById("Submit").innerHTML = "提交中...";
var name = stripscript(document.getElementById("name").value);
var osname = stripscript(document.getElementById("osname").value);
var content = stripscript(document.getElementById("content").value);
var xhr = new XMLHttpRequest();
xhr.open("POST", "./submit.php");
xhr.setRequestHeader('Content-Type', ' application/x-www-form-urlencoded');
xhr.send("name=" + name + "&osname=" + osname + "&content=" + content);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
document.getElementById("Submit").innerHTML = "<i class=\"mdui-icon material-icons\">near_me</i>";
if (xhr.responseText == 200) {
mdui.dialog({
title: '发布成功...',
content: '愿你们真诚的相爱之火,如初升的太阳,越久越旺;让众水也不能熄灭,大水也不能淹没!',
modal: true
});
setTimeout(() => {
window.location.href = "./index.php";
}, 3000);
} else {
mdui.alert(xhr.responseText, '发布失败...');
}
}
}
}
</Script>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.