[PHP] Downloading a part of a file

2004-09-07 Thread Octavian Rasnita
Hi all,

Please tell me how can I fetch an html document from a web page, let's say
starting from the character 1000, and get the text until the caracter 5000.

In fact, I want to use the GET or POST method, and to also send to the
server the HTTP header:

Range: bytes=1000-5000

Thanks.

Teddy

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



[PHP] Convert Smart Quotes to Sraight Quotes - Need Help!

2004-09-07 Thread Monty
I've been reading for the last three days about character encodings and
such, but, have still been unable to figure out what I think should be a
simple solution.

All I want to do is take curly or smart quotes that have been pasted or
entered into a form field and convert those into straight quotes () before
I store the text in my database.

It appears the data passed from the form to my PHP script is encoded as
Unicode. My version of MySQL does not support Unicode character encoding,
so, I need to convert that into Latin1 (or ISO-8859-1).

When I use iconv() to translate the data that contains curly quotes, the
string gets chopped off at the very first curly quote and the rest of the
string is lost. This is the command I am using:

$var = iconv(UTF-8, ISO-8859-1, $var);

When I use utf8_decode(), I at least get the whole string back, but, all the
curly quotes and apostrophes are turned into ? question marks.

So, I presume there must be some way to convert those curly quotes into
straight ASCII quotes while the text is still in Unicode format, before I
run this through either iconv() or utf8_decode(). But, I've searched all
over for two days and can't figure out how to accomplish this.

I'd really appreciate someone's help with this! It's driving me nuts!!

Thanks,

Monty

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



RE: [PHP] Regex for Validating URL

2004-09-07 Thread Burhan Khalid
-Original Message-
From: Nick Wilson [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 02, 2004 11:59 AM

Hi all, 

yeah, i know, i did do quite a bit of searching but I just cant find it...

Does anyone have the regex to make sure an http address is full and without
error? like http://www.example.com

http://www.php.net/parse_url should do what you require.  If all you want to
do is filter out the different parts of the url and check if they exist or
not.

[ ignoring the rather OT discussion that this thread has lead to ]

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



[PHP] anyone using? ROS pdf class? help: addTextWrap

2004-09-07 Thread Louie Miranda
I need help about this PHP Class,

i only have a small problem. But i could not get it to work.

$pdf-addTextWrap(10,30,100,8,WALA NGA DIBA OK NA ATA E? Sana naman
no Ok na!!!,left,0);

i have this text, at line 100 it was truncated. thats ok, but the
remainder of the string is not being listed. do you guys have any
example that is working?


-- 
Louie Miranda
http://www.axishift.com

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



[PHP] unzipping

2004-09-07 Thread Mag
Hi,
Anybody know of a good class, tutorial or something
easy to let me unzip a file on my server?

E.g:
I have 3 uploaded zip files named a,b,c
I want to unzip them into 3 diff folders while
preserving their file structure.

Thanks in advance.
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] Downloading a part of a file

2004-09-07 Thread zareef ahmed
Hi Rasnita,

What you excatly want to do?

if you just want to get a  remote file.

You can use normal file functions  like fopen, fget,
fgets, file_get_contents etc. with  a url.
http://in.php.net/manual/en/ref.filesystem.php

and if you want to send  headers to  a server using
curl can be a solutions.
http://in.php.net/curl  

zareef ahmed

--- Octavian Rasnita [EMAIL PROTECTED] wrote:

 Hi all,
 
 Please tell me how can I fetch an html document from
 a web page, let's say
 starting from the character 1000, and get the text
 until the caracter 5000.
 
 In fact, I want to use the GET or POST method, and
 to also send to the
 server the HTTP header:
 
 Range: bytes=1000-5000
 
 Thanks.
 
 Teddy
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


=
Homepage :: http://www.zasaifi.com



__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] unzipping

2004-09-07 Thread zareef ahmed
HI Mag !

look at it 

http://www.phpclasses.org/browse/package/945.html


zareef ahmed
--- Mag [EMAIL PROTECTED] wrote:

 Hi,
 Anybody know of a good class, tutorial or something
 easy to let me unzip a file on my server?
 
 E.g:
 I have 3 uploaded zip files named a,b,c
 I want to unzip them into 3 diff folders while
 preserving their file structure.
 
 Thanks in advance.
 Mag
 
 =
 --
 - The faulty interface lies between the chair and
 the keyboard.
 - Creativity is great, but plagiarism is faster!
 - Smile, everyone loves a moron. :-)
 
 
   
 __
 Do you Yahoo!?
 New and Improved Yahoo! Mail - Send 10MB messages!
 http://promotions.yahoo.com/new_mail 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


=
Homepage :: http://www.zasaifi.com



__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] unable to use pear

2004-09-07 Thread Marek Kilimajer
zareef ahmed wrote:
Hi, 

Make sure you have installed the pear and double check
your included path in your php.ini .
As per your message it seems that your pear should be
in c:\php4\pear .
Check for it and revert back.
Also check if HTML_Template_IT package is installed, not all packages 
are installed by default. You should have `pear` script installed, you 
can execute `pear list` to get a list of installed packages. `pear 
install HTML_Template_IT` will install the package.

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


[PHP] Fwd: [ilugd] PHP and World Pay

2004-09-07 Thread zareef ahmed

--- Pushpendra  Tiwari
[EMAIL PROTECTED] wrote:

 Date: 7 Sep 2004 08:25:04 -
 From: Pushpendra  Tiwari
 [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [ilugd] PHP Help nedded urgently..!
 
 Dear Friends,
 Hi..!
 
 I am PHP Programmer. I want to know that has any
 body implemented Worldpay Gateway for electronic
 payment. 
 If yes Plese tell me how to grab the response in
 case of failure or wrong card no. Please send some
 example script.
 I am in crisis hope you people will me to out. 
 You can give your cell no or call me at 01133461451
 as it is very urgent for me.
 
 Hope a prompt help.
 
 Pushpendra
 
  ___
 ilugd mailinglist -- [EMAIL PROTECTED]
 http://frodo.hserus.net/mailman/listinfo/ilugd
 Archives at:
 http://news.gmane.org/gmane.user-groups.linux.delhi

http://www.mail-archive.com/[EMAIL PROTECTED]/
 


=
Homepage :: http://www.zasaifi.com



__
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail

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



Re: [PHP] Problem with SSH output when called from apache

2004-09-07 Thread Jason Wong
On Tuesday 07 September 2004 08:16, Chandu Nannapaneni wrote:

 I want to capture the output of a certain remote command ( issued
 But when called from apache .. It's not giving any ouput.

Does the logs on the ssh server indicate a successful login?

 [EMAIL PROTECTED] is well configured for ssh without passphrase
 I've checked the file permissions of /var/wwwhtml/sshtest/id_rsa
 It's given read permissions for the user 'apache' ( apache is running
 as apache:apache )

Does apache have execute permissions to the path where id_rsa resides?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
A bachelor is a selfish, undeserving guy who has cheated some woman out
of a divorce.
-- Don Quinn
*/

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



Re: [PHP] converting seconds since unix epoc to date array

2004-09-07 Thread Wouter van Vliet
 beware of dates before 1969.

That problem mostly occurs on windows systems, and in fact it's dates
before 1 jan 1970 0:00 - php on windows will issue a warning if you
try to use dates like that

   Can anyone tell me how to convert a date stored in the format
   -MM-DD to an integer of seconds since unix epoc,

As for converting a -MM-DD date to epoch seconds, if it comes for
mysql (as suggested)  you should use

select UNIX_TIMESTAMP(date_column), * FROM tablename;

From another source, strtotime should work on this format. Consider
the 1 jan 1970 problem, check your error logs, call
error_reporting(E_ALL); to see for any additional problems... the
problem might as well be a typo in your varname.

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



Re: [PHP] Regex for Validating URL

2004-09-07 Thread Wouter van Vliet
On Tue, 7 Sep 2004 10:58:48 +0300, Burhan Khalid [EMAIL PROTECTED] wrote:
 -Original Message-
 From: Nick Wilson [mailto:[EMAIL PROTECTED]
 Sent: Thursday, September 02, 2004 11:59 AM

 Hi all,

 yeah, i know, i did do quite a bit of searching but I just cant find it...

 Does anyone have the regex to make sure an http address is full and without
 error? like http://www.example.com

 http://www.php.net/parse_url should do what you require.  If all you want to
 do is filter out the different parts of the url and check if they exist or
 not.

Consider what you'd mark as a full url, do you want to accept ftp://
and such links as well.. quite generic, I'd go for smth like:

/^([a-z]+):\/\/(([\w\.]+)\.([a-z]{2,3}))(:(\d+))?(\/.*)?$/

Which would give you:
Array
(
   [0] = ftp://www.example.com.com.uk:88/something/to/remember
   [1] = ftp
   [2] = www.example.com.com.uk
   [3] = www.example.com.com
   [4] = uk
   [5] = :88
   [6] = 88
   [7] = /something/to/remember
)

Here're seme things I didn't take into account:
* double dots (www...example..com)
* double slashes (www.example.com//asdfasf//asdfasf)
* check for protocol validity, might wanna change the first part to
(ftp|http|chrome|.. any protocol you want to accept)
* I left everything after the first slash completely to the
imagination of your input data - this can contain pretty much anything
anyways
* login details (user:[EMAIL PROTECTED])

If you want to have a full regex that is really complete, check out:
http://www.foad.org/~abigail/Perl/url3.pl, and execute it ..  (linked
from http://www.foad.org/~abigail/Perl/url2.html)

Enjoy!

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



[PHP] gzip

2004-09-07 Thread Matthew Oatham
Hi,

I have a file on my server that I want to compress in a php page i.e take file.txt and 
add it to the archive file.zip.

How the hell do I do it using gzip cant understand the manual, or is there another way 
to create a zip file or other compressed file.

cheers

matt

[PHP] Dynamic Class Methods

2004-09-07 Thread Mathieu Dumoulin
I'm trying to setup a function from user code inside a defined object or a
class definition but it doesnt seem to work. Am i doing it right? Is there
something i need to know... is it even possible?

I know create_function can be used to create a function and it returns the
ident to run the function later on, lookup create_function on php.net and it
seems possible. Now i wonder if you can actually assign this function inside
a class. My final goal is to create a set of functions or objects that will
be able to implement interfaces to object classes, which is something
missing to the PHP language.

--
RESULT
--
allo
Fatal error: Call to undefined function: b() in
/home/tech/web/testboard/implements.php on line 21

-
CODE
-
?php
class cls_a {
 function a(){
  echo 'allo';
 }
}

class impl_a {
 function get_impl_b(){
  return array('', 'echo Hello world;');
 }
}

$a = new cls_a();
$b_code = impl_a::get_impl_b();
$a-b = create_function($b_code[0], $b_code[1]);
$a-a();
$a-b();
?

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



RE: [PHP] Re: Unable to open word document.

2004-09-07 Thread Gryffyn, Trevor
Another thing to keep in mind is that Office products can run
invisible.  Sometimes you'll get COM failures and can't understand why
and it turns out that Word or Excel or whatever is still running, just
not visible.  Pull up your Task Manager and look for the process and
kill it.

The property in VBA is applicationobjectname.Visible = True  (or
False)

I forget the exact syntax for PHP, but you get the idea.

There's also a .UserControl T/F property that tells the application
whether it's allowed to auto-close when the COM call is done or if it
needs to stay open for the user to manipulate.  TRUE means to stay open
(even if it's not visible).

-TG

 -Original Message-
 From: M. Sokolewicz [mailto:[EMAIL PROTECTED] 
 Sent: Saturday, September 04, 2004 8:19 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: Unable to open word document.
 
 
 Cbharadwaj wrote:
  Hi,
  
  I am asked to generate reports on MS WORD.
  OFFICE 2000 is installed in mechine.
  when I am calling a PHP page containin this  code.
  
  $word = new COM(word.application) ;
  
  I am getting following error.
  Warning: (null)(): Unable to obtain IDispatch interface for CLSID
  {000209FF---C000-0046}:
  The message filter indicated that the application is busy
  
  your valuable help is needed.
  
  Bharadwaj.
 try closing word and running the script again...
 Also, which version of PHP are you using? Because asof PHP5 the COM 
 section has been thoroughly rewritten and is much easier to 
 use (aswell 
 as quicker, more stable, etc).
 
 Besides that, could you PLEASE adjust your system time, it's 
 miles ahead 
 and your messages don't order right in my mailclient. Thank you :)
 
 - Tul
 
 -- 
 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] Re: remote script execution

2004-09-07 Thread Matthew Weier O'Phinney
* Sean Smith [EMAIL PROTECTED]:
 Scenario

 Server 1 is a LAMP webserver.

 Server 2 is an email server.

 I have a php script on Server 2 that creates user accounts and echos the 
 UID, GID, and HOME. It works great when your logged into Server 2 and 
 run it from the CLI.

 What I'm trying to do is have my GUI on Server 1 call the script on 
 Server 2 and have Server 2 return the variable back to Server 1 for 
 processing. Is that possible? Any help would be appreciated. Thank you.

Try using fopen (assuming you have PHP compiled to allow streams with
the f* functions) or cURL; I've used both with good success, in similar
situations.

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



Re: [PHP] Dynamic Class Methods

2004-09-07 Thread Wouter van Vliet
On Tue, 7 Sep 2004 09:37:44 -0400, Mathieu Dumoulin
[EMAIL PROTECTED] wrote:
 I'm trying to setup a function from user code inside a defined object or a
 class definition but it doesnt seem to work. Am i doing it right? Is there
 something i need to know... is it even possible?
 
 I know create_function can be used to create a function and it returns the
 ident to run the function later on, lookup create_function on php.net and it
 seems possible. Now i wonder if you can actually assign this function inside
 a class. My final goal is to create a set of functions or objects that will
 be able to implement interfaces to object classes, which is something
 missing to the PHP language.
 
 --
 RESULT
 --
 allo
 Fatal error: Call to undefined function: b() in
 /home/tech/web/testboard/implements.php on line 21
 
 -
 CODE
 -
 ?php
 class cls_a {
  function a(){
   echo 'allo';
  }
 }
 
 class impl_a {
  function get_impl_b(){
   return array('', 'echo Hello world;');
  }
 }
 
 $a = new cls_a();
 $b_code = impl_a::get_impl_b();
 $a-b = create_function($b_code[0], $b_code[1]);
 $a-a();
 $a-b();
 ?

First of all, I must say that from PHP5, the php (zend) engine does
support interfaces and implementing interfaces. So, maybe that's what
you're looking for... Anyway, now let's go on to helping you out with
your question.

Your approach is impossible. I'm stuck with the same thing, trying to
get the function name from a constant.. but there is a very nice way
of dealing with this. If you're running php5, it plainly works.
Earlier versions will need the (experimental) overload
(http://nl2.php.net/manual/en/ref.overload.php) function..


?php
class Obj {
  var $gen = Array();
  function registerFunction($name, $args, $imp) {
$this-gen[$name] = create_function($args, $imp);
  }
  function __call($n, $args) {
call_user_func_array(Array($this, $this-gen[$n]), $args);
  }
}
?

after a registerFunction call, you can call your function as you'd
expect to call it. Everything I just wrote is untested, but I'm pretty
sure it'll work - safe for maybe some typo's.

have fun!

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



Re: [PHP] unzipping

2004-09-07 Thread raditha dissanayake
Mag wrote:
Hi,
Anybody know of a good class, tutorial or something
easy to let me unzip a file on my server?
 

well you could just use `unzip filename` but make sure you update your 
zip installation because some older versions had some vulnerabilities.

--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Dynamic Class Methods

2004-09-07 Thread Dan Joseph
 Fatal error: Call to undefined function: b() in
 /home/tech/web/testboard/implements.php on line 21


 $a-b();

You don't have a function b() defined in class cls_a.

-Dan Joseph

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



[PHP] ERROR

2004-09-07 Thread Jorge
?
session_start();
//echo session_id();

if (!isset($_SESSION['Id'])){

echo(scripttop.location.href='../portada.php';/script);
}
?

 Can somebody helps me ? the error is that login don' t access and I don't found the 
error.

Re: [PHP] Multi-User Text-Editing

2004-09-07 Thread Daniel Schierbeck
Okay, i got the general idea, now it all comes down to the actual 
writing. I'm making a function that compares two strings (the one in the 
source i read used an exec() call, but i'd like to do it all in PHP) 
per-line. This poses some difficulties. Here's the scenario:

I want to determine whether or not two lines are identical.
If they're not:
- Has the line simply been edited?
- Is it a completely new line?
- Has the line been deleted?
To do so i'll have to run a loop, checking each line. But here's where 
the problem is:

?php
$str1 = NEWTXT
Once there was a Bar
It was red
It had some Foo
Underneath its Foobar
NEWTXT;
$str2 = OLDTXT
Once there was a Bar
It had some Foo
Underneath its Foobar
OLDTXT;
$arr1 = explode('\n', $str1);
$arr2 = explode('\n', $str2);
$count = 0;
foreach ($arr1 as $line_num = $line) {
if (isset($arr2[$count]  ($line === $arr2[$count]))) {
echo Unchanged \ . $line . \\n;
} elseif ($line !== $arr2[$count]) {
echo Changed to \ . $line . \ from \ . $arr2[$count] . 
\\n;
} elseif (!isset($arr2[$count])) {
echo Added \ . $line . \, was  . $arr2[$count] . \\n;
}
$count++;
}
?
Then i'd get something like this:
Unchanged Once there was a Bar
Changed to It was red from It had some Foo
Changed to It had some Foo from Underneath its Foobar
Added Underneath its Foobar
Where the second, third and fourth line is wrong - i added a line 
between There was a Bar and It had some Foo...

How should i do this?










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


Re: [PHP] ERROR

2004-09-07 Thread Wouter van Vliet
 ?
 session_start();
 //echo session_id();
 
 if (!isset($_SESSION['Id'])){
 
 echo(scripttop.location.href='../portada.php';/script);
 }
 ?
 
  Can somebody helps me ? the error is that login don' t access and I don't found the 
 error.

Jorge,

can you supply somewhat more information on what you're doing? Where
do you set the $_SESSION['id'] value? Do you make a call to
session_start() on the page where you set $_SESSION['id']?

(though, from the look of this post - the problem is probably the use
of a capital I in Id instead of a lowercase one. Case mangling is a
very common error ..)
(also, I'd advise you to use the somewhat more elegant ?php
header('Location: http://www.domain.com/path/to/portada.php');
exit(0); ? way of redirecting.)

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



Re: [PHP] Multi-User Text-Editing

2004-09-07 Thread Wouter van Vliet
 ?php
 
 $str1 = NEWTXT
 Once there was a Bar
 It was red
 It had some Foo
 Underneath its Foobar
 NEWTXT;
 
 $str2 = OLDTXT
 Once there was a Bar
 It had some Foo
 Underneath its Foobar
 OLDTXT;
 
 $arr1 = explode('\n', $str1);
 $arr2 = explode('\n', $str2);
 
 $count = 0;
 
 foreach ($arr1 as $line_num = $line) {
 if (isset($arr2[$count]  ($line === $arr2[$count]))) {
 echo Unchanged \ . $line . \\n;
 } elseif ($line !== $arr2[$count]) {
 echo Changed to \ . $line . \ from \ . $arr2[$count] 
 . \\n;
 } elseif (!isset($arr2[$count])) {
 echo Added \ . $line . \, was  . $arr2[$count] . 
 \\n;
 }
 
 $count++;
 }
 
 ?
 
 Then i'd get something like this:
 
 Unchanged Once there was a Bar
 Changed to It was red from It had some Foo
 Changed to It had some Foo from Underneath its Foobar
 Added Underneath its Foobar
 
 Where the second, third and fourth line is wrong - i added a line
 between There was a Bar and It had some Foo...
 
 How should i do this?

Add something that goes to the next line in one file and stays on the
same line in the other whenver an addition is found - and use
http://nl2.php.net/manual/en/function.levenshtein.php or
http://nl2.php.net/manual/en/function.similar-text.php instead of !=
to see if a line has changed. I've never used it myself, but the
return value gives you a number indicating how different the strings
are. If they're very different AND the number of lines is not equal
you know for almost sure it's an addition.

Have fun finding the difference!

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



[PHP] Underscores within echo statements

2004-09-07 Thread Neil Freeman
Just a quick question. What is the purpose of the underscore character 
within the following echo statement? I had a quick look in the manual 
and archives but couldn't find any reference to it.

?php echo _(Username) ?
Thanks,
Neil
This communication is confidential to the intended recipient(s). If you are not 
that person you are not permitted to make use of the information and you are requested 
to notify the sender immediately of its receipt then destroy the copy in your 
possession. Any views or opinions expressed are those of the originator and may not 
represent those of Advanced System Architectures Ltd.
*** This Email Has Been Virus Checked ***
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Underscores within echo statements

2004-09-07 Thread John Holmes
From: Neil Freeman [EMAIL PROTECTED]
Just a quick question. What is the purpose of the underscore character 
within the following echo statement? I had a quick look in the manual 
and archives but couldn't find any reference to it.

?php echo _(Username) ?
http://us2.php.net/manual/en/function.gettext.php
---John Holmes...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


FW: [PHP] Dynamic Class Methods

2004-09-07 Thread Dan Joseph
I am not nearly as stupid as you are.  You're the one who can't get it to
work, not me.

-Dan Joseph

-Original Message-
From: Mathieu Dumoulin [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 07, 2004 10:56 AM
To: 'Dan Joseph'
Subject: RE: [PHP] Dynamic Class Methods

... are u stupid?

Next time read the whole mail before posting a reply and you'll know why i'm
sending you back a flame.

Mathieu Dumoulin
Groupimage Communications (http://www.groupimage.com/)
T: (514) 353-9595 // F: (514) 353-9550 // C: (514) 880-1442
-Original Message-
From: Dan Joseph [mailto:[EMAIL PROTECTED] 
Sent: 7 septembre 2004 10:41
To: 'Mathieu Dumoulin'; [EMAIL PROTECTED]
Subject: RE: [PHP] Dynamic Class Methods

 Fatal error: Call to undefined function: b() in
 /home/tech/web/testboard/implements.php on line 21


 $a-b();

You don't have a function b() defined in class cls_a.

-Dan Joseph

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



Re: [PHP] Underscores within echo statements

2004-09-07 Thread Marek Kilimajer
Neil Freeman wrote:
Just a quick question. What is the purpose of the underscore character 
within the following echo statement? I had a quick look in the manual 
and archives but couldn't find any reference to it.

?php echo _(Username) ?
see gettext extension
Thanks,
Neil

Could you turn this of?
This communication is confidential to the intended recipient(s). If you 
are not that person you are not permitted to make use of the information 
and you are requested to notify the sender immediately of its receipt 
then destroy the copy in your possession. Any views or opinions 
expressed are those of the originator and may not represent those of 
Advanced System Architectures Ltd.

*** This Email Has Been Virus Checked ***
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] gzip

2004-09-07 Thread Matt M.
 I have a file on my server that I want to compress in a php page i.e take file.txt 
 and add it to the archive file.zip.
 
 How the hell do I do it using gzip cant understand the manual, or is there another 
 way to create a zip file or other compressed file.
 

have you looked at http://pear.php.net/package/Archive_Zip

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



Re: [PHP] Dynamic Class Methods

2004-09-07 Thread Curt Zirzow
* Thus wrote Mathieu Dumoulin:
 I'm trying to setup a function from user code inside a defined object or a
 class definition but it doesnt seem to work. Am i doing it right? Is there
 something i need to know... is it even possible?
 
 I know create_function can be used to create a function and it returns the
 ident to run the function later on, lookup create_function on php.net and it
 seems possible. Now i wonder if you can actually assign this function inside
 a class. My final goal is to create a set of functions or objects that will
 be able to implement interfaces to object classes, which is something
 missing to the PHP language.
 
 --
 RESULT
 --
 allo
 Fatal error: Call to undefined function: b() in
 /home/tech/web/testboard/implements.php on line 21

This is because $a-b is a member not a method.

One option that you might want to look at is:

http://php.net/classkit

Keep in mind the above is still in beta, but will allow you to
add/remove/redefine methods of objects at runtime.  iirc it works
with php4 and php5.

The other option would be to set a variable within a class that the
method b() uses:

class impl_a {
  var $_b;

  function setFunc($func, $params, $code) {
$var = _$func; /* set up $this-varname */
$this-$var = create_function($params, $code);
  }

  function b() {
$func = $this-_b;
$func();
  }
}

$a = new impl_a();
$a-setFunc('b', '', 'echo hello world');
$a-b();

Its Not very clean solution, but might work in you situation.


Curt
-- 
The above comments may offend you. flame at will.

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



RE: [PHP] Dynamic Class Methods

2004-09-07 Thread Jay Blanchard
[snip]
...stupid...
[/snip]

Mathieu, calling one of the better contributors on this list stupid is a
quick way to earn your way into the 'ignored' group. He tried to help
you and you flame him?

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



Re: [PHP] Underscores within echo statements

2004-09-07 Thread Neil Freeman
Marek Kilimajer wrote:
***
This Email Has Been Virus Swept
***
Neil Freeman wrote:
Just a quick question. What is the purpose of the underscore character 
within the following echo statement? I had a quick look in the manual 
and archives but couldn't find any reference to it.

?php echo _(Username) ?

see gettext extension
Thanks,
Neil

Could you turn this of?
This communication is confidential to the intended recipient(s). If 
you are not that person you are not permitted to make use of the 
information and you are requested to notify the sender immediately of 
its receipt then destroy the copy in your possession. Any views or 
opinions expressed are those of the originator and may not represent 
those of Advanced System Architectures Ltd.

*** This Email Has Been Virus Checked ***

OK - great. Thanks for the quick reply John and Marek.
Marek - sorry about the rather lengthy signature. It's appended to all 
e-mails sent out by our company and is therefore out of my hands :(

This communication is confidential to the intended recipient(s). If you are not 
that person you are not permitted to make use of the information and you are requested 
to notify the sender immediately of its receipt then destroy the copy in your 
possession. Any views or opinions expressed are those of the originator and may not 
represent those of Advanced System Architectures Ltd.
*** This Email Has Been Virus Checked ***
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: FW: [PHP] Dynamic Class Methods

2004-09-07 Thread John Nichel
Mathieu Dumoulin wrote:
... are u stupid?
Next time read the whole mail before posting a reply and you'll know why i'm
sending you back a flame.
Mathieu Dumoulin
Groupimage Communications (http://www.groupimage.com/)
T: (514) 353-9595 // F: (514) 353-9550 // C: (514) 880-1442
Mathieu, did you forget your meds this morning?
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Dynamic Class Methods

2004-09-07 Thread John Nichel
Jay Blanchard wrote:
[snip]
...stupid...
[/snip]
Mathieu, calling one of the better contributors on this list stupid is a
quick way to earn your way into the 'ignored' group. He tried to help
you and you flame him?
We have an 'ignored' group?  Where do I sign up?  ;)
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Multi-User Text-Editing

2004-09-07 Thread Michal Migurski
 Okay, i got the general idea, now it all comes down to the actual
 writing. I'm making a function that compares two strings (the one in the
 source i read used an exec() call, but i'd like to do it all in PHP)
 per-line. This poses some difficulties. Here's the scenario:

Tavi Wiki just calls out to the diff command using exec(), which is a lazy
way of doing it. The wiki at c2.com does this too. Not sure what mediawiki
(Raditha's suggestion) does. If you want to implement your own version of
diff in PHP, you can start at the explanation here:
http://c2.com/cgi/wiki?DiffAlgorithm

Also there is this:
http://pear.php.net/package/Text_Diff

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



[PHP] Re: array_merge changed behaviour in Php5??

2004-09-07 Thread I2eptileX
I don't get it, this is a real problem for me. This is a backward 
incompatibility that brakes a lot of things.
You are allways whining about not being able to change the strange
parameters from functions due to backwards incompatibility. There a 
simple alias function would do the trick, and make things better and for 
new programers much more logical.
But now you do something like this, that makes absolutetly no sense to me.
And your doku at the given site is wrong, because I could live with a 
warning, but I cannot live with an empty array due to an array merge.

Instead of:
array_merge() was changed to accept only arrays. If a non-array variable 
is passed, a E_WARNING will be thrown for every such parameter. Be 
careful because your code may start emitting E_WARNING out of the blue.

It should say:
array_merge() was changed to accept only arrays. If a non-array variable 
is passed, a E_WARNING will be thrown for every such parameter and your 
resulting array will be empty. Be careful because your code may start 
emitting E_WARNING out of the blue and all of them will result in an 
empty array.

Can you at least explain me why it has been changed, before I go and 
change 150 lines of code, please?

Yours Sincerely
Sebastian
M. Sokolewicz wrote:
You can find more info about this here:
http://www.php.net/manual/en/migration5.incompatible.php
I2eptilex wrote:
Hi,
I came across a strange behaviour in array_merge since I installed php5.
I merge three arrays, one of them can be empty. So not an array at all.
In php 4.3.6 that I had before, there was no warning and the two first 
arrays were merged. In php5 on the other hand, there is a warning and 
my array is empty.
Is this behaviour wanted? Or is this just me having this problem?
I find it pretty ugly, either there is more than a warning, or at 
least the first two arrays should be merged and given back.

$array_1 = array('key1'='oranges','key2'='apples');
$array_2 = array('key3'='pears','key4'='tomatoes');
$array_3 = null;
$arr_gemerged = array_merge($array_1,$array_2,$array_3);
print_r($arr_gemerged);
Result on php4:
Array ( [key1] = oranges [key2] = apples [key3] = pears [key4] = 
tomatoes )

Result on php5:
Warning: array_merge() [function.array-merge]: Argument #3 is not an 
array in 
/Library/WebServer/Documents/regis24/admin/test_array_merge.php on line 7

I would define this behaviour as backwards incompatible. How about you?
Sebastian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Dynamic Class Methods

2004-09-07 Thread Alex Hogan
 Keep in mind the above is still in beta, but will allow you to
 add/remove/redefine methods of objects at runtime. 

You'll have to excuse me form my ignorance, but why would you want to
add, remove or redefine methods of objects at runtime?

I understand object overloading, but are you talking about something else?



alex hogan

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



[PHP] PHP for 'Calculate the statistics for a line'

2004-09-07 Thread Eugene Voznesensky
I am looking for PHP imlementation of the Statistics
calculation for a line. It should have the same
functionality like Excel LINEST.

[From Excel Help: LINEST:Calculates the statistics
for a line by using the least squares method to
calculate a straight line that best fits your data,
and returns an array that describes the line.}

Thank you!

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



Re: [PHP] Re: array_merge changed behaviour in Php5??

2004-09-07 Thread Jim Grill
 Can you at least explain me why it has been changed, before I go and
 change 150 lines of code, please?

 Yours Sincerely

 Sebastian

Sebastian,

Version 5 is what you would call a Major Version change. This is like
comparing MySQL 4.x to MySQL 3.x. An insert statement that would result in
duplicate keys used to issue a warning and would be skipped in a batch - now
it issues a fatal error halting the batch. Using a new feature like on
duplicate key update or REPLACE INTO ... is the better way to go if you
want to explicitly ignore duplicates. This comparison is only meant as an
example to explain why changes are made.

With PHP 5 there are many fixes and small changes like this. To many,
allowing non array values in array_merge() might seem like a mis-feature. To
you it is obviously a problem. Many people would argue that you should have
declared your array before hand to avoid this problem. This is why major
versions are released early while the older major version is still supported
like Apache 1.3.x VS. Apache 2.0.x and PHP 4.3.x VS. PHP 5.0.x.

Some modifications to existing code are expected; hence the migration
documentation. I can certainly understand your frustration as can many
others, however, this is an anticipated (and documented) issue.

Now, if I could just figure out how to plug this new fire wire storage
device into my 386 I'd be a happy camper. :-)

Best to you,

Jim Grill

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



[PHP] Intermittent Seg Fault with PHP4.3.8 + FTP

2004-09-07 Thread Steve Brown
I'm using PHP to write some backup scripts.  One of the scripts uses
PHP to connect via FTP to a server, download some scripts and tar them
up.  I'm getting intermittent segmentation faults with this script,
and I'm not sure what to report to troubleshoot this.  Can someone
tell me what would be useful information to help determine the case of
this seg fault?  Thanks.

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



Re: [PHP] More on the credit card fraud

2004-09-07 Thread Matt M.
 The fraudulent orders that I receive on my site come with email
 addresses of eight random alphanumerics @yahoo.com.

preg_match('/[EMAIL PROTECTED]/', $email) should do the trick

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



[PHP] Re: Instant private messenger

2004-09-07 Thread Manuel Lemos
Hello,
On 09/06/2004 06:31 PM, Phpu wrote:
I wanna create an instant private messenger for users who are online on my site.
Foe example: I have a list with online users. I select the user which i wanna send an 
message. A popup window will apear, i write the message and click send. To that user 
it will appear a popup window with my message.
How can i do that? I've googled but all i found was expensive. 
I need a tutorial or something. Could someone help me please !!! 
You may want to try this Web based private messaging package:
Class: libSiteMessage
http://www.phpclasses.org/libsitemessage
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Dynamic Class Methods

2004-09-07 Thread Matthew Weier O'Phinney
* Alex Hogan [EMAIL PROTECTED]:
 Keep in mind the above is still in beta, but will allow you to
 add/remove/redefine methods of objects at runtime. 

 You'll have to excuse me form my ignorance, but why would you want to
 add, remove or redefine methods of objects at runtime?

 I understand object overloading, but are you talking about something else?

I can think of some good reasons -- the one that readily leaps to mind
is a plugin architecture. 

In perl, you have namespaces, and multiple files can share the same
namespace. This is handy because it allows you to separate classes over
multiple files, and also to dynamically add methods/properties to your
class when needed. For instance, let's say you have a base class that
has the following methods:

init()
run()
load_config()

Now, you could easily extend the class and add new methods, of course;
that's worked in PHP OOP since the beginning. But what if you end up
with three subclasses, each adding methods as follows:

Sub1::error()
Sub2::validate()
Sub3::login()

The problem arises when you want to get a combination of these
subclasses for a single class; how do you do it without creating a new
class? For instance, if I need an object that has the methods of the
base class, plus error() and validate(), how do I do it without making a
fourth subclass that duplicates the methods of Sub1 and Sub2?

As I mentioned above, this is (fairly) trivial to do in perl, as you can
have them use the same namespace and dynamically import methods from
other files into your class. How does one do the same in PHP?

I think the overloading introduced in PHP5 *may* help -- you could look
to see if a file with a name matching the method called exists, load it
into a variable, and then add a function dynamically. I'd need to test
something like this pretty rigorously, though.

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



[PHP] Announcement: Smarty template engine 2.6.4 released

2004-09-07 Thread Monte Ohrt
Hi,
This is a bug fix and minor feature release.
Have fun,
-Monte
Homepage: 
http://*smarty*.php.net/ http://smarty.php.net/

ChangeLog: 
http://*smarty*.php.net/misc/NEWS http://smarty.php.net/misc/NEWS

Download: 
http://*smarty*.php.net/download.php http://smarty.php.net/download.php

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


Re: [PHP] Dynamic Class Methods

2004-09-07 Thread Alex Hogan
[snip]
I can think of some good reasons -- the one that readily leaps to mind
is a plugin architecture.
[/snip]

OK.., Duh.., that hit me like a brick.  It may take some time but
eventually the light will come on. ;-)

I don't know why but, plugins never crossed my mind in php
development.  Until now I've always thought of plugins as purley
client side development.




alex hogan

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



Re: [PHP] remote script execution

2004-09-07 Thread Sean Smith
Warren,
   I use ssh on all of my servers for logging in remotely. My next 
question would be, how do I connect to the remote server to run commands 
through PHP? Do I need to setup a socket or something? Could you provide 
me a pseudo sample or maybe point me to some docs. I've never had to do 
this type of thing in PHP before and I want to make sure I do it right. 
Thanks.

Sean
Vail, Warren wrote:
I've done a number of these and the choice depends on many things but
perhaps the biggest factor is;
Is server 1 and server 2 behind the same firewall or are they exposed to the
internet?
Behind a firewall you can probably get away with running any one of the
following commands to remotely execute your script on server 2, from server
1;
Rexec, rsh, rpc, just to name 3.  The client part of the protocol is
required on server 1 and the daemon part needs to be running on server 2.
Across the open internet, be very careful here, I would think the choice
would be ssh (secure shell).  This has several nice features that could be
useful internally as well.  You start out by exchanging encryption keys
between the two servers and because of this handshake, each server trusts
the other in a way that the correct execution permissions can be established
on server 2, and of course the data sent between the servers is encrypted
rendering it virtually useless to third parties.  Google for ssh for more
info.
Warren Vail
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Intermittent Seg Fault with PHP4.3.8 + FTP

2004-09-07 Thread Jim Grill
 I'm using PHP to write some backup scripts.  One of the scripts uses
 PHP to connect via FTP to a server, download some scripts and tar them
 up.  I'm getting intermittent segmentation faults with this script,
 and I'm not sure what to report to troubleshoot this.  Can someone
 tell me what would be useful information to help determine the case of
 this seg fault?  Thanks.


I would be happy to offer some help with this issue, but need more
information first.

1) Environment
a) OS
b) PHP Version
c) CLI or web-based
d) Are you running php as an apache module?
2) Logs/errors
a) example from log file (just the error line(s))
b) what is segfaulting? (Apache, PHP, Kernel, other)
c) Any error messages?
3) Any other pertinent information

