Results 1 to 9 of 9

Thread: Can this be done

  1. #1
    Senior Member
    Join Date
    Dec 2001
    Posts
    304

    Can this be done

    I am interested in finding (if anything to find) a script that will make it so I can veiw my weblogs from a browser. I currently can only look at them threw pico using my shell and it is kindof crazy looking. Anyone know of a way to do this
    Violence breeds violence
    we need a world court
    not a republican with his hands covered in oil and military hardware lecturing us on world security!

  2. #2
    Senior Member tampabay420's Avatar
    Join Date
    Aug 2002
    Posts
    953
    ooh, i do this kind of stuff all the time...
    in perl:
    Code:
    print "Content-Type: text/html\n\n";
    
    opendir(DIRECTORY, '.') or die ("Can't open DIRECTORY");
     @DIRSCAN = readdir(DIRECTORY);
    closedir DIRECTORY;
    
    foreach (@DIRSCAN) {
    	if (/.htm/) { print "<a href=$_>$_</a>
    ";}
    	if (/.txt/) { print "<a href=$_>$_</a>
    ";}
    	if (/.php/) { print "<a href=$_>$_</a>
    ";}
    	if (/.pl/) { print "<a href=$_>$_</a>
    ";}
    	if (/.etc/) { print "<a href=$_>$_</a>
    ";}
    }
    h4h4h4- that only took 2 minutes

    i don't know if this is what you want? maybe i can still help?
    yeah, I\'m gonna need that by friday...

  3. #3
    Senior Member
    Join Date
    Dec 2001
    Posts
    304
    Thank you.. I will try that for now. I just re read my post though and see where i messed up. What I meant to say was a php script that does this.... But if none this perl script will due just fine
    Violence breeds violence
    we need a world court
    not a republican with his hands covered in oil and military hardware lecturing us on world security!

  4. #4
    Senior Member
    Join Date
    Mar 2002
    Posts
    502

    Re: Can this be done

    Originally posted here by Euclid
    I am interested in finding (if anything to find) a script that will make it so I can veiw my weblogs from a browser. I currently can only look at them threw pico using my shell and it is kindof crazy looking. Anyone know of a way to do this
    PHP Code:
    <html>
    <body>
    <?php

    $dir 
    = @opendir(".");
    $extention_array = array(
        
    ".txt$",
        
    ".log$",
        
    ".etc$"
    );
    $while$file = @readdir($dir) )
    {
        if( 
    ereg($extention_array$file) )
        {
            echo(
    '[url="'.$file.'"]'.$file.'[/url]
    '
    );
        }
    }
    @
    closedir($dir);

    ?>
    </body>
    </html>
    Check out www.hotscripts.com or www.sf.net for more detailed, bigger, scripts.
    Bleh.

  5. #5
    Senior Member tampabay420's Avatar
    Join Date
    Aug 2002
    Posts
    953
    Parse error: parse error, unexpected '{' in C:\...\dir.php on line 12
    Am i doing something wrong?
    yeah, I\'m gonna need that by friday...

  6. #6
    Senior Member
    Join Date
    Oct 2002
    Posts
    181
    by the looks of it you have an extra { somwhere in your code

    SittingDuck
    I\'m a SittingDuck, but the question is \"Is your web app a Sitting Duck?\"

  7. #7
    Senior Member
    Join Date
    Mar 2002
    Posts
    502
    wooops, sorry bout that. one dollar sign to much.
    PHP Code:
    <?php
    <html>
    <
    body>
    <?
    php

    $dir 
    = @opendir(".");
    $extention_array = array(
        
    ".txt$",
        
    ".log$",
        
    ".etc$"
    );
    while( 
    $file = @readdir($dir) )
    {
        if( 
    ereg($extention_array$file) )
        {
            echo(
    '[url="'.$file.'"]'.$file.'[/url]
    '
    );
        }
    }
    @
    closedir($dir);

    ?>
    </body>
    </html>
    Bleh.

  8. #8
    Junior Member
    Join Date
    Aug 2001
    Posts
    29
    <?php

    $dir = @opendir(".");
    $extention_array = array(
    ".txt$",
    ".log$",
    ".etc$"
    );
    while( $file = @readdir($dir) )
    {
    if( ereg($extention_array, $file) )
    {
    echo(''.$file.'
    ');
    }
    }
    @closedir($dir);

    ?>


    What excatly should this do, i only get a white page
    Am i doing something wrong ?

  9. #9
    Senior Member
    Join Date
    Mar 2002
    Posts
    502
    Plant this script in your log directory.

    Or, if you have it in another directory, then change the
    PHP Code:
    $dir = @opendir("."); 
    to
    PHP Code:
    $dir = @opendir("your_log_dir/somewhere_deeper/right_over_here/"); 
    Bleh.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •