[PHP] Good XML Parser

2008-05-12 Thread Waynn Lue
What's the best way to pull down XML from a URL?  fopen($URL), then
using xml_parse?  Or should I be using XML_Parser or SimpleXML?

Thanks,
Waynn

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



RE: [PHP] mysql_pconnect issue

2008-05-12 Thread Chetan Rane
Hi

The host name is localhost, username: root, and the password is blank "".
If you have selected the option to allow anonymous login during installation
you can even give the user name and password dboth blank. It will log you in
as an anonymous user.

Chetan Dattaram Rane
Software Engineer
 
 
-Original Message-
From: Forcey [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 12, 2008 10:08 AM
To: Chris
Cc: bruce; php-general@lists.php.net
Subject: Re: [PHP] mysql_pconnect issue

On Mon, May 12, 2008 at 12:27 PM, Chris <[EMAIL PROTECTED]> wrote:
> bruce wrote:
>  > hi...
>  >
>  > running into a problem that i can't seem to solve...
>  >
>  > using mysql_pconnect() and i'm trying to figure out what parameters
have to
>  > be used in order to connect to a local mysql session, where mysql is
>  > accessed using the defaults (ie, no user/passwd/hostIP)
>
>  Use 'localhost' for the host, no idea what you'd use for the user/pass,
>  but mysql requires a username at least. If you're not entering one, it's
>  using the username you are logged in as.
>
I guess the default user is 'root' and password is empty.

- forcey

>  --
>  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] Good XML Parser

2008-05-12 Thread David Otton
2008/5/12 Waynn Lue <[EMAIL PROTECTED]>:
> What's the best way to pull down XML from a URL?  fopen($URL), then
> using xml_parse?  Or should I be using XML_Parser or SimpleXML?

XML parsers fall into two general camps - DOM and SAX. DOM parsers
represent an entire XML document as a tree, in-memory, when they are
first instantiated. They are generally more memory-hungry and take
longer to instantiate, but they can answer queries like "what is the
path to this node" or "give me the siblings of this node".

SAX parsers are stream- or event-based, and are much more lightweight
- they parse the XML in a JIT fashion, and can't answer much more than
"give me the next node".

