?? lxencode.cs
字號:
?using System;
using System.Data;
using System.Configuration;
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;
/// <summary>
/// EnCode 的摘要說明
/// </summary>
public class LxEnCode
{
public LxEnCode()
{
//
// TODO: 在此處添加構造函數邏輯
//
}
public static string EnCode(string str)
{
//編碼替換
str = HttpUtility.HtmlEncode(str);
str = str.Replace("'", "-%^_^%---");
str = str.Replace("\"", "--%-_-%----");
return str;
}
public static string DeCode(string str)
{
//反編碼替換
str = str.Replace("--%-_-%----", "\"");
str = str.Replace("-%^_^%---", "'");
str = HttpUtility.HtmlDecode(str);
return str;
}
public static string EnURL(string str)
{
//編碼URL地址
str = HttpUtility.HtmlEncode(str);
str = str.Replace("'", "");
str = str.Replace(" ", "");
return str;
}
public static bool CheckParams(string res)
{
//防sql注入及非法HTML字符
string[] str = new string[21];
str[0] = "net user";
str[1] = "xp_cmdshell";
str[2] = "/add";
str[3] = "exec%20master.dbo.xp_cmdshell";
str[4] = "net localgroup administrators";
str[5] = " select ";
str[6] = " count ";
str[7] = " asc ";
str[8] = " char ";
str[9] = " mid ";
str[10] = "''";
str[11] = ":";
str[12] = "'";
str[13] = "insert ";
str[14] = "delete ";
str[15] = "drop ";
str[16] = "truncate";
str[17] = "from ";
str[18] = "%";
str[19] = "<";
str[20] = ">";
int no = 0;
for (int i = 0; i < str.Length; i++)
{
if (res.IndexOf(str[i].ToString()) != -1)
{
no = 1;
break;
}
}
if (no == 1)
{
return true;//有問題
}
else
return false;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -