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 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] 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 ) . "\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 "";
print_r($string_as_array);
echo "";

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] 

--
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] 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] 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] 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] 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] 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] 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] 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] 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/u

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] 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


http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>

http://tempuri.org/";>
X
XX
40010
30840300
30840280
10
1
20
5
100
S
300
S





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


//THIS IS THE XML THAT THE PHP IS SENDING

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/";>

 // HOW CAN I REMOVE THIS NAMESPACE? ns1:
X
XX
40096
30840280
30840300
10
1
5
10
0
300
N
300
N





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 :


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

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

   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] 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 :


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] 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] 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 :

> 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] 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
>  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] 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] 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] strip_tags

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

> 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 "" and "" are not stripped.
> 
> How do you strip all tags, but leave some tags (such as , , and  -- 
> 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("", "") 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] extract price by preg_match_all

2011-02-14 Thread Frank Arensmeier

";
print_r($matches);
echo "";
} else {
echo "Didn't find anything...";
}
?>

Untested.

/frank

14 feb 2011 kl. 15.05 skrev Tontonq Tontonq:

> example data:
> 
> 
>  old price 829,00
> €your price 58,90 € *
> 
> 
> another :
>   9,90 € *
> 
> i want to extract 829,.00 & 58,90 from first source , 9,90 from the second
> 
> i tried many way like preg_match_all('/ 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] 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'].')
';
>else
>echo '
';
>}
> 
> 
> 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'].')
';
   else
   echo '
';
   }

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



[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] 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



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] 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] 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] 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:
>  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)?



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] 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  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
>> 
>> 
>> 
>> > 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



[PHP] replace special characters

2005-02-24 Thread Frank Arensmeier
Hello everybody!
I was wondering if you could help me with a little problem I ran into 
some days ago.

In my database I have some information about file paths. Originally, 
those paths come from a Windows Excel spreadsheet and look like "..\1 
PDF Filer\65051.PDF". In my PHP code I try to do two things:

1) replace ".." with a string like "file://server/folder"
2) replace all "\" characters with "/".
The PHP code looks something like:
$path_to_file = "..\1 PDF Filer\65051.PDF";
$things_to_look_for = array("..", "\");
$things_to_replace_with = array("file://server/folder", "/");
$link = str_replace($things_to_look_for, $things_to_replace_with, 
$path_to_file);

The big problem is the character "\" which, if I got it right, in 
UNICODE is used for things like expressing line breaks ('\n' or 
something like this). The code above is resulting in the following 
error massage: "Parse error: parse error, expecting `')'' in 
/xxx/xxx/xxx/TMPz06yoces6o.php on line 2."

Is there a simple solution for this problem?
Regards,
Frank
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: replace special characters

2005-02-24 Thread Frank Arensmeier
Thank you Stian!
In Swedish they say "Sometimes you can't see the forest by all the 
trees."

/frank
2005-02-24 kl. 09.45 skrev Stian Berger:
On Thu, 24 Feb 2005 09:14:32 +0100, Frank Arensmeier 
<[EMAIL PROTECTED]> wrote:

Hello everybody!
I was wondering if you could help me with a little problem I ran into 
some days ago.

In my database I have some information about file paths. Originally, 
those paths come from a Windows Excel spreadsheet and look like "..\1 
PDF Filer\65051.PDF". In my PHP code I try to do two things:

1) replace ".." with a string like "file://server/folder"
2) replace all "\" characters with "/".
The PHP code looks something like:
$path_to_file = "..\1 PDF Filer\65051.PDF";
$things_to_look_for = array("..", "\");
$things_to_replace_with = array("file://server/folder", "/");
$link = str_replace($things_to_look_for, $things_to_replace_with, 
$path_to_file);

The big problem is the character "\" which, if I got it right, in 
UNICODE is used for things like expressing line breaks ('\n' or 
something like this). The code above is resulting in the following 
error massage: "Parse error: parse error, expecting `')'' in 
/xxx/xxx/xxx/TMPz06yoces6o.php on line 2."

Is there a simple solution for this problem?
Regards,
Frank

You are escaping the last quote, meaning that the rest of your code is 
"quoted". What you need to do is to escape the escape character.

$path_to_file = addslashes("..\1 PDF Filer\65051.PDF");
$things_to_look_for = array("..", "\\");
You should use addslashes() or similar on you're path name, as some 
escaped characters have certain meanings. \n for example means a new 
line character, while \\n on the other hand means \ followed by n.

Manual: http://www.php.net/types.string
--
Stian
--
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] function to resize images

