Wednesday, February 13, 2008

Add Cookie manipulation to WebSession Class

To add the getCookieVal function and the setCookie subroutine to Jake Howlett's WebSession class, add them and the escape and unescape functions at the end of the class.



Class WebSession
Public session As Notessession
Public database As NotesDatabase
...



Sub return(URL As String)
If Left(URL, 1)<>"/" Then
URL = "/"+URL
End If

Print "Location: " + URL
End Sub

' insert functions and subroutines here

' escape function is the same
Function escape(strIn As String) As String
Dim strAllowed As String
Dim i As Integer
Dim strChar As String
Dim strReturn As String
...
escape = strReturn
End Function


' unescape function is the same
Function unescape(strIn As String) As String
Dim i As Integer
Dim strChar As String
Dim strReturn As String
...
unescape = strReturn
End Function


' getCookieValfunction is the same
Function getCookieVal(thisname As String) As String
Dim cookie As String
Dim prefix As String
...
getCookieVal = unescape(Mid$(cookie, begin+Len(prefix), ending - begin -Len(prefix)+1))
End Function


' the setCookie sub needs a small adjustment where the database path (dbpath) is calculated
Sub setCookie(compName As String, compValue As String, adjYear As Integer, adjHour As Integer)
Dim thistime As NotesDateTime
Dim gmttime As NotesDateTime
Dim gmtvar As Variant
Dim cooktime As String
Set thistime = New NotesDateTime("")
Call thistime.SetNow
If adjHour <> 0 Then
Call thistime.AdjustHour(adjHour)
End If
If adjYear <> 0 Then
Call thistime.AdjustYear(adjYear)
End If
Set gmttime = New NotesDateTime(Left$(thistime.GMTTime, Len(thistime.GMTTime)-4))
gmtvar = gmttime.LSLocalTime
cooktime = Format(gmtvar, "dddd")+ ", " + Format(gmtvar, "dd")+ "-" + Format(gmtvar, "mmm") + "-" + Format(gmtvar, "yyyy") +_
" " + Format(gmtvar, "hh:mm:ss") + " GMT"
compName = escape(compName)
compValue = escape(compValue)
Dim dbpath As String
dbpath = Strleft(Lcase(Me.document.Path_Info_Decoded(0)), ".nsf") + ".nsf"+ "/"
Print "Set-Cookie: " + compName + "=" + compValue + "; expires=" + cooktime + "; path=" + dbpath + ";"
End Sub

End Class

34 comments:

KaranTilton said...

歐美潮吹影片歐美模特兒寫真影片欣賞歐美模特兒寫真歐美影集歐美影片歐美整形外科歐美潮吹影片歐美模特兒寫真影片欣賞歐美模特兒寫真歐美影集歐美影片歐美寫真歐美辣妹寫真集歐美貼圖區歐美貼圖片區歐美貼圖歐美絲襪美腿歐美無碼歐美猛男歐美情色貼圖歐美情色歐美素圖歐美素材歐美美女歐美洋妞美女圖片歐美性愛女郎歐美性愛歐美刺青紋身圖片歐美亞語文中心歐美亞歐美男同志歐美免費影片欣賞歐美免費影片歐美免費a片歐美色情影片歐美色情歐美自拍歐美成人影片歐美成人歐美幼幼

遊戲機 said...

看看blog調整心情,又要來繼續工作,大家加油........................................

開心唷 said...

If you lend someone $20 and never see that person again, it was probably worth it.............................................

家瑩 said...

It's great!!..................................................

志文志文 said...

裸體寫真全裸美女圖片色情訊息黃色圖片自拍裸體圖片sex裸露圖片18限85cc a片台灣色情網站免費色情圖一夜激情聊天情色聊天室限制級爆乳女優作愛巨乳學院性愛情慾陰脣一夜情下體網愛聊天鹹濕做愛自拍成人圖庫成人影城性關係視訊情人性影片觀賞裸照淫美成人論壇av寫真自拍裸女貼圖av圖情色性愛貼圖成人vcdsexy辣妹視訊聊天色情視訊淫婦台灣情色論壇丁字褲貼圖免費a片影片淫蕩女人live show男女做愛火辣妹妹激情網愛聊天美女裸照免費色情網站

Porsha蔡Coghlan明宏 said...

One swallow does not make a summer.......................................................

