\n"; exit; } mysql_select_db($apidb_db); return $dbcon; } function closedb() { global $dbcon, $dbref; if(--$dbref) return; mysql_close($dbcon); } function querydb($query) { $result = mysql_query($query); if(!$result) { echo "
$query

\n"; echo "A QUERY error occurred: ". "".mysql_error()."

\n"; } return $result; } function mysql_field_is_null($result, $row, $field) { if(mysql_result($result, $row, $field) == null) return 1; return 0; } function read_string($filename) { return join("", file($filename)); } function build_urlarg($vars) { $arr = array(); while(list($key, $val) = each($vars)) { if(is_array($val)) { while(list($idx, $value) = each($val)) { //echo "Encoding $key / $value
"; $arr[] = rawurlencode($key."[]")."=".rawurlencode($value); } } else $arr[] = $key."=".rawurlencode($val); } return implode("&", $arr); } function add_option_menu($options, $label, $id) { echo "

\n"; echo "\n"; echo "\n"; echo "

\n"; } /* * return all keys of a mapping as an array */ function keys($arr) { $res = array(); while(list($k, $v) = each($arr)) $res[] = $k; return $res; } /* * return all values of a mapping as an array */ function values($arr) { $res = array(); while(list($k, $v) = each($arr)) $res[] = $v; return $res; } /* * format date */ function makedate($time) { return date("F d, Y H:i:s", $time); } function get_remote() { global $REMOTE_HOST, $REMOTE_ADDR; if($REMOTE_HOST) $ip = $REMOTE_HOST; else $ip = $REMOTE_ADDR; return $ip; } function htmlify_urls($text) { //FIXME: wonder what the syntax is, this doesn't seem to work // $text = strip_tags($text, ",,,