2005-02-28 Thread Frank Arensmeier
Dave!
I would start by reading the PHP manual. Look for a function called 
'imagecopyresized()'. This might help.

/frank
2005-02-28 kl. 16.34 skrev Bosky, Dave:
Does anyone have a nice function that will resize an uploaded image to
specific width/height dimensions?
I wanted to find something that would work for only GIF and JPG image 
types.
I've converted my shopping cart

application from Cold Fusion to PHP and need to create thumbnails and 
reduce
the size of large uploaded images.


I've already done a google search and found an example but can't get 
it to
work for some reason and it includes a

bunch of other stuff that's not needed and too much trouble to remove.


Thanks,
Dave


HTC Disclaimer:  The information contained in this message may be 
privileged and confidential and protected from disclosure. If the 
reader of this message is not the intended recipient, or an employee 
or agent responsible for delivering this message to the intended 
recipient, you are hereby notified that any dissemination, 
distribution or copying of this communication is strictly prohibited.  
If you have received this communication in error, please notify us 
immediately by replying to the message and deleting it from your 
computer.  Thank you.

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


Re: [PHP] textarea posting duplicate text

2005-03-01 Thread Frank Arensmeier
Elizabeth!
Have you considered reinstalling PHP on your server?
Maybe, it is worth the effort?
Regards,
Frank
2005-03-01 kl. 17.19 skrev Bret Hughes:
On Tue, 2005-03-01 at 08:43, Elizabeth Lawrence wrote:
Thanks, Dan. I copied your code exactly and posted it here:
http://www.tidefans.com/test.php I pasted a large part of O'Henry's 
"Gift of
the Magi" into the textarea, and it gets repeated, as before.

Thanks for any help,
Elizabeth

There are some settings in php.ini that affect the max size of post
variables.  It is sort of interesting to me that it is not a complete
copy but the first 1303 bytes or so are printed and then the test as a
whole is there preceded by testarea=.
It does not do this on my server. 4.3.6 apache 2
I notice that the Server API  says  Apache 2.0 Filter on your box and 
on
mine it says Apache 2.0 Handler.  I have no idea what that means.

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

________
Frank Arensmeier
Marketing Support
NIKE HYDRAULICS AB
Box 1107
631 80 Eskilstuna
Sweden
tel +46 16 82 34
fax +46 16 13 93 16
email: [EMAIL PROTECTED]
www.nikehydraulics.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Connecting to a AS/400?

2005-03-02 Thread Frank Arensmeier
Hello!
Is there anyone who has some experience in connecting to a IBM AS/400 
server with PHP? Any ideas where to start?

Regards,
Frank

Frank Arensmeier
Marketing Support
NIKE HYDRAULICS AB
Box 1107
631 80 Eskilstuna
Sweden
tel +46 16 82 34
fax +46 16 13 93 16
email: [EMAIL PROTECTED]
www.nikehydraulics.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Connecting to a AS/400?

2005-03-02 Thread Frank Arensmeier
Richard, you are my man! Thank you for the hints you gave me. I will do 
some digging in the list archives tonight.

Thank you.
/frank
2005-03-02 kl. 19.57 skrev Richard Lynch:
Frank Arensmeier wrote:
Is there anyone who has some experience in connecting to a IBM AS/400
server with PHP? Any ideas where to start?
I know somebody reported success back in the day on this list...
Actually, it's so far back in the day, it just might be on the 
predecessor
to this list, back when all PHP discussion took place pretty much on 
one
single list...  But I don't think it's *that* far back.

Worst case, we're talking back in PHP 3.0 Beta/Release Candidate days,
possibly, but not before, as that's when I joined up.
I think they were using "AS400" or "AS 400" without the "/" in their 
posts.

IIRC (and that's a big "IF"):
They originally had nothing, then they got read access, then they 
achieved
write access, finally, but I think there was something really skanky 
about
getting the write access that made them not real happy with the
solution...  Like I think it required having "root" be a bit too wide 
open
permissive on the AS/400 end.

Fortunately, the list archives of this list and even that old list are
linked from:
http://php.net/mailing-lists.php
Start with the PHP-General, as I suspect it's in there, though it 
*could*
be back in the old old list.

PS I'm assuming you want to connect to "the database" on an AS/400 and
that that database is the standard and only database that shipped on 
those
suckers.  P-something, right?

PPS You'd probably be best off getting a CSV dump and migrating to
hardware/OS less, shall we say, antiquated? :-)
PPPS I'm not sure if I've ever *seen* an AS/400, so this is definitely
highly suspect info in this post.
--
Like Music?
http://l-i-e.com/artists.htm
--
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] How to sort a Multidimensional array?

2005-03-02 Thread Frank Arensmeier
Hello!
This must be one of the most frequently asked questions ever. Anyway, 
take a look at the PHP manual. Look for a function called 'foreach'. To 
put it simple, with 'foreach' you are able to go through the array 
step-by-step, value by value.

For example:

$arr = array('value1', 'value2', 'value3);
foreach ($arr as $key => $value) {
echo "Key: $key; Value: $value\n"; // in stead of just 
echoing the values and keys, you can e.g. assign the values to another 
array and sort them when done
}
?>

regards,
frank
2005-03-02 kl. 23.27 skrev Mirco Blitz:
Hi,
i have a multidimensional array that look like this:
$arr=array($key=>array('item0key'=>'item0', 'item1key'=>'item1',
'item2key'=>'item2', 'item3key'=>'item3', 'item4key'=>'item4'));
Lineview:
0item0key = item0
  item1key = item1
  item2key = item2
  item3key = item3
  item4key = item4
1item0key = item0
  item1key = item1
  item2key = item2
  item3key = item3
  item4key = item4
2item0key = item0
  item1key = item1
  item2key = item2
  item3key = item3
  item4key = item4
4item0key = item0
  item1key = item1
  item2key = item2
  item3key = item3
  item4key = item4
How can I sort such an array, depending on the Userentry by the Item 
values?

Thank you very much
Mirco Blitz
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: [suspicious - maybe spam] [PHP] [suspicious - maybe spam] [PHP] how to get checkbox form data as array?

2005-03-04 Thread Frank Arensmeier
Try:


/frank
2005-03-04 kl. 04.06 skrev tx:
i create the html form as below




and i receive the form data in php file as below:
global $aaa;
print_r($aaa);
this action only echo "4" not the total array in array format,why?



Re: [PHP] php-help

2005-03-08 Thread Frank Arensmeier
Hi,
MySQL is capable of doing very complex queries. You could boil down 
your query into just one single line:

'SELECT * FROM table1, table2 WHERE table2.field2 = table1.field1'
A good starting point would be the MySQL manual.
I would also strongly recommend you to take a look at the PHP manual 
for information about connecting to a MySQL database from PHP, gaining 
results and processing these results.

If you could post some PHP code to this list, I am sure members of this 
list will gladly help you with debugging the code.

Regards,
Frank
2005-03-08 kl. 11.26 skrev K Karthik:
sir,
iam new to php i'll explain my problem .if u could help i'll be very 
thankful...
in my mysql database i have two tables  i.e., table1  and table2.
 i have an array of result from one query  "select feild1 from table1 "
i have to use this result in another query.
"select field2 from table 2 where field1 = (array of first query 
iterated)"
can u help me doing this in php.
thanks,
karthik

________
Frank Arensmeier
Marketing Support
NIKE HYDRAULICS AB
Box 1107
631 80 Eskilstuna
Sweden
tel +46 16 82 34
fax +46 16 13 93 16
email: [EMAIL PROTECTED]
www.nikehydraulics.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] croping an image with GD and putting it into html code

2005-03-15 Thread Frank Arensmeier
Hi!
I ran into a little problem today and I would like to get some help. I 
create a thumbnail image with GD from a jpeg image stored on my 
web-server with this function:

function thumb($img_scr) {
	$thumbWidth = 100;
	$thumbHeight = 100;
	$scourceImg = @imagecreatefromjpeg($img_scr);
	$thumbImg = @imagecreate($thumbWidth, $thumbHeight);
	@imagecopyresized($thumbImg, $sourceImg, 0, 0, 0, 0, $thumbWidth, 
$thumbHeight, imagesx($img_scr), imagesy($img_scr));
	@imagejpeg($thumbImg);
}

