0%
注册界面
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| <?php $uname = base64_encode($_POST['username']); $upass = md5($_POST['passwd']); $umail = base64_encode($_POST['email']); $img_url = base64_encode($_POST['photo']);
if($upass && $uname&& $umail&& $img_url){
$date = base64_encode(time()); $data = "{$uname}|{$upass}|{$umail}|{$img_url}"."\n"; $f = fopen('shadow.db','a'); fwrite($f,$data); fclose($f); echo "<script>alert('恭喜你注册成功!即将跳转到登陆界面!');location.href='./login.html';</script>"; }
|
登陆界面
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>登录页面</title> <link rel="stylesheet" type="text/css" href="css/login.css"> </head> <body>
<div class="box"> <div class="top"> <h1>登录</h1> </div>
<form action="login.php" method="post"> <input type="text" name="username" placeholder="手机号/邮箱/用户名"> <br> <input type="password" name="password" placeholder="密码"> <br> <input class="input_code" type="text" name="verifycode" placeholder="验证码"> <img class="verifycode" src="https://passport.360.cn/captcha.php?m=create&app=i360&scene=login&userip=&level=default&sign=8820a4&r=1564540365&border=none&_=1564540365972"> <br> <a class="getpass" href="./reg.html">注册账号</a> <br> <input class="login" type="submit" name="submit" value="登录">
</form>
</div>
</body> </html>
|
登陆验证页面
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| <?php session_start(); ?> <?php //登陆验证页面
$uname = base64_encode($_POST['username']);
$upass = md5($_POST['password']);
if ($uname && $upass){ $f = fopen('shadow.db','r');
while (!feof($f)){ $data = fgets($f); $arr = explode('|',$data);
if(count($arr) !=4 ){ continue; }
if ($arr[0] == $uname && $arr[1] == $upass){
$idd = base64_decode($arr[0]); $_SESSION["user"] = true; echo "<script>alert('登陆成功!将跳转到主页!');location.href='index.php?id={$idd}';</script>"; break; }
} echo "<script>alert('用户名或者密码错误,请重新登录!');location.href='login.html';</script>"; } ?>
|
登陆成功后的页面
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| <?php //登陆成功页面 session_start(); $q = $_GET['id']; if($q == NULL){ echo "<script>alert('请登录!');location.href='login.html';</script>"; } echo "<h1>{$q}欢迎光临!!!</h1>";
echo <<<EOF
<p><a href="xinwenindex.php?id={$q}"> <button> 跳转到新闻界面 </button></a></p>
<p><a href="upload.php?id={$q}"> <button> 跳转到新闻编辑界面 </button></a></p>
EOF; ?>
|
接收页面
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
| <?php session_start(); ?> <?php $q = $_GET['id']; if($q == NULL){ echo "<script>alert('请登录!');location.href='login.html';</script>"; }
?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title><?php echo '梗百科';?></title> </head> <body background=""> <center><h2><?php echo "梗百科";?></h2></center> <center> <div align="right" style="width: 1070px"> <?php $user = false;
// 判断是否登陆 if (isset($_SESSION["user"]) && $_SESSION["user"] === true) { echo "已登录"; echo "<p><a href='loginout.php'>退出登录</a></p>"; } else { $_SESSION["user"] = false; echo "未登录"; }
?></div> <style type="text/css"> table{ width:80% } th{ width: 300px; text-align: center; height: 50px; } td{ height: 30px; width: 300px; text-align: center; } img{ height:150px; width: 150px; } </style> <hr>
<table> <tr> <th><button><?php echo "热度✍"; ?></button></th> <th><?php echo "标题"; ?></th> <th><?php echo "作者"; ?></th> <th><?php echo "发表时间"; ?></th> <th><?php echo "操作"; ?><th>
</tr> <?php $f = fopen("news.db","r"); $i=0;
$l=0;
while(!feof($f)){ $hang = fgets($f);
$shuzu = explode("|",$hang); //echo "长度为:".strlen($shuzu[0]); if(count($shuzu) !=7){ continue; }
$redu = base64_decode($shuzu[0]); $biaoti = base64_decode($shuzu[1]); $zuozhe = base64_decode($shuzu[2]); $fashijian = base64_decode($shuzu[3]); $caozuo = base64_decode($shuzu[4]); $tupian = base64_decode($shuzu[5]); $jianjie = substr(base64_decode($shuzu[6]),"0","400"); echo <<<EOF <tr> <td align="center">$redu</td> <td align="center">$biaoti</td> <td align="center">$zuozhe</td> <td align="center">$fashijian</td> <td align="center">$caozuo</td> </tr> EOF; if($i<9){ echo <<<EOF <tr> <td><a ><img src="{$tupian}"></a></td> <td colspan="4">$jianjie</tr> EOF; $i++; } } ?>
</table> </center> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- <center>版权所有 ICQ</center>
<center>©2019 GENG 意见反馈 京ICP证15365号 京公网安备110000000511号 </center> </body> </html>
|
退出登陆
1 2 3 4 5
| <?php session_start(); session_destroy(); echo "<script>alert('账号已退出'); location.href='login.html'</script>" ?>
|
上传页面
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| <?php $q = $_GET['id']; if($q == NULL){ echo "<script>alert('请登录!');location.href='login.html';</script>"; } echo <<<EOF
<html> <body>
<!--<form action="jieshou.php" method="post">--> <!-- 用户名:<input type="text" name="uname" id="uname" value="" /><br />--> <!-- 密码:<input type="password" name="pwd" id="pwd" value="" /><br />--> <!-- <input type="submit" name="" id="" value="提交" />--> <tr> <td> <a href="https://www.baidu.com/baidu?cl=3&tn=SE_baiduhomet8_jmjb7mjw&rsv_dl=fyb_top&fr=top1000&wd=%D0%C7%C7%F2%B4%F3%D5%BD8"> <img src="https://static.shodan.io/shodan/img/logo.png"></a></td> </tr>
<form action="jieshou.php?id={$q}" method="post"> <p>热度:<br><br><input type="text" name="redu" id="redu" value="1"><br></p> <p>标题:<br><br><input type="text" name="biaoti" id="biaoti" value=""><br></p> <!-- <p>作者:<br><br><input type="text" name="zuozhe" id="zuozhe" value="{$q}"> <br></p> --> <!-- <p>发时间:<br><br><input type="text" name="fashijian" id="fashijian" value=""><br></p>--> <p>操作:<br><br><input type="text" name="caozuo" id="caozuo" value=""><br></p> <p>请输入图片地址:</p> <p><input type="text" name="tupian" id="tupian" value=""></p> <p>简介:<br><br><input type="text" name="jianjie" id="jianjie" value=""><br></p> <input type="submit" value="点击上传"> </form> <!----> <!--<form action="jieshou.php" method="POST" accept-charset="utf-8" enctype="multipart/form-data">--> <!-- <div class="lsUpfindBtn">上传图片 <input type="file" name="file" id="file" /> </div>--> <!-- <input type="submit" value="点击上传">--> <!--</form>--> </body>
</html> EOF;
|
上传接收页面
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| <?php $q = $_GET['id']; var_dump($q); if ($q == NULL) { echo "<script>alert('请登录!');location.href='login.html';</script>"; }
function zhuanma($shuju){
$bianmahou = htmlspecialchars($shuju);
return $bianmahou; } $redu = base64_encode(zhuanma($_POST["redu"])); $biaoti = base64_encode(htmlspecialchars($_POST["biaoti"])); $zuozhe = base64_encode(htmlspecialchars($q)); //$fashijian = base64_encode(htmlspecialchars($_POST["fashijian"])); $t=time(); $fashijian = base64_encode(date('Y.m.d', $t)); $caozuo = base64_encode(htmlspecialchars($_POST["caozuo"])); $tupian = $_POST["tupian"]; $jianjie = base64_encode(htmlspecialchars($_POST["jianjie"])); $tupianbm = base64_encode("{$tupian}");
$qwe = "$redu|$biaoti|$zuozhe|$fashijian|$caozuo|$tupianbm|$jianjie"."\n";
$f = fopen("news.db","a+");
fwrite($f,$qwe);
$url = "./xinwenindex.php?id={$q}"; echo "<script>alert('恭喜你添加成功')</script>";
echo "<script language='javascript' type='text/javascript'>"; echo "window.location.href='$url'"; echo "</script>";
?>
|