Jim Grill

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



Re: [PHP] Intermittent Seg Fault with PHP4.3.8 + FTP

2004-09-07 Thread Steve Brown
 1) Environment
 a) OS
 b) PHP Version
 c) CLI or web-based
 d) Are you running php as an apache module?

I'm runnning PHP 4.3.8 in CLI on Redhat 9 in this particular case. 
PHP compiled with --enable-ftp (among other things).  PHP is installed
as an Apache2 module, but (obviously since this is CLI), Apache isn't
involved here.  All other scripts work fine (CLI and web-based). 
Server is a dual MP 1600+.  I've got the same setup running on a
non-SMP server  and it also seg faults at about the same place.

 2) Logs/errors
 a) example from log file (just the error line(s))
 b) what is segfaulting? (Apache, PHP, Kernel, other)
 c) Any error messages?

I assume this is PHP seg faulting as I'm running CLI here.  No error
messages or anything (not hiding them or anything like that).  Nothing
in the sys logs.  The script runs for a while (I've got it echoing
what file it is d/l'ing), but then displays Segmentation Fault after
it downloads several files.

 3) Any other pertinent information

It does not die after a specific file, e.g. it dies randomly.  Also,
if I reduce the number of files to be d/l'ed, it won't seg fault. 
Usually it faults after d/ling about 210 files (it varies), but I've
seen it go as high as 290.  Its actually made it all the way through
the script once today, but seg faults most of them time.

