简易php博客(3)_后台登陆
2016-06-15 22:28
543 查看
login.php
<?php
include("../connect.php");
echo <<<HTML
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>简易blog后台测试</title>
<link rel=stylesheet type="text/css" href="../css/css.css">
</head>
<body>
HTML;
session_start();
$_SESSION['mng_name']="";
$_SESSION['mng_tag']="";
if(!empty($_POST['login'])){
$login=$_POST['login'];
if ($login=="登 陆"){
$username=$_POST['username'];
$password=$_POST['password'];
if ($username!="" and $password!=""){
$query="select * from manage where usr='$username'";
@$query = mysql_query($query)or die("查询数据表失败");
$user=mysql_fetch_array($query);
if ($user['pwd']==$password){
$_SESSION['mng_name']=$user['usr'];
$_SESSION['mng_tag']=1;
header("location:./index.php");
exit;
}else{
echo"登陆失败";
}
}
}
}
echo <<<HTML
<div style="width: 240px; margin:18% auto;">
<form method=POST name="tijiao" action="#">
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#111111" width="240" height="126" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF" style="border-collapse: collapse;alignment: center">
<tr>
<td width="238" colspan="2" height="50" bgcolor="#A8A3AD">
<p align="center"><b color="#FFFFFF">简易blog后台管理系统</b></td>
</tr>
<tr>
<td width="64" height="28" bgcolor="#E3E1E6">
<p align="center">账号:</td>
<td height="28" bgcolor="#E3E1E6" width="173">
<input type="text" name="username" size="20" class="login"></td>
</tr>
<tr>
<td width="64" height="28" bgcolor="#E3E1E6">
<p align="center">口令:</td>
<td height="28" bgcolor="#E3E1E6" width="173">
<input type="password" name="password" size="20" class="login"></td>
</tr>
<tr>
<td width="238" height="36" bgcolor="#E3E1E6" colspan="2">
<p align="center">
<input type="submit" value="登 陆" name="login">
<input type="reset" value="取 消" name="cancel">
</td>
</tr>
<tr>
<td width="238" colspan="2" height="20" bgcolor="#A8A3AD" align="center"> <a href="../index.php">>>>index<<<</index></a></td>
</tr>
</table>
</form>
</div>
HTML;
?>效果:
<?php
include("../connect.php");
echo <<<HTML
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>简易blog后台测试</title>
<link rel=stylesheet type="text/css" href="../css/css.css">
</head>
<body>
HTML;
session_start();
$_SESSION['mng_name']="";
$_SESSION['mng_tag']="";
if(!empty($_POST['login'])){
$login=$_POST['login'];
if ($login=="登 陆"){
$username=$_POST['username'];
$password=$_POST['password'];
if ($username!="" and $password!=""){
$query="select * from manage where usr='$username'";
@$query = mysql_query($query)or die("查询数据表失败");
$user=mysql_fetch_array($query);
if ($user['pwd']==$password){
$_SESSION['mng_name']=$user['usr'];
$_SESSION['mng_tag']=1;
header("location:./index.php");
exit;
}else{
echo"登陆失败";
}
}
}
}
echo <<<HTML
<div style="width: 240px; margin:18% auto;">
<form method=POST name="tijiao" action="#">
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#111111" width="240" height="126" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF" style="border-collapse: collapse;alignment: center">
<tr>
<td width="238" colspan="2" height="50" bgcolor="#A8A3AD">
<p align="center"><b color="#FFFFFF">简易blog后台管理系统</b></td>
</tr>
<tr>
<td width="64" height="28" bgcolor="#E3E1E6">
<p align="center">账号:</td>
<td height="28" bgcolor="#E3E1E6" width="173">
<input type="text" name="username" size="20" class="login"></td>
</tr>
<tr>
<td width="64" height="28" bgcolor="#E3E1E6">
<p align="center">口令:</td>
<td height="28" bgcolor="#E3E1E6" width="173">
<input type="password" name="password" size="20" class="login"></td>
</tr>
<tr>
<td width="238" height="36" bgcolor="#E3E1E6" colspan="2">
<p align="center">
<input type="submit" value="登 陆" name="login">
<input type="reset" value="取 消" name="cancel">
</td>
</tr>
<tr>
<td width="238" colspan="2" height="20" bgcolor="#A8A3AD" align="center"> <a href="../index.php">>>>index<<<</index></a></td>
</tr>
</table>
</form>
</div>
HTML;
?>效果:
相关文章推荐
- PHP 判断值为整数
- 简易php博客(2)_前台
- PHPwamp开发环境搭建详解
- Thinkphp 控制器
- 简易php博客(1)_安装
- Thinkphp框架基础
- PHP两种redirect
- 深入理解php-fpm.conf中的max_children和request_terminate_timeout
- Minor【 PHP框架】2.第一个应用与请求的生命周期
- ThinkPHP模板
- PHP面向对象:PHP中的多态
- phpcms v9表单向导中怎么加入验证码
- PHPstorm和Xdebug结合实现PHP断点调试
- Thinkphp 模版
- ORTP移植到Hi3518e,h.264封包rtp发送
- php 日常函数
- php实现协程,真正的异步
- php实现协程,真正的异步
- tp-link宽带控制设置
- thinkPHP点击自动刷新二维码