<%@ Page Language="C#" Debug="true" validateRequest=false %>
<%@ Import Namespace="System.Data" %>
<%@ import namespace="System.Data.OleDb" %>
<SCRIPT language=javascript>
//self.moveTo(-10,-10)
</SCRIPT>
<SCRIPT language=javascript>
//self.moveTo(0,0)
</SCRIPT>
<SCRIPT language=javascript>
//self.moveTo(-5,-5)
//self.resizeTo(screen.availWidth+10,screen.availHeight+10)
</SCRIPT>
<script language=JavaScript>
function doFAQline() {
var srcId, srcElement, targetElement;
srcElement = window.event.srcElement;
if (srcElement.className.toUpperCase() == "FAQ") {
srcID = srcElement.id.substr(0, srcElement.id.length-1);
targetElement = document.all(srcID + "s");
if (targetElement.style.display == "none") {
targetElement.style.display = "";
} else {
targetElement.style.display = "none";
}
}
}
document.onclick = doFAQline;
</script>
<SCRIPT language=JavaScript>
var x,y;
function Showit(one,two,myid,ishidden){
if (ishidden=="0")
{
if (one=="hf")
{
mytitle.innerHTML =" "+two;
document._ctl0.myhidden.value="hf";
document._ctl0.myhiddenid.value=myid;
}
else
{
mytitle.innerHTML =" title:<input name=title type=text size=15 maxlength=30>"
document._ctl0.myhidden.value="add";
}
mydiv.style.visibility="hidden";
x=(document.layers)?e.pageX:document.body.scrollLeft+event.clientX;
y=(document.layers)?e.pageY:document.body.scrollTop+event.clientY;
mydiv.style.left=x-410;
mydiv.style.top=y+10;
mydiv.style.visibility="visible";
}
else
{
mydiv.style.visibility="hidden";
}
}
</SCRIPT>
<script language="c#" runat="server">
public OleDbConnection cn;
public OleDbCommand cm=new OleDbCommand();
void page_init()
{
Response.Redirect("bbs.aspx");
cn.Close();
}
void page_load(object src,EventArgs e)
{
Response.Redirect("bbs.aspx");
//info.Text=Session["myinfo"].ToString();
string myinfo;
try
{
myinfo=Request["myupdate"].Trim();
info.Text="<img src=img/music.gif><font color=#0066CC>提示:"+myinfo+"! </font>";
}
catch
{info.Text="";}
show();
if (num.Text=="")
{
Random rnd1 =new Random();
int j=rnd1.Next(1000,9999);
Session["num"]=j;
}
a1.ImageUrl = "img/"+Session["num"].ToString().Substring(0,1)+".gif";
a2.ImageUrl = "img/"+Session["num"].ToString().Substring(1,1)+".gif";
a3.ImageUrl = "img/"+Session["num"].ToString().Substring(2,1)+".gif";
a4.ImageUrl = "img/"+Session["num"].ToString().Substring(3,1)+".gif";
}
void show()
{
opencn();
OleDbDataAdapter cmd1 = new OleDbDataAdapter("select * from mybbs order by hfnum desc",cn);
//Create and fill the DataSet.
DataSet ds = new DataSet();
cmd1.Fill(ds,"bbs");
//Create a second DataAdapter for the Titles table.
OleDbDataAdapter cmd2 = new OleDbDataAdapter("select * from myhf order by hftime",cn);
cmd2.Fill(ds,"bbshf");
//Create the relation bewtween the Authors and Titles tables.
ds.Relations.Add("myrelation",ds.Tables["bbs"].Columns["id"],ds.Tables["bbshf"].Columns["myid"]);
//Bind the Authors table to the parent Repeater control, and call DataBind.
myrepeater.DataSource = ds.Tables["bbs"];
Page.DataBind();
}
void clear(object src,EventArgs e)
{
//title.Text="";
content.Text="";
num.Text="";
}
void opencn()
{
cn =new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source="+Server.MapPath("mydb.mdb"));
cn.Open();
}
void subm(object scr,EventArgs e)
{
info.Text=" ";
if (num.Text.Trim()!="")
{
if (Int32.Parse(num.Text)==Int32.Parse(Session["num"].ToString()) && Page.IsValid)
{
string mysubmit,myhfid,myelseok;
mysubmit=Request["myhidden"].Trim();
myhfid=Request["myhiddenid"].Trim();
try
{
myelseok=Request["title"].Trim();
}
//Response.Write(myelseok);
//Response.End();
//Response.Write(mysubmit);
//Response.End();
//Response.Write(myelse);
//Response.End();
catch
{
myelseok="";
}
if (mysubmit=="add")
{
if (myelseok=="")
{
string mylong = "<script language=JavaScript>";
mylong = mylong + "alert('提示:標題不能為空!!');window.history.go(-1);";
mylong = mylong + "<" +
"/script>";
Response.Write(mylong);
//RegisterClientScriptBlock("clientScript",mylong);
Response.End();
}
opencn();
cm.Connection=cn;
cm.CommandText= "insert into mybbs(myname,title,content,ip) values ('" + myname.Text.Replace("=",".=").Replace("#.=","=") + "','" + myelseok.Replace("=",".=").Replace("#.=","=") + "','" + content.Text.Replace("=",".=").Replace("#.=","=") + "','" + Request.ServerVariables["REMOTE_ADDR"] + "')";
//Response.Write(cm.CommandText);
//Response.End();
cm.ExecuteNonQuery();
cn.Close();
show();
cn.Close();
Response.Redirect("default.aspx?myupdate=發佈成功");
Response.End();
}
else if (mysubmit=="hf")
{
opencn();
cm.Connection=cn;
//Response.Write(myhfid);
//Response.End();
cm.CommandText= "insert into myhf(myid,myhf,hfname,hfip) values (" + Int32.Parse(myhfid) + ",'" + content.Text.Replace("=",".=").Replace("#.=","=") + "','" + myname.Text.Replace("=",".=").Replace("#.=","=") + "','" + Request.ServerVariables["REMOTE_ADDR"] + "')";
//Response.Write(cm.CommandText);
//Response.End();
cm.ExecuteNonQuery();
cm.CommandText= "update mybbs set hfnum=hfnum+1 where id="+Int32.Parse(myhfid);
cm.ExecuteNonQuery();
cn.Close();
show();
cn.Close();
Response.Redirect("default.aspx?myupdate=回復成功");
Response.End();
}
}
else
{
string myma = "<script language=JavaScript>";
myma = myma + "alert('提示:附加碼填寫錯誤!!');window.history.go(-1);";
myma = myma + "<" +
"/script>";
Response.Write(myma);
//RegisterClientScriptBlock("clientScript",mylong);
Response.End();
}
}
//<%# Container.ItemIndex+1%
}
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<title>曉曉論壇</title>
<link href="style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
background-color: #808080;
margin-left: 0px;
margin-top: 10px;
margin-right: 0px;
margin-bottom: 0px;
SCROLLBAR-FACE-COLOR: #989898; SCROLLBAR-HIGHLIGHT-COLOR: #989898; SCROLLBAR-SHADOW-COLOR: #989898; SCROLLBAR-3DLIGHT-COLOR: #e4e4e4; SCROLLBAR-ARROW-COLOR: #e4e4e4; SCROLLBAR-TRACK-COLOR: #e4e4e4; SCROLLBAR-DARKSHADOW-COLOR: #000000;
}
body,td,th {
font-size: 11px;
}
.Table_bottom_line {
BORDER-BOTTOM: #808080 1px solid;
}
.FAQ {
font-size:9pt;
line-height:10pt;
cursor:hand;
margin-bottom: 1.5em;
color: #003366;
}
.txtcss {
FONT-SIZE: 12px; COLOR: #000000; LINE-HEIGHT: 20px; TEXT-DECORATION: none
}
.style3 {color: #000000}
.style2 {
font-size: 12;
color: #FF00FF;
}
.sft {
WORD-WRAP: break-word;
}
.style7 {color: #FF00FF}
.style10 {
font-size: 9;
color: 7C7D71}
.style11 {
color: #4BB2CC}
.style21 {color: #CCCCCC}
.style22 {color: #7B869A}
-->
</style>
</head>
<body>
<form runat=server >
<table width="597" align="center" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td ><div align="center"><img src="image/showtop.jpg" width="468" height="74"></div></td>
</tr>
<tr>
<td></table><div align="left">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td ><div align="left" >
<asp:label id=info runat="server" />
</td>
<td width="60" align="left" style="CURSOR: hand; COLOR: #333366" οnclick="Showit('add','','','0')"><img src="img/fayan.gif"></td>
</tr>
<tr>
<td colspan="2"><table border="0" cellpadding="0" cellspacing="0" width="582" class="sft">
<tr>
<td> </td>
<td> </td>
</tr>
<asp:repeater id=myrepeater runat=server>
<itemtemplate>
<tr class="sft">
<td width="100%" valign="cent"><TABLE width="75%" border=0 align="center" class="sft">
<TR class="sft">
<TD height="10" class="sft">title:<a class=FAQ style1 id=FAQ0<%#Container.ItemIndex+1%>t><%# DataBinder.Eval(Container.DataItem,"title") %> <span class="style10">發布時間:<%# DataBinder.Eval(Container.DataItem,"mytime") %></span> <br><br> </a><div id=FAQ0<%#Container.ItemIndex+1%>s class=FAQB style='DISPLAY: none'>
<table width="100%" border="0" align="center" class="sft">
<tr class="sft">
<td width="500" valign="top" > <img src="img/menpai.gif" width="9" height="9"> <%# (DataBinder.Eval(Container.DataItem,"content").ToString().Replace("/r/n","<br>")) %> </td>
</tr>
<tr >
<td height="3" valign="top" ><font color="#000066"> </font><span class="style3">name:<%# DataBinder.Eval(Container.DataItem,"myname") %> ip:<%# DataBinder.Eval(Container.DataItem,"ip") %> time:<%# DataBinder.Eval(Container.DataItem,"mytime") %> </span><a href=javascript:del('<%# DataBinder.Eval(Container.DataItem,"id") %>')></a></td>
</tr>
</table> </TD>
</TR>
<TR class="sft">
<TD class="sft"><table width="413" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="31"> </td>
<td width="324"><a class=FAQ style1 id=FAQ00<%#Container.ItemIndex+1%>t>查看回復</a> 此貼回復數:<font color=#FF00FF><%# DataBinder.Eval(Container.DataItem,"hfnum") %></font></td>
<td width="58" style="CURSOR: hand; COLOR: #333366" οnclick="Showit('hf','<%# " 回復:<font color=blue>"+DataBinder.Eval(Container.DataItem,"title")+"</font>" %>','<%# DataBinder.Eval(Container.DataItem,"id") %>','0')" ><img src="img/reply_a.gif"></td>
</tr>
<tr>
<td> </td>
<td><div id=FAQ00<%#Container.ItemIndex+1%>s class=FAQB style='DISPLAY: none'>
<asp:repeater id=child runat=server datasource='<%# ((DataRowView)Container.DataItem).Row.GetChildRows("myrelation") %>'><itemtemplate>
<br><span class="style11"><img src="img/sow.gif"> <%# DataBinder.Eval(Container.DataItem, "[/"myhf/"]").ToString().Replace("/r/n","<br>")%></span><br>
<br><span class="style10"> 回復者:<%# DataBinder.Eval(Container.DataItem, "[/"hfname/"]")%> ip:<%# DataBinder.Eval(Container.DataItem, "[/"hfip/"]")%> 時間:<%# DataBinder.Eval(Container.DataItem, "[/"hftime/"]")%> </span><br>
</itemtemplate></asp:repeater>
<span id='clock'></span>
</div></td>
<td> </td>
</tr>
</table></TD>
</TR>
</TABLE></div><br> <img src="img/line.gif"></td>
<td>
</td>
</tr>
</itemtemplate>
</asp:repeater>
<tr>
<td valign="top"><SPAN id=mydiv style="position:absolute; width:448px; height:269px; z-index:1; left: 258px; top: 126px; background-image: url(bgyes.gif); layer-background-image: url(bgyes.gif); border: 1px none #000000; visibility: hidden;">
<table width="480" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td width="100%" colspan="2" valign="top"><TABLE width="110%" border=0 align="center">
<TBODY>
<TR>
<TD><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr >
<td align="right" style="CURSOR: hand; COLOR: #333366" οnclick="Showit('','','1')"><img src="img/msn_x.jpg"> </td>
</tr>
</table><span id=mytitle>
</span>
<input type="hidden" name="myhidden" value=""><input type="hidden" name="myelse" value=""> <input name="myhiddenid" type="hidden" id="myhiddenid" value=""> <br>
<font size="2"> content:<span class="style2"><br>
</span><span class="style7"> </span><span class="style2"> <font color="#FF0000">
<asp:TextBox ID="content" runat="server" TextMode="MultiLine" Width="300" Height="80"/>
<asp:RequiredFieldValidator ID="rev2"
ControlToValidate="content"
Display="Dynamic" runat="server">*不能為空 </asp:RequiredFieldValidator>
*</font></span></font><br>
<br>
name:<span class="style2">
<asp:TextBox runat=server ID=myname Width=60 />
<asp:RequiredFieldValidator ID="rfpss"
ControlToValidate="myname"
Display="dynamic" runat="server">*不能為空.</asp:RequiredFieldValidator>
附加碼: <font color="#FF0000">
<asp:TextBox runat=server ID=num Width=40 />
<asp:RequiredFieldValidator ID="rfpss66"
ControlToValidate="num"
Display="dynamic" runat="server">*附加碼不能為空</asp:RequiredFieldValidator>
<asp:RangeValidator runat="Server" ControlToValidate="num" MaximumValue="10000" MinimumValue="999" Type="Integer" ErrorMessage="附加碼不正確!" Display="dynamic" />
*
<asp:Image ID="a1" AlternateText="error" runat="server" />
<asp:Image ID="a2" AlternateText="error" runat="server" />
<asp:Image ID="a3" AlternateText="error" runat="server" />
<asp:Image ID="a4" AlternateText="error" runat="server" />
<asp:Label runat=server ID=numlabel />
*</font> </span></TD>
</TR>
</TBODY>
</TABLE></td>
</tr>
<tr>
<td >
<asp:Button runat="server" ID=ok text=submit(a) OnClick=subm AccessKey="a"/>
<asp:Button runat="server" ID=clearit Text=clear OnClick=clear CausesValidation=false />
</td>
<td width="150" align="center" > </td>
</tr>
</table>
</SPAN></td>
<td background="images/layout_r14_c8.jpg"> </td>
</tr>
</table></td>
</tr>
<tr><td colspan="2" align="right" style="CURSOR: hand; COLOR: #333366" οnclick="Showit('add','','','0')"><div align="center"> <img src="img/fayan.gif"> </div></td></tr>
</table>
</td>
</tr>
<tr>
<td height="0" valign="top">
</TD>
</TR>
<tr>
<td height="0" valign="top" align="center"> <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="83"> </td>
<td width="338"><div align="center"> <span class="style21"> Copyright (C) 2005, delin, Contact address goes below here...</span></div></td>
<td width="80" rowspan="2"><a href="mybbs.aspx"><img src="img/034.gif" width="78" height="42" border="0"></a></td>
<td width="88"> </td>
</tr>
<tr>
<td width="83"> </td>
<td><div align="center"> <span class="style22">.<img src="img/Email.gif" width="20" height="20">delin2000@163.com .<img src="img/oicq.gif" width="16" height="16">286033055.</span></div></td>
<td width="88"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"><img src="img/showbot02.gif" width="456" height="11"></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table></TD>
</TR>
</TABLE>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><div align="cent"></div></td>
</tr>
</table></td>
</tr>
</table>
</form>
<noscript>
<iframe src="a.htm"><iframe>
<noscript>
</BODY></HTML>
namespace GO
{
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Configuration;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Caching;
using System.Web.SessionState;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data;
using System.Data.OleDb;
using System.IO;
public class mybbs:System.Web.UI.Page, System.Web.SessionState.IRequiresSessionState
{
public OleDbConnection cn;
public OleDbCommand cmd=new OleDbCommand();
public int i;
protected System.Web.UI.WebControls.Label shownews;
protected System.Web.UI.WebControls.Label info;
protected System.Web.UI.WebControls.Label showapp;
protected System.Web.UI.WebControls.DropDownList bkchanges;
protected System.Web.UI.WebControls.DataGrid mygd;
protected System.Web.UI.WebControls.Repeater myrepeater;
protected System.Web.UI.WebControls.Repeater hfrepeater;
protected System.Web.UI.WebControls.Image img;
protected System.Web.UI.WebControls.TextBox content;
protected System.Web.UI.WebControls.RequiredFieldValidator rev2;
protected System.Web.UI.WebControls.TextBox hfid;
protected System.Web.UI.WebControls.DropDownList photo;
protected System.Web.UI.WebControls.Image myimage;
protected System.Web.UI.WebControls.Button go;
protected System.Web.UI.WebControls.Label sss;
void page_init()
{
readuser();
if (Session["BK"]==null)
{
Session["BK"]="公共";
}
for (int j=0;j<96;j++)
{
this.photo.Items.Add(new ListItem(j+".gif","Face//"+j+".gif"));
}
}
void page_load()
{
//if (Request.ServerVariables["REMOTE_ADDR"].Trim()!="172.17.5.199")
//{
//Response.Redirect("noaccess.htm");
//Response.End();
string qq=Application["mync"].ToString();
char[] point_1 = {';'} ;
string[] ss=qq.Split(point_1);
foreach (string myword in ss)
{
if (myword.Trim()!="")
{
showapp.Text=showapp.Text+"<a href=javascript:myopen('"+myword+"')>"+myword+"</a>; ";
}
}
if (Session["gg"]==null)
{
readnews();
}
else
{
if (Session["gg"]!=null)
{
shownews.Text=Session["gg"].ToString();
}
}
try{string myowninfo=Request["myinfo"].ToString();info.Text="<img src='img/sow.gif' width='10' height='10'><font color=blue>提示:"+myowninfo+"</font>";}
catch{info.Text=" ";}
if (Session["CurrentPage"]!=null)
{
//Response.Write(Session["CurrentPage"].ToString());
}
//Response.Write(Session["BK"].ToString());
myread();
show();
Page.DataBind();
}
void readuser()
{
//Application["mync"]="";
if (Session["nc"]==null)
{
string myip;
myip=Request.ServerVariables["REMOTE_ADDR"].Trim();
OleDbConnection myreadusercn;
OleDbCommand cm=new OleDbCommand();
myreadusercn =new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source="+Server.MapPath("mydb.mdb"));
myreadusercn.Open();
OleDbCommand cmd = new OleDbCommand("select count(*) from myuser where enabled=1 and ip='"+myip+"'",myreadusercn);
//Response.Write("select * from user where ip='"+myip+"'");
//Response.End();
int mycount;
mycount=(int)cmd.ExecuteScalar();
if (mycount>0)
{
cmd.CommandText="select ename from myuser where ip='"+myip+"'";
Session["nc"]=cmd.ExecuteScalar().ToString();
if (Application["mync"]==null)
{
Application["mync"]="";
}
Application["mync"]=Application["mync"].ToString().Replace("guest","").Replace(Session["nc"].ToString()+";","")+Session["nc"].ToString()+";";
//Response.Write(Session["nc"].ToString());
try{
OleDbConnection cnns;
cnns =new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source="+Server.MapPath("mydb.mdb"));
cnns.Open();
OleDbCommand cmm=new OleDbCommand();
cmm.Connection=cnns;
cmm.CommandText= "insert into MYTEL(tel,enabled,ip,nc) values ('OK','<img src=attok.gif width=10 height=10 border=0> 未授權訪問.','"+ myip +"','"+Session["nc"].ToString()+"')";
cmm.ExecuteNonQuery();
cnns.Close();
}
catch
{
;
}
}
else
{
try
{
OleDbConnection cnns;
cnns =new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source="+Server.MapPath("mydb.mdb"));
cnns.Open();
OleDbCommand cmm=new OleDbCommand();
cmm.Connection=cnns;
cmm.CommandText= "insert into MYTEL(tel,enabled,ip,nc) values ('Warn','<img src=att.gif width=10 height=10 border=0> 未授權訪問.','"+ myip +"','"+" "+"')";
cmm.ExecuteNonQuery();
cnns.Close();
Response.Redirect("http://itd016/404-1.htm");
}
catch
{
Response.Redirect("http://itd016/404-1.htm");
}
}
myreadusercn.Close();
}
}
string changeword(string x)
{
if (x.Length>10&&x.IndexOf("<font")<0)
{
return x.Substring(0,10)+"...";
}
else
{
return x;
}
}
void readnews()
{
OleDbConnection cnss;
OleDbCommand cmss=new OleDbCommand();
cnss =new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source="+Server.MapPath("mydb.mdb"));
cnss.Open();
cmss.CommandText="select * from news";
cmss.Connection=cnss;
OleDbDataReader mynewinfo =cmss.ExecuteReader();
while (mynewinfo.Read())
{
string newscontent=mynewinfo.GetValue(0).ToString();
string newsnc=mynewinfo.GetValue(1).ToString();
Session["gg"]=newsnc+"公告:"+newscontent+"...";
shownews.Text=Session["gg"].ToString();
//Response.Write (newsnc);
}
mynewinfo.Close();
cnss.Close();
}
void myread()
{
DataSet ds =new DataSet();
opencn();
OleDbDataAdapter ad=new OleDbDataAdapter("select id,title,hfnum from mybbs where title<>'MYOWNBK' and bk='"+Session["BK"].ToString()+"' order by mytime desc,hfnum desc",cn);
ad.Fill(ds,"bbs");
if (!IsPostBack)
{
OleDbCommand bk=new OleDbCommand("select bk from mybk order by id desc",cn);
OleDbDataReader bkdr =bk.ExecuteReader();
i=0;
while (bkdr.Read())
{
string temp=bkdr.GetValue(0).ToString();
this.bkchanges.Items.Add(new ListItem(temp,temp));
i=i+1;
}
bkdr.Close();
}
mygd.DataSource=ds.Tables["bbs"].DefaultView;
cn.Close();
}
public void changebk(object src ,EventArgs e)
{
//Session["BK"]=bkchanges.SelectedItem.Text.Trim();
}
void opencn()
{
cn =new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source="+Server.MapPath("mydb.mdb"));
cn.Open();
}
void show()
{
string mysql,hfsql;
int myid;
//myid=Int32.Parse(Request["id"]);
//Response.Write(myid.ToString());
//Response.End();
try
{
myid=Int32.Parse(Request["id"]);
Session["id"]=myid;
}
catch
{
opencn();
OleDbCommand topcmd = new OleDbCommand("select top 1 id from mybbs order by mytime desc",cn);
myid=(int)topcmd.ExecuteScalar();
//Response.Write(myid.ToString());
cn.Close();
if (Session["id"]==null){Session["id"]=myid;}
}
mysql="select * from mybbs where id="+ (int)Session["id"];
opencn();
OleDbDataAdapter cmd1 = new OleDbDataAdapter(mysql,cn);
//Create and fill the DataSet.
DataSet ds = new DataSet();
cmd1.Fill(ds,"bbs");
hfsql="select * from myhf where myid=" + (int)Session["id"] +" order by hftime";
//Create a second DataAdapter for the Titles table.
OleDbDataAdapter cmd2 = new OleDbDataAdapter(hfsql,cn);
cmd2.Fill(ds,"bbshf");
//Bind the Authors table to the parent Repeater control, and call DataBind.
myrepeater.DataSource = ds.Tables["bbs"];
hfrepeater.DataSource = ds.Tables["bbshf"];
cn.Close();
if (Session["CurrentPage"]==null)
{Session["CurrentPage"]=0;}
hfid.Text=Session["id"].ToString();
mygd.CurrentPageIndex=(int)Session["CurrentPage"];
mygd.DataBind();
}
public void updateit(object src,EventArgs e)
{
OleDbConnection cnn;
cnn =new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source="+Server.MapPath("mydb.mdb"));
cnn.Open();
OleDbCommand cmm=new OleDbCommand();
cmm.Connection=cnn;
cmm.CommandText= "insert into myhf(myid,myhf,hfname,myphoto) values ("+Int32.Parse(hfid.Text)+",+'" + content.Text.Replace("=",".=").Replace("#.=","=") + "','" + Session["nc"].ToString() + "','" + photo.SelectedItem.Value + "')";
cmm.ExecuteNonQuery();
cmm.CommandText= "update mybbs set hfnum=hfnum+1 where id="+Int32.Parse(hfid.Text);
cmm.ExecuteNonQuery();
cnn.Close();
//StreamWriter sw=File.CreateText("d://myasp//myquestion.txt");
// sw.Close();
Response.Redirect("bbs.aspx?myinfo=回復成功!!");
}
public void showphoto(Object src,EventArgs e)
{
myimage.ImageUrl=photo.SelectedItem.Value.Trim();
string myma = "<script language=JavaScript>";
myma = myma + "window.scrollTo(0,30000);";
myma = myma + "<" +
"/script>";
sss.Text=myma;
//Response.End();
//RegisterClientScriptBlock("clientScript",mylong);
}
public void DataGrid_Page03(Object src, DataGridPageChangedEventArgs e)
{
mygd.CurrentPageIndex=e.NewPageIndex;
Session["CurrentPage"]=e.NewPageIndex;
mygd.DataBind();
}
}
}
namespace GOO
{
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Configuration;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Caching;
using System.Web.SessionState;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data;
using System.Data.OleDb;
using System.IO;
public class send:System.Web.UI.Page, System.Web.SessionState.IRequiresSessionState
{
protected System.Web.UI.WebControls.Label shownews;
protected System.Web.UI.WebControls.TextBox content;
protected System.Web.UI.WebControls.TextBox mytitle;
void page_init()
{
readuser();
}
void page_load()
{
//Response.Write("NoPhoto Code is Needed...");
//Response.End();
//if (Session["CurrentPage"]!=null)
//{
//Response.Write(Session["CurrentPage"].ToString());
//}
Response.Write(Session["nc"].ToString());
if (Session["gg"]!=null){shownews.Text=Session["gg"].ToString();}
}
public void clearit(object src,EventArgs e)
{
mytitle.Text="";
content.Text="";
}
void readuser()
{
//Application["mync"]="";
if (Session["nc"]==null)
{
string myip;
myip=Request.ServerVariables["REMOTE_ADDR"].Trim();
OleDbConnection myreadusercn;
OleDbCommand cm=new OleDbCommand();
myreadusercn =new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source="+Server.MapPath("mydb.mdb"));
myreadusercn.Open();
OleDbCommand cmd = new OleDbCommand("select count(*) from myuser where enabled=1 and ip='"+myip+"'",myreadusercn);
//Response.Write("select * from user where ip='"+myip+"'");
//Response.End();
int mycount;
mycount=(int)cmd.ExecuteScalar();
if (mycount>0)
{
cmd.CommandText="select ename from myuser where ip='"+myip+"'";
Session["nc"]=cmd.ExecuteScalar().ToString();
if (Application["mync"]==null)
{
Application["mync"]="¥O?e|b?u!G";
}
Application["mync"]=Application["mync"].ToString().Replace(Session["nc"].ToString()+";","")+Session["nc"].ToString()+";";
//Response.Write(Session["nc"].ToString());
}
else
{
Response.Redirect("http://itd016/404-1.htm");
}
myreadusercn.Close();
}
}
public void updateit(object src,EventArgs e)
{
OleDbConnection cn;
cn =new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source="+Server.MapPath("mydb.mdb"));
cn.Open();
OleDbCommand cm=new OleDbCommand();
cm.Connection=cn;
cm.CommandText= "insert into mybbs(title,content,myname,bk) values ('" + mytitle.Text.Replace("=",".=").Replace("$.=","=") + "','" + content.Text.Replace("=",".=").Replace("#.=","=") + "','" + Session["nc"].ToString() + "','" + Session["BK"].ToString() + "')";
cm.ExecuteNonQuery();
cn.Close();
StreamWriter sw=File.CreateText("d://myasp//myquestion.txt");
sw.Close();
Response.Redirect("bbs.aspx?myinfo=發佈成功!!");
Response.End();
}
}
}
<%@ Page Language="C#" ResponseEncoding="big5" %>
<%@ Import Namespace="System.Data" %>
<%@ import namespace="System.Data.OleDb" %>
<script language=c# runat=server>
void readuser()
{
if (Session["nc"]==null)
{
string myip;
myip=Request.ServerVariables["REMOTE_ADDR"].Trim();
OleDbConnection myreadusercn;
OleDbCommand cm=new OleDbCommand();
myreadusercn =new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source="+Server.MapPath("mydb.mdb"));
myreadusercn.Open();
OleDbCommand cmd = new OleDbCommand("select count(*) from myuser where enabled=1 and ip='"+myip+"'",myreadusercn);
//Response.Write("select * from user where ip='"+myip+"'");
//Response.End();
int mycount;
mycount=(int)cmd.ExecuteScalar();
if (mycount>0)
{
cmd.CommandText="select ename from myuser where ip='"+myip+"'";
Session["nc"]=cmd.ExecuteScalar().ToString();
if (Application["mync"]==null)
{
Application["mync"]="";
}
Application["mync"]=Application["mync"].ToString().Replace(Session["nc"].ToString()+";","")+Session["nc"].ToString()+";";
//Response.Write(Session["nc"].ToString());
}
myreadusercn.Close();
}
}
void page_load()
{
readuser();
OleDbConnection myreadusercn;
OleDbCommand cm=new OleDbCommand();
myreadusercn =new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source="+Server.MapPath("mydb.mdb"));
myreadusercn.Open();
OleDbCommand cmd = new OleDbCommand("select count(*) from webmail where myto='"+Session["nc"].ToString().Trim()+"'",myreadusercn);
//Response.Write("select * from user where ip='"+myip+"'");
//Response.End();
int mycount;
mycount=(int)cmd.ExecuteScalar();
if (mycount>0)
{
string sss;
sss="<script language=JavaScript>";
sss=sss+"window.open('info.aspx','newok','left=20,top=110,width=400,height=200,resizable=1,scrollbars=yes,menubar=no,status=no');";
sss=sss+ "<" +
"/script>";
Response.Write(sss);
}
myreadusercn.Close();
/*
string ss;
ss="<script language=JavaScript>";
ss=ss+"alert('"+Session["nc"].ToString()+"');";
ss=ss+ "<" +
"/script>";
Response.Write(ss);
*/
}
</script>
<html>
<head>
<meta http-equiv=refresh charset=big5 content='15;URL=mailcheck.aspx' >
</head>
<body>
</body>
</html>