求救啊附上源码<?php require_once('Connections/kangci.php'); ?>
<?php
$maxRows_a = 10;
$pageNum_a = 0;
if (isset($_GET['pageNum_a'])) {
$pageNum_a = $_GET['pageNum_a'];
}
$startRow_a = $pageNum_a * $maxRows_a;mysql_select_db($database_kangci, $kangci);
$query_a = "SELECT * FROM zhanghao";
$query_limit_a = sprintf("%s LIMIT %d, %d", $query_a, $startRow_a, $maxRows_a);
$a = mysql_query($query_limit_a, $kangci) or die(mysql_error());
$row_a = mysql_fetch_assoc($a);if (isset($_GET['totalRows_a'])) {
$totalRows_a = $_GET['totalRows_a'];
} else {
$all_a = mysql_query($query_a);
$totalRows_a = mysql_num_rows($all_a);
}
$totalPages_a = ceil($totalRows_a/$maxRows_a)-1;$queryString_a = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_a") == false &&
stristr($param, "totalRows_a") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_a = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_a = sprintf("&totalRows_a=%d%s", $totalRows_a, $queryString_a);
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['test'])) {
$loginUsername=$_POST['test'];
$password=$_POST['textfield'];
$MM_fldUserAuthorization = "jibie";
$MM_redirectLoginSuccess = "";
$MM_redirectLoginFailed = "chatu2.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_kangci, $kangci);
$LoginRS__query=sprintf("SELECT name, password, jibie FROM zhanghao WHERE name='%s' AND password=md5('%s')",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $kangci) or die(mysql_error());
$array=mysql_fetch_array($LoginRS);
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'jibie');
switch($array['jibie']){
case 1: $MM_redirectLoginSuccess = "chatu2.php?recordID=$loginUsername"; break;
case 2: $MM_redirectLoginSuccess = "321.php?recordID=$loginUsername"; break;
case 3: $MM_redirectLoginSuccess = "Location.php?recordID=$loginUsername"; break;
}
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>动态案例站</title>
<style type="text/css">
<!--
body {
background-image: url(7981635_091456690000_2.jpg);
background-repeat: no-repeat;
}
-->
</style>
</head>
<body><table width="100%" height="79%" border="0">
<tr>
<td height="140"> </td>
</tr>
</table>
<div align="center">
<table width="300" height="150" border="0">
<tr>
<td>
<form ACTION="<?php echo $loginFormAction; ?>" id="form1" name="form1" method="POST">
<p>
帐号:<input name="test" type="text" />
</p>
<p>
<label>
密码:<input type="password" name="textfield" />
</label>
</p>
<p><script>
function changeid(id){
document.getElementById(id).src ='yzm.php?'+Math.random(1);
}
</script>
验证码<Input type="text" name="yz" id="yz" size="8" />
<Img src="yzm.php" title="看不清,换一张" id="pc" onclick="changeid('pc')" />
<label>
<input type="submit" name="Submit" value="登入" />
</label>
</p>
</form>
</tr>
</table>
</div>
<br>
</body>
</html>
<?php
mysql_free_result($a);
?>
下面这一块是验证码……
<?php
session_start();
$nmsg="";
for($i=0;$i<4;$i++)
{
$nmsg.=dechex(mt_rand(0,15));
}
$_SESSION["code"]=$nmsg;
header("Content-Type:image/jpeg");$width=75;
$height=25;
$img=imagecreatetruecolor($width,$height);$white=imagecolorallocate($img,255,255,255);
imagefill($img,0,0,$white);
$flag=false;
if($flag)
{
$black=imagecolorallocate($img,0,0,0);
imagerectangle($img,0,0,$width-1,$height-1,$black);
}
for($j=0;$j<6;$j++)
{ $randcolor=imagecolorallocate($img,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));
imageline($img,mt_rand(0,$width),mt_rand(0,$height),mt_rand(0,$width),mt_rand(0,$height),$randcolor);
}for($k=0;$k<100;$k++)
{
$rc=imagecolorallocate($img,mt_rand(200,255),mt_rand(200,255),mt_rand(200,255));
imagestring($img,1,mt_rand(1,$width),mt_rand(1,$height),"*",$rc);}for($s=0;$s<strlen($nmsg);$s++)
{
$randcolor=imagecolorallocate($img,mt_rand(0,100),mt_rand(0,150),mt_rand(0,200));
imagestring($img,mt_rand(3,5),$s*$width/strlen($nmsg)+mt_rand(1,10),mt_rand(1,$height/2),$nmsg[$s],$randcolor);}imagejpeg($img);
imagedestroy($img);
?>
<?php
$maxRows_a = 10;
$pageNum_a = 0;
if (isset($_GET['pageNum_a'])) {
$pageNum_a = $_GET['pageNum_a'];
}
$startRow_a = $pageNum_a * $maxRows_a;mysql_select_db($database_kangci, $kangci);
$query_a = "SELECT * FROM zhanghao";
$query_limit_a = sprintf("%s LIMIT %d, %d", $query_a, $startRow_a, $maxRows_a);
$a = mysql_query($query_limit_a, $kangci) or die(mysql_error());
$row_a = mysql_fetch_assoc($a);if (isset($_GET['totalRows_a'])) {
$totalRows_a = $_GET['totalRows_a'];
} else {
$all_a = mysql_query($query_a);
$totalRows_a = mysql_num_rows($all_a);
}
$totalPages_a = ceil($totalRows_a/$maxRows_a)-1;$queryString_a = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_a") == false &&
stristr($param, "totalRows_a") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_a = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_a = sprintf("&totalRows_a=%d%s", $totalRows_a, $queryString_a);
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['test'])) {
$loginUsername=$_POST['test'];
$password=$_POST['textfield'];
$MM_fldUserAuthorization = "jibie";
$MM_redirectLoginSuccess = "";
$MM_redirectLoginFailed = "chatu2.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_kangci, $kangci);
$LoginRS__query=sprintf("SELECT name, password, jibie FROM zhanghao WHERE name='%s' AND password=md5('%s')",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $kangci) or die(mysql_error());
$array=mysql_fetch_array($LoginRS);
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'jibie');
switch($array['jibie']){
case 1: $MM_redirectLoginSuccess = "chatu2.php?recordID=$loginUsername"; break;
case 2: $MM_redirectLoginSuccess = "321.php?recordID=$loginUsername"; break;
case 3: $MM_redirectLoginSuccess = "Location.php?recordID=$loginUsername"; break;
}
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>动态案例站</title>
<style type="text/css">
<!--
body {
background-image: url(7981635_091456690000_2.jpg);
background-repeat: no-repeat;
}
-->
</style>
</head>
<body><table width="100%" height="79%" border="0">
<tr>
<td height="140"> </td>
</tr>
</table>
<div align="center">
<table width="300" height="150" border="0">
<tr>
<td>
<form ACTION="<?php echo $loginFormAction; ?>" id="form1" name="form1" method="POST">
<p>
帐号:<input name="test" type="text" />
</p>
<p>
<label>
密码:<input type="password" name="textfield" />
</label>
</p>
<p><script>
function changeid(id){
document.getElementById(id).src ='yzm.php?'+Math.random(1);
}
</script>
验证码<Input type="text" name="yz" id="yz" size="8" />
<Img src="yzm.php" title="看不清,换一张" id="pc" onclick="changeid('pc')" />
<label>
<input type="submit" name="Submit" value="登入" />
</label>
</p>
</form>
</tr>
</table>
</div>
<br>
</body>
</html>
<?php
mysql_free_result($a);
?>
下面这一块是验证码……
<?php
session_start();
$nmsg="";
for($i=0;$i<4;$i++)
{
$nmsg.=dechex(mt_rand(0,15));
}
$_SESSION["code"]=$nmsg;
header("Content-Type:image/jpeg");$width=75;
$height=25;
$img=imagecreatetruecolor($width,$height);$white=imagecolorallocate($img,255,255,255);
imagefill($img,0,0,$white);
$flag=false;
if($flag)
{
$black=imagecolorallocate($img,0,0,0);
imagerectangle($img,0,0,$width-1,$height-1,$black);
}
for($j=0;$j<6;$j++)
{ $randcolor=imagecolorallocate($img,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));
imageline($img,mt_rand(0,$width),mt_rand(0,$height),mt_rand(0,$width),mt_rand(0,$height),$randcolor);
}for($k=0;$k<100;$k++)
{
$rc=imagecolorallocate($img,mt_rand(200,255),mt_rand(200,255),mt_rand(200,255));
imagestring($img,1,mt_rand(1,$width),mt_rand(1,$height),"*",$rc);}for($s=0;$s<strlen($nmsg);$s++)
{
$randcolor=imagecolorallocate($img,mt_rand(0,100),mt_rand(0,150),mt_rand(0,200));
imagestring($img,mt_rand(3,5),$s*$width/strlen($nmsg)+mt_rand(1,10),mt_rand(1,$height/2),$nmsg[$s],$randcolor);}imagejpeg($img);
imagedestroy($img);
?>
解决方案 »
- PHP 有时候出现"数据无效 "不知道是什么原因?
- 这段代码错在哪里?判断客户端是否存在Cookie怎么判断(PHP)
- 重启了服务器,运行Discuz!首页就找不到common.inc.php了,怎么回事?
- 就加了这么一句,apache就不能启动了!!救命!
- php5中session不能保存
- 需要从比较稳定的新闻源获取新闻,请问用著名网站的滚动新闻好,还是用新闻组(nntp协议连接)的好?
- MD5密码用户验证问题,高手来啊,郁闷的很啊
- 表格中大于宽度的英文单词换行除了用<tr style=\"word-break:break-all\">,还有其他办法吗?
- 一个好的程序应该有尽量少的Mysql进程么
- 请问sprintf函数的详细运用
- php小偷程序的类,都要有什么功能呢?
- 关于html解码
if (!isset($_SESSION)) {
session_start();
}$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['test'])) {
$loginUsername=$_POST['test'];
$password=$_POST['textfield'];
$MM_fldUserAuthorization = "jibie";
$MM_redirectLoginSuccess = "";
$MM_redirectLoginFailed = "chatu2.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_kangci, $kangci);
$LoginRS__query=sprintf("SELECT name, password, jibie FROM zhanghao WHERE name='%s' AND password=md5('%s')",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $kangci) or die(mysql_error());
$array=mysql_fetch_array($LoginRS);
$loginFoundUser = mysql_num_rows($LoginRS);
if($_POST['yz'] == $_SESSION['code']) {
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'jibie');
switch($array['jibie']){
case 1: $MM_redirectLoginSuccess = "chatu2.php?recordID=$loginUsername"; break;
case 2: $MM_redirectLoginSuccess = "321.php?recordID=$loginUsername"; break;
case 3: $MM_redirectLoginSuccess = "Location.php?recordID=$loginUsername"; break;
}
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
报的错是直接说我加的这行代码错误- -