[PHP] spawning a process that uses pipes - doesn't terminate when webpage download is canceled

2009-05-28 Thread Flint Million
so here's the scenario..

I have a site that uses php with a database to offer sound files to
users using streaming methods.

the request page has options, allowing the user to modify the sound
file in various ways, before having it sent to them

Here's the problem:

The method i'm using to feed the data to the user is to run the source
file through various piped commands, with the resulting audio being
dumped to stdout, and then using passthru in php to get that data to
the enduser.

here's an example, for serving an MP3 with its pitch/speed changed by sox:

passthru(lame --quiet --decode \ . $in_file . \ - |  .
 sox -V -S -t wav - -t wav - speed  . $speed_factor .  |  .
 lame --quiet  . $lame_params .  - -);

This works just fine, except the problem is if the end user aborts the
transfer (e.g. stops playback in the media player, cancels download of
the mp3, whatever) then it leaves behind both the sox process and the
decoder LAMe process along with the sh that's running them. the only
process that exits is the final encoding lame process. If the sound
file runs to completion, everythign exits properly.

But this obviously means enough cancelling of downloads means the
server ends up with a huge batch of stuck processes! And I even tried
simply killing the 'host' sh process, and the lame and sox processes
remain anyway. The only way I've been able to deal with this is
manually killing the lame and sox processes directly.

is there any way I can make this work, such so that if the user
cancels the transfer, all relavent processes are killed rather than
just the single process that's feeding output into php?

-FM

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



Re: [PHP] Why does PHP have such a pain in the a$$ configuration file?

2009-05-28 Thread kranthi
phpinfo() will help you to find the differences in the configuration...

i do this every time i move to a new host(before uploading any other files
to the server, of course i delete it afterward) and change my pages
accordingly. most of the configuration settings in php.ini can be overridden
by ini_set().


Re: [PHP] Confirmation email caught by spam filter

2009-05-28 Thread Ashley Sheridan
On Wed, 2009-05-27 at 16:54 -0400, Stephen wrote:
 Ashley Sheridan wrote: 
  I've also seen this happen where the address that the mail was sent
  from
  is different from the MX record for the domain the email says it is sent
  from. The only way round this is to have the MX and A records point to
  the same server.
  

 Is their a document that explains how to do this?
 
 Thanks
 Stephen
 
It's just a setting in your DNS entry for the domain. But be careful, as
it will change where your email and/or website goes.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Confirmation email caught by spam filter

2009-05-28 Thread Ashley Sheridan
On Thu, 2009-05-28 at 07:45 +0200, Per Jessen wrote:
 Ashley Sheridan wrote:
 
  I've also seen this happen where the address that the mail was sent
  from is different from the MX record for the domain the email says it
  is sent from. The only way round this is to have the MX and A records
  point to the same server.
 
 It's not a real problem - lots of companies have different inbound and
 outbound servers. 
 
 
 /Per
 
 -- 
 Per Jessen, Zürich (14.2°C)
 
 
The spam filters we use at work have this problem, not any others that
I've seen, but I was just saying it is a problem, and in a corporate
environment, not just someone with an over zealous firewall.

Would setting up a backup MX record solve this do you think?


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Re: Displaying images

2009-05-28 Thread kranthi
I suggest you use firebug
https://addons.mozilla.org/en-US/firefox/addon/1843

coming back to your case..
1. use the inspect function of firebug to check if the img src=.. is
displaying correctly.
2  then use the net tab of firebug to see if the image is actually
downloaded from the server.
3. open the link in new tab to see image is actually displayed.

if you are struck at case 1: some problem in the echo statement of your main
php
case 2: firebug actually tells you what is the mistake you did
case 3: i suggest one more firefox addon: live http headers
see if the content-type and content-length header are being sent


This page isn't working and if I try to browse this page it wants to open it
with an editor, it won't view in the browser.

i assume that the address in the URL bar of your browser starts with file://
rather than http:// ? simply put are you double clicking the file or
clicking open with firefox ?


Re: [PHP] [php] php_network_getaddresses: getaddrinfo failed: No such host is known

2009-05-28 Thread HELP!
now I have been able to telnet to the server IP but it defaulting to port 23
instead of the port I specified ( telnet ip port). How do u correct this
problem

On Wed, May 27, 2009 at 2:40 PM, Daniel Brown danbr...@php.net wrote:

 On Wed, May 27, 2009 at 09:08, Stuart stut...@gmail.com wrote:
 
  There's like 37 different things it could be, none of which have
  anything to do with PHP. You may find someone on this list willing to
  help you out, but your better bet would be to find a list more suited
  to the problem.

I will help.

Step 1: RTFM [1]
Step 2: STFW [2]
Step 3: Follow the advice Stuart already gave you and speak with a
 network tech.
Step 4: Try restarting Apache (if you can), in case the DNS was
 changed recently.
Step 5: Re-query the list with more information, if needed, and
 don't top-post.
Step 6: If still unresolved, give up. [3]

^1: http://php.net/stream-socket-client
^2:
 http://google.com/search?q=php_network_getaddresses:+getaddrinfo+failed:+No+such+host+is+known
^3: http://asia.cnet.com/i/r/2005/gb/mar/funkey_b1.jpg

 --
 /Daniel P. Brown
 daniel.br...@parasane.net || danbr...@php.net
 http://www.parasane.net/ || http://www.pilotpig.net/
 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1




-- 
www.bemycandy.com


Re: [PHP] PHP ping and exec() hangs apache

2009-05-28 Thread Kamil Walas

Ashley Sheridan pisze:
 On Wed, 2009-05-27 at 10:25 +0200, Kamil Walas wrote:
 Hi,

 I stuck with strange error. I have following code:
 ?
  echo 'BEFORE';
  echo exec(ping -c1 -w1 1.1.25.38);
  echo 'AFTER';
 ?

 Address doesn't exist. When execute script from command line everything
 works fine. But when I go to the file by Firefox it hangs out and 
apache

 need to be restart. This is a Virtual Server with PHP Version
 5.2.6-pl222-gentoo. When address exists it works fine. Only problem is
 when it doesn't respond and apache hangs.

 I copy file to apache at my local apache and everything works fine. My
 apache is with Version 5.3.0alpha3-dev at windows XP.

 At old server with php4 everything works fine.

 I suspect that something wrong is with apache configuration but I don't
 know it for sure and couldn't find it.

 Thank you,
 Kamil Walas

 Are you sure it's crashed and is not just waiting for a reply from the
 remote server. How long do you leave it running before you assume it's
 crashed? I see it's set for a 1millisecond wait response, but what is
 the -c1 flag, as I'm not familiar with all the flags of a Windows ping,
 and a quick Google didn't reveal it.


 Ash
 www.ashleysheridan.co.uk



It is waiting. Not crash but hangs. Id don't know why. For test once I 
leave it for something about 2 hours - for one ping it should be 
enought. -c1 flag tells to send only one ping. It hangs on Gentoo.


I solved it by removing exec.
Now it looks like:
function ping( $host, $number_port, $timeout )
{
   $fp = fsockopen($host, $number_port, $a, $timeout);  
   if($fp !== FALSE ) { fclose($fp); return true;}
   else { return false; }  
}

It's better than ping becouse there is also a port number check.


Thanks for fast answer,

Kamil Walas


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



Re: [PHP] [php] php_network_getaddresses: getaddrinfo failed: No such host is known

2009-05-28 Thread Nathan Nobbe
On Thu, May 28, 2009 at 2:31 AM, HELP! izod...@gmail.com wrote:

 now I have been able to telnet to the server IP but it defaulting to port
 23
 instead of the port I specified ( telnet ip port). How do u correct this
 problem


rtfm telnet

translates to

man telnet

which says

telnet host port

so put the port after the hostname ;)

-nathan


Re: [PHP] [php] php_network_getaddresses: getaddrinfo failed: No such host is known

2009-05-28 Thread HELP!
I have done that.

o host port
or
telnet host port

On Thu, May 28, 2009 at 9:39 AM, Nathan Nobbe quickshif...@gmail.comwrote:

 On Thu, May 28, 2009 at 2:31 AM, HELP! izod...@gmail.com wrote:

 now I have been able to telnet to the server IP but it defaulting to port
 23
 instead of the port I specified ( telnet ip port). How do u correct this
 problem


 rtfm telnet

 translates to

 man telnet

 which says

 telnet host port

 so put the port after the hostname ;)

 -nathan




-- 
www.bemycandy.com


[PHP] Create multipart email

2009-05-28 Thread Guus Ellenkamp
I'm trying to attach an uploaded file to an e-mail which I receive in 
Outlook. Neither the first part, nor the second part displays properly. The 
header looks ok when displayed on the screen. What am I missing?

See code below.
function xmail($mailto, $from_mail, $from_name, $replyto, $subject, 
$message, $origname, $tempfile, $filetype) {

$file = $tempfile;

$file_size = filesize($file);

$handle = fopen($file, r);

$content = fread($handle, $file_size);

fclose($handle);

$content = chunk_split(base64_encode($content));

$uid = md5(uniqid(time()));

$name = basename($origname);

$header = From: .$from_name. .$from_mail.\r\n;

$header .= Reply-To: .$replyto.\r\n;

$header .= MIME-Version: 1.0\r\n;

$header .= Content-Type: multipart/mixed; boundary=\.$uid.\\r\n\r\n;

$header .= This is a multi-part message in MIME format.\r\n;

$header .= --.$uid.\r\n;

$header .= Content-type:text/plain; charset=iso-8859-1\r\n;

$header .= Content-Transfer-Encoding: 7bit\r\n\r\n;

$header .= $message.\r\n\r\n;

$header .= --.$uid.\r\n;

$header .= Content-Type: .$filetype.; name=\.$name.\\r\n; // use 
diff. tyoes here

$header .= Content-Transfer-Encoding: base64\r\n;

$header .= Content-Disposition: attachment; file=\.$name.\\r\n\r\n;

$header .= $content.\r\n\r\n;

$header .= --.$uid.--;

echo $header;

if (mail($mailto, $subject, test, $header)) {

echo mail send ... OK; // or use booleans here

} else {

echo mail send ... ERROR!;

}

}

