Toggle menu
862
3.8K
30.2K
279.1K
Catglobe Wiki
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

GetServerVariable: Difference between revisions

From Catglobe Wiki
Cg_pham (talk | contribs)
No edit summary
Cg van (talk | contribs)
No edit summary
 
Line 1: Line 1:
[[Category:Network_Functions]]
{{HelpFiles}}  
{{HelpFiles}}
 
==== getServerVariable ====
 
Returns the string corresponding to the requested serverVariable.
 
'''Syntax'''
 
getServerVariable(''serverVariable'')
 
'''Arguments'''
 
''serverVariable'': a number expression. It must be one of 3 pre-defined constants:
 
*HTTP_REFERER: Returns a string containing the URL of the page that referred the request to the current page using an <a> tag. If the page is redirected, HTTP_REFERER is empty
*HTTP_USER_AGENT: Returns a string describing the browser that sent the request.
*REMOTE_ADDR: Returns the IP address of the remote host making the request (reference: http://www.w3schools.com/asp/coll_servervariables.asp)
 
'''Return type'''
 
string
 
'''Examples'''
 
''string a = getServerVariable(HTTP_REFERER);''
 
''print(a); ''
 
''//Returns the URL of the page that referred the request to the current page''


====getServerVariable====
''//Result: http://[sitename].catglobe.com/DataModule/DataCache/CGScriptPromptPage.aspx?type=DataCacheSpecification&id=[id]''


Returns the string corresponding to the requested serverVariable.
''//------------------------------''


'''Syntax'''
''string b = getServerVariable(HTTP_USER_AGENT);''


getServerVariable(''serverVariable'')
''print(b); ''


'''Arguments'''
''//Returns a string describing the browser that you're using to run script ''


''serverVariable'': a number expression. It must be one of 3 pre-defined constants:
''//Result: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3)''


* HTTP_REFERER: Returns a string containing the URL of the page that referred the request to the current page using an <a> tag. If the page is redirected, HTTP_REFERER is empty
''//------------------------------''
* HTTP_USER_AGENT: Returns a string describing the browser that sent the request.
* REMOTE_ADDR: Returns the IP address of the remote host making the request (reference: http://www.w3schools.com/asp/coll_servervariables.asp)


'''Return type'''
''string c = getServerVariable(REMOTE_ADDR);''


string
''print(c); ''


'''Examples'''
''//Returns your computer's IP (e.g: 192.168.1.10)''


getServerVariable(HTTP_REFERER);
'''Availability'''


'''Availability'''
Version 5.3 __NOTOC__ <!-- imported from file: 3243.htm-->


Version 5.3
[[Category:Network_Functions]]
__NOTOC__
<!-- imported from file: 3243.htm-->

Latest revision as of 08:34, 22 December 2011



getServerVariable

Returns the string corresponding to the requested serverVariable.

Syntax

getServerVariable(serverVariable)

Arguments

serverVariable: a number expression. It must be one of 3 pre-defined constants:

  • HTTP_REFERER: Returns a string containing the URL of the page that referred the request to the current page using an <a> tag. If the page is redirected, HTTP_REFERER is empty
  • HTTP_USER_AGENT: Returns a string describing the browser that sent the request.
  • REMOTE_ADDR: Returns the IP address of the remote host making the request (reference: http://www.w3schools.com/asp/coll_servervariables.asp)

Return type

string

Examples

string a = getServerVariable(HTTP_REFERER);

print(a);

//Returns the URL of the page that referred the request to the current page

//Result: http://[sitename].catglobe.com/DataModule/DataCache/CGScriptPromptPage.aspx?type=DataCacheSpecification&id=[id]

//------------------------------

string b = getServerVariable(HTTP_USER_AGENT);

print(b);

//Returns a string describing the browser that you're using to run script

//Result: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3)

//------------------------------

string c = getServerVariable(REMOTE_ADDR);

print(c);

//Returns your computer's IP (e.g: 192.168.1.10)

Availability

Version 5.3