php学习之简单应用(0)

一个简单地留言板的初始模板:

主页menu.html如下:


 1 <html><head>
  2     <title>简单的留言板</title>
  3 </head><body>
  4 <p><h3 align = "center"><font color = "red">欢迎来的我的简单留言板,请登录或者注册。</font></h3></p>
  5 <form action = "log.php" method = "post">
  6 Username:<input type = "text" name = "username" />
  7 Passwd:<input type  = "password" name = "password" maxlength = "6" /><br>
  8 <input type = "submit" /> <input type = "reset" /><br>
  9 </body></html>
 10 
~            

log.php文件内容如下:

  1  <?php
  2     header("content-type:text/html; charset=UTF-8");
  3     print "Your name is :".$_POST["username"]."<p>";
  4     print "Your code is :".$_POST["password"]."<p>";
  5     if($_POST["username"] == NULL){
  6         print "输入错误,用户名为空。";
  7         exit;
  8     }
  9     if($_POST["password"] == NULL){
 10         print "输入错误,密码为空。";
 11         exit;
 12     }
 13     $file = fopen("info.txt","rb");
 14     while(!feof($file)){
 15         $str = fgetss($file);
 16         $str = substr($str,0,strlen($str)-1);
 17         $array = explode("*",$str);
 18         if(!strcmp($array[0],$_POST["username"]) && !strcmp($array[1],$_POST["password"])){
 19             print "欢迎进入我的简单留言板。<p>";
 20             break;
 21         }
 22     }


未完待续。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值