// how to use

$my_name = Guus;

$my_mail = g...@activediscovery.net;

$my_replyto = g...@activediscovery.net;

$my_subject = This is a mail with attachment.;

$my_message = Hallo,\r\ndo you like this script? I hope it will 
help.\r\n\r\ngr. Olaf;

xmail(g...@activediscovery.net, $my_mail, $my_name, $my_replyto, 
$my_subject, $my_message,$fileName, $fileTempName, $fileType);



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



Re: [PHP] [php] php_network_getaddresses: getaddrinfo failed: No such host is known

2009-05-28 Thread Nathan Nobbe
On Thu, May 28, 2009 at 2:40 AM, HELP! izod...@gmail.com wrote:

 I have done that.

 o host port
 or
 telnet host port


thats pretty odd.. a quick test on my box, looks like it works fine,

phdelnnobbe:~ nnobbe$ telnet host 22
Trying xx.xx.xx.xx...
Connected to host.
Escape character is '^]'.
SSH-2.0-OpenSSH_4.5

again, you may want to consult the docs on your system to hunt down the
issue..

-nathan


Re: [PHP] Re: Displaying images

2009-05-28 Thread O. Lavell
Miller, Terion wrote:

[..]

 header(Content-type: img/jpeg);

[..]

 This page isn't working and if I try to browse this page it wants to
 open it with an editor, it won't view in the browser.
 
 What am I doing wrong? Is it the code or the data?

Content-type: img/jpeg is undefined, the browser would not know what to 
do with it. Try image/jpeg which is the official MIME type.


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



[PHP] PHP, OOP and AJAX

2009-05-28 Thread Julian Muscat Doublesin
Hi Everyone,

This is the first time that I am posting in the PHP forum, so hope that I am
osting in the right place.

I would like to say that before submitting to this forum I have done some
research looking for a solution without success.

I had been programming in ASP.NET for years using Object Oriented
Princeliness but decided to walk away from that.  I am now researching and
specialising in the open source world.

I have started to develop a project using MySQL, PHP and OOP. So far I have
succeed. However I got stuck once I started implement AJAX using the AJAX
tutorial from w3schools.com.

What I have discovered is: for some reason when you call a file that
requires other fies using the REQUIRE or INCLUDE it just does not work. I
can conform this as I have tested with out the the functions.

Has anyone ever meet such a situation can you give me some feedback please.

Thank you very much in advance for your support.

Regards

Julian


[PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Jo�o C�ndido de Souza Neto
Julian,

could you please show us an example of this problem?


-- 
João Cândido de Souza Neto
SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS
Fone: (0XX41) 3033-3636 - JS
www.siens.com.br

Julian Muscat Doublesin opensourc...@gmail.com escreveu na mensagem 
news:5e0039ed0905280431o2e9d8036u217b0449eccd...@mail.gmail.com...
 Hi Everyone,

 This is the first time that I am posting in the PHP forum, so hope that I 
 am
 osting in the right place.

 I would like to say that before submitting to this forum I have done some
 research looking for a solution without success.

 I had been programming in ASP.NET for years using Object Oriented
 Princeliness but decided to walk away from that.  I am now researching and
 specialising in the open source world.

 I have started to develop a project using MySQL, PHP and OOP. So far I 
 have
 succeed. However I got stuck once I started implement AJAX using the AJAX
 tutorial from w3schools.com.

 What I have discovered is: for some reason when you call a file that
 requires other fies using the REQUIRE or INCLUDE it just does not work. I
 can conform this as I have tested with out the the functions.

 Has anyone ever meet such a situation can you give me some feedback 
 please.

 Thank you very much in advance for your support.

 Regards

 Julian
 



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



Re: [PHP] Create multipart email

2009-05-28 Thread Phpster

Use phpmailer, makes it simple

Bastien

Sent from my iPod

On May 28, 2009, at 4:47, Guus Ellenkamp  
ellenkamp_g...@hotmail.com wrote:



I'm trying to attach an uploaded file to an e-mail which I receive in
Outlook. Neither the first part, nor the second part displays  
properly. The

header looks ok when displayed on the screen. What am I missing?

See code below.
function xmail($mailto, $from_mail, $from_name, $replyto, $subject,
$message, $origname, $tempfile, $filetype) {

$file = $tempfile;

$file_size = filesize($file);

$handle = fopen($file, r);

$content = fread($handle, $file_size);

fclose($handle);

$content = chunk_split(base64_encode($content));

$uid = md5(uniqid(time()));

$name = basename($origname);

$header = From: .$from_name. .$from_mail.\r\n;

$header .= Reply-To: .$replyto.\r\n;

$header .= MIME-Version: 1.0\r\n;

$header .= Content-Type: multipart/mixed; boundary=\.$uid.\\r\n 
\r\n;


$header .= This is a multi-part message in MIME format.\r\n;

$header .= --.$uid.\r\n;

$header .= Content-type:text/plain; charset=iso-8859-1\r\n;

$header .= Content-Transfer-Encoding: 7bit\r\n\r\n;

$header .= $message.\r\n\r\n;

$header .= --.$uid.\r\n;

$header .= Content-Type: .$filetype.; name=\.$name.\\r\n; //  
use

diff. tyoes here

$header .= Content-Transfer-Encoding: base64\r\n;

$header .= Content-Disposition: attachment; file=\.$name.\\r\n\r 
\n;


$header .= $content.\r\n\r\n;

$header .= --.$uid.--;

echo $header;

if (mail($mailto, $subject, test, $header)) {

echo mail send ... OK; // or use booleans here

} else {

echo mail send ... ERROR!;

}

}

// how to use

$my_name = Guus;

$my_mail = g...@activediscovery.net;

$my_replyto = g...@activediscovery.net;

$my_subject = This is a mail with attachment.;

$my_message = Hallo,\r\ndo you like this script? I hope it will
help.\r\n\r\ngr. Olaf;

xmail(g...@activediscovery.net, $my_mail, $my_name, $my_replyto,
$my_subject, $my_message,$fileName, $fileTempName, $fileType);



--
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] Create multipart email

2009-05-28 Thread kranthi
i have been using PEAR Mail. major reason being nearly all of my web
hosts have this supported (pre-installed)

Kranthi.


On Thu, May 28, 2009 at 17:29, Phpster phps...@gmail.com wrote:

 Use phpmailer, makes it simple

 Bastien

 Sent from my iPod

 On May 28, 2009, at 4:47, Guus Ellenkamp ellenkamp_g...@hotmail.com wrote:

 I'm trying to attach an uploaded file to an e-mail which I receive in
 Outlook. Neither the first part, nor the second part displays properly. The
 header looks ok when displayed on the screen. What am I missing?

 See code below.
 function xmail($mailto, $from_mail, $from_name, $replyto, $subject,
 $message, $origname, $tempfile, $filetype) {

 $file = $tempfile;

 $file_size = filesize($file);

 $handle = fopen($file, r);

 $content = fread($handle, $file_size);

 fclose($handle);

 $content = chunk_split(base64_encode($content));

 $uid = md5(uniqid(time()));

 $name = basename($origname);

 $header = From: .$from_name. .$from_mail.\r\n;

 $header .= Reply-To: .$replyto.\r\n;

 $header .= MIME-Version: 1.0\r\n;

 $header .= Content-Type: multipart/mixed; boundary=\.$uid.\\r\n\r\n;

 $header .= This is a multi-part message in MIME format.\r\n;

 $header .= --.$uid.\r\n;

 $header .= Content-type:text/plain; charset=iso-8859-1\r\n;

 $header .= Content-Transfer-Encoding: 7bit\r\n\r\n;

 $header .= $message.\r\n\r\n;

 $header .= --.$uid.\r\n;

 $header .= Content-Type: .$filetype.; name=\.$name.\\r\n; // use
 diff. tyoes here

 $header .= Content-Transfer-Encoding: base64\r\n;

 $header .= Content-Disposition: attachment; file=\.$name.\\r\n\r\n;

 $header .= $content.\r\n\r\n;

 $header .= --.$uid.--;

 echo $header;

 if (mail($mailto, $subject, test, $header)) {

 echo mail send ... OK; // or use booleans here

 } else {

 echo mail send ... ERROR!;

 }

 }

 // how to use

 $my_name = Guus;

 $my_mail = g...@activediscovery.net;

 $my_replyto = g...@activediscovery.net;

 $my_subject = This is a mail with attachment.;

 $my_message = Hallo,\r\ndo you like this script? I hope it will
 help.\r\n\r\ngr. Olaf;

 xmail(g...@activediscovery.net, $my_mail, $my_name, $my_replyto,
 $my_subject, $my_message,$fileName, $fileTempName, $fileType);



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


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


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



Re: [PHP] Create multipart email

2009-05-28 Thread Richard Heyes
Hi,

 i have been using PEAR Mail. major reason being nearly all of my web
 hosts have this supported (pre-installed)

It doesn't need to be installed for you to use it. If you want/need to
you can get the sauce off of the PEAR website:

http://cvs.php.net/viewvc.cgi/pear/Mail/

