Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] wywalanie katalogów z serwera
byczek
post
Post #1





Grupa: Zarejestrowani
Postów: 58
Pomógł: 0
Dołączył: 23.02.2004

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


Witam mam taki oto kod do usówania userów z bazy ale problem w tym ze na serwerze zostaje katalog usera .Katalog nosi nazwe tak jak login danego usera co dopisac do tego kawałka tak aby i katalog poleciał (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

oto moj kod

  1. <?php
  2. function usun_usera($id) {
  3. $r = mysql_fetch_assoc( mysql_query("SELECT login FROM owners WHERE id='{$id}'") );
  4. $login = $r['login'];
  5. @mysql_query("DELETE FROM owners WHERE id='{$id}'");
  6. if( file_exists('users/'.$login.'/') ) {
  7.  @unlink('users/'.$login.'/');
  8.  @exec('rm -rf /users/'.$login.'/');
  9.  
  10. }
  11. $this->_usun_users_form();
  12.  }
  13.  }
  14. ?>


Aha dodam ze na serwerze jest katalog danego usera a w nim są jeszcze dwa katalogi i kilka plików (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
byczek
post
Post #2





Grupa: Zarejestrowani
Postów: 58
Pomógł: 0
Dołączył: 23.02.2004

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


Coś nie tak (IMG:http://forum.php.pl/style_emoticons/default/sad.gif) wywala bład (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

Fatal error: Call to undefined function: deletefromdirectory() in /home/KONTA/WWW/HOME/b/bambolo/_public_html/cmsek_include.php on line 401


Pomocy (IMG:http://forum.php.pl/style_emoticons/default/sad.gif) tu 56 to linia 401 (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

  1. <?php
  2. function DeleteFromDirectory ( $Dir )
  3. {
  4. if ( is_dir( $Dir ) ) {
  5. $items = scandir( $Dir );
  6.  
  7. if ( !empty( $items ) ) {
  8. foreach( $items as $file ) {
  9. if ( !is_dir( $Dir . '/' . $file ) && is_file( $Dir . '/' . $file ) ) {
  10. unlink( $Dir . '/' . $file );
  11. } 
  12. if ( is_dir( $Dir . '/' . $file ) && !is_file( $Dir . '/' . $file ) ) {
  13. DeleteFromDirectory ( $Dir . '/' . $file );
  14. } 
  15. } 
  16. } 
  17. rmdir( $Dir );
  18. } 
  19. } 
  20.  
  21. function _usun_users_form()
  22. {
  23. $r = mysql_fetch_assoc( mysql_query( "SELECT COUNT(*) AS ile FROM owners" ) );
  24. $ilosc = $r['ile'];
  25. $start = ( int )$_GET['p'];
  26. $start *= 70;
  27. $q = mysql_query( "SELECT * FROM owners ORDER BY owner,login ASC LIMIT $start,70" );
  28. echo '<table width="400">';
  29. while ( ( $r = mysql_fetch_assoc( $q ) ) != false ) {
  30. if ( is_array( $r ) ) {
  31. extract( $r );
  32. } 
  33. echo '
  34.  <tr>
  35. <td>' . $login . '</td>
  36. <td>' . ( $owner?'tak':'nie' ) . '</td>
  37. <td><a href="index.php?cmd=usun_usera&id=' . $id . '">usuń</a></td>
  38.  </tr>
  39.  ';
  40. } 
  41. echo '<tr><td colspan="3">Strona: ';
  42. for( $i = 1; $i < ( $ilosc / 70 ); $i++ ) {
  43. echo '
  44.  <a href="?k=usun_users&p=' . $i . '">' . $i . '</a>
  45. ';
  46. } 
  47. echo '</td></tr>';
  48. echo '</table>';
  49. } 
  50.  
  51. function usun_usera( $id )
  52. {
  53. $r = mysql_fetch_assoc( mysql_query( "SELECT login FROM owners WHERE id='{$id}'" ) );
  54. $login = $r['login'];
  55. @mysql_query( "DELETE FROM owners WHERE id='{$id}'" );
  56.  DeleteFromDirectory ( 'users/' . $login );
  57. $this->_usun_users_form();
  58. } 
  59.  }
  60. ?>


A tak wywglada to na serwerze

(IMG:http://yny.pl//thumbs/78400.jpg)

Nikt nie pomoze (IMG:http://forum.php.pl/style_emoticons/default/sad.gif) pliss (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) sam raczej nie dam rady (IMG:http://forum.php.pl/style_emoticons/default/sad.gif)

Ten post edytował byczek 9.06.2007, 09:58:29
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: 4.10.2025 - 08:44