Web页面安全验证类函数代码

【菜科解读】
/// publicstaticstring GetQuerryString(string key) { string s = GetQuerry(key); return InputText(s); } /// ///获取查询字符串数字值 /// ///
/// publicstaticint GetQuerryInt(string key) { int i =0; int.TryParse(GetQuerryString(key), out i); return i; } #region Utilities privatestaticstring GetQuerry(string key) { string s =""; if (System.Web.HttpContext.Current.Request.QueryString[key] !=null) { s = System.Web.HttpContext.Current.Request.QueryString[key]; } return s; } #endregion /// /// 获取表单字符值 /// ///
/// publicstaticstring GetFormString(string strText) { return InputText(strText); } /// /// 获取表单数字值 /// ///
/// publicstaticint GetFormInt(string strText) { strText = GetFormString(strText); int i =0; int.TryParse(strText, out i); return i; } #region Utilities /// /// 验证是否为正整数 /// ///
/// publicstaticbool IsInt(string str) { return Regex.IsMatch(str, @"^[0-9]*$"); } /// /// 验证是否为日期格式的字符串 /// ///
/// publicstaticbool IsDateString(string str) { return Regex.IsMatch(str, @"(\d{4})-(\d{1,2})-(\d{1,2})"); } /// /// 返回 HTML 字符串的编码结果 /// ///
字符串 ///编码结果 publicstaticstring HtmlEncode(string str) { return HttpUtility.HtmlEncode(str); } /// /// 返回 HTML 字符串的解码结果 /// ///
字符串 ///解码结果 publicstaticstring HtmlDecode(string str) { return HttpUtility.HtmlDecode(str); } /// /// 返回 URL 字符串的编码结果 /// ///
字符串 ///编码结果 publicstaticstring UrlEncode(string str) { return HttpUtility.UrlEncode(str); } /// /// 返回 URL 字符串的编码结果 /// ///
字符串 ///解码结果 publicstaticstring UrlDecode(string str) { return HttpUtility.UrlDecode(str); } /// /// HH:mm:ss /// ///日期字符串 publicstaticstring GetTime() { return GetDateTime("HH:mm:ss", null); } /// /// yyyy-MM-dd /// ///日期字符串 publicstaticstring GetDate() { return GetDateTime("yyyy-MM-dd", null); } /// /// yyyy-MM-dd HH:mm:ss /// ///日期字符串 publicstaticstring GetDateTime() { return GetDateTime("yyyy-MM-dd HH:mm:ss", null); } /// /// yyyy-MM-dd HH:mm:ss /// ///
需要增加的天数 ///日期字符串 publicstaticstring GetDateTime(int adddays) { return DateTime.Now.AddDays(adddays).ToString("yyyy-MM-dd HH:mm:ss"); } /// /// 自定义日期 /// ///
日期格式 如:yyyy-MM-dd ///
默认日期 如:2010-10-10 ///日期字符串 publicstaticstring GetDateTime(string formats, string defaultd) { if (string.IsNullOrEmpty(formats)) { formats ="yyyy-MM-dd"; } if (string.IsNullOrEmpty(defaultd)) { defaultd = DateTime.Now.ToString("yyyy-MM-dd"); } string d =""; try { d = DateTime.Now.ToString(formats); } catch (FormatException e) { d = Convert.ToDateTime(defaultd).ToString("yyyy-MM-dd"); } return d; } /// /// 清除所有脚本 /// ///
/// privatestaticstring InputText(string inputText) { if (inputText ==null) return""; inputText = Regex.Replace(inputText, "[\\s]{2,}", ""); inputText = Regex.Replace(inputText, "()+|()", "\n"); inputText = Regex.Replace(inputText, "(\\s*&[n|N][b|B][s|S][p|P];\\s*)+", ""); inputText = Regex.Replace(inputText, "", ""); inputText = inputText.Replace("'", "''"); return Filter(inputText); } /// /// /// 过滤危险字符 /// ///
/// publicstaticstring Filter(string input) { if ((input ==null) || (input =="")) { returnnull; } string p =@"exec[\s]{1,}|insert[\s]{1,}into[\s]{1,}|select[\s\S]{1,}from|delete[\s]{1,}|update[\s]{1,}|truncate[\s]{1,}table|--"; MatchCollection matches = Regex.Matches(input, p, RegexOptions.IgnoreCase); foreach (Match m in matches) { input = input.Replace(m.Value, ""); } return input; } #endregion } Web,页面,安全,验证,类,函数,代码,summary,W
避孕套正确使用?安全避孕又增情趣的啪啪戴套法
切勿戴反,前松后紧使用时还要分清安全套的里外面。
有的夫妻在不开灯时进行性行为,经常在佩戴过程中将安全套内外搞反。
由于有的避孕套内侧面或外侧面涂有药物或其它化学成分,戴反后不仅起不到应有效果,反而可能造成不良刺激。
不完全展开,挤出气体另外,在戴安全套时不要将其完全展开,并要将顶部的气体挤出。
而佩戴时机最好在前戏过后、阴茎完全勃起时,要保证在戴前双方没有性器接触。
戴上后应保证“前松后紧”的状态,若使用途中破裂,应停止性行为或事后采取紧急避孕措施。
疲软前摘掉,用过即扔何时摘掉安全套也是有讲究的。
在男性射精后、阴茎没有完全“疲软”前,按住安全套底部连同阴茎一起抽出,要保证没有精液溢出,否则也要采取紧急避孕措施。
2、在阴茎勃起时带上安全套,谨记在阴茎插入对方身体前戴上安全套。
在阴茎勃起前期所产生的分泌物可能含有精.液与导致性.病的病菌,能引起怀.孕和性.病的传播。
#p#分页标题#e#4、在挤压住安全套前端的同时,以另一只手将安全套轻轻伸展包覆整个阴茎。
确定安全套于性.交过程中紧套于阴茎上;如果安全套部分滑脱,立即将其套回原位。
若是安全套滑落掉出,立即将阴茎抽出,并在继续性.交前戴上新的安全套。
安全期是哪几天?前七后八是安全期吗
安全期是哪几天安全期是指上次排卵期结束后到下次排卵期前的一段时间。
一般来说,若女性以28天为正常生理周期的话,月经来潮的第一天往前七天和往后八天这一段时间就是安全期。
月经前七天和月经后八天为成年女性的安全期,菜叶说说,是多数人用来避孕的一种计算方法。
除了使用天数计算的日历法外,尚有基础体温法和分泌物观察法。
然而安全期并非绝对安全,有时候女性排卵会提前,或者延后,此时安全期的判断就会变得无效。
安全期怀孕几率是多大很多人的认知里,安全期就是代表安全,所以安全期应该不会怀孕的,但是,很多时候,原来发现安全期居然也会怀孕,那么,安全期怀孕的几率有多大呢?在安全期进行性生活怀孕的机率大约为2%,如果有月经推迟可以在性生活半月后用晨尿进行早早孕检查来确定是否怀孕。
排除怀孕后,如果月经推迟超过10天还不来,可以应用黄体酮等药物进行治疗。
也可以通过中医望闻问切辨证论治进行调节、。
如果平时月经周期很规律,确定是安全期的话会怀孕的几率很小的。
在安全期内同房,正常情况下是不会怀孕的,女人月经周期稳定,没有受到其他影响的的情况下,月经前7天后8天一般是为安全期。
性行为距离月经第一天越近越安全,越远则越危险,因为排卵可能性与之呈正相关。