找传奇、传世资源到传世资源站!

php 简单红包功能(入门级)

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

from clipboard
from clipboard
<?php$con = mysql_connect("localhost","root","root");if (!$con) { die("连接失败!".mysql_errno()); }mysql_select_db("hongbao",$con);if($_POST){$time=time();$username=mysql_query("SELECT * FROM user WHERE username='$_POST[username]' AND password='$_POST[password]'");if($username){setcookie("username", "$_POST[username]", time() 3600);echo "<script>alert('登录成功!即将为您跳转到领取红包页面。');window.location.href='/red_code.php';</script>";}else{echo "<script>alert('密码或用户名错误!');history.go(-1);</script>";}}?><!DOCTYPE html><html lang="en"><head><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"><meta charset="UTF-8"><link rel="stylesheet" href="css/base.css"><link rel="stylesheet" href="css/style.css"><link rel="stylesheet" href="css/login.css"><link rel="stylesheet" href="css/laout.css"><script src="js/jquery-1.11.2.min.js"></script><script src="js/js.js"></script><script src="js/viewport.js"></script></head><body><div class="warp login-bg"><div class="login-top"><div class="headd"><a href="javascript:history.back(-1);" class="return">返回</a></div><div class="login-box"><ul><li class="active"><a href="index.php">登录</a></li> <li><a href="register.php">注册</a></li> <div class="clear"></div></ul></div></div><div class="login-form"><form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" id="form" onsubmit="return becheck();"><ul><li><div class="li-txt"><input type="text" name="username" id="userName" value="" placeholder="请输入用户名" maxlength="20" ><img src="images/lg.png" alt=""></div></li><li><div class="li-txt"><input type="text" name="password" id="password" value="" placeholder="请输入密码" maxlength="20" ><img src="images/set_icon1.png" alt=""></div></li></ul><div class="sub"><button type="submit" name="submit" id="submit">立即登录</button></div></form></div></div><script>$(function(){ init(); }) function becheck() { var userName = $('#userName').val(); var password = $('#password').val(); if (!userName) { alert("用户名不能为空!"); return false; } if (!password || password.length < 6) { alert('密码为空或少于6位'); return false; } }</script></body></html>

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复