You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.2 KiB
C#

using System;
using System.Linq;
using System.Web.Mvc;
using System.Data;
using Microsoft.Practices.EnterpriseLibrary.Data;
namespace DSWeb.MvcShipping.Controllers
{
public class IPLimitController : Controller
{
//
// GET:
public ActionResult Index ( )
{
return View();
}
//
public string UpdateIPAddress (string name)
{
//ip更新状态
string message = "0";
try
{
string delsql = "delete from sys_iplimit where oper = '" + name + "'";
Database db = DatabaseFactory.CreateDatabase();
db.ExecuteNonQuery(CommandType.Text, delsql);
string clientIP = System.Web.HttpContext.Current.Request.UserHostAddress;
string inssql = "insert into sys_iplimit (ip,oper) values('" + clientIP + "','" + name + "')";
int rst = db.ExecuteNonQuery(CommandType.Text, inssql);
message=rst>0?"1":"0";
}
catch (Exception)
{
message = "0";
}
return message;
}
}
}