/
ivan
/
ModMas
Обзор
Документация
Войти
/
ivan
/
ModMas
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
ModuleMaster/handlers/update_changed_by.ashx
75 строк
3 KB
i.krivokon
Initial commit
13 мар 2026, 13:49
13 мар 2026, 13:49
00d9fb6
Код
Авторство
О чём код?
<%@ WebHandler Language="VB" Class="updateChangedBy" %> Imports System.Net Imports System.IO Imports System.Web Imports sharedClasses.dbFunctions Public Class updateChangedBy : Implements IHttpHandler, System.Web.SessionState.IRequiresSessionState Private sqlf As New SqlFunctions Public ReadOnly Property IsReusable As Boolean Implements IHttpHandler.IsReusable Get Throw New System.NotImplementedException() End Get End Property Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest Dim userIp As String = "" Dim a As sharedClasses.Auth.auth With context If .Request.UserHostAddress = "::1" Then userIp = "106.109.72.69" Else userIp = .Request.UserHostAddress End If a = New sharedClasses.Auth.auth("SSO", userIp) Dim qString As System.Collections.Specialized.NameValueCollection = .Request.QueryString Dim tableName, rowId As String tableName = qString("tid") rowId = qString("rowid") tableName = sqlf.GetScalar("SELECT [DbTableName] FROM [UserModules].[dbo].[ModuleTables] WHERE ID=" & tableName) Dim sql As String = "UPDATE [UserModules].[user].[" & tableName & "] SET CHANGED_BY='" & a.userId & "' WHERE ID=" & rowId sqlf.NonQuery(sql) sql = "UPDATE [UserModules].[user].[" & tableName & "] SET CHANGE_DATE=convert(char(10), GETDATE(), 121) WHERE ID=" & rowId sqlf.NonQuery(sql) sql = "UPDATE [UserModules].[user].[" & tableName & "] SET CHANGE_TIME=convert(char(10), GETDATE(), 8) WHERE ID=" & rowId sqlf.NonQuery(sql) End With Dim logFilePath As String = "handlerlog.txt" Try Using writer As StreamWriter = File.AppendText(logFilePath) writer.WriteLine("Log entry at :", Date.Now) writer.WriteLine("user IP: ", userIp, " user name: ", a.userId) End Using Catch ex As Exception Dim exc As String = ex.Message End Try End Sub End Class 'Imports System.IO 'Module LogWriter ' Sub Main() ' Dim logFilePath As String = "C:\Logs\applog.txt" ' Try ' Using writer As StreamWriter = File.AppendText(logFilePath) ' writer.WriteLine($"Log entry at {Date.Now}") ' writer.WriteLine("This is a test log message.") ' End Using ' Console.WriteLine("Лог успешно записан!") ' Catch ex As Exception ' Console.WriteLine("Ошибка записи лога: " & ex.Message) ' End Try ' End Sub 'End Module