如何为需要使用php一次激活的产品制作激活码?

时间:2019-01-21 01:47:55

标签: php validation

试图在没有数据库的情况下进行验证,这是一种产品,只需使用一次即可激活的密码或密码即可激活。香港专业教育学院一直只使用简单的登录名,只需要激活密码,但再次运行,则需要再次输入密码。我也将其设为可执行文件

<?php session_start(); enter code here
if(isset($_POST['Submit'])){`enter code here`

    $logins = array('abiva' => 'password1');
    setcookie("abiva", 'password1', $logins);

    $Password = isset($_POST['Password']) ? $_POST['Password'] : '';


    if (isset($logins[$Password])){

        header("location:main.html");
        exit;
    } else {

        $msg="<span style='color:red'>Invalid Activation Code</span>";
    }
}
?>
        <!doctype html>
        <html>
        <head>
<meta charset="utf-8">
<title>activation</title>
<link href="./css/style.css" rel="stylesheet">
</head>
<body>
<div id="Frame0">


<br>
<form action="" method="post" name="Login_Form">
  <table width="400" border="0" align="center" cellpadding="5" 
 cellspacing="1" class="Table">
    <?php if(isset($msg)){?>
    <tr>
      <td colspan="2" align="center" valign="top"><?php echo $msg;?></td>
    </tr>
    <?php } ?>
    <tr>
      <td colspan="2" align="left" valign="top"><h3>Activation</h3></td>
    </tr>

    <tr>
      <td align="right">Password</td>
      <td><input name="Password" type="password" class="Input"></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input name="Submit" type="submit" value="Login" 
   class="Button3"></td>
    </tr>
  </table>
</form>
</body>
</html>

0 个答案:

没有答案