Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. Here's the code that I was playing with function getPlayLength($mp3file) { $filesize = filesize($mp3file); return 0; } function getMusicGenre($genreId, $default = null) { static $genres = array( 'Blues', 'Classic Rock', 'Country', 'Dance', 'Disco', 'Funk', 'Grunge', 'Hip-Hop', 'Jazz', 'Metal', 'New Age', 'Oldies', 'Other', 'Pop', 'R&B', 'Rap', 'Reggae', 'Rock', 'Techno', 'Industrial', 'Alternative', 'Ska', 'Death Metal', 'Pranks', 'Soundtrack', 'Euro-Techno', 'Ambient', 'Trip-Hop', 'Vocal', 'Jazz+Funk', 'Fusion', 'Trance', 'Classical', 'Instrumental', 'Acid', 'House', 'Game', 'Sound Clip', 'Gospel', 'Noise', 'AlternRock', 'Bass', 'Soul', 'Punk', 'Space', 'Meditative', 'Instrumental Pop', 'Instrumental Rock', 'Ethnic', 'Gothic', 'Darkwave', 'Techno-Industrial', 'Electronic', 'Pop-Folk', 'Eurodance', 'Dream', 'Southern Rock', 'Comedy', 'Cult', 'Gangsta', 'Top 40', 'Christian Rap', 'Pop/Funk', 'Jungle', 'Native American', 'Cabaret', 'New Wave', 'Psychadelic', 'Rave', 'Showtunes', 'Trailer', 'Lo-Fi', 'Tribal', 'Acid Punk', 'Acid Jazz', 'Polka', 'Retro', 'Musical', 'Rock & Roll', 'Hard Rock', 'Folk', 'Folk-Rock', 'National Folk', 'Swing', 'Fast Fusion', 'Bebob', 'Latin', 'Revival', 'Celtic', 'Bluegrass', 'Avantgarde', 'Gothic Rock', 'Progressive Rock', 'Psychedelic Rock', 'Symphonic Rock', 'Slow Rock', 'Big Band', 'Chorus', 'Easy Listening', 'Acoustic', 'Humour', 'Speech', 'Chanson', 'Opera', 'Chamber Music', 'Sonata', 'Symphony', 'Booty Bass', 'Primus', 'Porn Groove', 'Satire', 'Slow Jam', 'Club', 'Tango', 'Samba', 'Folklore', 'Ballad', 'Power Ballad', 'Rhythmic Soul', 'Freestyle', 'Duet', 'Punk Rock', 'Drum Solo', 'Acapella', 'Euro-House', 'Dance Hall' ); return isset($genres[$genreId]) ? $genres[$genreId] : $default; } function getId3Tag($mp3file) { $data = array(); if ($fh = fopen($mp3file, 'r')) { fseek($fh, -128, SEEK_END); $tag = fread($fh, 3); if ('TAG' === $tag) { $data['song'] = trim(fread($fh, 30)); $data['artist'] = trim(fread($fh, 30)); $data['album'] = trim(fread($fh, 30)); $data['year'] = trim(fread($fh, 4)); $data['comment'] = trim(fread($fh, 30)); //$data['length'] = getPlayLength($mp3file); $data['genre'] = getMusicGenre(ord(fread($fh, 1))); } } return $data; } function getMusicFiles($directory) { $mp3files = array(); if (!is_dir($directory) || !is_readable($directory)) return $mp3files; $files = scandir($directory); foreach ($files as $file) { if ('.' === $file[0] || !preg_match('/\.(mp3|mp4|org|wav|wma)$/', $file)) continue; $fullpath = implode(DIRECTORY_SEPARATOR, array($directory, $file)); if (is_dir($fullpath)) { $mp3files = array_merge($mp3files, call_user_func(__FUNCTION__, $fullpath)); } else { $mp3files[] = $fullpath; } } return $mp3files; }
  2. http://www.phpfreaks.com/forums/index.php/topic,265910.msg1256286.html#msg1256286
  3. CREATE TABLE concerts ( concerts_tickets_on_sale INTEGER, ); Are there tickets available? SELECT * FROM concerts WHERE concerts_id = $id AND concerts_tickets_on_sale > 0 Once a ticket is sold for a concert: LOCK TABLES concerts WRITE; UPDATE concerts SET concerts_tickets_on_sale = concerts_tickets_on_sale - 1 WHERE concerts_id = $id; UNLOCK TABLES;
  4. Who says a framework is secure? Plain PHP can be written as secure as a PHP framework can. The only difference is the implementation and the (recurring) work involved.
  5. Yes it will return the full path to the file but you won't be able to use this with JavaScript.
  6. print "<option value=\"".$rs_skill["id"]."\"".isset($_POST['skill']) && in_array($rs_skill['id'], $_POST['skill']) ? ' selected="selected"' : ''.">".ucwords($rs_skill["skill"])."</option>";
  7. If someone knows Cake and you are looking for Drupal developers then it's pretty obvious that he ain't the guy you are looking for. Altough it's nice to have a cook around =) To tell if something is wether or not top-notch code is difficult altough their are some indicators wether or not the programmer knew what he was doing. To make sure the programmer knew what he was doing go over the code he wrote and discuss it, preferably by someone who has proven experience in programming applications. Afterwards the interrogating programmer will get a general idea of the assumptions the programmer did or did not make, he'll also get an in-depth view in the thinking logic of the programmer and can associate that with the thinking logic and best practices generally applied in the company. Afterwards you select the programmers whose thinking logic and best practices used best applies to those used in the company.
  8. I think this could work. UPDATE table SET field = CONCAT(field, $data) WHERE id = $id
  9. switch ($alchemy_key) { case 'somekey': $toon_array[$counter]->alchemy = $data; break; }
  10. eval
  11. $usenet = @fsockopen($cfgServer, $cfgPort, &$errno, &$errstr, $cfgTimeOut); Should be: $errno = 0; $errstr = ''; $usenet = @fsockopen($cfgServer, $cfgPort, &$errno, &$errstr, $cfgTimeOut); Change: echo "Connection failed\n"; To: echo $errno, ': ', $errstr;
  12. Post your code.
  13. Wrong section.
  14. No matter how you play it out: straight PHP or a PHP framework. You will - in the end - always be using some sort of framework wether it's third-party or your collection of library files created throughout the development of the application.
  15. I have no experience with vbulletin myself but wouldn't it allow you to specify the cookie domain? So at the first website you leave the domain as is and on the other website you specify the domain as those found on your first website. If you already tried that then it probably doesn't work this way and I'm not sure there are other possibilities.
  16. $parts = explode("/", dirname(__FILE__)); unSet($parts[(count($parts) - 1)]); $myFile = implode("/", $parts) . '/images/upload/profiles/' . $row['id'] . '/profilepicture.jpg'; Is then the same as: $myFile = '../images/upload/profiles/' . $row['id'] . '/profilepicture.jpg';
  17. That is what this is for: You will need to modify the query though as you need to count() only a sub-section of the table (those who's foreign key matches the primary key of your other table) SELECT SQL_CALC_FOUND_ROWS, .. FROM table1 JOIN table2 ON table1.pk = table2.fk Afterwards retrieve the found rows: SELECT found_rows() found_rows
  18. Please post your code of both pages or atleast the relevant code.
  19. If you want to broadcast you need a live streaming server. listen2radio uses this method too unless they just refer to some radio station. Plus if you start streaming music don't forget their are some legal fees you need to pay and these are in accordance to your listeners.
  20. Can't be the same error I used a different function. And yes it's a quote but I fixed the code inside it.
  21. Have you used session_start(); on both pages?
  22. $directoryPath = 'path/to/directory'; $files = scandir($directoryPath); $newest = 0; $newestImage = ''; foreach ($files as $file) { if ('.' === $file[0] || !preg_match_all('/\.(jpe?g|png|gif)$/', $file)) continue; $fullPath = implode(DIRECTORY_SEPARATOR, array($directoryPath, $file)); if (($ctime = filectime($fullPath)) > $newest) { $newest = $ctime; $newestImage = $fullPath; } } This gives you the time the $newest image was entered and the full path to the image in $newestImage.
×
×
  • 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.