The random nature leads me to believe that this is some sort of
harmful interaction between this server and the FTP server.  The FTP
server is a Windows-based host.  An almost identical script runs just
fine while connecting to other servers.

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



RE: [PHP] remote script execution

2004-09-07 Thread Vail, Warren
Ignoring PHP for a moment; to execute a string of commands on a remote
machine using ssh you would execute the following;

Promptssh -l user ps -ef|grep edit;cd /usr/local/bin;ls -la

Which would result in showing any edit processes, followed by a listing of
the contents of the /usr/local/bin directory.

Notice that I did not include a password (this is not needed if the two
servers have already exchanged security keys), and as near as I know, cannot
be supplied unless you are there to type it in on a tty type device, so be
sure to get the keys setup properly.  You will also need the client program
ssh installed on the originating machine, and the daemon sshd installed
on the remote machine, but then you probably knew that ;-)

In PHP simply;

$cmd = ssh -l user \ps -ef|grep edit;cd /usr/local/bin;ls -la;
$rtn = exec($cmd, $responselines);

http://us4.php.net/manual/en/function.exec.php

$responselines is now an array containing lines of output from the commands.

Hope this helps,

Warren Vail


-Original Message-
From: Sean Smith [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 07, 2004 11:43 AM
To: Vail, Warren
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] remote script execution


Warren,

I use ssh on all of my servers for logging in remotely. My next 
question would be, how do I connect to the remote server to run commands 
through PHP? Do I need to setup a socket or something? Could you provide 
me a pseudo sample or maybe point me to some docs. I've never had to do 
this type of thing in PHP before and I want to make sure I do it right. 
Thanks.

Sean

Vail, Warren wrote:

I've done a number of these and the choice depends on many things but 
perhaps the biggest factor is;

Is server 1 and server 2 behind the same firewall or are they exposed 
to the internet?

Behind a firewall you can probably get away with running any one of the 
following commands to remotely execute your script on server 2, from 
server 1;

Rexec, rsh, rpc, just to name 3.  The client part of the protocol is 
required on server 1 and the daemon part needs to be running on server 
2.

Across the open internet, be very careful here, I would think the 
choice would be ssh (secure shell).  This has several nice features 
that could be useful internally as well.  You start out by exchanging 
encryption keys between the two servers and because of this handshake, 
each server trusts the other in a way that the correct execution 
permissions can be established on server 2, and of course the data sent 
between the servers is encrypted rendering it virtually useless to 
third parties.  Google for ssh for more info.

Warren Vail


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



Re: [PHP] Intermittent Seg Fault with PHP4.3.8 + FTP

2004-09-07 Thread Greg Donald
On Tue, 2004-09-07 at 15:21, Steve Brown wrote:
 The random nature leads me to believe that this is some sort of
 harmful interaction between this server and the FTP server.  The FTP
 server is a Windows-based host.  An almost identical script runs just
 fine while connecting to other servers.

I had to work on a client machine running some kind of windows ftp
server a few months ago, and I had very similar issues.  Random
unexplainable breakages when downloading lots of files.  I know this
doesn't help your current issue, but I thought I would share my
experience.


-- 
Greg Donald

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



