Utils/Utils.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
namespace IndiaStudyChannel.Utils
{
/// <summary>
/// Summary description for Utils.
/// </summary>
/// 由 liudao 翻译整理
/// 该源码下载自www.51aspx.com(51aspx.com)
public class Utils
{
public Utils()
{
}
/// <summary>
/// This method removes some dangerous characters from the word to avoid 'Sql Injection attack'.
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static string MakeSafeWord(string s)
{
if ( s == null )
return "";
return s.Replace("'", "").Replace("--", "");
}
/// <summary>
/// This method checks if the passed user id is an adinistrator or if this is same as current user.
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public static bool IsOwner(object userId)
{
if ( System.Web.HttpContext.Current.Session["CurrentUser"] == null )
{
// There is no userid saved in session. This means user has not logged in.
return false;
}
// Get current user from session.
string currentUser = System.Web.HttpContext.Current.Session["CurrentUser"].ToString();
// Get the admin user id from config file.
string adminUser = System.Configuration.ConfigurationSettings.AppSettings["AdminUser"];
if ( currentUser == adminUser )
{
// Current user is an administrator. Administrator is Owner for all submissions.
return true;
}
if ( userId != null && userId.ToString() == currentUser )
{
// Current user is same as the userId passed.
return true;
}
return false;
后面还有 51 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。