<!--#include file="conn.asp"-->
<!--#include file="ubb.asp"-->
<%
 if request.QueryString("action")="del" then
conn.execute "delete from notify where newsid in ("&request.form("selectdel")&")"
response.Redirect  "editnews.asp"
end if %>
<title>GUESTBOOK--CHUNLIN'S OIL PAINTINGS GALLERY|Tibet oil paintings|Tibet arts|Tibet pictures|Tibet photo|Oil paintings about Tibet</title> 

<!--#include file="include/etop.asp"-->

<TABLE WIDTH="760" BORDER="0" CELLSPACING="0" CELLPADDING="0" ALIGN="CENTER">






<tr> 
          <td height="20"></td>
        </tr>
<tr>
<td  colspan=2>

<%

 if request.QueryString("action")="save" then
Dim ErrorMessage
if trim(session("validateCode")) <> trim(Request("txt_check")) then
ErrorMessage = "Please enter right verification code."
response.write(" <script>alert('"&ErrorMessage&"');history.go(-1);</script>")
response.end
end if
%>



<%



  function HTMLEncode2(fString)
	fString = Replace(fString, CHR(13), "")
	fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
	fString = Replace(fString, CHR(10), "<BR>")
	HTMLEncode2 = fString
    end function
dim pos1,pos2,pos3,pos4,notifycontent,pos5,pos6
notifycontent=trim(request.form("newscontent"))
 if request.QueryString("action")="save" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from notify",conn,1,3
pos1 = Instr(notifycontent, "url=")
pos2 = Instr(notifycontent, "href=")
pos3 = Instr(notifycontent, "URL=")
pos4 = Instr(notifycontent, "HREF=")
pos5 = Split(notifycontent,"http://")
pos6 = UBound(pos5)
 if pos1=0 and pos2=0 and pos3=0 and pos4=0 And pos6<3 then
rs.addnew
rs("newsname")=trim(request.form("newsname"))
rs("addname")=trim(request.form("addname"))

rs("newscontent")=HTMLEncode2(trim(request.form("newscontent")))
rs("tel")=trim(request.form("tel"))
rs("email")=trim(request.form("email"))
rs("adddate")=now()
rs("viewnum")=0
rs.update
response.write "<script language=javascript>alert('OK！');history.go(-1);</script>"
response.End
  else
response.write "<script language=javascript>alert('Error！');history.go(-1);</script>"
response.End
    end if
rs.close
set rs=nothing

end If

end if 
%>

<table width="400" border="0" cellspacing="0" cellpadding="0" align="center"> 
<tr> 
    <td> <table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#000000">
        

<tr> 
          <td height="20" ALIGN="CENTER" bgcolor="#ffffff"><FONT COLOR="#000000">SIGN</FONT></td>
        </tr>
		<tr> 
          <td height="20" ALIGN="CENTER" bgcolor="#ffffff"><FONT COLOR="#000000">Please call(+86)13916806875 or<br>mail to 13916806875#139.com(Please replace # by @)<br> if you want to buy the oil-paintings.</FONT></td>
        </tr>

        <tr> 
          <td height="168" valign="top"  bgcolor="#ffffff"> 
		  <form name="form1" method="post" action="guestbook.asp?action=save">
              <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr> 
                  <td width="20%" style="PADDING-LEFT: 8px" align="center">Title：</td>
                  <td width="80%"> <input name="newsname" type="text" id="newsname" SIZE="50"></td>
                </tr>
                <tr> 
                  <td style="PADDING-LEFT: 8px" align="center">Name：</td>
                  <td> <input name="addname" type="text" id="addname" SIZE="50"></td>
                </tr>
				<tr> 
                  <td style="PADDING-LEFT: 8px" align="center" colspan=2><font color=red>Please fill in your phone number or E-mail.</td>
                </tr>
                <tr> 
                  <td style="PADDING-LEFT: 8px" align="center">E-mail：</td>
                  <td> <input name="email" type="text" id="email" SIZE="50"></td>
                </tr>
                <tr> 
                  <td style="PADDING-LEFT: 8px" align="center">Phone：</td>
                  <td> <input name="tel" type="text" id="tel" SIZE="50"></td>
                </tr>

