[PHP] How to create RSS feeds with PHP?

2006-03-28 Thread Merlin

Hi there,

I am wondering if there are already tools out there which do
create RSS feeds on the fly with the help of PHP.

My goal would be to create RSS dynamicly out of a LAMP App. to
syndicate the results.

Are there any tools you know about?

Thank you in advance, Merlin

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



Re: [PHP] How to create RSS feeds with PHP?

2006-03-28 Thread chris smith
On 3/28/06, Merlin [EMAIL PROTECTED] wrote:
 Hi there,

 I am wondering if there are already tools out there which do
 create RSS feeds on the fly with the help of PHP.

 My goal would be to create RSS dynamicly out of a LAMP App. to
 syndicate the results.

 Are there any tools you know about?

This might get you started:

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

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

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



[PHP] Problem wih mail() and attachment

2006-03-28 Thread Dennis N.
Hello,

I have some trouble with sending emails with an MS word attachment. I let
fill a word document from my php website. When it is finished with filling
the information, the document is saved on the webserver and the word
application will be closed by the website. So far so good. Now I want to
send this created document to the user via the mail function. If I send an
email without the attachment it works great. So there is no error with the
SMTP server. But when I send this email with the attachment, the webserver
breaks down and I receive no email. I can't see the error in the code. So
perhaps someone can help me.

Here is the code:


$word-StatusBar = Fertig!; // Statusbar Ausgabe
$word-ActiveDocument-SaveAs(d:\wwwRoot\Lieferprogramm\ProductPortfolio.doc);
//$word-ActiveDocument-Save();
$word-Documents-Close();
$word-Quit();
$word = null;
$Empfaenger = [EMAIL PROTECTED];
$Betreff = Product Portfolio;
//$Dateiname = d:\\wwwRoot\\Lieferprogram\\ProductPortfolio.doc;
$Dateiname = ProductPortfolio.doc;
$DateinameMail = ProductPortfolio.doc;
$Header = From: [EMAIL PROTECTED] [EMAIL PROTECTED];
$Trenner = md5(uniqid(time()));
$Header .= \n;
$Header .= MIME-Version: 1.0;
$Header .= \n;
$Header .= Content-Type: multipart/mixed; boundary=\$Trenner\;
$Header .= \n\n;
$Header .= This is a multi-part message in MIME format;
$Header .= \n;
$Header .= --$Trenner;
$Header .= \n;
$Header .= Content-Type: text/plain; charset=\iso-8859-9\;
$Header .= \n;
$Header .= Content-Transfer-Encoding: 8bit;
$Header .= \n\n;
$Header .= Product Portfolio;
$Header .= \n;
$Header .= --$Trenner;
$Header .= \n;
$Header .= Content-Type: application/msword; name=\$DateinameMail\;
$Header .= \n;
$Header .= Content-Transfer-Encoding: base64;
$Header .= \n;
$Header .= Content-Disposition: attachment; filename=\$DateinameMail\;
$Header .= \n\n;
$Dateiinhalt = fread(fopen($Dateiname, r), filesize($Dateiname));
$Header .= chunk_split(base64_encode($Dateiinhalt));
$Header .= \n;
$Header .= --$Trenner--;
mail($Empfaenger, $Betreff, , $Header);




Thanks in advance.

Dennis

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



[PHP] Re: How to ping a webserver with php?

2006-03-28 Thread Merlin

Barry schrieb:

Merlin wrote:

Hi there,

I do have a webserver (that also runns php 4.x) running which I would 
like to ping from an intranet server. In case that the webserver is 
down and therefore my webapp the php script which does the ping should 
send an e-mail which results in a message on my mobile.


Are there any commands for PHP which you can recommend for doing that?

The plan was to write a php file which does the ping and e-mail thing 
and execute it via cron every few minutes.


Can somebody give me a hint on the commands I could use for the ping?

Thanx, merlin

http://pear.php.net/manual/de/html/package.networking.net-ping.ping.html

Greets
Barry


Hi,

that looks exactly like what I am looking for. Now there is just on problem:
I can't get pear running :-(

phpinfo tells me that I have compiled with pear:
Version 4.3.11 '--with-PEAR'
But there is no further entry inside teh output of phpinfo on pear.

What do you recommend? Do I have to install pear by hand, or would it help to 
install the newest 4.x tree of php which hopefully comes with pear?


Thanx,

Merlin

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



[PHP] why is this newsroup server so slow?

2006-03-28 Thread Merlin

Hi there,

I used to be more often on news.php.net in former times. But now the server is
so incredibly slow?! I do get very often time outs and it takes ages to load the 
threads. Is there a possible misconfiguration of my newsreader, or is the server 
that slow?


Thank you for your help,

Merlin

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



Re: [PHP] How to create RSS feeds with PHP?

2006-03-28 Thread Merlin

chris smith schrieb:

On 3/28/06, Merlin [EMAIL PROTECTED] wrote:

Hi there,

I am wondering if there are already tools out there which do
create RSS feeds on the fly with the help of PHP.

My goal would be to create RSS dynamicly out of a LAMP App. to
syndicate the results.

Are there any tools you know about?


This might get you started:

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

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

Thank you! That works great. Do you know about a class which does
the other way around? I mean there are a couple of webservices out there
which you can use to generate the JavaScript code on the fly via their php 
script. But that relies on an external website which is not my intention.

My goal would be to have a PHP script which provides the possibility to create
a JS file to parse the XML stream.
So basicly to provide the people who would like to integrate my RSS feeds with a 
few lines of copy and paste JavaScript code to include into their blogs.


Is this possible?

Thank you for any hint,

Merlin

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



[PHP] Re: How to ping a webserver with php?

2006-03-28 Thread Barry

Merlin wrote:

Hi,

that looks exactly like what I am looking for. Now there is just on 
problem:

I can't get pear running :-(

phpinfo tells me that I have compiled with pear:
Version 4.3.11 '--with-PEAR'
But there is no further entry inside teh output of phpinfo on pear.

What do you recommend? Do I have to install pear by hand, or would it 
help to install the newest 4.x tree of php which hopefully comes with pear?


I am not quite sure if it is in 4.x but 5.x has it in.

Probably PEAR isn't working because PEAR is complied but missing the 
packages?


Sorry i am not so very firm with PEAR.

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] Re: why is this newsroup server so slow?

2006-03-28 Thread Barry

Merlin wrote:

Hi there,

I used to be more often on news.php.net in former times. But now the 
server is
so incredibly slow?! I do get very often time outs and it takes ages to 
load the threads. Is there a possible misconfiguration of my newsreader, 
or is the server that slow?


Thank you for your help,

Merlin

More people probably?

Well my Thunderbird works fine so far. Just a few times a day i get 
timeouts.


--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] object oriented syntax in php

2006-03-28 Thread Merlin

Hi there,

I do have problems with object oriented syntax as this is not familar to me.
There is following output:


object(net_ping_result)(11) { [_icmp_sequence]=  array(1) { [61.117):]= 
string(1) 7 } [_target_ip]=  string(9) y2.php.ne [_bytes_per_request]= 
 string(2) 64 [_bytes_total]=  int(192) [_ttl]=  string(6) _seq=2 
[_raw_data]=  array(7) { [0]=  string(72) PING php.net (66.163.161.117) 
from 192.168.1.114 : 56(84) bytes of data. [1]=  string(72) 64 bytes from 
y2.php.net (66.163.161.117): icmp_seq=1 ttl=47 time=211 ms [2]=  string(72) 
64 bytes from y2.php.net (66.163.161.117): icmp_seq=2 ttl=47 time=206 ms [3]= 
 string(0)  [4]=  string(31) --- php.net ping statistics --- [5]= 
string(55) 2 packets transmitted, 2 received, 0% loss, time 1008ms [6]= 
string(55) rtt min/avg/max/mdev = 206.299/209.139/211.979/2.840 ms } 
[_sysname]=  string(5) linux [_round_trip]=  array(3) { [min]= 
string(7) 209.139 [avg]=  string(7) 211.979 [max]=  string(5) 2.840 
} [_transmitted]=  string(1) 2 [_received]=  string(1) 2 [_loss]= 
int(0) }



Now I would like to retrieve my needed info out of it. How do I do this? (sounds 
a bit silly this question, sorry :-)


I tried:
$ping_result = $ping-ping('php.net');
echo $ping_result[net_ping_result][_raw_data][5];

But this and other tries did not work. My goal is to find out wheter a specified 
site is reachable.


Can anybody give me a hint on this one?

Thank you in advance,

Merlin

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



[PHP] Re: object oriented syntax in php

2006-03-28 Thread Barry

Merlin wrote:

Hi there,

I do have problems with object oriented syntax as this is not familar to 
me.

There is following output:


object(net_ping_result)(11) { [_icmp_sequence]=  array(1) { 
[61.117):]= string(1) 7 } [_target_ip]=  string(9) y2.php.ne 
[_bytes_per_request]=  string(2) 64 [_bytes_total]=  int(192) 
[_ttl]=  string(6) _seq=2 [_raw_data]=  array(7) { [0]=  
string(72) PING php.net (66.163.161.117) from 192.168.1.114 : 56(84) 
bytes of data. [1]=  string(72) 64 bytes from y2.php.net 
(66.163.161.117): icmp_seq=1 ttl=47 time=211 ms [2]=  string(72) 64 
bytes from y2.php.net (66.163.161.117): icmp_seq=2 ttl=47 time=206 ms 
[3]=  string(0)  [4]=  string(31) --- php.net ping statistics --- 
[5]= string(55) 2 packets transmitted, 2 received, 0% loss, time 
1008ms [6]= string(55) rtt min/avg/max/mdev = 
206.299/209.139/211.979/2.840 ms } [_sysname]=  string(5) linux 
[_round_trip]=  array(3) { [min]= string(7) 209.139 [avg]=  
string(7) 211.979 [max]=  string(5) 2.840 } [_transmitted]=  
string(1) 2 [_received]=  string(1) 2 [_loss]= int(0) }


This Block is kinda hard to read. Would you mind to post something more 
formatted?


Thanks!

print_r($net_ping_result);

or something like that.

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] object oriented syntax in php

2006-03-28 Thread Thomas Munz
echo $ping_result[_raw_data][5];

 Hi there,

 I do have problems with object oriented syntax as this is not familar to
 me. There is following output:


 object(net_ping_result)(11) { [_icmp_sequence]=  array(1) {
 [61.117):]= string(1) 7 } [_target_ip]=  string(9) y2.php.ne
 [_bytes_per_request]= string(2) 64 [_bytes_total]=  int(192)
 [_ttl]=  string(6) _seq=2 [_raw_data]=  array(7) { [0]= 
 string(72) PING php.net (66.163.161.117) from 192.168.1.114 : 56(84) bytes
 of data. [1]=  string(72) 64 bytes from y2.php.net (66.163.161.117):
 icmp_seq=1 ttl=47 time=211 ms [2]=  string(72) 64 bytes from y2.php.net
 (66.163.161.117): icmp_seq=2 ttl=47 time=206 ms [3]= string(0)  [4]= 
 string(31) --- php.net ping statistics --- [5]= string(55) 2 packets
 transmitted, 2 received, 0% loss, time 1008ms [6]= string(55) rtt
 min/avg/max/mdev = 206.299/209.139/211.979/2.840 ms } [_sysname]= 
 string(5) linux [_round_trip]=  array(3) { [min]= string(7)
 209.139 [avg]=  string(7) 211.979 [max]=  string(5) 2.840 }
 [_transmitted]=  string(1) 2 [_received]=  string(1) 2
 [_loss]= int(0) }


 Now I would like to retrieve my needed info out of it. How do I do this?
 (sounds a bit silly this question, sorry :-)

 I tried:
 $ping_result = $ping-ping('php.net');
 echo $ping_result[net_ping_result][_raw_data][5];

 But this and other tries did not work. My goal is to find out wheter a
 specified site is reachable.

 Can anybody give me a hint on this one?

 Thank you in advance,

 Merlin

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



Re: [PHP] Re: object oriented syntax in php

2006-03-28 Thread Petar Nedyalkov
On Tuesday 28 March 2006 12:54, Barry wrote:
 Merlin wrote:
  Hi there,
 
  I do have problems with object oriented syntax as this is not familar to
  me.
  There is following output:
 
 
  object(net_ping_result)(11) { [_icmp_sequence]=  array(1) {
  [61.117):]= string(1) 7 } [_target_ip]=  string(9) y2.php.ne
  [_bytes_per_request]=  string(2) 64 [_bytes_total]=  int(192)
  [_ttl]=  string(6) _seq=2 [_raw_data]=  array(7) { [0]=
  string(72) PING php.net (66.163.161.117) from 192.168.1.114 : 56(84)
  bytes of data. [1]=  string(72) 64 bytes from y2.php.net
  (66.163.161.117): icmp_seq=1 ttl=47 time=211 ms [2]=  string(72) 64
  bytes from y2.php.net (66.163.161.117): icmp_seq=2 ttl=47 time=206 ms
  [3]=  string(0)  [4]=  string(31) --- php.net ping statistics ---
  [5]= string(55) 2 packets transmitted, 2 received, 0% loss, time
  1008ms [6]= string(55) rtt min/avg/max/mdev =
  206.299/209.139/211.979/2.840 ms } [_sysname]=  string(5) linux
  [_round_trip]=  array(3) { [min]= string(7) 209.139 [avg]=
  string(7) 211.979 [max]=  string(5) 2.840 } [_transmitted]=
  string(1) 2 [_received]=  string(1) 2 [_loss]= int(0) }

 This Block is kinda hard to read. Would you mind to post something more
 formatted?

This is a result of print_r();

It would be better to have the class definition...


 Thanks!

 print_r($net_ping_result);

 or something like that.

 --
 Smileys rule (cX.x)C --o(^_^o)
 Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgphhOZlXEgSu.pgp
Description: PGP signature


Re: [PHP] Re: object oriented syntax in php

2006-03-28 Thread Barry

Petar Nedyalkov wrote:

This is a result of print_r();

It would be better to have the class definition...


No it's var_dump() and without linebreaks and so _

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] object oriented syntax in php

2006-03-28 Thread Stut

Merlin wrote:
snipped unformatted

Now I would like to retrieve my needed info out of it. How do I do 
this? (sounds a bit silly this question, sorry :-)


I tried:
$ping_result = $ping-ping('php.net');
echo $ping_result[net_ping_result][_raw_data][5];

But this and other tries did not work. My goal is to find out wheter a 
specified site is reachable.



Next time you want to post data like that please copy and paste the 
source not the browser output...


object(net_ping_result)(11)
{
   [_icmp_sequence]=array(1)
   {
   [61.117):]= string(1) 7
   }
   [_target_ip]=  string(9) y2.php.ne
   [_bytes_per_request]=  string(2) 64
   [_bytes_total]=  int(192)
   [_ttl]=  string(6) _seq=2
   [_raw_data]=array(7)
  {
  [0]=  string(72) PING php.net (66.163.161.117) 
from 192.168.1.114 : 56(84) bytes of data.
  [1]=  string(72) 64 bytes from y2.php.net 
(66.163.161.117): icmp_seq=1 ttl=47 time=211 ms
  [2]=  string(72) 64 bytes from y2.php.net 
(66.163.161.117): icmp_seq=2 ttl=47 time=206 ms

  [3]=  string(0) 
  [4]=  string(31) --- php.net ping statistics ---
  [5]= string(55) 2 packets transmitted, 2 
received, 0% loss, time 1008ms
  [6]= string(55) rtt min/avg/max/mdev = 
206.299/209.139/211.979/2.840 ms

  }
   [_sysname]=  string(5) linux
   [_round_trip]=array(3)
{
   [min]= string(7) 209.139
   [avg]=  string(7) 211.979
   [max]=  string(5) 2.840
}
   [_transmitted]=  string(1) 2
   [_received]=  string(1) 2
   [_loss]= int(0)
}

This is the output of a call to var_dump. What you probably want is 
$ping_result['_raw_data'][5]. However, since the class has nicely 
extracted the details you may be better off using the _transmitted, 
_received and _loss members.


I'm not familiar with the class in question, but given the names of the 
member variables I would expect there are accessor methods that you 
should be using instead of pulling the data out manually.


-Stut

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



[PHP] call a php script in a php script

2006-03-28 Thread nicolas figaro

Hi,

I'd like to run a php script in another php script. (the first is 
lauched from the command line).


Is there a way to do it better than
system (/path/to/php script_included.php options).
?

the goal is to run several scripts with several options.

the result of the included script should be a returning code with a 
message. (but it hasn't been fixed yet).


Thanks a lot.

Nicolas Figaro

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



[PHP] Re: call a php script in a php script

2006-03-28 Thread Merlin

nicolas figaro schrieb:

Hi,

I'd like to run a php script in another php script. (the first is 
lauched from the command line).


Is there a way to do it better than
system (/path/to/php script_included.php options).
?

the goal is to run several scripts with several options.