Click on the version numbers to get at the code. You can then treat it
like you would any other PHP file. You'll have to resolve any
depenencies yourself though.

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 23rd May)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

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



Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread kranthi
i never faced such a problem and i can assure you that it will never
happen. try...

main.php
?php
require('second.php');
?

second.php
test

call main.php via AJAX and see the responseText.
many things can go wrong in your coding. dont come to the conclusion
that this particular thing is not working.

i recommend you firebug firefox adddon (just go to the net tab and you
can see all the details of the communication between client and
server)
and i find it helpful to use a standard javascript(jQuery in my case)
library instead of highly limited plain javascript  language

and for you case its difficult to comment without seeing your actual code.

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



RE: [PHP] spawning a process that uses pipes - doesn't terminate when webpage download is canceled

2009-05-28 Thread bruce
Hi Flint.

Not sure if you have a solution to this yet, or if I fully understand! But
if your issue is basically that you have a situation where you might have
orphaned processes that never finish and that are consuming real resources
you could have the app get/monitor the process ID for each process you
create, and then simply periodically check to see if that process is in a
run state.

Bow, if the situation is one where the user aborts the transfer process, and
the underlying processes are still 'running' then I would still think the
above appproach would work, but you'd have to have your app keep track of
when the user 'kills' the download process..

But are you sure the orphaned processes are consuming resources, or are they
zombie processes, which are resident in the process tbl, but aren't really
consuming resources... sombie processes will (should) eventually be dealt
with by the operating system...

regards



-Original Message-
From: Flint Million [mailto:fmill...@gmail.com]
Sent: Wednesday, May 27, 2009 11:39 PM
To: php-general@lists.php.net
Subject: [PHP] spawning a process that uses pipes - doesn't terminate
when webpage download is canceled


so here's the scenario..

I have a site that uses php with a database to offer sound files to
users using streaming methods.

the request page has options, allowing the user to modify the sound
file in various ways, before having it sent to them

Here's the problem:

The method i'm using to feed the data to the user is to run the source
file through various piped commands, with the resulting audio being
dumped to stdout, and then using passthru in php to get that data to
the enduser.

here's an example, for serving an MP3 with its pitch/speed changed by sox:

passthru(lame --quiet --decode \ . $in_file . \ - |  .
 sox -V -S -t wav - -t wav - speed  . $speed_factor .  |  .
 lame --quiet  . $lame_params .  - -);

This works just fine, except the problem is if the end user aborts the
transfer (e.g. stops playback in the media player, cancels download of
the mp3, whatever) then it leaves behind both the sox process and the
decoder LAMe process along with the sh that's running them. the only
process that exits is the final encoding lame process. If the sound
file runs to completion, everythign exits properly.

But this obviously means enough cancelling of downloads means the
server ends up with a huge batch of stuck processes! And I even tried
simply killing the 'host' sh process, and the lame and sox processes
remain anyway. The only way I've been able to deal with this is
manually killing the lame and sox processes directly.

is there any way I can make this work, such so that if the user
cancels the transfer, all relavent processes are killed rather than
just the single process that's feeding output into php?

-FM

--
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] Create multipart email

2009-05-28 Thread kranthi
ohh.. what i meant is most of my web hosts hav it pre-installed (copy
of that file in their include dir) so that i'll not hav to upload it
again and thereby save some web space

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



Re: [PHP] Create multipart email

2009-05-28 Thread Tom Worster
guus, take a look at:

http://pear.php.net/manual/en/package.mail.mail-mime.php



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



Re: [PHP] Confirmation email caught by spam filter

2009-05-28 Thread Tom Worster
On 5/28/09 3:20 AM, Ashley Sheridan a...@ashleysheridan.co.uk wrote:

 Would setting up a backup MX record solve this do you think?

this is what the spf record is for.

http://en.wikipedia.org/wiki/Sender_Policy_Framework




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



Re: Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread oorza2k5

Two things:

1. Try using the fully qualified path (ie /var/www/foo/bar.php instead of  
foo/bar.php)
2. Look at setting up autoloading so you don't need to manually include  
anyway. If you're going OOP, autoloading is a must!


On May 28, 2009 8:49am, kranthi kranthi...@gmail.com wrote:

i never faced such a problem and i can assure you that it will never



happen. try...





main.php




require('second.php');



?





second.php



test





call main.php via AJAX and see the responseText.



many things can go wrong in your coding. dont come to the conclusion



that this particular thing is not working.





i recommend you firebug firefox adddon (just go to the net tab and you



can see all the details of the communication between client and



server)



and i find it helpful to use a standard javascript(jQuery in my case)



library instead of highly limited plain javascript language





and for you case its difficult to comment without seeing your actual code.





--



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



To unsubscribe, visit: http://www.php.net/unsub.php






Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Lenin
2009/5/28 kranthi kranthi...@gmail.com



 i recommend you firebug firefox adddon (just go to the net tab and you
 can see all the details of the communication between client and
 server)
 and i find it helpful to use a standard javascript(jQuery in my case)
 library instead of highly limited plain javascript  language

I also recommend using FirePHP with FireBug here's a nicely written tutorial
on how to use them both together for Ajax'ed pages. http://tr.im/iyvl
Thanks
Lenin
www.twitter.com/nine_L


Re: [PHP] Create multipart email

2009-05-28 Thread Per Jessen
Guus Ellenkamp wrote:

 I'm trying to attach an uploaded file to an e-mail which I receive in
 Outlook. Neither the first part, nor the second part displays
 properly. The header looks ok when displayed on the screen. What am I
 missing?

Show us the entire email that doesn't work. 


/Per

-- 
Per Jessen, Zürich (20.8°C)


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



Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Olexandr Heneralov
Hi!
Do not use low-level AJAX.
There are many frameworks for ajax (JQUERY).
Try to use PHP frameworks like symfony, zend framework. They simplify your
work.


2009/5/28 Lenin le...@phpxperts.net

 2009/5/28 kranthi kranthi...@gmail.com

 
 
  i recommend you firebug firefox adddon (just go to the net tab and you
  can see all the details of the communication between client and
  server)
  and i find it helpful to use a standard javascript(jQuery in my case)
  library instead of highly limited plain javascript  language
 
 I also recommend using FirePHP with FireBug here's a nicely written
 tutorial
 on how to use them both together for Ajax'ed pages. http://tr.im/iyvl
 Thanks
 Lenin
 www.twitter.com/nine_L



[PHP] PHP vs ASP.NET

2009-05-28 Thread Olexandr Heneralov
Hi!
Guys, you of course, know that  ASP.NET becomes more and more popular in the
world.
I have a question for everyone:
Can it happen so that PHP will be replaced with ASP.NET?


[PHP] PHP vs ASP.NET

2009-05-28 Thread Olexandr Heneralov
Hi!
Guys, you of course, know that  ASP.NET becomes more and more popular in the
world.
I have a question for everyone:
Can it happen so that PHP will be replaced with ASP.NET?


RE: [PHP] PHP vs ASP.NET

2009-05-28 Thread Bob McConnell
No.

Bob McConnell

-Original Message-
From: Olexandr Heneralov [mailto:ohenera...@gmail.com] 
Sent: Thursday, May 28, 2009 9:21 AM
To: php-general@lists.php.net
Subject: [PHP] PHP vs ASP.NET

Hi!
Guys, you of course, know that  ASP.NET becomes more and more popular in
the
world.
I have a question for everyone:
Can it happen so that PHP will be replaced with ASP.NET?

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



Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Luke
2009/5/28 Olexandr Heneralov ohenera...@gmail.com

 Hi!
 Do not use low-level AJAX.
 There are many frameworks for ajax (JQUERY).
 Try to use PHP frameworks like symfony, zend framework. They simplify your
 work.


 2009/5/28 Lenin le...@phpxperts.net

  2009/5/28 kranthi kranthi...@gmail.com
 
  
  
   i recommend you firebug firefox adddon (just go to the net tab and you
   can see all the details of the communication between client and
   server)
   and i find it helpful to use a standard javascript(jQuery in my case)
   library instead of highly limited plain javascript  language
  
  I also recommend using FirePHP with FireBug here's a nicely written
  tutorial
  on how to use them both together for Ajax'ed pages. http://tr.im/iyvl
  Thanks
  Lenin
  www.twitter.com/nine_L
 



Moo, I would say learn to do PHP by itself before you go using frameworks.

AJAX is a bit different though because there will be few reasons that you
will ever need to write low level code when you're using a library like
Prototype =)

-- 
Luke Slater
:O)


Re: [PHP] PHP vs ASP.NET

2009-05-28 Thread Robert Cummings
On Thu, 2009-05-28 at 16:20 +0300, Olexandr Heneralov wrote:
 Hi!
 Guys, you of course, know that  ASP.NET becomes more and more popular in the
 world.
 I have a question for everyone:
 Can it happen so that PHP will be replaced with ASP.NET?

It is unlikely. Open source continues to grow, and as such free and
unrestricted alternatives to the iron-fisted grip of closed source
technologies will always be in demand.

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


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



Re: Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Tony Marston

oorza...@gmail.com wrote in message 
news:000e0cd6ad1a9f7d3d046af89...@google.com...
 Two things:

 1. Try using the fully qualified path (ie /var/www/foo/bar.php instead of
 foo/bar.php)
 2. Look at setting up autoloading so you don't need to manually include
 anyway. If you're going OOP, autoloading is a must!

I totally disagree. I have been doing OOP with PHP for years, and I have 
never used autoloading. It is just a feature that can be used, misused or 
abused just like any other. I choose not to use it, and my code does not 
suffer in the least!

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org




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