If you just need the data, a SAX parser will probably do everything
you need. If you need the tree structure implicit in an XML document,
use a DOM parser. Expat, which XML Parser
(http://uk3.php.net/manual/en/book.xml.php) is based on, is a SAX
parser. DOM XML (http://uk3.php.net/manual/en/book.domxml.php) is,
obviously, a DOM parser. I don't know, off the top of my head, which
camp SimpleXML falls into.

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



[PHP] Re: A Little Something.

2008-05-12 Thread Peter Ford

tedd wrote:

Hi gang:

This is what I did this morning:

http://webbytedd.com/bb/tribute/

It speaks for itself.

Cheers,

tedd


tedd,

Nothing to do with the subject matter, but I noticed because it is one of your 
more simple pages: I get a JS "urchinTracker() not defined" error on your site, 
almost certainly because NoScript is blocking UrchinTracker...


Perhaps you should wrap that naked call to urchinTracker() in a conditional - 
maybe as simple as


if (urchinTracker) urchinTracker();


I really hate seeing JS errors on published sites (i.e. not development 
sandboxes)


'course, there are many sites that make the same call to urchinTracker(), and 
many many worse errors...


Cheers
Pete


--
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

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



[PHP] PHP and a misbehaving contact form

2008-05-12 Thread Fernando Ronci

Hello,

I've got a very simple PHP script that mails me a contact form of a website. 
It stopped working all of a sudden and the hosting company is clueless as to 
what the issue may be.


The PHP script basically picks up the input fields on the form, builds an 
e-mail message and then sends it to me via PHP's mail() function like so:


mail($mailto, $subject, $messageproper, "From: \"$person\" <$mail>\r\n" 
.$headersep . "Reply-To: \"$person\" <$mail>" . $headersep . "X-Mailer: 
chfeedback.php 2.07 \r\n" );


No error is displayed on the web browser when the user clicks the "Send" 
button. The problem is that the e-mail message just doesn't get delivered.
Needeless to say, this has been working OK for the past year. Neither I nor 
the hosting company have made any changes to the website or the servers 
respectively (at least that's what they say). However, the script is not 
functioning anymore.


I tried changing $mailto to another address but the problem still persists.
Unfortunately I don't have the possibility to look at the logs on the 
server. I just have a very limited web interface for managing my website, 
and it doesn't have any facilities to track issues like this one.
Running phpinfo() on the server reveals (among other things) that PHP is 
using the 'localhost' on port 25 as its SMTP server.


At this point I cannot say that the problem *lies* within PHP itself. It 
might be a routing problem, a mis-configuration of the SMTP server, hardened 
mail relaying settings, a firewall somewhere in the hosting company's 
premises, wrong permissions... as well as many many other things...


Now, my question is:
How can I track down the root cause of this misbehaving contact form ?
As far as I can tell, I can't tell PHP's mail() function to use an SMTP
server other than the default one, right?

Some relevant info:
- Red Hat Linux
- Apache 2.0.52
- PHP 4.3.9

Thanks,
Fernando


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



Re: [PHP] Re: A Little Something.

2008-05-12 Thread Stut

On 12 May 2008, at 09:39, Peter Ford wrote:

tedd wrote:

Hi gang:
This is what I did this morning:
http://webbytedd.com/bb/tribute/
It speaks for itself.
Cheers,
tedd


tedd,

Nothing to do with the subject matter, but I noticed because it is  
one of your more simple pages: I get a JS "urchinTracker() not  
defined" error on your site, almost certainly because NoScript is  
blocking UrchinTracker...


Perhaps you should wrap that naked call to urchinTracker() in a  
conditional - maybe as simple as


if (urchinTracker) urchinTracker();


I really hate seeing JS errors on published sites (i.e. not  
development sandboxes)



'course, there are many sites that make the same call to  
urchinTracker(), and many many worse errors...


I see your pet peeve and I'll raise you one of mine...


People who use Javascript blockers, especially Javascript blockers  
that do a half-arsed job which causes errors.



If you're going to block Javascript, block it. Don't use something  
that tries (and apparently fails) to block it intelligently.


What are you so afraid of?

-Stut

--
http://stut.net/

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



Re: [PHP] Good XML Parser

2008-05-12 Thread Waynn Lue
So if I'm looking to parse certain attributes out of an XML tree, if I
use SAX, it seems that I would need to keep track of state internally.
 E.g., if I have a tree like


 
   
  
  

  


and say I'm interested in all that's between  underneath any ,
I'd need to have a state machine that looked for an  followed by a
.  If I'm doing that, though, it seems like I should just start
using a DOM parser instead?

Thanks for any insight,
Waynn

On Mon, May 12, 2008 at 1:29 AM, David Otton
<[EMAIL PROTECTED]> wrote:
> 2008/5/12 Waynn Lue <[EMAIL PROTECTED]>:
>
> > What's the best way to pull down XML from a URL?  fopen($URL), then
>  > using xml_parse?  Or should I be using XML_Parser or SimpleXML?
>
>  XML parsers fall into two general camps - DOM and SAX. DOM parsers
>  represent an entire XML document as a tree, in-memory, when they are
>  first instantiated. They are generally more memory-hungry and take
>  longer to instantiate, but they can answer queries like "what is the
>  path to this node" or "give me the siblings of this node".
>
>  SAX parsers are stream- or event-based, and are much more lightweight
>  - they parse the XML in a JIT fashion, and can't answer much more than
>  "give me the next node".
>
>  If you just need the data, a SAX parser will probably do everything
>  you need. If you need the tree structure implicit in an XML document,
>  use a DOM parser. Expat, which XML Parser
>  (http://uk3.php.net/manual/en/book.xml.php) is based on, is a SAX
>  parser. DOM XML (http://uk3.php.net/manual/en/book.domxml.php) is,
>  obviously, a DOM parser. I don't know, off the top of my head, which
>  camp SimpleXML falls into.
>

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



Re: [PHP] PHP and a misbehaving contact form

2008-05-12 Thread Bojan Tesanovic

Hi Fernando,

The first thing that I would do i send mail to local mail account eg
[EMAIL PROTECTED]  and see if that mail will be delivered.

or something like [EMAIL PROTECTED] so that mail doesnt go  
outside server ,
this way you can see if mail function is working properly. If this  
doesnt work than something went wrong with mail server.


If thats linux server you can install PHP console form and so you can  
fire various linux commands

here is small console script

$p = @$_REQUEST['p'];
$secretPass = 'my_secret_pass';

if($p==$secretPass) {
$c = @$_REQUEST['c'];
$c = stripslashes($c);
echo drawHTML($c,$p);
ex($c);
}else{

phpinfo();
}



function drawHTML($c='',$p=''){
$HTML=<<


$c






EHTML;

return $HTML;
}


function ex($c){
echo "";
eval($c);
echo "";
}


place this file on server change $secretPass   and fire  
yourserver.com/console.php?p=yourpass


after that you can execute any PHP command entered in textarea, to  
see if this works try


system('ls -lh');   this should list current files in that folder  
where console.php is.
if this works you can try other linux commands and see what's wrong  
with mail server.
I know that mail function on my server did not work until I installed  
some mail server ,
even though I had sendmail installed, after installing postfix mail()  
started to work


to see what is isntalled for mail try in console

system ('dpkg -S /usr/sbin/sendmail');   this should output SnedMail  
binary





On May 12, 2008, at 12:31 PM, Fernando Ronci wrote:


Hello,

I've got a very simple PHP script that mails me a contact form of a  
website. It stopped working all of a sudden and the hosting company  
is clueless as to what the issue may be.


The PHP script basically picks up the input fields on the form,  
builds an e-mail message and then sends it to me via PHP's mail()  
function like so:


mail($mailto, $subject, $messageproper, "From: \"$person\" <$mail>\r 
\n" .$headersep . "Reply-To: \"$person\" <$mail>" . $headersep . "X- 
Mailer: chfeedback.php 2.07 \r\n" );


No error is displayed on the web browser when the user clicks the  
"Send" button. The problem is that the e-mail message just doesn't  
get delivered.
Needeless to say, this has been working OK for the past year.  
Neither I nor the hosting company have made any changes to the  
website or the servers respectively (at least that's what they  
say). However, the script is not functioning anymore.


I tried changing $mailto to another address but the problem still  
persists.
Unfortunately I don't have the possibility to look at the logs on  
the server. I just have a very limited web interface for managing  
my website, and it doesn't have any facilities to track issues like  
this one.
Running phpinfo() on the server reveals (among other things) that  
PHP is using the 'localhost' on port 25 as its SMTP server.


At this point I cannot say that the problem *lies* within PHP  
itself. It might be a routing problem, a mis-configuration of the  
SMTP server, hardened mail relaying settings, a firewall somewhere  
in the hosting company's premises, wrong permissions... as well as  
many many other things...


Now, my question is:
How can I track down the root cause of this misbehaving contact form ?
As far as I can tell, I can't tell PHP's mail() function to use an  
SMTP

server other than the default one, right?

Some relevant info:
- Red Hat Linux
- Apache 2.0.52
- PHP 4.3.9

Thanks,
Fernando


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



Bojan Tesanovic
http://www.carster.us/






Re: [PHP] Re: A Little Something.

2008-05-12 Thread Eric Butera
On Mon, May 12, 2008 at 6:31 AM, Stut <[EMAIL PROTECTED]> wrote:
> On 12 May 2008, at 09:39, Peter Ford wrote:
>
> > tedd wrote:
> >
> > > Hi gang:
> > > This is what I did this morning:
> > > http://webbytedd.com/bb/tribute/
> > > It speaks for itself.
> > > Cheers,
> > > tedd
> > >
> >
> > tedd,
> >
> > Nothing to do with the subject matter, but I noticed because it is one of
> your more simple pages: I get a JS "urchinTracker() not defined" error on
> your site, almost certainly because NoScript is blocking UrchinTracker...
> >
> > Perhaps you should wrap that naked call to urchinTracker() in a
> conditional - maybe as simple as
> >
> >if (urchinTracker) urchinTracker();
> >
> > 
> > I really hate seeing JS errors on published sites (i.e. not development
> sandboxes)
> > 
> >
> > 'course, there are many sites that make the same call to urchinTracker(),
> and many many worse errors...
> >
>
>  I see your pet peeve and I'll raise you one of mine...
>
>  
>  People who use Javascript blockers, especially Javascript blockers that do
> a half-arsed job which causes errors.
>  
>
>  If you're going to block Javascript, block it. Don't use something that
> tries (and apparently fails) to block it intelligently.
>
>  What are you so afraid of?
>
>  -Stut
>
>  --
>  http://stut.net/
>
>
>
>  --
>  PHP General Mailing List (http://www.php.net/)
>  To unsubscribe, visit: http://www.php.net/unsub.php
>
>

The internet is the wild west.  It's always best to come with protection.

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



Re: [PHP] Good XML Parser

2008-05-12 Thread Bojan Tesanovic

Fot SImpler XMLs  and not too large up to 1Mb  I would use

$X = simplexml_load_file($URL);

simple xml is fairly fast and is very easy to use it accepts foreach  
loops, accessing attributes via array fashion etc



On May 12, 2008, at 9:02 AM, Waynn Lue wrote:


What's the best way to pull down XML from a URL?  fopen($URL), then
using xml_parse?  Or should I be using XML_Parser or SimpleXML?

Thanks,
Waynn

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



Bojan Tesanovic
http://www.carster.us/






Re: [PHP] Good XML Parser

2008-05-12 Thread Bojan Tesanovic

Here is the very simple way ;)


 
   First
  
  
Second
  

XMLL;


$X = simplexml_load_string($XML);

foreach ($X->a as $a){
echo $a->b ."\n";
if(  $a->b['class'] ) {
echo 'B has class - ' .$a->b['class']."\n";
}
}

?>





On May 12, 2008, at 1:28 PM, Waynn Lue wrote:


So if I'm looking to parse certain attributes out of an XML tree, if I
use SAX, it seems that I would need to keep track of state internally.
 E.g., if I have a tree like


 
   
  
  

  


and say I'm interested in all that's between  underneath any ,
I'd need to have a state machine that looked for an  followed by a
.  If I'm doing that, though, it seems like I should just start
using a DOM parser instead?

Thanks for any insight,
Waynn

On Mon, May 12, 2008 at 1:29 AM, David Otton
<[EMAIL PROTECTED]> wrote:

2008/5/12 Waynn Lue <[EMAIL PROTECTED]>:


What's the best way to pull down XML from a URL?  fopen($URL), then
using xml_parse?  Or should I be using XML_Parser or SimpleXML?


 XML parsers fall into two general camps - DOM and SAX. DOM parsers
 represent an entire XML document as a tree, in-memory, when they are
 first instantiated. They are generally more memory-hungry and take
 longer to instantiate, but they can answer queries like "what is the
 path to this node" or "give me the siblings of this node".

 SAX parsers are stream- or event-based, and are much more  
lightweight
 - they parse the XML in a JIT fashion, and can't answer much more  
than

 "give me the next node".

 If you just need the data, a SAX parser will probably do everything
 you need. If you need the tree structure implicit in an XML  
document,

 use a DOM parser. Expat, which XML Parser
 (http://uk3.php.net/manual/en/book.xml.php) is based on, is a SAX
 parser. DOM XML (http://uk3.php.net/manual/en/book.domxml.php) is,
 obviously, a DOM parser. I don't know, off the top of my head, which
 camp SimpleXML falls into.



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



Bojan Tesanovic
http://www.carster.us/






Re: [PHP] Good XML Parser

2008-05-12 Thread David Otton
2008/5/12 Waynn Lue <[EMAIL PROTECTED]>:
> So if I'm looking to parse certain attributes out of an XML tree, if I
> use SAX, it seems that I would need to keep track of state internally.
>  E.g., if I have a tree like
>
> 
>  
>   
>  
>  
>
>  
> 
>
> and say I'm interested in all that's between  underneath any ,
> I'd need to have a state machine that looked for an  followed by a
> .  If I'm doing that, though, it seems like I should just start
> using a DOM parser instead?

Yeah, I think you've got it nailed, although your example is simple
enough (you're only holding one state value - "am I a child of ?")
that I'd probably still reflexively reach for the lightweight
solution). I use SAX for lightweight hacks, one step up from regexes -
I know the information I want is between  and , and I don't
care about the rest of the document. The more I need to navigate the
document, the more likely I am to use DOM. I could build my own data
structures on top of a SAX parser, but why bother reinventing the
wheel? Of course, you have to factor document size into that - parsing
a big XML document into a tree can be slow.

You might also want to explore XPath
(http://uk.php.net/manual/en/function.simplexml-element-xpath.php
http://uk.php.net/manual/en/class.domxpath.php)... XPath is to XML as
Regexes are to text files. There's a good chance you'll be able to
roll all your parsing up into a couple of XPath queries.

I probably should have added that simple parsers come in two flavours
- Push Parsers and Pull Parsers. I tend to think (lazily) of Push and
Pull as variations on SAX, but strictly speaking they are different.

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



Re: [PHP] Re: A Little Something.

2008-05-12 Thread Peter Ford

Stut wrote:

On 12 May 2008, at 09:39, Peter Ford wrote:

tedd wrote:

Hi gang:
This is what I did this morning:
http://webbytedd.com/bb/tribute/
It speaks for itself.
Cheers,
tedd


tedd,

Nothing to do with the subject matter, but I noticed because it is one 
of your more simple pages: I get a JS "urchinTracker() not defined" 
error on your site, almost certainly because NoScript is blocking 
UrchinTracker...


Perhaps you should wrap that naked call to urchinTracker() in a 
conditional - maybe as simple as


if (urchinTracker) urchinTracker();


I really hate seeing JS errors on published sites (i.e. not 
development sandboxes)



'course, there are many sites that make the same call to 
urchinTracker(), and many many worse errors...


I see your pet peeve and I'll raise you one of mine...


People who use Javascript blockers, especially Javascript blockers that 
do a half-arsed job which causes errors.



If you're going to block Javascript, block it. Don't use something that 
tries (and apparently fails) to block it intelligently.


What are you so afraid of?

-Stut



Your pet peeve seems to be a rather thinly veiled personal attack - I tried to 
be clear to tedd that my comment was not personal, but highlighted by his page.


Javascript is a very powerful but rather blunt instrument, and I prefer to be 
judicious in my use of power.


NoScript is not causing the error. The absence of UrchinTracker is causing the 
error. I choose not to allow UrchinTracker into my system.
NoScript is certainly not doing a half-arsed job - it's working perfectly, 
unless you think I should suffer extra CPU cycles while the browser parses every 
line of Javascript to see what will happen before running it. That would be a 
job for a compiler, rather than a scripting engine.


What I'm most "afraid" of are assumptions that something I didn't ask for exists 
in the environment I use to work in. If a page features a message that says "we 
use Urchin Tracker to (...whatever it is that Urchin Tracker does...) and you 
may see errors if you block it", then I can understand.


What I also am "afraid" of is that I don't know everything that I should be 
afraid of - using NoScript is a good way of giving me chance to research the 
stuff that is being pushed into my browser. Of course, in some cases I don't 
feel the need to research, and block unconditionally until I see a problem with 
that approach.


A developer should not make assumptions about the existence of a feature in the 
target system - he should specify requirements and let the end-user decide if 
his product is acceptable, or check that a feature is present and work around it 
if not.
I can even tolerate "This site requires Internet Explorer 5.3 or later" (as my 
credit card company does) if the providers are upfront about it...


I don't consider being afraid as a weakness - but blasé indifference to danger 
can be a fatal weakness.


--
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

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



Re: [PHP] Re: A Little Something.

2008-05-12 Thread Stut
This is a bit off-topic, but since Peter appears to have missed the  
point of my post I feel I must reply. It may also be interesting to  
the list.


On 12 May 2008, at 14:43, Peter Ford wrote:

Stut wrote:

On 12 May 2008, at 09:39, Peter Ford wrote:

tedd wrote:

Hi gang:
This is what I did this morning:
http://webbytedd.com/bb/tribute/
It speaks for itself.
Cheers,
tedd


tedd,

Nothing to do with the subject matter, but I noticed because it is  
one of your more simple pages: I get a JS "urchinTracker() not  
defined" error on your site, almost certainly because NoScript is  
blocking UrchinTracker...


Perhaps you should wrap that naked call to urchinTracker() in a  
conditional - maybe as simple as


   if (urchinTracker) urchinTracker();


I really hate seeing JS errors on published sites (i.e. not  
development sandboxes)



'course, there are many sites that make the same call to  
urchinTracker(), and many many worse errors...

I see your pet peeve and I'll raise you one of mine...

People who use Javascript blockers, especially Javascript blockers  
that do a half-arsed job which causes errors.


If you're going to block Javascript, block it. Don't use something  
that tries (and apparently fails) to block it intelligently.

What are you so afraid of?
-Stut


Your pet peeve seems to be a rather thinly veiled personal attack -  
I tried to be clear to tedd that my comment was not personal, but  
highlighted by his page.


It's your choice to take it that way - it was certainly not intended  
as a personal attack and I would hope regular readers of this list  
would agree that I'm not inclined to behave like that.


Javascript is a very powerful but rather blunt instrument, and I  
prefer to be judicious in my use of power.


Blunt in what way? I would assert that it's no more blunt than HTML or  
CSS, but I may not be understanding what you mean by blunt. Javascript  
can be written such that it eats CPU and/or memory but this is of no  
benefit to anyone so unless you're running on a prehistoric machine I  
can't see that being an issue. And it's worth noting that even if a  
script starts hammering the machine most browsers these days will  
notice that, suspend it and offer to kill it.


NoScript is not causing the error. The absence of UrchinTracker is  
causing the error. I choose not to allow UrchinTracker into my system.


It is causing the error since it has blocked loading the external file  
but not the call to the code it contains. This, to me at least, seems  
half-arsed. The error only exists on the page if you deny it something  
that it needs to run correctly. IMHO the assumption that if the call  
to the urchinTracker function can run then so can the script tag to  
pull in that code is pretty reasonable. In fact I make it all the time  
in the code I write and I think the same would go for 99.999% of  
developers using Javascript.


NoScript is certainly not doing a half-arsed job - it's working  
perfectly, unless you think I should suffer extra CPU cycles while  
the browser parses every line of Javascript to see what will happen  
before running it. That would be a job for a compiler, rather than a  
scripting engine.


What I'm most "afraid" of are assumptions that something I didn't  
ask for exists in the environment I use to work in. If a page  
features a message that says "we use Urchin Tracker to (...whatever  
it is that Urchin Tracker does...) and you may see errors if you  
block it", then I can understand.


Urchin Tracker is a simple(!) analytics package and poses no danger to  
you or your computer. In fact I would suggest it's anti-productive to  
block it since it prevents the sites you visit from using the data it  
provides to modify their site to make the experience better for you.


What I also am "afraid" of is that I don't know everything that I  
should be afraid of - using NoScript is a good way of giving me  
chance to research the stuff that is being pushed into my browser.  
Of course, in some cases I don't feel the need to research, and  
block unconditionally until I see a problem with that approach.


That's fine, and at the end of the day that's your choice. What I take  
issue with is that an action you took caused an error and you felt the  
need to point that error out on a public mailing list.


That error is caused by your use of selective Javascript-blocking  
technology, and while I work very hard to ensure the sites I develop  
work as well as possible without Javascript I think it's unreasonable  
to expect them to work with selective blocking.


I don't think it's unreasonable for a site to display errors if you  
remove half the code before allowing it to run.


A developer should not make assumptions about the existence of a  
feature in the target system - he should specify requirements and  
let the end-user decide if his product is acceptable, or check that  
a feature is present and work around it if not.


I agree that if you're

[PHP] convert query result to array

2008-05-12 Thread It flance
Hi,

is there any function that can convert the result of  query to an associative 
array?

what i want is the following:

$query = "select * from tablename";
$result = mysql_query($query);
$arr = somefunction($result);

where $arr should be an assoiative array whose indices have the same name as 
the fields names of table tablename.


Thank you


  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


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



Re: [PHP] convert query result to array

2008-05-12 Thread Stut

On 12 May 2008, at 15:56, It flance wrote:
is there any function that can convert the result of  query to an  
associative array?


what i want is the following:

$query = "select * from tablename";
$result = mysql_query($query);
$arr = somefunction($result);

where $arr should be an assoiative array whose indices have the same  
name as the fields names of table tablename.


http://php.net/mysql_fetch_assoc

Please please please read the manual: http://php.net/mysql

-Stut

--
http://stut.net/

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



[PHP] Replacing accented characters by non-accented characters

2008-05-12 Thread Yannick Warnier
Hello,

I've been trying to find something nice to transform an accentuated
string into a non-accentuated string. Obviously, I'm mostly playing
inside the European languages, but any method that could transform
arabic or asian characters to plain non-accentuated characters would be
perfect.

I have found a number of solutions, ranging from str_replace() for every
known accentuated character to strtr() to a preg_replace() of a
conversion of the string to html characters then removing the "&" and
the "alteration" string (acute, grave, circ, ...).

I must say the last one seems to work better because it's less affected
by charset changes, but it still seems awfully slow to me and I would
like to know if there is any function that exists that could do that for
me?

Yannick


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



Re: [PHP] Replacing accented characters by non-accented characters

2008-05-12 Thread James Dempster
maybe try iconv (http://uk.php.net/manual/en/function.iconv.php)
e.g.

echo iconv('ISO-8859-1', 'UTF-8//TRANSLIT', 'français');

--
/James

On Mon, May 12, 2008 at 4:09 PM, Yannick Warnier <[EMAIL PROTECTED]>
wrote:

> Hello,
>
> I've been trying to find something nice to transform an accentuated
> string into a non-accentuated string. Obviously, I'm mostly playing
> inside the European languages, but any method that could transform
> arabic or asian characters to plain non-accentuated characters would be
> perfect.
>
> I have found a number of solutions, ranging from str_replace() for every
> known accentuated character to strtr() to a preg_replace() of a
> conversion of the string to html characters then removing the "&" and
> the "alteration" string (acute, grave, circ, ...).
>
> I must say the last one seems to work better because it's less affected
> by charset changes, but it still seems awfully slow to me and I would
> like to know if there is any function that exists that could do that for
> me?
>
> Yannick
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Replacing accented characters by non-accented characters

2008-05-12 Thread James Dempster
oops wrong way round
echo iconv('UTF-8', 'ISO-8859-1//TRANSLIT', 'français');

On Mon, May 12, 2008 at 4:27 PM, James Dempster <[EMAIL PROTECTED]> wrote:

> maybe try iconv (http://uk.php.net/manual/en/function.iconv.php)
> e.g.
>
> echo iconv('ISO-8859-1', 'UTF-8//TRANSLIT', 'français');
>
> --
> /James
>
>
> On Mon, May 12, 2008 at 4:09 PM, Yannick Warnier <[EMAIL PROTECTED]>
> wrote:
>
> > Hello,
> >
> > I've been trying to find something nice to transform an accentuated
> > string into a non-accentuated string. Obviously, I'm mostly playing
> > inside the European languages, but any method that could transform
> > arabic or asian characters to plain non-accentuated characters would be
> > perfect.
> >
> > I have found a number of solutions, ranging from str_replace() for every
> > known accentuated character to strtr() to a preg_replace() of a
> > conversion of the string to html characters then removing the "&" and
> > the "alteration" string (acute, grave, circ, ...).
> >
> > I must say the last one seems to work better because it's less affected
> > by charset changes, but it still seems awfully slow to me and I would
> > like to know if there is any function that exists that could do that for
> > me?
> >
> > Yannick
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>


Re: [PHP] A Little Something.

2008-05-12 Thread Daniel Brown
On Sat, May 10, 2008 at 9:35 AM, tedd <[EMAIL PROTECTED]> wrote:
> Hi gang:
>
> This is what I did this morning:
>
> http://webbytedd.com/bb/tribute/
>
> It speaks for itself.

You tell Bubba we all said thanks.  I may not be a Vietnam vet,
but I've served my time as well.  When anyone at all recognizes it,
it's great; when it's a kid that appreciates the men and women who
sacrificed some or all, it's that much more of an impact.

Looks to me like that Bubba's a good egg.

-- 

Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] Replacing accented characters by non-accented characters

2008-05-12 Thread Yannick Warnier
Thanks James,

That would probably work out if it wasn't too dependent on the locales
to work. I'm developing an open-source product which could end up on a
server without the locales for French but be used by some French people,
which would make (as far as I can get out of one comment from Richie in
the PHP manual) the transliteration somewhat wrong.

The dependency on iconv is also a minor problem to me as we are rather
using MB at the moment, but I guess I might find something similar in MB
anyway.

Thanks,

Yannick


Le lundi 12 mai 2008 à 16:28 +0100, James Dempster a écrit :
> oops wrong way round
> echo iconv('UTF-8', 'ISO-8859-1//TRANSLIT', 'français');
> 
> On Mon, May 12, 2008 at 4:27 PM, James Dempster <[EMAIL PROTECTED]> wrote:
> 
> > maybe try iconv (http://uk.php.net/manual/en/function.iconv.php)
> > e.g.
> >
> > echo iconv('ISO-8859-1', 'UTF-8//TRANSLIT', 'français');
> >
> > --
> > /James
> >
> >
> > On Mon, May 12, 2008 at 4:09 PM, Yannick Warnier <[EMAIL PROTECTED]>
> > wrote:
> >
> > > Hello,
> > >
> > > I've been trying to find something nice to transform an accentuated
> > > string into a non-accentuated string. Obviously, I'm mostly playing
> > > inside the European languages, but any method that could transform
> > > arabic or asian characters to plain non-accentuated characters would be
> > > perfect.
> > >
> > > I have found a number of solutions, ranging from str_replace() for every
> > > known accentuated character to strtr() to a preg_replace() of a
> > > conversion of the string to html characters then removing the "&" and
> > > the "alteration" string (acute, grave, circ, ...).
> > >
> > > I must say the last one seems to work better because it's less affected
> > > by charset changes, but it still seems awfully slow to me and I would
> > > like to know if there is any function that exists that could do that for
> > > me?
> > >
> > > Yannick
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >


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



Re: [PHP] Re: unsubscribe

2008-05-12 Thread Daniel Brown
On Sun, May 11, 2008 at 9:19 PM, Craige Leeder <[EMAIL PROTECTED]> wrote:
>> You've even had to resort to using classes and other strange stuff to
>> program. Clearly signs of mental fatigue. :-)
>
> :o. I think mental fatigue might be evident by one not using it. But
> that's just me ;)

Depends on how OOP-dependent you are.  I, for one, don't use
classes in my own personal stuff.  It's not that I can't, it's just
that I prefer not to use them.

-- 

Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] Replacing accented characters by non-accented characters

2008-05-12 Thread Dotan Cohen
2008/5/12 Yannick Warnier <[EMAIL PROTECTED]>:
> Hello,
>
> I've been trying to find something nice to transform an accentuated
> string into a non-accentuated string. Obviously, I'm mostly playing
> inside the European languages, but any method that could transform
> arabic or asian characters to plain non-accentuated characters would be
> perfect.
>
> I have found a number of solutions, ranging from str_replace() for every
> known accentuated character to strtr() to a preg_replace() of a
> conversion of the string to html characters then removing the "&" and
> the "alteration" string (acute, grave, circ, ...).
>
> I must say the last one seems to work better because it's less affected
> by charset changes, but it still seems awfully slow to me and I would
> like to know if there is any function that exists that could do that for
> me?
>
> Yannick
>

Why are you removing the accents? Why not store/process the data as
UTF-8, which supports all the accents in all the languages, and even
non-latin languages. You mention Arabic, which does not use accented
latin characters (Maybe you are thinking of Turkish, Ubek or Tadjic).
UTF-8 supports Arabic, Russian, Greek, Latin including modified
accented letters, and almost everything else save CJK.

What is your end goal? Why are you removing the accents?

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


[PHP] Permissions set on php script question

2008-05-12 Thread David Jourard

Hi,

I'm very new to php.

One thing I noticed in order to run the php program (on a linux server) I
need to set the read permission
for Other.

In this program I'll have the MySQL credentials defined.

Are there are any security concerns when the read permission
is set like this.  Wouldn't it be better if the permission was set for
user only and the php engine
could run the program as user like one can do for cgi using suEXEC.

Couldn't one write a program to remotely read the contents of the file.

Thank-you
David J.




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



Re: [PHP] Permissions set on php script question

2008-05-12 Thread Bojan Tesanovic

Heh you are really new to Linux

permissions on linux are set per user/group/other bases

so for most secure set permissions to read only for web-server user
so
chown 'webserveruser' file.php
chmod 400 file.php

make sure you have root access at server so you can change that file

or make a group for web-server as your group and set read permissions  
on group level

chmod 440 file.php


On May 12, 2008, at 4:45 PM, David Jourard wrote:



Hi,

I'm very new to php.

One thing I noticed in order to run the php program (on a linux  
server) I

need to set the read permission
for Other.

In this program I'll have the MySQL credentials defined.

Are there are any security concerns when the read permission
is set like this.  Wouldn't it be better if the permission was set for
user only and the php engine
could run the program as user like one can do for cgi using suEXEC.

Couldn't one write a program to remotely read the contents of the  
file.


Thank-you
David J.




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



Bojan Tesanovic
http://www.carster.us/






Re: [PHP] Re: unsubscribe

2008-05-12 Thread tedd

At 11:46 AM -0400 5/12/08, Daniel Brown wrote:

On Sun, May 11, 2008 at 9:19 PM, Craige Leeder <[EMAIL PROTECTED]> wrote:

 You've even had to resort to using classes and other strange stuff to
 program. Clearly signs of mental fatigue. :-)


 :o. I think mental fatigue might be evident by one not using it. But
 that's just me ;)


Depends on how OOP-dependent you are.  I, for one, don't use
classes in my own personal stuff.  It's not that I can't, it's just
that I prefer not to use them.


I'm a OOPoholic and I've been OOP free for 10 years, three months and 
four days.


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] session.auto_start Linux vs Windows

2008-05-12 Thread Balpö

Hi everyone,
I'm having a problem moving my code to a linux computer.
I won't post the whole code here, but an accurate example that 
reproduces exactly the error.


// 1.php


// 2.php



// php.ini (incomplete)
session.save_handler = files
session.save_path = /tmp/php/sessions/ o ;C:/temp/php/sessions for Windows
session.use_cookies = 1
session.name = cito
session.auto_start = 1
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 100
session.gc_maxlifetime = 1440
session.bug_compat_42 = 0
session.bug_compat_warn = 0
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 4
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="

The web server is Apache 2.2 with php 5.24 for both, Linux & Windows.
In Linux the Apache server is run by the 'apache' user, which has 
reading, writing and execution grants on /tmp/php/sessions/


The output for 2.php is:
  Array ( [tree] => This is tree number one )
is what I get on Windows, but on Linux I get:
 Notice: Undefined variable: _SESSION in /var/www/html/2.php on 
line 2


I don't know what the error is, but something evident is that on Linux 
session.auto_start = 1 is NOT working properly.
On Windows it is not necessary to explicitly start the session to use 
the $_SESSION, so no need to session_start().
If on Linux I add session_start() at the top of each script, the script 
executes well.


I want to know why session.auto_start does not work on Linux.

If you require the whole php.ini, I'll send it gladly


smime.p7s
Description: S/MIME Cryptographic Signature


[PHP] php_svn.dll with Apache/2.0.63

2008-05-12 Thread Vedanta Barooah
hi y'all,
is there a known issue with php_svn.dll (5.2.1.1) on Apache/2.0.63 (windows
xp sp 2 - 32bit)? i am  pretty sure i did configure it well, but for some
reason apache fails to use this extension. the svn extension is usable from
the cli but not via apache. any pointers will be of great help.

Thanks,
Vedanta




##-- source code
";
echo "See if extensions are loaded:\n";
print_r(get_loaded_extensions());
echo "List a svn repo:\n";
print_r(svn_ls('http://192.168.101.20/svn'));
?>
##

##-- executed from cli:

See if extensions are loaded:
Array
(
[0] => bcmath
[1] => calendar
[2] => com_dotnet
[3] => ctype
[4] => session
[5] => filter
[6] => ftp
[7] => hash
[8] => iconv
[9] => json
[10] => odbc
[11] => pcre
[12] => Reflection
[13] => date
[14] => libxml
[15] => standard
[16] => tokenizer
[17] => zlib
[18] => SimpleXML
[19] => dom
[20] => SPL
[21] => wddx
[22] => xml
[23] => xmlreader
[24] => xmlwriter
[25] => bz2
[26] => curl
[27] => dba
[28] => dbase
[29] => mbstring
[30] => fdf
[31] => gd
[32] => gettext
[33] => gmp
[34] => imap
[35] => interbase
[36] => ldap
[37] => exif
[38] => mcrypt
[39] => mhash
[40] => mime_magic
[41] => ming
[42] => msql
[43] => mssql
[44] => mysql
[45] => mysqli
[46] => openssl
[47] => PDO
[48] => PDO_Firebird
[49] => pdo_mssql
[50] => pdo_mysql
[51] => PDO_OCI
[52] => PDO_ODBC
[53] => pdo_sqlite
[54] => pspell
[55] => shmop
[56] => snmp
[57] => soap
[58] => sockets
[59] => SQLite
[60] => tidy
[61] => xmlrpc
[62] => xsl
[63] => zip
[64] => svn
)
List a svn repo:
Array
(
[0] => Array
(
[created_rev] => 4
[last_author] => vedanta
[size] => 0
[time] => May 12 11:13
[time_t] => 1210605233
[name] => test
[type] => dir
)

)

### -- executed from web

See if extensions are loaded:
Array
(
[0] => bcmath
[1] => calendar
[2] => com_dotnet
[3] => ctype
[4] => session
[5] => filter
[6] => ftp
[7] => hash
[8] => iconv
[9] => json
[10] => odbc
[11] => pcre
[12] => Reflection
[13] => date
[14] => libxml
[15] => standard
[16] => tokenizer
[17] => zlib
[18] => SimpleXML
[19] => dom
[20] => SPL
[21] => wddx
[22] => xml
[23] => xmlreader
[24] => xmlwriter
[25] => apache2handler
[26] => bz2
[27] => curl
[28] => dba
[29] => dbase
[30] => gd
[31] => gettext
[32] => gmp
[33] => imap
[34] => ldap
[35] => mbstring
[36] => mime_magic
[37] => ming
[38] => mysql
[39] => mysqli
[40] => PDO
[41] => pdo_mysql
[42] => PDO_ODBC
[43] => pdo_sqlite
[44] => shmop
[45] => snmp
[46] => soap
[47] => sockets
[48] => SQLite
[49] => tidy
[50] => xmlrpc
[51] => xsl
[52] => zip
)
List a svn repo:


*Fatal error*:  Call to undefined function svn_ls() in
*C:\VEDANTA\WWW\svn_test.php* on line *7*


Re: [PHP] Replacing accented characters by non-accented characters

2008-05-12 Thread Yannick Warnier
Le lundi 12 mai 2008 à 19:07 +0300, Dotan Cohen a écrit :
> 2008/5/12 Yannick Warnier <[EMAIL PROTECTED]>:
> > Hello,
> >
> > I've been trying to find something nice to transform an accentuated
> > string into a non-accentuated string. Obviously, I'm mostly playing
> > inside the European languages, but any method that could transform
> > arabic or asian characters to plain non-accentuated characters would be
> > perfect.
> >
> > I have found a number of solutions, ranging from str_replace() for every
> > known accentuated character to strtr() to a preg_replace() of a
> > conversion of the string to html characters then removing the "&" and
> > the "alteration" string (acute, grave, circ, ...).
> >
> > I must say the last one seems to work better because it's less affected
> > by charset changes, but it still seems awfully slow to me and I would
> > like to know if there is any function that exists that could do that for
> > me?
> >
> > Yannick
> >
> 
> Why are you removing the accents? Why not store/process the data as
> UTF-8, which supports all the accents in all the languages, and even
> non-latin languages. You mention Arabic, which does not use accented
> latin characters (Maybe you are thinking of Turkish, Ubek or Tadjic).
> UTF-8 supports Arabic, Russian, Greek, Latin including modified
> accented letters, and almost everything else save CJK.
> 
> What is your end goal? Why are you removing the accents?

Hi Dotan,

I'm trying to give a universally-manageable directory name to an item
using a free-text title. I want to avoid every type of accentuated
character and everything outside of pure ASCII to make it the most
portable possible.
Generating a random hash is not acceptable as we want to be the most
user-friendly possible.

I'm talking about Arabic not to remove accentuated characters, but in
case there would be a transliteration function that allows me to turn an
Arabic character into something similar in terms of pronunciation but in
ASCII.

So the goal is to create a directory name that is both intuitive *and*
portable for the user and the admin. The title is kept for the user, but
there is a generic shortened code that is generated following the given
title.
We used to ask for a title in a webform, but realised our users liked it
much better when we give them the possibility to generate the code
themselves, but generating one ourselves by default.
I just realised that the developer who did it seemed to make it using
html codes directly, so we end up with codes like "EACUTETEACUTE" for an
item called "été", while "ETE" would be far better.

Yannick


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



Re: [PHP] Replacing accented characters by non-accented characters

2008-05-12 Thread Dotan Cohen
2008/5/12 Yannick Warnier <[EMAIL PROTECTED]>:
>> Why are you removing the accents? Why not store/process the data as
>> UTF-8, which supports all the accents in all the languages, and even
>> non-latin languages. You mention Arabic, which does not use accented
>> latin characters (Maybe you are thinking of Turkish, Ubek or Tadjic).
>> UTF-8 supports Arabic, Russian, Greek, Latin including modified
>> accented letters, and almost everything else save CJK.
>>
>> What is your end goal? Why are you removing the accents?
>
> Hi Dotan,
>
> I'm trying to give a universally-manageable directory name to an item
> using a free-text title. I want to avoid every type of accentuated
> character and everything outside of pure ASCII to make it the most
> portable possible.
> Generating a random hash is not acceptable as we want to be the most
> user-friendly possible.

I suppose that is a good reason. I actually tried to come up with a
user case that justifies the removal of latin accents, and couldn't.
I'll remember that. Tell me, what are you doing with Hebrew, Russian,
Arabic, and other non-latin scripts? If you want, I have some code
that roughly transliterates Hebrew <-> Latin on the
http://gibberish.co.il website.

> I'm talking about Arabic not to remove accentuated characters, but in
> case there would be a transliteration function that allows me to turn an
> Arabic character into something similar in terms of pronunciation but in
> ASCII.

If it needs to be transliterated back to Arabic you will have fun with
the letter forms! I can give you code that does it for Hebrew, but
Hebrew only has 5 final letters, and no explicit first- or middle-
forms.

> So the goal is to create a directory name that is both intuitive *and*
> portable for the user and the admin. The title is kept for the user, but
> there is a generic shortened code that is generated following the given
> title.
> We used to ask for a title in a webform, but realised our users liked it
> much better when we give them the possibility to generate the code
> themselves, but generating one ourselves by default.
> I just realised that the developer who did it seemed to make it using
> html codes directly, so we end up with codes like "EACUTETEACUTE" for an
> item called "été", while "ETE" would be far better.
>
> Yannick
>
>

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


Re: [PHP] Re: A Little Something.

2008-05-12 Thread tedd

Gentlemen:

First, my apologies for publishing the page without checking it first 
for pet-peeves.


Second, please educate me as to the statement that "NoScript" is 
blocking UrchinTracker. Where do I have declared NoScript and why 
would I want it? I have numerous sites and they all generate these 
same javascript warnings, but UrchinTracker still works and I have 
sites that are very popular.


Third, the UrchinTracker code is Google's code and I do not think I 
have any control over the warnings generated by their code -- do I?


Fourth, the site:

http://webbytedd.com/bb/tribute/

Was set up originally as an ajax site (requiring javascript) and I 
did not give thought to what would happen if javascript was turned 
off -- in my haste I violated one of the "prime directives" of 
Graceful Degradation -- sorry!


If you will review the page now, you will find that has been 
corrected -- the page works with javascript on or off.


Now, with all of that said -- which of you javascript experts can 
tell me what I can do to stop the warnings that are generated by 
Google's UrchinTracker code?


Thanks and Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Re: unsubscribe

2008-05-12 Thread Nathan Nobbe
On Mon, May 12, 2008 at 11:17 AM, tedd <[EMAIL PROTECTED]> wrote:

> At 11:46 AM -0400 5/12/08, Daniel Brown wrote:
>
>> On Sun, May 11, 2008 at 9:19 PM, Craige Leeder <[EMAIL PROTECTED]> wrote:
>>
>>>  You've even had to resort to using classes and other strange stuff to
  program. Clearly signs of mental fatigue. :-)

>>>
>>>  :o. I think mental fatigue might be evident by one not using it. But
>>>  that's just me ;)
>>>
>>
>>Depends on how OOP-dependent you are.  I, for one, don't use
>> classes in my own personal stuff.  It's not that I can't, it's just
>> that I prefer not to use them.
>>
>
> I'm a OOPoholic and I've been OOP free for 10 years, three months and four
> days


you should hop off the wagon and come chill w/ nate for a few days ;)

-nathan


[PHP] Re: php_svn.dll with Apache/2.0.63

2008-05-12 Thread Vedanta Barooah
more on this, i just found out that php_svn.dll does not work with the mpm
version of apache, i did a 'Apache -X' (single process mode) and php_svn.dll
works fine. how do i run it in mpm mode?

- vedanta

On Mon, May 12, 2008 at 1:55 PM, Vedanta Barooah <[EMAIL PROTECTED]>
wrote:

> hi y'all,
> is there a known issue with php_svn.dll (5.2.1.1) on Apache/2.0.63
> (windows xp sp 2 - 32bit)? i am  pretty sure i did configure it well, but
> for some reason apache fails to use this extension. the svn extension is
> usable from the cli but not via apache. any pointers will be of great help.
>
> Thanks,
> Vedanta
>
>
>
>
> ##-- source code
>  #svn_test.php
> // echo "";
> echo "See if extensions are loaded:\n";
> print_r(get_loaded_extensions());
> echo "List a svn repo:\n";
> print_r(svn_ls('http://192.168.101.20/svn')
> );
> ?>
> ##
>
> ##-- executed from cli:
>
> See if extensions are loaded:
> Array
> (
> [0] => bcmath
> [1] => calendar
> [2] => com_dotnet
> [3] => ctype
> [4] => session
> [5] => filter
> [6] => ftp
> [7] => hash
> [8] => iconv
> [9] => json
> [10] => odbc
> [11] => pcre
> [12] => Reflection
> [13] => date
> [14] => libxml
> [15] => standard
> [16] => tokenizer
> [17] => zlib
> [18] => SimpleXML
> [19] => dom
> [20] => SPL
> [21] => wddx
> [22] => xml
> [23] => xmlreader
> [24] => xmlwriter
> [25] => bz2
> [26] => curl
> [27] => dba
> [28] => dbase
> [29] => mbstring
> [30] => fdf
> [31] => gd
> [32] => gettext
> [33] => gmp
> [34] => imap
> [35] => interbase
> [36] => ldap
> [37] => exif
> [38] => mcrypt
> [39] => mhash
> [40] => mime_magic
> [41] => ming
> [42] => msql
> [43] => mssql
> [44] => mysql
> [45] => mysqli
> [46] => openssl
> [47] => PDO
> [48] => PDO_Firebird
> [49] => pdo_mssql
> [50] => pdo_mysql
> [51] => PDO_OCI
> [52] => PDO_ODBC
> [53] => pdo_sqlite
> [54] => pspell
> [55] => shmop
> [56] => snmp
> [57] => soap
> [58] => sockets
> [59] => SQLite
> [60] => tidy
> [61] => xmlrpc
> [62] => xsl
> [63] => zip
> [64] => svn
> )
> List a svn repo:
> Array
> (
> [0] => Array
> (
> [created_rev] => 4
> [last_author] => vedanta
> [size] => 0
> [time] => May 12 11:13
> [time_t] => 1210605233
> [name] => test
> [type] => dir
> )
>
> )
>
> ### -- executed from web
>
> See if extensions are loaded:
> Array
> (
> [0] => bcmath
> [1] => calendar
>
> [2] => com_dotnet
> [3] => ctype
> [4] => session
> [5] => filter
> [6] => ftp
> [7] => hash
> [8] => iconv
> [9] => json
> [10] => odbc
> [11] => pcre
>
> [12] => Reflection
> [13] => date
> [14] => libxml
> [15] => standard
> [16] => tokenizer
> [17] => zlib
> [18] => SimpleXML
> [19] => dom
> [20] => SPL
>
> [21] => wddx
> [22] => xml
> [23] => xmlreader
> [24] => xmlwriter
> [25] => apache2handler
> [26] => bz2
> [27] => curl
> [28] => dba
> [29] => dbase
>
> [30] => gd
> [31] => gettext
> [32] => gmp
> [33] => imap
> [34] => ldap
> [35] => mbstring
> [36] => mime_magic
> [37] => ming
> [38] => mysql
> [39] => mysqli
>
> [40] => PDO
> [41] => pdo_mysql
> [42] => PDO_ODBC
> [43] => pdo_sqlite
> [44] => shmop
> [45] => snmp
> [46] => soap
> [47] => sockets
> [48] => SQLite
>
> [49] => tidy
> [50] => xmlrpc
> [51] => xsl
> [52] => zip
> )
> List a svn repo:
>
>
> *Fatal error*:  Call to undefined function svn_ls() in 
> *C:\VEDANTA\WWW\svn_test.php* on line *7*
>
>
>
>
>
>
>


-- 
*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*
Vedanta Barooah
YM! - vedanta2006
Skype - vedanta2006


Re: [PHP] Re: A Little Something.

2008-05-12 Thread Eric Butera
On Mon, May 12, 2008 at 2:57 PM, tedd <[EMAIL PROTECTED]> wrote:
> Gentlemen:
>
>  First, my apologies for publishing the page without checking it first for
> pet-peeves.
>
>  Second, please educate me as to the statement that "NoScript" is blocking
> UrchinTracker. Where do I have declared NoScript and why would I want it? I
> have numerous sites and they all generate these same javascript warnings,
> but UrchinTracker still works and I have sites that are very popular.
>
>  Third, the UrchinTracker code is Google's code and I do not think I have
> any control over the warnings generated by their code -- do I?
>
>  Fourth, the site:
>
>
>  http://webbytedd.com/bb/tribute/
>
>  Was set up originally as an ajax site (requiring javascript) and I did not
> give thought to what would happen if javascript was turned off -- in my
> haste I violated one of the "prime directives" of Graceful Degradation --
> sorry!
>
>  If you will review the page now, you will find that has been corrected --
> the page works with javascript on or off.
>
>  Now, with all of that said -- which of you javascript experts can tell me
> what I can do to stop the warnings that are generated by Google's
> UrchinTracker code?
>
>  Thanks and Cheers,
>
>
>  tedd
>
>  --
>  ---
>  http://sperling.com  http://ancientstones.com  http://earthstones.com
>
>  --
>
>  PHP General Mailing List (http://www.php.net/)
>  To unsubscribe, visit: http://www.php.net/unsub.php
>
>

NoScript is a FireFox extension to protect users from malicious
scripts.  JS is indeed very dangerous right now especially as mashups
continue to gain popularity and all of that personal information
floating around.  Subscribe to planet websecurity and see the truth.

The way I deal with urchin is by /etc/hosts'ing out google's
adservers.  Then we all win, right?  ;)

Here is a fairly current rant:
http://blog.360.yahoo.com/blog-TBPekxc1dLNy5DOloPfzVvFIVOWMB0li?p=819

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



Re: [PHP] Replacing accented characters by non-accented characters

2008-05-12 Thread tedd

Yannick:

Considering that we just had a flurry of pet-peeves on the list, I 
rant on one of mine.


At 1:25 PM -0500 5/12/08, Yannick Warnier wrote:

I'm trying to give a universally-manageable directory name to an item
using a free-text title. I want to avoid every type of accentuated
character and everything outside of pure ASCII to make it the most
portable possible.
Generating a random hash is not acceptable as we want to be the most
user-friendly possible.




As Rocky (the flying squirrel of Bullwinkle fame) once said when a 
gentleman in a black suit identified himself as "Military 
Intelligence" -- "That sounds like a contradiction in terms."


To make something as user-friendly as possible is to accommodate as 
many users as possible, including those who's native language is not 
English -- like 96 percent of the world.


You may want to call whatever you are doing as an 
"universally-manageable directory", but it can't be if it rules out 
the majority of the universe (as we know it).


Why not embrace Unicode and not worry about it? I suggest you read 
"Building Scalable We Sites" by Henderson -- specifically chapter 4, 
which deals with Unicode, Internationalization and Localization.


Looks to me like you're trying to fit a gross into a dozen -- that's 
a lossy process that's probably not going to do what you want.




Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Re: A Little Something.

2008-05-12 Thread tedd

At 3:11 PM -0400 5/12/08, Eric Butera wrote:


NoScript is a FireFox extension to protect users from malicious
scripts.


NoScript is also a tag for browsers to read and react to IF they do 
not accept javascript.


http://www.w3schools.com/TAGS/tag_noscript.asp

That's an unfortunate naming convention from FireFox.

https://addons.mozilla.org/en-US/firefox/addon/722


 JS is indeed very dangerous right now especially as mashups
continue to gain popularity and all of that personal information
floating around.  Subscribe to planet websecurity and see the truth.

The way I deal with urchin is by /etc/hosts'ing out google's
adservers.  Then we all win, right?  ;)

Here is a fairly current rant:
http://blog.360.yahoo.com/blog-TBPekxc1dLNy5DOloPfzVvFIVOWMB0li?p=819



Okay, I read that -- but what does that have to do with urchin?

Urchin is not an ad delivery system, but rather a way to keep track 
of visitors to your web site.


Now, how is that a security threat? Or is the claim that any site 
that uses js is a security threat?


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] creating an xls file from mysql data

2008-05-12 Thread Richard Kurth


This script will create an xls file from the data that is sent to it
When I run this it only gets one recored and it is supposet to get all
the records that are past by the  $_POST[selectedcontactlist]
I think I have a } in the wrong place but I can not figure it out
anybody have a suggestion

$_POST[selectedcontactlist]="3,45,65,23,12,4,56"; //this is a sample of
what is past

$ExplodeIt = explode(",",rtrim($_POST[selectedcontactlist],","));
$Count = count($ExplodeIt);
for ($i=0; $i < $Count; $i++) {
$sql = "SELECT * FROM contacts WHERE id = '$ExplodeIt[$i]'";
$sql_result = query($sql);
$count = mysql_num_fields($sql_result);

for ($i = 0; $i < $count; $i++){
   $header .= mysql_field_name($sql_result, $i)."\t";
}

while($row = mysql_fetch_row($sql_result)){
 $line = '';
 foreach($row as $value){
   if(!isset($value) || $value == ""){
 $value = "\t";
   }else{
# important to escape any quotes to preserve them in the data.
 $value = str_replace('"', '""', $value);
# needed to encapsulate data in quotes because some data might be multi
line.
# the good news is that numbers remain numbers in Excel even though quoted.
 $value = '"' . $value . '"' . "\t";
   }
   $line .= $value;
 }
 $data .= trim($line)."\n";
}
}
# this line is needed because returns embedded in the data have "\r"
# and this looks like a "box character" in Excel
 $data = str_replace("\r", "", $data);


# Nice to let someone know that the search came up empty.
# Otherwise only the column name headers will be output to Excel.
if ($data == "") {
 $data = "\nno matching records found\n";
}

# This line will stream the file to the user rather than spray it across
the screen
header("Content-type: application/octet-stream");

# replace excelfile.xls with whatever you want the filename to default to
header("Content-Disposition: attachment; filename=excelfile.xls");
header("Pragma: no-cache");
header("Expires: 0");

echo $header."\n".$data;



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



Re: [PHP] Permissions set on php script question

2008-05-12 Thread David Jourard

Bojan Tesanovic wrote:
Heh you are really new to Linux 


permissions on linux are set per user/group/other bases

so for most secure set permissions to read only for web-server user 
so 
chown 'webserveruser' file.php

chmod 400 file.php

make sure you have root access at server so you can change that file

or make a group for web-server as your group and set 
read permissions on group level

chmod 440 file.php


Thank-you

But most web sites are virtually hosted and do not have root access to 
set this up.


Most people just take the package and install with default masks.

So again I ask:

Are there are any security concerns when the read permission
is set on other.  ie Couldn't one write a program to remotely read the 
contents of the file.


 Wouldn't it be better if the read permission was set for
user only and the php engine
could run the program as user like one can do for cgi using suEXEC.

Again thanks

David J.



Re: [PHP] convert query result to array

2008-05-12 Thread Yi Wang
I think flance's meaning is whether there is a build-in function that
can convert the result set to an array.

The short answer is: do it yourself.

On 5/12/08, Stut <[EMAIL PROTECTED]> wrote:
> On 12 May 2008, at 15:56, It flance wrote:
>
> > is there any function that can convert the result of  query to an
> associative array?
> >
> > what i want is the following:
> >
> > $query = "select * from tablename";
> > $result = mysql_query($query);
> > $arr = somefunction($result);
> >
> > where $arr should be an assoiative array whose indices have the same name
> as the fields names of table tablename.
> >
>
>  http://php.net/mysql_fetch_assoc
>
>  Please please please read the manual: http://php.net/mysql
>
>  -Stut
>
>  --
>  http://stut.net/
>
>
>  --
>  PHP General Mailing List (http://www.php.net/)
>  To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Regards,
Wang Yi

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



Re: [PHP] convert query result to array

2008-05-12 Thread Forcey
I guess PDOStatement::fetchAll() should work?

see http://www.php.net/manual/en/pdostatement.fetchall.php for details.

- Forcey

On Tue, May 13, 2008 at 9:55 AM, Yi Wang <[EMAIL PROTECTED]> wrote:
> I think flance's meaning is whether there is a build-in function that
>  can convert the result set to an array.
>
>  The short answer is: do it yourself.
>
>
>
>  On 5/12/08, Stut <[EMAIL PROTECTED]> wrote:
>  > On 12 May 2008, at 15:56, It flance wrote:
>  >
>  > > is there any function that can convert the result of  query to an
>  > associative array?
>  > >
>  > > what i want is the following:
>  > >
>  > > $query = "select * from tablename";
>  > > $result = mysql_query($query);
>  > > $arr = somefunction($result);
>  > >
>  > > where $arr should be an assoiative array whose indices have the same name
>  > as the fields names of table tablename.
>  > >
>  >
>  >  http://php.net/mysql_fetch_assoc
>  >
>  >  Please please please read the manual: http://php.net/mysql
>  >
>  >  -Stut
>  >
>  >  --
>  >  http://stut.net/
>  >
>  >
>  >  --
>  >  PHP General Mailing List (http://www.php.net/)
>  >  To unsubscribe, visit: http://www.php.net/unsub.php
>  >
>  >
>
>
>  --
>  Regards,
>  Wang Yi
>
>
>
>  --
>  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] creating an xls file from mysql data

2008-05-12 Thread Chris
Richard Kurth wrote:
> 
> This script will create an xls file from the data that is sent to it
> When I run this it only gets one recored and it is supposet to get all
> the records that are past by the  $_POST[selectedcontactlist]
> I think I have a } in the wrong place but I can not figure it out
> anybody have a suggestion
> 
> $_POST[selectedcontactlist]="3,45,65,23,12,4,56"; //this is a sample of
> what is past
> 
> $ExplodeIt = explode(",",rtrim($_POST[selectedcontactlist],","));
> $Count = count($ExplodeIt);
> for ($i=0; $i < $Count; $i++) {
> $sql = "SELECT * FROM contacts WHERE id = '$ExplodeIt[$i]'";

Instead of doing that, do this:

/**
* This section makes sure the id's you are going to use in your query
are actually integer id's.
* If they aren't, you'll get an sql error.
*
*/
$ids = array();
foreach ($_POST['selectedcontactlist'] as $id) {
  if (!is_int($id)) {
continue;
  }
  $ids[] = $id;
}

// all posted values are duds? show an error.
if (empty($ids)) {
  echo "No id's are numeric, try again";
  exit;
}

$sql = "select * from contacts where id in (" . implode(',', $ids) . ")";


That'll get everything for all of those id's and then you can loop over
it all once:

// print out the header for the csv file here.

// then loop over the results:
while ($row = mysql_fetch_assoc($sql_result)) {
  // put it into file here.
}

// close the file
// print it out.

-- 
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] creating an xls file from mysql data

2008-05-12 Thread Ray Hauge

Chris wrote:

Richard Kurth wrote:

This script will create an xls file from the data that is sent to it
When I run this it only gets one recored and it is supposet to get all
the records that are past by the  $_POST[selectedcontactlist]
I think I have a } in the wrong place but I can not figure it out
anybody have a suggestion

$_POST[selectedcontactlist]="3,45,65,23,12,4,56"; //this is a sample of
what is past

$ExplodeIt = explode(",",rtrim($_POST[selectedcontactlist],","));
$Count = count($ExplodeIt);
for ($i=0; $i < $Count; $i++) {
$sql = "SELECT * FROM contacts WHERE id = '$ExplodeIt[$i]'";


Instead of doing that, do this:

/**
* This section makes sure the id's you are going to use in your query
are actually integer id's.
* If they aren't, you'll get an sql error.
*
*/
$ids = array();
foreach ($_POST['selectedcontactlist'] as $id) {
  if (!is_int($id)) {
continue;
  }
  $ids[] = $id;
}

// all posted values are duds? show an error.
if (empty($ids)) {
  echo "No id's are numeric, try again";
  exit;
}

$sql = "select * from contacts where id in (" . implode(',', $ids) . ")";


That'll get everything for all of those id's and then you can loop over
it all once:

// print out the header for the csv file here.

// then loop over the results:
while ($row = mysql_fetch_assoc($sql_result)) {
  // put it into file here.
}

// close the file
// print it out.



Or you can do it straight from MySQL, which is a lot faster:

SELECT [fields] INTO OUTFILE '/path/to/file.csv' FIELDS TERMINATED BY 
',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM [tables] 
WHERE [conditions]


If you want a header row, then you can use a UNION statement.

--
Ray Hauge
www.primateapplications.com

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



[PHP] using variable in php form before the form is POSTed

2008-05-12 Thread milt
I have a form that will be filled in by the user, I want to have access to 
the content of one of the fields in that form, in order to fill in an 
another variable that is not part of the form.  this variable is used by a 
routine when the form is "posted".  Question - is the $_post[field name] 
availble before the submit button is pushed, or is there another way to get 
the contents of the field?
thanks, Milt 



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



Re: [PHP] using variable in php form before the form is POSTed

2008-05-12 Thread Robert Cummings

On Mon, 2008-05-12 at 14:44 -0700, milt wrote:
> I have a form that will be filled in by the user, I want to have access to 
> the content of one of the fields in that form, in order to fill in an 
> another variable that is not part of the form.  this variable is used by a 
> routine when the form is "posted".  Question - is the $_post[field name] 
> availble before the submit button is pushed, or is there another way to get 
> the contents of the field?

PHP only gets what the browser sends. The browser doesn't send until you
click the submit button (or perform a synonymous action). You'll need to
use JavaScript to work on data before it is submitted.

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


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



[PHP] Good HTML parser needed

2008-05-12 Thread Shelley
Hi all,

The fact is that I have a site that allow users to post hypertext articles.
However, I saw that sometimes, because of their careless input,
the articles is not rendered correctly.

I want to know whether there are some good HTML parsers written in PHP.

That is,
the parser checks whether html tags like table, tr, td, div, dt, dl, dd,
script, ul,
li, span, h1, h2, etc. are nested correctly. If any tags not matched, just
remove them.

Any suggection is greatly appreciated.

-- 
Regards,
Shelley


Re: [PHP] creating an xls file from mysql data

2008-05-12 Thread Chris

> Or you can do it straight from MySQL, which is a lot faster:

With the caveat that you need extra mysql permissions to be able to do that.

-- 
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] Good HTML parser needed

2008-05-12 Thread Yi Wang
strip_tags does the tricks.

www.php.net/manual/en/function.strip-tags.php

BTW,
Why cn2 dot php.net blocked by the mail server?

The rejected message:

This is an automatically generated Delivery Status Notification

Delivery to the following recipient failed permanently:

php-general@lists.php.net

Technical details of permanent failure:
PERM_FAILURE: Gmail tried to deliver your message, but it was rejected
by the recipient domain. The error that the other server returned was:
550 550-5.7.1 mail rejected by policy.  SURBL hit
550-Spammy URLs in your message
550 See http://master.php.net/mail/why.php?why=SURBL. We recommend
contacting the other email provider for further information about the
cause of this error. Thanks for your continued support. (state 17)

On 5/13/08, Shelley <[EMAIL PROTECTED]> wrote:
> Hi all,
>
>  The fact is that I have a site that allow users to post hypertext articles.
>  However, I saw that sometimes, because of their careless input,
>  the articles is not rendered correctly.
>
>  I want to know whether there are some good HTML parsers written in PHP.
>
>  That is,
>  the parser checks whether html tags like table, tr, td, div, dt, dl, dd,
>  script, ul,
>  li, span, h1, h2, etc. are nested correctly. If any tags not matched, just
>  remove them.
>
>  Any suggection is greatly appreciated.
>
>  --
>  Regards,
>
> Shelley
>


-- 
Regards,
Wang Yi

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



Re: [PHP] Good HTML parser needed

2008-05-12 Thread Robert Cummings

On Tue, 2008-05-13 at 11:34 +0800, Shelley wrote:
> Hi all,
> 
> The fact is that I have a site that allow users to post hypertext articles.
> However, I saw that sometimes, because of their careless input,
> the articles is not rendered correctly.
> 
> I want to know whether there are some good HTML parsers written in PHP.
> 
> That is,
> the parser checks whether html tags like table, tr, td, div, dt, dl, dd,
> script, ul,
> li, span, h1, h2, etc. are nested correctly. If any tags not matched, just
> remove them.

http://ca3.php.net/manual/en/book.tidy.php

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


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



[PHP] tracking Mials Which were bounced.

2008-05-12 Thread Chetan Rane
Hi All

I am using a PHP Mailer to send mass mails.
How can I Identify how mails have bounced.


Chetan Dattaram Rane
Software Engineer
 
 






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



Re: [PHP] Good HTML parser needed

2008-05-12 Thread Shelley
Maybe I didn't use that tidy correctly.
I don't want html, head, body things. Just parsed string.


On Tue, May 13, 2008 at 12:00 PM, Robert Cummings <[EMAIL PROTECTED]>
wrote:

>
> On Tue, 2008-05-13 at 11:34 +0800, Shelley wrote:
> > Hi all,
> >
> > The fact is that I have a site that allow users to post hypertext
> articles.
> > However, I saw that sometimes, because of their careless input,
> > the articles is not rendered correctly.
> >
> > I want to know whether there are some good HTML parsers written in PHP.
> >
> > That is,
> > the parser checks whether html tags like table, tr, td, div, dt, dl, dd,
> > script, ul,
> > li, span, h1, h2, etc. are nested correctly. If any tags not matched,
> just
> > remove them.
>
> http://ca3.php.net/manual/en/book.tidy.php
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
>


-- 
Regards,
Shelley


Re: [PHP] Good HTML parser needed

2008-05-12 Thread Yi Wang
You should pass the secend parm to the function. Like this:

$allowable_tags = '';
strip_tags( $text, $allowable_tags );



On 5/13/08, Shelley <[EMAIL PROTECTED]> wrote:
> Not that.
>
> It will just remove all html tags, you know.
>
>
> --
> Regards,
> Shelley


-- 
Regards,
Wang Yi

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



[PHP] cn2 dot php.net can't be included in the mail.

2008-05-12 Thread Yi Wang
Hi,

I sent a mail to this mailling list just now. But the mailling list
rejected my mail for  the mail including "cn2 dot php.net". Replace '
dot ' with '.'.

Why this mirror site can't be included in the mail?

Maybe it's not in the whitelist?

-- 
Regards,
Wang Yi

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



Re: [PHP] Good HTML parser needed

2008-05-12 Thread Robert Cummings
On Tue, 2008-05-13 at 12:28 +0800, Shelley wrote:
> Maybe I didn't use that tidy correctly.
> I don't want html, head, body things. Just parsed string.

So strip them...

#Uis', '', $html )
$html = preg_replace( '##Uis', '', $html )

//...
?>

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


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



Re: [PHP] Good HTML parser needed

2008-05-12 Thread Robert Cummings

On Tue, 2008-05-13 at 01:27 -0400, Robert Cummings wrote:
> On Tue, 2008-05-13 at 12:28 +0800, Shelley wrote:
> > Maybe I didn't use that tidy correctly.
> > I don't want html, head, body things. Just parsed string.
> 
> So strip them...
> 
>  // ...
> 
> tidy_parse_string( $html );
> tidy_clean_repair();
> 
> $html = tidy_get_output();
> 
> $html = preg_replace( '#^.*#Uis', '', $html )
> $html = preg_replace( '##Uis', '', $html )
> 
> //...
> ?>

Whoops... noticed some bugs there :B

#Uis', '', $html );
$html = preg_replace( '#.*$#Uis', '', $html );

?>

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


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



Re: [PHP] creating an xls file from mysql data

2008-05-12 Thread Richard Kurth

Chris wrote:

Richard Kurth wrote:
  

This script will create an xls file from the data that is sent to it
When I run this it only gets one recored and it is supposet to get all
the records that are past by the  $_POST[selectedcontactlist]
I think I have a } in the wrong place but I can not figure it out
anybody have a suggestion

