// {% LoadHRB( "retedb.hrb" ) %}
memvar hForm
**************************************************************************
Function main()
local mv_username:="" , mv_password:="" , nErr:=0 , zMail:="" , cUserName:=""
local link_intra:="" , pagina_arrivo:="" , controllo_web:=""
local cookie_stringa
Setting_db()
SetCookie( 'blu1', "cookie numero 1" + "|" + "2020|1|1|", 90000, '' )
SetCookie( 'blu2', "cookie numero 2" + "|" + "2020|2|2|", 90000, '' )
SetCookie( 'blu3', "cookie numero 3" + "|" + "2020|3|3|", 90000, '' )
SetCookie( 'blu4', "cookie numero 4" + "|" + "2020|4|4|", 90000, '' )
SetCookie( 'blu5', "cookie numero 5" + "|" + "2020|5|5|", 90000, '' )
SetCookie( 'blu6', "cookie numero 6" + "|" + "2020|6|6|", 90000, '' )
SetCookie( 'blu7', "cookie numero 7" + "|" + "2020|7|7|", 90000, '' )
SetCookie( 'blu8', "cookie numero 8" + "|" + "2020|8|8|", 90000, '' )
Return nil
**************************************************************************
function msgAlert( cMsg )
? "<script>alert('"+cMsg+"');</script>"
Return nil
**************************************************************************
Function BLR(wait) // BLOCCA IL RECORD
** wait = i secondi di attesa dopodiche' la funzione ritorna .F.
** se non riesce ad aprire il file
local forever
IF RLOCK()
Return .T.
ENDIF
forever=(wait=0)
Do while ( forever .or. wait > 0 )
SecondsSleep(1)
wait-=0.50
IF RLOCK()
Return .T.
ENDIF
IF INT(wait) = wait
EXIT
ENDIF
Enddo
Return .F.
**************************************************************************
Function Setting_db()
REQUEST HB_LANG_IT
HB_LANGSELECT("IT")
REQUEST DBFCDX
REQUEST DBFFPT
REQUEST ADS
RddRegister( "ADS", 1 )
RddSetDefault("ADS")
SET SERVER REMOTE
SET FILETYPE TO ADT
SET(_SET_AUTORDER,1)
SET AUTOPEN ON
set(_SET_OPTIMIZE,.T.)
ADSLOCKING(.T.)
SET DATE BRITISH
SET DELETED ON
SET CENTURY ON
Return nil
Error: Undefined function
operation: SETTING_DB
called from: pcode.hrb, SETTING_DB, line: 0
called from: pcode.hrb, MAIN, line: 12
called from: HB_HRBDO, line: 0
called from: ..\source\exec.prg, EXECUTE, line: 70
Source:
0010: local cookie_stringa
0011:
0012 =>Setting_db()
0013:
0014: SetCookie( "blu1", "cookie numero 1" + "|" + "2020|1|1|", 90000, "" )
function MyLoadHRB( cHrbFile_or_oHRB )
local lResult := .F.
if ValType( cHrbFile_or_oHRB ) == "C"
if File( hb_GetEnv( "PRGPATH" ) + "/" + cHrbFile_or_oHRB )
AAdd( M->getList,;
hb_HrbLoad( 1, hb_GetEnv( "PRGPATH" ) + "/" + cHrbFile_or_oHRB ) )
lResult = .T.
endif
endif
if ValType( cHrbFile_or_oHRB ) == "P"
AAdd( M->getList, hb_HrbLoad( 1, cHrbFile_or_oHRB ) )
lResult = .T.
endif
return lResult
// {% MyLoadHRB( "retedb.hrb" ) %}
Error: Undefined function
operation: MYLOADHRB
[ 1] = C retedb.hrb
called from: pcode.hrb, MYLOADHRB, line: 0
called from: ..\source\exec.prg, (b)REPLACEBLOCKS, line: 143
called from: ..\source\exec.prg, REPLACEBLOCKS, line: 143
called from: ..\source\exec.prg, EXECUTE, line: 63
Source:
Function Setting_db()
REQUEST HB_LANG_IT
HB_LANGSELECT("IT")
REQUEST DBFCDX
REQUEST DBFFPT
REQUEST ADS
RddRegister( "ADS", 1 )
RddSetDefault("ADS")
SET SERVER REMOTE
SET FILETYPE TO ADT
SET(_SET_AUTORDER,1)
SET AUTOPEN ON
set(_SET_OPTIMIZE,.T.)
ADSLOCKING(.T.)
SET DATE BRITISH
SET DELETED ON
SET CENTURY ON
Return nil
*****************************************************************************
function SetCookie( cName, cValue, nSecs, cPath, cDomain, lHttps, lOnlyHttp )
local cCookie := ''
hb_default( @cName, '' )
hb_default( @cValue, '' )
hb_default( @nSecs, 86400 )
hb_default( @cPath, '/' )
hb_default( @cDomain , '' )
hb_default( @lHttps, .F. )
hb_default( @lOnlyHttp, .F. )
cCookie += cName + '=' + cValue + ';'
if nSecs # 0
cCookie += 'max-age=' + alltrim(str( nSecs )) + ';'
endif
if !empty(cPath)
cCookie += 'path=' + cPath + ';'
endif
MH_Header( "Set-Cookie", cCookie )
return nil
*********************
function GetCookies()
local hHeadersIn := MH_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
// {% LoadHRB( "retedb.hrb" ) %}
**************************************************************************
Function main()
Setting_db()
SetCookie( 'blu1', "cookie numero 1", 90000 )
Return nil
Errore del server!
Il server ha generato un errore interno e non è in grado di soddisfare la richiesta.
Messaggio di errore:
malformed header from script 'test_cookie.prg': Bad header: Set-Cookie
Se pensi che questo sia un errore del server, per favore contatta il webmaster.
Error 500
localhost
Apache/2.4.39 (Win64) OpenSSL/1.0.2s PHP/7.1.30 mod_fcgid/2.3.9
Function main()
SetCookie( 'blu', "cookienumber1" )
Return nil
function SetCookie( cName, cValue, nSecs, cPath, cDomain, lHttps, lOnlyHttp )
local cCookie := ''
// check parameters
hb_default( @cName, '' )
hb_default( @cValue, '' )
hb_default( @nSecs, 3600 ) // Session will expire in Seconds 60 * 60 = 3600
hb_default( @cPath, '/' )
hb_default( @cDomain , '' )
hb_default( @lHttps, .F. )
hb_default( @lOnlyHttp, .F. )
// we build the cookie
cCookie += cName + '=' + cValue + ';'
cCookie += 'expires=' + CookieExpire( nSecs ) + ';'
cCookie += 'path=' + cPath + ';'
cCookie += 'domain=' + cDomain + ';'
// pending logical values for https y OnlyHttp
// we send the cookie
MH_Header( "Set-Cookie", cCookie )
return nil
//----------------------------------------------------------------//
// CookieExpire( nSecs ) builds the time format for the cookie
// Using this model: 'Sun, 09 Jun 2019 16:14:00'
function CookieExpire( nSecs )
local tNow := hb_datetime()
local tExpire // TimeStampp
local cExpire // TimeStamp to String
hb_default( @nSecs, 60 ) // 60 seconds for this test
tExpire = hb_ntot( ( hb_tton( tNow ) * 86400 - hb_utcoffset() + nSecs ) / 86400 )
cExpire = cdow( tExpire ) + ', '
cExpire += AllTrim( Str( Day( hb_TtoD( tExpire ) ) ) ) + ;
' ' + cMonth( tExpire ) + ' ' + AllTrim( Str( Year( hb_TtoD( tExpire ) ) ) ) + ' '
cExpire += AllTrim( Str( hb_Hour( tExpire ) ) ) + ':' + AllTrim( Str( hb_Minute( tExpire ) ) ) + ;
':' + AllTrim( Str( hb_Sec( tExpire ) ) )
return cExpire
Errore del server!
Il server ha generato un errore interno e non è in grado di soddisfare la richiesta.
Messaggio di errore:
malformed header from script 'test_cookie.prg': Bad header: Set-Cookie
Se pensi che questo sia un errore del server, per favore contatta il webmaster.
Error 500
localhost
Apache/2.4.39 (Win64) OpenSSL/1.0.2s PHP/7.1.30 mod_fcgid/2.3.9
Users browsing this forum: No registered users and 0 guests