Results 1 to 6 of 6
  1. #1

    modify all the index.html in one server

    i'm looking about one script who put an additional line in all the accounts i host but i have no idea of programming shell, what i'm looking it's

    1. start on /home
    2. enter to all the directories for example /home/user1/www /home/user2/www
    3. open the index.html and put my text on it and save

    anyone did it before? anyone know any script who do that? thanks. honest european provider

  2. #2
    That's not hard to do

    function treatDir($dir)
    if (!file_exists($dir.'/index.html'))

    /* I assume you want to add a line at the end of index.html */
    $f = fopen($dir.'/index.html', 'a');
    fwrite($f, "\nYour text here\n");

    function recurseOn($dir)
    $h = opendir($dir);
    while(($file = readdir($h)) !== false)
    if($file == '.' || $file == '..')
    $file = $dir . '/' . $file;

  3. #3
    I forgot to say two things:
    1) it's not tested
    2) call recurseOn('/home') to change all the index.html contained in a subdirectory of /home

  4. #4
    yes, i get that errors;

    ./dale: line 1: syntax error near unexpected token `$dir'
    ./dale: line 1: `function treatDir($dir)' honest european provider

  5. #5
    Join Date
    Apr 2004
    Fullerton, CA
    First off, figure out where your php cli is by typing 'which php' in shell, most likeley it'll be #!/usr/local/bin/php. Although check and make sure... then just append that line to dale. Or you could just run it by typing "php dale" if php is in the local env too.

  6. #6
    thanks for the info, but i'm going to try with mod_layout that seems more easy to do, i tell you if finally works, thanks. honest european provider

Posting Permissions

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