$_POST[selectedcontactlist]="3,45,65,23,12,4,56"; //this is a sample of
what is past

$ExplodeIt = explode(",",rtrim($_POST[selectedcontactlist],","));
$Count = count($ExplodeIt);
for ($i=0; $i < $Count; $i++) {
$sql = "SELECT * FROM contacts WHERE id = '$ExplodeIt[$i]'";



Instead of doing that, do this:

/**
* This section makes sure the id's you are going to use in your query
are actually integer id's.
* If they aren't, you'll get an sql error.
*
*/
$ids = array();
foreach ($_POST['selectedcontactlist'] as $id) {
  if (!is_int($id)) {
continue;
  }
  $ids[] = $id;
}

// all posted values are duds? show an error.
if (empty($ids)) {
  echo "No id's are numeric, try again";
  exit;
}

$sql = "select * from contacts where id in (" . implode(',', $ids) . ")";


That'll get everything for all of those id's and then you can loop over
it all once:

// print out the header for the csv file here.

// then loop over the results:
while ($row = mysql_fetch_assoc($sql_result)) {
  // put it into file here.
}

// close the file
// print it out.

  

This is what the $_POST['selectedcontactlist'] looks like

121,17,97,123,243,52,138,114,172,170,64,49,60,256,176,244,201,42,95,4,

it is not coming across as an array so the foreach is throwing an error

how can I make this an array in the proper format.

This number are selected in a checkbox and passed with a javascript to the 
script should I be converting them to an array in the javascript.
this is the javascript that is passing the numbers.

function exportContacts(theform)
{
   //theform.action = "cmexport.php";

   theform.action="cmexport.php";
   if (getSelectedContacts(theform) != "")
   {
   theform.submit();
   }
   else
   {
   alert("Please select contacts to export by checking the boxes to the 
left of the contact's name.");
   }
}


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