靜宸 said...

手機色情電話卡通色情動畫影片免費色情動漫下載qvod色情影片色情qvod線上色情下載線上色情片免費線上色情片免費看線上成年人影片線上成人影片a直播線上成人網站影片線上女優短片線上片免費看線上片試看線上卡通色線上卡通動畫線上卡通網線上台灣 18a 片網線上同志漫畫線上字線上成人線上成人免費go2線上成人動畫網線上成人電影分享線上色情片免費觀賞線上色情免費看線上免費卡通影片線上免費同志影片線上免費成人片試看線上免費成人長片成人小說 言情小說 視訊交友玩美女人

LeGarten佳琳 said...

沒有一件事情是好的或壞的,是想法改變了一切。 ..................................................

智能 said...

噴泉的高度,不會超過它的源頭。一個人的事業也是如此,它的成就絕不會超過自己的信念。.............................................

柏廷柏廷 said...

成人免費線上看 日本情色視訊 ut聊天網 免費線上色情片 yam交友 女優影片分享 露點 成人免費影片觀看 偷拍貼圖站 美女聊天室 愛情 歐美情趣圖片 女優18禁 台灣絲襪美少女 85cc免費小短片影城 免費a片直撥網 av情色影片 卡通色情影片區 一夜情 影音383 完美女人影片試看 美少女 性美女愛 辣妹強姦 人妻av下載 成人 成人視訊 空姐絲襪 a片a圖論壇 偷拍寫真 85cc 免費影片欣 微風成人區成人寫真 成人嘟嘟網免費看 www.7777th.com 杜雷斯免費貼圖區 援交妹貼圖區 嘟嘟情人色網 dudu 台南鋼管秀 pub 日本av線上 洪爺影片交流區 大大奶的 ab 女傭 sex888 okk 免費下載 巨乳人妻 敏感帶 後宮無碼光碟網 限制級 0204成人影片 無碼性愛影片 走光照

ErnestoE_S陽峰ommers0909 said...

樂觀進取,勇往直前,持之以恒,是克服困難的妙方。 ............................................................

和辛和辛 said...

生存乃是不斷地在內心與靈魂交戰;寫作是坐著審判自己。......................................................................

rodriguezp said...

A bad excuse is worse than none. ....................................................

esthermelvin said...

人生是故事的創造與遺忘。..................................................................

博行 said...

婚姻對男人來說是賭他的自由,對女人而言卻是賭她的幸福。..................................................................

明宏 said...

我來湊熱鬧的~~^^ 要平安快樂哦.....................................................................

江婷 said...

河水永遠是相同的,可是每一剎那又都是新的。......................................................................

信豪信豪 said...

Pay somebody back in his own coin.....................................................................

懿綺懿綺 said...

認清問題就等於已經解決了一半的問題。.................................................................

婷珊 said...

噴泉的高度,不會超過它的源頭。一個人的事業也是如此,它的成就絕不會超過自己的信念。.................................................................

原秋原秋 said...

好棒的地方 我一定要常來~~~^^~..................................................................

宜FH定博林P'韓T彥 said...

Riches serve a wise man but command a fool.............................................................

劉耀德劉耀德 said...

流浪到這裡,留言謝謝你。............................................................

林柏毅林柏毅 said...

Pen and ink is wits plough. ............................................................

KyungBivo中如 said...

人們不缺少力量,他們缺少意志。..................................................

蔡靜芳蔡靜芳 said...

第一忠誠,第二勤奮,第三專心工作。..................................................

ju吳phe宇te佳ns said...

不論做什麼事,相信自己,別讓別人的一句話,把你擊倒。..................................................

趙喜柯凡豐妤 said...

生命所經歷的折磨愈多,其所產生的奮鬥力愈大。............................................................

楊燕沛楊燕沛 said...

來給你加油打氣!!............................................................

劉黃志宇建娥 said...

良言一句三冬暖,惡語傷人六月寒。......................................................................

瑞彥強瑞彥強瑞彥強 said...

may the blessing be always with you!!............................................................

48684 said...

看到大家都留言-我也忍不住說聲---加油..................................................

惠奇 said...

男女互悅,未必廝守終生,相愛就是美的。.................................................................

瑰潼 said...

財富並非永遠的朋友,但朋友卻是永遠的財富。......................................................................