Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Skypt do zmiany atrybutow
Aragon
post
Post #1





Grupa: Zarejestrowani
Postów: 3
Pomógł: 0
Dołączył: 2.08.2009

Ostrzeżenie: (0%)
-----


witam , mam skrypt żeby zmieniać atrybuty, bo przez total comandera sie nie da :
  1. <?php
  2. $id = $_GET['id'];
  3.  
  4. $_ok='nic nie wybrałeś: ?id=644';
  5. if (isset($id) AND $id!=="" AND is_numeric($id))
  6. {
  7.    $path = '.';
  8.    
  9.    $Dir = opendir ($path);
  10.    $i = 0;
  11.    while ( $file = readdir( $Dir ) )
  12.    {
  13.        //checks that file is an image
  14.        $file_type = strrchr( $file, "." );
  15.        $is_image = eregi( "txt|php|xml",$file_type );
  16.        
  17.        if ( $file != '.' && $file != '..' && $is_image && $file!=='_chmod.php')
  18.        {
  19.            if ($id == 644) {
  20.            
  21.                if(chmod($file, 0644))$_ok ='zapisano uprawnienia: '.$id;
  22.                else $_ok =' nieustawiono uprawnień';
  23.            
  24.                $i++;
  25.                echo "<li>$i. $file = $_ok";
  26.            }
  27.            else if ($id == 666) {
  28.            
  29.                if(chmod($file, 0666))$_ok ='zapisano uprawnienia: '.$id;
  30.                else $_ok =' nieustawiono uprawnień';
  31.            
  32.                $i++;
  33.                echo "<li>$i. $file = $_ok";
  34.            }
  35.        }
  36.    }
  37.    closedir ($Dir);
  38. }    
  39. else echo $_ok;
  40.  
  41. ?>



Ale jest jeden problem, bo ten skypt zmiania tylko pliki php txt, a ja musze zeby folderu zmienilo atrybuty , chodzi mi tylko o folder o nazwie mod_jsn_imageshow_pro , zeby tylko to wykrylo i zmienilo argumenty

tu jest ten skypt na mojej stronie : i jak widac zmiania tylko ten jeden plik :
http://www.iphoneworld.pl/modules/delete.php?id=0666

Bardzo prosze o pomoc bo juz kturac godzine mecze sie nad zmiana atrybutów tego folderu
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Pawel_W
post
Post #2





Grupa: Zarejestrowani
Postów: 1 675
Pomógł: 286
Dołączył: 15.06.2009
Skąd: Wieliczka

Ostrzeżenie: (0%)
-----


  1. <?php
  2. if ($id == 644) {
  3.          
  4.               if(chmod($file, 0644))$_ok ='zapisano uprawnienia: '.$id;
  5.               else $_ok =' nieustawiono uprawnień';
  6.          
  7.               $i++;
  8.               echo "<li>$i. $file = $_ok";
  9.           }
  10.           else if ($id == 666) {
  11.          
  12.               if(chmod($file, 0666))$_ok ='zapisano uprawnienia: '.$id;
  13.               else $_ok =' nieustawiono uprawnień';
  14.          
  15.               $i++;
  16.               echo "<li>$i. $file = $_ok";
  17.           }
  18. ?>

zamien na
  1. <?php
  2. if(chmod($file, 0.$id))$_ok ='zapisano uprawnienia: '.$id;
  3.               else $_ok =' nieustawiono uprawnień';
  4.          
  5.               $i++;
  6.               echo "<li>$i. $file = $_ok";
  7. ?>

będzie krócej, a żeby zmieniało ci chmod folderu to zrób to tak:
  1. <?php
  2. $id = $_GET['id'];
  3.  
  4. $_ok='nic nie wybrałeś: ?id=644';
  5. if (isset($id) AND $id!=="" AND is_numeric($id))
  6. {
  7.   $path = '.';
  8.  
  9.   $Dir = opendir ($path);
  10.   $i = 0;
  11.   while ( $file = readdir( $Dir ) )
  12.   {
  13.       //checks that file is an image
  14.       $file_type = strrchr( $file, "." );
  15.       $is_image = eregi( "txt|php|xml",$file_type );
  16.      
  17.       if ( $file != '.' && $file != '..' && $is_image && $file!=='_chmod.php')
  18.       {
  19.               if(chmod($file, 0.$id))$_ok ='zapisano uprawnienia: '.$id;
  20.               else $_ok =' nieustawiono uprawnień';
  21.          
  22.               $i++;
  23.               echo "<li>$i. $file = $_ok";
  24.       }
  25. else if(filetype($file) == 'dir')
  26. {
  27.               if(chmod($file, 0.$id))$_ok ='zapisano uprawnienia: '.$id;
  28.               else $_ok =' nieustawiono uprawnień';
  29.          
  30.               $i++;
  31.               echo "<li>$i. $file = $_ok";
  32. }
  33.   }
  34.   closedir ($Dir);
  35. }    
  36. else echo $_ok;
  37.  
  38. ?>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 00:48