[PHP] Re: mysql create table with date or timestamp

2009-05-28 Thread Jo�o C�ndido de Souza Neto
If you need date and hour the best way is:

CREATE TABLE diary (
 iddiary int auto_increment not null,
 imepriimek varchar(50),
 when timestamp,
 action varchar(30),
 onfile varchar(100)
 unique id(iddiary)
);

if you need only date you can use:

CREATE TABLE diary (
 iddiary int auto_increment not null,
 imepriimek varchar(50),
 when date,
 action varchar(30),
 onfile varchar(100)
 unique id(iddiary)
);

To get formated date you should use:

select date_format(when, %T%W%e%c%y) from diary;

To put data in this field you can use:

insert into diary (when) values (str_to_date(10:55:14Thursday28509, 
%T%W%e%c%y));



-- 
João Cândido de Souza Neto
SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS
Fone: (0XX41) 3033-3636 - JS
www.siens.com.br

Grega Leskovsek mavri...@gmail.com escreveu na mensagem 
news:1df2d4810905280643y62a0f092p91fa2c57558d8...@mail.gmail.com...
 CREATE TABLE diary(iddiary int auto_increment not null, imepriimek
 varchar(50), when date(%T%W%e%c%y), action varchar(30), onfile
 varchar(100) unique id(iddiary));

 I tried the above and it didn't work. What must I do to create a table
 with full time and date. If I should use timestamp how do I convert
 thee timestamp in php back to normal time? (I also tried the mysql
 command:
 when timestamp
 and
 when date
 in the above first mysql clause but it didnt work
 )

 Please help me. Thanks in advance,
 -- 
 When the sun rises I receive and when it sets I forgive -
 http://users.skavt.net/~gleskovs/
 All the Love, Grega Leskov'sek 



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



Re: [PHP] PHP vs ASP.NET

2009-05-28 Thread Daniel Brown
On Thu, May 28, 2009 at 09:39, Robert Cummings rob...@interjinn.com wrote:

 It's not really a stupid question. Some people aren't sufficiently aware
 of other technologies to know the answer. It may seem simplistic to many
 of us, but not to those new to the culture.

Well, even though I forgot to tack-on my smiley face, the more I
read the original post, the more my point is validated.  The question
is posed in such a manner that it would suggest PHP is a legacy
language being replaced by ASP.

Will Visual Basic be replaced by Visual Basic .NET?  That makes sense.

Will Assembly be replaced by LOLCODE?  Nonsense - they're
separate entities.

It's not a matter of not understanding open source technology,
it's a matter of not understanding the basics of programming and
development languages and semantics.  And don't get me wrong --- I
don't fault the original poster for this.  It's an age-old question
that pops up again and again (interesting side-note: when you query
Google for 'php vs asp metrics' - without the quotes, of course - a
quick article I wrote back in February is the top result).

The problem is the lack of education and understanding that
different languages have different strengths, weaknesses, features,
and purposes, and comparing them - indeed, inquiring if one will
replace another - is a dumb question.  Which then raises the
difference: a *dumb* question is often asked by a *smart* person.  So
it shouldn't be confused with an insult to the OP by any means.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



Re: [PHP] Re: mysql create table with date or timestamp

2009-05-28 Thread Grega Leskovsek
I GOT THIS ERROR when  I tried first sample with when timestamp;


ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual thatcorresponds to your MySQL server version for the right
syntax to use near 'id(iddiary) )' at line 1


2009/5/28 João Cândido de Souza Neto j...@consultorweb.cnt.br:
 If you need date and hour the best way is:

 CREATE TABLE diary (
  iddiary int auto_increment not null,
  imepriimek varchar(50),
  when timestamp,
  action varchar(30),
  onfile varchar(100)
  unique id(iddiary)
 );

Please advice. Thanks in advance, Grega

 if you need only date you can use:

 CREATE TABLE diary (
  iddiary int auto_increment not null,
  imepriimek varchar(50),
  when date,
  action varchar(30),
  onfile varchar(100)
  unique id(iddiary)
 );

 To get formated date you should use:

 select date_format(when, %T%W%e%c%y) from diary;

 To put data in this field you can use:

 insert into diary (when) values (str_to_date(10:55:14Thursday28509,
 %T%W%e%c%y));



 --
 João Cândido de Souza Neto
 SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS
 Fone: (0XX41) 3033-3636 - JS
 www.siens.com.br

 Grega Leskovsek mavri...@gmail.com escreveu na mensagem
 news:1df2d4810905280643y62a0f092p91fa2c57558d8...@mail.gmail.com...
 CREATE TABLE diary(iddiary int auto_increment not null, imepriimek
 varchar(50), when date(%T%W%e%c%y), action varchar(30), onfile
 varchar(100) unique id(iddiary));

 I tried the above and it didn't work. What must I do to create a table
 with full time and date. If I should use timestamp how do I convert
 thee timestamp in php back to normal time? (I also tried the mysql
 command:
 when timestamp
 and
 when date
 in the above first mysql clause but it didnt work
 )

 Please help me. Thanks in advance,
 --
 When the sun rises I receive and when it sets I forgive -
 http://users.skavt.net/~gleskovs/
 All the Love, Grega Leskov'sek



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





-- 
When the sun rises I receive and when it sets I forgive -
http://users.skavt.net/~gleskovs/
All the Love, Grega Leskov'sek

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



Re: Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Tony Marston
Eddie Drapkin oorza...@gmail.com wrote in message 
news:68de37340905280737t3e1ad844y188ab8fa08f17...@mail.gmail.com...
 Your code might not, but you sure do!  Spending all that time writing
 require statements = :(

If you are too lazy to write require statements then you are probably too 
lazy to write readable, well structured and efficient code. Besides, I don't 
use require statements, I use
$dbobject = singleton::getInstance('classname');

I don't use autoload because *I* want to be in control. I prefer not to rely 
on automatuic features which may not work as expected.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

 On Thu, May 28, 2009 at 9:49 AM, Tony Marston 
 t...@marston-home.demon.co.uk
 wrote:


 oorza...@gmail.com wrote in message
 news:000e0cd6ad1a9f7d3d046af89...@google.com...
  Two things:
 
  1. Try using the fully qualified path (ie /var/www/foo/bar.php instead 
  of
  foo/bar.php)
  2. Look at setting up autoloading so you don't need to manually include
  anyway. If you're going OOP, autoloading is a must!

 I totally disagree. I have been doing OOP with PHP for years, and I have
 never used autoloading. It is just a feature that can be used, misused or
 abused just like any other. I choose not to use it, and my code does not
 suffer in the least!

 --
 Tony Marston
 http://www.tonymarston.net
 http://www.radicore.org




 --
 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: mysql create table with date or timestamp

2009-05-28 Thread Jo�o C�ndido de Souza Neto
It´s not auto_increment, it´s auto increment.

-- 
João Cândido de Souza Neto
SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS
Fone: (0XX41) 3033-3636 - JS
www.siens.com.br

Grega Leskovsek mavri...@gmail.com escreveu na mensagem 
news:1df2d4810905280748uec4f425kaf14b6410caa...@mail.gmail.com...
I GOT THIS ERROR when  I tried first sample with when timestamp;


ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual thatcorresponds to your MySQL server version for the right
syntax to use near 'id(iddiary) )' at line 1


2009/5/28 João Cândido de Souza Neto j...@consultorweb.cnt.br:
 If you need date and hour the best way is:

 CREATE TABLE diary (
 iddiary int auto_increment not null,
 imepriimek varchar(50),
 when timestamp,
 action varchar(30),
 onfile varchar(100)
 unique id(iddiary)
 );

Please advice. Thanks in advance, Grega

 if you need only date you can use:

 CREATE TABLE diary (
 iddiary int auto_increment not null,
 imepriimek varchar(50),
 when date,
 action varchar(30),
 onfile varchar(100)
 unique id(iddiary)
 );

 To get formated date you should use:

 select date_format(when, %T%W%e%c%y) from diary;

 To put data in this field you can use:

 insert into diary (when) values (str_to_date(10:55:14Thursday28509,
 %T%W%e%c%y));



 --
 João Cândido de Souza Neto
 SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS
 Fone: (0XX41) 3033-3636 - JS
 www.siens.com.br

 Grega Leskovsek mavri...@gmail.com escreveu na mensagem
 news:1df2d4810905280643y62a0f092p91fa2c57558d8...@mail.gmail.com...
 CREATE TABLE diary(iddiary int auto_increment not null, imepriimek
 varchar(50), when date(%T%W%e%c%y), action varchar(30), onfile
 varchar(100) unique id(iddiary));

 I tried the above and it didn't work. What must I do to create a table
 with full time and date. If I should use timestamp how do I convert
 thee timestamp in php back to normal time? (I also tried the mysql
 command:
 when timestamp
 and
 when date
 in the above first mysql clause but it didnt work
 )

 Please help me. Thanks in advance,
 --
 When the sun rises I receive and when it sets I forgive -
 http://users.skavt.net/~gleskovs/
 All the Love, Grega Leskov'sek



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





-- 
When the sun rises I receive and when it sets I forgive -
http://users.skavt.net/~gleskovs/
All the Love, Grega Leskov'sek 



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



Re: Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Eddie Drapkin
There's a huge difference between laziness and opting in to use an
incredibly useful (and easy to properly deploy) feature to save myself time
so that I can spend more time writing that structured and efficient code of
which you speak.  And the problem with what you're saying is that you still
have to include 'singleton.php' somewhere in order to call its static
methods, and I'd rather just spend 30 minutes writing an autoloader object
and letting it deal with finding any of the classes I use then trying to
keep track of legacy code I didn't write and require'ing them all over the
place.

The way I look at it, if you spend all your time handling things that you
could automate - and if written properly, will always work as expected (it's
called unit testing and debugging) - then you have no time to write that
structured and efficient code in order to meet your deadlines! :)

