Re: [PHP] strip_tags

2013-07-20 Thread Frank Arensmeier
20 jul 2013 kl. 18:25 skrev Tedd Sperling t...@sperling.com:

 Hi gang:
 
 I've been using
 
$str = strip_tags($str, $allowable)
 
 as it is described via the manuals:
 
 http://php.net/manual/en/function.strip-tags.php
 
 The problem I've found is the tags br and br / are not stripped.
 
 How do you strip all tags, but leave some tags (such as b, i, and u -- 
 I know these are depreciated, but my client wants them anyway).
 
From the manual:
allowable_tags
You can use the optional second parameter to specify tags which should not be 
stripped.

Note:
HTML comments and PHP tags are also stripped. This is hardcoded and can not be 
changed with allowable_tags.

Note:
This parameter should not contain whitespace. strip_tags() sees a tag as a 
case-insensitive string between  and the first whitespace or . It means that 
strip_tags(br/, br) returns an empty string.

It's all there… ;-)

Cheers,
/frank


 Cheers,
 
 tedd
 
 _
 t...@sperling.com
 http://sperling.com
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



Re: [PHP] Detecting massive web hits

2013-04-12 Thread Frank Arensmeier
12 apr 2013 kl. 17.23 skrev Angela Barone:

   Does anyone know if there's a ready-made script that detects if someone 
 hits multiple web pages within seconds of each other and then can temporarily 
 ban them by IP from accessing our site?
 
   Looking through the logs, I see someone/something hit each and every 
 page of a site I work on within only a few seconds of each other.  I 
 seriously doubt they are a customer. ;)
 
   I'd appreciate any insights.
 
 Thank you,
 Angela
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

Maybe Fail2ban is what you are looking for?
http://www.fail2ban.org/wiki/index.php/Main_Page

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



Re: [PHP] Expected behaviour or bug?

2012-09-17 Thread Frank Arensmeier
17 sep 2012 kl. 10.50 skrev Camilo Sperberg:

 Hello list, I have a little question with PHP's internal working. I've 
 managed to reduce the test to the following lines:
 
 $globalVariable = 'i am a global variable';
 function testFunction() {
   global $globalVariable;
   unset($globalVariable);
 }
 
 testFunction();
 
 if(isset($globalVariable)) {
   var_dump('global variable IS set');
 } else {
   var_dump('global variable is NOT set');
 }
 
 
 
 When executing the above test, you will get printed that the global variable 
 is set, despite unsetting it in the function. Is it really the intention to 
 unset a global variable inside a function locally or have I just happen to 
 found a little bug?
 
 unreal4u-MBP:~ unreal4u$ php --version
 PHP 5.3.13 with Suhosin-Patch (cli) (built: Jun 20 2012 17:05:20) 
 Copyright (c) 1997-2012 The PHP Group
 Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with Xdebug v2.3.0dev, Copyright (c) 2002-2012, by Derick Rethans
 
 If it is expected behavior, is there any documentation on why this is done 
 this way?
 
 Greetings and thanks.
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
Sometimes, it helps reading the manual...

http://lmgtfy.com/?q=php+unset+global

If a globalized variable is unset() inside of a function, only the local 
variable is destroyed. The variable in the calling environment will retain the 
same value as before unset() was called.
[...]
To unset() a global variable inside of a function, then use the$GLOBALS array 
to do so:

Took about 1 minute to find out.

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



Re: [PHP] extract Occurrences AFTER ... and before -30-

2012-09-02 Thread Frank Arensmeier
2 sep 2012 kl. 14.40 skrev Matijn Woudt:

 On Sun, Sep 2, 2012 at 6:23 AM, John Taylor-Johnston
 jt.johns...@usherbrooke.ca wrote:
 See:
 http://www.cegepsherbrooke.qc.ca/~languesmodernes/test/test.php
 http://www.cegepsherbrooke.qc.ca/~languesmodernes/test/test.phps
 
 In $mystring, I need to extract everything between |News Releases| and
 -30.
 
 The thing now is $mystring might contain many instances of |News Releases|
 and -30.
 
 How do I deal with this? My code only catches the first instance.
 
 Thanks for you help so far.
 
 John
 
 
 You could use substr to retrieve the rest of the string and just start
 over (do it in a while loop to catch all).
 Though, it's probably not really efficient if you have long strings.
 You'd be better off with preg_match. You can do it all with a single
 line of code, albeit that regex takes quite some time to figure out if
 not experienced.
 
 - Matijn
 
 PS. Please don't top post on this and probably any mailing list.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

My approach would be to split the hole text into smaller chunks (with e.g. 
explode()) and extract the interesting parts with a regular expression. Maybe 
this will give you some ideas:

$chunks = explode(-30-, $mystring);
foreach($chunks as $chunk) {
preg_match_all(/News Releases\n(.+)/s, $chunk, $matches);
var_dump($matches[1]);
}

The regex matches all text between News Releases and the end of the chunk.

/frank


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



Re: [PHP] array_push

2012-09-02 Thread Frank Arensmeier
2 sep 2012 kl. 19.48 skrev John Taylor-Johnston:

 How can I clean this up?
 My approach would be to split the hole text into smaller chunks (with e.g. 
 explode()) and extract the interesting parts with a regular expression. 
 Maybe this will give you some ideas:
 $chunks = explode(-30-, $mystring);
 foreach($chunks as $chunk) {
 preg_match_all(/News Releases\n(.+)/s, $chunk, $matches);
 var_dump($matches[1]);
 }
 The regex matches all text between News Releases and the end of the 
 chunk.
 2) How could I suck it into one nice easy to handle array?
 
 |$mynewarray=|array {
  [0]= Residential Fire Determined to be Accidental in Nature ...
  [1]= Arrest Made in Residential Fire ...
 } 
 I was hoping preg_match_all would return strings.  I w/as hoping |$matches[1] 
 was a string.|/
 
 source: http://www.cegepsherbrooke.qc.ca/~languesmodernes/test/test4.phps
 result: http://www.cegepsherbrooke.qc.ca/~languesmodernes/test/test4.php

Have you read up on 'preg_match_all' in the manual? What makes you think that 
preg_match_all returns strings? $matches[1], in the above case contains an 
array with all matches from the parenthesized subpattern, which is (.+).

 This is ugly. How can I clean this up like this?
 
 $mynewarray= array {
  [0]= Residential Fire Determined to be Accidental in Nature ...
  [1]= Arrest Made in Residential Fire ...
 }

Why not add two lines of code within the first loop?

$chunks = explode(-30-, $mystring);
foreach($chunks as $chunk) {
preg_match_all(/News Releases\n(.+)/s, $chunk, $matches);
foreach($matches[1] as $matched_text_line) {
$mynewarray[] = $matched_text_line;
}
}

Besides the regex, this is pretty basic php. 

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



Re: [PHP] no traffic

2012-03-06 Thread Frank Arensmeier

6 mar 2012 kl. 15.29 skrev Mike Mackintosh:

 On Mar 6, 2012, at 8:55, Lawrence Decker lld0...@gmail.com wrote:
 
 I've been playing with PHP for about 6 years and I have no idea why this is
 happening... I've been writing a script to auth to AD.  When I run the
 script on my dev box, nothing.  I have wireshark running in the background
 on the dev box, I can see the script's traffic go out and hit the DNS
 server but no other traffic. Command line, no problem talking to other
 hosts with whatever port I'm trying to hit.  On my box, all the scripts
 work fine.  LDAP is enabled, but I can't hit ANY port other than DNS and if
 I use the IP in the script, I see no traffic.  Both are FC16-64 patched as
 of last week. I matched line-by-line in the phpinfo() on my box and the dev
 box - no difference.  Used this script to try any port open on other hosts
 but no traffic shows up in wireshark!! Any ideas
 
 
 Lawrence
 
 
 
 ?php
 function ping($host,$post=25,$timeout=6)
 
 {
 $fsock = fsockopen($host, $port, $errno, $errstr, $timeout);
 if ( ! $fsock )
 {
  return FALSE;
 }
 else
 {
  return TRUE;
 }
 }

Have you noticed that you have a typo in your function? '$post' should be 
'$port'...

/frank


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



Re: [PHP] php://input

2012-01-15 Thread Frank Arensmeier
15 jan 2012 kl. 06.18 skrev Adam Tong:

 Hi,
 
 I am trying to read variables from input method.
 I am using this tuorial:
 http://www.lornajane.net/posts/2008/Accessing-Incoming-PUT-Data-from-PHP.
 Here is my code:
 ?php
 if($_SERVER['REQUEST_METHOD'] == 'GET') {
echo this is a get request\n;
echo $_GET['fruit']. is the fruit\n;
echo I want .$_GET['quantity']. of them\n\n;
 } elseif($_SERVER['REQUEST_METHOD'] == 'PUT') {
echo this is a put request\n;
parse_str(file_get_contents(php://input),$post_vars);
echo $post_vars['fruit']. is the fruit\n;
echo I want .$post_vars['quantity']. of them\n\n;
 }
 ?
 
 I am using the firefox extension  poster to run this example. GET
 works fine but when using PUT, file_get_contents(php://input)
 returns an empty string.
 
 I found a bug related to this: https://bugs.php.net/bug.php?id=51592
 
 I am using xampp on win7 (
 + Apache 2.2.17
  + MySQL 5.5.8 (Community Server)
  + PHP 5.3.5 (VC6 X86 32bit) + PEAR)
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

Hi Adam.

Although I've never worked with PUT/DELETE requests, here are my thoughts.

1) According to the manual, file_get_contents only allows URL's as filenames if 
fopen wrappers are enabled. Make sure that this is the case (have a look at 
the settings in your php ini file). Do you get any data when changing 
'file_get_contents' to e.g. (as found here: 
http://php.net/manual/en/features.file-upload.put-method.php)?

?php
/* PUT data comes in on the stdin stream */
$putdata = fopen(php://input, r);

/* Open a file for writing */
$fp = fopen(myputfile.ext, w);

/* Read the data 1 KB at a time
   and write to the file */
while ($data = fread($putdata, 1024))
  fwrite($fp, $data);

/* Close the streams */
fclose($fp);
fclose($putdata);
?

2) Have a look in your Appache log files and make sure the client is actually 
making a valid PUT request.

/frank


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



Re: [PHP] Question about date calculations

2011-12-29 Thread Frank Arensmeier
29 dec 2011 kl. 22.22 skrev Eric Lommatsch:

 So far in looking at the functions that are available at
 http://www.php.net/manual/en/ref.datetime.php I have not been able to figure
 out how to do what I need to do.  Below is a snippet showing approximately
 what I am trying to do.

On the same page you are referring, there are plenty of examples on how to 
calculate the difference between two dates. Choose one and see if it fits your 
bill. Or is there any particular reason why you're writing your own function?

http://www.php.net/manual/en/ref.datetime.php#78981

/frank


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



Re: [PHP] PDF Page Size

2011-12-20 Thread Frank Arensmeier
20 dec 2011 kl. 16.15 skrev Floyd Resler:

 What is a good solution for get the size of a PDF page in pixels?  I've tried 
 a few different methods but haven't had much success.
 
 Thanks!
 Floyd

If you don't mind using a command line tool, Xpdf would be my first choice. 
Look out for pdfinfo.

http://foolabs.com/xpdf/download.html

/frank


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



Re: [PHP] Opening Multiple Files

2011-09-07 Thread Frank Arensmeier
7 sep 2011 kl. 16.21 skrev Ron Piggott:

 
 Hi Everyone
 
 I am trying to load an HTML book into mySQL.  The book was distributed with 
 each chapter being it’s own HTML file.
 
 The only way I know how to open a file is by specifying the file name.  Such 
 as:
 
 $myFile = B01C001.htm;
 $lines = file($myFile);
 foreach ($lines as $line_num = $theData) {
 
 Is there a way PHP will open each file in the directory ending in “.htm”, one 
 file at a time, without me specifying the file name?
 

http://se.php.net/manual/en/function.glob.php

/frank


 When the file is open I need the FOREACH (above) to parse the content which 
 ends with an “INSERT INTO” for a mySQL table.
 
 Thank you in advance for any help you are able to give me.
 
 Ron
 
 The Verse of the Day
 “Encouragement from God’s Word”
 http://www.TheVerseOfTheDay.info  



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



Re: [PHP] ftell Issue or Feature

2011-06-08 Thread Frank Arensmeier
8 jun 2011 kl. 09.09 skrev Christian Grobmeier:

 The object itself is always the same, for all threads. Every thread
 gets this Appender from a kind of a pool.
 
 My guess is, every thread gets some kind of a copy of this object,
 working at it. Once it reaches the method, its members states are not
 reflected into the other stack call.

I never worked with log4php, so I am really not sure how getMaxFileSize 
calculates the log file size. In general, results for functions like PHP's 
filesize are cached. See e.g. http://php.net/manual/en/function.filesize.php

Right after the flock call, try to clear the cache with clearstatcache().

Maybe that helps.
/frank
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] RelaxNG parser in PHP?

2011-04-29 Thread Frank Arensmeier
Hello List!

Currently I am using a pear package in one of my projects to parse and query 
XML DTD files. The package is called XML_DTD 0.5.2 and includes the so called 
XML_DTD_Parser. One of the purposes of this class is to parse a given DTD file 
and return that file as a tree like object. With the help of that object, I can 
find out valid children (and valid attributes) for a given tag (which is what I 
am using the XML_DTD class for). Now I am looking for a similar class in order 
to parse RelaxNG (alternatively Schematron) files.

I have search Google high and low but was not able to find anything suitable.

Any hints are more than welcome!

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



Re: [PHP] Re: echo?

2011-03-23 Thread Frank Arensmeier

23 mar 2011 kl. 02.42 skrev Jim Giner:

 ok - here's the code in question.
 $q = 'select * from director_records ';
 $qrslt = mysql_query($q);
 $rows = mysql_num_rows($qrslt);
 for ($i=0; $i$rows; $i++)
{
$j = $i+1;
$row = mysql_fetch_array($qrslt);
echo $j.'-'.$row['userid'];
if ($row['user_priv'] )
echo ' ('.$row['user_priv'].')#13#10';
else
echo '#13#10';
}
 
 
 The output I get is:
 
 
 1-smith5
 f-ginerjm (M)
 g-smith8
 
 While the alpha parts are valid, the index is only correct for the first one 
 (0) obviously.
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

Why not try some basic debugging strategies and see what you get?

Try:
for ($i=0; $i$rows; $i++)
   {
   var_dump($i);
   $j = $i+1;
   $row = mysql_fetch_array($qrslt);
   echo $j.'-'.$row['userid'];
   var_dump($j);
   if ($row['user_priv'] )
   echo ' ('.$row['user_priv'].')#13#10';
   else
   echo '#13#10';
   }

The output you've posted, that's rendered output, right? What's the raw output?

By the way, the code snippet you gave us is not complete. Is there anything 
else? As Dan noticed earlier, judging from that code snippet only, there must 
be something else funky going on.

/frank



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



Re: [PHP] extract price by preg_match_all

2011-02-14 Thread Frank Arensmeier

?php
if ( preg_match_all(/([0-9]+[,\.]{1}[0-9]{2})/, $data, $matches) ) {
echo Matches found:;
echo pre;
print_r($matches);
echo /pre;
} else {
echo Didn't find anything...;
}
?

Untested.

/frank

14 feb 2011 kl. 15.05 skrev Tontonq Tontonq:

 example data:
 
 div class=picboxfooter
  span class=newpricespan class=productOldPriceold price 829,00
 euro;/spanbr /your price 58,90 euro; */span
 /div
 
 another :
  span class=newprice 9,90 euro; */span
 
 i want to extract 829,.00  58,90 from first source , 9,90 from the second
 
 i tried many way like preg_match_all('/span
 class=newprice(\$[0-9,]+(\.[0-9]{2})?)\/span/',$data,$prices);
 it doesn't work


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



Re: [PHP] a quick question about array keys

2010-08-31 Thread Frank Arensmeier
Have a look at the manual, especially the function array_values(). 

/frank
Skickat från min iPhone.

31 aug 2010 kl. 17:43 skrev Tontonq Tontonq root...@gmail.com:

 a quick question
 lets say i have an array like that
 
 
 Array
 (
 [300] = 300
 [301] = 301
 [302] = 302
 [303] = 303
 [304] = 304
 [305] = 305
 [306] = 306
 [307] = 307
 [308] = 308
 ...
 how can i change keys to 0,1,2,3,.. by faster way
 (it should like that) 
 Array
 (
  [0] = 300
  [1] = 301
  [2] = 302
  [3] = 303
   

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



Re: [PHP] Server-side postscript-to-PDF on-the-fly conversion

2010-03-27 Thread Frank Arensmeier

27 mar 2010 kl. 05.41 skrev Rob Gould:

Is there a free solution out there that will enable me to take a PHP- 
generated postscript output file, and dynamically, on-the-fly  
convert it to a PDF document and send to the user as a download when  
the user clients on a link?


More description of what I'm trying to do:

1)  I've got a web-page that accepts some user input
2)  They hit SUBMIT
3)  I've got a PHP file that takes that input and generates a custom  
Postscript file from it, which I presently serve back to the user.   
On a Mac, Safari and Firefox automatically take the .ps output and  
render it in Preview.
4)  However, in the world of Windows, it seems like it'd be better  
to just convert it on-the-fly into a PDF, so that the user doesn't  
need to worry about having a post-script viewer app installed.





If your webserver runs on MacOSX, look out for a binary called  
'pstopdf'. From the man page:


[...]
pstopdf is a tool to convert PostScript input data into a PDF  
document. The input data may come from a file
 or may be read from stdin. The PDF document is always written to  
a file. The name of the output PDF file is
 derived from the name of the input file or may be explicitly  
named using the -o option.

[...]

Another option might be xpdf (http://www.foolabs.com/xpdf/). There are  
several different tools bundled with that app and there might be some  
ps - pdf converter too.


Otherwise, there is always Ghostscript.

/frank


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



Re: [PHP] Merry Christmas!

2009-12-25 Thread Frank Arensmeier

Merry Christmas from Sweden!

/frank
Skickat från min iPhone.

25 dec 2009 kl. 15.16 skrev Shawn McKenzie nos...@mckenzies.net:


Merry Christmas from Texas, USA!

--
Thanks!
-Shawn
http://www.spidean.com

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




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



Re: [PHP] remove namespace from xml

2009-12-03 Thread Frank Arensmeier

2 dec 2009 kl. 19.12 skrev Augusto Flavio:


Hi all,


i'm trying to connect to a SOAP Server but i'm having a problem. Look
the xml that i need send to the server:

// THIS IS THE XML CORRECT THAT NEED BE SENT TO THE SERVER

?xml version=1.0 encoding=utf-8?
soap:Envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:xsd=http://www.w3.org/2001/XMLSchema;
xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/;
soap:Body
CalcPrecoPrazo xmlns=http://tempuri.org/;
nCdEmpresaX/nCdEmpresa
sDsSenhaXX/sDsSenha
nCdServico40010/nCdServico
sCepOrigem30840300/sCepOrigem
sCepDestino30840280/sCepDestino
nVlPeso10/nVlPeso
nCdFormato1/nCdFormato
nVlComprimento20/nVlComprimento
nVlAltura5/nVlAltura
nVlLargura10/nVlLargura
nVlDiametro0/nVlDiametro
sCdMaoPropriaS/sCdMaoPropria
nVlValorDeclarado300/nVlValorDeclarado
sCdAvisoRecebimentoS/sCdAvisoRecebimento
/CalcPrecoPrazo
/soap:Body
/soap:Envelope


And now the xml that i'm sending to the SOAP Server.


//THIS IS THE XML THAT THE PHP IS SENDING
?xml version=1.0 encoding=UTF-8?
SOAP-ENV:Envelope
xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/;
xmlns:ns1=http://tempuri.org/;
xmlns:xsd=http://www.w3.org/2001/XMLSchema;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:SOAP-ENC=http://schemas.xmlsoap.org/soap/encoding/;
SOAP-ENV:encodingStyle=http://schemas.xmlsoap.org/soap/encoding/;
SOAP-ENV:Body
ns1:CalcPrecoPrazo // HOW CAN I REMOVE THIS NAMESPACE? ns1:
nCdEmpresa xsi:type=xsd:intX/nCdEmpresa
sDsSenha xsi:type=xsd:stringXX/sDsSenha
nCdServico xsi:type=xsd:string40096/nCdServico
sCepOrigem xsi:type=xsd:string30840280/sCepOrigem
sCepDestino xsi:type=xsd:string30840300/sCepDestino
nVlPeso xsi:type=xsd:string10/nVlPeso
nCdFormato xsi:type=xsd:string1/nCdFormato
nVlComprimento xsi:type=xsd:string5/nVlComprimento
nVlAltura xsi:type=xsd:string10/nVlAltura
nVlLargura xsi:type=xsd:string0/nVlLargura
nVlDiametro xsi:type=xsd:string300/nVlDiametro
sCdMaoPropria xsi:type=xsd:stringN/sCdMaoPropria
nVlValorDeclarado xsi:type=xsd:string300/nVlValorDeclarado
sCdAvisoRecebimento xsi:type=xsd:stringN/sCdAvisoRecebimento
/ns1:CalcPrecoPrazo
/SOAP-ENV:Body
/SOAP-ENV:Envelope


How can i remove the ns1 from the Child CalcPrecoPrazo?

Some idea?



//here is the php code:

$client = new SoapClient(null, array('location' = $url,
'uri'  =
http://tempuri.org/CalcPrecoPrazo;,
 'trace'= 1 ));

$results = $client-CalcPrecoPrazo($empresaCod, $empresaSenha,
$codigoFrete, $cepOrigem, $cepDestino, $peso,
  (int)$formatoCd, (int)$comprimento, 
(int)$altura, (int)$largura,
(int)$VlDiametro,
		  $codMaoPropria, (float)$valor,  
$codAvisoRecebimento);



thanks




Augusto Morais

Although I never worked with SOAP so far, at least when it comes to  
XML namespaces, you need to explicitly set those somewhere in your  
code before use (which you haven't). Have you asked Google or even  
looked at the MAN pages? After two minutes of googling, I found this.


From the SOAP man page:

[...]
nico
25-Aug-2006 01:20
If you want to build a Soap Server for Microsoft Office's client (like  
Microsoft Office Research Service) you need to rewrite SOAP's  
namespaces :


?php
// (...)

$server = new SoapServer($wsdl, array('uri' = $uri, 'classmap' =  
$classmap));

$server-setClass($class);
function callback($buffer)
{
$s = array('ns1:RegistrationResponse', 'ns1:', 'xmlns:ns1=urn:Microsoft.Search 
');
$r = array('RegistrationResponse xmlns=urn:Microsoft.Search',  
'', '');

   return (str_replace($s, $r, $buffer));
}
ob_start('callback');
$server-handle();
ob_end_flush();

// (...)
?

There are a complete example at this URL : 
http://touv.ouvaton.org/article.php3?id_article=104
[...]

I am sure there are other examples too.

/frank


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



Re: [PHP] installing php 5 with pdflib

2009-01-14 Thread Frank Arensmeier

13 jan 2009 kl. 22.38 skrev Merlin Morgenstern:


Hi there,

I am still facing trouble with pdflib and php 5. After hours of  
research I found that I do have to install the pecl package. So I  
decided to compile it into php staticly like described here:

http://www.php-resource.de/handbuch/install.pecl.static.htm

The configure command stops with the error:
configure: error: pdflib.h not found! Check the path passed to -- 
with-pdflib=PATH. PATH should be the install prefix directory.


actually the file is and always was there. Does it have to be a new  
version? I am using pdflib 4.x which workes fine in the running php  
4.x installation.


Thank you for any help,

Merlin

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


Are you talking about pdflib lite or the commercial version? Is there  
any particular reason why you like to compile pdflib directly into  
PHP? pdflib (at least the commercial version) is available as a .so  
extension for PHP. See:


http://www.pdflib.com/download/pdflib-family/pdflib-7/

Maybe you should download the current version (7) and try to compile  
your php again. Version 4 seems pretty outdated.


//frank

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



Re: [PHP] Waste of storage space? [follow-up]

2008-11-07 Thread Frank Arensmeier

1 nov 2008 kl. 16.27 skrev Michelle Konzack:


Hello Frank,

Do you use Linux or Windows?


Initially, the system I am working on will be installed under Mac OS X  
Server.


If Windows you have  already  lost  since  the  cluster  size  of   
e.g.

Windows 2003 is 32 kByte or 64 kByte...

If Linux, you can setup the partitoin to use a blocksize of 1, 2,   
4  or

8 kByte.

I asume you are using Linux and  two or three sentences per text   
can

not realy large...  even 2 kByte is already big for it.

I have arround 140 million files on one of my storage server (38  
TByte)
with a size of some kBytes up to a  half  GByte  and  I  have  set   
the

blocksize to 4 kByte...

Calculating the wasted space give me arround 340 GByte...

Reducing the blocksize to 2 kByte the wasted space is only 170 GBYte.

But I give a f..k on it...

Diskspace is cheap (even using 300 GByte SCSI drives) and I realy do  
not
like to reinitialize 10 Raid-5 volumes (each 16 HDD) with 3900  
GBytes of

usable space



I agree, disk space is cheap. And to be honest, I am now convinced  
that storage space really isn't a serious issue. So, to sum up.  
Previously I was working with the idea to store both old and new  
values. But, thanks to what Bastien Koert suggested earlier, the  
history table now stores changes (=new text) only. I think that this  
is much more sleek to work with.


Besides that, before recording something to the history table, I do  
some filtering on the new text which means that minor changes are  
walked over.


Thank you all for sharing your ideas.

//frank




Thanks, Greetings and nice Day/Evening
   Michelle Konzack
   Systemadministrator
   24V Electronic Engineer
   Tamay Dogan Network
   Debian GNU/Linux Consultant



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



Re: [PHP] Printing Web Page

2008-11-06 Thread Frank Arensmeier

6 nov 2008 kl. 21.21 skrev Patrick Moloney:

I'd like to enable my users to print individual web pages from their  
browser. If they simply select the browser print button they don't  
get all the text that is displayed in a scrolling text area.

The web page is static html and css, in a php file.



This might be a good starting point.

http://www.alistapart.com/articles/printyourway

//frank


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



Fwd: [PHP] Waste of storage space?

2008-10-29 Thread Frank Arensmeier

Från: Yeti [EMAIL PROTECTED]
Datum: ti 28 okt 2008 23.07.11 GMT+01:00
Till: Frank Arensmeier [EMAIL PROTECTED]
Ämne: Re: [PHP] Waste of storage space?

Hej,

why not do a simple strlen() before comparison?
Like if strlen (or mb_strlen()) is less than 50 do not serialize/ 
compare.


Or Like levenchtein(), You could do :
?php
(strlen($string2) - similar_text($string,$string2))
?
to see how much characters have been changed.




Thank you for your respons.

I have thought of such a sorting mechanism too. But on the other hand,  
the biggest drawback would be that even minor changes that might be  
really important could get lost. And my goal is to really keep track  
on everything my users do. And, in the long run, the problem with the  
database that eventually could/will grow very large in size, is not  
solved.


//frank

..please keep responses on list.




Re: [PHP] Waste of storage space?

2008-10-29 Thread Frank Arensmeier

28 okt 2008 kl. 23.56 skrev Chris:



1) Store the delta (=the actual change) of a text change. This  
could be done by utilizing the Pear package TextDiff. My idea was  
to compare the old with the new text with help of the TextDiff  
class. I would then grab the array containing the changes from  
TextDiff, serialize it and store this data into the db. The problem  
is that this is every thing else but efficient when it comes to  
smaller text (the serialized array holding the changes was actually  
larger than the two texts combined).


What happens when you want to restore a particular version? You have  
to go through each edition and apply patches. Could get very messy.


Not only that. What would happen if they update TextDiff and all  
stored serialized arrays got obsolete? The system is aimed to store  
documents for several years to come. Besides that, doing some advanced  
search in the history/revision table would be very difficult.



I'd say you're on the right track in just storing each version.

2) Do some kind of compression on the text to be stored. However,  
it seems that the build-in compression functions from PHP5 are more  
efficient when it comes to large texts.


All compression techniques (in or out of php) will work better on  
more text.


I noticed that too.

//frank




--
Postgresql  php tutorials
http://www.designmagick.com/





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



[PHP] Re: Waste of storage space?

2008-10-29 Thread Frank Arensmeier

29 okt 2008 kl. 00.00 skrev Maciek Sokolewicz:


Frank Arensmeier wrote:

Hi all.
In short, I am working on a system that allows me to keep track of  
changes to a large amount of short texts (a couple of thousand text  
snippets, two or three sentences per text). All text is stored in a  
database. As soon as a user changes some text (insert, delete,  
update), this action is recorded. Look at an article on e.g.  
Wikipedia and click History. This is more or less what I am  
trying to accomplish.
Right now, my history class that takes care of all changes, is  
working pretty much as I want. The thing is that both the original  
text and the altered text is stored in the database every time the  
text is changed. My concern is that this will eventually evolve  
into a serious problem regarding amount of storage and performance.  
So, I am looking for a more efficient way to store all changes.

Ideas I have come up with so far are:
1) Store the delta (=the actual change) of a text change. This  
could be done by utilizing the Pear package TextDiff. My idea was  
to compare the old with the new text with help of the TextDiff  
class. I would then grab the array containing the changes from  
TextDiff, serialize it and store this data into the db. The problem  
is that this is every thing else but efficient when it comes to  
smaller text (the serialized array holding the changes was actually  
larger than the two texts combined).
2) Do some kind of compression on the text to be stored. However,  
it seems that the build-in compression functions from PHP5 are more  
efficient when it comes to large texts.

Any other ideas?
thank you.
//frank
ps. I notice that Mediawiki also stores complete articles in the db  
(every time an article is updated, the hole article is stored in  
the database). ds.


Hi Frank,

why don't you simply make use of systems specifically designed for  
such things. eg. CVS or SVN (subversion.tigris.org). You could  
pretty easily tie it in with your application. It's quite compact,  
and pretty fast too.


- Tul



Hi Tul.

I think would be an idea worth investigating a little bit more. But  
what about performance? I am really not that familiar with version  
control systems like CVS etc. Let's say there are 30 different text  
snippets with 10 recorded changes each. And I want to see what changes  
users have made to those snippets. That would be 300 calls to the  
(filesystem based) CVS system. Would that be overheat? Besides that,  
in the database I am able to store more information about those  
recorded changes. E.g. the user ID and the time is currently stored as  
well. Can this be done with CVS as well?


/frank

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



Re: [PHP] Waste of storage space?

2008-10-29 Thread Frank Arensmeier

29 okt 2008 kl. 01.08 skrev Bastien Koert:




On Tue, Oct 28, 2008 at 4:24 PM, Frank Arensmeier  
[EMAIL PROTECTED] wrote:

Hi all.

In short, I am working on a system that allows me to keep track of  
changes to a large amount of short texts (a couple of thousand text  
snippets, two or three sentences per text). All text is stored in a  
database. As soon as a user changes some text (insert, delete,  
update), this action is recorded. Look at an article on e.g.  
Wikipedia and click History. This is more or less what I am trying  
to accomplish.


Right now, my history class that takes care of all changes, is  
working pretty much as I want. The thing is that both the original  
text and the altered text is stored in the database every time the  
text is changed. My concern is that this will eventually evolve into  
a serious problem regarding amount of storage and performance. So, I  
am looking for a more efficient way to store all changes.


Ideas I have come up with so far are:

1) Store the delta (=the actual change) of a text change. This  
could be done by utilizing the Pear package TextDiff. My idea was to  
compare the old with the new text with help of the TextDiff class. I  
would then grab the array containing the changes from TextDiff,  
serialize it and store this data into the db. The problem is that  
this is every thing else but efficient when it comes to smaller text  
(the serialized array holding the changes was actually larger than  
the two texts combined).


2) Do some kind of compression on the text to be stored. However, it  
seems that the build-in compression functions from PHP5 are more  
efficient when it comes to large texts.


Any other ideas?

thank you.
//frank

ps. I notice that Mediawiki also stores complete articles in the db  
(every time an article is updated, the hole article is stored in the  
database). ds.


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


Save just the new version each time

table like
record_id  //PK
relates_to //FK
item_text
author_id
timestamp


much easier to work with


Yes, maybe it's just as simple as that. Thanks.

//frank



--

Bastien

Cat, the other other white meat




[PHP] Waste of storage space?

2008-10-28 Thread Frank Arensmeier

Hi all.

In short, I am working on a system that allows me to keep track of  
changes to a large amount of short texts (a couple of thousand text  
snippets, two or three sentences per text). All text is stored in a  
database. As soon as a user changes some text (insert, delete,  
update), this action is recorded. Look at an article on e.g. Wikipedia  
and click History. This is more or less what I am trying to  
accomplish.


Right now, my history class that takes care of all changes, is  
working pretty much as I want. The thing is that both the original  
text and the altered text is stored in the database every time the  
text is changed. My concern is that this will eventually evolve into a  
serious problem regarding amount of storage and performance. So, I am  
looking for a more efficient way to store all changes.


Ideas I have come up with so far are:

1) Store the delta (=the actual change) of a text change. This could  
be done by utilizing the Pear package TextDiff. My idea was to compare  
the old with the new text with help of the TextDiff class. I would  
then grab the array containing the changes from TextDiff, serialize it  
and store this data into the db. The problem is that this is every  
thing else but efficient when it comes to smaller text (the serialized  
array holding the changes was actually larger than the two texts  
combined).


2) Do some kind of compression on the text to be stored. However, it  
seems that the build-in compression functions from PHP5 are more  
efficient when it comes to large texts.


Any other ideas?

thank you.
//frank

ps. I notice that Mediawiki also stores complete articles in the db  
(every time an article is updated, the hole article is stored in the  
database). ds.


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



Re: [PHP] store array into session variable and get it back later

2008-10-01 Thread Frank Arensmeier

1 okt 2008 kl. 12.31 skrev Alain Roger:

...





later on i try to use the content of this array, bt without success.
Here is what i do:

$bci = array($_SESSION['bc']);

array_push($bci,$_SESSION['bc']);

foreach($bci as $key=$value)
{
 echo bci : .$bci[$key]['name'];
 echo br/;
}



how can i get the 'name' value for each row in this session stored  
array ?

thx.


...

The function you need to look into is called serialize.

http://www.php.net/manual/en/function.serialize.php

//frank


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



Re: [PHP] Re: very very small CMS

2008-07-19 Thread Frank Arensmeier


19 jul 2008 kl. 05.05 skrev Robert Cummings:


On Fri, 2008-07-18 at 19:40 -0400, tedd wrote:

At 4:26 PM -0400 7/18/08, Al wrote:

I've got one that sounds like it's exactly what you are looking for.

This site uses it extensively.  http://www.restonrunners.org

Just about every single page on the site was created using my php
program EditPage.  Non-techies do their own thing.

It is highly configurable and uses a simple file-based DB for the
content. Requires php5. Here is part of the user instructions to
give you an idea of the content user instructions.

Rendering of lines and paragraphs generally will be the same as
they appear in the edit box. Titles, centering and bulletins are
centered.

Tags are special instructions for the user's browser and consist
of starting and, generally [there are exceptions as noted], ending
elements [e.g., blueBlue Text/blue] EditPage's tags are
described below. Tag names can be lower or upper case. Two word
tags can be connected with an underscore or a dash. [e.g. big_blue
or big-blue]

That's the good news. Bad news is that I'm doing a major redesign
and it won't be ready for about a 3 or 4 weeks. If you can wait till
then, just ask.

Al.


Al:

Here's a CMS I've been working on.

http://www.webbytedd.com/a/easy-page-db

The idea is to allow the user edit pages in situ.

That specific layout is only one of several different types.


That's a really great layout ;)


Extremely funny. I hope Tedd won't get too scared...

//frank




Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP


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





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



Re: [PHP] de lester

2008-06-27 Thread Frank Arensmeier

27 jun 2008 kl. 09.05 skrev [EMAIL PROTECTED]:



SORRY, IN THE LAST EMAIL I DONT SAY WHAT TYPE OF VIDEO I WAS WORKING,
 I AM WORKING WITH VIDEO  .MOV
THANKS.

I am working with videos and I need to Know how I can obtain the  
duration of the videos
I had a formula that did not need any function of php, but i lost  
de page, please i need any help with this.


Sorry for my english, i am from Cuba.



Lester..Univ de Cienfuegos..Informatica 3 Año
(*_*)Todos somos muy ignorantes. Lo que ocurre es que no todos  
ignoramos las mismas cosas(*_*)



Servicio del Grupo de Redes
Universidad de Cienfuegos
Contacto: [EMAIL PROTECTED]

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


First of all, I think it's not necessary for you to apologize for  
your skills in the English language. Sometimes I feel that some  
members of this list tend to think that it is funny when somebody is  
not able to express him-/herself to 100% when English is not the  
native language. I think it is wrong to make fun of something like  
that. Not everyone subscribing to this list is a lecturer in english.


Now something that might help you to find a solution. Depending on  
your operating system, there are definitely several different  
solutions out there that are able to get the information you are  
looking for. Have a look at the command line tool ffmpeg. This  
package is able to convert many different movie formats (it's like  
ImageMagick, but for movie files) and to retrieve some information  
from movie files.


Have a look at
http://ffmpeg.mplayerhq.hu/
http://ffmpeg-php.sourceforge.net/

An other option could be Apple Quicktime. There are some command line  
tools out there that interact with Quicktime. Google for quicktime  
command line tool and see if you find something useful.


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



Re: [PHP] substr?

2008-06-18 Thread Frank Arensmeier


17 jun 2008 kl. 22.14 skrev Jim Lucas:


Jason Pruim wrote:

Hi everyone,
I am attempting to adopt some code to work more reliably then how  
it is now...
What I am doing is coding a upload form where people could be  
uploading .zip files in excess of 200 MB... Yes I know that is  
large, but it's for a print shop and they get HUGE files to print  
from.

The code I'm having issues with is this:
$filename = $_FILES['userfile']['name']; // Get the name of  
the file (including file extension).
$ext = substr($filename, strpos($filename,'.'), strlen 
($filename)-1); // Get the extension from the filename.
All I want to do is grab the file extension and verify that it is  
a .zip or a .pdf etc. file. This is working for small files (under  
a few megs) but for some reason it fails when I get bigger. I have  
increased the allowed memory size to 50 MB's I'm testing with a 44  
MB file right now.
When it fails, it says the file type is not allowed even though it  
is listed in the file type array.
Hopefully I have given you enough to go on to at least ask me some  
questions :)

--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]


Looking at what I think you are trying to do, how about this?

?php

if ( isset( $_FILES ) ) {

  foreach ( $_FILES AS $file )

$filename = $file['name'];

list($ext) = array_reverse(explode('.', $filename));

$allowed_ext = array('zip', 'pdf');

if ( in_array($ext, $allowed_ext) ) {
  // Correct extension; do what ever
} else {
  // Incorrect extension; do nothing
}

  }

}

?



I am somewhat surprised that all code suggestions are rather  
complicated in my opinion. What is wrong with 'pathinfo'?


if ( !isset( $_FILES['userfile']['name'] ) ) {
echo No file has been uploaded;
} else {

$allowed_extensions = array( zip, pdf, ai, html );
$file_info = pathinfo( $_FILES['userfile']['name'] );

	if ( in_array( strtolower( $file_info['extension'] ),  
$allowed_extensions ) ) {

echo File has a valid extension;
} else {
// do something else
}
}

// frank


--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare


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





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



Re: [PHP] SCanning text of PDF documents

2008-05-15 Thread Frank Arensmeier
A reliable solution depends partly on the pdf document itself.  
Consider if your pdf document contains roted text or text that spans  
about several different blocks/pages. My experience with ps2acsii and  
other ghostscript related tools is that sometimes it works quite  
well, sometimes the output is rather messy.


The most reliable way of extracting text from a pdf is (I think) a  
product called PDF TET from PDFlib Gmbh. Yes, it costs some money for  
a license, but you are able to get almost everything out of the pdf  
then.


http://www.pdflib.com/products/tet/

Maybe some magic with OpenOffice could do the trick as well?

//frank

15 maj 2008 kl. 10.19 skrev Angelo Zanetti:


Hi All.

This is a quick question.

A client of ours wants a solution that when a PDF document is  
uploaded that

we use PHP to scan the documents contents and save it in a DB.

I know you can do this with normal text documents using the file  
commands

and functions.

Is it possible with PDF documents?

My feeling is NO, but perhaps someone will prove me wrong.

Thanks in advance.

Angelo

Web: http://www.elemental.co.za



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






Frank Arensmeier
 


Webmaster  IT Development

NIKE Hydraulics AB
Box 1107
631 80 Eskilstuna
Sweden

phone +46 - (0)16 16 82 34
fax +46 - (0)16 13 93 16
[EMAIL PROTECTED]
www.nikehydraulics.se
 







Re: [PHP] Know a JS list serve

2008-03-12 Thread Frank Arensmeier

11 mar 2008 kl. 22.39 skrev Skip Evans:


Hey all,

I've been Googling trying to find a JavaScript list serve to post a  
question to, but have been, embarrassingly, unable to find one.


Anyone on one they'd recommend or know of one?

Thanks

*sigh*



Evolt has a rather good list (not too much traffic, but still ...)

http://lists.evolt.org/mailman/listinfo/javascript

//frank

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



Re: [PHP] How to measure memory leakage/usage in PHP?

2008-03-05 Thread Frank Arensmeier

6 mar 2008 kl. 06.10 skrev Zareef Ahmed:


HI Chirs,

On 3/6/08, Chris [EMAIL PROTECTED] wrote:


Zareef Ahmed wrote:

Hi Chris,

  Thanks for such quick response.

quite good suggestion, but my application is using a framework  
and lots
of includes and even autoloads of classes are being done, so  
using break

point approach is not possible for me.



Why not? It just means the files are spread out in different folders
instead of one place.

If you're using a framework, set up a new very simple environment and
see how much memory that uses by itself (see
http://www.php.net/memory_get_peak_usage).

That'll at least tell you whether it's the framework using all the
memory or your specific changes to it.



 I have done that check and I am sure that only my changes are  
taking time,
but they are large in numbers, so I was looking something to pin  
point the
exact change which is consuming more memory. Thanks for your  
suggestions, I

will definitely use them.



You should be able to do that with a so called tick function.

From the manual: A tick is an event that occurs for every N low- 
level statements executed by the parser within the declare block. The  
value for N is specified using ticks=N within the declare blocks's  
directive section.


Have a look at the function 'register_tick_function'. Take the  
function that was suggested previously by Chris and make it a tick  
function.


//frank






--


Postgresql  php tutorials
http://www.designmagick.com/





--
Zareef Ahmed
http://www.zareef.net
A PHP Developer in India



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



Re: [PHP] Re: imagettftext and utf-8 (swedish characters)

2008-02-29 Thread Frank Arensmeier

29 feb 2008 kl. 03.41 skrev David Sveningsson:


Nathan Rixham skrev:
before going any further, your HTML page is in UTF-8 yes? with the  
appropriate content-type line.


Yes, apache uses only utf-8 as charset and the html content-type  
meta tag is set to utf-8 too. Also, the html form validates at  
validator.w3.org



plus: first debugging step:
function preview(){
$title = html_entity_decode($_GET['title'], ENT_COMPAT, 'UTF-8');
print_r($title); #verify in view source / web browser that data is  
correct before it's sent to imagettftext


I see the characters correctly, and page info in firefox says the  
encoding is utf-8.




From the man page:
If a character is used in the string which is not supported by the  
font, a hollow rectangle will replace the character
If you are 100% sure that the var $title contains a valid UTF-8  
encoded text sting (simply output the string to the browser and set  
the page encoding to UTF-8), then the only thing that is left that  
might screw up the text-to-image output is the font you are using. As  
you might know, you can only use TrueType fonts.


//frank

ps sorry for posting my reply off-list the first time... ds.

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



Re: [PHP] building PHP5.2.5 on Mac OS X Leopard (anyone know how to build a just an extension)

2007-12-20 Thread Frank Arensmeier


20 dec 2007 kl. 00.55 skrev Jochem Maas:


hi guys,

well having tried for countless hours to build php on leopard I  
pretty much gave up.

that's too bad...

apparently it's pretty much impossible unless your name is Marc  
Liyanage (entropy.ch) ...


the problem lies with the fact that you need 64bit libs and the  
some (most notably iconv)
of the libs included with Leopard are borked in respect to the  
'universal build' stuff (which
I gather means you actually have a number of different  
[architecture related] executables bundled
into a single file ... I probably have that all wrong, to be honest  
it's a little over my head.


Marc L. offers a tarball with a working php5.2.5 (just untar and  
move the php5 dir to /usr/local):

 http://www2.entropy.ch/download/php5-5.2.5.leopard.release1.tar.gz

his build does work but it doesn't include one extension that I  
rely on for some of my projects,

namely interbase.

I figured I'd try using Marc' configure line (as given by /usr/ 
local/php5/bin/php-config against the
source of php5.2.5 that I downloaded and add the relevant configure  
option (--with-interbase[=DIR])
... in the hope I at least get a couple of usable extensions so  
that I could copy the ibase extension

over into the working php5.2.5 installation ... no joy.


what error(s) did you get?

I figure I'm screwed - I have a painfully expensive dev machine I  
can't blooming use. oh well,

at least it is the nicest looking paper weight I've got.


that's something, isn't it??

I'm still wondering whether it's possible to build just the  
interbase extension ... anyone know

how to do that? or have any tips?
is interbase available via PEAR or PECL? How desperately are you  
trying to get thinks working? I mean, are you working on a project  
right now with a tight deadline? I really would like to help with the  
install (since I would like to update to Leopard in the near future  
as well, it might be a good opportunity to learn a few things), but  
right now I don't feel that I have the time...




rgds,
Jochem

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



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



Re: [PHP] re-compiling PHP on Mac OS X

2007-12-17 Thread Frank Arensmeier

hi guys ( girls),

any Mac heads about? I have a MacBook Pro in front of me ... super  
cool,

it even comes with apache  php installed as standard. nice.

only thing is php is not compiled with with all the extensions I  
need, the
question is what is the *correct* way to update/recompile the  
standard installed
copy of php on a Mac? I quite comfortable with compiling/installing  
[mulitple]
custom apache+php installs on a linux server but I'd like to keep  
this Mac as

clean as possible if I can.

If any one has recommendations I love to here from you :-)
in the mean time I'll keep hunting

rgds,
Jochem

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


Why not do it the Mac-way?
http://www.entropy.ch/software/macosx/php/

Download the latest package and make a custom install. I think there  
are 40/50 PHP extensions included. Just pick what you want.


//frank

ps. merry christmas ds.

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



Re: [PHP] re-compiling PHP on Mac OS X

2007-12-17 Thread Frank Arensmeier

17 dec 2007 kl. 12.03 skrev Jochem Maas:


Frank Arensmeier schreef:

hi guys ( girls),

any Mac heads about? I have a MacBook Pro in front of me ...  
super cool,

it even comes with apache  php installed as standard. nice.

only thing is php is not compiled with with all the extensions I  
need,

the
question is what is the *correct* way to update/recompile the  
standard

installed
copy of php on a Mac? I quite comfortable with compiling/installing
[mulitple]
custom apache+php installs on a linux server but I'd like to keep  
this

Mac as
clean as possible if I can.

If any one has recommendations I love to here from you :-)
in the mean time I'll keep hunting

rgds,
Jochem

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


Why not do it the Mac-way?


I've had this Mac for about 5 minutes - it's my first one ... I'm  
not yet
upto speed on the Mac-way :-) ... heck I've even figured out what  
the key
above the TAB key is (I was used to having a backtick/tilde there  
and it took
me longer than I care to admit to figure out that key lies next to  
the SHIFT key.



http://www.entropy.ch/software/macosx/php/

Download the latest package and make a custom install.


ok let's assume I know exactly what a 'custom install' is in  
MacWorld (I don't ;-))
and let's assume I install this 'custom install' what happens to  
the standard php
install - I'd rahter not have 2 php builds installed to start with  
(especially if
it's because my lack of knowledge means I don't know how to  
'correctly' remove the

original, standard installation.

anyway thanks for the hint so far ... Im off to investigate.



Uninstalling the pre-installed PHP module shouldn't be that hard. The  
PHP CLI is located under /usr/bin (at least under Tiger, not sure if  
this location was changed under Leopard). The Apache module is  
located under /usr/libexec/httpd


When you install PHP5 with the package from entropy.ch, the new PHP5  
will install under /usr/local/php5. Just download the package to the  
desktop and double click. This opens the Installer application  
within the Utilities folder - the install process should be self- 
explaining. Somewhere in the install process, you will see a button  
labeled Custom install. All necessary configuration of Apache will  
be done automatically.


You might check if /usr/local and /usr/local/php5/bin is stored in  
your PATH environment.


I mean, it is possible to compile PHP from scratch, but it's not that  
easy. See for example here: http://blog.phpdoc.info/archives/83- 
php-5.2.5-on-Leopard.html


You might check out MAMP as well http://sourceforge.net/projects/mamp


I think there are
40/50 PHP extensions included. Just pick what you want.


I'll have the blond ;-)


Sorry, already taken...




//frank

ps. merry christmas ds.





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



Re: [PHP] re-compiling PHP on Mac OS X

2007-12-17 Thread Frank Arensmeier

17 dec 2007 kl. 18.23 skrev David Powers:


Frank Arensmeier wrote:
When you install PHP5 with the package from entropy.ch, the new  
PHP5 will install under /usr/local/php5.


The Mac package from entropy.ch is not compatible with Leopard (Mac  
OS X 10.5). Marc Liyanage is working on a Leopard-compatible  
version. Check the forum on his site for the latest details.  
There's an extremely long thread about PHP on Leopard. A command  
line installation is somewhere around page 15 of the thread.


Thanks for the information! As a matter of fact, although I already  
have a Leopard DVD, I haven't updated my development machine yet. My  
impression of Leopard (installed on my iMac at home) is that the OS  
still is somewhat unstable. I'll wait for 10.5.2 / 10.5.3


//frank



--
David Powers

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



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



Re: [PHP] Re: chrooted php5-cgi in a non chrooted apache

2007-11-16 Thread Frank Arensmeier

Maybe the Apache mailing list is a better place to ask.

http://httpd.apache.org/userslist.html

//frank

16 nov 2007 kl. 12.20 skrev Joerg Schoppet:


Hi,

no more tips for this problem?


Joerg Schoppet




Joerg Schoppet wrote:

Hi,

actually I try to make my webserver-installation more secure. I've
something in mind, but don't know if it is possible and if so, how  
to do

it ;-)

Actually I have the following config:

Directory-Structure:

/var/www
  domain1
conf
cgi-bin
web
  htdocs
  logs
  domain2


I've installed mod_fastcgi in apache and uses suexec.
In each /var/www/domainx/cgi-bin I have a php-fcgi-starter-file,  
which

starts /usr/bin/php5-cgi.

Actually I see the following problem: I can run each domain under a
different user, but the developer within each domain can program
php-code to at least VIEW a lot of other things outside the
domain-directory.

Now I thought about the following:
If I can create a chroot-jail within /var/www/domainx/web and let
php5-cgi be executed within this chroot-jail, the developers would  
only

see there own directory structure like
var/www/domain1/web
  etc
  bin
  usr
  home

What I've get so far is, that I've created a chroot jail within the
web-directory. I can chroot to there and execute php (I used  
jailer,

for this).

But I don't get it to work that mod_fastcgi starts the chroot-jail.

I googled a lot, but only found howtos and tutorials how to put the
complete apache into a jail, but this is not what I want. Each domain
have to be in its own jail.

Can someone help me / point me in the right direction?


Thanks in advance

Joerg Schoppet


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



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



Re: [PHP] Re: XML editors

2007-08-17 Thread Frank Arensmeier

16 aug 2007 kl. 13.12 skrev Colin Guthrie:


Frank Arensmeier wrote:
Although I am not able to give you any helping advice, I would  
like to
know if there are any PHP based XML online - editors out there  
(that
would allow me to edit XML files online so to say). One thing that  
poped
up in my mind was Tiny MCE. Sure, it could be possible to  
customise Tiny

MCE, but I think one of the most important drawbacks with Tiny MCE is
that it is not working with all browsers.

Since my site is based on a XML/PHP template engine, it would be very
convenient to be able to edit XML files online (instead of editing  
XML

files locally and uploading them to the server).

Any ideas?


I'd be interested to know this too. There are a few places I can think
of where it would be quite a nice addition.

Col

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

Maybe this could be a good idea for a project? I am sure that there  
are people who are interested in such an editor.


//frank

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



Re: [PHP] XML editors

2007-08-16 Thread Frank Arensmeier
Although I am not able to give you any helping advice, I would like  
to know if there are any PHP based XML online - editors out there  
(that would allow me to edit XML files online so to say). One thing  
that poped up in my mind was Tiny MCE. Sure, it could be possible to  
customise Tiny MCE, but I think one of the most important drawbacks  
with Tiny MCE is that it is not working with all browsers.


Since my site is based on a XML/PHP template engine, it would be very  
convenient to be able to edit XML files online (instead of editing  
XML files locally and uploading them to the server).


Any ideas?

//frank

15 aug 2007 kl. 21.15 skrev Al:

What do you guys use for casual XML editing, besides plain text  
editors?


Ones that'll error check and allow fixing files with errors?

Thanks...

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



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



Re: [PHP] pdf and send to printer question

2007-06-20 Thread Frank Arensmeier
Mike. I would start by confirming that the pdf library has been  
enabled/loaded successfully. Call phpinfo() and look for the pdf  
library. It should be there. Since I am on Mac OS X, I am not sure  
what php_cpdf.dll/php_pdf.dll really is (pdflib? - why two  
libraries?). Anyway, the error you get indicates that the pdf  
extension hasn't been loaded successfully. Did you restart the server  
after enabling it?


Regarding the printing issue, assuming that you are on Windows, there  
is a PECL extension called php_printer.dll that should do what you want.


For download: http://pecl4win.php.net/ext.php/php_printer.dll
Documentation: http://se2.php.net/manual/en/ref.printer.php

//frank

19 jun 2007 kl. 22.43 skrev Mike Ryan:


I am trying to get a query to run and outputed to a pdf file I get the
following error

Fatal error: Call to undefined function pdf_begin_document()

in my php.ini I have php_cpdf.dll and php_pdf.dll enabled am I missing
something.?

also is there a way to send the document I create to the printer  
instead of

the screen?

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



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



Re: [PHP] Re: Not getting expected result from file()

2007-06-11 Thread Frank Arensmeier
If you are not able to get anything into your DB (and your connection  
is ok), then two things might be wrong: your input or the query  
string itself.


Echo out the query string and try to use the query  
manually (directly with a MySQL client). If the query string is ok,  
you might check your MySQL connection settings (var_dump, echo etc).  
If the query string is not ok, you have to look at the input values  
for the query ($regName, $regAddress etc).


//frank


11 jun 2007 kl. 07.27 skrev kvigor:

Trimmed elements in the array.  I still can't get it to store in  
central

table.  No MySQL errors either. :-(
 (Also, all form values are escaped.) Strings compared in if  
condition are

now identical.


newcode
===
theFileArray = file('C:\htdocs\folder1\file.txt');

function trim_value($value)
{
$value = trim($value);
}

array_walk($theFileArray, 'trim_value');


if(isset($_POST['strName'], $_POST['strCity'], $_POST['strState']))
{
 $space =  ;
 $stringOne = $_POST['strName']. $space. $_POST['strCity']. $space .
$_POST['strState'];
}

 if(in_array($stringOne, $theFileArray)) // string were identical  
after I

trimmed an did var_dump on $stringOne and $theFileArray[2]
 {
  $queryCentral = INSERT INTO central (conName, conAddress, conCity,
conState, conZip, conPhone, schName, schAddress, schCity, schState,  
schZip,
strName, strCity, strState) VALUES('$regName', '$regAddress',  
'$regCity',
'$regState', '$regZip', '$regPhone', '$sclName', '$sclAddress',  
'$sclCity',

'$sclState', '$sclZip', '$stoName', '$stoCity', '$stoState');

  mysql_query($queryCentral, $connection) or die(Query failed: .
mysql_error($connection));
 }


else
{
$queryUnknown = INSERT INTO unknown (conName, conAddress, conCity,
conState, conZip, conPhone, schName, schAddress, schCity, schState,  
schZip,
strName, strCity, strState) VALUES('$regName', '$regAddress',  
'$regCity',
'$regState', '$regZip', '$regPhone', '$sclName', '$sclAddress',  
'$sclCity',

'$sclState', '$sclZip', '$stoName', '$stoCity', '$stoState');
mysql_query($queryUnknown, $connection) or die(Query failed: .
mysql_error($connection));
}
== 
==

David Robley [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

kvigor wrote:


Hello,

I'm using the file function create an array.  I'm using a value  
from a

form to see if it matches in elements in the array.

My problem is I expect  the condition to be true but info but my  
DB isn't

populated as I in the right DB...
=Code
Begins==
$theFileArray = file('C:\htdocs\folder1\file.txt');



Your problem starts here - file returns the file in an array. Each  
element
of the array corresponds to a line in the file, with the newline  
still
attached. When you compare to a string without the newline at the  
end, the

comparison fails.

If you have php  5.0.0 you can use the FILE_IGNORE_NEW_LINES flag  
in the
file() arguments, otherwise use trim() to remove trailing  
whitespace from

the array elements.



Cheers
--
David Robley

I hate playing craps, Tom said dicily.
Today is Boomtime, the 16th day of Confusion in the YOLD 3173.


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



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



Re: [PHP] Re: Sample

2007-06-11 Thread Frank Arensmeier

Thats nice! Could correct mine also? ;-)

//frank

11 jun 2007 kl. 11.01 skrev [EMAIL PROTECTED]:


I have corrected your document.


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


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



Re: [PHP] Sending mail on OS X

2007-06-09 Thread Frank Arensmeier
I think the key to your problem is to configure Postfix on Mac OS X  
properly. My best suggestion would be Postfix Enabler (look at e.g.  
versiontracker.com for the current version). Postfix Enabler makes it  
very easy to setup Postfix for exemple to use SMTP for the outgoing  
mails.


Another idea would be to use phpmailer (http:// 
phpmailer.sourceforge.net/).


//frank

9 jun 2007 kl. 06.04 skrev Christian Cantrell:


Hi, all.  I'm sure this question has been asked, but I was not able to
effectively search the forum archives, so I'm having to ask it again.

I'm trying to use the mail function to send email on OS X, but the  
email

gets rejected by the mail server I'm sending to.  I get messages in
mail.loglike this:

The IP you're using to send email is not authorized to send email  
directly

to our servers.

I tried sending mail through another server using the SMTP and  
smtp_port
settings in my php.ini files, but the settings seem to be ignored  
(perhaps
they are Windows only?).  Can anyone tell me how I can successfully  
send

test emails on OS X?

Also, the From header does seem to be getting successfully set.  Is  
there

anything wrong with this code?

mail('[EMAIL PROTECTED]', 'php test', 'this is the message.\nthis is another
line.', 'From: [EMAIL PROTECTED]'.\n\r);

Thanks,
Christian


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



[PHP] None US ASCII characters not allowed in headers?

2007-06-09 Thread Frank Arensmeier

Hi.

I have been struggling with a little problem for quite some time now,  
without finding a good solution.


On one of my pages, users are able to download files that contain  
none US ASCII characters in their filenames (e.g. character ö,ä,å).  
And I would like to set the original filename in the content header.  
But according to RFC2183 on ... The Content-Dispostion Header  
Field, characters that are not part of US ASCII are not allowed in  
content headers. Is there any chance to get around this limitation?  
On the other hand, uploading files that contain special characters  
in their filenames is no problem. Why is that so? My solution so  
far is that I simply replace those characters (ä with a, ö with o and  
so on).


Any ideas?

//frank

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



Re: [PHP] None US ASCII characters not allowed in headers?

2007-06-09 Thread Frank Arensmeier
Sorry, my misstake. It turned out that the filename (stored in MySQL)  
was UTF8 encoded. Setting the content header filename value  
manually to something including umlaut characters was no problem.


Lazy me...

Nice weekend.

//frank

9 jun 2007 kl. 21.51 skrev Frank Arensmeier:


Hi.

I have been struggling with a little problem for quite some time  
now, without finding a good solution.


On one of my pages, users are able to download files that contain  
none US ASCII characters in their filenames (e.g. character ö,ä,å).  
And I would like to set the original filename in the content  
header. But according to RFC2183 on ... The Content-Dispostion  
Header Field, characters that are not part of US ASCII are not  
allowed in content headers. Is there any chance to get around this  
limitation? On the other hand, uploading files that contain  
special characters in their filenames is no problem. Why is that  
so? My solution so far is that I simply replace those characters  
(ä with a, ö with o and so on).


Any ideas?

//frank

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



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



Re: [PHP] None US ASCII characters not allowed in headers?

2007-06-09 Thread Frank Arensmeier

9 jun 2007 kl. 22.05 skrev Robert Cummings:


On Sat, 2007-06-09 at 21:59 +0200, Frank Arensmeier wrote:

Sorry, my misstake. It turned out that the filename (stored in MySQL)
was UTF8 encoded. Setting the content header filename value
manually to something including umlaut characters was no problem.


Funny how the solution often presents itself after you make your  
problem

public *lol* :) Wonder if it falls under Murphy's Law.


... I think you made a good point there ...

//frank



Cheers,
Rob.
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'


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



Re: [PHP] [EMAIL PROTECTED]

2007-05-10 Thread Frank Arensmeier

Sorry, your question has nothing to do with PHP. Maybe try a CSS list?

http://www.google.com/search?rls=sv-seq=css+discussion 
+listie=UTF-8oe=UTF-8

http://www.google.com/search?rls=sv-seq=why+ie+sucksie=UTF-8oe=UTF-8
http://whyiesucks.blogspot.com/

//frank

9 maj 2007 kl. 15.13 skrev Farid Jamea:


Hello,

To me this seems to be a very strange problem.

I have a static html page (index.html) that shows correctly on both  
FF2 

IE7.

I splitted the website up into different sections: (header,  
footer, ...). To

do this I have used:
--
?php
require(header.php);
?
Some code goes here...
?php
require(footer.php);
?
--
 and so on.
When I test my page (now index.php), it shows perfect on Firefox,  
but in IE
some stuff are not in their right place. I have checked the source  
code of

both index.html and index.php and they seem both identical to me.

Do you know why IE fails to correctly render the page?

Thanks

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



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



Re: [PHP] Problem with timeout

2007-05-05 Thread Frank Arensmeier

4 maj 2007 kl. 23.48 skrev Richard Lynch:


On Fri, May 4, 2007 3:42 pm, Frank Arensmeier wrote:

I still think that the best way to go is to not involve Apache at all
when running the script. Because the script already has functions for
output logging etc. it is no big deal to change the code so that it
can be run from PHP CLI.


Once you said it was something you did weekly, it's pretty much a
given that you ought to use a cron job with PHP CLI and take Apache
out of the picture entirely...


You are absolutely right. I might also mention that running the  
script under PHP CLI did two things:


1) No problems with timeout settings anymore.
2) The script takes 10 minutes less time to finish

However, I realized that PHP CLI is version 4.4.4 whereas the Apache  
module PHP is version 5.something. After some modifications to the  
script, it is running flawlessly now.



Actually, even if it's for surfer interaction, anything taking that
long should probably be turned into a jobs oriented architecture,
and queue up the work for a cron job later, with user email
notification when it's done.

NOBODY wants to sit that long watching the browser do nothing.


I totally agree. The script was never ment to be user-triggered.  
Instead, the archiving process takes place weekly.


Thanks you all! Have a nice weekend.

//frank


--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?



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



[PHP] Problem with timeout

2007-05-04 Thread Frank Arensmeier

Hello.

I am currently working on a script that parses a given http adress by  
looking for anchor tags, background images and so on - a crawler if  
you like. The downloaded content is temporarily stored on the server  
(Mac OS X Server 10.4.9 with PHP 5) and, when the script is done, the  
content is packed into a ZIP archive. It seems that I am having  
trouble with my Apache timeout setting. Because the script downloads  
between 250 and 300MB of html, pdf, css files and so on, it is  
terminated automatically after the specified timeout setting  
(currently 1200 seconds). Setting max execution time to -1 in the  
script has no effect (which has been noticed previously on the  
php.net manual page).


Is there any other way (with PHP) to come around this problem besides  
setting the time-out in the Apache config to more than 1200 seconds?  
The Apache manual says that the time out value can only be changed  
within the core configuration scope. My initial idea was to set the  
value in a .htaccess file which unfortunately is not allowed. I might  
also add that the script is already optimized for speed so to say.


Hope you get what I mean.

//frank

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



Re: [PHP] Re: Problem with timeout

2007-05-04 Thread Frank Arensmeier

// sorry for posting my answer off list... //

4 maj 2007 kl. 17.35 skrev Emmanuel Raulo-Kumagai:


Frank Arensmeier a écrit :

Hello.
I am currently working on a script that parses a given http adress  
by looking for anchor tags, background images and so on - a  
crawler if you like. The downloaded content is temporarily stored  
on the server (Mac OS X Server 10.4.9 with PHP 5) and, when the  
script is done, the content is packed into a ZIP archive. It seems  
that I am having trouble with my Apache timeout setting. Because  
the script downloads between 250 and 300MB of html, pdf, css files  
and so on, it is terminated automatically after the specified  
timeout setting (currently 1200 seconds). Setting max execution  
time to -1 in the script has no effect (which has been noticed  
previously on the php.net manual page).
Is there any other way (with PHP) to come around this problem  
besides setting the time-out in the Apache config to more than  
1200 seconds? The Apache manual says that the time out value can  
only be changed within the core configuration scope. My initial  
idea was to set the value in a .htaccess file which unfortunately  
is not allowed. I might also add that the script is already  
optimized for speed so to say.

Hope you get what I mean.
//frank


Hello Frank

Are you really sure you need an Apache-spawned PHP script to do all  
that

long stuff ? Even if Apache does not give up on your PHP script, the
HTTP client might do so. This is also not a good idea for a site with
several clients because Apache could easily run low on available
sockets, causing a DoS.

I suggest you just spawn a background process from your PHP script,
through some shell command like batch and nohup. The background  
process

can still be coded in PHP with the CLI interface.


Thank you for sharing your suggestions.

The idea of running the script as a background process seems very  
elegant to me, I have to admit. Since my script is executed only once  
a week, it would be sufficient to set up a simple cron job.  
Modifications to the script are also rather small, since I already  
have e.g. functions for output logging, process locking and so on.



At the end of the long process, you alert the user job was done (e.g.
by mail or by some kind of AJAX mechanism) and let him download the
result.

In the Apache-spawned script:

?php
// This will launch the process in background.
// Be sure to set $job_id.
$cmd_path = /path/to/some/job/dir/job$job_id.sh;
$cmd = fopen( $cmd_path, 'w' );
fwrite(
  $cmd,
  #!/bin/sh\n.
  nohup php -f /path/to/your/scripts/long_process.php someargs\n.
  rm -f $cmd_path );
fclose( $cmd );
shell_exec( batch -f $cmd_path );

// Tell the user the job was scheduled...
?

In long_process.php:

?php
// Do your stuff...

// Send an e-mail to the user or change a persistent server-side
// state so that a script called periodically by the client will let
// her know it was done.
?

You may need to give the right to www-data, or whatever account  
running

Apache, to create jobs through at/batch.

Regards

--
Emmanuel

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



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



Re: [PHP] Problem with timeout

2007-05-04 Thread Frank Arensmeier

4 maj 2007 kl. 21.58 skrev Richard Lynch:


On Fri, May 4, 2007 8:37 am, Frank Arensmeier wrote:

I am currently working on a script that parses a given http adress by
looking for anchor tags, background images and so on - a crawler if
you like. The downloaded content is temporarily stored on the server
(Mac OS X Server 10.4.9 with PHP 5) and, when the script is done, the
content is packed into a ZIP archive. It seems that I am having
trouble with my Apache timeout setting. Because the script downloads
between 250 and 300MB of html, pdf, css files and so on, it is
terminated automatically after the specified timeout setting
(currently 1200 seconds). Setting max execution time to -1 in the
script has no effect (which has been noticed previously on the
php.net manual page).


You mean 0, not -1, right?...


Well, yes. I think I mixed up the function set_time_limit with the  
memory_limit option.



Cuz 0 means forever and -1 probably doesn't mean anything at all,
unless it means 0x seconds, which is on heck of a long time.

You can often use set_time_limit inside your loop with a reasonable
number this is much longer than any single loop execution should take.

This provides you with as much time as you need to finish, without
wiping out ALL the benefits of the original intent of set_time_limit


Is there any other way (with PHP) to come around this problem besides
setting the time-out in the Apache config to more than 1200 seconds?


Wait a minute.

Are you talking about a PHP time limit, or an Apache time limit?!


I was talking about the Apache time limit. As you most certainly  
know, the Apache time limit is superior to the maximal execution  
time set inside a PHP script. Therefore, setting the max execution  
time to 0 (no limit) has no effect if the script reaches the Apache  
time limit specified by the TimeOut directive.


Of course, since this is my own server and I have root access, I  
could set the Apache time limit to a higher value. But, as Emmanuel  
already pointed out ... because Apache could easily run low on  
available sockets, causing a DoS. So I do not feel that this is the  
right way to go.


Cuz we can't really help you much with some Apache time limit  
thingie...


I was afraid of that.




The Apache manual says that the time out value can only be changed
within the core configuration scope. My initial idea was to set the
value in a .htaccess file which unfortunately is not allowed. I might
also add that the script is already optimized for speed so to say.


Not allowed as in you can't have .htaccess, or not allowed as in
somebody turned off the ability to change PHP's timeout setting?


With not allowed I ment that you are not able to set the Apache  
directive timeout in a .htaccess file (at least not with Apache  
1.3) since this directive is only legal within the server core  
configuration.


I still think that the best way to go is to not involve Apache at all  
when running the script. Because the script already has functions for  
output logging etc. it is no big deal to change the code so that it  
can be run from PHP CLI.


//frank


--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?


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



Re: [PHP] sorting multi array

2007-04-25 Thread Frank Arensmeier
Jon, I would suggest that you should have a look at the function  
array_multisort. See the manual for details on what this function  
is capable of.


//frank
25 apr 2007 kl. 01.58 skrev Jon Bennett:


hi,

I have the following array, which I need to sort by quantity...

Array
(
   [2408] = Array
   (
   [name] = Havaianas Top Pink Crystal
   [size] = 5 (37/38)
   [quantity] = 4
   )

   [3388] = Array
   (
   [name] = Havaianas Brazil Silver
   [size] = 6/7 (39/40)
   [quantity] = 6
   )

   [2666] = Array
   (
   [name] = Havaianas Brasil Black
   [size] = 8/9 (41/42)
   [quantity] = 1
   )

   [3210] = Array
   (
   [name] = Havaianas Margaridas Yellow
   [size] = 5 (37/38)
   [quantity] = 1
   )

   [2552] = Array
   (
   [name] = Havaianas Flash White
   [size] = 5 (37/38)
   [quantity] = 1
   )
)

I need to keep the indexes if poss.

Many thanks,

jon

--


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

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



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



Re: [PHP] Catch STDERR

2007-02-19 Thread Frank Arensmeier
Spontaneously, my suggestion would to pipe the STDERR output from  
your command to a file. I have to admit that this doesn't feel like  
the most efficient solution since you would involve some reading /  
writing to your filesystem.


Regards.
//frank

17 feb 2007 kl. 21.49 skrev Peter Lauri:


Hi,

I am executing exec('some cool command', $stdout, $exitcode);

That is fine. I get what I in the beginning wanted. However, now I  
need to
catch the STDERR that the command is generating as well. Some of  
you might
tell me to redirect STDERR to STDOUT, but that is not possible as I  
need to

use the STDOUT as is to automate a process.

I know I can do fwrite(STDERR, 'Output some error\n');

So could I fread(STDERR, SOMESIZE)?

Is there anyone with experience of best way of doing this? Should I  
maybe
use proc_open or something similar and then write it to a file, and  
then

read that file? Hrm, doesn’t make any sense to do that.

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free

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



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



Re: [PHP] Multi lingual pages

2007-02-09 Thread Frank Arensmeier

Anyone?

//frank
8 feb 2007 kl. 11.24 skrev Frank Arensmeier:


Hello.

I would like to hook up on this issue a little bit more. I am  
wondering if anybody is willing to share some good advices  
regarding how to implement a good (normative) url structure so to  
say when it comes to multi lingual sites. Let me give you an example.


IBM has many different domains including .se, .de, .com, .es and so  
on. But, all local domains are redirected to e.g. www.ibm.com/de or  
www.ibm.com/se and so on. Is this common practise? Right now, I  
am about to restructure my employers site. But, in contrast to for  
example the IBM site, I would like to bind the content to the  
corresponding domain - without redirecting the visitor. All english  
content for example will be under the .com domain, all swedish  
content will be under .se domain. Hope you see what I mean.


I am not seeking advices about how to implement such a structure (I  
have done this already). I am more interested in pros and cons with  
either way. My hope is that the site will be more Google friendly.


Am I making sense? I might also add that I read some articles from  
W3 org about localization / internationalization, but I couldn't  
find anything useful so far.


What is your opinion?

regards,

//frank


27 jan 2007 kl. 01.12 skrev Jochem Maas:


Otto Wyss wrote:

Paul Novitski wrote:

I formulated my question in general since I couldn't find an other
message here about supporting multiple languages.


http://www.w3.org/International/articles/

http://www.w3.org/TR/i18n-html-tech-lang/

http://php.net/setlocale


Thanks a lot, these are good points for reading.


1) Switching language downloads a new version of the current page,
generally with the same markup but new text.  Example:
http://partcon.ca/

I'll favor this way especially if several languages have to be  
provided.



In both cases I store the text in database tables that contain a
language field I can select on to match the user's request.


I wonder if retrieving static texts from the database draws too much
performance. I know from somebody who stores texts in large data  
arrays

an uses shared memory, yet I haven't figured it out how.

I consider storing static texts as defines and just load a different
definition file when the user switches language. Is this practical?


don't go down the define('LANG_KEY', 'lang string value'); route -  
defines
are comparatively SLOW to create. IF you go down the road of  
loading in text
from 'per lang' files I would suggest using an array as the  
storage mechanism:


$Lang = array(
'LANG_KEY' = 'lang string value',
// .. etc
);

assoc array are much less heavy to create.

also consider that there are, imho, 2 kinds of language specific  
data:


1. 'static' values - button texts, [error] messages - these are  
specified during site/application

design.

2. 'dynamic' values - document titles, headers, content - these  
are specified by the owner/user during

the lifetime of the site/application

for the rest I'll just say 'ditto' to most of what the other list  
members replied :-)




O. Wyss



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




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



Re: [PHP] Multi lingual pages

2007-02-09 Thread Frank Arensmeier

Thank you Paul for your comments - very valuable!

//frank
9 feb 2007 kl. 10.08 skrev Paul Novitski:




8 feb 2007 kl. 11.24 skrev Frank Arensmeier:


I would like to hook up on this issue a little bit more. I am
wondering if anybody is willing to share some good advices
regarding how to implement a good (normative) url structure so to
say when it comes to multi lingual sites. Let me give you an  
example.


IBM has many different domains including .se, .de, .com, .es and so
on. But, all local domains are redirected to e.g. www.ibm.com/de or
www.ibm.com/se and so on. Is this common practise? Right now, I
am about to restructure my employers site. But, in contrast to for
example the IBM site, I would like to bind the content to the
corresponding domain - without redirecting the visitor. All english
content for example will be under the .com domain, all swedish
content will be under .se domain. Hope you see what I mean.

I am not seeking advices about how to implement such a structure (I
have done this already). I am more interested in pros and cons with
either way. My hope is that the site will be more Google friendly.



My initial thought is that it will be confusing if you use national  
TLDs instead of ISO language codes.  I see national TLDs as  
national indicators, not linguistic ones.  I think it's appropriate  
to use a series of national TLDs for the branches of an  
international organization in various countries, but I don't see  
the one-to-one correlation between nations and languages that  
you're reaching for.  Although using country codes or flags to  
represent languages might appear to work well with a very small and  
select sampling, it breaks down quickly when you include more groups.


Maybe what would serve you better would be language-specific sub- 
domains, e.g.:


sv.example.com (website in Swedish)

contrasted with:

example.se (website in Sweden)

See:

IS0 639-2
Alpha-3 codes arranged alphabetically by the English name of language
http://www.loc.gov/standards/iso639-2/php/English_list.php

By the way, because your question is not how to implement such a  
system in PHP, perhaps this topic isn't really appropriate for this  
list.  I'd suggest taking it to one of these:


multiweb.googlegroups.com
Webdesign-L
WSG (Web Standards Group)

Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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



Re: [PHP] Multi lingual pages

2007-02-09 Thread Frank Arensmeier

Thank you Robert.

Actually, I am not so sure anymore if my idea of binding localized  
content to domains is the right path to go. After a litte research, I  
saw that many of the major sites out there are redirecting the user  
to subfolders. Maybe this is the right thing to do. What would happen  
if a page is available in English and e.g. american English or when a  
certain domain is not available?


Right now I am playing with mod_rewrite. Looks promising.
//frank

9 feb 2007 kl. 13.23 skrev Robert Cummings:


On Fri, 2007-02-09 at 09:03 +0100, Frank Arensmeier wrote:

Anyone?


If you use top level domains like that then if someone wants to swith
between languages you won't be able to share session information  
without

employing session propogation tricks.

Cheers,
Rob.



//frank
8 feb 2007 kl. 11.24 skrev Frank Arensmeier:


Hello.

I would like to hook up on this issue a little bit more. I am
wondering if anybody is willing to share some good advices
regarding how to implement a good (normative) url structure so to
say when it comes to multi lingual sites. Let me give you an  
example.


IBM has many different domains including .se, .de, .com, .es and so
on. But, all local domains are redirected to e.g. www.ibm.com/de or
www.ibm.com/se and so on. Is this common practise? Right now, I
am about to restructure my employers site. But, in contrast to for
example the IBM site, I would like to bind the content to the
corresponding domain - without redirecting the visitor. All english
content for example will be under the .com domain, all swedish
content will be under .se domain. Hope you see what I mean.

I am not seeking advices about how to implement such a structure (I
have done this already). I am more interested in pros and cons with
either way. My hope is that the site will be more Google friendly.

Am I making sense? I might also add that I read some articles from
W3 org about localization / internationalization, but I couldn't
find anything useful so far.

What is your opinion?

regards,

//frank


27 jan 2007 kl. 01.12 skrev Jochem Maas:


Otto Wyss wrote:

Paul Novitski wrote:

I formulated my question in general since I couldn't find an other
message here about supporting multiple languages.


http://www.w3.org/International/articles/

http://www.w3.org/TR/i18n-html-tech-lang/

http://php.net/setlocale


Thanks a lot, these are good points for reading.


1) Switching language downloads a new version of the current  
page,

generally with the same markup but new text.  Example:
http://partcon.ca/


I'll favor this way especially if several languages have to be
provided.


In both cases I store the text in database tables that contain a
language field I can select on to match the user's request.

I wonder if retrieving static texts from the database draws too  
much

performance. I know from somebody who stores texts in large data
arrays
an uses shared memory, yet I haven't figured it out how.

I consider storing static texts as defines and just load a  
different
definition file when the user switches language. Is this  
practical?


don't go down the define('LANG_KEY', 'lang string value'); route -
defines
are comparatively SLOW to create. IF you go down the road of
loading in text
from 'per lang' files I would suggest using an array as the
storage mechanism:

$Lang = array(
'LANG_KEY' = 'lang string value',
// .. etc
);

assoc array are much less heavy to create.

also consider that there are, imho, 2 kinds of language specific
data:

1. 'static' values - button texts, [error] messages - these are
specified during site/application
design.

2. 'dynamic' values - document titles, headers, content - these
are specified by the owner/user during
the lifetime of the site/application

for the rest I'll just say 'ditto' to most of what the other list
members replied :-)



O. Wyss



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





--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'



Frank Arensmeier
 


Marketing Support  Webmaster

NIKE Hydraulics AB
Box 1107
631 80 Eskilstuna
Sweden

phone +46 - (0)16 16 82 34
fax +46 - (0)16 13 93 16
[EMAIL PROTECTED]
www.nikehydraulics.se
 






Re: [PHP] Multi lingual pages

2007-02-09 Thread Frank Arensmeier

9 feb 2007 kl. 15.38 skrev Tim:





-Message d'origine-
De : Frank Arensmeier [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 9 février 2007 14:51
À : Robert Cummings
Cc : PHP List; Jochem Maas; Otto Wyss
Objet : Re: [PHP] Multi lingual pages

Thank you Robert.

Actually, I am not so sure anymore if my idea of binding
localized content to domains is the right path to go. After a
litte research, I saw that many of the major sites out there
are redirecting the user to subfolders.
As a question or maybe a comment i'm not sure which yet, but aren't  
those
major sites rewriting url's rather then redirecting the pages to  
different

folders?


Yes, of course. Maintaining such a site without rewriting urls would  
be a nightmare. When I said that those sites are redirecting users,  
I was thinking about response headers.


//frank



It seems they are usually using the same layout and design and the
content is essentially the same, so i thought it logical to  
concluded they
are using the same framework, i can't imagine using several copies  
of the
same framework to overcome language issues, which would be the case  
if they

were using seperate directories for languages, IMO.


Just a logical geuss, please correct me if I am mistaken ;)

Regards,
Tim


Maybe this is the
right thing to do. What would happen if a page is available
in English and e.g. american English or when a certain domain
is not available?

Right now I am playing with mod_rewrite. Looks promising.
//frank

9 feb 2007 kl. 13.23 skrev Robert Cummings:


On Fri, 2007-02-09 at 09:03 +0100, Frank Arensmeier wrote:

Anyone?


If you use top level domains like that then if someone

wants to swith

between languages you won't be able to share session information
without employing session propogation tricks.

Cheers,
Rob.



//frank
8 feb 2007 kl. 11.24 skrev Frank Arensmeier:


Hello.

I would like to hook up on this issue a little bit more. I am
wondering if anybody is willing to share some good

advices regarding

how to implement a good (normative) url structure so to

say when it

comes to multi lingual sites. Let me give you an example.

IBM has many different domains including .se, .de, .com,

.es and so

on. But, all local domains are redirected to e.g.

www.ibm.com/de or

www.ibm.com/se and so on. Is this common practise?

Right now, I am

about to restructure my employers site. But, in contrast to for
example the IBM site, I would like to bind the content to the
corresponding domain - without redirecting the visitor.

All english

content for example will be under the .com domain, all swedish
content will be under .se domain. Hope you see what I mean.

I am not seeking advices about how to implement such a

structure (I

have done this already). I am more interested in pros and

cons with

either way. My hope is that the site will be more Google friendly.

Am I making sense? I might also add that I read some articles from
W3 org about localization / internationalization, but I couldn't
find anything useful so far.

What is your opinion?

regards,

//frank


27 jan 2007 kl. 01.12 skrev Jochem Maas:


Otto Wyss wrote:

Paul Novitski wrote:

I formulated my question in general since I couldn't

find an other

message here about supporting multiple languages.


http://www.w3.org/International/articles/

http://www.w3.org/TR/i18n-html-tech-lang/

http://php.net/setlocale


Thanks a lot, these are good points for reading.


1) Switching language downloads a new version of the current
page, generally with the same markup but new text.  Example:
http://partcon.ca/


I'll favor this way especially if several languages have to be
provided.


In both cases I store the text in database tables that

contain a

language field I can select on to match the user's request.


I wonder if retrieving static texts from the database draws too
much performance. I know from somebody who stores texts

in large

data arrays an uses shared memory, yet I haven't figured it out
how.

I consider storing static texts as defines and just load a
different definition file when the user switches

language. Is this

practical?


don't go down the define('LANG_KEY', 'lang string

value'); route -

defines are comparatively SLOW to create. IF you go down

the road

of loading in text from 'per lang' files I would suggest

using an

array as the storage mechanism:

$Lang = array(
'LANG_KEY' = 'lang string value',
// .. etc
);

assoc array are much less heavy to create.

also consider that there are, imho, 2 kinds of language specific
data:

1. 'static' values - button texts, [error] messages - these are
specified during site/application design.

2. 'dynamic' values - document titles, headers, content

- these are

specified by the owner/user during the lifetime of the
site/application

for the rest I'll just say 'ditto' to most of what the

other list

members replied :-)



O. Wyss



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

Re: [PHP] Multi lingual pages

2007-02-08 Thread Frank Arensmeier

Hello.

I would like to hook up on this issue a little bit more. I am  
wondering if anybody is willing to share some good advices regarding  
how to implement a good (normative) url structure so to say when it  
comes to multi lingual sites. Let me give you an example.


IBM has many different domains including .se, .de, .com, .es and so  
on. But, all local domains are redirected to e.g. www.ibm.com/de or  
www.ibm.com/se and so on. Is this common practise? Right now, I am  
about to restructure my employers site. But, in contrast to for  
example the IBM site, I would like to bind the content to the  
corresponding domain - without redirecting the visitor. All english  
content for example will be under the .com domain, all swedish  
content will be under .se domain. Hope you see what I mean.


I am not seeking advices about how to implement such a structure (I  
have done this already). I am more interested in pros and cons with  
either way. My hope is that the site will be more Google friendly.


Am I making sense? I might also add that I read some articles from W3  
org about localization / internationalization, but I couldn't find  
anything useful so far.


What is your opinion?

regards,

//frank


27 jan 2007 kl. 01.12 skrev Jochem Maas:


Otto Wyss wrote:

Paul Novitski wrote:

I formulated my question in general since I couldn't find an other
message here about supporting multiple languages.


http://www.w3.org/International/articles/

http://www.w3.org/TR/i18n-html-tech-lang/

http://php.net/setlocale


Thanks a lot, these are good points for reading.


1) Switching language downloads a new version of the current page,
generally with the same markup but new text.  Example:
http://partcon.ca/

I'll favor this way especially if several languages have to be  
provided.



In both cases I store the text in database tables that contain a
language field I can select on to match the user's request.


I wonder if retrieving static texts from the database draws too much
performance. I know from somebody who stores texts in large data  
arrays

an uses shared memory, yet I haven't figured it out how.

I consider storing static texts as defines and just load a different
definition file when the user switches language. Is this practical?


don't go down the define('LANG_KEY', 'lang string value'); route -  
defines
are comparatively SLOW to create. IF you go down the road of  
loading in text
from 'per lang' files I would suggest using an array as the storage  
mechanism:


$Lang = array(
'LANG_KEY' = 'lang string value',
// .. etc
);

assoc array are much less heavy to create.

also consider that there are, imho, 2 kinds of language specific data:

1. 'static' values - button texts, [error] messages - these are  
specified during site/application

design.

2. 'dynamic' values - document titles, headers, content - these are  
specified by the owner/user during

the lifetime of the site/application

for the rest I'll just say 'ditto' to most of what the other list  
members replied :-)




O. Wyss



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



Frank Arensmeier
 


Marketing Support  Webmaster

NIKE Hydraulics AB
Box 1107
631 80 Eskilstuna
Sweden

phone +46 - (0)16 16 82 34
fax +46 - (0)16 13 93 16
[EMAIL PROTECTED]
www.nikehydraulics.se
 






Re: [PHP] Opera advice needed!

2007-02-07 Thread Frank Arensmeier

7 feb 2007 kl. 09.50 skrev William Stokes:

If there's an opera expert around could you please check out the  
following

link:

http://www.fcviikingit.com/new/testimenu.php

This script contacts a DB and prints out the results as javascript  
to the
client browser. As I mentioned earlier It works ok with IE, FF,  
Netscape but
not with Opera. However the same script works with all mentioned  
browsers on

my test server.

I can't get this sorted!
Thanks
-W



Opera 9.02 on Mac OS is fine, as far I can tell. However, I would  
start by validating your html source.

Right now, your html code is little bit messed up.

http://validator.w3.org/check?uri=http%3A%2F%2Fwww.fcviikingit.com% 
2Fnew%2Ftestimenu.php

//frank


Roman Neuhauser [EMAIL PROTECTED] kirjoitti
viestissä:[EMAIL PROTECTED]

# [EMAIL PROTECTED] / 2007-02-07 08:32:47 +0200:

Hello,

I just noticed when I published a new menu system that it does  
NOT work

in
the ISP hosted server. However it works ok on my test server.  
Here's the

test I have done all in same client machine (=unchanged browser
settings):

My test server:
IE6  7-OK
Opera 9.02 - OK
Firefox -OK

ISP server:
IE6  7-OK
Opera 9.02 - DOES NOT WORK!
Firefox -OK

The system relies on JS also I can see from the browser source  
code that

all
PHP has printed out all JS like it should but the menu is not  
printed to
browser. Could you give me some pointers how to troubleshoot  
this? It

must
be something server related but not folder or file rights  
according to my

testing.


Might be a content-type issue.  http://www.wireshark.org/

--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991


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



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



Re: [PHP] Regular Expression

2007-02-05 Thread Frank Arensmeier

5 feb 2007 kl. 22.12 skrev H.T:


Do you know good regular expression editor or something simialar?

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


Regex online: www.regextester.com
//frank

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



Re: [PHP] Ongoing encoding issues

2007-01-26 Thread Frank Arensmeier

Hi Dave.

I don't think you are able to detect your users character encoding  
with php only (at least not rock-solid). Just some days ago, there  
was a discussion about that issue (at least concerning Safari) on the  
Apple web dev mailing list.


Have a look at:
http://lists.apple.com/archives/web-dev/2007/Jan/msg00038.html

I could be possible to send some information about character encoding  
along with the user submitted post data to your php script as well.  
Depending on that encoding, do some string replace on your input data.


Have you provided a valid charset encoding in your html?

Maybe you could give us a link to a test page?

//frank

26 jan 2007 kl. 10.33 skrev Dave Goodchild:

Hi all, I posted a question a couple of days ago regarding a web  
app I have
wherein users are able to indicated prices and concessions via a  
text field,
and the resulting encoding issues I have experienced, the main one  
being
seeing the pound sign as £ if viewing the results in a browser  
with the

encoding set to Latin-1.

My question is, how do I overcome this. If I set my browser  
encoding to
Latin-1 and enter the data I get that odd symbol, if I set it to  
UTF-8 I get
clean data. Is there a way to sniff out what encoding the browser  
is using

and then clean the data in any way.

I am googling for help also but you guys have been so helpful in  
the past I

thought I'd try you also.

--
http://www.web-buddha.co.uk


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



Re: [PHP] Encoding issue with £

2007-01-24 Thread Frank Arensmeier

23 jan 2007 kl. 18.55 skrev Dave Goodchild:

This may be more of a mysql issue, but I am using php for my app so  
here

goes...

I have a fee field in the database, and when users post events they  
can
specify entrance fee in £. In some, not all, of the fields I am  
getting, for

example, £7 rather than £. Is this an encoding issue?

Many thanks in advance...

--
http://www.web-buddha.co.uk

Dave,

Maybe you already noticed that the first two letters of £7 are the  
UTF8 encoded pound sign. But where the 7 is coming from, I do not  
know. Does the data come from a html form? A select list? Do you have  
a valid html encoding specified for your html code? I would begin by  
looking at the source where the data is coming from. In order to  
track the bug, maybe (temporarily) you could have a db where you  
would strore a var_dump on posted data together with a var_dump on  
$_SERVER. It might be possible as well to get some information about  
the users curent browser encoding by using some java script? This  
information might give you some help in narrowing down the source of  
your problem.


Otherwise, why not give your user predefined currencies to choose  
from? A simple select list would do the trick.


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



Re: [PHP] Validating a link in php

2007-01-24 Thread Frank Arensmeier

25 jan 2007 kl. 07.06 skrev [EMAIL PROTECTED]:


Richard Lynch wrote:

I dunno what you did wrong with fsockopen...


First of all, thanks for taking the time to respond.

I had tried fsockopen, but here's the problem.  The
following calls work as expected, returning a valid file
pointer for valid urls and FALSE for invalid urls:

$fp = fsockopen(www.example.com, 80, $errno, $errstr, 30);
$fp = fsockopen(www.youtube.com, 80, $errno, $errstr, 30);
$fp = fsockopen(www.this_url_is_not_valid.com, 80, $errno,  
$errstr, 30);


The call below does not work and always returns FALSE.
If I enter the url in a web browser, it works fine, but
fsockopen does not like it.