This function will return only the raw data for the new thumbnail 
image. Is there a way to output the thumbnail image directly to a  
tag in my html file? Is there a way to do this without storing the 
thumbnail into a tmp file?

/frank

Frank Arensmeier
Marketing Support
NIKE HYDRAULICS AB
Box 1107
631 80 Eskilstuna
Sweden
tel +46 16 82 34
fax +46 16 13 93 16
email: [EMAIL PROTECTED]
www.nikehydraulics.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Renaming Directories

2005-03-21 Thread Frank Arensmeier
Hello Daniel!
In the code it says:
echo rename($path_old, $path_new) ? "done\n" : "failed\n";
I assume that this line is supposed to actually rename the directory. 
Why did you wrote "echo" before "rename"?

Try to change the code to:
if (!rename($path_old,$path_new)) {
echo "failed\n";
}
else
{
echo "done\n";
}
May this helps!
/frank
2005-03-21 kl. 15.07 skrev Daniel Schierbeck:
Daniel Schierbeck wrote:
I've made a small PHP script that renames the files and folders in my 
music library, to make them more linux-friendly. I'm running PHP 
5.0.3 on version 2.6.9 kernel.
What's happening is that all files and folders are renamed, except 
for folders whose names consist of one word only (such as Toto), 
which is still with a capital T. Here is the script and the result 
I'm getting:

error_reporting(E_ALL | E_STRICT);
header('Content-Type: text/plain');
function clean_filename ($str) {
  $str = strtolower($str);
  $str = str_replace(' - ', '-', $str);
  $str = str_replace(' ', '_', $str);
  $str = str_replace('\'', '', $str);
  return $str;
}
function parse_dir ($dir_name) {
  $dir = opendir($dir_name);
  while (false !== ($file = readdir($dir))) {
if ($file != '.' && $file != '..') {
  $path_old = $dir_name  . $file;
  $path_new = $dir_name . clean_filename($file);
  echo "renaming $path_old to $path_new... ";
  echo rename($path_old, $path_new) ? "done\n" : "failed\n";
  if (is_dir($file)) parse_dir($path_old);
}
  }
  closedir($dir);
}
parse_dir('/shared/music/');
?>
renaming /shared/music/dire_straits to /shared/music/dire_straits... 
done
renaming /shared/music/johnny_winter to 
/shared/music/johnny_winter... done
renaming /shared/music/pink_floyd to /shared/music/pink_floyd... done
renaming /shared/music/ten_years_after to 
/shared/music/ten_years_after... done
renaming /shared/music/the_doors to /shared/music/the_doors... done
renaming /shared/music/Santana to /shared/music/santana... done
renaming /shared/music/the_jimi_hendrix_experience to 
/shared/music/the_jimi_hendrix_experience... done
renaming /shared/music/the_velvet_underground to 
/shared/music/the_velvet_underground... done
renaming /shared/music/tim_christensen to 
/shared/music/tim_christensen... done
renaming /shared/music/dizzy_mizz_lizzy to 
/shared/music/dizzy_mizz_lizzy... done
renaming /shared/music/Toto to /shared/music/toto... done
renaming /shared/music/Cream to /shared/music/cream... done
renaming /shared/music/Filopahpos to /shared/music/filopahpos... done
renaming /shared/music/bob_dylan to /shared/music/bob_dylan... done
renaming /shared/music/dinojax to /shared/music/dinojax... done
renaming /shared/music/red_hot_chili_peppers to 
/shared/music/red_hot_chili_peppers... done
renaming /shared/music/peter_frampton to 
/shared/music/peter_frampton... done
renaming /shared/music/louis_armstrong-what_a_wonderful_world.mp3 to 
/shared/music/louis_armstrong-what_a_wonderful_world.mp3... done
As you can see, the rename() returns TRUE, but it doesn't rename the 
folder.
I hope you guys can help me out, because otherwise I'll have to do it 
manually (which I'm too lazy to even consider.)
Daniel
Ooops, that should've been parse_dir($path_new) instead of 
parse_dir($path_old).

--
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] seraching / indexing in php

2005-03-22 Thread Frank Arensmeier
Hello!
I suggest you take a look at:
http://www.phpdig.net/
Regards,
Frank
2005-03-22 kl. 15.47 skrev Reinhart Viane:
I'm looking for a script which indexes the pages of a site (dynamic 
pages)
in a dbase and makes it possible to search the site based on
keywords/sentences/etc.

