Files
17168ERP/web/App_Script/ContentBuilder/ContentBuilder.aspx.cs
2025-08-29 01:27:25 +08:00

61 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.OleDb;
using System.Configuration;
public partial class App_Script_ContentBuilder_ContentBuilder : MyWeb.function
{
public string web_root;
string db = ConfigurationManager.ConnectionStrings["shopConn"].ConnectionString;
string p_name = ConfigurationManager.ConnectionStrings["shopConn"].ProviderName;
string scc = ConfigurationManager.AppSettings["shopCarCode"].ToString();
protected void Page_Load(object sender, EventArgs e)
{
MyWeb.admin admin = new MyWeb.admin();
if (admin.isLoign())
{
if (admin.info.login_ip != MyWeb.admin.MyIP)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.StatusCode = 404;
HttpContext.Current.Response.End();
}
MyWeb.sql sql = new MyWeb.sql();
OleDbConnection sqlConn = sql.conn(db, p_name);
try
{
sqlConn.Open();
OleDbCommand sqlCmd = new OleDbCommand("", sqlConn);
sqlCmd.CommandText = "SELECT pic_url FROM company";
DataTable dt = sql.dataTable(sqlCmd);
if (dt.Rows.Count > 0)
{
web_root = dt.Rows[0]["pic_url"].ToString();
web_root += web_root.Substring(web_root.Length - 1, 1) != "/" ? "/" : "";
}
}
catch (Exception ex)
{
//Response.Write(ex.Message);
}
finally
{
sqlConn.Close();
sqlConn.Dispose();
}
}
else
{
HttpContext.Current.Response.Redirect("~/admin/index.aspx");
}
base.OnPreInit(e);
}
}