Re: [PHP] Re: array_merge changed behaviour in Php5??

2004-09-07 Thread Curt Zirzow
* Thus wrote I2eptileX:
 I don't get it, this is a real problem for me. This is a backward 
 incompatibility that brakes a lot of things.
 You are allways whining about not being able to change the strange
 parameters from functions due to backwards incompatibility. There a 
 simple alias function would do the trick, and make things better and for 
 new programers much more logical.

I'm not sure who you're talking to.  

 But now you do something like this, that makes absolutetly no sense to me.
 And your doku at the given site is wrong, because I could live with a 
 warning, but I cannot live with an empty array due to an array merge.

This change actually fixes something that was broken. The function
is designed to accept multiple array's and merge them together; not
to take any value, if not array convert to an array,  then
merge the array's. What happens if you do something like:

  $var = 'scalar';
  echo current($var);

 Instead of:
 array_merge() was changed to accept only arrays. If a non-array variable 
 is passed, a E_WARNING will be thrown for every such parameter. Be 
 careful because your code may start emitting E_WARNING out of the blue.
 
 It should say:
 array_merge() was changed to accept only arrays. If a non-array variable 
 is passed, a E_WARNING will be thrown for every such parameter and your 
 resulting array will be empty. Be careful because your code may start 
 emitting E_WARNING out of the blue and all of them will result in an 
 empty array.

You can submit a documentation bug at http://bugs.php.net/.

 
 Can you at least explain me why it has been changed, before I go and 
 change 150 lines of code, please?

 - Do some research.
 - Contact the internals list and ask them: http://php.net/mailing-lists.php

   note: 
   You might want to change your tone of you message, i doubt
   calling the developers 'whiners' is really going to help you get
   your questions answered.


Curt
-- 
The above comments may offend you. flame at will.

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



Re: [PHP] More on the credit card fraud

2004-09-07 Thread Curt Zirzow
* Thus wrote Brian Dunning:
 The fraudulent orders that I receive on my site come with email 
 addresses of eight random alphanumerics @yahoo.com.

consider blocking any free address: hotmail, gmx.net, etc.. Of
course gmail is an exception, who would want to get that one
revoked ;)

 - Brian
 
 PS - If anyone wants an update: the orders stopped for a while but 
 started up this weekend with a vengeance. Now they are coming with 
 valid address verification AND card validation numbers! Pretty darn 
 good, whoever's doing it. One of the cops I've spoken with says that 
 they're making a large number of small charges (like mine) to these 
 cards and then, in one case, placing a large $2000 order from QVC. In 
 that case the large charge was declined, thankfully.

This seems to b a rather common practice, they'll go through and check
which cards are valid by attempting small charges on them and the
ones that work a few times will then attempt a large order.


Curt
-- 
The above comments may offend you. flame at will.

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



[PHP] Is ob_gzhandler interfering with dynamic zipping???

2004-09-07 Thread Thomas Hochstetter
Hi there,
 
Still sitting on this problem of not being able to dynamically zip a bunch
of files together, to output them as a Save Dialog box for downloading. I am
using the rather old pclzip classes for the zipping part (still wrestle with
the server admin to get Archive_xxx stuff from PEAR installed - hate Debian
servers!).
 
Now I came across a discussion in which someone said that [code] ob_start(
ob_gzhandler);[/code] should not be used when one things of dynamically
outputting stuff via header() to the browser.
 
Anyone has got a story on that? Or even better, an idea how to get this show
going even with [same-code]ob_start( ob_gzhandler);[/same-code] enabled.
 
Help is appreciated!
 
Thomas
 
P.S. Sorry Marek, last time is was a bit slow to respond. ;-)


[PHP] Re: Is ob_gzhandler interfering with dynamic zipping???

2004-09-07 Thread Torsten Roehr
Thomas Hochstetter [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi there,

 Still sitting on this problem of not being able to dynamically zip a bunch
 of files together, to output them as a Save Dialog box for downloading. I
am
 using the rather old pclzip classes for the zipping part (still wrestle
with
 the server admin to get Archive_xxx stuff from PEAR installed - hate
Debian
 servers!).

Hi Thomas,

why not using your own PEAR version of Archive_xxx? Install it locally (or
download/unpack the archive), upload it into a custom PEAR dir and set the
include path to it (maybe just in the script where you need it).

Regards, Torsten Roehr

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



[PHP] referencing a class

2004-09-07 Thread Jed R. Brubaker
Quick question here. Has anyone run into trouble with a variable reference 
to a class object?

Here is the code:
$_SESSION['database'] = new Database;
$this-db = $_SESSION['database'];

Everything goes screwy after a call like this.

Thanks in advance! 

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



[PHP] mail() from addess problems

2004-09-07 Thread Josh Close
When I'm using mail() to send an email, the user is always

From: Apache [EMAIL PROTECTED]

How would I get this to change? I didn't see anything in php.ini or
httpd.conf. I've found it's not possible to do a header rewrite with
postfix either.

-Josh

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



Re: [PHP] mail() from addess problems

2004-09-07 Thread Greg Donald
On Tue, 2004-09-07 at 16:52, Josh Close wrote:
 When I'm using mail() to send an email, the user is always
 
 From: Apache [EMAIL PROTECTED]
 
 How would I get this to change? I didn't see anything in php.ini or
 httpd.conf. I've found it's not possible to do a header rewrite with
 postfix either.

Add a From: header in the optional last field of your mail() call.


-- 
Greg Donald

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



Re: [PHP] mail() from addess problems

2004-09-07 Thread Matt M.
 How would I get this to change? I didn't see anything in php.ini or
 httpd.conf. I've found it's not possible to do a header rewrite with
 postfix either.

There is examples in the manual

http://us2.php.net/mail

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



Re: [PHP] mail() from addess problems

2004-09-07 Thread Josh Close
Thanks.

-Josh


On Tue, 07 Sep 2004 16:55:24 -0500, Greg Donald [EMAIL PROTECTED] wrote:
 
 
 On Tue, 2004-09-07 at 16:52, Josh Close wrote:
  When I'm using mail() to send an email, the user is always
 
  From: Apache [EMAIL PROTECTED]
 
  How would I get this to change? I didn't see anything in php.ini or
  httpd.conf. I've found it's not possible to do a header rewrite with
  postfix either.
 
 Add a From: header in the optional last field of your mail() call.
 
 --
 Greg Donald
 


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



[PHP] create a zip file

2004-09-07 Thread Matthew Oatham
Hi,

I have been trying to find a way of creating a zip file. I have a file on my server 
that I want to compress I have had a look at gzip but cant work out what to do. 

Can someone point me to a function or an example of how to do this.

thanks

matt

Re: [PHP] Intermittent Seg Fault with PHP4.3.8 + FTP

2004-09-07 Thread Jim Grill
 I'm runnning PHP 4.3.8 in CLI on Redhat 9 in this particular case.
 PHP compiled with --enable-ftp (among other things).  PHP is installed
 as an Apache2 module, but (obviously since this is CLI), Apache isn't
 involved here.  All other scripts work fine (CLI and web-based).
 Server is a dual MP 1600+.  I've got the same setup running on a
 non-SMP server  and it also seg faults at about the same place.

 I assume this is PHP seg faulting as I'm running CLI here.  No error
 messages or anything (not hiding them or anything like that).  Nothing
 in the sys logs.  The script runs for a while (I've got it echoing
 what file it is d/l'ing), but then displays Segmentation Fault after
 it downloads several files.

 It does not die after a specific file, e.g. it dies randomly.  Also,
 if I reduce the number of files to be d/l'ed, it won't seg fault.
 Usually it faults after d/ling about 210 files (it varies), but I've
 seen it go as high as 290.  Its actually made it all the way through
 the script once today, but seg faults most of them time.


OK. Sounds like a genuine segfault to me. The CLI version will simply print
Segmentation fault to the screen or Segmentation fault (core dumped)
when configured with debugging enabled.

You will need to recompile and install PHP with the --enable-debug option.
If you compiled from source you can usually go to your source tree and run
./config.nice --enable-debug  make  make install

You need to have gdb installed (most likely, you already do). Since you are
running a CLI script this will be super easy. This is the best way to go
about it IMHO with your particular problem:

At the prompt type:

$ gdb php

This will fire up the debugger and give you a prompt like so: (gdb). Type
the following at the gdb prompt:

(gdb) run /path/to/crashing/script.php

This will run the application and will produce some kind of message
indicating that there was a segfault like so Program received signal
SIGSEGV, Segmentation fault. In the example below it was clearly
mysqli_read_property() that caused the problem.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 17763)]
0x080d9e48 in mysqli_read_property (object=0x83b8184, member=0x83b5fb0,
type=0)
at /usr/local/src/php/php-5.0.1/ext/mysqli/mysqli.c:204
204 if (!obj-ptr ||

Once you receive a message like that, type the following at the gdb prompt:

(gdb) bt

This will produce a backtrace with one instruction per line with the last
instruction at the top of the list.

Alternately, if you run your code in CLI mode, and it segfaults, a file
called core will be created in the directory you are working in. You can
perform the same task using the core file like by running the following
command: (replace /usr/local/bin/php with the path to your php executable)

$ gdb /usr/local/bin/php /path/to/core

Then type bt at the (gdb) prompt.

The problem with running gdb and bt is that you have to have an intimate
understanding of the PHP source code to get anything more than just a hint
about the problem. If you can reproduce the segfault and capture a backtrace
consistently you might have found a PHP bug. *Most* segfaults are caused by
bugs since PHP is interpreted.

What to do:

If any of the output from gdb give you a hint what the problem could be (ftp
functions or something) research each of the functions you are using on the
PHP site reading the user added comments. Look for any mention of a possible
segfault. Search the PHP bugs on http://bugs.php.net for your PHP version
using the name of the function and/or the name of the commands in the
backtrace. Chances are someone has already found the bug and there may be a
workaround or the problem has been fixed in CVS or in a newer version (in
your case PHP 4.3.9RC2).

If you can't find anything relating to your problem on PHP.net,
bugs.php.net, or google then you should follow the proceedure for reporting
bugs on http://bugs.php.net/ . It's a thankless job, but it helps everyone
out in the long run if done properly. It will be much appreciated if you
follow the above steps and include sample code and gdb information when
submitting a bug. Leave it to the real pros to read the backtrace output!
:-)

Good luck,

Jim Grill

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



[PHP] Problem compiling PHP5

2004-09-07 Thread Paul Reinheimer
Hi, 

