<?php
//登入页面
$conn=mysql_connect('127.0.0.1','root','')or die("连接失败");
mysql_select_db('tujian',$conn)or die("未到该数据库");
define(ALL_PS,"vivid");  mysql_query("set names GBK");
if($_POST[submit]){
    $postcode=strtolower($_POST["code"]);
    $postcode=strtoupper($_POST["code"]);
    $uid=str_replace(" ","",$_POST[uid]);
    $sql="select * from users where `uid`='$_POST[uid]'";
    $query=mysql_query($sql);
    $user=is_array($row=mysql_fetch_array($query));
    $mi=$user?md5($_POST[pass].ALL_PS)==$row[pass]:FALSE;
    if($mi){
        $_SESSION[uid]=$row[uid];
        $_SESSION[name]=$row[name];
        $_SESSION[id]=$row[id];
        $_SESSION[user_shell]=md5($row[uid].$row[pass].ALL_PS);
        if( $_SESSION["code"]==$postcode){
            echo"<script>alert('登录成功!');location.href='index.php';</script>";
        }else{
            echo"<div class='show'>验证码输入错误,请重新输入!</div>";
        }
    }
    else{
        echo"<div class='show'>用户名或密码输入错误</div>";
        session_destroy();
    }
}
>
<SCRIPT language=javascript>
    function Checklogin()
    {
        if(myform.uid.value=="账号/学号")
    {
        alert("请填写登录名");
        myform.uid.focus();
        return false;
    }
    if(myform.pass.value=="密码/身份证后六位数"){
        alert("密码不能为空");
        myform.pass.focus();
        return false;
    }
    de.value=="验证码"){
        alert("请填写验证码");
        de.focus();
        return false;
    }
}
</SCRIPT>
<style type="text/css">
<!--
body {
    background-image: url(images/user_loginbg.jpg);
php好看主页源码}
-->
</style>
<style type="text/css">
<!--
.STYLE1 {
    color: #000000;
    font-size: 18px;
}
body {
    background-color: #f7f4f6;
}
.position{
    position: absolute;
top:  10px
right:  200px
width: 296px;
    left: 878px;
    top: 161px;
    height: 304px;
    width: 258px;
}
.position2{
position: absolute;
    left:63px;
    top:250px;
}
.position3{
    position:absolute;
    left: 935px;
    top: 122px;
    font-size:25px;
    font-family: Arial, Helvetica, sans-serif;
}
.STYLE8 {
    position: absolute;
    font-size: 30px;
    font-family: Arial, Helvetica, sans-serif;
    color: #0000FF;
    top: 0px;
    left: 40px;
}
.STYLE9 {
    font-size: 18px;
    font-family: "宋体";
}
.STYLE10 {
    font-family: "Courier New", Courier, monospace;
    font-weight: bold;
}
.STYLE11 {
    color: #FFFFFF;
    font-weight: bold;
    text-decoration:none;
}
.show{
    position:absolute;
    left:1135px;
    top:400px;
}
-->
</style>
<html>
<title>用户登录</title>
<body background="images/login.PN">
<form action="" method="post" name="myform" onsubmit="return Checklogin();">
  <div class="position">
  <table width="296" height="250" align="right" bordercolor="#ffffff" bgcolor="#ffffff">
<tr>
<td width="292" height="37" bgcolor="#ffffff">  <h1 class="STYLE1"> 欢迎登录</h1></td>
</tr>
<tr>
<td><div align="center"><br> 
  <input type="text" value="账号" onfocus="if(value=='账号') {value=''}" onblur="if (value=='')
  {value='账号'}" name="uid"  />
    <br>
</div></td>
</tr>
<tr>
<td> 
  <div align="center"> 
    <input type="text" value="密码" onfocus="if(value=='密码') {value=''}" onblur="if (value=='')
  {value='密码'}" name="pass"  />
    <br>
  </div></td>
</tr><br>
<tr>
<td>  
  <div align="center">  
    <input type="text" value="验证码" onfocus="if(value=='验证码') {value=''}" onblur="if (value=='')
  {value='验证码'}" name="code"  />
      <span >填写下图所示文字</span><br />
          <img src="code.php?"    alt="点击刷新" onClick="this.src=this.src+'?'" /><span size="20px">看不清?点击图片刷新</span>
    </p>
  </div></td>
</tr>
<tr>
<td height="297"><div class="position2"> </div>
  <span class="position2">
  <input type="submit" name="submit" value="登入"/>
  </span></td>
</tr>
</table>
</div>
  <p class="STYLE8"> </p>
  <p class="STYLE8"><span class="STYLE10">土建学院交流平台</span><span class="STYLE9"> 登 录 界 面</span></p>
  <p class="STYLE8"> </p>
  <p class="STYLE8">     </p>
</form>
<p> </p>
<p> </p>
<p><div class="position3"><a href="register.php"class="STYLE11">立即注册</a></div>
</p>
</body>
</html>

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。