%@ CodePage = 1254 LCID = 1055 %> <% Response.expires = 0 Response.expiresabsolute = Now() - 1 Response.addHeader "pragma", "no-cache" Response.addHeader "cache-control", "private" Response.addHeader "cache-control", "no-cache" Response.addHeader "cache-control", "no-store" Response.CacheControl = "no-cache" %> <% If Not IsLoggedIn Then Response.Redirect "login.asp" %> <% ' Initialize common variables x_id = Null: ox_id = Null: z_id = Null x_ust_yazi = Null: ox_ust_yazi = Null: z_ust_yazi = Null x_resim = Null: ox_resim = Null: z_resim = Null fs_x_resim = 0: fn_x_resim = "": ct_x_resim = "" wd_x_resim = 0: ht_x_resim = 0: a_x_resim = "" x_alt_yazi = Null: ox_alt_yazi = Null: z_alt_yazi = Null x_yan_yazi = Null: ox_yan_yazi = Null: z_yan_yazi = Null x_resimsol = Null: ox_resimsol = Null: z_resimsol = Null x_resim_boy = Null: ox_resim_boy = Null: z_resim_boy = Null x_resim_en = Null: ox_resim_en = Null: z_resim_en = Null %> <% Response.Buffer = True ' Load key from QueryString x_id = Request.QueryString("id") sAction = "" If Not RequestBlobData() Then ' Load Blob Data sAction = "I" ' Display Record End If ' Check if valid key If x_id = "" Or IsNull(x_id) Then Response.Redirect "halklailiskilerlist.asp" ' Open connection to the database Set conn = Server.CreateObject("ADODB.Connection") conn.Open xDb_Conn_Str Select Case sAction Case "I": ' Get a record to display If Not LoadData() Then ' Load Record based on key Session(ewSessionMessage) = "Kayıt Bulunmadı" conn.Close ' Close Connection Set conn = Nothing Response.Clear Response.Redirect "halklailiskilerlist.asp" End If Case "U": ' Update If EditData() Then ' Update Record based on key Session(ewSessionMessage) = "Başarıyla Güncelleştirildi" conn.Close ' Close Connection Set conn = Nothing Response.Clear Response.Redirect "halklailiskilerlist.asp" End If End Select %>
Değiştir TABLO: halklailiskiler
Listeye Geri Don
<%= Session(ewSessionMessage) %>
<% Session(ewSessionMessage) = "" ' Clear message End If %> <% conn.Close ' Close Connection Set conn = Nothing %> <% '------------------------------------------------------------------------------- ' Function RequestBlobData ' - Handle mult-part data (for file upload) ' - Variables setup: sAction, field variables, EW_Max_File_Size Function RequestBlobData() Dim rawData, separator, lenSeparator, dict Dim currentPos, inStrByte, tempValue, mValue, value Dim intDict, begPos, endPos, nValue Dim nameN, isValid, nameValue, midValue If Request.TotalBytes > 0 Then rawData = Request.BinaryRead(Request.TotalBytes) separator = MidB(rawData, 1, InStrB(1, rawData, ChrB(13)) - 1) lenSeparator = LenB(separator) Set dict = Server.CreateObject("Scripting.Dictionary") currentPos = 1 inStrByte = 1 tempValue = "" While inStrByte > 0 inStrByte = InStrB(currentPos, rawData, separator) mValue = inStrByte - currentPos If mValue > 1 Then value = MidB(rawData, currentPos, mValue) Set intDict = Server.CreateObject("Scripting.Dictionary") begPos = 1 + InStrB(1, value, ChrB(34)) endPos = InStrB(begPos + 1, value, ChrB(34)) nValue = endPos nameN = MidB(value, begPos, endPos - begPos) isValid = True If InStrB(1, value, stringToByte("Content-Type")) > 1 Then begPos = 1 + InStrB(endPos + 1, value, ChrB(34)) endPos = InStrB(begPos + 1, value, ChrB(34)) If endPos = 0 Then endPos = begPos + 1 isValid = False End If midValue = MidB(value, begPos, endPos - begPos) intDict.Add "FileName", Trim(byteToString(midValue)) begPos = 14 + InStrB(endPos + 1, value, stringToByte("Content-Type:")) endPos = InStrB(begPos, value, ChrB(13)) midValue = MidB(value, begPos, endPos - begPos) intDict.Add "ContentType", Trim(byteToString(midValue)) begPos = endPos + 4 endPos = LenB(value) nameValue = MidB(value, begPos, ((endPos - begPos) - 1)) Else nameValue = Trim(byteToString(MidB(value, nValue + 5))) End If If isValid = True Then If dict.Exists(byteToString(nameN)) Then Set intDict = dict.Item(byteToString(nameN)) If Right(intDict.Item("Value"), 2) = vbCrLf Then intDict.Item("Value") = Left(intDict.Item("Value"), Len(intDict.Item("Value"))-2) End If intDict.Item("Value") = intDict.Item("Value") & ", " & nameValue Else intDict.Add "Value", nameValue intDict.Add "Name", nameN dict.Add byteToString(nameN), intDict End If End If End If currentPos = lenSeparator + inStrByte Wend ' Get action sAction = getValue(dict, "a_edit") EW_Max_File_Size = getValue(dict, "EW_Max_File_Size") x_id = getValue(dict, "x_id") x_ust_yazi = getValue(dict, "x_ust_yazi") fs_x_resim = getFileSize(dict, "x_resim") ' Check the file size If fs_x_resim > 0 And CLng(EW_Max_File_Size) > 0 Then If fs_x_resim > CLng(EW_Max_File_Size) Then Response.Write Replace("", "%s", EW_Max_File_Size) Response.End End If End If fn_x_resim = getFileName(dict, "x_resim") ' Check the file type If Not ewUploadAllowedFileExt(fn_x_resim) Then Response.Write "" Response.End End If ct_x_resim = getFileContentType(dict, "x_resim") x_resim = getFileData(dict, "x_resim") wd_x_resim = getValue(dict, "wd_x_resim") ht_x_resim = getValue(dict, "ht_x_resim") a_x_resim = getValue(dict, "a_x_resim") x_alt_yazi = getValue(dict, "x_alt_yazi") x_yan_yazi = getValue(dict, "x_yan_yazi") x_resimsol = getValue(dict, "x_resimsol") x_resim_boy = getValue(dict, "x_resim_boy") x_resim_en = getValue(dict, "x_resim_en") If IsObject(intDict) Then intDict.RemoveAll Set intDict = Nothing End If dict.RemoveAll Set dict = Nothing RequestBlobData = True Else RequestBlobData = False End If End Function %> <% '------------------------------------------------------------------------------- ' Function LoadData ' - Load Data based on Key Value ' - Variables setup: field variables Function LoadData() Dim rs, sSql, sFilter sFilter = ewSqlKeyWhere sFilter = Replace(sFilter, "@id", AdjustSql(x_id)) ' Replace key value sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, sFilter, "") Set rs = Server.CreateObject("ADODB.Recordset") rs.Open sSql, conn If rs.Eof Then LoadData = False Else LoadData = True rs.MoveFirst ' Get the field contents x_id = rs("id") x_ust_yazi = rs("ust_yazi") x_resim = rs("resim") x_alt_yazi = rs("alt_yazi") x_yan_yazi = rs("yan_yazi") x_resimsol = rs("resimsol") x_resim_boy = rs("resim_boy") x_resim_en = rs("resim_en") End If rs.Close Set rs = Nothing End Function %> <% '------------------------------------------------------------------------------- ' Function EditData ' - Edit Data based on Key Value ' - Variables used: field variables Function EditData() On Error Resume Next Dim rs, sSql, sFilter sFilter = ewSqlKeyWhere sFilter = Replace(sFilter, "@id", AdjustSql(x_id)) ' Replace key value sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, sFilter, "") Set rs = Server.CreateObject("ADODB.Recordset") rs.CursorLocation = 3 rs.Open sSql, conn, 1, 2 If Err.Number <> 0 Then Session(ewSessionMessage) = Err.Description rs.Close Set rs = Nothing EditData = False Exit Function End If ' clone old and new rs object Dim rsold, rsnew Set rsold = rs.Clone(1) rsold.Requery() Set rsnew = rs.Clone(1) If rs.Eof Then EditData = False ' Update Failed Else ' Field id ' Field ust_yazi sTmp = Trim(x_ust_yazi) If Trim(sTmp) = "" Then sTmp = Null rs("ust_yazi") = sTmp ' Field resim If a_x_resim = "2" Or a_x_resim = "3" Then ' Update/Remove ox_resim = rs("resim") sTmpFolder = ewUploadPathEx(True, EW_UploadDestPath) If ox_resim <> "" Then ewDeleteFile sTmpFolder & ox_resim sTmp = x_resim If Trim(sTmp) = "" Then sTmp = Null If IsNull(sTmp) Then rs("resim") = Null Else rs("resim") = ewUploadFileNameEx(sTmpFolder, fn_x_resim) ewSaveFile sTmpFolder, rs("resim"), sTmp End If End If ' Field alt_yazi sTmp = Trim(x_alt_yazi) If Trim(sTmp) = "" Then sTmp = Null rs("alt_yazi") = sTmp ' Field yan_yazi sTmp = Trim(x_yan_yazi) If Trim(sTmp) = "" Then sTmp = Null rs("yan_yazi") = sTmp ' Field resimsol sTmp = x_resimsol If sTmp = "Sol" Then rs("resimsol") = True Else rs("resimsol") = False End If ' Field resim_boy sTmp = x_resim_boy If Not IsNumeric(sTmp) Then sTmp = Null Else sTmp = CLng(sTmp) End If rs("resim_boy") = sTmp ' Field resim_en sTmp = x_resim_en If Not IsNumeric(sTmp) Then sTmp = Null Else sTmp = CLng(sTmp) End If rs("resim_en") = sTmp ' Call updating event If Recordset_Updating(rs, rsnew) Then rs.Update If Err.Number <> 0 Then Session(ewSessionMessage) = Err.Description EditData = False Else EditData = True End If Else rs.CancelUpdate EditData = False End If End If ' Call updated event If EditData Then Call Recordset_Updated(rsold, rsnew) End If rs.Close Set rs = Nothing rsold.Close Set rsold = Nothing rsnew.Close Set rsnew = Nothing End Function '------------------------------------------------------------------------------- ' Recordset updating event Function Recordset_Updating(rsold, rsnew) On Error Resume Next ' Please enter your customized codes here Recordset_Updating = True End Function '------------------------------------------------------------------------------- ' Recordset updated event Sub Recordset_Updated(rsold, rsnew) On Error Resume Next End Sub %>