ASP

쿠키(Cookies) 중복 체크 및 처리

Dayis 2015. 11. 7. 16:30

'-------------------------------------------------
' 쿠키 중복 체크
'-------------------------------------------------
Function CookieDuplicateCheck(tableName, idx)
    dim dupliChk
    dim c_read_idx
    dim i
    dupliChk = false
    
    c_read_idx = Request.Cookies("C_TABLE_NAME")("READ")
    
    Response.Cookies("C_TABLE_NAME") = tableName
    Response.Cookies("C_TABLE_NAME").Path = "/"
    Response.Cookies("C_TABLE_NAME").Expires = date+1

    arrRead = split(c_read_idx,",")
    for i = 1 to UBound(arrRead)
        if CInt(idx) = CInt(Trim(arrRead(i))) then
            dupliChk = true
        end if
    next
    if dupliChk = true then
        Response.Cookies("C_TABLE_NAME")("READ") = c_read_idx
    else
        Response.Cookies("C_TABLE_NAME")("READ") = c_read_idx & "," & idx
    end if
    CookieDuplicateCheck = dupliChk
End Function



If CookieDuplicateCheck("board", idx)=False Then 

'쿠키정보가 없을 때 처리

else

  '쿠키정보가 있을 때 처리

End If