Does anyone has any experience with such scripts and which do they
recommend?

Thx in advance
Reinhart


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


Re: [PHP] seraching / indexing in php

2005-03-23 Thread Frank Arensmeier
PHPdig comes with extensive documentation and you are free to rewrite 
the code so that the search engine does exactly what you want. But, you 
have to be rather familiar with PHP. My own impression was that it is 
easy (more or less) to do some basic configuration on the search 
engine. When it comes to adopting the code for your own needs, so to 
say, it is sometime necessary to do some extensive research on the PHP 
manual.

However, Phpdig is capable of indexing dynamically generated pages (I 
just tested it). To write a little script in order to update the index 
when the pages content changed, shouldn't be a problem either.

Download the package and take a look at the source code.
regards,
frank
2005-03-22 kl. 16.01 skrev Reinhart Viane:
Thanks Frank,
One question: on most of these search engines I can't seem to find if 
the
index and search dynamically generated  pages.
The intention is to make a site where several users have one page each 
which
they can edit on there own.

Do you think most of those engines can index pages like that? Or 
should I
create an index every time a page is updated / made?

Greetings
-Oorspronkelijk bericht-
Van: Frank Arensmeier [mailto:[EMAIL PROTECTED]
Verzonden: dinsdag 22 maart 2005 15:54
Aan: php list general
Onderwerp: Re: [PHP] seraching / indexing in php
Hello!
I suggest you take a look at:
http://www.phpdig.net/
Regards,
Frank
2005-03-22 kl. 15.47 skrev Reinhart Viane:
I'm looking for a script which indexes the pages of a site (dynamic
pages)
in a dbase and makes it possible to search the site based on
keywords/sentences/etc.
Does anyone has any experience with such scripts and which do they
recommend?

Thx in advance
Reinhart


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

--
Internal Virus Database is out-of-date.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.3 - Release Date: 15/03/2005
--
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] reduce the following code "if ($colorVar == 'Black' || $colorVar == 'Red' || $colorVar == 'White' || $colorVar == 'Blue' ){"

2005-03-23 Thread Frank Arensmeier

/frank

2005-03-23 kl. 09.54 skrev Lupita:
Hello;
Can any one show me a way to reduce the following code?
##

if ($colorVar == 'Black' || $colorVar == 'Red' || $colorVar == 'White' 
||
$colorVar == 'Blue' ){
$someVar = "Something";
}
?>

I was thinking there must be a way to place all the Colors into a
$allColorVar and check to see if $colorVar = $allColorVar?

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


____
Frank Arensmeier
Marketing Support
NIKE HYDRAULICS AB
Box 1107
631 80 Eskilstuna
Sweden
tel +46 16 82 34
fax +46 16 13 93 16
email: [EMAIL PROTECTED]
www.nikehydraulics.com

Re: [PHP] asking comment

2005-03-30 Thread Frank Arensmeier
Instead of generating filenames with random numbers, why not take a 
timestamp and use this as filenames?

/frank
2005-03-30 kl. 14.44 skrev William Stokes:
Hello,
I got a bit frustrated with image upload stuff with different image 
name
problems. So I created a system that gives the uploaded imaged a random
numeric name between 1-10 000 000 and saves the file to a server 
folder and
the image name to mysql DB.

Is there a so sort of a problem here that I am not thinking of? I only 
can
imagine problem that the rand() gives the same value twice. But I cant 
see
this as a major problem because there would be maybe not more than 1000
uploaded pictures. So the chance is at worst something like 1:10 000 
that
same name is created to the image.

Anyway if same name is created what's the best way to check that? I was
thinking of putting the image name field in DB as a unique field. That 
would
do it? Right?

Thanks again
-Will
--
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] Little Help Needed

2005-04-05 Thread Frank Arensmeier
You should describe more specific what is going wrong with your script.  
What does the script output? Maybe you should post a vardump as well.

/frank
2005-04-05 kl. 11.07 skrev Jason:
Could someone tell me what I did wrong with this script.   It should  
read the page  
http://www.mto.gov.on.ca/english/traveller/conditions/rdclosure.htm   
and only read between the 2 words in the script. And email any new  
stuff to the email address in the script.  What did I do wrong that is  
causing this script to fail?



#  
--- 
---
# Configuration

