This article will show how to use snippet to show the visitor username, IP, browser version and show a "hello" sample that come with MosModule install package. Note: See below for the actual code. (1) {mosmodule snippet=216} (2) {mosmodule snippet=220} (3) {mosmodule phpinc=hello.php,firstname,lastname} Explain: (1) This line will run snippet number 216 which shows the visitor username if available and IP. (2) This line will run snippet number 200 which shows the visitor browser version. (3) This line will run "phpinc" command to include the sample "hello" that come with MosModule install package. The "hello.php" is accepting a name and upon submission will show your name that you entered. Here is the running sample at my support site: http://support.ongetc.com/index.php?option=com_content&task=view&id=217&... *** Code *** The snippet 216 code is: global $my; $name = "guest"; if ($my->username) $name=$my->username; echo "Hello ".$name; printf ("
Your IP is %s", $_SERVER['REMOTE_ADDR'] );
The snippet 220 code is: $curos=strtolower($_SERVER['HTTP_USER_AGENT']); if (strstr($curos,"gecko")) { if (strstr($curos,"firefox")) { $browser="Firefox"; } else if (strstr($curos,"netscape")) { $browser="Netscape"; } else { $browser="Mozilla"; } } else if (strstr($curos,"opera")) { $browser="Opera"; } else if (strstr($curos,"msie")) { $browser="Internet Explorer"; } else if (strstr($curos,"voyager")) { $browser="Voyager"; } else { $browser="[?]EgzoticalBrowser"; $browser="DontKnow"; } echo $browser; "hello.php" Direct Access to this location is not allowed.