📄 fill_ad.asp
字号:
<%
DIM username,password
username=TRIM(Request.Form("username"))
password=TRIM(Request.Form("password"))
'fenlei1=TRIM(Request.Form("fenlei1"))
'再次检查口令和用户名是否为空
On Error RESUME NEXT
if username="" and password="" and session("username")="" then
response.redirect "../syspages/error_nouser.htm"
'错误:用户名或口令为空
end if
Set con=Server.CreateObject("ADODB.Connection")
con.Open Application("DBCon_ConnectionString")
if username<>"" and password<>"" then '从主页进来
'检查是否存在此用户,及是否有效"
strSql="select * from yonghu where yonghu='"+username+"' and kouling='"+password+"'"
Set rs=con.Execute(strSql)
if rs.EOF then '错误:没有这个用户
response.redirect "../syspages/error_nothisuser.htm"
end if
session("username")=username
valid=rs("youxiao")
sqlmjj="select * from fenlei1"
set rsfenlei1=con.Execute(sqlmjj)
if valid=2 then '已经发布了一条广告
strSql="SELECT * FROM guanggao where yonghu='"+username+"' "
Set rs1=con.Execute(strSql)
Session("modify")=1 '标志
end if
if valid<=0 then '无效
response.redirect "../syspages/error_invalid.htm"
end if
' if valid=1 and fenlei1="" then '第一次发布广告并且还未选择分类
' response.redirect "fill_class.asp"
' end if
classSql="SELECT * FROM fenlei1,fenlei2 where fenlei1.ID=fenlei2.fenlei1ID AND fenlei1.fenlei='"+rs1("fenlei1")+"'"
set rs2=con.Execute(classSql)
else
if session("username")<>"" and fenlei1<>"" then '
valid=1
username=Session("username")
strSql="SELECT * FROM yonghu where yonghu='"+username+"' "
classSql="SELECT * FROM fenlei1,fenlei2 where fenlei1.ID=fenlei2.fenlei1ID AND fenlei1.fenlei='"+fenlei1+"'"
Set rs=con.Execute(strSql)'要用到用户信息
if rs.EOF then '错误:没有这个用户
response.redirect "../syspages/error_nothisuser.htm"
end if
Set rs2=con.Execute(classSql)'分类信息
end if
end if
%>
<html>
<head>
<title>找一找——发布广告</title>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function form1_onsubmit() {
return check();
}
function changeclass2()
{
var mjj=document.form1.fenlei2
var dl=document.form1.fenlei1.options[document.form1.fenlei1.selectedIndex].index;
var myarray=new Array();
var list=new Array(15);
list[0]=new Array("台式机","笔记本","服务器","单片机","工控机","电脑配件","显示器");
list[1]=new Array("多媒体产品","电脑字典","机房外设","电脑外设","耗材");
list[2]=new Array("光设备","电子商务网站","布线服务","网络产品","UPS","开发与集成");
list[3]=new Array("维修","电脑培训","服务","软件专卖","租赁","建站与网页");
list[4]=new Array("出租","物业","地产","售房","二手房","房屋中介");
list[5]=new Array("维修","租赁","中介","服务","销售","装饰","车辆保险","驾照培训");
list[6]=new Array("传真机","语音产品","通讯设备","交换机","维修");
list[7]=new Array("家电","专卖店","游戏机","小家电","家庭影院","厨房电器","家电维修");
list[8]=new Array("设计咨询","家具","五金器材","装饰装修","装饰材料","交电设备");
list[9]=new Array("办公设备","设计","文化","礼品","办公用品","印刷和设备","广告","展示","策划");
list[10]=new Array("美食城","娱乐厅","保龄球","饭店餐厅","俱乐部","电话信息台");
list[11]=new Array("酒店","风景点","定票","宾馆","旅游公司","移民");
list[12]=new Array("美容整形","化妆品","培训","体育","摄影","保健","药品","艺术","器材","服务");
list[13]=new Array("婚介","工商/税务代理","职介","公证");
list[14]=new Array("咨询","家政","教学进修培训","翻译","法律","搬家","清洗","婚庆","劳务");
list[15]=new Array("交易市场","饰品","商场","着装专卖","饰品");
myarray=list[dl];
mjj.length=0
for(var i=0;i<=myarray.length-1;i++)
{
mjj.options[i]=new Option(myarray[i]);
}
mjj.options[0].selected=true
}
function check()
{
var form=document.form1;
if(form.dianhua.value.length>0)
{
if(!JudgePhone(form.dianhua.value))
{
window.alert("请输入合法电话!");
form.dianhua.focus();
return false;
}
}
if(form.e_mail.value.length>0)
{
if(!JudgeEmail(form.e_mail.value))
{
window.alert("请输入正确的电子邮件地址!");
form.e_mail.focus();
return false;
}
return true;
}
if(form.neirong.value.length<=0)
{
window.alert("请输入广告内容!");
form.neirong.focus();
return false;
}
if(form.neirong.value.length>600)
{
window.alert("广告长度不得大于600字!");
form.neirong.focus();
return false;
}
if(form.fenlei1.value=="0")
{
window.alert("请选择广告分类!");
form.fenlei1.focus();
return false;
}
return true;
}
//判断电话号码有效性
function JudgePhone(strPass)
{
var array,intTmp,strTmp,i;
var re1=/0/gi;
strPass=strPass.replace(re1,"1");
array=strPass.split("-");
for (i=0;i<array.length;i++)
{
intTmp=parseFloat(array[i]);
strTmp=intTmp.toString();
if (strTmp.length!=array[i].length)
return false;
}
return true;
}
//判断E-mail有效性
function JudgeEmail(strPass)
{
var array,strTmp,re1,re2;
re1=/@/i;
if (strPass.search(re1)==-1)
return false;
array=strPass.match(re1);
return true;
if (array.length==1)
{
re2=/\./i;
if (strPass.search(re1)<strPass.search(re2))
return true;
}
return false;
}
function fenlei1_onclick() {
changeclass2();
}
function window_onload() {
changeclass2();
}
//-->
</SCRIPT>
<link rel="stylesheet" href="../html/3508.css">
<style type="text/css">
<!--
.botton { font-size: 12px; color: #000000; background-color: #FFFFE8}
.hello { color: #990099}
.white { color: #000000}
-->
</style>
</head>
<body background="../images/bg1.gif" LANGUAGE=javascript onload="return window_onload()">
<table width="740" border="0" cellspacing="0" cellpadding="0" align="center" height="40">
<tr>
<td width="192" height="39" align="center" valign="bottom"><img src="../images/newzhao1zhao.gif" width="140" height="50"></td>
<td colspan="2" align="right" height="39" valign="bottom">
<table width="480" border="1" bordercolordark="#FFFFFF" bordercolorlight="#FFFFFF" bgcolor="#CCCCFF" cellpadding="0" cellspacing="0" height="22">
<tr align="center">
<td width="75" bordercolorlight="#FFFFFF" bordercolordark="#000000" align="center" height="18"><a href="../html/navigator.asp" class="black">本站导航</a></td>
<td width="75" bordercolorlight="#FFFFFF" bordercolordark="#000000" align="center" height="18">
<a href="../sh/search.asp" class="black">二手市场</a></td>
<td width="75" bordercolorlight="#FFFFFF" bordercolordark="#000000" align="center" height="18"><a href="../chat/default.asp" class="black">供求信息</a></td>
<td width="75" bordercolorlight="#FFFFFF" bordercolordark="#000000" align="center" height="18"><a href="../news/index.asp" class="black">精品生活</a></td>
<td width="75" bordercolorlight="#FFFFFF" bordercolordark="#000000" align="center" height="18">
<a href="../lovelife/default.asp" class="black">我爱生活</a></td>
<td width="75" bordercolorlight="#FFFFFF" bordercolordark="#000000" align="center" height="18"><a href="../xhtj/index.asp" class="black">笑话天地</a></td>
<td width="75" bordercolorlight="#FFFFFF" bordercolordark="#000000" align="center" height="18"><a href="../diaocha1/diaocha1.asp" class="black">调查生活</a></td>
<td width="75" bordercolorlight="#FFFFFF" bordercolordark="#000000" align="center" height="18"><a href="../club/Default.asp" class="black">生活社区</a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="3" height="1" bgcolor="006600"></td>
</tr>
</table>
<table width="740" border="0" cellspacing="0" cellpadding="0" align="center">
<tr bgcolor="#33CCFF">
<td height="17" bgcolor="#33CCFF" width="445">【本站导航】<a href="../default.asp">首页</a>>><%if valid=1 then%><span class="white">发布广告</span><%else%><span class="white">修改广告</span><%end if%></td>
<td height="17" width="295" class="white">Http://www.zhao1zhao.com</td>
</tr>
</table>
<br>
<br>
<table width="600" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="298" height="25"><%=username%>,您好!</td>
</tr>
<tr>
<%if valid=1 then%>
<td width="298" height="24">欢迎发布您的广告!</td>
<%else%>
<td width="298" height="24">欢迎修改您的广告!</td>
<%end if%>
</tr>
</table>
<form method="post" action="add_ad.asp" id=form1 name=form1 LANGUAGE=javascript onsubmit="return form1_onsubmit()">
<table width="640" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="18" width="100" align="center">【广告所属大类】</td>
<td height="18" width="226">
<%if valid=1 then%>
<select name="fenlei1" class="botton" onchange="changeclass2()">
<%
first=true
while not rsfenlei1.eof
if first then
%>
<option value=<%=rsfenlei1("fenlei1")%> selected><%=rsfenlei1("fenlei")%></option>
<%
first=false
rsfenlei1.movenext
else
%>
<option value=<%=rsfenlei1("fenlei1")%>><%=rsfenlei1("fenlei")%></option>
<%
rsfenlei1.movenext
end if
wend
%>
</select>
<%else
'response.write rs1("fenlei1")&"mjjjjjj"
%> <select name="fenlei1" class="botton" onchange="changeclass2()" onclick="return fenlei1_onclick()">
<%
while not rsfenlei1.eof
%>
<option value=<%=rsfenlei1("fenlei")%><%if rsfenlei1("fenlei")=rs1("fenlei1") then%> selected<%end if%>><%=rsfenlei1("fenlei")%></option>
<%
rsfenlei1.movenext
wend
%>
</select>
<%end if
'response.write rs2.eof
'response.end
%>
</td>
<td height="18" width="77" align="center">【详细类别】</td>
<td height="18" width="237">
<%if valid=1 then%>
<select name="fenlei2" class="botton">
<option selected>台式机
<option>笔记本
<option>服务器
<option>单片机
<option>工控机
<option>电脑配件
<option>显示器
</select>
<%else%>
<select name="fenlei2" class="botton">
<%while not rs2.eof%>
<option <%if rs2("fenlei2")=rs1("fenlei2") then%>selected<%end if%>><%=rs2("fenlei2")%>
<%
rs2.movenext
wend
end if
%>
</select>
</td>
</tr>
<tr><td colspan="4" height="1" bgcolor="006600"></td></tr>
<tr>
<td colspan="4"> </td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" align="center" height="15" width="600">
<tr>
<td height="16" width="53%">联系人:
<input name="lianxiren" size="14"
value="<%if valid=2 then%><%=rs1("lianxiren")%><%else%><%=rs("lianxiren")%><%end if%>" maxlength="10" class="botton">
* </td>
<td height="16" width="47%">电话:
<input name="dianhua" size="36"
value="<%if valid=2 then%><%=rs1("dianhua")%><%else%><%=rs("dianhua")%><%end if%>" maxlength="40" class="botton">
</td>
</tr>
<tr>
<td height="16" width="53%">地 址:
<input name="dizhi" size="40"
value="<%if valid=2 then%><%=rs1("dizhi")%><%else%><%=rs("dizhi")%><%end if%>" maxlength="80" class="botton">
*</td>
<td height="16" width="47%">邮编:
<input name="youbian" size="16"
value="<%if valid=2 then%><%=rs1("youbian")%><%else%><%=rs("youbian")%><%end if%>" maxlength="16" class="botton">
*</td>
</tr>
<tr>
<td height="16" width="53%">国 家:
<input name="guojia" size="16"
value="<%if valid=2 then%><%=rs1("guojia")%><%else%><%=rs("guojia")%><%end if%>" maxlength="20" class="botton">
</td>
<td height="16" width="47%">城市:
<input name="chengshi" size="9"
value="<%if valid=2 then%><%=rs1("chengshi")%><%else%><%=rs("chengshi")%><%end if%>" class="botton">
* </td>
</tr>
<tr>
<td height="16" colspan="2">E_mail:
<input name="e_mail"
value="<%if valid=2 then%><%=rs1("e_mail")%><%else%><%=rs("e_mail")%><%end if%>"
size="35" maxlength="35" class="botton" >
*</td>
</tr>
<tr>
<td height="16" width="53%">广告内容:*</td>
<td height="16" width="47%">
<input type="hidden" name="danwei" value="<%=rs("danwei")%>">
</td>
</tr>
<tr align="center">
<td height="16" colspan="2">
<textarea cols=80 name=neirong rows=9 class="botton"
><%if valid=2 then%><%=replace(rs1("neirong"),"<br>",vbcrlf)%><%end if%></textarea>
</td>
</tr>
<tr>
<td height="16" colspan="2">代理商/分公司/连锁店:
<input name="dailishang" size="50"
value="<%if valid>1 then%><%=rs1("dailishang")%><%end if%>" maxlength="50" class="botton">
</td>
</tr>
<tr>
<td height="16" colspan="2"> </td>
</tr>
<tr align="center">
<td height="16" colspan="2">
<input type="hidden" name="youxiao"
value="<%if valid>=0 then%><%=valid%><%end if%>">
<input type="reset" value="重填" id=button1 name=button1 class="botton">
<input type="submit" value="发布" id=submit1 name=submit1 class="botton">
</td>
</tr>
</table>
</form>
<!--#include file="../include/end.htm" -->
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -