[PHP-DB] special character in filename

2003-06-08 Thread Ole Hornauer
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-DB] mysql, php, mp3 - a variable problem

2003-06-07 Thread Ole Hornauer
hi,
i put a script together to scan a directory and its subdirectories for 
all mp3 files. the tag informations and path then should be put into a 
mysql database.
i included a script called mphp3.php from http://res.crea-bmb.de/mphp3/ 
which returns the needed tag info from one file.
the script to recursively scan a dir i got from groups.google.

using the mphp3.php with one file is simple (demo from website):
?
include(mphp3.php);
$info = New mphp3(2); 
$info-load(test.mp3); 
echo $info-title. is a nice song. it's encoded with.$info-
bitrate.kbps.;
?

my code to include the db:
?
  include(mphp3.php);

  mysql_connect(192.168.100.12,user,password) or die (no connect 
to db);
  mysql_select_db(music) or die (db does not exist);

  function scan_dir($dir)
{
$info = New mphp3(2);

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

if(is_dir($dir.$file))
{
scan_dir($dir.$file./);
}
else
{
$info-load(/.$dir.$file);

$query =insert into mp3 (
  file,
  path,
  artist,
  title,
  album)
values (
 '$info2-filename',
 '$dir',
 '$info2-v2_artist',
 '$info2-v2_title',
 '$info2-v2_album');;

mysql_query($query);
}
}
@closedir($handle);
}
scan_dir(mp3/);
?

but all it does is to put the path ($dir) into the database. everything 
else is ignored. an error does not occur. since the simple demo works 
fine i think its a problem with the validity of variables.
i'm new to php, so could anybody give me a hint on what mightbe wrong 
with my code please?

thanx a lot

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



Re: [PHP-DB] mysql, php, mp3 - a variable problem

2003-06-07 Thread Ole Hornauer
hi allowee,

sorry, this was not meant to be. $info2 is supposed to be $info. my 
fault. but that is not the actual problem.

 Hi,
 
 Where do you get $info2 from?
 I only see $info in this function.
 
 .: Allowee
 
  function scan_dir($dir)
  {
  $info = New mphp3(2);
 
  $handle = @opendir($dir);
  while ($file = @readdir ($handle))
  {
  if (eregi(^\.{1,2}$,$file))
  {
  continue;
  }
 
  if(is_dir($dir.$file))
  {
  scan_dir($dir.$file./);
  }
  else
  {
  $info-load(/.$dir.$file);
 
  $query =insert into mp3 (
file,
path,
artist,
title,
album)
  values (
   '$info2-filename',
   '$dir',
   '$info2-v2_artist',
   '$info2-v2_title',
   '$info2-v2_album');;
 
  mysql_query($query);
  }
  }
  @closedir($handle);
  }
  scan_dir(mp3/);
  ?
 
  but all it does is to put the path ($dir) into the database. everything
  else is ignored. an error does not occur. since the simple demo works

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



Re: [PHP-DB] mysql, php, mp3 - a variable problem