<tr> 
                  <td style="PADDING-LEFT: 8px" valign="top" align="center">Content：</td>
                  <td><TEXTAREA NAME="newscontent" COLS="51" ROWS="10" ID="newscontent"></TEXTAREA></td>
                </tr>
 <tr > 
            <td align="center">Verification Code：</td>
            <td>		 <input name="txt_check" type="text" size=6 maxlength=4 class="input"> <img src="checkcode.asp " alt="Refesh" height="10" style="cursor : pointer;" onClick="this.src='checkcode.asp?t='+(new Date().getTime());" ></td>
         
	  
		  
		  
		  
		  
		  </tr>
                <tr> 
                  <td height="28" colspan="2" style="PADDING-LEFT: 6px" align="center">
                      <input type="submit" name="Submit" value="SUBMIT">
 <input type="reset" name="Submit2" value="RESET" onClick="return checkpro();">
                      </td>
                </tr>
              </table>
            </form></td>
        </tr>
      </table></td></tr> </table>
</td></tr>

<tr> 
          <td height="20"></td>
        </tr>
<TR>
<TD WIDTH="300">&nbsp;</TD>
<TD WIDTH="80%">
<TABLE WIDTH="760" BORDER="0" ALIGN="center" CELLPADDING="1" CELLSPACING="1" BGCOLOR="000000">
        

<TR> 
          <TD HEIGHT="20" WIDTH="100%" ALIGN="center" BGCOLOR="ffffff"><FONT COLOR="#000000">GUESTBOOK</FONT></TD>
          
        </TR>

        <TR BGCOLOR="#ffffff"> 
          <TD HEIGHT="140" VALIGN="top" COLSPAN="2">
            <%
				Const MaxPerPage=20 
   				dim totalPut   
   				dim CurrentPage
   				dim TotalPages,j
   				dim sql
    			if Not isempty(request.QueryString("page")) then
      				currentPage=Cint(request.QueryString("page"))
   				else
      				currentPage=1
   				end if 
	 set rs=server.createobject("adodb.recordset")
	rs.open "select newsid,newsname,addname,newscontent,book,adddate from notify order by adddate desc",conn,1,1
		  
				if err.number<>0 then
				response.write "数据库中暂时无数据"
				end if
				
  				if rs.eof And rs.bof then
       				Response.Write "<p align='center' class='contents'> 您还没有添加留言！</p>"
   				else
	  				totalPut=rs.recordcount

      				if currentpage<1 then
          				currentpage=1
      				end if

      				if (currentpage-1)*MaxPerPage>totalput then
	   					if (totalPut mod MaxPerPage)=0 then
	     					currentpage= totalPut \ MaxPerPage
	   					else
	      					currentpage= totalPut \ MaxPerPage + 1
	   					end if
      				end if

       				if currentPage=1 then
            			showContent
            			showpage totalput,MaxPerPage,"guestbook.asp"
       				else
          				if (currentPage-1)*MaxPerPage<totalPut then
            				rs.move  (currentPage-1)*MaxPerPage
            				dim bookmark
            				bookmark=rs.bookmark
            				showContent
             				showpage totalput,MaxPerPage,"guestbook.asp"
        				else
	        				currentPage=1
           					showContent
           					showpage totalput,MaxPerPage,"guestbooks.asp"
	      				end if
	   				end if
   				   				end if

   				sub showContent
       			dim i
	   			i=0

			%>
<TABLE WIDTH="95%" BORDER="0" ALIGN="center" CELLPADDING="1" CELLSPACING="1">
<FORM NAME="form1" METHOD="post" ACTION="guestbook.asp?action=del">
<%do while not rs.eof%>
<TR> 
 <TD STYLE="PADDING-LEFT: 6px">
 <TABLE WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="0" BGCOLOR="#ffffff">
 <TR> 