On Thu, May 28, 2009 at 10:53 AM, Tony Marston 
t...@marston-home.demon.co.uk wrote:

 Eddie Drapkin oorza...@gmail.com wrote in message
 news:68de37340905280737t3e1ad844y188ab8fa08f17...@mail.gmail.com...
  Your code might not, but you sure do!  Spending all that time writing
  require statements = :(

 If you are too lazy to write require statements then you are probably too
 lazy to write readable, well structured and efficient code. Besides, I
 don't
 use require statements, I use
$dbobject = singleton::getInstance('classname');

 I don't use autoload because *I* want to be in control. I prefer not to
 rely
 on automatuic features which may not work as expected.

 --
 Tony Marston
 http://www.tonymarston.net
 http://www.radicore.org

  On Thu, May 28, 2009 at 9:49 AM, Tony Marston
  t...@marston-home.demon.co.uk
  wrote:
 
 
  oorza...@gmail.com wrote in message
  news:000e0cd6ad1a9f7d3d046af89...@google.com...
   Two things:
  
   1. Try using the fully qualified path (ie /var/www/foo/bar.php instead
   of
   foo/bar.php)
   2. Look at setting up autoloading so you don't need to manually
 include
   anyway. If you're going OOP, autoloading is a must!
 
  I totally disagree. I have been doing OOP with PHP for years, and I have
  never used autoloading. It is just a feature that can be used, misused
 or
  abused just like any other. I choose not to use it, and my code does not
  suffer in the least!
 
  --
  Tony Marston
  http://www.tonymarston.net
  http://www.radicore.org
 
 
 
 
  --
  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: mysql create table with date or timestamp

2009-05-28 Thread Grega Leskovsek
The problem was I  didn't type a comma before unique id(iddary).
Thanks to everybody for helping me on the seminar. Love, Grega

2009/5/28 LinuxManMikeC linuxmanmi...@gmail.com:
 Actually, AUTO_INCREMENT is the correct syntax for MySQL.  I think the
 problem is NOT NULL should come first: iddiary INT NOT NULL
 AUTO_INCREMENT.

 2009/5/28 João Cândido de Souza Neto j...@consultorweb.cnt.br:
 It´s not auto_increment, it´s auto increment.

 --
 João Cândido de Souza Neto
 SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS
 Fone: (0XX41) 3033-3636 - JS
 www.siens.com.br

 Grega Leskovsek mavri...@gmail.com escreveu na mensagem
 news:1df2d4810905280748uec4f425kaf14b6410caa...@mail.gmail.com...
 I GOT THIS ERROR when  I tried first sample with when timestamp;


 ERROR 1064 (42000): You have an error in your SQL syntax; check the
 manual thatcorresponds to your MySQL server version for the right
 syntax to use near 'id(iddiary) )' at line 1


 2009/5/28 João Cândido de Souza Neto j...@consultorweb.cnt.br:
 If you need date and hour the best way is:

 CREATE TABLE diary (
 iddiary int auto_increment not null,
 imepriimek varchar(50),
 when timestamp,
 action varchar(30),
 onfile varchar(100)
 unique id(iddiary)
 );

 Please advice. Thanks in advance, Grega

 if you need only date you can use:

 CREATE TABLE diary (
 iddiary int auto_increment not null,
 imepriimek varchar(50),
 when date,
 action varchar(30),
 onfile varchar(100)
 unique id(iddiary)
 );

 To get formated date you should use:

 select date_format(when, %T%W%e%c%y) from diary;

 To put data in this field you can use:

 insert into diary (when) values (str_to_date(10:55:14Thursday28509,
 %T%W%e%c%y));



 --
 João Cândido de Souza Neto
 SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS
 Fone: (0XX41) 3033-3636 - JS
 www.siens.com.br

 Grega Leskovsek mavri...@gmail.com escreveu na mensagem
 news:1df2d4810905280643y62a0f092p91fa2c57558d8...@mail.gmail.com...
 CREATE TABLE diary(iddiary int auto_increment not null, imepriimek
 varchar(50), when date(%T%W%e%c%y), action varchar(30), onfile
 varchar(100) unique id(iddiary));

 I tried the above and it didn't work. What must I do to create a table
 with full time and date. If I should use timestamp how do I convert
 thee timestamp in php back to normal time? (I also tried the mysql
 command:
 when timestamp
 and
 when date
 in the above first mysql clause but it didnt work
 )

 Please help me. Thanks in advance,
 --
 When the sun rises I receive and when it sets I forgive -
 http://users.skavt.net/~gleskovs/
 All the Love, Grega Leskov'sek



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





 --
 When the sun rises I receive and when it sets I forgive -
 http://users.skavt.net/~gleskovs/
 All the Love, Grega Leskov'sek



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





-- 
When the sun rises I receive and when it sets I forgive -
http://users.skavt.net/~gleskovs/
All the Love, Grega Leskov'sek

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



Re: [PHP] Re: mysql create table with date or timestamp

2009-05-28 Thread Daniel Brown
On Thu, May 28, 2009 at 11:15, Andrew Ballard aball...@gmail.com wrote:

 Make that a 'comma', not the 'coma' that I seem to be in.  :-)

Eh, it's your birthday.  You're allowed.  ;-P

Happy birthday, by the way.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



Re: [PHP] Create multipart email

2009-05-28 Thread Eric Butera
On Thu, May 28, 2009 at 4:47 AM, Guus Ellenkamp
ellenkamp_g...@hotmail.com wrote:
 I'm trying to attach an uploaded file to an e-mail which I receive in
 Outlook. Neither the first part, nor the second part displays properly. The
 header looks ok when displayed on the screen. What am I missing?

If you value your time then use Zend_Mail and be done with it.  :D

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



Re: Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Tony Marston

Eddie Drapkin oorza...@gmail.com wrote in message 
news:68de37340905280801m6964d355l2d6d8ef773f3b...@mail.gmail.com...
 There's a huge difference between laziness and opting in to use an
 incredibly useful (and easy to properly deploy) feature to save myself 
 time
 so that I can spend more time writing that structured and efficient code 
 of
 which you speak.  And the problem with what you're saying is that you 
 still
 have to include 'singleton.php' somewhere in order to call its static
 methods,

I have a single general purpose include file which autmatically includes all 
other standard files, so I never have to explicity load my singleton class.

 and I'd rather just spend 30 minutes writing an autoloader object
 and letting it deal with finding any of the classes I use then trying to
 keep track of legacy code I didn't write and require'ing them all over the
 place.

I'd rather not waste 30 minutes of my time writing a feature that I don't 
need.

The difference between using and not using the autoload feature does not 
have any measurable impact on either my development times, nor the execution 
of my code, so I choose to not use it. That's my choice, and I'm sticking to 
it.

 The way I look at it, if you spend all your time handling things that you
 could automate - and if written properly, will always work as expected 
 (it's
 called unit testing and debugging) - then you have no time to write that
 structured and efficient code in order to meet your deadlines! :)

Not using autoload does not have any noticeable effect on my deadlines, so I 
have no incentive to use it. Just because you say that I *should* use it 
carries no weight at all.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

 On Thu, May 28, 2009 at 10:53 AM, Tony Marston 
 t...@marston-home.demon.co.uk wrote:

 Eddie Drapkin oorza...@gmail.com wrote in message
 news:68de37340905280737t3e1ad844y188ab8fa08f17...@mail.gmail.com...
  Your code might not, but you sure do!  Spending all that time writing
  require statements = :(

 If you are too lazy to write require statements then you are probably 
 too
 lazy to write readable, well structured and efficient code. Besides, I
 don't
 use require statements, I use
$dbobject = singleton::getInstance('classname');

 I don't use autoload because *I* want to be in control. I prefer not to
 rely
 on automatuic features which may not work as expected.

 --
 Tony Marston
 http://www.tonymarston.net
 http://www.radicore.org

  On Thu, May 28, 2009 at 9:49 AM, Tony Marston
  t...@marston-home.demon.co.uk
  wrote:
 
 
  oorza...@gmail.com wrote in message
  news:000e0cd6ad1a9f7d3d046af89...@google.com...
   Two things:
  
   1. Try using the fully qualified path (ie /var/www/foo/bar.php 
   instead
   of
   foo/bar.php)
   2. Look at setting up autoloading so you don't need to manually
 include
   anyway. If you're going OOP, autoloading is a must!
 
  I totally disagree. I have been doing OOP with PHP for years, and I 
  have
  never used autoloading. It is just a feature that can be used, misused
 or
  abused just like any other. I choose not to use it, and my code does 
  not
  suffer in the least!
 
  --
  Tony Marston
  http://www.tonymarston.net
  http://www.radicore.org
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 



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


 



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



Re: [PHP] Re: mysql create table with date or timestamp

2009-05-28 Thread Andrew Ballard
On Thu, May 28, 2009 at 11:15 AM, Andrew Ballard aball...@gmail.com wrote:
 2009/5/28 Grega Leskovsek mavri...@gmail.com:
 I GOT THIS ERROR when  I tried first sample with when timestamp;


 ERROR 1064 (42000): You have an error in your SQL syntax; check the
 manual thatcorresponds to your MySQL server version for the right
 syntax to use near 'id(iddiary) )' at line 1


 2009/5/28 João Cândido de Souza Neto j...@consultorweb.cnt.br:
 If you need date and hour the best way is:

 CREATE TABLE diary (
  iddiary int auto_increment not null,
  imepriimek varchar(50),
  when timestamp,
  action varchar(30),
  onfile varchar(100)
  unique id(iddiary)
 );

 Please advice. Thanks in advance, Grega

 There is a coma missing between the lines for the last column and the
 unique key.

 Andrew


Make that a 'comma', not the 'coma' that I seem to be in.  :-)

