?? 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")
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 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("廣告長度不得大于300字!");
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;
}
//-->
</SCRIPT>
<link rel="stylesheet" href="../html/3508.css">
<style type="text/css">
<!--
.botton { font-size: 12px; color: #000000; background-color: #FFFFE8}
-->
</style>
</head>
<body background="../images/bg1.gif">
<table width="740" border="0" cellspacing="0" cellpadding="0" align="center" height="40">
<tr>
<td width="217" height="39" align="center" valign="bottom"><img src="../images/smallmark.gif" width="120" height="25"></td>
<td width="523" valign="bottom" height="39"><a href="../default.asp">本站首頁</a>
>> 供求信息</td>
</tr>
<tr>
<td colspan="2" height="1" bgcolor="006600"></td>
</tr>
</table>
<p><%=username%>,您好! </p>
<%if valid=1 then%>
歡迎發布您的廣告!
<%else%>
歡迎修改您的廣告!
<%end if%>
<form method="post" action="add_ad.asp" id=form1 name=form1 LANGUAGE=javascript onsubmit="return form1_onsubmit()">
<table width="80%" border="0" cellspacing="0" cellpadding="0" align="center" height="15">
<tr>
<td height="16" width="54%">聯系人:
<input name="lianxiren" size="14"
value="<%if valid=2 then%><%=rs1("lianxiren")%><%else%><%=rs("lianxiren")%><%end if%>" maxlength="10">
* </td>
<td height="16" width="46%">電話:
<input name="dianhua" size="36"
value="<%if valid=2 then%><%=rs1("dianhua")%><%else%><%=rs("dianhua")%><%end if%>" maxlength="40">
*</td>
</tr>
<tr>
<td height="16" width="54%">地 址:
<input name="dizhi" size="40"
value="<%if valid=2 then%><%=rs1("dizhi")%><%else%><%=rs("dizhi")%><%end if%>" maxlength="80">
*</td>
<td height="16" width="46%">郵編:
<input name="youbian" size="16"
value="<%if valid=2 then%><%=rs1("youbian")%><%else%><%=rs("youbian")%><%end if%>" maxlength="16">
*</td>
</tr>
<tr>
<td height="16">國 家:
<input name="guojia" size="16"
value="<%if valid=2 then%><%=rs1("guojia")%><%else%><%=rs("guojia")%><%end if%>" maxlength="20">
</td>
<td height="16">城市:
<input name="chengshi" size="9"
value="<%if valid=2 then%><%=rs1("chengshi")%><%else%><%=rs("chengshi")%><%end if%>">
* </td>
</tr>
<tr>
<td height="16" colspan="2">E_mail:
<input name="e_mail"
value="<%if valid=2 then%><%=rs1("chengshi")%><%else%><%=rs("e_mail")%><%end if%>"
size="23" maxlength="20" >
*</td>
</tr>
<tr>
<td height="16">廣告內容:*</td>
<td height="16">
<input type="hidden" name="danwei" value="<%=rs("danwei")%>">
</td>
</tr>
<tr>
<td height="16" colspan="2">
<textarea cols=80 name=neirong rows=9
><%if valid=2 then%><%=replace(rs1("neirong"),"<br>",vbcrlf)%><%end if%></textarea>
</td>
</tr>
<tr>
<td height="16" colspan="2">代理商/分公司/連鎖店:
<input name="dailishang" size="60"
value="<%if valid<=0 then%><%=rs1("dailishang")%><%end if%>" maxlength="50">
</td>
</tr>
<tr>
<td height="16">分類:
<%if valid=1 then%> <%=fenlei1%>
<input type="hidden" name=fenlei1 value="<%=fenlei1%>">
<%else%> <%=rs1("fenlei1")%>
<input type="hidden" name=fenlei1 value="<%=rs1("fenlei1")%>">
<%end if%>
</td>
<td height="16">詳細分類:
<%if valid=1 then%>
<select name="fenlei2" size="1">
<option value='0' selected>---請選擇分類---</option>
<%While not rs2.EOF%>
<option value='<%=rs2("fenlei2")%>'><%=rs2("fenlei2")%></option>
<%rs2.MoveNext%>
<%Wend%>
</select>
<%else%>
<select name="fenlei2" size="1">
<%While not rs2.EOF%>
<option value="<%=rs2("fenlei2")%>"
<% if rs1("fenlei2")=rs2("fenlei2") then%> selected <%end if%>
><%=rs2("fenlei2")%></option>
<%rs2.MoveNext%>
<%wend%>
</select>
<%end if%>
</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 + -