# Directory on the remote server.  Be sure to include leading and  
trailing slashes!
$remotedir = "/english/traveller/conditions/";

# File on the remote server.  No slashes!
$remotefile = "rdclosure.htm";
# Keyword to check for in response.
$keyword = "Closed";
# Remote server address.
$remoteserver = "www.mto.gov.on.ca";
# E-mail recipient(s).  Separate each address with a comma and a space.
$emailrecip = "[EMAIL PROTECTED]";
# E-mail subject line.
$emailsubject = "MTO - TEST" .  date(' (G:i:s)');
# E-mail From name.
$emailfromname = "WxServer Roads";
# E-mail From address.
$emailfromaddr = "[EMAIL PROTECTED]";
# End Configuration
#  
--- 
---

# Format the page for easy viewing.
Header( "Content-type: text/html");
# Setup the request.
$header .= "GET " . $remotedir . $remotefile . " HTTP/1.0\r\n";
$header .= "Host: " . $remoteserver . "\r\n";
$header .= "User-Agent: Downloader\r\n\r\n";
$fp = fsockopen ($remoteserver, 80, $errno, $errstr, 30);

# Do the request.
fputs ($fp, $header . $req) or die("Can't access the site!");
while (!feof($fp)) {
$res .= fgets ($fp, 128);
}
# Strip off the header info.
$res = preg_replace("/<[^>]+>/", "", $res);
$res = preg_replace("/Last  
Updated\:\s+?\d\d\d\d-\d\d-\d\d\s+?\d\d\:\d\d/", "", $res);
$res = preg_replace("/ /", "", $res);
$headerend = strpos($res,"\r\n\r\n");

if (is_bool($res)) {
$result = $res;
}
else {
$result = substr($res,$headerend+4,strlen($res) - ($headerend+4));
}
fclose ($fp);
# Start and end tags
$startstr = "Highways";
$endstr = "This";
# Find start and end positions
$startpos = strpos($result, $startstr) + strlen($startstr);
$endpos = strpos($result, $endstr, $startpos);
# Get string between 2 tags
$result = substr($result, $startpos, $endpos-$startpos);
echo ($new_res);
# Check for keyword.
if (!stristr($result, $keyword)) die("ERROR Code Word Not Found");
# Read the file containing the last response.
$filename = $remotefile . '.txt';
$fp = fopen($filename, "r");
$contents = fread($fp, filesize($filename));
fclose($fp);

# Check for changes.
if ($contents == $new_res) {
# There has not been a change.
echo ("No Updates\r\n");
} else {
# There has been a change.
echo ("**UPDATES DETECTED**\r\n");
# Write the new file.
$filename = $remotefile . '.txt';
$fp = fopen($filename, "w");
$write = fputs($fp, $result);
fclose($fp);
# Send the e-mail.
$recipient = $emailrecip;
$subject = $emailsubject;
$body_of_email = $result;
$header = 'From: "' . $emailfromname . '" <' . $emailfromaddr . '>';
mail ($recipient, $subject, $body_of_email, $header);
echo ("E-mail sent.");
}
?>
--
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] 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] 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] 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-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] 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: 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] 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] 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] 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] 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



[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:



In long_process.php:



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] 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



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-se&q=css+discussion 
+list&ie=UTF-8&oe=UTF-8

http://www.google.com/search?rls=sv-se&q=why+ie+sucks&ie=UTF-8&oe=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:
--

Some code goes here...

--
 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] 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] 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] 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



[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:

// Including a line with the commend "" will turn  
off tidy conversion


if ( !stristr ( $output, "" ) ) {
$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 . ' 2>&1';


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] 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:

" will turn
off tidy conversion

if ( !stristr ( $output, "" ) ) {
$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 . ' 2>&1';

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




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] 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] 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] 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] 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



[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 / (([[:digit:]]+|[[:digit:]]+\.[[:digit:]]+)([[:blank:]]?) 
(mm), $string, $matches, PREG_SET_ORDER)


you can define $replacements by this way:
for(int =0; 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; i
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] 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=5&productSubgroup=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=5&productSubgroup=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 comple

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] 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] 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 ( href='client_testing_html401.php?art='> ) 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:

"http://www.w3.org/TR/html4/loose.dtd";>





when we SHOULD be seeing
"http://www.w3.org/TR/html4/loose.dtd";>






- 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] 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] 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



[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] 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



  1   2   >