| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 600 人关注过本帖
标题:菜鸟问题请各位大哥帮忙啊!
只看楼主 加入收藏
feijia
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2005-12-14
收藏
 问题点数:0 回复次数:3 
菜鸟问题请各位大哥帮忙啊!

我想在下面的代码中读取数据库USER 表中 USER =NAME (数据库中的)字段 的值WEBRUL 值请问怎么来 添加 这段代码 请各位高手大哥帮忙啊!谢谢了

<!-- #include file="conn.asp" -->

<SCRIPT Language=javascript>
<!--

function fucCheckTEL(TEL)
{
var i,j,strTemp;
strTemp="0123456789-()# ";
for (i=0;i<TEL.length;i++)
{
j=strTemp.indexOf(TEL.charAt(i));
if (j==-1)
{
//说明有字符不合法
return 0;
}
}
//说明合法
return 1;
}

function fucCheckPrice(Price)
{
var i,j,strTemp;
strTemp="0123456789";
for (i=0;i<Price.length;i++)
{
j=strTemp.indexOf(Price.charAt(i));
if (j==-1)
{
//说明有字符不合法
return 0;
}
}
//说明合法
return 1;
}


function CheckData2()
{
if (form2.title.value == "")
{
window.alert("标题不能为空!!");
return false;
}
else if (form2.price.value == "")
{
window.alert("价格不能为空!!");
return false;
}
else if (fucCheckPrice(form2.price.value) == 0)
{
window.alert("价格需为整数!!");
return false;
}
else if (form2.intro.value == "")
{
window.alert("内容不能为空!!");
return false;
}
else if (fucCheckTEL(form2.phone.value) == 0)
{
window.alert("电话格式不对!!");
return false;
}
else//通过所有检查
form2.submit(); //送出表单中的数据
}
-->
</SCRIPT>

<%
username=trim(Request.Form("username"))
userpass=trim(Request.Form("userpass"))
if username<>"" and userpass<>"" then
exec_index="select * from [user] where name='"&username&"' and password='"&userpass&"'"
set rs=server.createobject("adodb.recordset")
rs.open exec_index,conn,1,3
if not rs.eof then
userip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If userip = "" Then userip = Request.ServerVariables("REMOTE_ADDR")
rs("user_ip")=userip
rs("user_lastlogintime")=now()
rs.update
session("user")=username
else
%>
<SCRIPT Language=javascript>
<!--
window.alert("用户名或密码错误!!");
-->
</SCRIPT>
<%
end if
end if
%>

<html>
<head>
<TITLE>欢迎光临中国狗市——宠物交易网</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<link rel="stylesheet" href="css.css">
<body leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">


<table width="760" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"><!-- #include file="head.asp" --></td>
</tr>
<tr>
<td height="25" colspan="3"><!-- #include file="menu.asp" --></td>
</tr>

<tr valign="top">
<%
if session("user")="" then
%>
<td width="192" height="150">
<!-- #include file="left.asp" --></td>
<%
else
%>
<td width="192" height="150">
<!-- #include file="left_user.asp" --></td>
<%
end if
%>

<td height="570" width="570" rowspan="2" colspan="2">



<%
set rs=server.createobject("adodb.recordset")
sql = "select * from sclass"
rs.open sql,conn,1,1
%>

<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("sclass_name"))%>","<%= trim(rs("sclass_parent"))%>","<%= trim(rs("sclass_id"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;

function changelocation(locationid)
{
document.form2.sclass.length = 0;

var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.form2.sclass.options[document.form2.sclass.length] = new Option(subcat[i][0], subcat[i][2]);
}
}

}
</script>

