using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class add : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack) 
        {
            try
            {
                if (Request["action"] != "" && Request["action"]!=null)
                {
                    string title = Request["title"].ToString();
                    string contents = Server.UrlDecode(Request["contents"].ToString());
                    string muser = Request["muser"].ToString();
                    string userip =PubliclClass.getIp();
                    string time= DateTime.Now.ToString("yyyy-MM-dd");

                    int result;
                    if (ISDatabase.SelectDatebase() == 1)
                    {
                        string sql = "insert into A_Message(Title,Contents,M_user,M_Ip,Rey_Contents,AddTime,ReyTime) values('" + title + "','" + contents + "','" + muser + "','" + userip + "','','" + time + "','" + time + "')";
                        result = DbHelp.ExecuteSql(sql);
                    }
                    else
                    {
                        string sql = "insert into A_Message(Title,Contents,M_user,M_Ip,Rey_Contents,AddTime,ReyTime) values('" + title + "','" + contents + "','" + muser + "','" + userip + "','',#" + time + "#,#" + time + "#)";
                        result = DbHelperOleDb.ExecuteSql(sql);
                    }
                   
                    if (result > 0)
                    {
                        Response.Write("ok");
                    }
                    else 
                    {
                        Response.Write("erro");
                    }

                }
            }
            catch (Exception ex) {
                Response.Write(ex.ToString());
            
            }
        
        }
    }




}