PHP: Object to URL Data

June 3rd, 2008 · No Comments

This is a simple, but very handy function when working with PHP and Flash.  This will turn an object into a string of URL data – this is very helpful converting a mySQL object from mysql_fetch_object to Flash variables.

function object2URLData($obj)

{

     $data = "";

     foreach($obj as $key=>$prop)

     {

          if($data != [...]

[Read more →]

Tags: Flash · PHP

PHP: Get IP/Host and Proxy Information

April 12th, 2008 · 4 Comments

Below is a method I use to detect the IP Address and Host Name as well as Proxy Information of a visitors.

if ($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"] != ""){

     // for proxy

     $IP = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"];

     $proxy = $HTTP_SERVER_VARS["REMOTE_ADDR"];

     $host = @gethostbyaddr($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]);

}else{

     // for normal user

     $IP = $HTTP_SERVER_VARS["REMOTE_ADDR"];

     $host = @gethostbyaddr($HTTP_SERVER_VARS["REMOTE_ADDR"]);

}

[Read more →]

Tags: PHP

PHP Function: URLDecode All Properties of an Object

April 12th, 2008 · No Comments

I haven’t had a whole lot to blog about lately as I have been stuck doing some Java work that won’t ever really see the light of day (as far as the to the public), so I decided to start posting some of my commonly used PHP functions. I use this function urldecodeObject() along [...]

[Read more →]

Tags: PHP