ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
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; }
-
PHP to read directory & Import ID3 tags to MySQL DB
ignace replied to grunshaw's topic in PHP Coding Help
http://www.phpfreaks.com/forums/index.php/topic,265910.msg1256286.html#msg1256286 -
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;
-
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.
-
Yes it will return the full path to the file but you won't be able to use this with JavaScript.
-
print "<option value=\"".$rs_skill["id"]."\"".isset($_POST['skill']) && in_array($rs_skill['id'], $_POST['skill']) ? ' selected="selected"' : ''.">".ucwords($rs_skill["skill"])."</option>";
-
Need Advanced Cake PHP Coders to review this code
ignace replied to ep2002's topic in PHP Coding Help
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. -
I think this could work. UPDATE table SET field = CONCAT(field, $data) WHERE id = $id
-
switch ($alchemy_key) { case 'somekey': $toon_array[$counter]->alchemy = $data; break; }
-
$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;
-
Post your code.
-
Want to create a search engine via criteria/check boxes.
ignace replied to kenetik's topic in Application Design
Wrong section. -
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.
-
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.
-
Checking to see if a string is only zen-kaku characters
ignace replied to paullb's topic in PHP Coding Help
Thx -
check if file exists and if it does delete it
ignace replied to dachshund's topic in PHP Coding Help
$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'; -
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
-
Session returns different variables with same SID
ignace replied to phpshift's topic in PHP Coding Help
Please post your code of both pages or atleast the relevant code. -
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.
-
Can't be the same error I used a different function. And yes it's a quote but I fixed the code inside it.
-
Session returns different variables with same SID
ignace replied to phpshift's topic in PHP Coding Help
Have you used session_start(); on both pages? -
Fixed it.
-
$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.