<?php
ob_start();
$bt="一线印象-登录";
include("conn.php");
include("head.php");
include_once("function.php");
$name=sqlstr($_POST["name"]);
$password=sqlstr($_POST["password"]);
//对用户输入的数据转义，安全考虑
$row=mysql_fetch_array(mysql_query("SELECT * FROM user WHERE name='$name' or email='$name' order by id DESC"));
$sid=$row['sid'];
$pass=$row['password'];

if($name==Null or $password==Null){
echo '<br/><font color="red">登录失败：</font><br/>太马虎了，你忘了输入帐号或者密码哦<br/>仔细一点再登录吧<br/><br/><a href="login.php">重新登录</a><br/><br/>';
}else{
if($password==$pass){

setcookie('dl',$sid,time()+31536000,'/',$_SERVER['HTTP_HOST']);//设置cookies
header("Location:diary/index.php");
exit;//跳转到日记页面

}else{
echo '<br/><font color="red">登录失败：</font><br/>可能是帐号或者密码输入错误哦<br/>好好想一想再登录吧<br/><br/><a href="login.php">重新登录</a><br/><br/>';
}

}
?>
<div id="libbottom" class="ll"><a href="reg.php">注册印象</a> | <a href="about.php">关于印象</a><br />浏览：<a href="/">桌面版(开发中)</a><br /><?php echo $showtime=date("m月d日 H:i:s");?><br />© 2013 一线印象</div>