the result of the included script should be a returning code with a 
message. (but it hasn't been fixed yet).


Thanks a lot.

Nicolas Figaro

Hi Nocolas,

try : include(); or require();

regards, merlin

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



Re: [PHP] call a php script in a php script

2006-03-28 Thread Thomas Munz
I personaly use proc_open() to run PHP Scripts.

on Tuesday 28 March 2006 12:14, nicolas figaro wrote:
 Hi,

 I'd like to run a php script in another php script. (the first is
 lauched from the command line).

 Is there a way to do it better than
 system (/path/to/php script_included.php options).
 ?

 the goal is to run several scripts with several options.

 the result of the included script should be a returning code with a
 message. (but it hasn't been fixed yet).

 Thanks a lot.

 Nicolas Figaro

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



Re: [PHP] object oriented syntax in php

2006-03-28 Thread Sameer N Ingole

Merlin wrote:

Hi there,

I do have problems with object oriented syntax as this is not familar 
to me.

There is following output:
[snip]
Now I would like to retrieve my needed info out of it. How do I do 
this? (sounds a bit silly this question, sorry :-)


I tried:
$ping_result = $ping-ping('php.net');
echo $ping_result[net_ping_result][_raw_data][5];

But this and other tries did not work. My goal is to find out wheter a 
specified site is reachable.

Why not use something like this
---code start---
if($ping-checkhost(php.net))
   echo I'm up;
else
   ding!!;
---code end---
if you are using PEAR



--
Sameer N. Ingole
Blog: http://weblogic.noroot.org/
---
Better to light one candle than to curse the darkness.

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



Re: [PHP] object oriented syntax in php

2006-03-28 Thread Robin Vickery
On 28/03/06, Merlin [EMAIL PROTECTED] wrote:
 Hi there,

 I do have problems with object oriented syntax as this is not familar to me.
 There is following output:



 Now I would like to retrieve my needed info out of it. How do I do this? 
 (sounds
 a bit silly this question, sorry :-)

 I tried:
 $ping_result = $ping-ping('php.net');
 echo $ping_result[net_ping_result][_raw_data][5];

You'd be much better using the interface to Net_Ping_Result that's
provided. Then your code won't break if someone decides to rearrange
the internals of the class.

$ping_result-getMin();
$ping_result-getMax();
$ping_result-getAvg();
$ping_result -getTransmitted();
$ping_result-getReceived();
$ping_result-getLoss();
...


 -robin

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



Re: [PHP] Problem wih mail() and attachment

2006-03-28 Thread chris smith
On 3/27/06, Dennis N. [EMAIL PROTECTED] wrote:
 Hello,

 I have some trouble with sending emails with an MS word attachment. I let
 fill a word document from my php website. When it is finished with filling
 the information, the document is saved on the webserver and the word
 application will be closed by the website. So far so good. Now I want to
 send this created document to the user via the mail function. If I send an
 email without the attachment it works great. So there is no error with the
 SMTP server. But when I send this email with the attachment, the webserver
 breaks down and I receive no email. I can't see the error in the code. So
 perhaps someone can help me.

 Here is the code:

 
 $word-StatusBar = Fertig!; // Statusbar Ausgabe
 $word-ActiveDocument-SaveAs(d:\wwwRoot\Lieferprogramm\ProductPortfolio.doc);
 //$word-ActiveDocument-Save();
 $word-Documents-Close();
 $word-Quit();
 $word = null;
 $Empfaenger = [EMAIL PROTECTED];
 $Betreff = Product Portfolio;
 //$Dateiname = d:\\wwwRoot\\Lieferprogram\\ProductPortfolio.doc;
 $Dateiname = ProductPortfolio.doc;
 $DateinameMail = ProductPortfolio.doc;
 $Header = From: [EMAIL PROTECTED] [EMAIL PROTECTED];
 $Trenner = md5(uniqid(time()));
 $Header .= \n;
 $Header .= MIME-Version: 1.0;
 $Header .= \n;
 $Header .= Content-Type: multipart/mixed; boundary=\$Trenner\;
 $Header .= \n\n;
 $Header .= This is a multi-part message in MIME format;
 $Header .= \n;
 $Header .= --$Trenner;
 $Header .= \n;
 $Header .= Content-Type: text/plain; charset=\iso-8859-9\;
 $Header .= \n;
 $Header .= Content-Transfer-Encoding: 8bit;
 $Header .= \n\n;
 $Header .= Product Portfolio;
 $Header .= \n;
 $Header .= --$Trenner;
 $Header .= \n;
 $Header .= Content-Type: application/msword; name=\$DateinameMail\;
 $Header .= \n;
 $Header .= Content-Transfer-Encoding: base64;
 $Header .= \n;
 $Header .= Content-Disposition: attachment; filename=\$DateinameMail\;
 $Header .= \n\n;
 $Dateiinhalt = fread(fopen($Dateiname, r), filesize($Dateiname));
 $Header .= chunk_split(base64_encode($Dateiinhalt));

The file doesn't go in the header, it goes in the body.

Can I ask why you're not using something like phpmailer
(http://phpmailer.sf.net) ?

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

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



Re: [PHP] How to create RSS feeds with PHP?

2006-03-28 Thread chris smith
On 3/28/06, Merlin [EMAIL PROTECTED] wrote:
 chris smith schrieb:
  On 3/28/06, Merlin [EMAIL PROTECTED] wrote:
  Hi there,
 
  I am wondering if there are already tools out there which do
  create RSS feeds on the fly with the help of PHP.
 
  My goal would be to create RSS dynamicly out of a LAMP App. to
  syndicate the results.
 
  Are there any tools you know about?
 
  This might get you started:
 
  http://www.phpclasses.org/browse/package/2957.html
 
  --
  Postgresql  php tutorials
  http://www.designmagick.com/
 Thank you! That works great. Do you know about a class which does
 the other way around? I mean there are a couple of webservices out there
 which you can use to generate the JavaScript code on the fly via their php
 script. But that relies on an external website which is not my intention.
 My goal would be to have a PHP script which provides the possibility to create
 a JS file to parse the XML stream.
 So basicly to provide the people who would like to integrate my RSS feeds 
 with a
 few lines of copy and paste JavaScript code to include into their blogs.

This is how ajax works.. so yes it is possible.

Check out:
http://developer.apple.com/internet/webcontent/xmlhttpreq.html
http://www.xml.com/pub/a/2005/02/09/xml-http-request.html
http://jibbering.com/2002/4/httprequest.html

It's hard to give a specific example because some of it depends on the
clients website and how it works (whether it's tables, divs etc)...

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

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



[PHP] Templates and partial rendering?

2006-03-28 Thread Sunstorm

Hello,

I'm trying to find a graceful solution for a problem I ran into while  
trying to set up a templating system.


The problem is as such: Every traditional templating solution implies that  
the template is assembled in a string with all the required data before  
being sent to the browser. This for me is a Bad Thing (tm), because some  
of my data is pulled off an XML webservice, which sometimes isn't too  
quick about answering, and having the user stare at a blank page during  
that time is just not viable. (Calls to the webservice are obviously  
cached to as much of an extent as possible, so that's not the problem).


So, what I need is a way to be able to render chunks of the page as they  
come in, as opposed to all at the same time, but still retain the ability  
to reuse the same HTML in multiple pages. As far as I've seen so far, the  
only way I can do this is to make functions with static HTML and calling  
them from each page as I need them. But this isn't very mantainable, I'd  
much rather use a template system that I can easily alter, much like in a  
traditional template system.


As far as I know, and please correct me if I'm wrong, none of the OOB  
template systems out there support this kind of behavior. Does anyone have  
any ideas about how one might implement it (in PHP4, preferably)?


My best thought right now involves passing lists of function callbacks  
into a template class, and having it run them as it needs them, but this  
seems to be a somewhat messy approach. Any insight is appreciated.


Best,

- Alex Sunstorm

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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



[PHP] imagecreatefromjpeg() uses too much memory

2006-03-28 Thread Fredrik Enestad
Hi!

I'm making a function for uploading and resizing images to my web hotel.
Problem is, memory_limit is set to 16M so when uploading larger images the
script crashes.

So, I tried to override the memory_limit setting, but as it turns out, my
web host has set some safe mode setting,
so that no settings can be changed in the php.ini, and they wont change the
setting to a higher value themselves.

This is were the code crashes:

$image_p = imagecreatetruecolor($widthNew, $heightNew);
if($mime==image/jpeg || $mime==image/pjpeg) {
  $image = imagecreatefromjpeg($imgarray[tmp_name]);
  imagecopyresampled($image_p, $image, 0, 0, 0, 0, $widthNew, $heightNew,
$widthOrg, $heightOrg);
  imagejpeg($image_p, $save_dir.$temp_filename, 80);
  return Done;
}

The line $image = imagecreatefromjpeg($imgarray[tmp_name]); causes the
problem.

Do any of you know any other way to solve this problem?

--
Thanks
Fredrik


Re: [PHP] imagecreatefromjpeg() uses too much memory

2006-03-28 Thread Richard Davey

On 28 Mar 2006, at 14:21, Fredrik Enestad wrote:

I'm making a function for uploading and resizing images to my web  
hotel.
Problem is, memory_limit is set to 16M so when uploading larger  
images the

script crashes.

So, I tried to override the memory_limit setting, but as it turns  
out, my

web host has set some safe mode setting,
so that no settings can be changed in the php.ini, and they wont  
change the

setting to a higher value themselves.

Do any of you know any other way to solve this problem?


What size images are you uploading? (as in what dimensions, and file  
size)


Do you have access to something like ImageMagik on the server?

Cheers,

Rich
--
http://www.corephp.co.uk
Zend Certified Engineer
PHP Development Services

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



Re: [PHP] imagecreatefromjpeg() uses too much memory

2006-03-28 Thread Fredrik Enestad
The image I'm trying is 2848x2144 @ 2,13MB so its pretty big..

An other user in this mail-group asked me if ImageMagick existed on the
server,
but I'm pretty new to all this, and I don't actually know how to check if it
does?

Thanks for taking the time
Fredrik


2006/3/28, Richard Davey [EMAIL PROTECTED]:

 On 28 Mar 2006, at 14:21, Fredrik Enestad wrote:

  I'm making a function for uploading and resizing images to my web
  hotel.
  Problem is, memory_limit is set to 16M so when uploading larger
  images the
  script crashes.
 
  So, I tried to override the memory_limit setting, but as it turns
  out, my
  web host has set some safe mode setting,
  so that no settings can be changed in the php.ini, and they wont
  change the
  setting to a higher value themselves.
 
  Do any of you know any other way to solve this problem?

 What size images are you uploading? (as in what dimensions, and file
 size)

 Do you have access to something like ImageMagik on the server?

 Cheers,

 Rich
 --
 http://www.corephp.co.uk
 Zend Certified Engineer
 PHP Development Services

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




--
Mvh
Fredrik Enestad


[PHP] Re: Strip Tags and Content

2006-03-28 Thread Sunstorm

Hi,

You can use fgetss() or strip_tags() to take the tags off and  
html_entity_decode() to transform the HTML entities.


I don't understand what you mean by putting it into paragraphs. Are you  
talking about rewriting the HTML, or something else?


- Alex Sunstorm

On Tue, 28 Mar 2006 15:08:31 +0100, Ministério Público  
[EMAIL PROTECTED] wrote:


Hi guys I`m trying to retrieve a html page from an url, wich I already  
done

with the following script:

*

$document* *=* implode*('',* file*('http://www.mysite.net/'));*

**

*Then I need to extract the html tags from it wich I did with the  
following

script:*
*

$search = array ('@script[^]*?.*?/script@si', // Strip out  
javascript

'@[\/\!]*?[^]*?@si', // Strip out HTML tags
'@([\r\n])[\s]+@', // Strip out white space
'@(quot|#34);@i', // Replace HTML entities
'@(amp|#38);@i',
'@(lt|#60);@i',
'@(gt|#62);@i',
'@(nbsp|#160);@i',
'@(iexcl|#161);@i',
'@(cent|#162);@i',
'@(pound|#163);@i',
'@(copy|#169);@i',
'@#(\d+);@e'); // evaluate as php

$replace = array ('',
'',
'\1',
'',
'',
'',
'',
' ',
chr(161),
chr(162),
chr(163),
chr(169),
'chr(\1)');

$text = preg_replace($search, $replace, $document);



My Problem is that I still get a mumbled text wich I'd like to put a
paragraph after every attribute, like after title should be a paragrah,
after the first block of text should be another, and so on. Also the
attributes for the html tags as still showing so I'd also like to remove
these from the results. Thanks for any idea.

Rodrigo
*




--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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



[PHP] Dependent selections

2006-03-28 Thread Raúl Castro Marín
Hello, I'm trying to find the best way to implement Dependent selections -for 
instance, like countries and states tables-. I found this nice example 
http://www.ashleyit.com/rs/jsrs/select/php/select.php. But this method require 
to go to other page to refresh vars php. I would like have a method (I think 
with Javascript) that don't need to go to other page as possible. 
I hope you help me,  regards!

RE: [PHP] where php at?

2006-03-28 Thread Ryan A
 Ooops, and lets not forget this one:
 
 curl http://www.yoursite.com/path/to/script/yourscript.php


 Thanks Ryan, but that failed to work as well.

 tedd
 --

Sorry to hear that, you might ask them to install CURL on your system along
with PEAR if you dont already have them, both are very very useful even if
you dont need them right now. Not to be a jackass and repeat what others
have said but you might also want to look into other hosts who are a bit
more helpful and effecient than your current host sounds. If you need a
recommendation for a good host, post another thread and I'm sure you will
get many good leads, some actually have hosting companies...

I hope you solve your problem quick, one way or another, I know how
frustrating it can be to have something simple not work for days, i'm
quite sure someone will find the solution you need on the list as they are
quite a few (famous? :-p ) gurus who have helped me (and others) tons of
times.

Best of luck!

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



RE: [PHP] where php at?

2006-03-28 Thread Jay Blanchard
[snip]
Sorry to hear that, you might ask them to install CURL on your system
along
with PEAR if you dont already have them, both are very very useful even
if
you dont need them right now. Not to be a jackass and repeat what others
have said but you might also want to look into other hosts who are a bit
more helpful and effecient than your current host sounds. If you need a
recommendation for a good host, post another thread and I'm sure you
will
get many good leads, some actually have hosting companies...

I hope you solve your problem quick, one way or another, I know how
frustrating it can be to have something simple not work for days, i'm
quite sure someone will find the solution you need on the list as they
are
quite a few (famous? :-p ) gurus who have helped me (and others) tons of
times.
[/snip]

Tedd,

I know that you have searched Google for cPanel cron jobs and that lot's
of folks here have tried to help.

Where are you on this and can we help?

Jay

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



Re: [PHP] Dependent selections

2006-03-28 Thread Justin Cook
Look into AJAX. I just implemented a project on our intranet doing the exact 
same thing. Go to w3chools for a quick run down and then check out Prototype. 
Sitepoint has a good article on AJAX with Prototype.
  _  

From: Raúl Castro Marín [mailto:[EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Tue, 28 Mar 2006 09:16:16 -0600
Subject: [PHP] Dependent selections

Hello, I'm trying to find the best way to implement Dependent selections -for 
instance, like countries and states tables-. I found this nice example 
http://www.ashleyit.com/rs/jsrs/select/php/select.php. But this method require 
to go to other page to refresh vars php. I would like have a method (I think 
with Javascript) that don't need to go to other page as possible. 
I hope you help me,  regards!
  

[PHP] PDO, Persistent Connections

2006-03-28 Thread Jarratt Ingram
Hi,

I have a little unusual question, we are currently looking into the new PDO
extension with PHP5.1. We are currently use Mysql, InnoDB and transactions.

What we would like to know if we use the PDO extension and persistent
connections, can we start a Transaction on one page and then commit it from
another separate page by carrying the PDO object through a php session? Thus
preventing php from automatically closing that specific DB connection.  The
reason for this we use remote connections to the Database.

Any thoughts or comments if i have missed the boat completely

Regards
Jarratt


RE: [PHP] PHP|FLASH hit counter

2006-03-28 Thread Tom Haschenburger
Sorry chris meant that for the list.

Thanks chris, got it to work. I think it was caching a previous swf.
After trying it later. It worked.

T


 
 Tom Haschenburger wrote:
  Got this from a tutorial and I am not able to get this to work.
 
  Even when I download the finished files from the site I can't get it
to
  work. It definitely does its job on bringing in the variable but, it
  never increments any higher from zero. It seems as though I maybe
have a
  problem with reading/writing files. Would someone mind taking a look
and
  see if this looks correct?
 
  Using PHP 4.4.2
 
  //FLASH
  //instance of dynamic text box on stage with variable name count
  //Frame1
  this.loadVariables(counter.php?num=+random(99));
 
  //Frame2
  this.loadVariables(count.txt?num=+random(999));
 
  //frame40
  gotoAndPlay(2);
 
 
  //PHP
  ?php
  $count = file_get_contents(count.txt);
  $count = explode(=, $count);
  $count[1] = $count[1]+1;
 
 echo or error_log $count[1] here - is it what you expect?
 
 --
 Postgresql  php tutorials
 http://www.designmagick.com/

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



Re: [PHP] PDO, Persistent Connections

2006-03-28 Thread Jochem Maas

Jarratt Ingram wrote:

Hi,

I have a little unusual question, we are currently looking into the new PDO
extension with PHP5.1. We are currently use Mysql, InnoDB and transactions.

What we would like to know if we use the PDO extension and persistent
connections, can we start a Transaction on one page and then commit it from
another separate page by carrying the PDO object through a php session? Thus
preventing php from automatically closing that specific DB connection.  The
reason for this we use remote connections to the Database.

Any thoughts or comments if i have missed the boat completely


not quite but in practice what you want is not possible.
in order to continue that transaction on 'page 2' you browser will
need to connect to the same thread/process as the connection of request
of 'page 1' - not impossible but it's _very_ hit and miss (not something you
want to build upon).

oh and php resource datatypes (e.g. a DB connection) cannot be serialized.

in short you don't want to to do what you think you want to do :-) instead
stuff the data in the session until you have it all and only then start and 
finish
the transaction in a single request.




Regards
Jarratt



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



Re: [PHP] protecting passwords when SSL is not available

2006-03-28 Thread Evan Priestley

This looks good, as far as I can tell. Good luck with implementation.

Evan

On Mar 28, 2006, at 2:51 AM, Satyam wrote:


You are absolutely right!  I love this list!

I didn't realize that I was sending the session_id. Let's see if  
this works.


On first serving the login page I create a session and also a  
unique_id via uniqid().   I store the unique_id in the session and  
send it as a challenge to the client along the login form.  This  
unique_id is the nonce. Upon receiving the login data and checking  
it for good, I delete the unique_id from the session.  If I receive  
a made up session_id, the password data won't match the unique_id  
stored in the session (probably there will be none).  The nonce  
stored in the session will be a new one, even for the same session,  
each time the login screen is requested.  If the login fails, upon  
retry a new unique_id will be generated and sent for the retry.   
Thus, session_ids and unique_ids combinations (almost) never get  
repeated.  Thus, is you knew the answer to one, it won't help you  
with any other because even if you can make up a session_id, you  
cannot change the unique_id the server made and, since unique_ids  
don't repeat, there is no chance that you have ever sniffed the  
password hashed with that unique_id.



Satyam


- Original Message - From: Evan Priestley [EMAIL PROTECTED]
To: Satyam [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Monday, March 27, 2006 11:58 PM
Subject: Re: [PHP] protecting passwords when SSL is not available


The client cannot and does not send the session_id() used to  
hash  the password back to the server, it does not need to, the  
client  got it from the server.


It does send the session ID back though, because that's how the  
user maintains their session across requests.


For simplicity, let the totally made up word noncehash represent  
hash(hash(password)+nonce) -- that is, the hash of 'the nonce   
appended to the hash of the password'.


Generally, if the client ONLY sends (a) a user name and (b) a   
noncehash, then the server has no way to tell which nonce was   
originally issued. Therefor, the client has to send (a) a user  
name,  (b) a noncehash, and (c) some key which can identify which  
nonce was  sent. This key might be the session ID, the nonce  
itself, or  something else[1].


If the key is the nonce itself and the only server-side validation  
is that the response noncehash is correct for the supplied nonce,   
attacker Bob can observe ANY valid nonce/noncehash combination  
Alice  submits and replay it to gain access[2].


If the key is the session ID, and the only server-side validation  
is still that the response noncehash is correct for the given  
session  ID, attacker Bob can STILL observe ANY valid session ID /  
noncehash combination Alice submits (she _is_ submitting the  
session ID -- the nonce, here -- because every request always  
includes the session ID  when sessions are being used) and replay  
it immediately to gain  access. This is session hijacking, and  
it works because PHP will  let Bob into Alice's session as long as  
he knows her session ID[3].


Instead, suppose the server-side validation is a little stronger:  
it checks that the response noncehash is correct for the given  
session  ID, but ALSO checks to make sure that this session ID  
hasn't logged  in yet. Now Bob can't replay the response  
immediately. He can still  just hijack the logged-in session,  
though, and he might be able to  replay the attack after Alice's  
session has expired, because the flag  that says this session has  
already logged in will also have  expired. I'm not sure if PHP  
will create an expired session ID for  you; presumably it won't,  
but if you're writing your own session  handler or implementing  
nonced password transmission in some other  programming language,  
this might be a viable attack vector.


Evan

[1] It could even be the username, if the login process went like   
this: client sends server username, server generates a nonce and   
stores it in the user table, server sends generated nonce to  
client,  client sends hash(hash(password)+nonce) to server -- but  
then an  attacker can perform a DOS attack by repeatedly sending  
the server a  username so that it regenerates nonces more quickly  
than the real  user can log in. In any case, (a), (b) and (c) do  
not necessarily  need to be three separate pieces of information,  
since one piece of  information can serve multiple roles.
[2] Unless nonces are stored in a database and flagged as used  
afterward. You can also, e.g., generate nonces in the form  
timestamp,hash(timestamp+secret); google for more on this.
[3] Unless you're e.g. restricting sessions by IP, but this is  
potentially a whole different can of worms.





It is the server that challenges the client with a session_id()  
(or  any other random) sent clear and the client has to take the   
challenge and combine it with 

Re: [PHP] PDO, Persistent Connections

2006-03-28 Thread Philip Thompson

On Mar 28, 2006, at 10:23 AM, Jochem Maas wrote:


Jarratt Ingram wrote:

Hi,
I have a little unusual question, we are currently looking into  
the new PDO
extension with PHP5.1. We are currently use Mysql, InnoDB and  
transactions.

What we would like to know if we use the PDO extension and persistent
connections, can we start a Transaction on one page and then  
commit it from
another separate page by carrying the PDO object through a php  
session? Thus
preventing php from automatically closing that specific DB  
connection.  The

reason for this we use remote connections to the Database.
Any thoughts or comments if i have missed the boat completely


not quite but in practice what you want is not possible.
in order to continue that transaction on 'page 2' you browser will
need to connect to the same thread/process as the connection of  
request
of 'page 1' - not impossible but it's _very_ hit and miss (not  
something you

want to build upon).

oh and php resource datatypes (e.g. a DB connection) cannot be  
serialized.


in short you don't want to to do what you think you want to do :-)  
instead
stuff the data in the session until you have it all and only then  
start and finish

the transaction in a single request.


Regards
Jarratt



*Please don't throw tomatoes at me!!*

Sounds like Java might be a solution here. From my understanding,  
Java can hold persistent connections. I know that may not be a  
feasible solution, but still something to consider.


~PRT

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



Re: [PHP] --enable-radius, not found

2006-03-28 Thread Mike Milano

Chris wrote:

Mike Milano wrote:
I'm trying to compile PHP with radius enabled.  I have the pecl source 
and I can use other pecl extensions just fine.


When I type: cscript /nologo configure.js --help, I do not see any 
option for radius.


I've also tried to compile the dll by itself, but it is simply not found.

My system is WinXP using the platform SDK for Win2k to compile.  I get 
the same results compiling in VC7.


Any insight into what might be causing this would be greatly appreciated.


Can you try the binary?

http://pecl4win.php.net/list.php/5_1

That is the back-up plan.  I was hoping to get everything into the 
executable.


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



Re: [PHP] PDO, Persistent Connections

2006-03-28 Thread Rasmus Lerdorf

Philip Thompson wrote:

On Mar 28, 2006, at 10:23 AM, Jochem Maas wrote:


Jarratt Ingram wrote:

Hi,
I have a little unusual question, we are currently looking into the 
new PDO
extension with PHP5.1. We are currently use Mysql, InnoDB and 
transactions.

What we would like to know if we use the PDO extension and persistent
connections, can we start a Transaction on one page and then commit 
it from
another separate page by carrying the PDO object through a php 
session? Thus
preventing php from automatically closing that specific DB 
connection.  The

reason for this we use remote connections to the Database.
Any thoughts or comments if i have missed the boat completely


not quite but in practice what you want is not possible.
in order to continue that transaction on 'page 2' you browser will
need to connect to the same thread/process as the connection of request
of 'page 1' - not impossible but it's _very_ hit and miss (not 
something you

want to build upon).

oh and php resource datatypes (e.g. a DB connection) cannot be 
serialized.


in short you don't want to to do what you think you want to do :-) 
instead
stuff the data in the session until you have it all and only then 
start and finish

the transaction in a single request.


Regards
Jarratt



*Please don't throw tomatoes at me!!*

Sounds like Java might be a solution here. From my understanding, Java 
can hold persistent connections. I know that may not be a feasible 
solution, but still something to consider.


Not in any sort of scalable fashion.

In order to do this with either Java or PHP the second request has to 
come in on the same machine and get the same database connection as in 
the initial request.  While you could do some sticky session tricks and 
some database pooling, connection holding magic, there is no way this 
will work at all at any sort of scale.  What happens, for example, if 
that second request never comes?  How long do you keep that 
half-finished transaction connection around?  You obviously can't give 
it to anybody else, so it is in limbo.


The difference between Java and PHP here is that Java has a single JVM 
process per machine that holds the pool of database connections, so in a 
single-server architecture it becomes easier to give subsequent requests 
the same database connection, but as far as I am concerned that just 
means it is easier to shoot yourself in the foot since this is really a 
bad way to approach this.


-Rasmus

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



RE: [PHP] where php at?

2006-03-28 Thread tedd

Jay said:


I know that you have searched Google for cPanel cron jobs and that lot's
of folks here have tried to help.

Where are you on this and can we help?


You guys have been Great!

At the moment, I sent a trouble ticket to my host -- I'll see what he 
says, if anything.


Please don't think my host is remise in not responding -- it's just 
that he's not making any money off me for I paid less $7 for the 
entire year of hosting. So, I can't expect him to spend a lot of time 
with me. Likewise, what leverage do I have? Am I going to say Look, 
fix this or I'll take my seven bucks elsewhere?


I would like to get better hosting, but simply can't afford it. I 
won't go into the reasons why, but let's just say conditions are 
difficult for me. However, with all of your help, I'm learning and 
doing pretty well, all things considered.


So, I'll let the tread die for now until my host responds. If I solve 
it, then I'll post the solution. If he doesn't respond, then I'll 
start the thread up again. At least I know a lot more about this now.


Thanks again guys, you've been great!

tedd
--

http://sperling.com

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



[PHP] PHP installation determination

2006-03-28 Thread Bronislav Klucka

Hi,
I'm using 2 copies of PHP
1/ on local computer for developing
2/ on web server regular running webs

Is there any way to determine what PHP i'm using? Where am I?. Can I 
somehow define my own constant in php.ini?


Brona

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



Re: [PHP] PHP installation determination

2006-03-28 Thread Bronislav Klucka

Hi,
I didn't mean to able to determine this myself. I was thinking somethink 
like


?php
if (is_debug())  do something
else do something else

function is_debug()
{
  here I need to determine where am I
}

Brona



Dave Goodchild wrote:

Two easy ways - type 'php -v' on the command line or run phpinfo() and 
view the output.


On 28/03/06, *Bronislav Klucka*  [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


Hi,
I'm using 2 copies of PHP
1/ on local computer for developing
2/ on web server regular running webs

Is there any way to determine what PHP i'm using? Where am I?. Can I
somehow define my own constant in php.ini?

Brona

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




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



RE: [PHP] PHP installation determination

2006-03-28 Thread Shaunak Kashyap
Try using phpinfo().

http://us2.php.net/manual/en/function.phpinfo.php

In particular you want to pay attention to the $_SERVER variables
(search for PHP Variables in the phpinfo() output).

Shaunak Kashyap
 
Senior Web Developer
WPT Enterprises, Inc.
5700 Wilshire Blvd., Suite 350
Los Angeles, CA 90036
 
Direct: 323.330.9870
Main: 323.330.9900
 
www.worldpokertour.com
 
Confidentiality Notice:  This e-mail transmission (and/or the
attachments accompanying) it may contain confidential information
belonging to the sender which is protected.  The information is intended
only for the use of the intended recipient.  If you are not the intended
recipient, you are hereby notified that any disclosure, copying,
distribution or taking of any action in reliance on the contents of this
information is prohibited. If you have received this transmission in
error, please notify the sender by reply e-mail and destroy all copies
of this transmission.


 -Original Message-
 From: Bronislav Klucka [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 28, 2006 10:08 AM
 To: php-general@lists.php.net
 Subject: [PHP] PHP installation determination
 
 Hi,
 I'm using 2 copies of PHP
 1/ on local computer for developing
 2/ on web server regular running webs
 
 Is there any way to determine what PHP i'm using? Where am I?. Can I
 somehow define my own constant in php.ini?
 
 Brona
 
 --
 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: PHP installation determination

2006-03-28 Thread Mike Milano

Bronislav Klucka wrote:

Hi,
I'm using 2 copies of PHP
1/ on local computer for developing
2/ on web server regular running webs

Is there any way to determine what PHP i'm using? Where am I?. Can I 
somehow define my own constant in php.ini?


Brona


Is the server IP good enough for this? $_SERVER['SERVER_ADDR']

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



[PHP] php error reporting problem

2006-03-28 Thread ngwarai zed
hi, I omitted a semicolon ; at the end of a php statement on purpose to  see
what the error looks like. I ran the script and a blank page just  came
out.No error message. I then edited php.ini and set Display_errors  = On and
errror_reporting = E_ALL then restarted httpd. Ran the script  again and the
same thing happens. My question is:- how do I make php to show me a simple
error like omitting a semicolon?


Re: [PHP] php error reporting problem

2006-03-28 Thread John Nichel

ngwarai zed wrote:

hi, I omitted a semicolon ; at the end of a php statement on purpose to  see
what the error looks like. I ran the script and a blank page just  came
out.No error message. I then edited php.ini and set Display_errors  = On and
errror_reporting = E_ALL then restarted httpd. Ran the script  again and the
same thing happens. My question is:- how do I make php to show me a simple
error like omitting a semicolon?



Sure you're editing the right php.ini file?  No .htaccess files 
disabling error display?  ini_set turning it off?


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] php error reporting problem

2006-03-28 Thread Paul Novitski

At 10:57 AM 3/28/2006, ngwarai zed wrote:

hi, I omitted a semicolon ; at the end of a php statement on purpose to  see
what the error looks like. I ran the script and a blank page just  came
out.No error message. I then edited php.ini and set Display_errors  = On and
errror_reporting = E_ALL then restarted httpd. Ran the script  again and the
same thing happens. My question is:- how do I make php to show me a simple
error like omitting a semicolon?


If you omit the semicolon at the end of a line, PHP attempts to join 
it with the next line into one statement.  Sometimes, by coincidence, 
this results in a legal statement.  To show the error message, enter 
two statements that you're sure will combine into invalid syntax, such as:


$x = 4
$y = 3;

Their concatenation results in:

$x = 4 $y = 3;

which should get you parse error, unexpected T_VARIABLE.

Paul 


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



[PHP] private $foo

2006-03-28 Thread Anthony Ettinger
I see this all over the place, but I don't think it stores the variable in =
$foo:

class Foo {
private $foo;

public function __setFoo($arg)
{
  $this-foo = $arg;
}

--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

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



RE: [PHP] private $foo

2006-03-28 Thread Jay Blanchard
[snip]
I see this all over the place, but I don't think it stores the variable
in =
$foo:

class Foo {
private $foo;

public function __setFoo($arg)
{
  $this-foo = $arg;
}
[/snip]

I am always using 'foo' in conversation and finally said it enough that
the CEO used it in a meeting the other day. Setter functions are cool.

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



Re: [PHP] word matrix

2006-03-28 Thread Mike Dunlop

Sure Chris.

$words = array(word1,word2,word3);

I want this:

$result = array(
word1,
word2,
word3,
word1 word2,
word1 word3,
word2 word1,
word2 word3,
word3 word1,
word3 word2,
word1,word2,word3
);


Thanks - MD




On Mar 27, 2006, at 5:55 PM, Chris wrote:


Mike Dunlop wrote:
i have an array of various words and am looking to create a  
result  array of every possible combination of words from the orig  
array. I'm  not sure how to accomplish this elegantly within a for  
loop. Anyone  have any ideas?


Could you post a sample of what you have and what you want to end  
up with?


It'll be easier for us to work out rather than guess at what you're  
trying to do.


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

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



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



RE: [PHP] word matrix

2006-03-28 Thread Shaunak Kashyap
Would you also want the following combinations?

word1 word3 word2
word2 word1 word3
word2 word3 word1
word3 word1 word2
word3 word2 word1

Shaunak Kashyap
 
Senior Web Developer
WPT Enterprises, Inc.
5700 Wilshire Blvd., Suite 350
Los Angeles, CA 90036
 
Direct: 323.330.9870
Main: 323.330.9900
 
www.worldpokertour.com
 
Confidentiality Notice:  This e-mail transmission (and/or the
attachments accompanying) it may contain confidential information
belonging to the sender which is protected.  The information is intended
only for the use of the intended recipient.  If you are not the intended
recipient, you are hereby notified that any disclosure, copying,
distribution or taking of any action in reliance on the contents of this
information is prohibited. If you have received this transmission in
error, please notify the sender by reply e-mail and destroy all copies
of this transmission.


 -Original Message-
 From: Mike Dunlop [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 28, 2006 11:36 AM
 To: Chris
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] word matrix
 
 Sure Chris.
 
 $words = array(word1,word2,word3);
 
 I want this:
 
 $result = array(
   word1,
   word2,
   word3,
   word1 word2,
   word1 word3,
   word2 word1,
   word2 word3,
   word3 word1,
   word3 word2,
   word1,word2,word3
 );
 
 
 Thanks - MD
 
 
 
 
 On Mar 27, 2006, at 5:55 PM, Chris wrote:
 
  Mike Dunlop wrote:
  i have an array of various words and am looking to create a
  result  array of every possible combination of words from the orig
  array. I'm  not sure how to accomplish this elegantly within a for
  loop. Anyone  have any ideas?
 
  Could you post a sample of what you have and what you want to end
  up with?
 
  It'll be easier for us to work out rather than guess at what you're
  trying to do.
 
  --
  Postgresql  php tutorials
  http://www.designmagick.com/
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

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



Re: [PHP] $i vs. $r -- coding style ....

2006-03-28 Thread Jochem Maas



Philip Hallstrom wrote:
I simplified the code a bit, and I am guessing that it was too much. 
Below is the complete code that works fine. The weird part is, the 
part that I have the question on, is if I change $r to $i, it doesn't 
work anymore. $i doesn't count up as it should and instead gives me 
some unpredictible results. as it goes down the list sometimes its 
sequential (1,2,3 but never more than 3), other times its just the 
number 2 over and over).



$r = 1;

while ($row = mysql_fetch_array($website_result))
{
if (is_int(($r+2)/3))
{echo (\ntr);}
echo (\ntd align=\center\ valign=\bottom\);


purely aesthetic but maybe your eyes will hurt less if you cut down
on the backslashes (and unrequired parentheses) 

   echo \n, 'td align=center valign=bottom';

[echo is special in that it is not a function! rtm for more info ;-)]



include($site_path/common/code/directory_format_name.php);



I'm going to guess that 
$site_path/common/code/directory_format_name.php uses $i to do 
something else on it's own and is therefore messing up your $i.  At 
least that's where I'd start looking.




ditto!

also I'd suggest that doing this include again and again inside
this loop is a bad idea ... maybe try refactoring the code in the include file
so that you can use/call it as a function (which has it's own scope and is 
garanteed
_not_ to screw the vars in the calling scope)

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



[PHP] Div-element at same vert. position?

2006-03-28 Thread Gustav Wiberg

Hi guys!

I have a code-snippet here:

while ($dbArray = mysql_fetch_array($querys)) {
$dbIDLevel1 = $dbArray[IDLevel1];
$dbLevel1Name = $dbArray[level1Name];
$dbFactsLevel1Name = $dbArray[factsLevel1Name];
$dbFactsPictureLevel1Name = $dbArray[factsPictureLevel1Name];
?
div id=factsmenu_?php echo $dbIDLevel1;? name=factsmenu_?php echo 
$dbIDLevel1;? style=position:absolute; width:250px; height:300px; 
z-index:?php echo 200 + $dbIDLevel1;?; left: ?php echo $xTextledins + 
310;?px; top: ?php echo $yRightmenu;?px; overflow: auto; visibility: 
hidden

p class=textstyleb?php echo $dbLevel1Name;?/bbr
img src=pictures/level1/?php echo $dbFactsPictureLevel1Name;? 
align=top width=200 height=150br

?php echo $dbFactsLevel1Name;?/p
/div

div id=rightmenu_?php echo $dbIDLevel1;? name=rightmenu_?php echo 
$dbIDLevel1;? style=position:absolute; width:150px; height:300px; 
z-index:?php echo 100 + $dbIDLevel1;?; left: ?php echo $xTextledins + 
130;?px; top: ?php echo $yMenu;?px; overflow: auto; visibility: hidden

p class=textstyle
?php
   $sql2 = SELECT tblevel2catlevel1cat.ForIDLevel1Cat, 
tblevel2catlevel1cat.ForIDLevel2Cat, tblevel2cat.IDLevel2, 
tblevel2cat.level2Name FROM tblevel2catlevel1cat;
   $sql2 .=  LEFT JOIN tblevel2cat ON (tblevel2cat.IDLevel2 = 
tblevel2catlevel1cat.ForIDLevel2Cat);
   $sql2 .=  WHERE tblevel2catlevel1cat.ForIDLevel1Cat =  . 
safeQuote($dbIDLevel1);

   $querys2 = mysql_query($sql2);

   $nrRows++;
   while ($dbArray2 = mysql_fetch_array($querys2)) {
   $dbIDLevel2 = $dbArray2[IDLevel2];
   $dbLevel2Name = $dbArray2[level2Name];
   ?
   a href=page_productarea2.php?ID=?php echo $dbIDLevel2;? 
title=?php echo $dbLevel2Name;?font color=#015730?php echo 
$dbLevel2Name;?/font/abr

   ?php
   $nrRows++;
   }
   ?
   /p
   /div
?php
//Here...
$yMenu +=(8*intval($nrRows));
}


If you don't bother about the database:

You'll see that two div-elements are created. I want rightmenu_?php echo 
$dbIDLevel1;? to be at the same vertical level as div-element: 
factsmenu_?php echo $dbIDLevel1;?


Any ideas? (I tried with $yMenu +=(8*intval($nrRows)) with the rule that any 
row is 8 pixels, but this doesn't seem to be true)


/G

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



Re: [PHP] word matrix

2006-03-28 Thread Mike Dunlop

no, just all the unique combinations. Thanks!

...
Mike Dunlop
Director of Technology Development
[ e ] [EMAIL PROTECTED]
[ p ] 323.644.7808


On Mar 28, 2006, at 11:42 AM, Shaunak Kashyap wrote:


Would you also want the following combinations?

word1 word3 word2
word2 word1 word3
word2 word3 word1
word3 word1 word2
word3 word2 word1

Shaunak Kashyap

Senior Web Developer
WPT Enterprises, Inc.
5700 Wilshire Blvd., Suite 350
Los Angeles, CA 90036

Direct: 323.330.9870
Main: 323.330.9900

www.worldpokertour.com

Confidentiality Notice:  This e-mail transmission (and/or the
attachments accompanying) it may contain confidential information
belonging to the sender which is protected.  The information is  
intended
only for the use of the intended recipient.  If you are not the  
intended

recipient, you are hereby notified that any disclosure, copying,
distribution or taking of any action in reliance on the contents of  
this

information is prohibited. If you have received this transmission in
error, please notify the sender by reply e-mail and destroy all copies
of this transmission.



-Original Message-
From: Mike Dunlop [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 28, 2006 11:36 AM
To: Chris
Cc: php-general@lists.php.net
Subject: Re: [PHP] word matrix

Sure Chris.

$words = array(word1,word2,word3);

I want this:

$result = array(
word1,
word2,
word3,
word1 word2,
word1 word3,
word2 word1,
word2 word3,
word3 word1,
word3 word2,
word1,word2,word3
);


Thanks - MD




On Mar 27, 2006, at 5:55 PM, Chris wrote:


Mike Dunlop wrote:

i have an array of various words and am looking to create a
result  array of every possible combination of words from the orig
array. I'm  not sure how to accomplish this elegantly within a for
loop. Anyone  have any ideas?


Could you post a sample of what you have and what you want to end
up with?

It'll be easier for us to work out rather than guess at what you're
trying to do.

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

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



--
PHP 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] private $foo

2006-03-28 Thread Anthony Ettinger
On 3/28/06, Jay Blanchard [EMAIL PROTECTED] wrote:
 [snip]
 I see this all over the place, but I don't think it stores the variable
 in =
 $foo:

 class Foo {
 private $foo;

 public function __setFoo($arg)
 {
   $this-foo = $arg;
 }
 [/snip]

 I am always using 'foo' in conversation and finally said it enough that
 the CEO used it in a meeting the other day. Setter functions are cool.



Nevermind, it does need private $foo; it works without it, but not if
you want to use a default from within the class.

if you set private $foo = 'foo';

print $f-__getFoo();
$f-__setFoo('bar');
print $f-__getFoo();

Yields:
foo
bar


--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

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



RE: [PHP] Div-element at same vert. position?

2006-03-28 Thread Jay Blanchard
[snip]
I have a code-snippet here:

while ($dbArray = mysql_fetch_array($querys)) {
$dbIDLevel1 = $dbArray[IDLevel1];
$dbLevel1Name = $dbArray[level1Name];
$dbFactsLevel1Name = $dbArray[factsLevel1Name];
$dbFactsPictureLevel1Name = $dbArray[factsPictureLevel1Name];
?
div id=factsmenu_?php echo $dbIDLevel1;? name=factsmenu_?php echo

$dbIDLevel1;? style=position:absolute; width:250px; height:300px; 
z-index:?php echo 200 + $dbIDLevel1;?; left: ?php echo $xTextledins +

310;?px; top: ?php echo $yRightmenu;?px; overflow: auto; visibility: 
hidden
p class=textstyleb?php echo $dbLevel1Name;?/bbr
img src=pictures/level1/?php echo $dbFactsPictureLevel1Name;? 
align=top width=200 height=150br
?php echo $dbFactsLevel1Name;?/p
/div

div id=rightmenu_?php echo $dbIDLevel1;? name=rightmenu_?php echo

$dbIDLevel1;? style=position:absolute; width:150px; height:300px; 
z-index:?php echo 100 + $dbIDLevel1;?; left: ?php echo $xTextledins +

130;?px; top: ?php echo $yMenu;?px; overflow: auto; visibility:
hidden
p class=textstyle
?php
$sql2 = SELECT tblevel2catlevel1cat.ForIDLevel1Cat, 
tblevel2catlevel1cat.ForIDLevel2Cat, tblevel2cat.IDLevel2, 
tblevel2cat.level2Name FROM tblevel2catlevel1cat;
$sql2 .=  LEFT JOIN tblevel2cat ON (tblevel2cat.IDLevel2 = 
tblevel2catlevel1cat.ForIDLevel2Cat);
$sql2 .=  WHERE tblevel2catlevel1cat.ForIDLevel1Cat =  . 
safeQuote($dbIDLevel1);
$querys2 = mysql_query($sql2);

$nrRows++;
while ($dbArray2 = mysql_fetch_array($querys2)) {
$dbIDLevel2 = $dbArray2[IDLevel2];
$dbLevel2Name = $dbArray2[level2Name];
?
a href=page_productarea2.php?ID=?php echo $dbIDLevel2;? 
title=?php echo $dbLevel2Name;?font color=#015730?php echo 
$dbLevel2Name;?/font/abr
?php
$nrRows++;
}
?
/p
/div
?php
//Here...
$yMenu +=(8*intval($nrRows));
}


If you don't bother about the database:

You'll see that two div-elements are created. I want rightmenu_?php
echo 
$dbIDLevel1;? to be at the same vertical level as div-element: 
factsmenu_?php echo $dbIDLevel1;?

Any ideas? (I tried with $yMenu +=(8*intval($nrRows)) with the rule that
any 
row is 8 pixels, but this doesn't seem to be true)
[/snip]

A. The is a CSS question
2. You didn't provide a way to see it.
III. Using absolute positioning is a bad thing and the left div should
be floated to the left.

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



Re: [PHP] Div-element at same vert. position?

2006-03-28 Thread John Nichel

Gustav Wiberg wrote:
snip

The CSS list is down the road a-ways.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] private $foo

2006-03-28 Thread Jochem Maas

Anthony Ettinger wrote:

On 3/28/06, Jay Blanchard [EMAIL PROTECTED] wrote:


[snip]
I see this all over the place, but I don't think it stores the variable
in =
$foo:

class Foo {
private $foo;

public function __setFoo($arg)
{
 $this-foo = $arg;
}
[/snip]

I am always using 'foo' in conversation and finally said it enough that
the CEO used it in a meeting the other day. Setter functions are cool.


hmmm, who wants to write setters for 100's of properties? ...
see below for an alternative ...







Nevermind, it does need private $foo; it works without it, but not if
you want to use a default from within the class.

if you set private $foo = 'foo';

print $f-__getFoo();
$f-__setFoo('bar');
print $f-__getFoo();


?php

class Foo
{
private $foo = 'foo';

function __get($k)
{
if (isset($this-{$k})) {
return $this-{$k};
}

throw new Exception(non existing property!);
}

function __set($k, $v)
{
if (isset($this-{$k})) {
$this-{$k} = $v;
return;
}

throw new Exception(non existing property!);
}
}

$f = new Foo;
echo $f-foo,\n;
$f-foo = bar;
echo $f-foo,\n;


Yields:
foo
bar


--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html



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



Re: [PHP] Div-element at same vert. position?

2006-03-28 Thread Jochem Maas

Jay Blanchard wrote:



A. The is a CSS question


true :-)


2. You didn't provide a way to see it.
III. Using absolute positioning is a bad thing and the left div should
be floated to the left.


what's wrong with absolute positioning?





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



RE: [PHP] Div-element at same vert. position?

2006-03-28 Thread Jay Blanchard
[snip]
what's wrong with absolute positioning?
[/snip]

Because there is only one absolute; that there are no absolutes.

IE, FF, Opera and others all treat the box model differently.

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



[PHP] Random value from ini file

2006-03-28 Thread Benjamin Adams

I have an ini file that has:
1 = words;
2 = words1;
3 = words3;

I want to pull a rand value and print it out
I'm trying to use parse_ini_file but its not working any help would  
be great.

Thanks

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



Re: [PHP] private $foo

2006-03-28 Thread Joe Henry
On Tuesday 28 March 2006 1:12 pm, Jochem Maas wrote:
 ?php

 class Foo
 {
   private $foo = 'foo';

   function __get($k)
   {
   if (isset($this-{$k})) {
   return $this-{$k};
   }

   throw new Exception(non existing property!);
   }

   function __set($k, $v)
   {
   if (isset($this-{$k})) {
   $this-{$k} = $v;
   return;
   }

   throw new Exception(non existing property!);
   }
 }

 $f = new Foo;
 echo $f-foo,\n;
 $f-foo = bar;
 echo $f-foo,\n;

Maybe I'm wrong, but I thought you couldn't use the  $f-foo to access 
private variables from outside a class?
-- 
Joe Henry
www.celebrityaccess.com
[EMAIL PROTECTED]

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



Re: [PHP] private $foo

2006-03-28 Thread Anthony Ettinger
On 3/28/06, Jochem Maas [EMAIL PROTECTED] wrote:
 Anthony Ettinger wrote:
  On 3/28/06, Jay Blanchard [EMAIL PROTECTED] wrote:
 
 [snip]
 I see this all over the place, but I don't think it stores the variable
 in =
 $foo:
 
 class Foo {
 private $foo;
 
 public function __setFoo($arg)
 {
   $this-foo = $arg;
 }
 [/snip]
 
 I am always using 'foo' in conversation and finally said it enough that
 the CEO used it in a meeting the other day. Setter functions are cool.

 hmmm, who wants to write setters for 100's of properties? ...
 see below for an alternative ...

 
 
 
 
  Nevermind, it does need private $foo; it works without it, but not if
  you want to use a default from within the class.
 
  if you set private $foo = 'foo';
 
  print $f-__getFoo();
  $f-__setFoo('bar');
  print $f-__getFoo();

 ?php

 class Foo
 {
 private $foo = 'foo';

 function __get($k)
 {
 if (isset($this-{$k})) {
 return $this-{$k};
 }

 throw new Exception(non existing property!);
 }

 function __set($k, $v)
 {
 if (isset($this-{$k})) {
 $this-{$k} = $v;
 return;
 }

 throw new Exception(non existing property!);
 }
 }

 $f = new Foo;
 echo $f-foo,\n;
 $f-foo = bar;
 echo $f-foo,\n;
 
  Yields:
  foo
  bar


If you handle your properties all the same.



--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

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



Re: [PHP] private $foo

2006-03-28 Thread Anthony Ettinger
On 3/28/06, Joe Henry [EMAIL PROTECTED] wrote:
 On Tuesday 28 March 2006 1:12 pm, Jochem Maas wrote:
  ?php
 
  class Foo
  {
private $foo = 'foo';
 
function __get($k)
{
if (isset($this-{$k})) {
return $this-{$k};
}
 
throw new Exception(non existing property!);
}
 
function __set($k, $v)
{
if (isset($this-{$k})) {
$this-{$k} = $v;
return;
}
 
throw new Exception(non existing property!);
}
  }
 
  $f = new Foo;
  echo $f-foo,\n;
  $f-foo = bar;
  echo $f-foo,\n;

 Maybe I'm wrong, but I thought you couldn't use the  $f-foo to access
 private variables from outside a class?

I think he means:

echo $f-__get('foo');
$f-__set('foo', 'bar');
echo $f-__get('foo');

---
foo
bar

If you want to validate input, you then have to have a block of nested
conditionals if your validation expressions vary.


--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

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



RE: [PHP] Random value from ini file

2006-03-28 Thread Jim Moseby
 I have an ini file that has:
 1 = words;
 2 = words1;
 3 = words3;
 
 I want to pull a rand value and print it out
 I'm trying to use parse_ini_file but its not working any help would  
 be great.
 Thanks


You could read them all into an array then use array_rand() to pick one.

http://us2.php.net/manual/en/function.array-rand.php

JM

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



RE: [PHP] Div-element at same vert. position?

2006-03-28 Thread Chrome
Try drag-drop without absolute ;-)

Dan

 
---
http://chrome.me.uk
 

-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED] 
Sent: 28 March 2006 21:21
To: Jochem Maas
Cc: PHP General
Subject: RE: [PHP] Div-element at same vert. position?

[snip]
what's wrong with absolute positioning?
[/snip]

Because there is only one absolute; that there are no absolutes.

IE, FF, Opera and others all treat the box model differently.

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


__ NOD32 1.1459 (20060327) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



RE: [PHP] word matrix

2006-03-28 Thread Shaunak Kashyap
Here is my first cut at the problem. It is probably not the most optimal
solution in terms of algorithmic complexity and it could also do without
the use of global vars and such, but it should give you some ideas.

[code]

$arr = array('word1', 'word2', 'word3');

$lowerBound = 1;
$upperBound = pow(2, count($arr)) - 1;

for ($index = $lowerBound; $index = $upperBound; ++$index) {

$bitString = str_pad(decbin($index), count($arr), 0,
STR_PAD_LEFT);

echo showValues($bitString) . br;

}

function showValues($bitString) {

global $arr;

$outputStringArray = array();

for ($pos = 0; $pos  strlen($bitString); ++$pos) {

if ($bitString[$pos]) {

$outputStringArray[] = $arr[$pos];
}

}

return implode(' ', $outputStringArray);


}
[/code]

Shaunak Kashyap
 
Senior Web Developer
WPT Enterprises, Inc.
5700 Wilshire Blvd., Suite 350
Los Angeles, CA 90036
 
Direct: 323.330.9870
Main: 323.330.9900
 
www.worldpokertour.com
 
Confidentiality Notice:  This e-mail transmission (and/or the
attachments accompanying) it may contain confidential information
belonging to the sender which is protected.  The information is intended
only for the use of the intended recipient.  If you are not the intended
recipient, you are hereby notified that any disclosure, copying,
distribution or taking of any action in reliance on the contents of this
information is prohibited. If you have received this transmission in
error, please notify the sender by reply e-mail and destroy all copies
of this transmission.


 -Original Message-
 From: Mike Dunlop [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 28, 2006 11:57 AM
 To: Shaunak Kashyap
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] word matrix
 
 no, just all the unique combinations. Thanks!
 
 ...
 Mike Dunlop
 Director of Technology Development
 [ e ] [EMAIL PROTECTED]
 [ p ] 323.644.7808
 
 
 On Mar 28, 2006, at 11:42 AM, Shaunak Kashyap wrote:
 
  Would you also want the following combinations?
 
  word1 word3 word2
  word2 word1 word3
  word2 word3 word1
  word3 word1 word2
  word3 word2 word1
 
  Shaunak Kashyap
 
  Senior Web Developer
  WPT Enterprises, Inc.
  5700 Wilshire Blvd., Suite 350
  Los Angeles, CA 90036
 
  Direct: 323.330.9870
  Main: 323.330.9900
 
  www.worldpokertour.com
 
  Confidentiality Notice:  This e-mail transmission (and/or the
  attachments accompanying) it may contain confidential information
  belonging to the sender which is protected.  The information is
  intended
  only for the use of the intended recipient.  If you are not the
  intended
  recipient, you are hereby notified that any disclosure, copying,
  distribution or taking of any action in reliance on the contents of
  this
  information is prohibited. If you have received this transmission in
  error, please notify the sender by reply e-mail and destroy all
copies
  of this transmission.
 
 
  -Original Message-
  From: Mike Dunlop [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, March 28, 2006 11:36 AM
  To: Chris
  Cc: php-general@lists.php.net
  Subject: Re: [PHP] word matrix
 
  Sure Chris.
 
  $words = array(word1,word2,word3);
 
  I want this:
 
  $result = array(
 word1,
 word2,
 word3,
 word1 word2,
 word1 word3,
 word2 word1,
 word2 word3,
 word3 word1,
 word3 word2,
 word1,word2,word3
  );
 
 
  Thanks - MD
 
 
 
 
  On Mar 27, 2006, at 5:55 PM, Chris wrote:
 
  Mike Dunlop wrote:
  i have an array of various words and am looking to create a
  result  array of every possible combination of words from the
orig
  array. I'm  not sure how to accomplish this elegantly within a
for
  loop. Anyone  have any ideas?
 
  Could you post a sample of what you have and what you want to end
  up with?
 
  It'll be easier for us to work out rather than guess at what
you're
  trying to do.
 
  --
  Postgresql  php tutorials
  http://www.designmagick.com/
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

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



[PHP] Strange math results

2006-03-28 Thread Jeff
I've got a strange problem here.

I'm subtacting one variable from another, both of type double and if
they are the same, instead of getting a result of 0, I get something
like -9.99200722163E-016

Is this a bug or am I doing something wrong here?

Thanks,

Jeff

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



RE: [PHP] Strange math results

2006-03-28 Thread Jay Blanchard
[snip]
I've got a strange problem here.

I'm subtacting one variable from another, both of type double and if
they are the same, instead of getting a result of 0, I get something
like -9.99200722163E-016

Is this a bug or am I doing something wrong here?
[/snip]

From all of the information that you sent in your post I'd say that
you're doing something wrong here. 

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



RE: [PHP] Div-element at same vert. position?

2006-03-28 Thread Jay Blanchard
[snip]
 [snip]
what's wrong with absolute positioning?
[/snip]

Because there is only one absolute; that there are no absolutes.

IE, FF, Opera and others all treat the box model differently.
[/snip]

My bad.I should have said that it is a bad idea to use fixed
positioning.

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



Re: [PHP] Div-element at same vert. position?

2006-03-28 Thread Gustav Wiberg


- Original Message - 
From: Jay Blanchard [EMAIL PROTECTED]
To: Gustav Wiberg [EMAIL PROTECTED]; PHP General 
php-general@lists.php.net

Sent: Tuesday, March 28, 2006 10:00 PM
Subject: RE: [PHP] Div-element at same vert. position?


[snip]
I have a code-snippet here:

while ($dbArray = mysql_fetch_array($querys)) {
$dbIDLevel1 = $dbArray[IDLevel1];
$dbLevel1Name = $dbArray[level1Name];
$dbFactsLevel1Name = $dbArray[factsLevel1Name];
$dbFactsPictureLevel1Name = $dbArray[factsPictureLevel1Name];
?
div id=factsmenu_?php echo $dbIDLevel1;? name=factsmenu_?php echo

$dbIDLevel1;? style=position:absolute; width:250px; height:300px;
z-index:?php echo 200 + $dbIDLevel1;?; left: ?php echo $xTextledins +

310;?px; top: ?php echo $yRightmenu;?px; overflow: auto; visibility:
hidden
p class=textstyleb?php echo $dbLevel1Name;?/bbr
img src=pictures/level1/?php echo $dbFactsPictureLevel1Name;?
align=top width=200 height=150br
?php echo $dbFactsLevel1Name;?/p
/div

div id=rightmenu_?php echo $dbIDLevel1;? name=rightmenu_?php echo

$dbIDLevel1;? style=position:absolute; width:150px; height:300px;
z-index:?php echo 100 + $dbIDLevel1;?; left: ?php echo $xTextledins +

130;?px; top: ?php echo $yMenu;?px; overflow: auto; visibility:
hidden
p class=textstyle
?php
   $sql2 = SELECT tblevel2catlevel1cat.ForIDLevel1Cat,
tblevel2catlevel1cat.ForIDLevel2Cat, tblevel2cat.IDLevel2,
tblevel2cat.level2Name FROM tblevel2catlevel1cat;
   $sql2 .=  LEFT JOIN tblevel2cat ON (tblevel2cat.IDLevel2 =
tblevel2catlevel1cat.ForIDLevel2Cat);
   $sql2 .=  WHERE tblevel2catlevel1cat.ForIDLevel1Cat =  .
safeQuote($dbIDLevel1);
   $querys2 = mysql_query($sql2);

   $nrRows++;
   while ($dbArray2 = mysql_fetch_array($querys2)) {
   $dbIDLevel2 = $dbArray2[IDLevel2];
   $dbLevel2Name = $dbArray2[level2Name];
   ?
   a href=page_productarea2.php?ID=?php echo $dbIDLevel2;?
title=?php echo $dbLevel2Name;?font color=#015730?php echo
$dbLevel2Name;?/font/abr
   ?php
   $nrRows++;
   }
   ?
   /p
   /div
?php
//Here...
$yMenu +=(8*intval($nrRows));
}


If you don't bother about the database:

You'll see that two div-elements are created. I want rightmenu_?php
echo
$dbIDLevel1;? to be at the same vertical level as div-element:
factsmenu_?php echo $dbIDLevel1;?

Any ideas? (I tried with $yMenu +=(8*intval($nrRows)) with the rule that
any
row is 8 pixels, but this doesn't seem to be true)
[/snip]

A. The is a CSS question
2. You didn't provide a way to see it.
III. Using absolute positioning is a bad thing and the left div should
be floated to the left.

Ok, I got your message you all! But I really wanted to do the postitioning 
in PHP with absolute positioning (just for the sakes cause ;-))


/G

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



RE: [PHP] Strange math results

2006-03-28 Thread Ezra Nugroho

It is not always possible to precisely represent decimal values as a
float type in binary. In these cases, the value that you have is either
slightly bigger or slightly smaller than the actual. 

In your specific problem, you have two values that are not equal, but
very similar. Therefore you get a small negative value when subtracting
them.

You just have to keep this fact in mind whenever you want to do high-
precision computing.



On Tue, 2006-03-28 at 15:30 -0600, Jay Blanchard wrote:
 [snip]
 I've got a strange problem here.
 
 I'm subtacting one variable from another, both of type double and if
 they are the same, instead of getting a result of 0, I get something
 like -9.99200722163E-016
 
 Is this a bug or am I doing something wrong here?
 [/snip]
 
 From all of the information that you sent in your post I'd say that
 you're doing something wrong here. 
 

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



RE: [PHP] Div-element at same vert. position?

2006-03-28 Thread Jay Blanchard
[snip]
A. The is a CSS question
2. You didn't provide a way to see it.
III. Using absolute positioning is a bad thing and the left div should
be floated to the left.

Ok, I got your message you all! But I really wanted to do the
postitioning 
in PHP with absolute positioning (just for the sakes cause ;-))
[/snip]

While you may be using PHP to output attributes for CSS you are not
doing positioning with CSS. 

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



RE: [PHP] Div-element at same vert. position?

2006-03-28 Thread tedd

At 2:21 PM -0600 3/28/06, Jay Blanchard wrote:

[snip]
what's wrong with absolute positioning?
[/snip]

Because there is only one absolute; that there are no absolutes.

IE, FF, Opera and others all treat the box model differently.


That's if you use margins and padding. The way I understand it, the 
box model --


http://www.w3.org/TR/REC-CSS2/box.html

-- is problematic because M$ looks at things differently than 
everyone else (i.e., W3C et al) -- which has led to many different 
fixes (hacks), such as:


http://tantek.com/CSS/Examples/boxmodelhack.html

But, if you are trying to absolutely position things, then using 
absolute without padding and margins is the way to go.


For example, I've had a couple of clients who wanted their web sites 
to look exactly like their designers illustrations without any 
alteration or slack whatsoever on any browser. The only way I did it 
was to use absolute positioning.


But, like everything else (including this topic), it has it's place.

tedd

--

http://sperling.com

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



Re: [PHP] private $foo

2006-03-28 Thread M. Sokolewicz

Anthony Ettinger wrote:

On 3/28/06, Joe Henry [EMAIL PROTECTED] wrote:


On Tuesday 28 March 2006 1:12 pm, Jochem Maas wrote:


?php

class Foo
{
 private $foo = 'foo';

 function __get($k)
 {
 if (isset($this-{$k})) {
 return $this-{$k};
 }

 throw new Exception(non existing property!);
 }

 function __set($k, $v)
 {
 if (isset($this-{$k})) {
 $this-{$k} = $v;
 return;
 }

 throw new Exception(non existing property!);
 }
}

$f = new Foo;
echo $f-foo,\n;
$f-foo = bar;
echo $f-foo,\n;


Maybe I'm wrong, but I thought you couldn't use the  $f-foo to access
private variables from outside a class?



I think he means:

echo $f-__get('foo');
$f-__set('foo', 'bar');
echo $f-__get('foo');



no, he doesn't. http://www.php.net/manual/en/language.oop5.magic.php 
should explain it, however the part about __get() and __set() isn't 
quite finished yet (and thus missing). Rest assured though, Jochem 
showed a correct way of handling this problem, though PHP had a bug 
relating to recursive lookups when using isset() in combination with 
__get().


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



Re: [PHP] Div-element at same vert. position?

2006-03-28 Thread Gustav Wiberg


- Original Message - 
From: Jay Blanchard [EMAIL PROTECTED]
To: Gustav Wiberg [EMAIL PROTECTED]; PHP General 
php-general@lists.php.net

Sent: Tuesday, March 28, 2006 11:52 PM
Subject: RE: [PHP] Div-element at same vert. position?


[snip]
A. The is a CSS question
2. You didn't provide a way to see it.
III. Using absolute positioning is a bad thing and the left div should
be floated to the left.

Ok, I got your message you all! But I really wanted to do the
postitioning
in PHP with absolute positioning (just for the sakes cause ;-))
[/snip]

While you may be using PHP to output attributes for CSS you are not
doing positioning with CSS.

And your point is?

/Gustav Wiberg

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



RE: [PHP] private $foo

2006-03-28 Thread tedd

I am always using 'foo' in conversation and finally said it enough that
the CEO used it in a meeting the other day. Setter functions are cool.


That's interesting -- not meaning any disrespect, and this is just an 
opinion -- but in the newly published PHP Phrasebook by Christian 
Wenz (an excellent book btw), he says:


Another phrase I promise you will not find in this book is anything 
that looks like foo, bar, baz, or any other proofs of very little 
imagination.


While you may not agree with his statement, but I personally don't 
like the use of terms like those for I find them confusing. I would 
much rather like to see real world examples. From there I can make 
the translation to what I want. But using terms like $foo just adds 
another level of abstraction for me understand. But, I'm also simple.


tedd
--

http://sperling.com

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



Re: [PHP] Strange math results

2006-03-28 Thread Satyam
Indeed, when doing floating point math, you cannot  check the values for 
equality, they will rarely be, you have to check whether the difference in 
between them is less than the error you are willing to accept.  Floating 
point numbers are usually an approximation to the actual value and 
intermediate operations might pile up errors in each approximation in 
different ways.


As an example,

$third = 1/3;

$third will contain 0.3 up to a certain number of digits, but it won't 
last forever, as it should, theoretically.


Now,

$third * 3 == 1

will be false, but:

define('MAXERR',0.001);
abs($third * 3 - 1)  MAXERR

will be true.

MAXERR is the error you are willing to accept in your calculations, for 
example, if you are using cents, give it a couple of extra positions so that 
roundings don't creep up to significant cents, that is, use MAXERR = 0.0001 
or thereabouts.


Satyam



- Original Message - 
From: Ezra Nugroho [EMAIL PROTECTED]





It is not always possible to precisely represent decimal values as a
float type in binary. In these cases, the value that you have is either
slightly bigger or slightly smaller than the actual.

In your specific problem, you have two values that are not equal, but
very similar. Therefore you get a small negative value when subtracting
them.

You just have to keep this fact in mind whenever you want to do high-
precision computing.



On Tue, 2006-03-28 at 15:30 -0600, Jay Blanchard wrote:

[snip]
I've got a strange problem here.

I'm subtacting one variable from another, both of type double and if
they are the same, instead of getting a result of 0, I get something
like -9.99200722163E-016

Is this a bug or am I doing something wrong here?
[/snip]

From all of the information that you sent in your post I'd say that
you're doing something wrong here.



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





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



RE: [PHP] private $foo

2006-03-28 Thread Jay Blanchard
[snip]
That's interesting -- not meaning any disrespect, and this is just an 
opinion -- but in the newly published PHP Phrasebook by Christian 
Wenz (an excellent book btw), he says:

Another phrase I promise you will not find in this book is anything 
that looks like foo, bar, baz, or any other proofs of very little 
imagination.

While you may not agree with his statement, but I personally don't 
like the use of terms like those for I find them confusing. I would 
much rather like to see real world examples. From there I can make 
the translation to what I want. But using terms like $foo just adds 
another level of abstraction for me understand. But, I'm also simple.
[/snip]

I have been programming since the mid 70's and foo was in the lexcon at
that point. I guess I am old school.

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



Re: [PHP] private $foo

2006-03-28 Thread Anthony Ettinger
On 3/28/06, M. Sokolewicz [EMAIL PROTECTED] wrote:
 Anthony Ettinger wrote:
  On 3/28/06, Joe Henry [EMAIL PROTECTED] wrote:
 
 On Tuesday 28 March 2006 1:12 pm, Jochem Maas wrote:
 
 ?php
 
 class Foo
 {
   private $foo = 'foo';
 
   function __get($k)
   {
   if (isset($this-{$k})) {
   return $this-{$k};
   }
 
   throw new Exception(non existing property!);
   }
 
   function __set($k, $v)
   {
   if (isset($this-{$k})) {
   $this-{$k} = $v;
   return;
   }
 
   throw new Exception(non existing property!);
   }
 }
 
 $f = new Foo;
 echo $f-foo,\n;
 $f-foo = bar;
 echo $f-foo,\n;
 
 Maybe I'm wrong, but I thought you couldn't use the  $f-foo to access
 private variables from outside a class?
 
 
  I think he means:
 
  echo $f-__get('foo');
  $f-__set('foo', 'bar');
  echo $f-__get('foo');
 

 no, he doesn't. http://www.php.net/manual/en/language.oop5.magic.php
 should explain it, however the part about __get() and __set() isn't
 quite finished yet (and thus missing). Rest assured though, Jochem
 showed a correct way of handling this problem, though PHP had a bug
 relating to recursive lookups when using isset() in combination with
 __get().



private $foo; cannot be accessed directly outside the script.

print $f-foo; #fails

Fatal error: Cannot access private property Foo::$foo in
/x/home/username/docs/misc/php/client.php on line 11




--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

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



RE: [PHP] Strange math results

2006-03-28 Thread Jeff
 -Original Message-
 From: Satyam [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, March 28, 2006 17:23
 To: [EMAIL PROTECTED]; Jay Blanchard
 Cc: Jeff; php-general@lists.php.net
 Subject: Re: [PHP] Strange math results
 
 
 Indeed, when doing floating point math, you cannot  check the 
 values for 
 equality, they will rarely be, you have to check whether the 
 difference in 
 between them is less than the error you are willing to 
 accept.  Floating 
 point numbers are usually an approximation to the actual value and 
 intermediate operations might pile up errors in each approximation in 
 different ways.
 
 As an example,
 
 $third = 1/3;
 
 $third will contain 0.3 up to a certain number of digits, 
 but it won't 
 last forever, as it should, theoretically.
 
 Now,
 
 $third * 3 == 1
 
 will be false, but:
 
 define('MAXERR',0.001);
 abs($third * 3 - 1)  MAXERR
 
 will be true.
 
 MAXERR is the error you are willing to accept in your 
 calculations, for 
 example, if you are using cents, give it a couple of extra 
 positions so that 
 roundings don't creep up to significant cents, that is, use 
 MAXERR = 0.0001 
 or thereabouts.
 
 Satyam
 

That explains it.  Thanks!

Jeff

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



[PHP] Not sure if this is a php problem or a mysql problem

2006-03-28 Thread Paul Goepfert
Hi all,

I have developed a php functilon that is to return the date +1 from a
Mysql database.  My sql statement is as follows

SELECT dayNum FROM Days Where dayNum = day(curdate())+1;

The function works great on the intended webserver but when placed on
a different mysql server (The one I have using to develop the webpage)
the return variable with the intended SQL statement is not being set. 
I Think it has something to do with thlis day(curdate()) portion of
my sql statement.  When I had month in place of day I was able to
ge a output.  I don't have a problem with year(curdate()) or
month(curdate()).  Even though the functilon works on the final
destination webserver I would like to know why it won't work on my
testing server.

Thanks

Paul

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



Re: [PHP] word matrix

2006-03-28 Thread Mike Dunlop
Thanks much for your time on this - I'm going to give this code a try  
- much appreciated :)


Best,
Mike D




On Mar 28, 2006, at 12:53 PM, Shaunak Kashyap wrote:

Here is my first cut at the problem. It is probably not the most  
optimal
solution in terms of algorithmic complexity and it could also do  
without

the use of global vars and such, but it should give you some ideas.

[code]

$arr = array('word1', 'word2', 'word3');

$lowerBound = 1;
$upperBound = pow(2, count($arr)) - 1;

for ($index = $lowerBound; $index = $upperBound; ++$index) {

$bitString = str_pad(decbin($index), count($arr), 0,
STR_PAD_LEFT);

echo showValues($bitString) . br;

}

function showValues($bitString) {

global $arr;

$outputStringArray = array();

for ($pos = 0; $pos  strlen($bitString); ++$pos) {

if ($bitString[$pos]) {

$outputStringArray[] = $arr[$pos];
}

}

return implode(' ', $outputStringArray);


}
[/code]

Shaunak Kashyap

Senior Web Developer
WPT Enterprises, Inc.
5700 Wilshire Blvd., Suite 350
Los Angeles, CA 90036

Direct: 323.330.9870
Main: 323.330.9900

www.worldpokertour.com

Confidentiality Notice:  This e-mail transmission (and/or the
attachments accompanying) it may contain confidential information
belonging to the sender which is protected.  The information is  
intended
only for the use of the intended recipient.  If you are not the  
intended

recipient, you are hereby notified that any disclosure, copying,
distribution or taking of any action in reliance on the contents of  
this

information is prohibited. If you have received this transmission in
error, please notify the sender by reply e-mail and destroy all copies
of this transmission.



-Original Message-
From: Mike Dunlop [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 28, 2006 11:57 AM
To: Shaunak Kashyap
Cc: php-general@lists.php.net
Subject: Re: [PHP] word matrix

no, just all the unique combinations. Thanks!

...
Mike Dunlop
Director of Technology Development
[ e ] [EMAIL PROTECTED]
[ p ] 323.644.7808


On Mar 28, 2006, at 11:42 AM, Shaunak Kashyap wrote:


Would you also want the following combinations?

word1 word3 word2
word2 word1 word3
word2 word3 word1
word3 word1 word2
word3 word2 word1

Shaunak Kashyap

Senior Web Developer
WPT Enterprises, Inc.
5700 Wilshire Blvd., Suite 350
Los Angeles, CA 90036

Direct: 323.330.9870
Main: 323.330.9900

www.worldpokertour.com

Confidentiality Notice:  This e-mail transmission (and/or the
attachments accompanying) it may contain confidential information
belonging to the sender which is protected.  The information is
intended
only for the use of the intended recipient.  If you are not the
intended
recipient, you are hereby notified that any disclosure, copying,
distribution or taking of any action in reliance on the contents of
this
information is prohibited. If you have received this transmission in
error, please notify the sender by reply e-mail and destroy all

copies

of this transmission.



-Original Message-
From: Mike Dunlop [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 28, 2006 11:36 AM
To: Chris
Cc: php-general@lists.php.net
Subject: Re: [PHP] word matrix

Sure Chris.

$words = array(word1,word2,word3);

I want this:

$result = array(
word1,
word2,
word3,
word1 word2,
word1 word3,
word2 word1,
word2 word3,
word3 word1,
word3 word2,
word1,word2,word3
);


Thanks - MD




On Mar 27, 2006, at 5:55 PM, Chris wrote:


Mike Dunlop wrote:

i have an array of various words and am looking to create a
result  array of every possible combination of words from the

orig

array. I'm  not sure how to accomplish this elegantly within a

for

loop. Anyone  have any ideas?


Could you post a sample of what you have and what you want to end
up with?

It'll be easier for us to work out rather than guess at what

you're

trying to do.

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

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



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


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



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


--
PHP 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: imagecreatefromjpeg() uses too much memory

2006-03-28 Thread Al

You didn't say, but, I assume that ordinary users will not be uploading to your 
web hotel. Thus

To cope with the file size you must preprocess your images in an image editor, 
[e.g., PhotoShop, PaintShop Pro, etc.].
Enhance and compress as necessary. In general, it is best to use an image editor so you can visually judge the quality 
at each step.


Are the images going to be displayed on your site?  If so, I can't imagine needing anywhere near 16mb for a quality 
rendering.


In general, GD2 does a poor job of processing quality images.  It's great for 
annotating and applying borders, etc.

Imagemagick is far superior for image processing.

Then


Fredrik Enestad wrote:

Hi!

I'm making a function for uploading and resizing images to my web hotel.
Problem is, memory_limit is set to 16M so when uploading larger images the
script crashes.

So, I tried to override the memory_limit setting, but as it turns out, my
web host has set some safe mode setting,
so that no settings can be changed in the php.ini, and they wont change the
setting to a higher value themselves.

This is were the code crashes:

$image_p = imagecreatetruecolor($widthNew, $heightNew);
if($mime==image/jpeg || $mime==image/pjpeg) {
  $image = imagecreatefromjpeg($imgarray[tmp_name]);
  imagecopyresampled($image_p, $image, 0, 0, 0, 0, $widthNew, $heightNew,
$widthOrg, $heightOrg);
  imagejpeg($image_p, $save_dir.$temp_filename, 80);
  return Done;
}

The line $image = imagecreatefromjpeg($imgarray[tmp_name]); causes the
problem.

Do any of you know any other way to solve this problem?

--
Thanks
Fredrik



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



[PHP] Script to sanitize variables

2006-03-28 Thread Matt Arnilo S. Baluyos (Mailing Lists)
Hello everyone,

Would anyone know a PHP script that can sanitize variables to prevent
XSS and SQL injection?

Thanks and best regards,
Matt

--
Stand before it and there is no beginning.
Follow it and there is no end.
Stay with the ancient Tao,
Move with the present.

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



[PHP] About wrapping a forum into your own design.

2006-03-28 Thread twistednetadmin
I am making a page with css for styling and php for browsing and dynamic
content.
I use a simple switch statement to get the main content of each page into
the same div tag like this:


div id=main?php

switch(@$_GET['maintext']) {

default;
echo Welcome to the official website of bladablada! Feel free to
navigate around and get to now us better;
$maintitle=WELCOME;
break;
case news:
echo A bunch of news;
$maintitle=NEWS;
break;
case about:
include (about.php);
$maintitle=ABOUT;
break;
case gallery:
include (gallery.php);
$maintitle=SCREENSHOTS;
break;
case stats:
include (stats.php);
$maintitle=STATISTICS;
break;
case forum:
include ('forum/index.php');
$maintitle=FORUM;
break;

}
?/div

However. I am not that competent in PHP to make my own forum, so I use a
premade forum. Invision Power Board actually.

What I want to do is to get all the links I press in the forum (after
loading forum/index.php into the div-tag with id=main) to show up in the
same area. Not sure if this is a php question actually, but...

What happens now is that when I press the link Forum in my main navigation
on my site, the index.php of course loads into the div-tag with id=main. BUT
when I press a topic or something within this page (index.php), it opens up
in a new page. I know why, but I wonder if there is a way to get the rest of
the links in the forum to stay within my div-tag other than tracking down
all the variables and such in the forumscripts and alter them? (That's a
hell of alot java and php to work through)

Any help is appreciated.


Re: [PHP] About wrapping a forum into your own design.

2006-03-28 Thread Anthony Ettinger
you should be able to edit the forum template instead...


On 3/28/06, twistednetadmin [EMAIL PROTECTED] wrote:
 I am making a page with css for styling and php for browsing and dynamic
 content.
 I use a simple switch statement to get the main content of each page into
 the same div tag like this:


 div id=main?php

 switch(@$_GET['maintext']) {

 default;
 echo Welcome to the official website of bladablada! Feel free to
 navigate around and get to now us better;
 $maintitle=WELCOME;
 break;
 case news:
 echo A bunch of news;
 $maintitle=NEWS;
 break;
 case about:
 include (about.php);
 $maintitle=ABOUT;
 break;
 case gallery:
 include (gallery.php);
 $maintitle=SCREENSHOTS;
 break;
 case stats:
 include (stats.php);
 $maintitle=STATISTICS;
 break;
 case forum:
 include ('forum/index.php');
 $maintitle=FORUM;
 break;

 }
 ?/div

 However. I am not that competent in PHP to make my own forum, so I use a
 premade forum. Invision Power Board actually.

 What I want to do is to get all the links I press in the forum (after
 loading forum/index.php into the div-tag with id=main) to show up in the
 same area. Not sure if this is a php question actually, but...

 What happens now is that when I press the link Forum in my main navigation
 on my site, the index.php of course loads into the div-tag with id=main. BUT
 when I press a topic or something within this page (index.php), it opens up
 in a new page. I know why, but I wonder if there is a way to get the rest of
 the links in the forum to stay within my div-tag other than tracking down
 all the variables and such in the forumscripts and alter them? (That's a
 hell of alot java and php to work through)

 Any help is appreciated.




--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

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



Re: [PHP] Script to sanitize variables

2006-03-28 Thread Ray Hauge
On Tuesday 28 March 2006 18:05, Matt Arnilo S. Baluyos (Mailing Lists) wrote:
 Hello everyone,

 Would anyone know a PHP script that can sanitize variables to prevent
 XSS and SQL injection?

 Thanks and best regards,
 Matt

 --
 Stand before it and there is no beginning.
 Follow it and there is no end.
 Stay with the ancient Tao,
 Move with the present.

Chris Shiflett has written a number of good articles on the matter. You can 
find them at:

http://shiflett.org/articles

The articles in particular would be:

Security Corner: Cross-Site Request Forgeries
and
Security Corner: Data Filtering
and
Security Corner: SQL Injection

Also, make sure to check out http://phpsec.org

HTH
-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



Re: [PHP] Script to sanitize variables

2006-03-28 Thread Matt Arnilo S. Baluyos (Mailing Lists)
On 3/29/06, Ray Hauge [EMAIL PROTECTED] wrote:
 Chris Shiflett has written a number of good articles on the matter. You can
 find them at:

 http://shiflett.org/articles

 The articles in particular would be:

 Security Corner: Cross-Site Request Forgeries
 Security Corner: Data Filtering
 Security Corner: SQL Injection

Hello Ray,

Thanks for the links, they are very informative and gives a clear
background on this particular aspect of web security. I was looking
for an existing script that I can just plug in to my project though.

After some googling around, I've come across kses
(http://sourceforge.net/projects/kses). From the website, it says that
it's being used in Wordpress and Geeklog. There's also a PHP5 version
included in the release so for OOP purists, that ought to be great
news.


--
Stand before it and there is no beginning.
Follow it and there is no end.
Stay with the ancient Tao,
Move with the present.

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



Re: [PHP] Not sure if this is a php problem or a mysql problem

2006-03-28 Thread Chris

Paul Goepfert wrote:

Hi all,

I have developed a php functilon that is to return the date +1 from a
Mysql database.  My sql statement is as follows

SELECT dayNum FROM Days Where dayNum = day(curdate())+1;

The function works great on the intended webserver but when placed on
a different mysql server (The one I have using to develop the webpage)
the return variable with the intended SQL statement is not being set. 


What do you get on both servers when you run it manually through 
phpmyadmin or some other tool?


Are they the same mysql version - select version(); ?

Same php version?

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

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



Re: [PHP] Script to sanitize variables

2006-03-28 Thread Chris

Matt Arnilo S. Baluyos (Mailing Lists) wrote:

On 3/29/06, Ray Hauge [EMAIL PROTECTED] wrote:


Chris Shiflett has written a number of good articles on the matter. You can
find them at:

http://shiflett.org/articles

The articles in particular would be:

Security Corner: Cross-Site Request Forgeries
Security Corner: Data Filtering
Security Corner: SQL Injection



Hello Ray,

Thanks for the links, they are very informative and gives a clear
background on this particular aspect of web security. I was looking
for an existing script that I can just plug in to my project though.

After some googling around, I've come across kses
(http://sourceforge.net/projects/kses). From the website, it says that
it's being used in Wordpress and Geeklog. There's also a PHP5 version
included in the release so for OOP purists, that ought to be great
news.


Could check out http://pecl.php.net/package/filter if you have enough 
access to the server.


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

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



Re: [PHP] private $foo

2006-03-28 Thread Jasper Bryant-Greene

Anthony Ettinger wrote:


private $foo; cannot be accessed directly outside the script.

print $f-foo; #fails

Fatal error: Cannot access private property Foo::$foo in
/x/home/username/docs/misc/php/client.php on line 11


Did you define the __get and __set functions in your class as in the 
previous post? Are you running a version of PHP that supports them?


Jasper

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