using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
    
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
      
       SqlConnection conn = CDatabase.wtoconn();
        conn.Open();
        SqlCommand smdkg = new SqlCommand("select IsOpen from UserAdmin",conn);
        if (Convert.ToString(smdkg.ExecuteScalar()) == "close")
        {
            Response.Redirect("~/china/error2.aspx?err=网站未开通!");
            Response.End();
        }
        SqlCommand smd = new SqlCommand("select count(*) from Advertisement where Type='1' and Condition='y'", conn);
        int count = Convert.ToInt32(smd.ExecuteScalar());
        if (count != 0)
        {
                RegisterStartupScript(" ", " <script language=\"javascript\" src=\"js/ad.js\"></script> ");
        }
        conn.Close();
        if (Session["userid"] == null)
        {
            Session["userid"] = DateTime.Now.ToString("hmmssffff");
            Session["ad"] = "1";
        }
    }
    protected void MemberLogin1_Load(object sender, EventArgs e)
    {
        
    }
    protected void Page_PreInit(object sender, EventArgs e)
    {
        SqlConnection connsk = CDatabase.wtoconn();
        connsk.Open();
        if (Session["skin"] == null)
        {
            SqlCommand smdskin = new SqlCommand("select skinid from SystemBasicInformation", connsk);
            Session["skin"] = Convert.ToString(smdskin.ExecuteScalar());
        }
        this.Page.Theme = Session["skin"].ToString();
        connsk.Close();
    }
}
