Coder Social home page Coder Social logo

lovewall's Introduction

Hi there 👋

I'm xcsoft, A Full Stack Developer. I have development experience in back-end, web, Flutter mobile software, WeChat applet, etc.

lovewall's People

Contributors

soxft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

lovewall's Issues

add.php存在xss和sql注入的可能性

当前版本在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>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.