安全地发送没有https的PHP表单?

0 php forms security hash https

我是网站安全新手,我需要建立一个注册和登录系统.我还没有使用https,如何才能确保我的注册安全?

这是我的注册表单index.php,我使用ajax将表单值传递给create_account.php.

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript" language="javascript">
function submitForm() {
    $.ajax({type:'POST', url: 'create_account.php', data:$('#ContactForm').serialize(), success: function(response) {
        $('#ContactForm').find('.form_result').html(response);
    }});

    return false;
}

</script>
<form id="ContactForm" onsubmit="return submitForm();" method="POST">
   <input type="text" name="fname" value=""/> 
   <input type="text" name="lname" value="" />
   <input type="text" name="email" value="" />
   <input type="text" name="vEmail" value="" /> 
   <input type="password" name="password" value="" />
   <input type="password" name="vPassword" value="" />
   <input type="submit" name="submit" value="Submit" onclick="password.value=sha256_hash(password.value)"/>
<div class="form_result"> 
Run Code Online (Sandbox Code Playgroud)

我试过onclick ="password.value = sha256_hash(password.value)"但它根本不起作用.现在我不确定攻击者如何获取从index.php发送到create_account.php的信息.是否可以哈希(sha256/512)并用javascript加盐?在create_account.php中,我已经在做这种类型的安全性了.

如果不可能,我们如何设置https(我对ssl几乎一无所知)?

Que*_*tin 10

我还没有使用https,如何才能确保我的注册安全?

开始使用HTTPS.任何其他方法都是疯狂的,并且不安全.

我试过onclick ="password.value = sha256_hash(password.value)"但它根本不起作用.

发送散列密码对安全性的贡献很小.这将降低(虽然不是由显著量)攻击的风险,找出用户使用的是什么样的密码(这将有助于捍卫谁回收密码的用户),但如果他们嗅出它在运输途中那么他们仍然可以知道他们需要什么样的字符串发送到您的网站以该用户身份登录.

是否可以哈希(sha256/512)并用javascript加盐?

可能?是.有用的解决这个问题的方法?甚至没有一点点.

如果您需要安全性,请获取SSL支持.

如果不可能,我们如何设置https(我对ssl几乎一无所知)?

基本方法是:

  1. 购买或生成证书(生成您自己的证书会导致问题,因为它不会被普通用户的浏览器信任的人签名)
  2. 配置您的服务器以使用证书(如何执行此操作取决于服务器,Google是您的朋友,它可以找到类似于在Debian系统上为Apache HTTPD设置SSL的说明).