I am attempting to compile PHP with the following command:
./configure --with-mysql=/usr/local/mysql
--with-apxs=/etc/httpd/bin/apxs --with-gd --with-png
--with-zlib-dir=/root/zlib-1.2.1 --enable-gd-native-ttf --with-ttf
--with-jpeg-dir=/usr/local/lib/jpeg-6b/
--with-freetype-dir=/usr/local/lib/free
type-2.1.9/ --with-xpm-dir=/usr/local/lib/xpm-3.4k-linux/
--with-freetype-dir --with-xpm-dir=/usr/local/lib/xpm-3.4k-linux/lib/

Resulting with
...
checking for the location of libXpm... /usr/local/lib/xpm-3.4k-linux/lib/
checking for FreeType 1.x support... yes
checking for FreeType 2... yes
checking for T1lib support... no
checking whether to enable truetype string function in GD... yes
checking whether to enable JIS-mapped Japanese font support in GD... no
checking for fabsf... (cached) yes
checking for floorf... (cached) yes
checking for jpeg_read_header in -ljpeg... (cached) yes
checking for png_write_image in -lpng... (cached) yes
configure: error: libXpm.(a|so) not found.
[EMAIL PROTECTED] php-5.0.1]# cd /usr/local/lib/xpm-3.4k-linux/lib/
[EMAIL PROTECTED] lib]# ls
libXpm.so  libXpm.so.4  libXpm.so.4.11
[EMAIL PROTECTED] lib]# ls -al
total 96
drwxrwxr-x2 1618 16   4096 Mar 19  1998 .
drwxrwxr-x6 1618 16   4096 Mar 19  1998 ..
lrwxrwxrwx1 1618 16 14 Sep  5 12:15 libXpm.so -
libXpm.so.4.11
lrwxrwxrwx1 1618 16 14 Sep  5 12:15 libXpm.so.4 -
libXpm.so.4.11
-rwxr-xr-x1 1618 16  82734 Mar 19  1998 libXpm.so.4.11
[EMAIL PROTECTED] lib]# 

Why am I getting the error that libXpm.(a|so) can't be found, when php
should really be looking right at it?


thanks
paul

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



[PHP] Byte size of text?

2004-09-07 Thread John Smith
What's the most accurate way to get the byte count of
some text? Is strlen() accurate with Unicode, ASCII,
etc.?

John

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: [PHP] Problem compiling PHP5

2004-09-07 Thread Curt Zirzow
* Thus wrote Paul Reinheimer:
 Hi, 
 
 I am attempting to compile PHP with the following command:
 ./configure --with-mysql=/usr/local/mysql
 --with-apxs=/etc/httpd/bin/apxs --with-gd --with-png
 --with-zlib-dir=/root/zlib-1.2.1 --enable-gd-native-ttf --with-ttf
 --with-jpeg-dir=/usr/local/lib/jpeg-6b/
 --with-freetype-dir=/usr/local/lib/free
 type-2.1.9/ --with-xpm-dir=/usr/local/lib/xpm-3.4k-linux/
 --with-freetype-dir --with-xpm-dir=/usr/local/lib/xpm-3.4k-linux/lib/
 
 Resulting with
 ...
 checking for the location of libXpm... /usr/local/lib/xpm-3.4k-linux/lib/
 checking for FreeType 1.x support... yes
 checking for FreeType 2... yes
 checking for T1lib support... no
 checking whether to enable truetype string function in GD... yes
 checking whether to enable JIS-mapped Japanese font support in GD... no
 checking for fabsf... (cached) yes
 checking for floorf... (cached) yes
 checking for jpeg_read_header in -ljpeg... (cached) yes
 checking for png_write_image in -lpng... (cached) yes
 configure: error: libXpm.(a|so) not found.
 [EMAIL PROTECTED] php-5.0.1]# cd /usr/local/lib/xpm-3.4k-linux/lib/

This seems like an odd location.


 [EMAIL PROTECTED] lib]# ls
 libXpm.so  libXpm.so.4  libXpm.so.4.11
 [EMAIL PROTECTED] lib]# ls -al
 total 96
 drwxrwxr-x2 1618 16   4096 Mar 19  1998 .
 drwxrwxr-x6 1618 16   4096 Mar 19  1998 ..
 lrwxrwxrwx1 1618 16 14 Sep  5 12:15 libXpm.so -
 libXpm.so.4.11
 lrwxrwxrwx1 1618 16 14 Sep  5 12:15 libXpm.so.4 -
 libXpm.so.4.11
 -rwxr-xr-x1 1618 16  82734 Mar 19  1998 libXpm.so.4.11
 [EMAIL PROTECTED] lib]# 
 
 Why am I getting the error that libXpm.(a|so) can't be found, when php
 should really be looking right at it?

Your user/group names seem broken, or is this a nfs mount or the
like?



Curt
-- 
The above comments may offend you. flame at will.

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



[PHP] Re: Problem compiling PHP5

2004-09-07 Thread Paul Reinheimer
Taking the /lib/ portion of the configure command changes the error to 
configure: error: Problem with libXpm.(a|so) or libX11.(a|so). Please
check config.log for more information.

Which (assuming it means that it needs libXpm.so AND libX11.so) means
I might have a lead to follow.


thanks
paul



On Tue, 7 Sep 2004 18:33:39 -0400, Paul Reinheimer
[EMAIL PROTECTED] wrote:
 Hi,
 
 I am attempting to compile PHP with the following command:
 ./configure --with-mysql=/usr/local/mysql
 --with-apxs=/etc/httpd/bin/apxs --with-gd --with-png
 --with-zlib-dir=/root/zlib-1.2.1 --enable-gd-native-ttf --with-ttf
 --with-jpeg-dir=/usr/local/lib/jpeg-6b/
 --with-freetype-dir=/usr/local/lib/free
 type-2.1.9/ --with-xpm-dir=/usr/local/lib/xpm-3.4k-linux/
 --with-freetype-dir --with-xpm-dir=/usr/local/lib/xpm-3.4k-linux/lib/
 
 Resulting with
 ...
 checking for the location of libXpm... /usr/local/lib/xpm-3.4k-linux/lib/
 checking for FreeType 1.x support... yes
 checking for FreeType 2... yes
 checking for T1lib support... no
 checking whether to enable truetype string function in GD... yes
 checking whether to enable JIS-mapped Japanese font support in GD... no
 checking for fabsf... (cached) yes
 checking for floorf... (cached) yes
 checking for jpeg_read_header in -ljpeg... (cached) yes
 checking for png_write_image in -lpng... (cached) yes
 configure: error: libXpm.(a|so) not found.
 [EMAIL PROTECTED] php-5.0.1]# cd /usr/local/lib/xpm-3.4k-linux/lib/
 [EMAIL PROTECTED] lib]# ls
 libXpm.so  libXpm.so.4  libXpm.so.4.11
 [EMAIL PROTECTED] lib]# ls -al
 total 96
 drwxrwxr-x2 1618 16   4096 Mar 19  1998 .
 drwxrwxr-x6 1618 16   4096 Mar 19  1998 ..
 lrwxrwxrwx1 1618 16 14 Sep  5 12:15 libXpm.so -
 libXpm.so.4.11
 lrwxrwxrwx1 1618 16 14 Sep  5 12:15 libXpm.so.4 -
 libXpm.so.4.11
 -rwxr-xr-x1 1618 16  82734 Mar 19  1998 libXpm.so.4.11
 [EMAIL PROTECTED] lib]#
 
 Why am I getting the error that libXpm.(a|so) can't be found, when php
 should really be looking right at it?
 
 thanks
 paul


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



Re: [PHP] Problem compiling PHP5

2004-09-07 Thread Jim Grill
 Hi,

 I am attempting to compile PHP with the following command:
 ./configure --with-mysql=/usr/local/mysql
 --with-apxs=/etc/httpd/bin/apxs --with-gd --with-png
 --with-zlib-dir=/root/zlib-1.2.1 --enable-gd-native-ttf --with-ttf
 --with-jpeg-dir=/usr/local/lib/jpeg-6b/
 --with-freetype-dir=/usr/local/lib/free
 type-2.1.9/ --with-xpm-dir=/usr/local/lib/xpm-3.4k-linux/
 --with-freetype-dir --with-xpm-dir=/usr/local/lib/xpm-3.4k-linux/lib/


Would the problem be that you are providing two different locations for xpm?
You have --with-xpm-dir=/usr/local/lib/xpm-3.4k-linux/ *and*
--with-xpm-dir=/usr/local/lib/xpm-3.4k-linux/lib/

The first one appears to be incorrect. This would be a problem.

Just an observation.

Good luck,

Jim Grill

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



Re: [PHP] Problem compiling PHP5

2004-09-07 Thread Jim Grill
 * Thus wrote Paul Reinheimer:
  Hi,
 
  I am attempting to compile PHP with the following command:
  ./configure --with-mysql=/usr/local/mysql
  --with-apxs=/etc/httpd/bin/apxs --with-gd --with-png
  --with-zlib-dir=/root/zlib-1.2.1 --enable-gd-native-ttf --with-ttf
  --with-jpeg-dir=/usr/local/lib/jpeg-6b/
  --with-freetype-dir=/usr/local/lib/free
  type-2.1.9/ --with-xpm-dir=/usr/local/lib/xpm-3.4k-linux/
  --with-freetype-dir --with-xpm-dir=/usr/local/lib/xpm-3.4k-linux/lib/
 

 This seems like an odd location.

It does seem odd. Mine are in:

/usr/X11R6/lib/libXpm.so.4.11
/usr/X11R6/lib/libXpm.so.4
/usr/X11R6/lib/libXpm.so

They are the default installed with X11.



  [EMAIL PROTECTED] lib]# ls
  libXpm.so  libXpm.so.4  libXpm.so.4.11
  [EMAIL PROTECTED] lib]# ls -al
  total 96
  drwxrwxr-x2 1618 16   4096 Mar 19  1998 .
  drwxrwxr-x6 1618 16   4096 Mar 19  1998 ..
  lrwxrwxrwx1 1618 16 14 Sep  5 12:15 libXpm.so -
  libXpm.so.4.11
  lrwxrwxrwx1 1618 16 14 Sep  5 12:15 libXpm.so.4 -
  libXpm.so.4.11
  -rwxr-xr-x1 1618 16  82734 Mar 19  1998 libXpm.so.4.11
  [EMAIL PROTECTED] lib]#
 
  Why am I getting the error that libXpm.(a|so) can't be found, when php
  should really be looking right at it?

 Your user/group names seem broken, or is this a nfs mount or the
 like?

Good call, Curt.

That happens when you untar something that was originally created on another
machine with different users and groups... like a source tarball. Was libxpm
actually installed or just untared there?

Jim Grill




 Curt
 -- 
 The above comments may offend you. flame at 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] Re: Problem compiling PHP5