<TD BGCOLOR="#ffffff">
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR> 

<TD WIDTH="38%" align=center>Title：<font color="ff3377"><%=trim(rs("newsname"))%></TD>
<TD WIDTH="62%" align=center><DIV ALIGN="RIGHT"></DIV>Date:<%=rs("adddate")%></TD>
</TR>
</TABLE>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=*>
<TBODY>
<TR> 
<TD width="47" ROWSPAN="3"><IMG SRC="#" WIDTH="1" HEIGHT="1"> 
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=*>
<TBODY>
<TR> 
<TD WIDTH=7></TD>
<TD ></TD>
<TD WIDTH=16></TD>
</TR>
<TR> 
<TD ROWSPAN="2"></TD>
<TD align="center"></DIV></TD>
<TD ROWSPAN="2"></TD>
</TR>
<TR> 
<TD BGCOLOR=#fffff1></TD>
 </TR>
<TR> 
<TD VALIGN=top WIDTH=7></TD>
<TD>&nbsp;</TD>
<TD ALIGN=right WIDTH=16></TD>
</TR>
</TBODY>
</TABLE></TD>
<TD WIDTH=14></TD>
<TD width="565"></TD>
<TD WIDTH=16></TD>
</TR>
<TR> 
<TD></TD>
<TD HEIGHT="40" valign="top"><B><FONT COLOR="#990000"><%=trim(rs("addname"))%>:</FONT></B><%=trim(rs("newscontent"))%> 
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR> 
<TD BGCOLOR="#b3b3b3"></TD>
</TR>
<TR> 
<TD><B><FONT COLOR="#990000">Reply：</FONT></B><%=trim(rs("book"))%></TD>
</TR>
<TR> 
<TD BGCOLOR="#990000"></TD>
</TR>
</TABLE></TD>
<TD VALIGN=top WIDTH=16>
</TD>
</TR>
<TR> 
<TD VALIGN=top WIDTH=14></TD>
<TD></TD>
<TD ALIGN=right WIDTH=16></TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
</TABLE></TD>
</TR>
               <%i=i+1
			if i>=MaxPerPage then Exit Do
			rs.movenext
		  loop
		  rs.close
		  set rs=nothing%>
              </FORM>
            </TABLE>
            <%  
				End Sub   
  
				Function showpage(totalnumber,maxperpage,filename)  
  				Dim n
  				
				If totalnumber Mod maxperpage=0 Then  
					n= totalnumber \ maxperpage  
				Else
					n= totalnumber \ maxperpage+1  
				End If
				
				Response.Write "<form method=Post action="&filename&">"  
				Response.Write "<p align='center' class='contents'> "  
				If CurrentPage<2 Then  
					Response.Write "<font class='contents'>FIRST PAGE PREVIOUS PAGE</font> "  
				Else  
					Response.Write "<a href="&filename&"?page=1 class='contents'>FIRST PAGE</a> "  
					Response.Write "<a href="&filename&"?page="&CurrentPage-1&" class='contents'>PREVIOUS PAGE</a> "  
				End If
				
				If n-currentpage<1 Then  
					Response.Write "<font class='contents'>NEXT PAGE LAST PAGE</font>"  
				Else  
					Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&" class='contents'>"  
					Response.Write "NEXT PAGE</a> <a href="&filename&"?page="&n&" class='contents'>LAST PAGE</a>"  
				End If  
					Response.Write "<font class='contents'>PAGE:</font><font class='contents'>"&CurrentPage&"</font><font class='contents'>/"&n&"</font> "  
					
					
					
				End Function  
			%>
          </TD>
        </TR>
      </TABLE></TD>
<!--#include file="include/ebottom.asp"--> 

<script language=javascript>
function mm()
{
   var a = document.getElementsByTagName("input");
   if(a[0].checked==true){
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = false;
   }
   else
   {
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = true;
   }
}
</script>