如何将密钥授权实现为注册表单

时间:2014-11-02 01:19:07

标签: php forms post key

我有一个系统检查数据库中是否存在密钥,如果是,则将其设置为无效。

$keyauth = new Keyauth;

// set the key match string
$keyauth->key_match = "sample_match";

// set the temp key
$keyauth->key_temp  = $key;



if($keyauth_check) {

        // it was so say so
        echo "Key is valid!";

}
else
{

        // key was not valid
        echo "Key is invalid!";

}

但是我试图将其实现到我的注册表单中,这样除非您输入了正确的密钥,否则无法继续。我尝试在Post上添加它但仍然无法让它工作

$system = mysql_fetch_array(mysql_query("SELECT * FROM `Settings`"));


if ($_POST['register']&&$system['Register']=='0'){

    if ($_POST['username'] && $_POST['password'] && $_POST['cpassword'] && $_POST['email']){
        $username = mysql_real_escape_string($_POST['username']);
        $password = hash("sha512", mysql_real_escape_string($_POST['password']));
        $cpassword = hash("sha512", mysql_real_escape_string($_POST['cpassword']));
        $email = strip_tags(mysql_real_escape_string($_POST['email']));
        $key = strip_tags(mysql_real_escape_string($_POST['key']));
        $token = hash("sha512", rand() . rand() . rand());
        $msg = "Hello there, $username! 

谢谢,非常感谢任何支持。

0 个答案:

没有答案