2004-09-07 Thread Jim Grill
 Taking the /lib/ portion of the configure command changes the error to 
 configure: error: Problem with libXpm.(a|so) or libX11.(a|so). Please
 check config.log for more information.
 
 Which (assuming it means that it needs libXpm.so AND libX11.so) means
 I might have a lead to follow.
 
 
 thanks
 paul
 
 
...and the config.log says what??? ;-)

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



[PHP] Re: Convert Smart Quotes to Sraight Quotes - Need Help!

2004-09-07 Thread Monty
Anyone! I'm out of online resources and answers. I guess this isn't possible
to do...

 I've been reading for the last three days about character encodings and
 such, but, have still been unable to figure out what I think should be a
 simple solution.
 
 All I want to do is take curly or smart quotes that have been pasted or
 entered into a form field and convert those into straight quotes () before
 I store the text in my database.
 
 It appears the data passed from the form to my PHP script is encoded as
 Unicode. My version of MySQL does not support Unicode character encoding,
 so, I need to convert that into Latin1 (or ISO-8859-1).
 
 When I use iconv() to translate the data that contains curly quotes, the
 string gets chopped off at the very first curly quote and the rest of the
 string is lost. This is the command I am using:
 
 $var = iconv(UTF-8, ISO-8859-1, $var);
 
 When I use utf8_decode(), I at least get the whole string back, but, all the
 curly quotes and apostrophes are turned into ? question marks.
 
 So, I presume there must be some way to convert those curly quotes into
 straight ASCII quotes while the text is still in Unicode format, before I
 run this through either iconv() or utf8_decode(). But, I've searched all
 over for two days and can't figure out how to accomplish this.
 
 I'd really appreciate someone's help with this! It's driving me nuts!!
 
 Thanks,
 
 Monty

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



[PHP] Re: Problem compiling PHP5

2004-09-07 Thread Paul Reinheimer
This isnt an NFS mount, should be a pretty plain rhel install.


