谁能把这段ASP代码转换成PHP
<%@Language=VBScriptCodePage=936%><!--#includefile="conn.asp"--><%IfRequest.Querystri...
<%@ Language=VBScript CodePage=936%>
<!--#include file="conn.asp" -->
<%
If Request.Querystring("action")="add" then
dim gonghuiid,zhiwu,qq,xuanyan
gonghuiid = Trim(request.form("gonghuiid"))
zhiwu = Trim(request.form("zhiwu"))
qq= Trim (request.Form("qq"))
xuanyan = Trim(request.form("xuanyan"))
Set rs= Server.CreateObject("adodb.recordSet")
Sql="Select * from 数据 where gonghuiid='"&gonghuiid&"' and zhiwu='"&zhiwu&"' and qq='"&qq&"' and xuanyan='"&xuanyan&"'"
rs.open Sql,conn,1,3
If not (rs.eof and rs.bof) then
Response.Write"<script>alert('提交完成!马上转入浏览状态');this.location.href='asp/img.asp?id="&rs("id")&"';</SCRIPT>"
response.end
Else
rs.addnew
rs("zhiwu")= zhiwu
rs("gonghuiid")= gonghuiid
rs("qq")= qq
rs("xuanyan")= xuanyan
rs.update
Response.Write"<script>alert('提交完成!马上转入浏览状态');this.location.href='asp/img.asp?id="&rs("id")&"';</SCRIPT>"
response.end
end if
End If
rs.close
Set rs=nothing
End If
conn.close
Set conn=nothing
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>论坛名片生成系统</title>
<link rel="stylesheet" type="text/css" href="Skins/Style_1.css" />
<style type="text/css">
<!--
.STYLE1 {
font-size: xx-large;
font-weight: bold;
}
-->
</style>
</head>
<body>
<table width="800" border="0" align="center">
<tr>
<td><form method="POST" name="form1" action="?action=add"><table width="800" border="0">
<tr>
<td colspan="2" align="center"><span class="STYLE1">论坛名片生成系统</span></td>
</tr>
<tr>
<td width="100" align="right">游戏名字:</td>
<td><input type="text" name="gonghuiid" size="32"></td>
</tr>
<tr>
<td width="100" align="right">帮会职务:</td>
<td><input type="text" name="zhiwu" size="32"></td>
</tr>
<tr>
<td width="100" align="right">OICQ号码:</td>
<td><input type="text" name="qq" size="32"></td>
</tr>
<tr>
<td width="100" align="right">个人宣言:</td>
<td><input type="text" name="xuanyan" size="32"></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="提交" name="B1">
<input type="reset" value="重置" name="B2">
</td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td align="center"><table width="700" border="0">
<tr>
<td align="center"><img border="0" src="asp/img.asp?id=1"></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html> 展开
<!--#include file="conn.asp" -->
<%
If Request.Querystring("action")="add" then
dim gonghuiid,zhiwu,qq,xuanyan
gonghuiid = Trim(request.form("gonghuiid"))
zhiwu = Trim(request.form("zhiwu"))
qq= Trim (request.Form("qq"))
xuanyan = Trim(request.form("xuanyan"))
Set rs= Server.CreateObject("adodb.recordSet")
Sql="Select * from 数据 where gonghuiid='"&gonghuiid&"' and zhiwu='"&zhiwu&"' and qq='"&qq&"' and xuanyan='"&xuanyan&"'"
rs.open Sql,conn,1,3
If not (rs.eof and rs.bof) then
Response.Write"<script>alert('提交完成!马上转入浏览状态');this.location.href='asp/img.asp?id="&rs("id")&"';</SCRIPT>"
response.end
Else
rs.addnew
rs("zhiwu")= zhiwu
rs("gonghuiid")= gonghuiid
rs("qq")= qq
rs("xuanyan")= xuanyan
rs.update
Response.Write"<script>alert('提交完成!马上转入浏览状态');this.location.href='asp/img.asp?id="&rs("id")&"';</SCRIPT>"
response.end
end if
End If
rs.close
Set rs=nothing
End If
conn.close
Set conn=nothing
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>论坛名片生成系统</title>
<link rel="stylesheet" type="text/css" href="Skins/Style_1.css" />
<style type="text/css">
<!--
.STYLE1 {
font-size: xx-large;
font-weight: bold;
}
-->
</style>
</head>
<body>
<table width="800" border="0" align="center">
<tr>
<td><form method="POST" name="form1" action="?action=add"><table width="800" border="0">
<tr>
<td colspan="2" align="center"><span class="STYLE1">论坛名片生成系统</span></td>
</tr>
<tr>
<td width="100" align="right">游戏名字:</td>
<td><input type="text" name="gonghuiid" size="32"></td>
</tr>
<tr>
<td width="100" align="right">帮会职务:</td>
<td><input type="text" name="zhiwu" size="32"></td>
</tr>
<tr>
<td width="100" align="right">OICQ号码:</td>
<td><input type="text" name="qq" size="32"></td>
</tr>
<tr>
<td width="100" align="right">个人宣言:</td>
<td><input type="text" name="xuanyan" size="32"></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="提交" name="B1">
<input type="reset" value="重置" name="B2">
</td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td align="center"><table width="700" border="0">
<tr>
<td align="center"><img border="0" src="asp/img.asp?id=1"></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html> 展开
2个回答
展开全部
<?
include("conn.asp");
if($_GET['action']=="add")
{
$gonghuiid =trim($_POST['gonghuiid']);
$zhiwu = trim($_POST['zhiwu']);
$qq= trim($_POST['qq']);
$xuanyan = trim($_POST['xuanyan']);
$Sql="Select * from 数据 where gonghuiid='".$gonghuiid."' and zhiwu='".$zhiwu."' and qq='".$qq."' and xuanyan='".$xuanyan."'"
$result = mysql_query($sql,$conn);
$num = mysql_num_rows($result);
// ;
if($num>0)
{
echo "<script>alert('提交完成!马上转入浏览状态');this.location.href='asp/img.asp?id="&rs("id")&"';</SCRIPT>";
}else
{
$sq = "insert into 数据 (gonghuiid,zhiwu,qq,xuanyan) VALUES ('".$gonghuiid."','".$zhiwu."','".$qq."','".$xuanyan."')";
mysql_query($sq);
echo "<script>alert('提交完成!马上转入浏览状态');this.location.href='asp/img.asp?id=".$id."';</SCRIPT>";
}
mysql_close($conn);
}
?>
include("conn.asp");
if($_GET['action']=="add")
{
$gonghuiid =trim($_POST['gonghuiid']);
$zhiwu = trim($_POST['zhiwu']);
$qq= trim($_POST['qq']);
$xuanyan = trim($_POST['xuanyan']);
$Sql="Select * from 数据 where gonghuiid='".$gonghuiid."' and zhiwu='".$zhiwu."' and qq='".$qq."' and xuanyan='".$xuanyan."'"
$result = mysql_query($sql,$conn);
$num = mysql_num_rows($result);
// ;
if($num>0)
{
echo "<script>alert('提交完成!马上转入浏览状态');this.location.href='asp/img.asp?id="&rs("id")&"';</SCRIPT>";
}else
{
$sq = "insert into 数据 (gonghuiid,zhiwu,qq,xuanyan) VALUES ('".$gonghuiid."','".$zhiwu."','".$qq."','".$xuanyan."')";
mysql_query($sq);
echo "<script>alert('提交完成!马上转入浏览状态');this.location.href='asp/img.asp?id=".$id."';</SCRIPT>";
}
mysql_close($conn);
}
?>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<?
include("conn.asp");
if($_GET['action']=="add")
{
$gonghuiid
=trim($_POST['gonghuiid']);
$zhiwu
=
trim($_POST['zhiwu']);
$qq=
trim($_POST['qq']);
$xuanyan
=
trim($_POST['xuanyan']);
$Sql="Select
*
from
数据
where
gonghuiid='".$gonghuiid."'
and
zhiwu='".$zhiwu."'
and
qq='".$qq."'
and
xuanyan='".$xuanyan."'"
$result
=
mysql_query($sql,$conn);
$num
=
mysql_num_rows($result);
//
;
if($num>0)
{
echo
"<script>alert('提交完马转入浏览状态');this.location.href='asp/img.asp?id="&rs("id")&"';</SCRIPT>";
}else
{
$sq
=
"insert
into
数据
(gonghuiid,zhiwu,qq,xuanyan)
VALUES
('".$gonghuiid."','".$zhiwu."','".$qq."','".$xuanyan."')";
mysql_query($sq);
echo
"<script>alert('提交完马转入浏览状态');this.location.href='asp/img.asp?id=".$id."';</SCRIPT>";
}
mysql_close($conn);
}
?>
include("conn.asp");
if($_GET['action']=="add")
{
$gonghuiid
=trim($_POST['gonghuiid']);
$zhiwu
=
trim($_POST['zhiwu']);
$qq=
trim($_POST['qq']);
$xuanyan
=
trim($_POST['xuanyan']);
$Sql="Select
*
from
数据
where
gonghuiid='".$gonghuiid."'
and
zhiwu='".$zhiwu."'
and
qq='".$qq."'
and
xuanyan='".$xuanyan."'"
$result
=
mysql_query($sql,$conn);
$num
=
mysql_num_rows($result);
//
;
if($num>0)
{
echo
"<script>alert('提交完马转入浏览状态');this.location.href='asp/img.asp?id="&rs("id")&"';</SCRIPT>";
}else
{
$sq
=
"insert
into
数据
(gonghuiid,zhiwu,qq,xuanyan)
VALUES
('".$gonghuiid."','".$zhiwu."','".$qq."','".$xuanyan."')";
mysql_query($sq);
echo
"<script>alert('提交完马转入浏览状态');this.location.href='asp/img.asp?id=".$id."';</SCRIPT>";
}
mysql_close($conn);
}
?>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询