2003-06-07 Thread Ole Hornauer
well, you are right. the dir '/mp3' does not exist. 'mp3' is a subdir 
from my htdocs dir. so i think the right path should be 
'mp3/someartist/somesong', right?
i fixed that, but the original problem is still the same :(

 hmmm,
 maybe this code..
 
 $info-load(/.$dir.$file);
 
 if $dir = mp3s and $file = test.mp3
 then it will load '/mp3s/test.mp3'
 
 you got that directory?
 I've seen the class and you are hiding the fopen error message, which could be 
 the problem.
 
 .: Allowee
 
 On Saturday 07 June 2003 11:11, Ole Hornauer wrote:
  hi allowee,
 
  sorry, this was not meant to be. $info2 is supposed to be $info. my
  fault. but that is not the actual problem.
 
   Hi,
  
   Where do you get $info2 from?
   I only see $info in this function.
  
   .: Allowee
  
function scan_dir($dir)
{
$info = New mphp3(2);
   
$handle = @opendir($dir);
while ($file = @readdir ($handle))
{
if (eregi(^\.{1,2}$,$file))
{
continue;
}
   
if(is_dir($dir.$file))
{
scan_dir($dir.$file./);
}
else
{
$info-load(/.$dir.$file);
   
$query =insert into mp3 (
  file,
  path,

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



Re: [PHP-DB] mysql, php, mp3 - a variable problem

2003-06-07 Thread Ole Hornauer
moin,

sorry, my php-knowledge is not the best.
what do you mean with formfieldvalues?
i think $info-value is used to get the id3-tag info from the class, 
right? this worked for me in a more simple way without the recursive 
scan:

?
  include(mphp3.php);
  $info = New mphp3(2);

  mysql_connect(192.168.100.12,user,password);
  mysql_select_db(music);

  $info-load(test.mp3);

  $abfrage =insert into mp3 (
  file,
  artist,
  title,
  album)
   values (
 '$info-filename',
 '$info-v2_artist',
 '$info-v2_title',
 '$info-v2_album');;
  mysql_query($abfrage);
?

 Hi,
 
  Where do you get $info2 from?
  I only see $info in this function.
 
 I guess that the $info-values are formfieldvalues.
 $info-[db-field] is normaly used within a whileloop for
 outputing a select-statement.
 
 In the case of formfieldvalues you can use $formfieldname.
 
  .: Allowee
 
   function scan_dir($dir)
 ...
   $query =insert into mp3 (
 file,
 path,
 artist,
 title,
 album)
   values (
'$info2-filename',
'$dir',
'$info2-v2_artist',
'$info2-v2_title',
'$info2-v2_album');;
  
   mysql_query($query);
 ...
 
 Regards,
 Ruprecht
 
 --
 Ruprecht Helms IT-Service und Softwareentwicklung
 
 Tel./Fax  +49[0]7621 16 99 16
 email:  [EMAIL PROTECTED]
 Homep.http://www.rheyn.de
 

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



[PHP-DB] Re: ?? php and mysql database question ??

2003-06-07 Thread Ole Hornauer
hi,

u can install vmware (not freeware) on your windows machine and then 
install linux as a virtual machine. it behaves just like a real machine. 
works fine for me!

 Hello,
 
 I have a question, not sure if what I am looking for
 is available at all or a smaller program of the full
 sized program I am looking for but thought I'd ask to
 see if anyone knows of a program or a program they may
 of created.
 
 On my personal Computer I run a Windows OS and on my
 server (located elsewhere) I run a linux OS.  Now on
 my server I have PHP 4.0 installed as well as mysql
 database installed.  But I am not always available
 online to update the website/databse and wondered if
 there is a way to do updates/tests my my personal
 computer.  Test them offline and put them live when I
 am happy with it.
 
 The thing is on my personal computer I run a Windows
 OS and was wondering if there is a program I can
 install to have mysql database or a similar program to
 mysql database to run my scripts offline?
 
 I already have installed a PHP program that I can
 run/test PHP scripts and thought I'd ask here if
 anyone knew of a mysql one.  (I thought since a PHP
 program is available on Windows OS maybe a mysql one
 was too?)
 
 If anyone can help me that would be great.  If not, it
 was worth a shot!
 
 If anyone has another idea of doing things offline let
 me know, I am all ears.  (e.g. a similar database
 program to mysql I can download for Windows OS .. I
 don't mean MS ACCESS etc, needs to be linux like so I
 can test my scripts offline and make MINOR  edits to
 get it to work with mysql.  But would prefer a mysql
 program if available.)
 
 I need the program so I can test my PHP pages and do
 database changes to work with my PHP pages.  As I do
 on my live website.  (e.g. retrieve data from a
 database, and send data to a database. etc...)
 
 I'm not aware of a program for mysql on Windows OS but
 thought to ask here and see if any of you people do or
 know any in development.
 
 Thanks for your time in advance.
 

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