Config.log says:
...
configure:30359: checking for jpeg_read_header in -ljpeg
configure:30642: checking for png_write_image in -lpng
configure:31022: checking for XpmFreeXpmImage in -lXpm
configure:31041: gcc -o conftest -g -O2 
-Wl,-rpath,/usr/local/lib/xpm-3.4k-linux//lib
-L/usr/local/lib/xpm-3.4k-linux//lib  -Wl,-rpath,/usr/local/lib
-L/usr/local/lib -lX11 conftest.c -lXpm  -lpng -lz -ljpeg -lz -lresolv
-lm -ldl -lnsl  -lxml2 -lz -lm -lxml2 -lz -lm 15
/usr/local/lib/xpm-3.4k-linux//lib/libXpm.so: undefined reference to `__ctype_b'
/usr/local/lib/xpm-3.4k-linux//lib/libXpm.so: undefined reference to `_fxstat'
/usr/local/lib/xpm-3.4k-linux//lib/libXpm.so: undefined reference to
`__ctype_tolower'
collect2: ld returned 1 exit status
configure: failed program was:
#line 31030 configure
#include confdefs.h
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply.  */
char XpmFreeXpmImage();

int main() {
XpmFreeXpmImage()
; return 0; }



thanks for all the help
paul

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



[PHP] Re: Problem compiling PHP5

2004-09-07 Thread Paul Reinheimer
Okay

My /usr/X11R6/lib/ has the same files, however, it doesnt have any
symbolic links or files ending in .so,
ie
lrwxrwxrwx1 root root   14 Sep  7 13:03 libXpm.so.4 -
libXpm.so.4.11
-rwxr-xr-x1 root root56220 Aug 22 09:22 libXpm.so.4.11

So when I compile with  --with-xpm-dir=/usr/X11R6/ I get the original 
configure: error: libXpm.(a|so) not found.
error. Should I just make a bunch of sybolic links?


paul

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



[PHP] PHP OOP Question

2004-09-07 Thread ed . lazor
Is it bad practice for a class to have a variable and method of the same name? 
For example:

class product {
var $Name;

function Name() {
return stripslashes($this-Name);
}
}


Thanks,

-Ed



This message was sent using IMP, the Internet Messaging Program.

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



[PHP] Re: Problem compiling PHP5

2004-09-07 Thread Paul Reinheimer
(I wish this was a forum, so I could edit/update posts)

Trying the symbolic link trick in /usr/X11R6/LIB (from .so.4 - .so)
doesnt cut it. PHP needs some of the header files (.h), which are not
present anywhere but that /usr/local/lib/xpm-linux directory (which
someone correctly surmised I had downloaded and extracted into that
location).

I will keep playing around with what i have in the local/lib directory for now.



thanks
paul

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



Re: [PHP] Re: Convert Smart Quotes to Sraight Quotes - Need Help!

2004-09-07 Thread Jennifer Goodie
-- Original message from Monty : -- 

 Anyone! I'm out of online resources and answers. I guess this isn't possible 
 to do... 
 
  I've been reading for the last three days about character encodings and 
  such, but, have still been unable to figure out what I think should be a 
  simple solution. 
  

A quick google search led me to http://us4.php.net/htmlentities

If you scroll down the page or search for smart there's a note from  01-Apr-2004 
02:49 that gives a function for replacing these characters with their htmlentities.  
You will have to change the substitution array to what you want to replace them with, 
but that should be easy.  I didn't test to see if the function actually works, but the 
character values it uses look correct.

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



[PHP] Auth class----MySQL user

2004-09-07 Thread Pahlevanzadeh Mohsen
Dears,My code is :
?
function Login()
 {

  echo xxx;
  echo form method=\post\
action=\.$_SERVER['PHP_SELF'].  \\;
  echo input type=\text\ name=\u\ br /;
  echo input type=\password\ name=\p\ br /;
  echo input type=\submit\;
  echo /form;
 }
 $username=$_POST['u'];
 $password=$_POST['p'];
 echo md5('mohsen');

$parameterforauth=array(dsn=mysql://$username:[EMAIL PROTECTED]/mem,
 table=usernames,
 usernamecol=user,
 passwordcol=pass);
 $ptr_auth_C=new Auth(DB,$parameterforauth,'Login');
 $ptr_auth_C-start();
 if ($ptr_auth_C-getAuth())
   echo Successfuly loggined!!!;
?
I have opened mysql shell, i have typed following
statement:
use mem
grant all privileges on usernames to [EMAIL PROTECTED];
set password for mohsen=password('loverx');
insert into usernames values
(user='mohsen',pass=md5('loverx'));
commit;


But i can't loggin into my program.(with mohsen as
username  loverx as password)
Thsu i can't see Successfuly loggined!!!
Please guide me.
Yours,Mohsen.




=
-DIGITAL  SIGNATURE---
///Mohsen Pahlevanzadeh
 Network administrator   programmer 
  My home phone is: +98213810146  
My email address is  
  m_pahlevanzadeh at yahoo dot com   
My website is: http://webnegar.net




__
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail

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



Re: [PHP] Re: Problem compiling PHP5

2004-09-07 Thread Jim Grill
 (I wish this was a forum, so I could edit/update posts)

 Trying the symbolic link trick in /usr/X11R6/LIB (from .so.4 - .so)
 doesnt cut it. PHP needs some of the header files (.h), which are not
 present anywhere but that /usr/local/lib/xpm-linux directory (which
 someone correctly surmised I had downloaded and extracted into that
 location).

 I will keep playing around with what i have in the local/lib directory for
now.



 thanks
 paul


Paul,

I think the problem is that xpm was not installed properly. The directory
structure that Curt pointed out earlier suggests that libxpm was not built -
only untarred in to that location. libxpm has a rather strange build and
install process as documented here:
http://koala.ilog.fr/lehors/xpm-README.html

Alternatively, you may be able to find a dev package for X11 that will
include a libxpm library made for your system. The problem is that libxpm
will not run out of the box. There is a build process that must be followed
to build the library for your system architecture.

Jim Grill

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



Re: [PHP] Re: Problem compiling PHP5

2004-09-07 Thread Paul Reinheimer
(i apologize for the direct reply copy of this message, I'm still
getting used to gmail)

I've seen the readme before, and it specifies:
On Linux, if you do not use ELF yet you'd better get the binary
distribution available from sunsite. Because it's really a pain to
build a shared lib and the current XPM distribution doesn't contain
the jump files you would need to do so. On the other hand people have
had no problems building it using ELF.

I have no idea what ELF is, nor do I know what imake is. So I
downloaded the binary distribution, which is what is installed in that
-linux directory.


paul

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



Re: [PHP] create a zip file

2004-09-07 Thread raditha dissanayake
Matthew Oatham wrote:
Hi,
I have been trying to find a way of creating a zip file. I have a file on my server that I want to compress I have had a look at gzip but cant work out what to do. 

Can someone point me to a function or an example of how to do this.
 

Check the messages within the last 48 hours.
thanks
matt
 


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Byte size of text?

2004-09-07 Thread raditha dissanayake
John Smith wrote:
What's the most accurate way to get the byte count of
some text? Is strlen() accurate with Unicode, ASCII,
etc.?
 

if you are working with non ASCII characters you might want to install 
the mulitbyte string extension.

--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Web functional testing tools?

2004-09-07 Thread Doug Kearns
On Thu, Aug 26, 2004 at 04:19:51PM +0100, Geoff Caplan wrote:
 Doug,

snip
 
 I'm fairly new to this field, so I'm still feeling my way, but I guess
 my requirements are similar to anyone else building a fairly complex
 ecommerce application: fill and submit forms using the full range of
 HTML widgets, submit and check cookies, gets and posts, check changes
 to data (in Postgres), check for patterns in pages, organise groups of
 related tests, follow redirects etc etc. The requirement to run checks
 on the database suggests that a server-side solution would be the way
 to go.

SimpleTest provides all of this functionality with the exception of a
specific database testing API, although you can certainly use it for
this purpose.
 
 Obviously, a key issue is keeping the tests robust in the face of
 changes to the application. I need to be able to change a link label,
 for example, without breaking the test-suite.

Link assertions can be specified using the 'id' attribute.
 
 I am trying to avoid anything that requires a complex Java setup or
 Eclipse: I don't have the relevant skills. The best options I have
 found so far, in addition to SimpleTest, are:
 
 **Puffin** Pure Python framework, so easy to extend (I know a bit of
 Python). Looks very powerful, but not much current activity and
 documentation is minimal:
 
 http://www.puffinhome.org/what.htm
 
 **Canoo** Which you obviously know.
 
 http://webtest.canoo.com/webtest/manual/WebTestHome.html
 
 **TestCase**, which looks powerful - but requires that you model the
 whole site in UML, which is not the way I prefer to work:
 
 http://www5f.biglobe.ne.jp/~webtest/testcasetool/index.html
 
 Is there anything I have overlooked?

You might like to have a quick look at http://www.fitnesse.org/, but I
would think that SimpleTest meets most of your requirements.
 
 The problem I am facing is that it will take a few days to do a full
 evaluation of the options and I am pressed for time. Any advice that
 you could offer that would help accelerate the process would be most
 welcome...

Sorry, this might be a little late...

Regards,
Doug

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



Re: [PHP] Re: Problem compiling PHP5

2004-09-07 Thread Paul Reinheimer
WHOHOO!

up2date -i XFree86-devel

./configure --with-mysql=/usr/local/mysql
--with-apxs=/etc/httpd/bin/apxs --with-gd --with-png
--with-zlib-dir=/root/zlib-1.2.1 --enable-gd-native-ttf --with-ttf
--with-jpeg-dir=/usr/local/lib/jpeg-6b/
--with-freetype-dir=/usr/local/lib/freetype-2.1.9/ --with-freetype-dir
--with-xpm-dir=/usr/X11R6/

works wonders.

Thanks all!

paul



On Tue, 7 Sep 2004 20:51:14 -0400, Paul Reinheimer
[EMAIL PROTECTED] wrote:
 (i apologize for the direct reply copy of this message, I'm still
 getting used to gmail)
 
 
 
 I've seen the readme before, and it specifies:
 On Linux, if you do not use ELF yet you'd better get the binary
 distribution available from sunsite. Because it's really a pain to
 build a shared lib and the current XPM distribution doesn't contain
 the jump files you would need to do so. On the other hand people have
 had no problems building it using ELF.
 
 I have no idea what ELF is, nor do I know what imake is. So I
 downloaded the binary distribution, which is what is installed in that
 -linux directory.
 
 paul


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



Re: [PHP] Dinamic generate PDF : which way ? (classes, docbook)

2004-09-07 Thread robert mena
Thanks.  I'll check it out.

My main concern is that what seems great about using those php classes
to generate the pdf directly is the possibilite to pull data from
mysql (or other db) and generate an up-to-date report.

But since this is not the case seems a lot of work just to generate a
simple table.

I don't work with docbook yet so it can be a wrong feeling but seems
easier to train a person which already uses HTML to code using
docbook's tags than teach php/class.  Specially if what I want does
not involve fancy features.

- rt

On Mon, 6 Sep 2004 09:39:34 -0700, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 
 
 Hello Robert,
 
 I would suggest that if your data is such that it can use DocBook,
 definitely go the DocBook route. You can also use Apache's Cocoon publish
 your DocBook content to PDF/HTML/RTF/SVG/TXT etc.
 
 Here are some samples that use Apache Cocoon to perform dynamic conversion
 to PDF/HTML: http://www.xml-dev.com/blog/#88
 
 Here are some other utilities to convert to PDF:
 http://www.xml-dev.com/blog/#101
 
 This one is pretty good: http://html2pdf.seven49.net/seven49.aspx?
 
 Thanks.
 Saqib Ali
 http://validate.sf.net
 
 robert mena [EMAIL PROTECTED] wrote on 09/06/2004 04:56:18 AM:
 
 
 
  Hi,
 
  I plan to dynamic generate some of the documents I need on a regular
  basis.  Sometimes they only differ by the name of the company so my
  first attempt would be to generate templates in word and ask/replace
  for the values needed.
 
  I am evaluating the http://www.ros.co.nz/pdf/, www.fpdf.org and php
  classes that generate pdf and as another option use docbook to
  convert.
 
  I am not sure which way is better.
 
  From my point of view:
  a) Both classes seem to be fine but in order to generate (static)
  tables and other elements I will need a lot of programming
  calls/variables.  So I'd have a manual and perhaps tedious/error
  procedure to convert the document into the programable-version of
  it.
 
  b) I do not have experience with DocBook (even tough I can code html
  and latex) but I could use  an editor to generate the document with
  the tables, place images etc.  Identify the template variables and
  call docbook to generate the pdf.  I'd still have to manually convert
  the file but would not need a lot of calls to generate a table or even
  use a php programmer.  I am assuming the the tags needed are more
  easly understanded than $pdf-addCell($data,width..)
 
  Any ideias ?
 
  --
  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] Upload not working...

2004-09-07 Thread Deependra b. Tandukar
I tried this form to upload a file.
html
head
titleUntitled Document/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /
/head
body
form action=./upload.php method=post
input type=file name=userfile
input type=submit value=upload
/form
/body
/html
with the following code:
?php
copy($userfile, /var/www/html/upload/data/$userfile_name);
unlink($userfile);
?
and am getting the message Warning: Unable to open '\C:\\Documents and 
Settings\\Administrator\\Desktop\\photos\\IMAGE0099.JPG\' for reading: No 
such file or directory in /var/www/html/ICIweb/php/upload.php on line 2

This very code works in my home computer. I tried this with my local server 
at my office and my web server, both give the same message what is the 
wrong with it.

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


[PHP] array

2004-09-07 Thread John Taylor-Johnston
I'm reading data. Can I open a connection within a connection and write data to 
another $db.$table or do I have to write my data to an array. In an array, how do I do 
this?

I've looked at array_push, but don't think this is what I want?
$authors = array();
  array_push($singleauthor,$mydata-id);
I've been reading http://ca3.php.net/manual/en/function.array-push.php

John

---
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);

$news = mysql_query(select id,AUS from $table);

while ($mydata = mysql_fetch_object($news))
{
  $mydata-AUS = str_replace( ;, ;, $mydata-AUS);
  $mydata-AUS = str_replace(; , ;, $mydata-AUS);
  $tempauthors = explode(;, $mydata-AUS);
  foreach ($tempauthors as $singleauthor)
  {
if ($singleauthor  )
{
 echo tr\ntd$singleauthor/td\ntd$mydata-id/td\n/tr\n;
   }
  }
}

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



Re: [PHP] Intermittent Seg Fault with PHP4.3.8 + FTP

2004-09-07 Thread Rasmus Lerdorf
On Tue, 7 Sep 2004, Jim Grill wrote:
 If any of the output from gdb give you a hint what the problem could be (ftp
 functions or something) research each of the functions you are using on the
 PHP site reading the user added comments. Look for any mention of a possible
 segfault. Search the PHP bugs on http://bugs.php.net for your PHP version
 using the name of the function and/or the name of the commands in the
 backtrace. Chances are someone has already found the bug and there may be a
 workaround or the problem has been fixed in CVS or in a newer version (in
 your case PHP 4.3.9RC2).
 
 If you can't find anything relating to your problem on PHP.net,
 bugs.php.net, or google then you should follow the proceedure for reporting
 bugs on http://bugs.php.net/ . It's a thankless job, but it helps everyone
 out in the long run if done properly. It will be much appreciated if you
 follow the above steps and include sample code and gdb information when
 submitting a bug. Leave it to the real pros to read the backtrace output!

Just to back this up, if you submit a bug report with a good backtrace 
(one from a non-stripped PHP, you don't necessarily need to recompile 
using enable-debug) the bug is 90% fixed.  Reproducable segfaults on Unix 
are actually quite trivial to fix.  Getting the clean backtrace is usually 
more work than fixing the actual bug.

Thanks for the good explanation there Jim.

-Rasmus

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



Re: [PHP] Re: Convert Smart Quotes to Sraight Quotes - Need Help!

2004-09-07 Thread Rasmus Lerdorf
Are you certain these curly quotes are actually coming in and not being 
munged by the client sending them?  If they are coming in, and they are 
actually in Unicode, which unicode sequence are they represented by.  If 
you could save the raw data you are getting to a file and make that file 
available we might have a chance at helping you here.

-Rasmus

On Tue, 7 Sep 2004, Monty wrote:

 Anyone! I'm out of online resources and answers. I guess this isn't possible
 to do...
 
  I've been reading for the last three days about character encodings and
  such, but, have still been unable to figure out what I think should be a
  simple solution.
  
  All I want to do is take curly or smart quotes that have been pasted or
  entered into a form field and convert those into straight quotes () before
  I store the text in my database.
  
  It appears the data passed from the form to my PHP script is encoded as
  Unicode. My version of MySQL does not support Unicode character encoding,
  so, I need to convert that into Latin1 (or ISO-8859-1).
  
  When I use iconv() to translate the data that contains curly quotes, the
  string gets chopped off at the very first curly quote and the rest of the
  string is lost. This is the command I am using:
  
  $var = iconv(UTF-8, ISO-8859-1, $var);
  
  When I use utf8_decode(), I at least get the whole string back, but, all the
  curly quotes and apostrophes are turned into ? question marks.
  
  So, I presume there must be some way to convert those curly quotes into
  straight ASCII quotes while the text is still in Unicode format, before I
  run this through either iconv() or utf8_decode(). But, I've searched all
  over for two days and can't figure out how to accomplish this.
  
  I'd really appreciate someone's help with this! It's driving me nuts!!
  
  Thanks,
  
  Monty
 
 -- 
 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] Upload not working...

2004-09-07 Thread raditha dissanayake
Deependra b. Tandukar wrote:
I tried this form to upload a file.
form action=./upload.php method=post
...
This very code works in my home computer. I tried this with my local 
server at my office and my web server, both give the same message what 
is the wrong with it.

Suprised that it worked at all the  shouldbe : enctype=multipart/form-data
DT

--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Upload not working...

2004-09-07 Thread zareef ahmed

--- Deependra b. Tandukar [EMAIL PROTECTED]
wrote:

 I tried this form to upload a file.
 
 html
 head
 titleUntitled Document/title
 meta http-equiv=Content-Type content=text/html;
 charset=iso-8859-1 /
 /head
 
 body
 form action=./upload.php method=post

you should define  enctype 
 input type=file name=userfile
 input type=submit value=upload
 /form
 
 /body
 /html
 
 with the following code:
 
 ?php
 copy($userfile,
 /var/www/html/upload/data/$userfile_name);
 unlink($userfile);
 ?

I think you should read about $_FILES array  and
move_uploaded_file.

http://in.php.net/features.file-upload
http://in.php.net/move_uploaded_file


 
 and am getting the message Warning: Unable to open
 '\C:\\Documents and 

Settings\\Administrator\\Desktop\\photos\\IMAGE0099.JPG\'
 for reading: No 
 such file or directory in
 /var/www/html/ICIweb/php/upload.php on line 2
 
 This very code works in my home computer. I tried
 this with my local server 
 at my office and my web server, both give the same
 message what is the 
 wrong with it.
 
 DT
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


=
Homepage :: http://www.zasaifi.com




__
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

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