Webmaster общности: Predpriemach.com | SearchEngines.bg

    Извеждане и триене на файлове от папка

    Ето тук ще ви покажа как лесно можете да извеждате и да триете файлове от избрана папка Cool

    Ще ви трябват 3 файла – del.php ; ~del.php ; style.css (малко стил от моето въображение Laughing )

    Ето го del.php:

    <html>
    <head>
    <title>:: Delete ScripT By Dido_net & Web-tourist.net ::</title>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
    <link rel="stylesheet" href="style.css" type="text/css" />
    </head>
    
    <body bgcolor="#999999">
    
    <?php
    $directory = opendir('вашета директория/');
    while ($files = readdir($directory))
    {
    $file_array[] = $files;
    }
    foreach ($file_array as $files)
    {
    echo "";
    if($files == ".." || $files == ".")
    {
    continue;
    }
    echo "<table border=0><tr><td width=\"600\" style=\"border:solid 1px #9cff00\">";
    echo "<a href=\"http://адрес.com/вашета директория/$files\" target=\"_blank\">$files</a> ";
    echo "</td><td style=\"border:solid 1px #9cff00\">";
    echo "<a href=\"~del.php?target=$files\">X</a>";
    echo "</td></tr></table>";
    $file = "./".$files;
    
    echo "<td width='10%'>";
    echo "</td></tr>";
    }
    ?>
    <br /><font color=gray> By Dido_net & web-tourist.net </font>
    </body>
    </html>

    Ето го и ~del.php:

    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
    <link rel="stylesheet" href="style.css" type="text/css" />
    
    <?php
    $_GET['target'] = preg_replace('#(\\\|/)#', '', $_GET['target']);
    $del=$_GET['target'];
    if (eregi('/',$del)||$del='')
    {exit;}
    
    $filelocation="вашета директория/".$_GET['target'];
    if (!unlink ($filelocation)) {
    echo "Файлът не може да бъде изтрит!";
    }
    else {
    echo "Файлът бе изтрит успешно";
    exit;
    }
    ?>

    И style.css :

    body,td {
    background-color: #999999;
    font-family: Arial;
    font-size: 10px;
    color: #000000;
    }
    
    
    a {
    text-decoration: none;color: #cccccc
    }
    a:hover {
    text-decoration: none;color: #000000
    }

    Е, мисля че скрипта ще ви е полезен

    Оставете коментар