Andrew

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



Re: [PHP] Re: mysql create table with date or timestamp

2009-05-28 Thread Andrew Ballard
On Thu, May 28, 2009 at 11:20 AM, Daniel Brown danbr...@php.net wrote:
 On Thu, May 28, 2009 at 11:15, Andrew Ballard aball...@gmail.com wrote:

 Make that a 'comma', not the 'coma' that I seem to be in.  :-)

    Eh, it's your birthday.  You're allowed.  ;-P

    Happy birthday, by the way.


Thanks! It's a weak excuse, but I'll take it.  :-)

Andrew

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



Re: [PHP] Hebrew Directory Names

2009-05-28 Thread Tom Worster
On 5/28/09 10:15 AM, Nitsan Bin-Nun nit...@binnun.co.il wrote:

 I have wrote a files-based php system which not requires any kind of
 database to work, it is based upon files and directories.
 
 I'm using scandir() to fetch the file names of a directory, when the files
 and the directories are in English everything works like a charm, the
 problems starting when the files or the directories are in Hebrew.
 
 I tried several encodings for the directory names (including UTF8) but no
 luck so far. I always get is_file() === FALSE when the directory name is in
 Hebrew and the filename is in English.
 
 Any ideas??
 
 The path which I'm checking with is_file() is:
 
 string(63) /home/nitsanbn/public_html/iphoneia/walls/מחשבים/1346.jpg
 
 
 (Due to the LTR encoding of this messege the filename is looking like it's
 in Hebrew, the directory is מחשבים and the filename is 1346.jpg)

interesting problem. i suspect there will be serious dependency on os and
file system.

on os x 10.5 and a Mac OS Extended volume i created a directory with 5 files
in it as follows:

$ ls במהירות
אתעסקתשליטרוציםלהשלים

(i've no idea what these words mean. i copied them from a hebrew newspaped
web site.)

i ran the following script with cwd set to the ditectory in php 5.2.8 cli:

$default_locale = setlocale(LC_ALL, 'en_US.UTF-8');
ini_set('default_charset', 'UTF-8' );
$dh  = opendir('.');
while (false !== ($filename = readdir($dh)))
$files[] = $filename;
sort($files);
print_r($files);
foreach ($files as $f)
print( (is_file($f) ? file:\t\t : not file:\t).realpath($f).\n );


Array
(
[0] = .
[1] = ..
[2] = את
[3] = להשלים
[4] = עסקת
[5] = רוצים
[6] = שליט
)
not file:/Users/fsb/במהירות
not file:/Users/fsb
file:/Users/fsb/במהירות/את
file:/Users/fsb/במהירות/להשלים
file:/Users/fsb/במהירות/עסקת
file:/Users/fsb/במהירות/רוצים
file:/Users/fsb/במהירות/שליט

ok. but as you noted, the ltr reversal switches path order as well as
character order, which is a bit confusing. (btw: the square brackets above
got reversed in the cut and paste from terminal window to entourage.)

then i renamed the files thus:

$ ls 
את.jpgשליט.jpgלהשלים.jpg
עסקת.jpgרוצים.jpg

$ ls -l
total 0
-rw-r--r--  1 fsb  fsb  0 May 28 12:16 את.jpg
-rw-r--r--  1 fsb  fsb  0 May 28 12:16 עסקת.jpg
-rw-r--r--  1 fsb  fsb  0 May 28 12:59 שליט.jpg
-rw-r--r--  1 fsb  fsb  0 May 28 12:16 רוצים.jpg
-rw-r--r--  1 fsb  fsb  0 May 28 12:16 להשלים.jpg

which is also a tad confusing, ls using two different conventions. but the
script still seems to work.

Array
(
[0] = .
[1] = ..
[2] = את.jpg
[3] = להשלים.jpg
[4] = עסקת.jpg
[5] = רוצים.jpg
[6] = שליט.jpg
)
not file:/Users/fsb/במהירות
not file:/Users/fsb
file:/Users/fsb/במהירות/את.jpg
file:/Users/fsb/במהירות/להשלים.jpg
file:/Users/fsb/במהירות/עסקת.jpg
file:/Users/fsb/במהירות/רוצים.jpg
file:/Users/fsb/במהירות/שליט.jpg

now with a couple of numeric file names in the same directory:

$ ls
1234.jpgעסקת.jpgלהשלים.jpg
2345.jpgשליט.jpg
את.jpgרוצים.jpg

Array
(
[0] = .
[1] = ..
[2] = 1234.jpg
[3] = 2345.jpg
[4] = את.jpg
[5] = להשלים.jpg
[6] = עסקת.jpg
[7] = רוצים.jpg
[8] = שליט.jpg
)
not file:/Users/fsb/במהירות
not file:/Users/fsb
file:/Users/fsb/במהירות/1234.jpg
file:/Users/fsb/במהירות/2345.jpg
file:/Users/fsb/במהירות/את.jpg
file:/Users/fsb/במהירות/להשלים.jpg
file:/Users/fsb/במהירות/עסקת.jpg
file:/Users/fsb/במהירות/רוצים.jpg
file:/Users/fsb/במהירות/שליט.jpg

so it looks like things are working here.

i was unable to do anything hebrew at all on

in your position i would check the default charset and locale settings. also
perhaps try a different php version. i expect you have mbstring installed. i
have 

mbstring.func_overload = 7
mbstring.internal_encoding = UTF-8

but i doubt that makes the difference.



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



Re: [PHP] PHP, OOP and AJAX

2009-05-28 Thread Tom Worster
On 5/28/09 7:31 AM, Julian Muscat Doublesin opensourc...@gmail.com
wrote:

 I had been programming in ASP.NET for years using Object Oriented
 Princeliness but decided to walk away from that.  I am now researching and
 specialising in the open source world.

yay!


 I have started to develop a project using MySQL, PHP and OOP.

oh. not walking away from oop after all? sad ;-)


 So far I have
 succeed. However I got stuck once I started implement AJAX using the AJAX
 tutorial from w3schools.com.

if using ajax, i recommend you take a look at jquery. i'm really quite taken
with it. it makes browser-independent ajax much easier.


 What I have discovered is: for some reason when you call a file that
 requires other fies using the REQUIRE or INCLUDE it just does not work. I
 can conform this as I have tested with out the the functions.

i can't imagine a reason why an include would fail because the script was
invoked via XHR. my ajax back-end php scripts use included files. are you
sure this isn't a problem with the include path? to debug you could try
writing ini_get('include_path') to your log file.




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



Re: [PHP] PHP vs ASP.NET

2009-05-28 Thread Tom Worster
On 5/28/09 9:20 AM, Olexandr Heneralov ohenera...@gmail.com wrote:

 I have a question for everyone:
 Can it happen so that PHP will be replaced with ASP.NET?

why you pry it out of my cold dead hand ;-)



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



Re: [PHP] Hebrew Directory Names

2009-05-28 Thread Tom Worster
On 5/28/09 1:19 PM, Tom Worster f...@thefsb.org wrote:

 i suspect there will be serious dependency on os and file system.

i was unable to do anything with hebrew file or dir names on freebsd 7.1
with ufs. i even tried scping and tarring over the directory that worked on
os x.



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



Re: [PHP] Hebrew Directory Names

2009-05-28 Thread Nitsan Bin-Nun
i have tried this:

?php if (!defined('THROUGH_INDEX')) die('Sorry mate!');

 $default_locale = setlocale(LC_ALL, 'en_US.UTF-8');
 ini_set('default_charset', 'UTF-8' );


 $_GET['folder'] =
 preg_replace(/([\xE0-\xFA])/e,chr(215).chr(ord(\${1})-80),$_GET['folder']);

 $dirname = $config['walls_dir'].$_GET['folder']./.$_GET['filename'];


 if (!is_file($dirname)) { echo leave();; g($dirname);die;}



I'm still getting:

 leave();

 string(56) /home/nitsanbn/public_html/iphoneia/walls/חלל/008.jpg


The preg_replace() above convert the Hebrew chars into UTF8.
The conversion does work but the file is not recognized as a file, although
that i can browse it straightly.

I'm afraid that I don't have access to the php.ini, since it's a shared
hosting, do you know if hostgator gives access to php.ini or let you changes
it's values?

Thanks!

On Thu, May 28, 2009 at 7:44 PM, Tom Worster f...@thefsb.org wrote:

 On 5/28/09 1:19 PM, Tom Worster f...@thefsb.org wrote:

  i suspect there will be serious dependency on os and file system.

 i was unable to do anything with hebrew file or dir names on freebsd 7.1
 with ufs. i even tried scping and tarring over the directory that worked on
 os x.





Re: [PHP] Hebrew Directory Names

2009-05-28 Thread Tom Worster
On 5/28/09 2:06 PM, Nitsan Bin-Nun nit...@binnun.co.il wrote:

 i have tried this:
 
 ?php if (!defined('THROUGH_INDEX')) die('Sorry mate!');
 
 $default_locale = setlocale(LC_ALL, 'en_US.UTF-8');
 ini_set('default_charset', 'UTF-8' );
 
 
 $_GET['folder'] =
 preg_replace(/([\xE0-\xFA])/e,chr(215).chr(ord(\${1})-80),$_GET['folder']
 );
 
 $dirname = $config['walls_dir'].$_GET['folder']./.$_GET['filename'];
 
 
 if (!is_file($dirname)) { echo leave();; g($dirname);die;}
 
 
 
 I'm still getting:
 
 leave();
 
 string(56) /home/nitsanbn/public_html/iphoneia/walls/חלל/008.jpg
 
 
 The preg_replace() above convert the Hebrew chars into UTF8.
 The conversion does work but the file is not recognized as a file, although
 that i can browse it straightly.

why do you think that you need to do any conversion at all?

that preg_replace looks terrifying! how did you come by it? i'm immediately
suspicious that this is the problem.

i googled the code and found people claiming that it translates window-1255
to utf8 (2004, dubious) and iso-8859-1 to utf-8 (2005, dubious).

if you know that the browser is sending the GET variable 'folder' in a known
encoding other than utf8, why not convert it with mb_convert_encoding or
iconv?

alternatively, force the user agent to send it in utf8 by sending the form
as utf 8 (send header('Content-Type: text/html; charset=utf-8'), and use
accept-charset=utf-8 in the form tag) and don't convert. then you can
avoid all conversions.


 I'm afraid that I don't have access to the php.ini, since it's a shared
 hosting, do you know if hostgator gives access to php.ini or let you changes
 it's values?

i have no idea. but i imagine it is sufficient to use ini_set().



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



Re: [PHP] PHP ping and exec() hangs apache

2009-05-28 Thread Ashley Sheridan
On Thu, 2009-05-28 at 10:33 +0200, Kamil Walas wrote:
 Ashley Sheridan pisze:
   On Wed, 2009-05-27 at 10:25 +0200, Kamil Walas wrote:
   Hi,
  
   I stuck with strange error. I have following code:
   ?
echo 'BEFORE';
echo exec(ping -c1 -w1 1.1.25.38);
echo 'AFTER';
   ?
  
   Address doesn't exist. When execute script from command line everything
   works fine. But when I go to the file by Firefox it hangs out and 
 apache
   need to be restart. This is a Virtual Server with PHP Version
   5.2.6-pl222-gentoo. When address exists it works fine. Only problem is
   when it doesn't respond and apache hangs.
  
   I copy file to apache at my local apache and everything works fine. My
   apache is with Version 5.3.0alpha3-dev at windows XP.
  
   At old server with php4 everything works fine.
  
   I suspect that something wrong is with apache configuration but I don't
   know it for sure and couldn't find it.
  
   Thank you,
   Kamil Walas
  
   Are you sure it's crashed and is not just waiting for a reply from the
   remote server. How long do you leave it running before you assume it's
   crashed? I see it's set for a 1millisecond wait response, but what is
   the -c1 flag, as I'm not familiar with all the flags of a Windows ping,
   and a quick Google didn't reveal it.
  
  
   Ash
   www.ashleysheridan.co.uk
  
 
 
 It is waiting. Not crash but hangs. Id don't know why. For test once I 
 leave it for something about 2 hours - for one ping it should be 
 enought. -c1 flag tells to send only one ping. It hangs on Gentoo.
 
 I solved it by removing exec.
 Now it looks like:
 function ping( $host, $number_port, $timeout )
 {
 $fp = fsockopen($host, $number_port, $a, $timeout);  
 if($fp !== FALSE ) { fclose($fp); return true;}
 else { return false; }  
 }
 It's better than ping becouse there is also a port number check.
 
 
 Thanks for fast answer,
 
 Kamil Walas
 
 
Ah, ok sorry, I misread your question and thought all the tests were on
Windows (too early this morning!)



Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Ashley Sheridan
On Thu, 2009-05-28 at 16:17 +0300, Olexandr Heneralov wrote:
 Hi!
 Do not use low-level AJAX.
 There are many frameworks for ajax (JQUERY).
 Try to use PHP frameworks like symfony, zend framework. They simplify your
 work.
 
 
 2009/5/28 Lenin le...@phpxperts.net
 
  2009/5/28 kranthi kranthi...@gmail.com
 
  
  
   i recommend you firebug firefox adddon (just go to the net tab and you
   can see all the details of the communication between client and
   server)
   and i find it helpful to use a standard javascript(jQuery in my case)
   library instead of highly limited plain javascript  language
  
  I also recommend using FirePHP with FireBug here's a nicely written
  tutorial
  on how to use them both together for Ajax'ed pages. http://tr.im/iyvl
  Thanks
  Lenin
  www.twitter.com/nine_L
 
Real coders use low-level ajax... and code with rocks too ;)


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] PHP vs ASP.NET

2009-05-28 Thread Ashley Sheridan
On Thu, 2009-05-28 at 14:29 +0100, Lester Caine wrote:
 Olexandr Heneralov wrote:
  Hi!
  Guys, you of course, know that  ASP.NET becomes more and more popular in the
  world.
  I have a question for everyone:
  Can it happen so that PHP will be replaced with ASP.NET?
 
 Perhaps when it runs on Linux servers?
 Personally I'm moving more stuff OFF Windows servers and onto Linux than 
 the other way.
 
 -- 
 Lester Caine - G8HFL
 -
 Contact - http://lsces.co.uk/wiki/?page=contact
 L.S.Caine Electronic Services - http://lsces.co.uk
 EnquirySolve - http://enquirysolve.com/
 Model Engineers Digital Workshop - http://medw.co.uk//
 Firebird - http://www.firebirdsql.org/index.php
 
.Net does run on Linux servers, through a project called Mono. I've yet
to see it offered by a hosting company yet though.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Re: Displaying images

2009-05-28 Thread Miller, Terion



Well I have tried Numerous scripts and ways and still can't get the image to 
display.

I have echoed the file and have been able to get the gibberish image code to 
display but not a real image, here is my full code if anyone wants to have a 
look, I am going crossed eyed here.





These are just a few of the ways I have been trying to get the img tag to work 
on my output.php page:

   trtdScout Photo:/td  td  a 
href=image.php?filename=?php echo$row['photoName']; ??php 
echo$row['photoName']; ?/Abr?php echo 
\nbrScout Photo : .img src=\image.php?filename= .$row['photoName']. 
\; ?  ?php echo img 
src=\image.php?filename=.$row['photoName'].\\n; ?
?php echo img src=\image.php?id=.$row['ePID'].\\n; ?  
  img src=image2.php?filename=?php echo $row['photoName']; ?


Here is one way I was trying to get to work for the image.php page where the 
headers are supposed to work and don't

include(inc/dbconn_open.php);
error_reporting(E_ALL);


//if (isset($_FILES['ePhoto'])){$ePhoto = $_FILES['ePhoto'];} else {$ePhoto 
=;}

$filename = $_GET['$filename'];

$image = stripslashes($_REQUEST[photoName]);

$sql = SELECT ePhoto, photoName, photoType from eagleProjects WHERE photoName 
= $filename;
$result=mysql_query($sql);
$data = mysql_fetch_array ($result);



$type = $data['photoType'];
$name = $data['photoName'];

  header(Content-type: $type);
  header(Content-Disposition: attachment; filename=$name);


echo $data[photoName];
echo $data[ePhoto];

exit;

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



[PHP] class problem

2009-05-28 Thread Luke
Right I've read the manual on this and all that so hopefully you fine people
can help.
I have an abstract class with three children. The abstract is ForumObject
and the three children are Thread, Category and Post and each have their own
table so I wrote the following:
abstract class ForumObject
{
  static private $table;

  static function getObjectIds ($field, $value)
  {
  $query = SELECT id FROM {self::$table} WHERE $field = '$value';
  $object_ids = mysql_fetch_array();
  return $object_ids;
  }
}

class Category extends ForumObject
{
  static private $table = categories;
}
That's just got the important bits for the sake of your eyes but basically
the problem I'm having is calling
Category::getObjectIds ($whatever, $whatever2);
Seems to think that it's referring to ForumObject::$table rather than
Category::$table?
I looked into it and there seems to be something you can do with
get_called_class() but unfortunately I'm stuck with 5.2.9 at the moment and
that is new to 5.3.
Any ideas? Perhaps there is a different way I could implement the classes -
I would rather not have getObjectIds repeated three times!
Thanks in advance,

-- 
Luke Slater
http://dinosaur-os.com/
:O)


