I can't explain why addslashes() didn't work (incorrect placement in the script,
perhaps), but take a look at htmlspecialchars() and htmlentities().  They're
long shots, but they might help.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


----- Original Message -----
From: "Ole Hornauer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, 08 June, 2003 13:14
Subject: [PHP-DB] special character in filename


hi,

since i got my mp3 code somewhat working (was my fault, sorry guys), i
encountered another problem that i simply cant solve on my own.
im scanning mp3 files in a directory to put the data into a mysql
database.
everything works fine except that those files that have inverted commas
(maybe also other special characters?) as part of the filename are being
ignored by the script. i tried to use addslashes() but that didn't help
either. i included a test (echo $dir.$file) to see what exactly would be
inside the variables. but it looked ok.
could anybody give me a hint? i just dont get it.

here is my code. i included mphp3.php from http://res.crea-bmb.de/mphp3/
to scan for mp3 tags:

<?
include("mphp3.php");

mysql_connect("192.168.100.12","user","password") or die ("Keine
Verbindung moeglich");
mysql_select_db("mp3") or die ("Die Datenbank existiert nicht");

scan_dir("mp3/");
echo "Fertig";

function scan_dir($dir)
{
    $handle = @opendir($dir);
    while ($file = @readdir ($handle))
    {
        if (eregi("^\.{1,2}$",$file))
        {
            continue;
        }

        if(is_dir($dir.$file))
        {
             scan_dir($dir.$file."/");
        }
        else
        {
            $info = New mphp3(2);
     echo $dir.$file;
            $info->load($dir.$file);
            $abfrage ="insert into mp3 (
                              file,
                              path,
                              artist,
                              title,
                              album)
            values (
                     '$file',
                     '$dir',
                     '$info->v2_artist',
                     '$info->v2_title',
                     '$info->v2_album');";
            mysql_query($abfrage);
        }
    }
    @closedir($handle);
}
?>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to