⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_login.php

📁 我们运用一个小的记事本
💻 PHP
字号:
<?php
session_start();
include 'include/config.php';
include 'include/para.php';
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>管理登录 - <?php echo $gb_name?></title>
<link href="include/css.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php include 'include/head.php';?>
<?php 
if(empty($_POST['action'])){
include 'include/randnum.php';
$s = new code();
$s->genimg();
?><form name="form1" method="post" action="<?php $_SERVER['PHP_SELF']?>" onsubmit="return FrontPage_Form1_Validator(this)">
  <table width="750" border="0" align="center" cellpadding="0" cellspacing="10" bgcolor="#FFFFFF">
    <tr>
      <td align="center">
		<table width="97%" border="0" cellpadding="0" cellspacing="15" bgcolor="#EBF5FE">
          <tr> 
            <td align="center" valign="top" bgcolor="#FFFFFF"> 
              <table width="100%" border="0" cellpadding="5" cellspacing="0" class="border2">
                <tr> 
                  <td height="50" colspan="2"> <table width="95%" border="0" cellspacing="2" cellpadding="0">
                      <tr> 
                        <td width="9%" align="center"><font color="#0066FF"><img src="images/i3.gif" width="36" height="36"></font></td>
                        <td width="91%" class="font16"><img src="images/login.gif"></td>
                      </tr>
                    </table></td>
                </tr>
                <tr> 
                  <td width="35%" align="right"><font color="#333333">管理员帐号:</font></td>
                  <td width="65%"> <input name="admin_user" type="text" id="admin_user"> 
                    <font color="#999999">*</font></td>
                </tr>
                <tr> 
                  <td align="right"><font color="#333333">管理员密码:</font></td>
                  <td><input name="admin_pass" type="password" id="admin_pass">
                    <font color="#999999">*</font></td>
                </tr>
                <tr> 
                  <td align="right"><font color="#333333">输入验证码:</font></td>
                  <td> 
                    <input name="unum" type="text" id="unum" size="10">
                    <font color="#999999">*</font> <IMG SRC='<?php echo 'imcode.png?'.time();?>' WIDTH='50' HEIGHT='25' BORDER=0 ALT=''></td>
                </tr>
                <tr> 
                  <td align="right"> <script language=JavaScript>
function FrontPage_Form1_Validator(theForm)
{
  if (theForm.admin_user.value == "")
  {
    alert("请输入管理员帐号!");
    theForm.admin_user.focus();
    return (false);
  }
  if (theForm.admin_pass.value == "")
  {
    alert("请输入管理员密码!");
    theForm.admin_pass.focus();
    return (false);
  }
  if (theForm.unum.value == "")
  {
    alert("请您输入验证码!");
    theForm.unum.focus();
    return (false);
  }
   return (true);
}
</script></td>
                  <td height="50" class="font14"> <input type="submit" name="Submit" value=" 登录 "> 
                    <input name="action" type="hidden" id="action" value="add"> 
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
</form>
<?php }else{?>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="10" bgcolor="#FFFFFF">
  <tr> 
    <td><table width="97%" border="0" align="center" cellpadding="0" cellspacing="15" bgcolor="#EBF5FE">
        <tr> 
          <td align="center" bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="6" cellspacing="0" class="border2">
              <tr>
                <td align="center">
                  <?php
		 $unum_temp=$_POST['unum'];
		 if($unum_temp==$_SESSION["code"]){
			$admin_user=$_POST['admin_user'];
			$admin_pass=md5($_POST['admin_pass']);
			$rs=$db->execute("select admin_user,admin_pass from ".TABLE_PREFIX."gbconfig where admin_user='".$admin_user."'");
				if($db->num_rows($rs)!=0){
					//*判断密码
					///////////////////////////////////////////////////////////
					$row=$db->fetch_array($rs);
					$db->free_result($rs);
					if($row['admin_pass']==$admin_pass){

						$_SESSION['admin_pass']=$admin_pass;
						
						echo "<img src=\"images/success.gif\"> <font style=font-size:12pt;color=green>登录成功,请稍候……</font><br><a href=".$pageUrl.">如果浏览器没有自动返回,请点击此处返回</a>";
						echo "<meta http-equiv=\"refresh\" content=\"2; url=index.php\">";
						
					}else{
						echo "<script language=\"javascript\">alert('密码不正确!');history.go(-1)</script>";
					}
				}else{
					echo "<script language=\"javascript\">alert('帐号输入不正确!');history.go(-1)</script>";
				}
		}else{
			echo "<script language=\"javascript\">alert('对不起,验证码不正确,请重新输入……');history.go(-1)</script>";
		}
?>
                </td>
              </tr>
            </table></td>
        </tr>
      </table></td>
  </tr>
</table>
<?php }?>
<?php include 'include/foot.php';?>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -