Jump to content

melchedsik

New Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by melchedsik

  1. Can anyone help? I know the change has to be here but maybe I am doing something wrong......It took me almost a year just to get this far. move_uploaded_file($tmp, 'mp3/' . $filename . '-' . $_SESSION['user_id'] . '.mp3'); Here are the folders inside of the mp3 folder (country, rock, electronic, raggea, world) so when a category selected and the audio(mp3 file) uploads I need for it to go into the selected folder that was selected doing the upload (example: mp3/country/mysong.mp3).
  2. If you're taalking about added the folder names after the mp3/ it didn't work.
  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'; ?>
  4. Hello, i am having problems where on users profiles where they can write a bio about themselves after 60 characters it start running over on my design. How can i from the existing php code below make it where it goes to 50 characters then wraps to the second line the after 50 characters go to third line until 500 word max is reached? Here is a copy of the code: <?php include 'core/init.php'; include 'includes/overall/header.php'; ?> <h1>Users</h1> <?php $users = list_users(4, (isset($_GET['page']) && $_GET['page'] != 0) ? $_GET['page'] : 1); $pages = $users['pages']; unset($users['pages']); foreach($users as $user) { ?> <div class="user"> <a href="profile.php?username=<?php echo $user['username']; ?>"><img src="<?php echo $user['profile']; ?>"></a> <div class="data"> <h2><a href="profile.php?username=<?php echo $user['username']; ?>"><?php echo $user['username']; ?></a> (<?php echo $user['first_name'], ' ', $user['last_name']; ?>)</h2> <p><?php echo $user['email']; ?></p> <p><?php echo (empty($user['bio']) === false) ? substr($user['bio'], 0,60) . '...' : ''; ?></p> </div> <div class="clear"></div> </div> <?php } for($x = 1; $x <= $pages; $x++) { ?> <a href="users.php?page=<?php echo $x; ?>"><?php echo $x; ?></a> <?php } ?> <?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.