<form method="post" action="putout_ok.asp" name="form2">
<table width="570" border="0.5" cellpadding="0" cellspacing="0" bordercolor="#999999">
<tr>
<td width="79" height="25" align="right">&nbsp;</td>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td height="25" align="right">种类:&nbsp;&nbsp;</td>
<td colspan="2"> <select name="kind" id="kind">
<option value="出 售">出 售</option>
<option value="求 购">求 购</option>
<option value="配 种">配种服务</option>
<option value="宣 传">展示宣传</option>
</select>
*务必选正确</td>
</tr>
<%
exec_putout1="select * from bclass"
set rs=server.createobject("adodb.recordset")
rs.open exec_putout1,conn,1,1
idd=rs("bclass_id")
%>
<tr>
<td height="25" align="right">分类:&nbsp;&nbsp;</td>
<td colspan="2"> <select name="bclass" onChange="changelocation(document.form2.bclass.options[document.form2.bclass.selectedIndex].value)">
<option value='<%=rs("bclass_id")%>'"><%=rs("bclass_name")%></option>
<%
rs.movenext
do while not rs.eof
%>
<option value='<%=rs("bclass_id")%>'"><%=rs("bclass_name")%></option>
<%
rs.movenext
loop
rs.close
%>
</select>
<%
set rs=server.createobject("adodb.recordset")
sql = "select * from sclass where sclass_parent="&idd
rs.open sql,conn,1,1
%>
<select name="sclass">
<%
do while not rs.eof
%>
<option value='<%=rs("sclass_id")%>'"><%=rs("sclass_name")%></option>
<%
rs.movenext
loop
rs.close
%>
</select> </td>
</tr>
<tr>
<td height="25" align="right">标题:&nbsp;&nbsp;</td>
<td colspan="2"><input name="title" type="text" id="title" maxlength="15">
*请直接描述,请勿使用不雅字眼,
<input type="hidden" name="hits" value="0">
</td>
</tr>
<tr>
<td height="25" align="right">价格:&nbsp;&nbsp;</td>
<td colspan="2">
<input name="price" type="text" id="price" maxlength="5" onKeyUp="value=value.replace(/[^\d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" value="0">
元&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*请使用整数,求购信息不能确定价格时请写0</td>
</tr>
<tr valign="top">
<td height="135" align="right">内容:&nbsp;&nbsp;</td>
<td width="372"><textarea name="intro" id="intro" cols="70" rows="10"></textarea>
</td>
<td width="119" valign="middle">*内容请详细描述您的物品,诸如几成新等等。请注明交易方式、时间、联系方法</td>
</tr>
<tr>
<td align="right">商品图片:&nbsp;&nbsp;</td>
<td colspan="2">
<input type="text" name="pic" id="pic">
*上传图片后该项系统自动填写</td>
</tr>
<tr>
<td colspan="3"><IFRAME src="upfile.asp" frameBorder=0 width="100%" height="30" scrolling=no height=21></IFRAME></td>
</tr>
<tr>
<td height="25" align="right">有效期:&nbsp;&nbsp;</td>
<td colspan="2"> <select name="expiredays" id="expiredays">
<option value="45" yes>45</option>
<option value="30">30</option>
<option value="20">20</option>
<option value="15">15</option>
<option value="10">10</option>
<option value="7">7</option>
<option value="5">5</option>
<option value="3">3</option>
</select>
天</td>
</tr>
<tr>
<td height="25" align="right">手机/电话:&nbsp;&nbsp;</td>
<td colspan="2"><input name="phone" type="text" id="phone" maxlength="20">
*在内容中注明了其他联系方式,此项可以不填</td>
</tr>
<tr>
<td align="right">信息推送:&nbsp;&nbsp;</td>
<td colspan="2"><input name="ifpush" type="checkbox" id="ifpush" value="push">
*若选择该项系统将会发送小纸条提示与你这条信息相关的信息(详情请参阅帮助)</td>
</tr>
<tr>
<td align="right">&nbsp;</td>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td></td>
<td height="25" colspan="2" align="left"><input type="button" value="发布信息" onClick="CheckData2()"></td>
</tr>
<tr>
<td align="right">&nbsp;</td>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td height="25" align="right">提示:</td>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td height="25" align="right">1.</td>
<td colspan="2">&nbsp;请在发布信息前先搜索</td>
</tr>
<tr>
<td height="25" align="right">2.</td>
<td colspan="2">&nbsp;如您发布信息成功后发现信息有误,请到用户面板中修改信息</td>
</tr>
<tr>
<td height="25" align="right">3.</td>
<td colspan="2">&nbsp;如果该信息已成交,请到用户面板中修改信息状态,防止别人打扰</td>
</tr>
<tr>
<td height="25" align="right"></td>
<td colspan="2">&nbsp;&nbsp;</td>
</tr>
</table>
</form>



</td>

</tr>
<tr>
<td valign="top">

</td>
</tr>
<tr>
<td height="55" colspan="3"><!-- #include file="foot.asp" --></td>
</tr>
</table>
</body>
</html>

搜索更多相关主题的帖子: 数据库 strTemp TEL 
2005-12-14 13:34
dpxdpx
Rank: 1
等 级:新手上路
帖 子:230
专家分:0
注 册:2005-11-22
收藏
得分:0 
&lt;%=rs("webrul")%&gt;

从不懂到懂点点到有点懂到懂点了到想搞懂更多到问题更多了到不懂的更多了到编程论坛请教大家来了!
2005-12-14 13:36
conn
Rank: 2
等 级:新手上路
威 望:5
帖 子:420
专家分:0
注 册:2005-11-27
收藏
得分:0 
LZ大哥,有你这样问问题的吗?这么长的代码,谁有那么多时间了?
你问的直截了当一点,那个地方不明白就OK了嘛

我是新手,但我很虚心,对我发的问题请不要取笑,谢谢
2005-12-14 13:37
feijia
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2005-12-14
收藏
得分:0 
问题好象没有这么简单!我测试过了不行啊
2005-12-14 13:38
快速回复:菜鸟问题请各位大哥帮忙啊!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.045765 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved