PHP Programs and Functions

go back


    function listdir($dir='.') {
        if (!is_dir($dir)) {
            return false;

        $files = array();
        listdiraux($dir, $files);

        return $files;

    function listdiraux($dir, & $files) {
        $handle = opendir($dir);
            $filepath = $dir == '.' ? $file : $dir . '/' . $file;
            if (is_link($filepath))
            if (is_file($filepath))
                $files[] = $filepath;
            else if (is_dir($filepath))
                listdiraux($filepath, $files);

    $files = listdir('.');
    // sort files by last modified date

    $lastMod = date('F d, Y h:i A T', filemtime($files[0]));

February 21, 2018 11:27 AM CST


      $ip = $_SERVER['HTTP_CLIENT_IP'];
    } else {
      $ip = $_SERVER['REMOTE_ADDR'];

    echo $ip .'<BR>';

    $query = @unserialize(file_get_contents(''.$ip));
    if($query && $query['status'] == 'success') {

      echo 'Your current location is ' . $query['city'] .', '.$query['region'].' '.$query['zip'] . '<BR>';
      echo 'Your Coordinates are ' . $query['lat'] . ', ' . $query['lon'] . '<BR>';
      echo 'Your service provider is ' . $query['isp'];

Your current location is Ashburn, VA 20149
Your Coordinates are 39.043800354004, -77.487396240234
Your service provider is, Inc.