• Как сделать ссылками слова в файле?

    memory-s-duo
    @memory-s-duo
    Добрый скрипт всем! Подскажите как из списка сделать ссылки на поиск в соц сетях?
    <?php
    
    //max recent tracks to keep in the recently played tracks history
    $max_recent = 50;
    
    //secret key to access the script
    $key = '998877';
    
    //check access
    if ($_REQUEST['key'] !== $key) {
        ReturnError(400, 'Invalid key');
    }
    
    //retrieve title info
    $title = htmlspecialchars($_REQUEST['casttitle']);
    
    //save current track title and update history
    $file = 'nowplaying_title.txt';
    $recent = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    $recent = array_slice($recent, 0, $max_recent);
    
    $r = fopen($file, 'wb');
    if ($r !== false) {
        //current track
        fwrite($r, $title . "\n");
        //recent tracks
        foreach ($recent as $s) {
            fwrite($r, $s . "\n");
        }
        fclose($r);
    } else {
        ReturnError(500, 'Failed to save track title');
    }
    
    //album cover
    $artwork = isset($_REQUEST['artwork']) && ($_REQUEST['artwork'] !== '') ? $_REQUEST['artwork'] : false;
    if ($artwork !== false) {
        $artwork = base64_decode($artwork);
        $r = fopen('nowplaying_artwork.png', 'wb');
        if ($r !== false) {
            fwrite($r, $artwork);
            fclose($r);
        } else {
            ReturnError(500, 'Failed to save track artwork');
        }
    }
    
    function ReturnError($code, $text) {
        $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0';
        header($protocol . ' ' . $code . ' ' . $text);
        exit();
    }

    У меня просто список без ссылок, как можно переделать ?
    http://trmusicss.ddns.net/playlist это как сейчас.
    Ответ написан
    Комментировать