·ÀÖ¹SQL×¢Èë
×î½ü¿´µ½ºÜ¶àÈ˵ÄÍøÕ¾¶¼±»×¢Èëjs,±»iframeÖ®ÀàµÄ¡£·Ç³£¶à¡£
±¾ÈËÔø½ÓÊÖ¹ýÒ»¸ö±È½Ï´óµÄÍøÕ¾£¬±»È˼ÒÈëÇÖÁË£¬ÒªÎÒÊÕÊ°²Ð¾Ö¡£¡£
1.Ê×ÏÈÎÒ»á¼ì²éһϷþÎñÆ÷ÅäÖã¬ÖØÐÂÅäÖÃÒ»´Î·þÎñÆ÷°²È«£¬¿ÉÒԲο¼
http://hi.baidu.com/zzxap/blog/item/18180000ff921516738b6564.html
2.Æä´Î£¬ÓÃÂ󿧷È×Ô¶¨Òå²ßÂÔ£¬¼´Ê¹ÍøÕ¾³ÌÐòÓЩ¶´£¬±ðÈËÒ²ºÜÄÑÔÚÎļþÉÏдÈë´úÂëÁË¡£
²Î¿¼×Ô¶¨Òå²ßÂÔ£¬ÓÐÁËÕâ¸ö²ßÂÔ£¬ÔÙÀõijÌÐò£¬ÄãÒ²ÎÞ·¨Ð´ÈëÎÒµÄÎļþ
http://hi.baidu.com/zzxap/blog/item/efe093a7e0f2c190d04358ef.html
3.¿ÉÒÔÓÃÍøÂ糬¼¶Ñ²¾¯É¾³ý±»×¢ÈëµÄJS´úÂë¡£
²Î¿¼
http://hi.baidu.com/anlish/blog/item/ba45bb18eac77e0534fa4134.html
4.ÈçºÎÅúÁ¿É¾³ýÊý¾Ý¿âÖб»×¢ÈëµÄ´úÂ룿
ÔÚÊý¾Ý¿â²éѯ·ÖÎöÆ÷ÔËÐÐÕâ¶Î´úÂë¼´¿É
SQL code
DECLARE @fieldtype sysname
SET @fieldtype='varchar'
--ɾ³ý´¦Àí
DECLARE hCForEach CURSOR GLOBAL
FOR
SELECT N'update '+QUOTENAME(o.name)
+N' set '+ QUOTENAME(c.name) + N' = replace(' + QUOTENAME(c.name) + ',''<script_src=http://ucmal.com/0.js> </script>'','''')'
from sysobjects o,syscolumns c,systypes t
WHERE o.id=c.id
AND OBJECTPROPERTY(o.id,N'IsUserTable')=1
AND c.xusertype=t.xusertype
AND t.name=@fieldtype
EXEC sp_MSforeach_Worker @command1=N'?'
5.´´½¨Ò»¸ö´¥·¢Æ÷£¬Ö»ÒªÓÐ </script>¾Í²»¸ø²åÈ룬¶ÔÐÔÄÜ»áÓеãÓ°Ïì
SQL code
create trigger tr_table_insertupdate
on tablename
for insert,update
as
if exists (
select 1 from inserted
where data like '%</script>%'
)
begin
RAISERROR ('²»ÄÜÐ޸ĻòÕßÌí¼Ó',16,1);
ROLLBACK TRANSACTION
end
go
6.×îÖØÒªµÄ»¹ÊdzÌÐòµÄд·¨£¬ÓòÎÊý»¯SQL»ò´æ´¢¹ý³Ì
ÀýÈç
C# code
protected void cmdok_Click(object sender, EventArgs e)
{
//Ìí¼ÓÐÅÏ¢
StringBuilder sql = new StringBuilder( " insert into m_phone ( pid,PhoneName,num,price,phonetype,onSellTime,color,weight,Video,Camera,phoneSize,phoneSystem,Memorysize,PhoneDesc,Standbytime,ScreenSize,Frequency,InputMethod,Soundrecord,gps,fm,mp3,email,Infrared,game,clock,Calendar,Calculator,Bluetooth) ");
sql.Append(" values (@pid,@TextPhon
Ïà¹ØÎĵµ£º
ÎÊÌâÃèÊö£º
Óбítb, ÈçÏÂ:
id values
----------- -----------
1 aa,bb
2 aaa,bbb,ccc
Óû°´,·Ö²ðvaluesÁÐ, ·Ö²ðºó½á¹ûÈçÏÂ:
id& ......
ÓÉÓÚ´úÂë¹ýÓÚ¼òµ¥£¬Ö±½ÓÌù³ö£º
SqlDataSourceEnumerator SseInstance = SqlDataSourceEnumerator.Instance;
//ServerName:·þÎñÆ÷Ãû;
//InstanceName:ʵÀýÃû;
//IsClustered:ÊÇ·ñΪȺ¼¯·þÎñÆ÷µÄÒ»²¿·Ö;
//Version:°æ±¾,8.*ÊÇSQL 2000,9.*ÊÇSQL 2005
DataTable DtSqlInstance = SseInstance.GetDataSources();
×¢£º ......
Êý¾Ý¿âµÄÐÔÄܲâÊÔ¿ÉÒÔ°ïÖúÄãÌáÇ°ÖªµÀÄãµÄϵͳµÄ¸ºÔØÄÜÁ¦£¬¿ÉÒÔ°ïÖúÄã¸Ä½øϵͳµÄʵʩ»òÉè¼Æ£¬¿ÉÒÔ°ïÖúÄãÈ·¶¨Ò»Ð©Éè¼ÆºÍ±à³ÌÔÔò. µ«ÊÇ£¬ÕâÀïÃæÒ²ÓÐÏÝÚå. Èç¹û²»Ð¡ÐÄ£¬Äã»á×Ô¼º°Ñ×Ô¼ºÏݽøÈ¥£¬È´×îÖÕ²»Ã÷°×ÊÇʲôÔÒò. ÕâÀÎÒÄÃһλÏÈÉúΪÀý£¬À´¿´¿´ËûÔõô×Ô¼º°Ñ×Ô¼º¸ãºýÍ¿µÄ.
×î½ü, ÏëÆðÔÚ´æ´¢¹ý³ÌÖо¿¾¹ÊÇʹÓÃÁÙʱ±í»¹ÊÇÊ ......
/*
Ô±í£º
thid other
a 1
a 1
b 0
b 0
......
Ö÷¼ü:
Äܹ»Î¨Ò»±íʾÊý¾Ý±íÖеÄÿ¸ö¼Ç¼µÄ¡¾×ֶΡ¿»òÕß¡¾×ֶΡ¿µÄ×éºÏ¾Í³ÆΪÖ÷Âë(Ö÷¼ü)¡£ Ò»¸öÖ÷¼üÊÇΨһʶ±ðÒ»¸ö±íµÄÿһ¼Ç¼£¬µ«ÕâÖ»ÊÇÆä×÷ÓõÄÒ»²¿·Ö£¬Ö÷¼üµÄÖ÷Òª×÷ÓÃÊǽ«¼Ç¼ºÍ´æ·ÅÔÚÆäËû±íÖеÄÊý¾Ý½øÐйØÁª¡£ÔÚÕâÒ»µãÉÏ£¬Ö÷¼üÊDz»Í¬±íÖи÷¼Ç¼֮¼äµÄ¼òµ¥Ö¸Õë¡£Ö÷¼üÔ¼Êø¾ÍÊÇÈ·¶¨±íÖеÄÿһÌõ¼Ç¼¡£Ö÷¼ü²»ÄÜÊÇ¿ÕÖµ¡£Î¨Ò ......