$fp = fsockopen(www.youtube.com/v/JqO8ZevPJNk, 80, $errno,  
$errstr, 30);


I think it has something to do with the way YouTube
works.  Any clues?

Did you take a look at the error numbers / messages returned by  
fsockopen? What do they say? I can't see any problems with your code  
either. So, either the call gets stuck maybe due to some  
configuration on your machine (you can simply test it by changing you  
fsockopen call to e.g. www.php.net - or your lolcalhost), or - as you  
already mentioned - it is youTube that blocks your calls in some way  
(therefore, error message might give you a clue why).


Another thing that poped up in my mind - curl. Tried that?

//frank


Robert Porter

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



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



Re: [PHP] I lied, another question / problem

2007-01-16 Thread Frank Arensmeier

I believe that only two things could be messing up your validation:

a) input data
b) your function

a) Do a var_dump on your input data. Is there any white space  
characters or anything else that do not belong there in the string?
b) Rewrite your function/rethink what you are doing. You said that  
your function should match letters from a to Z and some special  
characters like ' - _ .


Try this regex:

^(\w+\s?[\'\-\_\.]?)+$

I would write the function as follows:

function invalidchar ( $input )
{
	if ( preg_match ( ^(\w+\s?[\'\-\_\.]?)+$, $input ) ) { // string  
matches against the pattern, everything is ok

return $input;
} else {
return false;
}
}
if ( invalidchar ( $my_string ) == false ) {
// do some stuff
} else {
echo You passed the test;
}

// untested
// frank


16 jan 2007 kl. 04.47 skrev Beauford:

My apologies, but I am just so frustrated right now. It seems my  
function
doesn't work either (if that's even the problem, which at this time  
I just
don't know). Somehow my variable is still getting a value, and I  
have no
idea how. Even if I don't return anything it still gets a value.  
Basically

this has just broken my whole site.

If anyone can figure this out let me know, right now I just have to  
put this

site up with no validation.

Thanks



-Original Message-
From: Beauford
Sent: January 15, 2007 10:26 PM
To: 'PHP'
Subject: RE: [PHP] I lied, another question / problem

Does anyone have any idea to this problem? All the code is in
the emails I have written to the list. I have temporarily
solved the problem by writing my own function not using any
pregs, eregs, or any other regs and it works perfectly. It's
probably not considered good programming, but it works the
way it is supposed to.

I would however like to know what the issue is with the
original code, or if this is actually a bug in PHP.

Thanks


-Original Message-
From: Beauford [mailto:[EMAIL PROTECTED]
Sent: January 15, 2007 7:22 PM
To: 'PHP'
Subject: RE: [PHP] I lied, another question / problem




-Original Message-
From: 'Roman Neuhauser' [mailto:[EMAIL PROTECTED]
Sent: January 15, 2007 7:53 PM
To: Beauford
Cc: 'PHP'
Subject: Re: [PHP] I lied, another question / problem

# [EMAIL PROTECTED] / 2007-01-15 18:33:31 -0500:

From: Roman Neuhauser [mailto:[EMAIL PROTECTED] #
[EMAIL PROTECTED] / 2007-01-15 16:31:32 -0500:

I have file which I use for validating which includes the
following
function:

function invalidchar($strvalue) {
if(!ereg(^[[:alpha:][:space:]\'-.]*$, $strvalue)) {


That regexp matches if $strvalue consists of zero or more

ocurrences

of a letter, a whitespace character, and any character

whose numeric

value lies between the numeric values of ' and . in

your locale.

Zero or more means it also matches an empty string.


I'm still confused. This works perfectly on my other two

pages with

the exact same code. So why is it only this one page that

is causing a problem?

I don't know, I don't care. You have enough problems with

the single

regex, let's concentrate on fixing this first.


This certainly has a bearing. If the code works here then there is
nothing wrong with the code. There is something else going on.


If I enter the word test in my form, without the quotes,

then why is

the fuction returning anything since this is a valid entry.

Should it

not only return a value if there is a problem.


I don't understand that paragraph. The regexp matches, and the
function returns *nothing* just as you programmed it.
That, of course, means that the variable you are assigning this
*nothing* gets set to *nothing*, which, in PHP lingo, is null.


The problem is that it is returning *something*, and that's

what I am

trying to figure out.

If I put this in my code after I do the checking it works, but it
should not work if the function is retuning *nothing*.
So the original question remains, what is being returned and why?

If($formerror) echo Testing;  This will display Testing -

it should

not display anything since nothing should be returned.





All I want to accomplish here is to allow the user to enter

a to z, A

to Z, and /\'-_. and a space. Is there a better way to do this?


1. Do you really want to let them enter backslashes, or are

you trying

   to escape the apostrophe?
2. Does that mean that /\'-_. (without the quotes) and 

  (that's

   three spaces) are valid entries?


Where do you see 3 spaces? In any event, I don't think this is the
problem.
As I have said the code works fine on two other pages,

which logically

suggests that there is something on this page that is causing a
problem.

Thanks

--
PHP General Mailing List (http://www.php.net/) To

unsubscribe, visit:

http://www.php.net/unsub.php





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





Re: [PHP] file_get_contents gets 404 error

2007-01-11 Thread Frank Arensmeier

In the manual it says:

You can use a URL as a filename with this function if the fopen  
wrappers have been enabled


First of all, I would check your php.ini file. If everything is ok  
(fopen wrappers are on), maybe you could post some code. The last  
option would be to use an other way round by using e.g. curl or  
anything else. If anybody else is able to open the URL you provided,  
it must be either you code or your server / PHP config that is  
messing things up.


//frank
11 jan 2007 kl. 17.01 skrev Németh Zoltán:


2007. 01. 11, csütörtök keltezéssel 16.55-kor Jochem Maas ezt írta:

Németh Zoltán wrote:

Hi all,

I have some php websites, for example http://www.alterationx.hu/

Now I'm trying to get the site with file_get_contents, and I'm  
getting

this error:

Warning: file_get_contents(http://www.alterationx.hu/): failed to  
open

stream: HTTP request failed! HTTP/1.1 404 Not Found


try this?:

file_get_contents(http://www.alterationx.hu/index.php;);

(it works for me. that said it works for me without the  
'index.php' at the end also.)


I tried this also, and get the same error still...



also check you logs on the site in question to figure out what  
exactly is going

on (i.e. what is being requested, if anything).


Yes, I'll contact our system administrator to check the apache logs

Thanks
Zoltán Németh





can anyone tell me why?

The site otherwise is working, and also getting other sites (not  
php) on

the same server with file_get_contents is working.

Thanks in advance
Zoltán Németh





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



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



Re: [PHP] Weird behaviour with IE

2007-01-11 Thread Frank Arensmeier
And where does PHP come in here? The issue you describe could be  
anything - CSS related, html related, server related, php / asp /  
java you name it - maybe it is MS Explorer that sucks. Do some more  
research first and then - if you still feel that this might be  
related to PHP, you are welcome back again.


//frank

11 jan 2007 kl. 17.54 skrev André Medeiros:


Hi list.

I know this may be a bit out of topic, but I've decided to try.

This website I'm maintaining opens just fine in firefox, and loads
everything. However, the same doesn't happen in IE, since the status
bar reads 1 item(s) remaining on most of the pages.

That issue raises another problem, because I really need that onLoad
event to be fired ;)

Has anyone had problems like this? What did you do to solve them?

Thanks in advance,
André

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



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



Re: [PHP] help with \n\r in strings

2006-12-29 Thread Frank Arensmeier

If you just want to test for \n\r -

if ( substr ( -2, $my_string ) == \n\r ) { // substr with the  
negative value of 2 will give you the last two characters of your string

// do some stuff
}

I think it would be a good idea to explain a little bit more what you  
are trying to accomplish. Are you preparing the string for a database  
insert? Do you want to sanitise the string?


Stripping off those kind of characters can also be done with trim (or  
ltrim - trims white space characters from the left of the string or  
rtim - trims from the right). Read the manual for more details and  
options.


If you are not quite sure what those characters are, you can find out  
with this little helper.


$characters = preg_split( '//', $my_string );
foreach ( $characters as $character ) {
	echo ASCI value of the character {$character} is:  . ord  
( $character ) . br /\n;

}

Then you can look up the values in a ASCI table.

/frank


29 dec 2006 kl. 11.01 skrev Peter Lauri:


Try:

$string_as_array = explode(\n, $string);

echo pre;
print_r($string_as_array);
echo /pre;

The array that you get will contain segments of the string that is  
separated

with \n. Let me know if that helps.

Best regards,
Peter Lauri

www.dwsasia.com  - company web site
www.lauri.se  - personal web site
www.carbonfree.org.uk  - become Carbon Free

-Original Message-
From: Angelo Zanetti [mailto:[EMAIL PROTECTED]
Sent: Friday, December 29, 2006 10:43 AM
To: PHP List
Subject: [PHP] help with \n\r in strings

Hi all,

I receive a text file with a whole bunch of strings. and each line is
terminated by what I presume is \n\r however when I read the string  
into

PHP, it seems that the last column of the row and the first column of
the next row are connected but it appears as a space but I've done all
kinds of tests like $spacePos = strrpos($dateAmount, ' '); but this is
always empty.

So is there a way to test for \r\n? or what else can I use to delimit
these two values (last column of row and first column of next row)?

Thanks in advance.

Angelo

--
-- 
--

Angelo Zanetti
Systems developer
-- 
--


*Telephone:* +27 (021) 469 1052
*Mobile:*   +27 (0) 72 441 3355
*Fax:*+27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]

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

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



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



Re: [PHP] Re: pattern containing single quote in IF statement

2006-12-26 Thread Frank Arensmeier
First of all, I strongly feel that you should have double quotes  
around the string you like to compare with (e.g. new). Otherwise,  
you are comparing against a string but to something else (integer ?).  
Without quotes, PHP will throw an error (not sure if it will throw a  
fatal error or something else). Second, do a var_dump on $_GET 
['query']. What do you get? (white space before, after the string?  
encodes quotes?) You may also look at the function strcasecmp, which  
is little more elegant than your solution, in my opinion.


Regarding your question about multiple OR, I would do something like:

$things_to_look_for = array ( new, newday ... and so on);
if ( in_array ( $_GET['query'], $things_to_look_for ) ) {
// do some stuff
}

/frank

26 dec 2006 kl. 14.42 skrev Jahangir:


I tried that also but it didnt work.
if($_GET['query']==some'u'all)
{ filter($query);}
I still get the same error.

Jahangir [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I am stuck at a wierd problem. I am trying to do comparision  
between a

query string and a string value. the string consists of some
diacriticals and single quotes.
But when i try to escape the single quotes using backshash (\) it  
doesnt
work. and when i try to use it inside a double quote preg_replace 
() doesnt

recognise the code.
why is php not comaparing string with single quotes??

here is the code:
 if($_GET['query']==new)
 { filter($query);}
 elseif($_GET['query']==some'u'all)
 { filter($query);}
 elseif($_GET['query']==all'u'ppl)
 { filter($query);}

 function filter($query)
 {
 $pattern = array ('/new/','/some'u'all/','/all'u'ppl/');
 $rep = array (new way,Some of you all ,all of you);
 $op = preg_replace($pattern,$rep,$_GET['query']);
 echo brnew value $op;
}


also i wanted to just clarify is there a way of using multiple  
OR's in the

same if condition
i.e if(($_GET['query]')==new||newday||newtime||newbeginning|| 
newthing)

{
// fn here;
}


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



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



Re: [PHP] Tidy HTML source?

2006-11-28 Thread Frank Arensmeier
As Richard already pointed out, ugly code can be a real problem  
occasionally. Besides that, I assume that you have some kind of  
coding standrad for your PHP code already, right? Basically, why do  
someone would make a difference between pretty styled PHP code and  
pretty styled html/CSS? Be consistent!


/frank

28 nov 2006 kl. 04.13 skrev Mark Kelly:


On Monday 27 November 2006 17:10, Mark Kelly wrote:

Am I crazy to make an extra effort in my code to make the  
generated HTML

pretty?


Thanks everyone for your thoughts on this - I'm quite relieved that  
I'm not
the only one who sits and tweaks so that the HTML is nice and  
readable.


It just struck me that trying to make my PHP spit out page source that
looks like it was made lovingly by hand was perhaps the work of an
obsessive.

Now I know that even if it is, I'm not alone :)

Cheers!

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




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



Re: [PHP] Attaching File to be Emailed

2006-11-24 Thread Frank Arensmeier
I think the OP was about how to send e-mail attachments - not a  
question about send a file to the client browser...


1) Read the manual about the function mail (especially the user notes)
http://se2.php.net/manual/en/ref.mail.php
2) Google for e.g. php mail attachment

Come back to this list when you have further questions.

/frank
24 nov 2006 kl. 06.30 skrev Travis Doherty:


[EMAIL PROTECTED] wrote:


I need to take a word document or pdf file from either a MySQL db or
from a
directory, which will then be sent via php script.  How can I go  
about

doing
this?  Can anyone provide sample code or point me in the right  
direction.


Brian Dunning started a thread about nine minutes before you on  
sending

a file to the browser. Serving out a file to Firefox ... headers?
That's pretty much all you need to do to read from a file (adding in
whatever fixes the problem he is experiencing with FireFox of course.)

If you wanted to store the data in a MySQL database it would be the  
same

procedure, except you would query the database (BLOB column type) and
echo that data instead of using readfile() to get your data.

Travis

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




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



[PHP] Update function for content of existing CD?

2006-11-17 Thread Frank Arensmeier

Hello all.

I am looking for some ideas on how to design / structure a script  
which checks for updates on files on a existing CD ROM.


Every week, I generate content for a CD ROM containing a large number  
of html pages and PDF files (the CD is distributed to 20 - 30 dealers  
for ours) . The PHP script which is doing this is outputting a ZIP  
compressed archive. This ZIP file is then unpacked and burned on a  
CD. I am now playing with the idea to provide a check-for-updates  
function on the CD. Because the ZIP archives are rather large in size  
(300 MB), I am not able to keep all ZIP files. One or two months back  
is ok. My idea is to have a db table on MySQL containing  checksums  
for all files of the archive and have a script that is able to  
compare those lists. (one ZIP archive has about 400 - 500 files)


My idea is:
On the CD's start page I could have a link like: http://myserver.com/ 
look_for_updates.php?myArchiveName=2006-11-10


The script will then compare checksums for the files included in the  
archive 2006-11-10 and checksums for the recent file list. It then  
outputs a new ZIP file including new and updated files. Do you think  
that there is another (more elegant) way for doing this? Keep in mind  
that a ZIP file contains about 400-500 files which means that the  
table would grow rapidly week by week. In only one year the table  
would contain roughly 25000 rows of data.


/frank

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



Re: [PHP] php cli and mysql

2006-11-15 Thread Frank Arensmeier
FYI - the problem with mysql.sock has been an support issue at  
apple.com before.


http://docs.info.apple.com/article.html?artnum=301457

/frank

15 nov 2006 kl. 11.03 skrev Roman Neuhauser:


# [EMAIL PROTECTED] / 2006-11-14 18:56:01 -0500:

Roman Neuhauser wrote:

# [EMAIL PROTECTED] / 2006-11-14 20:17:16 +0200:


On 11/14/06, James Tu [EMAIL PROTECTED] wrote:

I'm running a php script from the command line (I'm on OS X)  
and I'm

getting ...

Warning: mysql_connect(): Can't connect to local MySQL server  
through

socket '/var/mysql/mysql.sock' (2)


touch /var/mysql/mysql.sock
chmod 777 /var/mysql/mysql.sock


   How could that possibly help?

Because if the mysql.sock file is missing the mysql server won't  
start.
If the mysql server isn't running the PHP script won't work. So I  
think

it helps a lot.


He didn't have trouble running the mysql server (in fact the
original message said the same script worked when run from  
apache).

So even if the file was there mysql wouldn't listen on it.

--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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




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



Re: [PHP] Read Through PHP Files

2006-11-10 Thread Frank Arensmeier

There are search engins written in PHP available already. E.g. PHPdig.

http://www.phpdig.net/

PHPdig for example is able to index PDF and doc files (I think - see  
the docs). Maybe it would also be a good idea to have a look at the  
source code.


/frank

/frank
10 nov 2006 kl. 14.50 skrev Thomas Munz:


 You cannnot just open those files. That things that you see are not
 'rubish' or whatever. Those files are in a binary format. You need to
 understand the .doc format and the .pdf format. You can get this
 infromation by using google and search for 'Binary word format'  
and so on.
 Then you have to parse the file with the HEX codes etc and so on.  
This is

 pretty complex and I'm sure you dont wanna do that :D. Maybe there is
 allready a libary also in PHP that does it for you.

 But in generaly, you have to think in a different way. If you dont
 unserstand what binary formats are and how to parse them, its  
pretty hard

 and its better if you dont try it :)

 on Friday 10 November 2006 11:55, Kevin wrote:

Hi,

I am using the function fopen to open a word document, loading the
contents into a variable and then using a substr_count to count the
number of times a certain string is found, this is allowing me to  
search
through the file and say how many times the word appears, I can  
even use
str_replace to highlight certain words. However Microsoft word  
seems to

put a lot of rubbish in the header and footer, I am wondering is it
possible to filter this rubbish out to get the exact document.

I also tried using fopen to open a PDF file, but as PDF is handled
differently it came up completely different with no words at all,  
just

full of rubbish. Is there anyway I can get this information using a
simple fopen?

I am basically trying to create a search engine which can read within
files similar to google. The only problem I would have after I  
have done

all this is actually weighting the search results, however I would
probably have to create the results first and then finally go through
the results to try to weight them.

Does anyone else have any experience in this or could help me out  
with

any of the problems I am having?

Thanks

Kevin


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




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



Re: [PHP] why so slow?

2006-11-01 Thread Frank Arensmeier

Bad day?

/frank

1 nov 2006 kl. 09.55 skrev Mel:


Could you think of why my site loads so slowly?

http://www.squareinch.net/home.php


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



Re: [PHP] why so slow?

2006-11-01 Thread Frank Arensmeier
Maybe it's the 18 k of JavaScript from Google that slows your page  
down? Why not load this script locally from your server?


/frank

1 nov 2006 kl. 10.26 skrev Mel:


So do you mean that's it is ok and not slow?

On Nov 1, 2006, at 1:09 AM, Robert Cummings wrote:


On Wed, 2006-11-01 at 00:55 -0800, Mel wrote:

Could you think of why my site loads so slowly?

http://www.squareinch.net/home.php


That's a bit like asking us to read your mind. We'd only be guessing
since we can't see your code and you haven't told us what your site
does.

What I can say is that it's probably not reverse DNS since my  
first page
load was about 8 seconds, my second was about .5 seconds, and my  
third

was about 6 seconds.

Cheers,
Rob.
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'



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




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



Re: [PHP] why so slow?

2006-11-01 Thread Frank Arensmeier
My suggestion: stripp out the JS from Google. Test you page again.  
Should the page load as slowly as before, it might have to do with  
PHP. Then, give us more details about your script)


/frank

1 nov 2006 kl. 10.53 skrev Robert Cummings:


On Wed, 2006-11-01 at 01:26 -0800, Mel wrote:

So do you mean that's it is ok and not slow?


I'm saying we can't ascertain why it's so slow since we don't have
enough information.

Cheers,
Rob.
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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




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



Fwd: [PHP] why so slow?

2006-11-01 Thread Frank Arensmeier

Please send a CC of your answer to the PHP list as well...

/frank

Vidarebefordrat brev:


Från: Toby Osbourn [EMAIL PROTECTED]
Datum: onsdag 1 nov 2006 10.57.17 GMT+01:00
Till: Frank Arensmeier [EMAIL PROTECTED]
Ämne: Re: [PHP] why so slow?

Yeah it will be that hit counter or whatever it is you are trying  
to load - I had one myself that used JS and was hosted on another  
website and held up the page it was on by a good 3-4 seconds, and  
that was on a good day.


On 01/11/06, Frank Arensmeier [EMAIL PROTECTED]  
wrote:

Maybe it's the 18 k of JavaScript from Google that slows your page
down? Why not load this script locally from your server?

/frank

1 nov 2006 kl. 10.26 skrev Mel:

 So do you mean that's it is ok and not slow?

 On Nov 1, 2006, at 1:09 AM, Robert Cummings wrote:

 On Wed, 2006-11-01 at 00:55 -0800, Mel wrote:
 Could you think of why my site loads so slowly?

 http://www.squareinch.net/home.php

 That's a bit like asking us to read your mind. We'd only be  
guessing

 since we can't see your code and you haven't told us what your site
 does.

 What I can say is that it's probably not reverse DNS since my
 first page
 load was about 8 seconds, my second was about .5 seconds, and my
 third
 was about 6 seconds.

 Cheers,
 Rob.
 --
 ..
 | InterJinn Application Framework - http://www.interjinn.com |
 ::
 | An application and templating framework for PHP. Boasting  |
 | a powerful, scalable system for accessing system services  |
 | such as forms, properties, sessions, and caches. InterJinn |
 | also provides an extremely flexible architecture for   |
 | creating re-usable components quickly and easily.  |
 `'


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



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




--
http://www.borninblood.co.uk




Re: [PHP] why so slow?

2006-11-01 Thread Frank Arensmeier

Why do you have html tags before your doctype declaration?

Anyway, I am not sure if your problem has to do with PHP after all.  
Again, if you think that it is related to PHP, show us some code.  
There are still other things to consider (server, external files, CSS  
- neither of those things are necessarily related to PHP).


/frank


1 nov 2006 kl. 11.27 skrev Mel:


I took the Google stuff out. I can't tell if it's faster now.
I don't think it's very consistent. Sometimes it loads pretty fast  
and sometimes it gets stuck in the right corner!

I don't think I have seen this happen with any other site!

On Nov 1, 2006, at 2:12 AM, Frank Arensmeier wrote:

My suggestion: stripp out the JS from Google. Test you page again.  
Should the page load as slowly as before, it might have to do with  
PHP. Then, give us more details about your script)


/frank

1 nov 2006 kl. 10.53 skrev Robert Cummings:


On Wed, 2006-11-01 at 01:26 -0800, Mel wrote:

So do you mean that's it is ok and not slow?


I'm saying we can't ascertain why it's so slow since we don't have
enough information.

Cheers,
Rob.
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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






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




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



Re: [PHP] why so slow?

2006-11-01 Thread Frank Arensmeier
In fact, validator.w3.org validates the hmtl page at http:// 
www.squareinch.net/client_testing_html401.php as valid 4.01 html. So  
obviously, html comments are allowed before the doctype declaration.


Anyway, the page contains almost one hundred (haven't count them)  
totally unnecessary empty anchor tags ( span class='navText'a  
href='client_testing_html401.php?art='/a/span ) which shouldn't  
be there at all.


Once again - I can't see how the original problem is related to PHP.

/frank

1 nov 2006 kl. 20.45 skrev M.Sokolewicz:


No you have not, otherwise we would not be seeing:
!-- * start header --
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN  
http://www.w3.org/TR/html4/loose.dtd;


html
head

when we SHOULD be seeing
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN  
http://www.w3.org/TR/html4/loose.dtd;


html
head


- tul

Mel wrote:

I have
this is the page I am working on right now and it is valid html 4.01
http://www.squareinch.net/client_testing_html401.php
On Nov 1, 2006, at 5:32 AM, Dave Goodchild wrote:
Take out the comment before the DOCTYPE. There should be nothing  
before it.


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




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



Re: [PHP] PHP Template Trouble

2006-10-26 Thread Frank Arensmeier
Kevin, there is no need to post the same question three times to this  
list. Your chances on getting helpful responses won't increase.


The issue you describe is more related to Apache (assuming that you  
are on an Apache server) and URL rewriting than to PHP. Ask Google  
for Apache mod_rewrite and I am sure you will find some stuff that  
will help you.


/frank
25 okt 2006 kl. 11.49 skrev Kevin:


Hi,

I am trying to have 1 template site and have an unlimited number of
websites using this template site to call there own information.

The sites are exactly the same except for the database, each of the  
sites also needs there own URL, for example one of these urls may  
be www.example1.com and the other www.example2.com. These sites are  
identical apart from the database they call to, one will call to a  
database called example1 and the other example2. I want another  
site (for example www.solution.com) to read what url has been  
entered and to pull in the database for that site (either example1  
or example2) and show that information. I have tried using the CURL  
library without success (not sure how to use it fully) and have  
tried using frames but had loads of problems regarding losing  
session data. can anyone help?


Thanks
Kev



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



Re: [PHP] canon jpegs

2006-10-13 Thread Frank Arensmeier
It would be helpful for us if you could provide some detailed  
information about those jpeg pictures (resolution, color depth/ 
channel, color space etc.). Furthermore, do you get any error  
message? This would be helpful as well.


 /frank

13 okt 2006 kl. 03.24 skrev Ed Lazor:

Until someone has more specific information, my first thought was  
to wonder which version of PHP and GD you're using in case they  
aren't the latest and greatest.  If you're aren't, then I'd  
upgrade, retest, and go from there.  I'd also check to see if you  
run into the problem with images from your camera saved with  
different resolution and image quality settings.  Finally, you can  
also go to http://www.boutell.com/gd/ for more information on GD or  
to contact them for help.


On Oct 12, 2006, at 5:35 PM, Emil Edeholt wrote:


Hi!

I'm trying to make thumbnails of uploaded jpegs via GD. It works  
fine on most jpegs but doesn't seem to work on canon jpegs (tried  
both a consumer canon and one of the finer DSLRs). When I resaved  
the canon jpeg in my imaging application GD could handle it.


Any ideas of how to solve this? I'm in a bit of a panic.

Emil

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



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




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



Re: [PHP] ereg_replace with user defined function?

2006-10-11 Thread Frank Arensmeier


10 okt 2006 kl. 19.25 skrev Roman Neuhauser:


# [EMAIL PROTECTED] / 2006-10-09 22:01:34 +0200:

Thank you Ilaria and Roman for your input. I did not know that preg
is able to deal with PCRE patterns.


preg is obviously short for Perl REGular expressions, while
PCRE positively means Perl-Compatible Regular Expressions.
The regexp syntax from Perl is a superset of POSIX extended
regexps, so anything ereg_ function accept will be good for
preg_ as well (but beware of pattern delimiters).


Thanks for the info. I didn't know that.




As a matter of fact I came up
with the following solution (if someone is interested):


What problem does it solve? I mean, why are you trying to avoid
preg_replace_callback() in the first place?



Maybe because I didn't know better? Initially, I was using  
ereg_replace for replacing metric numbers with imperial ones. But  
obviously, ereg_replace replaces all instances in the given text  
string. A text containing more than one instance of the same unit,  
was replaced by the calculated replacement string of the first  
finding. So I had to think about other ways to do this - which  
brought me to preg_replace_callback (as I already said - I didn't  
know that preg takes POSIX patterns as well).


Would you suggest a different way? Would it be faster to do the  
replacement with preg_replace_callback compared to the function I wrote?


A page like this one: http://www.nikehydraulics.com/products/ 
product_chooser_gb.php?productMaingroup=5productSubgroup=33


.. gets converted within 0.32 / 0.34 seconds which I think is quite ok.

/frank



the function takes a text and an array with converters like:

$converters[] = array ( metric = mm, imperial = in,
ratio  = 0.039370079, round = 1 );
$converters[] = array ( metric = m, imperial = ft, ratio
= 3.280839895, round = 1 );


function convertTextString ( $text, $convertTable )
{
# this function takes a text string, searches for numbers to
convert, convert those numbers and returns
# the complete text again.

if ( !ereg ( [[:digit:]], $text ) ) // if the text does not
contain any numbers, return the text as it is
{
return $text;
}

foreach ( $convertTable as $convertKey = $convertUnit )
{
$pattern =
		((\d{1,10}[,|.]*\d{0,10})*(\s)(%s)([$|\s|.|,|\)|/]+| $)); //  
this regex
looks for a number followed by white space,  followed by the  
metric unit,

followed by a closing character like  ., , or )
$pattern = sprintf ( $pattern, $convertUnit['metric'] );

while ( preg_match ( $pattern, $text, $matches ) )
{
$matches[1] = str_replace ( ,, ., $matches[1] );
			// in case  numbers are written like 6,6 m, we need to  
replace , with

.
// because we do not want to return 0, we have to
make shure that  the new value is not zero.
$itterator = 0;
do {
$value = round ( ( $matches[1] *
$convertUnit['ratio'] ),  $convertUnit['round'] 
+ $itterator  );
++$itterator;
} while ( $value == 0 || $itterator == 10 );

$replacement = $value . $2 .
$convertUnit['imperial'] . $4;
$text = preg_replace ( $pattern, $replacement,
$text, 1 );
}
}
return $text;
}


--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991



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



Re: [PHP] ereg_replace with user defined function?

2006-10-11 Thread Frank Arensmeier

Thanks again for your suggestions.

Actually, - believe it or not - I have never written a class (I am  
still learning PHP after three years working with that language). So  
I am not quite sure of the benefits of your class. One thing I do  
realise is the benefit of replacing the foreach loop with a single  
preg_replace_callbak. Let me try to sum up:


With a preg_replace_callback I am able to look for a pattern like: a  
number ( float or integer ) followed by whitespace followed by one,  
two, three or more characters, followed by a closing character.


e.g.: ((\d{1,10}[,|.]*\d{0,10})*(\s)(\D{1,3})([$|\s|.|,|\)|/]+|  
$)) (untested)


If preg finds a match, it will pass an array to the specified  
function. In that function I evaluate the unit, see if it is in my  
array containing the conversion table. If that is the case,  
calculate the new value and return everything. Right?


I will get back with this new approach.

BTW, 0.32/0.34 seconds includes: calling the original html page from  
an outside server, loading this page into the DOM parser, walking  
through every table and every text string on that page. Convert  
everything necessary (the converter array contains about 14 metric -  
imperial converters) replace all converted DOM nodes and output  
everything. The metric / imperial calculations / replacements take  
between 0.00054 and 0.005 seconds per table cell / text string.


/frank

11 okt 2006 kl. 13.39 skrev Roman Neuhauser:


# [EMAIL PROTECTED] / 2006-10-11 09:52:51 +0200:


10 okt 2006 kl. 19.25 skrev Roman Neuhauser:


# [EMAIL PROTECTED] / 2006-10-09 22:01:34 +0200:

Thank you Ilaria and Roman for your input. I did not know that preg
is able to deal with PCRE patterns.


   preg is obviously short for Perl REGular expressions, while
   PCRE positively means Perl-Compatible Regular Expressions.
   The regexp syntax from Perl is a superset of POSIX extended
   regexps, so anything ereg_ function accept will be good for
   preg_ as well (but beware of pattern delimiters).


Thanks for the info. I didn't know that.


NP, glad to be of help. The relationship is quite obvious if you
look at both syntaxes.


As a matter of fact I came up
with the following solution (if someone is interested):


   What problem does it solve? I mean, why are you trying to avoid
   preg_replace_callback() in the first place?



Maybe because I didn't know better?


Well your question mentioned preg_replace_callback() so I thought
maybe there was something about the function you didn't like.

Initially, I was using  ereg_replace for replacing metric numbers  
with

imperial ones. But  obviously, ereg_replace replaces all instances in
the given text  string. A text containing more than one instance of
the same unit,  was replaced by the calculated replacement string of
the first  finding. So I had to think about other ways to do this -
which  brought me to preg_replace_callback (as I already said - I
didn't  know that preg takes POSIX patterns as well).

Would you suggest a different way? Would it be faster to do the
replacement with preg_replace_callback compared to the function I  
wrote?


Definitely, and probably by several orders of magnitude.


A page like this one: http://www.nikehydraulics.com/products/
product_chooser_gb.php?productMaingroup=5productSubgroup=33

.. gets converted within 0.32 / 0.34 seconds which I think is  
quite ok.


If the time covers only the conversion then it's quite terrible.

Looking at the convertTextString() function below there's a few
obvious optimizations waiting to be done, and... turning the  
foreach

into a single preg_replace_callback() is the one that begs
implementing the most (the code below's been tested and works):

class convertor
{
const SI_to_Imperial = 0;
const Imperial_to_SI = 1;

function convert($amount, $unit, $direction)
{
return sprintf(
whatever '%s' of '%s' is in the Imperial system
  , $amount
  , $unit
);
}
}
function callbackSI2IS(array $SIspec)
{
return convertor::convert(
$SIspec[1]
  , $SIspec[2]
  , convertor::SI_to_Imperial
);
}

$p = '~
((?:\d+[,|.])*\d+) # amount
\s*
(m{1,2}\b) # meters or millis
 ~x';
echo preg_replace_callback(
$p
  , 'callbackSI2IS'
  , file_get_contents('php://stdin')
);



the function takes a text and an array with converters like:

$converters[] = array ( metric = mm, imperial = in,
ratio  = 0.039370079, round = 1 );
$converters[] = array (	metric = m, imperial = ft,  
ratio

= 3.280839895, round = 1 );


function convertTextString ( $text, $convertTable )
{
# this function takes a text string, searches for numbers to
convert, convert those numbers and returns
# the complete text again.

if ( !ereg ( 

[PHP] ereg_replace with unser defined function?

2006-10-09 Thread Frank Arensmeier

Hello all.

Is it possible to have a user defined function for the replacement  
within an ereg_replace (like preg_replace_callback)? I am working on  
a script that converts html pages with metric data into imperial  
data. My script takes text strings containing one or more instances  
of e.g. 123 mm, 321 mm, 123 kg, 123 cm2 and so on. The script  
searches the string with a pattern like:

([[:digit:]]+|[[:digit:]]+\.[[:digit:]]+)([[:blank:]]?)(mm)

When the script finds an instance, it stores the matches into an  
array - ereg ( $pattern, $textstring, $matches )


The replacement (for mm) looks like:
round ( ( $matches[1] * 0.039370079 ), 1 ) . $matches[2]  . in

Everything is working great accept when the string contains more than  
one instance for example of the metric unit mm. In that case, all  
instances of xy mm will be replaced with the first occurrence.


So, a text like:

The product is 230 mm tall, 120 mm thick and 340 mm wide will  
output as The product is 9.1 in tall, 9.1 in thick and 9.1 in wide  
- because the replacement string is based / calculated on the first  
occurrence 230 mm.


Alternatively, is there a way to limit ereg_replace to only replace  
one instance at a time?


Hopefully I am not too confusing...

regards,

/frank

ps. of course I have searched the manual and asked Google - no luck ds.



Re: [PHP] ereg_replace with user defined function?

2006-10-09 Thread Frank Arensmeier
Thank you Ilaria and Roman for your input. I did not know that preg  
is able to deal with PCRE patterns. As a matter of fact I came up  
with the following solution (if someone is interested):


the function takes a text and an array with converters like:

$converters[] = array (	metric = mm, imperial = in, ratio  
= 0.039370079, round = 1 );
$converters[] = array (	metric = m, imperial = ft, ratio  
= 3.280839895, round = 1 );



function convertTextString ( $text, $convertTable )
{
	# this function takes a text string, searches for numbers to  
convert, convert those numbers and returns

# the complete text again.

	if ( !ereg ( [[:digit:]], $text ) ) // if the text does not  
contain any numbers, return the text as it is

{
return $text;
}

foreach ( $convertTable as $convertKey = $convertUnit )
{
		$pattern = ((\d{1,10}[,|.]*\d{0,10})*(\s)(%s)([$|\s|.|,|\)|/]+| 
$)); // this regex looks for a number followed by white space,  
followed by the metric unit, followed by a closing character like  
., , or )

$pattern = sprintf ( $pattern, $convertUnit['metric'] );

while ( preg_match ( $pattern, $text, $matches ) )
{
			$matches[1] = str_replace ( ,, ., $matches[1] ); // in case  
numbers are written like 6,6 m, we need to replace , with .
			// because we do not want to return 0, we have to make shure that  
the new value is not zero.

$itterator = 0;
do {
$value = round ( ( $matches[1] * $convertUnit['ratio'] ),  
$convertUnit['round'] + $itterator  );

++$itterator;
} while ( $value == 0 || $itterator == 10 );

$replacement = $value . $2 . $convertUnit['imperial'] . 
$4;
$text = preg_replace ( $pattern, $replacement, $text, 1 
);
}
}
return $text;
}

/frank

9 okt 2006 kl. 16.18 skrev Ilaria De Marinis:


Hi Frank,
I think preg_replace_callback is a good solution for you.

If you don't want to use it, you can construct two arrays defining  
matches and replacements.


For example:
$matches
[230]
[120]
[340]

$replacements
[9.1]
[replace2]
[replace3]



After you stored matches in $matches using regular expression like  
yours,/preg_match_all http://it.php.net/manual/en/function.preg- 
split.php/ (([[:digit:]]+|[[:digit:]]+\.[[:digit:]]+)([[:blank:]]?) 
(mm), $string, $matches, PREG_SET_ORDER)


you can define $replacements by this way:
for(int =0; icount($matches); i++){
   $replacements[$i]=round((substr($matches[$i][0], 0, 3)) 
*0.039370079),1); //take the last part of match with no digits, I  
don't know if there are sure 3 digits

}

for(int i=0; icount($matches); i++){
   preg_replace($string, $matches[$i][0], $replacement[$i].in);
}

hope to help you

Ilaria

Frank Arensmeier wrote:


Hello all.

Is it possible to have a user defined function for the  
replacement  within an ereg_replace (like preg_replace_callback)?  
I am working on  a script that converts html pages with metric  
data into imperial  data. My script takes text strings containing  
one or more instances  of e.g. 123 mm, 321 mm, 123 kg, 123  
cm2 and so on. The script  searches the string with a pattern like:

([[:digit:]]+|[[:digit:]]+\.[[:digit:]]+)([[:blank:]]?)(mm)

When the script finds an instance, it stores the matches into an   
array - ereg ( $pattern, $textstring, $matches )


The replacement (for mm) looks like:
round ( ( $matches[1] * 0.039370079 ), 1 ) . $matches[2]  . in

Everything is working great accept when the string contains more  
than  one instance for example of the metric unit mm. In that  
case, all  instances of xy mm will be replaced with the first  
occurrence.


So, a text like:

The product is 230 mm tall, 120 mm thick and 340 mm wide will   
output as The product is 9.1 in tall, 9.1 in thick and 9.1 in  
wide  - because the replacement string is based / calculated on  
the first  occurrence 230 mm.


Alternatively, is there a way to limit ereg_replace to only  
replace  one instance at a time?


Hopefully I am not too confusing...

regards,

/frank

ps. of course I have searched the manual and asked Google - no  
luck ds.





--

De Marinis Ilaria
Settore Automazione Biblioteche
Phone: +3906-44486052
CASPUR - Via dei Tizii ,6b - 00185 Roma
e-mail: [EMAIL PROTECTED]


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




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



Re: [PHP] Problems with date()

2006-09-13 Thread Frank Arensmeier
And what exactly did you expect? Have you checked a calendar? The  
31st of december 2001, 2002 and 2003 are Monday, Tuesday and  
Wednesday respectively. In other words. those days are more or less  
in the middle of the week 01. So, I would say that your results are  
absolutely right.


/frank
13 sep 2006 kl. 18.38 skrev Arno Kuhl:


I hope someone can help with this.

I'm trying to find the week number of the last week of the year.
I have the following code snippet:

$lastday = strtotime(31 December .$year);
$lastdate = date(Y-m-d, $lastday);  // for testing
$lastweek = date(W, $lastday);

I put the $lastdate line in because I was convinced that $lastday  
must be

wrong, but it's correct!

When $year is 2000 I get an expected $lastweek of 52.
When $year is 2001, 2002, or 2003 the $lastweek is 01!
When $year is 2004 $lastweek is 53.
When $year is 2005 $lastweek is 52.

I haven't checked further than 2005.

Why do I get the weird lastweek values for 2001, 2002, and 2003?
I'm using PHP 4.3.4 on Win2000.

Arno

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




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



Re: [PHP] Open file on a Mounted Share on Mac OS X

2006-09-13 Thread Frank Arensmeier

Hi there.

Look at the man page for mount_smbfs - especially the -M option  
which ia able to set permissions on the mounted SMB volume. If that  
doesn't help, when you said you tried to make a shortcut to the file  
- did you do this in the Finder? Try it with a symbolic link in stead  
(man ln). e.g. ln -s source file target file and place the symbolic  
link into a folder that PHP/Apache have access to.


Whit a symbolic link (which is not exactly the same as a shortcut  
created in the Finder), your link will act exactly as the target it  
is pointing at so to say.


Good luck.

/frank
13 sep 2006 kl. 20.53 skrev John Nichel:


Rahul S. Johari wrote:
Ok you may be on to something here. Everytime I was trying to  
chmod the
permissions etcetera, the share was mounted, and that probably was  
the
problem. What is a mount point? How do I set ownership/permission  
of a mount point?


This is going way beyond the scope of this mailing list.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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




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



Re: [PHP] Open file on a Mounted Share on Mac OS X

2006-09-13 Thread Frank Arensmeier

Sorry for the typos btw...

It's late.

/frank

13 sep 2006 kl. 21.20 skrev Frank Arensmeier:


Hi there.

Look at the man page for mount_smbfs - especially the -M option  
which ia able to set permissions on the mounted SMB volume. If that  
doesn't help, when you said you tried to make a shortcut to the  
file - did you do this in the Finder? Try it with a symbolic link  
in stead (man ln). e.g. ln -s source file target file and place the  
symbolic link into a folder that PHP/Apache have access to.


Whit a symbolic link (which is not exactly the same as a shortcut  
created in the Finder), your link will act exactly as the target it  
is pointing at so to say.


Good luck.

/frank
13 sep 2006 kl. 20.53 skrev John Nichel:


Rahul S. Johari wrote:
Ok you may be on to something here. Everytime I was trying to  
chmod the
permissions etcetera, the share was mounted, and that probably  
was the
problem. What is a mount point? How do I set ownership/permission  
of a mount point?


This is going way beyond the scope of this mailing list.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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




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




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



Re: [PHP] Directory Structure

2006-09-08 Thread Frank Arensmeier
I think that these kind of questions are very annoying - it is almost  
rude to post this to a list.


Why don't you

a) show that you have done some thinking
b) have at least scanned the manual
c) have asked Google.

/frank

8 sep 2006 kl. 07.12 skrev Manoj Singh:


Hello all,

I am developing a site in which i have to show the directory  
structure of
any server i.e the admin will enter any site name and i have to  
show the dir

structure of that site name.

Please help me to fix this.

Thanks  Regards
Manoj


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



Re: [PHP] Arabic

2006-09-07 Thread Frank Arensmeier

I would...

a) read the PDFlib manual
b) search the PDFlib list archives for information (this has been  
discussed previously, I am rather sure)

c) post your question to the PDFlib list

/frank

7 sep 2006 kl. 21.16 skrev Ronald Cole:


Hi,

I'm trying to use pdflib to generate Arabic.

Is this possible?

If so, what font should one use?

	Someone has told me that I may need to manipulate the unicode  
characters to change the order to right-to-left. Has anyone done  
this before?


Thanks,
Skip

Ronald Skip Cole
Program Officer
United States Institute of Peace (http://www.usip.org)
(202)457-1700 ext 4717

“The more you sweat in peace, the less you bleed in war” – Asian  
Proverb


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




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



Re: [PHP] Working with an existing PDF doc

2006-09-01 Thread Frank Arensmeier
You seem to use FPDF. Although I never tried working with FPDF, you  
might take a look at http://fpdi.setasign.de/ which is a class that  
extends FPDF.


If you are looking for a library with support for all PDF features,  
maybe PDFlib (http://www.pdflib.com) is the one for you (sure, PDFlib/ 
PDI costs some money. But if you are looking for a lib that has  
support for everything that the PDF format has to offer, PDFlib is  
definitely the lib you want to use.).


/frank

1 sep 2006 kl. 02.42 skrev tedd:


Hi gang:

I can create a pdf document on-the-fly pretty easily, as shown here:

http://xn--ovg.com/pdf

However, what I need is to find out how to open an existing pdf  
document and insert data into it -- does anyone have any experience  
in doing this, or references they can point me to?


As always, mondo thanks for those who reply.

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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




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



Re: [PHP] Working with an existing PDF doc

2006-09-01 Thread Frank Arensmeier

Tedd,

this issue has been discussed recently on the PDFlib mailing list.  
Search for the topic search  replace on PDF. Archive is here:


http://groups.yahoo.com/group/pdflib/

regards,
/frank
1 sep 2006 kl. 16.33 skrev tedd:

You seem to use FPDF. Although I never tried working with FPDF,  
you might take a look at http://fpdi.setasign.de/ which is a class  
that extends FPDF.


If you are looking for a library with support for all PDF  
features, maybe PDFlib (http://www.pdflib.com) is the one for you  
(sure, PDFlib/PDI costs some money. But if you are looking for a  
lib that has support for everything that the PDF format has to  
offer, PDFlib is definitely the lib you want to use.).


/frank


Thanks, your links were right-on.

All I have to do now is figure out how to do a search and replace  
in a PDF document.


tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com



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



Re: [PHP] display a single thumb per gallery

2006-08-28 Thread Frank Arensmeier

http://dev.mysql.com/doc/refman/5.0/en/join.html

you could use something like this:

SELECT DISTINCT thumbnails.gallery, thumbnails.id,  
thumbnails.binary_data FROM thumbnails


you can insert everything you want from your table after the DISTINCT  
by writing:

table.colName

/frank

27 aug 2006 kl. 21.39 skrev [EMAIL PROTECTED] [EMAIL PROTECTED]:


$query = SELECT distinct gallery FROM thumbnails;

that only returns the numbers 7  8. I need the all the info from  
the rows - id, binary data etcsomething like


$query = SELECT * FROM DISTINCT gallery FROM  thumbnails;


any ideas?


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



Re: [PHP] Problem with wrapper script for Tidy

2006-08-05 Thread Frank Arensmeier
Thank you Richard. I will test that (piping the output). Regarding my  
concerns about rubbing security by not validating the included  
code, I actually meant that the script does not validate where the  
included PHP script is coming from. Could someone set the  
environmental variable $_SERVER('PATH_TRANSLATED') from outside, so  
to say? Or is there no reason to be worried?


/frank
4 aug 2006 kl. 22.22 skrev Richard Lynch:


Did you try to use - as the file and pipe the output?...

That might work...

As far as the Tidy not validating the included PHP, I'm not sure what
you mean, but I don't see this making the PHP code any less secure
than it was before you wrapped Tidy around it...

On Fri, August 4, 2006 6:21 am, Frank Arensmeier wrote:

Hello.

Since my ISP does not provide the tidy module for Apache, I tested
writing a wrapper script for a locally installed tidy binary. In
general, the script is triggered by a modification to the .htaccess
file like so:

AddHandler server-parsed .php
Action server-parsed /tidy_wrapper.php5

All php pages are by that means treated by the script
tidy_wrapper.php5.

Here is the code for tidy_wrapper.php5:

?php

chdir ( dirname ( $_SERVER['PATH_TRANSLATED'] ) );
ob_start();
include ( $_SERVER['PATH_TRANSLATED'] );
$output = ob_get_contents();
ob_end_clean();

// Including a line with the commend !-- NO TIDY !-- will turn
off tidy conversion

if ( !stristr ( $output, !-- NO TIDY !-- ) ) {
$localfile = tempnam ( '../tmp', tmp );
$handle = fopen($localfile, w);
fwrite($handle, $output);
fclose($handle);

$command = '/Library/WebServer/CGI-Executables/tidy -iq --show-
errors 0 --show-warnings 0 -wrap 100 ' . $localfile . ' 21';

exec ( $command, $output_exec );
echo implode ( \n, $output_exec );
unlink ( $localfile );
} else {
echo $output;
}
exit;
?

Although the script is actually working fine, there is at least one
downside: speed. As you can see, the output buffer must be written to
a file in order to be processed by tidy. I was not able to get tidy
to accept a string for processing. Doing so, tidy throws en error. I
have looked through tidy documentation without finding any clues. I
would appreciate any hints. Any ideas for a walk-around for that file
saving-thing would be welcome!

Otherwise, I strongly feel that this script might become/be a
security hole. Because it does not validate the included PHP code, it
could be misused for doing bad stuff, or am I wrong? Once more, any
suggestions are welcome.

regards,
/frank

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





--
Like Music?
http://l-i-e.com/artists.htm





--
Frank Arensmeier
Marketing Support  Webmaster

NIKE Hydraulics AB
Box 1107
631 80 Eskilstuna
Sweden

phone +46 - (0)16 16 82 34
fax +46 - (0)16 13 93 16
[EMAIL PROTECTED]
www.nikehydraulics.se




[PHP] Problem with wrapper script for Tidy

2006-08-04 Thread Frank Arensmeier

Hello.

Since my ISP does not provide the tidy module for Apache, I tested  
writing a wrapper script for a locally installed tidy binary. In  
general, the script is triggered by a modification to the .htaccess  
file like so:


AddHandler server-parsed .php
Action server-parsed /tidy_wrapper.php5

All php pages are by that means treated by the script  
tidy_wrapper.php5.


Here is the code for tidy_wrapper.php5:

?php

chdir ( dirname ( $_SERVER['PATH_TRANSLATED'] ) );
ob_start();
include ( $_SERVER['PATH_TRANSLATED'] );
$output = ob_get_contents();
ob_end_clean();

// Including a line with the commend !-- NO TIDY !-- will turn  
off tidy conversion


if ( !stristr ( $output, !-- NO TIDY !-- ) ) {
$localfile = tempnam ( '../tmp', tmp );
$handle = fopen($localfile, w);
fwrite($handle, $output);
fclose($handle);

	$command = '/Library/WebServer/CGI-Executables/tidy -iq --show- 
errors 0 --show-warnings 0 -wrap 100 ' . $localfile . ' 21';


exec ( $command, $output_exec );
echo implode ( \n, $output_exec );
unlink ( $localfile );
} else {
echo $output;
}
exit;
?

Although the script is actually working fine, there is at least one  
downside: speed. As you can see, the output buffer must be written to  
a file in order to be processed by tidy. I was not able to get tidy  
to accept a string for processing. Doing so, tidy throws en error. I  
have looked through tidy documentation without finding any clues. I  
would appreciate any hints. Any ideas for a walk-around for that file  
saving-thing would be welcome!


Otherwise, I strongly feel that this script might become/be a  
security hole. Because it does not validate the included PHP code, it  
could be misused for doing bad stuff, or am I wrong? Once more, any  
suggestions are welcome.


regards,
/frank

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



Re: [PHP] Serving a graphic downloads it instead of displaying it

2006-06-17 Thread Frank Arensmeier

Maybe it is not essential, but shouldn't it say:

header(Content-type: image/jpeg);

notice jpeg - not jpg.

/frank

16 jun 2006 kl. 22.15 skrev Mariano Guadagnini:


Brian Dunning wrote:

I'm trying to serve up a jpeg like this:

header(Content-type: image/jpg);
readfile('images/banner-ad.jpg');

It works on other browsers, but on Safari it downloads the graphic  
like a file, rather than displaying it. What's up with that


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



--No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.0/367 - Release Date:  
16/06/2006



Maybe you can try to embed the image in a blank html, inside img  
tag for example, to show only the image you want.



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.0/367 - Release Date:  
16/06/2006


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




--
Frank Arensmeier
Marketing Support  Webmaster

NIKE Hydraulics AB
Box 1107
631 80 Eskilstuna
Sweden

phone +46 - (0)16 16 82 34
fax +46 - (0)16 13 93 16
[EMAIL PROTECTED]
www.nikehydraulics.se

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



Re: [PHP] Re: Setting headers for file download

2006-06-14 Thread Frank Arensmeier
I was working on a script that was supposed to generate PDF files on  
the fly and ran into the same problem as you described. MS IE has  
always been and will always be (?) a P.I.T.A. when it comes to  
following standards (I am not really sure if the header application/x- 
octet-steam is a standrad in order to force a download). I came up  
with this little helper:


?php
$filename = example.pdf;
$len = filesize ($filename );

if ( ( preg_match('|MSIE ([0-9.]+)|', $agent, $version ) ) ||  
( preg_match( '|Internet Explorer/([0-9.]+)|', $agent, $version ) ) )

{
header( 'Content-Type: application/x-msdownload' );
header( 'Content-Length: ' . $len );
if ( $version == '5.5' )
{
header( 'Content-Disposition: filename=' . $filename . '' );
} else {
		header( 'Content-Disposition: attachment; filename=' . $filename .  
'' );

}
} else {
header( 'Content-Type: application/pdf' );
header( 'Content-Length: ' . $len );
header( 'Content-disposition: attachment; filename=' . $filename );
}
echo file_get_contents($filename);
?

All browsers I have tested with do show the download frame (Opera,  
Safari, IE, Firefox, Mozilla browsers). But, as Richard already  
mentioned, I had to fake the download URL, like http:// 
www.site.com/downloads/example.pdf. In the folder downloads I put  
a .htaccess file with the line ErrorDocument 404 /link/to/my/php/ 
script.php.


/frank

14 jun 2006 kl. 02.19 skrev Peter Lauri:


I will try that after golf...

-Original Message-
From: Rafael [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 14, 2006 6:28 AM
To: php-general@lists.php.net
Subject: [PHP] Re: Setting headers for file download

I use something like this...
   $file_len = filesize($file_name);
   $file_ts  = filemtime($file_name);
   header('Content-Type: application/x-octet-stream'); // none known
   header('Cache-Control: must-revalidate, post-check=0, pre- 
check=0');
   header('Last-Modified: '. gmdate('D, d M Y H:i:s', $file_ts) .'  
GMT');

   header('Content-Disposition: attachment; filename='.
basename($file_name) .'');
   header(Content-Length: $file_len);
   readfile($file_name);


Peter Lauri wrote:

Best group member,

This is how I try to push files to download using headers:

header(Content-type: $file_type);
header(Content-Disposition: attachment; filename=$filename);
print $file;

It works fine in FireFox, but not that good in IE. I have been  
googled to

find the fix for IE, but I can not find it. Anyone with experience of

this?


Best regards,
Peter Lauri


--
Atentamente / Sincerely,
J. Rafael Salazar Magaña

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

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




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



Re: [PHP] HTML (php page) - PDF recommendation

2006-06-10 Thread Frank Arensmeier
Depending on what you need (CSS support, good table support and so  
on) and which plattform you are working with it might be a good idea  
to have a look at: http://www.digitaljunkies.ca/dompdf/


There are also several on-line services available like: http:// 
www.pdfonline.com/


If you are on Mac OS X, I would definitely recommend looking at the  
Core Image functions within the Quartz 2D layer in Mac OS X. Core  
Image has also subroutines for PDF output (this is why you can save  
any document from any program in Mac OS X as a PDF file). You can  
access those APIs for example via Python.


http://developer.apple.com/documentation/GraphicsImaging/Conceptual/ 
drawingwithquartz2d/dq_python/chapter_17_section_1.html


This might give you some ideas where to start.

/frank

10 jun 2006 kl. 16.57 skrev Ryan A:


Hi,
can anybody give me a recommendation on a good
html-pdf converter. Checked google and there are
loads of classes, this one looks like one of the best
though (even in price):

http://www.rustyparts.com/pdf.php

Anybody else using this? if yes, would appreciate any
cons of using this class.
Or, if you are using another class to do the above and
think its the next best thing to sliced bread, I would
appreciate you sending me the link so that I may try
it out.

All I need is a pdf generator that will generate an
exact (or as close to exact) copy of the html page
(that was generated by php, not a static html page),
nothing fancy, no permissions etc

Thanks!
Ryan

--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

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




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



  1   2   >