Re: [PHP] php and asp

2001-05-11 Thread Luiz Vitor

You can use this code:

set fso = Server.CreateObject(Scripting.FileSystemObject)
set fs = fso.GetFolder(Server.MapPath(/images))

for each file in fs.Files
 Response.write file.name  br
 Response.write file.size
next

You'll have to use the FileSystemObject in order to get data from a text
file, or get the file type, size, etc...


[]'s
Luiz Vitor

- Original Message -
From: todd kennedy [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, May 11, 2001 12:42 AM
Subject: [PHP] php and asp


 i've got a problem...i've written some stuff in PHP and now the person I
 wrote it for is looking for an ASP version to play with as well...

 I've gotten most of it working in ASP now (eek.  VBScript is downright
 archaic compared to php4), but I'm having problems finding an equivelent
 for one PHP function that's pretty central to the code (it's a
 photogallery)...

 the funciton is:
 getImageSize


 does any one know of an ASP equivelent to this?

 thanks in advance
 todd kennedy


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] php and asp

2001-05-11 Thread Luiz Vitor

I forgot to tell you... you don't need to install any component in your
server. The FileSystemObject already comes with IIS 5.0.

[]'s
Luiz Vitor

- Original Message -
From: todd kennedy [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, May 11, 2001 12:42 AM
Subject: [PHP] php and asp


 i've got a problem...i've written some stuff in PHP and now the person I
 wrote it for is looking for an ASP version to play with as well...

 I've gotten most of it working in ASP now (eek.  VBScript is downright
 archaic compared to php4), but I'm having problems finding an equivelent
 for one PHP function that's pretty central to the code (it's a
 photogallery)...

 the funciton is:
 getImageSize


 does any one know of an ASP equivelent to this?

 thanks in advance
 todd kennedy


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Search a string between foo/foo

2001-05-10 Thread Luiz Vitor

Thanks to all you guys who helped me.
I don't know if it's the best way, but the important is that works perfect.
It does search a string between foo/foo in a MySQL database and, if it
finds the string, will replace for the URL.

I'm posting it below:

function search4url($source) {
   $pattern = /foo(.*)\/foo/U;
   preg_match_all($pattern, $source, $values);

   $conexao = mysql_connect('localhost','','');
   mysql_select_db('savepoint');


   for ($i = 0; $i  sizeof($values[0]); $i++) {
 $values[0][$i] = str_replace(foo, '', $values[0][$i]);
 $values[0][$i] = str_replace(/foo, '', $values[0][$i]);

 $query = 'SELECT url FROM teste WHERE palavra = \''.$values[0][$i].'\'';

 $resultado = mysql_query($query);
 $row = mysql_fetch_array($resultado);


if (mysql_num_rows($resultado)) {
  $replacement = 'a href=' . $row['url'] . '\\1/a';
 $source = preg_replace($pattern, $replacement, $source, 1);
   } else {
  $replacement = '\\1';
  $source = preg_replace($pattern, $replacement, $source, 1);
}

   }
   mysql_close($conexao);
   echo nl2br($source);
}


Luiz Vitor

- Original Message -
From: Christian Reiniger [EMAIL PROTECTED]
To: Luiz Vitor [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, May 09, 2001 1:46 PM
Subject: Re: [PHP] Search a string between foo/foo


 On Wednesday 09 May 2001 16:14, Luiz Vitor wrote:
  It's still not working.
  I'm using the pattern ([^foo]*) and I'm getting the first match
  correct, but it's not getting all the other matches.

 [^foo] means any character except '', 'f', 'o' and ''

 You're looking for something like this:

 $Text = preg_replace ('/(foo)(.*?)\/\\1/', '$2', $Text);

 --
 Christian Reiniger
 LGDC Webmaster (http://sunsite.dk/lgdc/)

 REALITY.SYS corrupted ... reboot Universe [Y,n]?

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Search a string between foo/foo

2001-05-09 Thread Luiz Vitor

Hi...

I have a text and, some words of the text have the tags url/url between them.
What i'm trying to do is to replace the word between that tags for a url, wich I'll 
search them in a database and convert to a url.

It's working fine when I have only one url/url, but when there are more than one, 
the script converts all the text between the first foo/foo and the last 
foo/foo.

I'm using this code:

if (eregi(foo(.*)/foo, $string, $result)) {
   $string = str_replace($result[1], 'a href='.$result[1].''.$result[1].'/a', 
$string);
}


Someone knows what I have to do to put it to work???


Thanks in advance.

Luiz Vitor
Brazil



Re: [PHP] Search a string between foo/foo

2001-05-09 Thread Luiz Vitor

It's still not working.
I'm using the pattern ([^foo]*) and I'm getting the first match correct,
but it's not getting all the other matches.


Thanks,
Luiz Vitor

 - Original Message -
 From: Toby Dacre [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, May 09, 2001 9:06 AM
 Subject: Re: [PHP] Search a string between foo/foo


  .* in your patten will match everything  It's greedy like perl (unless
you
 compiled php not to be)

 add a ? and it will make it none greedy

 ^[foo]*   will not work  ^ needs to be in [] to mean not else it means
 start of string


  Luiz Vitor [EMAIL PROTECTED] wrote in message
  011201c0d87d$57f8ab00$[EMAIL PROTECTED]">news:011201c0d87d$57f8ab00$[EMAIL PROTECTED]...
  Hi...
 
  I have a text and, some words of the text have the tags url/url
 between
  them.
  What i'm trying to do is to replace the word between that tags for a
url,
  wich I'll search them in a database and convert to a url.
 
  It's working fine when I have only one url/url, but when there are
 more
  than one, the script converts all the text between the first foo/foo
 and
  the last foo/foo.
 
  I'm using this code:
 
  if (eregi(foo(.*)/foo, $string, $result)) {
 $string = str_replace($result[1], 'a
  href='.$result[1].''.$result[1].'/a', $string);
  }
 
 
  Someone knows what I have to do to put it to work???
 
 
  Thanks in advance.
 
  Luiz Vitor
  Brazil
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]