Re: [PHP] class problem :(

2009-05-28 Thread Nathan Nobbe
On Thu, May 28, 2009 at 4:28 PM, Luke l...@blog-thing.com wrote:

 Right I've read the manual on this and all that so hopefully you find
 people
 can help.
 I have an abstract class with three children. The abstract is ForumObject
 and the three children are Thread, Category and Post and each have their
 own
 table so I wrote the following:
 abstract class ForumObject
 {
  static private $table;

  static function getObjectIds ($field, $value)
  {
  $query = SELECT id FROM {self::$table} WHERE $field = '$value';
  $object_ids = mysql_fetch_array();
  return $object_ids;
  }
 }

 class Category extends ForumObject
 {
  static private $table = categories;
 }
 That's just got the important bits for the sake of your eyes but basically
 the problem I'm having is calling
 Category::getObjectIds ($whatever, $whatever2);
 Seems to think that it's referring to ForumObject::$table rather than
 Category::$table?
 I looked into it and there seems to be something you can do with
 get_called_class() but unfortunately I'm stuck with 5.2.9 at the moment and
 that is new to 5.3.
 Any ideas? Perhaps there is a different way I could implement the classes -
 I would rather not have getObjectIds repeated three times!
 Thanks in advance,


this is a limitation in pre-5.3 php wherein there is no support for static
inheritance.  another way to do it in 5.3, inside of the
ForumObject::getObjectId() method is to use

static::$table which will correctly resolve the lookup to the class youd
expect.

-nathan


Re: [PHP] class problem :(

2009-05-28 Thread Nathan Nobbe
On Thu, May 28, 2009 at 4:28 PM, Luke l...@blog-thing.com wrote:

 Any ideas? Perhaps there is a different way I could implement the classes -
 I would rather not have getObjectIds repeated three times!


just make the classes instance-based, thats your easiest bet.
(sorry for the extra noise)

abstract class ForumObject
{
  private $table;

 function getObjectIds ($field, $value)
 {
 $query = SELECT id FROM {$this-table} WHERE $field = '$value';
 $object_ids = mysql_fetch_array();
 return $object_ids;
 }
}

painful, i know..  which is why static inheritance is one of the headliners
in 5.3.

-nathan


[PHP] Re: class problem :(

2009-05-28 Thread Shawn McKenzie
Luke wrote:
 Right I've read the manual on this and all that so hopefully you find people
 can help.
 I have an abstract class with three children. The abstract is ForumObject
 and the three children are Thread, Category and Post and each have their own
 table so I wrote the following:
 abstract class ForumObject
 {
   static private $table;
 
   static function getObjectIds ($field, $value)
   {
   $query = SELECT id FROM {self::$table} WHERE $field = '$value';
   $object_ids = mysql_fetch_array();
   return $object_ids;
   }
 }
 
 class Category extends ForumObject
 {
   static private $table = categories;
 }
 That's just got the important bits for the sake of your eyes but basically
 the problem I'm having is calling
 Category::getObjectIds ($whatever, $whatever2);
 Seems to think that it's referring to ForumObject::$table rather than
 Category::$table?
 I looked into it and there seems to be something you can do with
 get_called_class() but unfortunately I'm stuck with 5.2.9 at the moment and
 that is new to 5.3.
 Any ideas? Perhaps there is a different way I could implement the classes -
 I would rather not have getObjectIds repeated three times!
 Thanks in advance,

I didn't test this, just a thought.  You'd still have to implement
getObjectIds(), but it would be slim:

abstract class ForumObject
{
  static private $table;

  static function getObjectIds ($field, $value, $class)
  {
$query = SELECT id FROM {$class::$table} WHERE $field = '$value';
$object_ids = mysql_fetch_array();
return $object_ids;
  }
}

class Category extends ForumObject
{
  static private $table = 'categories';

  static function getObjectIds ($field, $value)
  {
parent::getObjectIds ($field, $value, __CLASS__)
  }
}

Or probably the same because you're defining $table anyway in the child
class:

abstract class ForumObject
{
  static private $table;

  static function getObjectIds ($field, $value, $table)
  {
$query = SELECT id FROM $table WHERE $field = '$value';
$object_ids = mysql_fetch_array();
return $object_ids;
  }
}

class Category extends ForumObject
{
  static private $table = 'categories';

  static function getObjectIds ($field, $value)
  {
parent::getObjectIds($field, $value, self::$table)
  }
}

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

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



Re: [PHP] IE can't download, FF can: SSL ? Need special headers?

2009-05-28 Thread Michael A. Peters

Dee Ayy wrote:

Andrea and Ashley,
Thanks ladies.

Originally, IE claimed that the server wasn't even there (with that
wacky IE error).  I was lacking headers (which was fine for 6 years
prior).

The code below is consistent across the 3 browsers I tried (Safari,
FF, IE).  However, it converts spaces to underscores.  I'm keeping
this code:
header('Content-Description: File Transfer');
header('Content-Type: '.$type);
header('Content-Disposition: attachment;
filename='.basename(str_replace(' ', '_', $name)));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: '.$size);
echo $data;

If I use
header('Content-Disposition: attachment; filename='.basename($name).'');
of the 3 browsers tested, only IE will replace spaces with
underscores.  Safari and FF pass through correctly.  But I'll go with
consistency and avoid the if browser-war clauses.

Thanks all.



This is what I'm doing:

header(Pragma: public);
header(Expires: 0);
header(Cache-Control: must-revalidate, post-check=0, pre-check=0);
header(Cache-Control: private,false);

header('Content-type: application/gpx+xml');

header(Content-Disposition: attachment; filename=\Records.gpx\);
header(Content-Transfer-Encoding: binary);

print $myxml-saveXML();

-=-
Looks very similar to yours, but I haven't tested in IE or Safari.
I got the headers to send from some php cookbook website.

Technically the mime type I'm sending in my case isn't valid (there is 
not an official gpx mime type), but it works and allows association with 
a helper application specific to gpx files.


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



Re: [PHP] Re: class problem :(

2009-05-28 Thread Luke
2009/5/29 Shawn McKenzie nos...@mckenzies.net

 Luke wrote:
  Right I've read the manual on this and all that so hopefully you find
 people
  can help.
  I have an abstract class with three children. The abstract is ForumObject
  and the three children are Thread, Category and Post and each have their
 own
  table so I wrote the following:
  abstract class ForumObject
  {
static private $table;
 
static function getObjectIds ($field, $value)
{
$query = SELECT id FROM {self::$table} WHERE $field = '$value';
$object_ids = mysql_fetch_array();
return $object_ids;
}
  }
 
  class Category extends ForumObject
  {
static private $table = categories;
  }
  That's just got the important bits for the sake of your eyes but
 basically
  the problem I'm having is calling
  Category::getObjectIds ($whatever, $whatever2);
  Seems to think that it's referring to ForumObject::$table rather than
  Category::$table?
  I looked into it and there seems to be something you can do with
  get_called_class() but unfortunately I'm stuck with 5.2.9 at the moment
 and
  that is new to 5.3.
  Any ideas? Perhaps there is a different way I could implement the classes
 -
  I would rather not have getObjectIds repeated three times!
  Thanks in advance,

 I didn't test this, just a thought.  You'd still have to implement
 getObjectIds(), but it would be slim:

 abstract class ForumObject
 {
  static private $table;

   static function getObjectIds ($field, $value, $class)
  {
$query = SELECT id FROM {$class::$table} WHERE $field = '$value';
 $object_ids = mysql_fetch_array();
return $object_ids;
  }
 }

 class Category extends ForumObject
 {
   static private $table = 'categories';

  static function getObjectIds ($field, $value)
  {
 parent::getObjectIds ($field, $value, __CLASS__)
  }
 }

 Or probably the same because you're defining $table anyway in the child
 class:

 abstract class ForumObject
 {
  static private $table;

   static function getObjectIds ($field, $value, $table)
  {
$query = SELECT id FROM $table WHERE $field = '$value';
 $object_ids = mysql_fetch_array();
return $object_ids;
  }
 }

 class Category extends ForumObject
 {
   static private $table = 'categories';

  static function getObjectIds ($field, $value)
  {
 parent::getObjectIds($field, $value, self::$table)
  }
 }

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

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


Ah that looks like the perfect solution! Trying now!
Many thanks!

-- 
Luke Slater
http://dinosaur-os.com/
:O)


[PHP] mail body not decoded by base64_decode

2009-05-28 Thread vuthecuong

Hi all
I'm using below function to send Japanese mail, mail clients such as outlook
etc displayed Japanese text withou problems but if I viewed JP mail via
web-based mail such as Gmail, the JP subject is normally displayed, however
the JP body still base64 encoded strings, it still was not decoded yet.
Could anyone tell me solution to solve this?
===
private static function _sendPc( $from, $to, $subject, $body, $contentType,
$charSet=shift_jis, $header=, $parameter=){
Debugger::snap();
//make header
$headers = From: $from\n;
$headers .= MIME-Version: 1.0\n;
$headers .= Content-type: $contentType; charset=ISO-2022-JP\n;
//$headers .= Content-type: $contentType; charset=SHIFT_JIS\n;
//$headers .= Content-Transfer-Encoding: base64;
$headers .= Content-Transfer-Encoding: quoted-printable;


// add header to mail
if( strlen( $header )  0 ){
$headers .= \n;
$headers .= $header;
}

//make parameter
$parameters = $parameter;

//make subject
$subject = '=?ISO-2022-JP?B?'.base64_encode(mb_convert_encoding($subject,
'ISO-2022-JP', 'AUTO' )).'?=';
//$subject = '=?SHIFT_JIS?B?'.base64_encode($subject).'?=';
//$body = base64_encode($body);
$body = mb_convert_encoding( $body, 'ISO-2022-JP', AUTO);

// a,b...@mail.com こんなEMAILアドレスがたまにあるための回避策
$pos1 = strpos($to, ,);
$pos2 = strpos($to,);
if( $pos1 !== FALSE  $pos2 === FALSE ){
$to =  . $to .;
}

if( $parameters != null  strlen( $parameters )  0 )
mail( $to, $subject, $body, $headers, $parameters );
else
mail( $to, $subject, $body, $headers,-f . $from );

Debugger::debug( sended );
return true;
}

Thanks and regards,
-- 
View this message in context: 
http://www.nabble.com/mail-body-not-decoded-by-base64_decode-tp23773646p23773646.html
Sent from the PHP - General mailing list archive at Nabble.com.


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



[PHP] cURL loop?

2009-05-28 Thread espontaneo

Hello! I am currently working on a script that will scrape data from a
property advertising web page. The web page has multiple pages. What I'm
getting is only the first page. What I wanted to do is to use curl to scrape
all the data from that page. I just learned php so I don't know how I can do
this.
-- 
View this message in context: 
http://www.nabble.com/cURL-loop--tp23773748p23773748.html
Sent from the PHP - General mailing list archive at Nabble.com.


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