Jump to content

Search the Community

Showing results for tags 'mp3'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 3 results

  1. Hi in my code below, echo $body; outputs the link to every song in my $SongsFolder. How can I make it echo only one link and that link is the song the $Shuffle chose? I know I have array but is there a way to get around it? Anything I should change up? <?php function fooFucker($url) { $a = join('/', array_map('urlencode', explode('/', $url))); return str_replace('+', '%20', $a); } $SongsFolder = "songs"; header("Content-Type: audio/x-mpegurl"); $body = ''; $Songs = glob($SongsFolder."/*.mp3"); shuffle($Songs); $first = 0; foreach($Songs as $Song) { $SongPath = pathinfo($Song); if ($first != 0) { $body .= "\n"; } $first = 1; $body .= "http://".$_SERVER['HTTP_HOST'].fooFucker(dirname($_SERVER['PHP_SELF']))."/".fooFucker($SongsFolder)."/".fooFucker($SongPath['basename']); } header('Content-Length: ' . strlen($body)); echo $body; ?>
  2. Hi I have this code below. What I'm trying to do below is access .mp3 songs that are in my folder called "songs" When I do this code it doesn't show anything for the Artist, Title or anything anymore. Why is that? <?php require_once('/home/manveers94/public_html/getID3-1.9.7/getid3/getid3.php'); $getID3 = new getID3; $SongsFolder = "songs"; $file = glob($SongsFolder."/*.mp3"); // $file = 'Song.mp3' set_time_limit(30); $ThisFileInfo = $getID3->analyze($file); getid3_lib::CopyTagsToComments($ThisFileInfo); echo 'File name: '.$ThisFileInfo['filenamepath'].'<br>'; echo 'Artist: '.(!empty($ThisFileInfo['comments_html']['artist']) ? implode('<BR>', $ThisFileInfo['comments_html']['artist']) : ' ').'<br>'; echo 'Title: '.(!empty($ThisFileInfo['comments_html']['title']) ? implode('<BR>', $ThisFileInfo['comments_html']['title']) : ' ').'<br>'; echo 'Bitrate: '.(!empty($ThisFileInfo['audio']['bitrate']) ? round($ThisFileInfo['audio']['bitrate'] / 1000).' kbps' : ' ').'<br>'; echo 'Play time: '.(!empty($ThisFileInfo['playtime_string']) ? $ThisFileInfo['playtime_string'] : ' ').'<br>'; ?>
  3. I have two php files one with audio categories that allow a music selection when uploading MP3 and the other code is the audio file. I have it when MP3 files are uploaded it goes into a MP3 folder. I have other folders inside the MP3 folder which are the names of the category list (example: country folder, rock folder, etc) how can I get the MP3 files not to just go into the MP3 folder but when they are uploaded and a category selection is made it goes into that direct folder. Below are the codes: Audiocat code: <?php include 'core/init.php'; include 'includes/overall/header.php'; if (isset($_GET['cat']) === true) { $cat = $_GET['cat']; $audios = all_audio($cat); } else { header('Location: /'); exit(); } ?> <h1>Audio</h1> <p>Viewing category <strong><?php echo audio_category_name_from_id($cat); ?></strong></p> <?php if (empty($audios) === true) { ?> Sorry, there are no audio files in this category <?php } else { foreach($audios as $audio) { ?> <a href="listen.php?a=<?php echo $audio['audio_id']; ?>"><?php echo $audio['audio_file']; ?></a><br> <?php } } ?> <?php include 'includes/overall/footer.php'; ?> Audio code: <?php include 'core/init.php'; protect_page(); include 'includes/overall/header.php'; if (isset($_GET['delete']) === true) { $delete = $_GET['delete']; user_delete_audio($delete); header('Location: audio.php'); } ?> <h1>Your audio</h1> <p>Users can listen to your audio on your profile page</p> <?php if (empty($_FILES) === false && isset($_POST['cat']) === true) { $allowed = array('mp3'); $filename = $_FILES['audio_file']['name']; $fileext = strtolower(end(explode('.', $filename))); $tmp = $_FILES['audio_file']['tmp_name']; $cat = $_POST['cat']; if (in_array($fileext, $allowed) === false) { ?> <p><strong>Sorry, only mp3 files are allowed to be uploaded</strong></p> <?php } else if (user_audio_count($_SESSION['user_id']) >= 5) { ?> <p><strong>Maximum 5 files allowed, sorry.</strong></p> <?php } else { if (cat_exists($cat) === false) { ?> <p><strong>Something went really wrong here, sorry.</strong></p> <?php } else { user_add_audio($filename . '-' . $_SESSION['user_id'], $cat); move_uploaded_file($tmp, 'mp3/' . $filename . '-' . $_SESSION['user_id'] . '.mp3'); header('Location: audio.php'); } } } ?> <form action="" method="post" enctype="multipart/form-data"> <p> Add audio: <input type="file" name="audio_file"> <select name="cat"> <?php foreach(list_categories() as $cat) { ?> <option value="<?php echo $cat['cat_id']; ?>"><?php echo $cat['category']; ?></option> <?php } ?> </select> <input type="submit" value="Upload"> </p> </form> <?php $audios = user_audio($_SESSION['user_id']); if (empty($audios) === true) { ?> <p>You haven't added any audio files yet.</p> <?php } else { foreach($audios as $audio) { ?> <a href="listen.php?a=<?php echo $audio['audio_id']; ?>"><?php echo $audio['audio_file']; ?></a> in <?php echo audio_category_name_from_id($audio['cat_id']); ?> (<a href="audio.php?delete=<?php echo $audio['audio_id']; ?>">Delete</a>)<br> <?php } } include 'includes/overall/footer.php'; ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.