Changes for code getcookies

mod_harbour is an Apache module that allows to run PRGs directly on the web !!!
Post Reply
User avatar
Massimo Linossi
Posts: 474
Joined: Mon Oct 17, 2005 10:38 am
Location: Italy

Changes for code getcookies

Post by Massimo Linossi »

Hi to all
I made a change in this code adding the alltrim() to cCookie variable.
Without this in some situation the functions gives error.

Code: Select all

function GetCookies()

   local hHeadersIn := AP_HeadersIn()
   local cCookies := If( hb_HHasKey( hHeadersIn, "Cookie" ), hb_hGet( hHeadersIn, "Cookie" ), "" )
   local aCookies := hb_aTokens( cCookies, ";" )
   local cCookie, hCookies := {=>}
   
   for each cCookie in aCookies
      hb_HSet( hCookies, SubStr( alltrim(cCookie), 1, At( "=", alltrim(cCookie) ) - 1 ),;
               SubStr( alltrim(cCookie), At( "=", alltrim(cCookie)) + 1 ) )
   next
   
return hCookies
 
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Changes for code getcookies

Post by Antonio Linares »

thank you!
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply