Re: [PHP] Re: UTF-8 errors in RSS feed

2008-10-08 Thread Bastien Koert
[snip]
>
> I'm trying to load an external rss feed into a DomDocument, the feed says
 it's uft-8 but DomDocument rightly disagrees. This causes a warning: Input
 is not proper UTF-8, indicate encoding ! Bytes: 0xA3 0x36 0x35 0x20

 Is there any way I can get DomDocument to skip that part of the feed.
 I'm not looking for the LIBXML_NOERROR option which results in not loading
 the feed at all. The feed has some incorrectly encoded pound sign in it 
 that
 causes the problem. I'd much rather have the feed just without that pound
 sign (or maybe some weird character) than not having the feed at all.

 Thanks,
 Ron

>>> [/snip]

What about a simple str_replace on the string before moving to the
DomDocument?


-- 

Bastien

Cat, the other other white meat


Re: [PHP] Flow chart tool

2008-10-08 Thread Ashley Sheridan
On Wed, 2008-10-08 at 19:08 -0400, Haig Dedeyan wrote:
> Ashley Sheridan wrote:
> > On Wed, 2008-10-08 at 18:45 -0400, Haig Dedeyan wrote:
> >   
> >> Hi everyone,
> >>
> >> is there a software that will create a flow chart indicating what php 
> >> pages are using what tables in a MySql dbase?
> >>
> >> Haig
> >>
> >> 
> > To my knowledge no such software exists. You could include an extra bit
> > of code in each of your pages to make an entry in your MySQL database,
> > but i'm guessing that for you this goes beyond what you are looking for.
> >
> >
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
> >   
> Thanks Ash.
> 
> I was hoping to avoid that route. I guess I can write a script to scan 
> all my pages and whatever table reference it finds, it can flag it for 
> me and then I can make the flowchart myself.
> 
> Haig
For complete system agnosticism, I'd create the flowchart as  a series
of graphics, and then put those together in a page? I'm not sure on what
the best route is for blind users, so I'm hoping someone else in the
group can lend a hand on this one?


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Flow chart tool

2008-10-08 Thread Haig Dedeyan

Ashley Sheridan wrote:

On Wed, 2008-10-08 at 18:45 -0400, Haig Dedeyan wrote:
  

Hi everyone,

is there a software that will create a flow chart indicating what php 
pages are using what tables in a MySql dbase?


Haig



To my knowledge no such software exists. You could include an extra bit
of code in each of your pages to make an entry in your MySQL database,
but i'm guessing that for you this goes beyond what you are looking for.


Ash
www.ashleysheridan.co.uk


  

Thanks Ash.

I was hoping to avoid that route. I guess I can write a script to scan 
all my pages and whatever table reference it finds, it can flag it for 
me and then I can make the flowchart myself.


Haig

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



Re: [PHP] Flow chart tool

2008-10-08 Thread Ashley Sheridan
On Wed, 2008-10-08 at 18:45 -0400, Haig Dedeyan wrote:
> Hi everyone,
> 
> is there a software that will create a flow chart indicating what php 
> pages are using what tables in a MySql dbase?
> 
> Haig
> 
To my knowledge no such software exists. You could include an extra bit
of code in each of your pages to make an entry in your MySQL database,
but i'm guessing that for you this goes beyond what you are looking for.


Ash
www.ashleysheridan.co.uk


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



[PHP] Flow chart tool

2008-10-08 Thread Haig Dedeyan

Hi everyone,

is there a software that will create a flow chart indicating what php 
pages are using what tables in a MySql dbase?


Haig

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



Re: [PHP] Login

2008-10-08 Thread Stut

On 8 Oct 2008, at 22:32, Ashley Sheridan wrote:

On Wed, 2008-10-08 at 22:15 +0100, Stut wrote:

I don't disagree that it's not the best model, but it is the best
paying
I have to disagree. Each and every time I've come across this, I've  
gone

elsewhere. The model doesn't work as far as I can tell.


It's not the best model but I can assure you it *does* work otherwise  
advertisers would not pay the rates such campaigns demand.



I think the
problem is the people who create the schemes aren't really aware of  
what

the Internet can do; something similar to that guy in marketing asking
why it's not possible to duplicate his A4 page, exactly as he set it
out, as a web page. I don't have a better model, but something like  
that

that's used on Experts Exchange doesn't go too badly with me. Targeted
ads that don't get in my way. I'm more inclined to look at something
that isn't shoved in my face.


Like I said, I don't disagree, but you have to accept that ads that  
interrupt the user pay the best so for sites that are expensive to  
run, like download sites, they're economically sound.


I find it interesting that you feel you have the right to criticise  
the "people who create the schemes" for not knowing any better, but  
you with all your knowledge "of what the internet can do" admit that  
you can't come up with a better model.


Obviously, I'm a programmer, so I probably don't fall into the  
'normal'

category for advertising ;)


You may think that but I've never come across any statistics that  
suggest that programmers or even technical people in general have a  
lower response rate to any form of advertising. I'm sure they are  
differences, but as a percentage of internet users we're insignificant  
for most websites these days, even when it comes to games.


-Stut

--
http://stut.net/

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



Re: [PHP] Plotting Tool

2008-10-08 Thread Ashley Sheridan
On Wed, 2008-10-08 at 17:37 -0400, Daniel Brown wrote:
> On Wed, Oct 8, 2008 at 5:34 PM, Ashley Sheridan
> <[EMAIL PROTECTED]> wrote:
> >>
> > You probably wouldn't have wanted any cake, it was most likely spiked
> > with laxatives to induce the obvious and cause a decline in programming
> > time ;)
> 
> Precisely one of the reasons I'm not the only one to take a break!  ;-P
> 
> (The latter part of the above statement.)
> 
Whichever way I read that my mind is filled with images I'd rather it
not be... :(


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Plotting Tool

2008-10-08 Thread Daniel Brown
On Wed, Oct 8, 2008 at 5:34 PM, Ashley Sheridan
<[EMAIL PROTECTED]> wrote:
>>
> You probably wouldn't have wanted any cake, it was most likely spiked
> with laxatives to induce the obvious and cause a decline in programming
> time ;)

Precisely one of the reasons I'm not the only one to take a break!  ;-P

(The latter part of the above statement.)

-- 

More full-root dedicated server packages:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo.
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] Plotting Tool

2008-10-08 Thread Ashley Sheridan
On Wed, 2008-10-08 at 17:13 -0400, Daniel Brown wrote:
> On Wed, Oct 8, 2008 at 5:09 PM, Ashley Sheridan
> <[EMAIL PROTECTED]> wrote:
> >
> > I really meant standards when I said basics. IMHO, standards are the
> [snip!]
> 
> None of the list-newbies get smiley-less jokes here anymore.  What
> is this world coming to?!?
> 
> > ps, for those that don't know, I'm referring to the cake M$ sent Firefox
> > congratulating them on shipping Fx3!
> 
> Just this week I went on hiatus from the FF/TB development teams
> and the Mozilla project in general.  I didn't get any cake!
> 
> -- 
> 
> More full-root dedicated server packages:
> Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
> Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
> Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo.
> Dedicated servers, VPS, and hosting from $2.50/mo.
> 
You probably wouldn't have wanted any cake, it was most likely spiked
with laxatives to induce the obvious and cause a decline in programming
time ;)


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Login

2008-10-08 Thread Ashley Sheridan
On Wed, 2008-10-08 at 22:15 +0100, Stut wrote:
> I don't disagree that it's not the best model, but it is the best  
> paying 
I have to disagree. Each and every time I've come across this, I've gone
elsewhere. The model doesn't work as far as I can tell. I think the
problem is the people who create the schemes aren't really aware of what
the Internet can do; something similar to that guy in marketing asking
why it's not possible to duplicate his A4 page, exactly as he set it
out, as a web page. I don't have a better model, but something like that
that's used on Experts Exchange doesn't go too badly with me. Targeted
ads that don't get in my way. I'm more inclined to look at something
that isn't shoved in my face.

Obviously, I'm a programmer, so I probably don't fall into the 'normal'
category for advertising ;)


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Login

2008-10-08 Thread Stut

On 8 Oct 2008, at 22:05, Ashley Sheridan wrote:

On Wed, 2008-10-08 at 21:45 +0100, Stut wrote:

On 8 Oct 2008, at 21:44, Ashley Sheridan wrote:
The only redirects that have p!ssed me off before are those ones  
that

big sites put in to make room for their adverts. On more than one
occassion I've decided to look elsewhere for whatever it was I was
looking for, although it tends only to be game and (legal) download
sites that do this.


Yeah, I hate it when companies try to make a profit. Don't they know
everything on the Internet is supposed to be free?!?!?!?

Find your stuff elsewhere by all means, but don't slate sites for
using advertising to pay for your FREE usage of their service.

-Stut

PS. For those sarcasm-detector-challenged out there the first
paragraph was full of sarcasm.

I'm not against advertising, just this kind. It makes you sit  
through a

30 second long advert before you get to the sweet stuff. Now, I don't
have a bandwidth limit, but what about those users who do? Inline
adverts are better, and Google has them worked to a tee. If the model
doesn't work for the big companies then, it's time to find a new  
model,

but I think one in which the visitors to a site are treated like TV
viewers is not the way to go.


I don't disagree that it's not the best model, but it is the best  
paying. Why? For precisely the reason you've stated - it interrupts  
what you're doing and forces you to pay attention to it. The reason  
game and download sites use them is because they pay enough to cover  
your usage of their site, whereas I'd bet standard banners would not.


To make a reasonable amount of money from Google adwords you need a  
fairly sizable amount of traffic, and even then you won't pay for the  
scenario where every user downloads files 100's of meg in size.


If you don't like it and you think it can be done less intrusively I  
urge you to go ahead and build a competitor. But don't expect to break  
even anytime soon. In the meantime if it really bothers you that much  
I would recommend finding a site that lets you pay a monthly fee for  
ad-free access.


-Stut

--
http://stut.net/

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



Re: [PHP] Plotting Tool

2008-10-08 Thread Daniel Brown
On Wed, Oct 8, 2008 at 5:09 PM, Ashley Sheridan
<[EMAIL PROTECTED]> wrote:
>
> I really meant standards when I said basics. IMHO, standards are the
[snip!]

None of the list-newbies get smiley-less jokes here anymore.  What
is this world coming to?!?

> ps, for those that don't know, I'm referring to the cake M$ sent Firefox
> congratulating them on shipping Fx3!

Just this week I went on hiatus from the FF/TB development teams
and the Mozilla project in general.  I didn't get any cake!

-- 

More full-root dedicated server packages:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo.
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] Plotting Tool

2008-10-08 Thread Ashley Sheridan
On Wed, 2008-10-08 at 16:51 -0400, Daniel Brown wrote:

> On Wed, Oct 8, 2008 at 4:47 PM, Ashley Sheridan
> <[EMAIL PROTECTED]> wrote:
> >>
> > Obviously, I'm only advocating this as a last ditch alternative for a
> > browser that can't get even the basics right yet ;)
> 
> What do you mean, "basics"?  When you're Microsoft, you don't
> invent software to match the standards, you invent standards to match
> the software.
> 
> -- 
> 
> More full-root dedicated server packages:
> Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
> Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
> Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo.
> Dedicated servers, VPS, and hosting from $2.50/mo.
> 

I really meant standards when I said basics. IMHO, standards are the
baseline upon which browsers should build. That's how innovation gets
in. I'm not a fan of the M$ model, by which they define their own
standards. I think they are reconsidering their model though, as other
browsers eat more and more of their market share. I mean, IE8 is
actually a little bit closer to meeting the CSS2 requirements now,
surely we should applaud them that effort, or maybe send them a cake ;)

ps, for those that don't know, I'm referring to the cake M$ sent Firefox
congratulating them on shipping Fx3!


Ash
www.ashleysheridan.co.uk


Re: [PHP] Login

2008-10-08 Thread Ashley Sheridan
On Wed, 2008-10-08 at 21:45 +0100, Stut wrote:
> On 8 Oct 2008, at 21:44, Ashley Sheridan wrote:
> > On Wed, 2008-10-08 at 16:33 -0400, Wolf wrote:
> >> 
> >>> Redirects make sense IMO. IIRC the Yahoo guidelines say not to
> >>> redirect after a form POST, but unless you have a ka-jillion page
> >>> views a second (or, "a lot"), then I don't think it's a concern.
> >>
> >> Wait, Yahell has guidelines?!?!?
> >>
> >> You always have to look at the User Experience.  You don't want to  
> >> annoy or p!ss off your users or they will find a site like yours  
> >> that doesn't p!ss them off.  If it makes sense to re-direct the  
> >> user after a successful login, then go ahead and do it.
> >>
> >> Of course, I don't care if I p!ss off someone who is trying to run  
> >> malicious code on my site or find a hidden piece.  Then a redirect  
> >> to ratemypoo seems like a good idea to me!
> >>
> >> Wolf
> >>
> > The only redirects that have p!ssed me off before are those ones that
> > big sites put in to make room for their adverts. On more than one
> > occassion I've decided to look elsewhere for whatever it was I was
> > looking for, although it tends only to be game and (legal) download
> > sites that do this.
> 
> Yeah, I hate it when companies try to make a profit. Don't they know  
> everything on the Internet is supposed to be free?!?!?!?
> 
> Find your stuff elsewhere by all means, but don't slate sites for  
> using advertising to pay for your FREE usage of their service.
> 
> -Stut
> 
> PS. For those sarcasm-detector-challenged out there the first  
> paragraph was full of sarcasm.
> 
I'm not against advertising, just this kind. It makes you sit through a
30 second long advert before you get to the sweet stuff. Now, I don't
have a bandwidth limit, but what about those users who do? Inline
adverts are better, and Google has them worked to a tee. If the model
doesn't work for the big companies then, it's time to find a new model,
but I think one in which the visitors to a site are treated like TV
viewers is not the way to go.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Plotting Tool

2008-10-08 Thread Daniel Brown
On Wed, Oct 8, 2008 at 4:47 PM, Ashley Sheridan
<[EMAIL PROTECTED]> wrote:
>>
> Obviously, I'm only advocating this as a last ditch alternative for a
> browser that can't get even the basics right yet ;)

What do you mean, "basics"?  When you're Microsoft, you don't
invent software to match the standards, you invent standards to match
the software.

-- 

More full-root dedicated server packages:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo.
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] magic_quotes

2008-10-08 Thread Stut

On 8 Oct 2008, at 21:38, Bryan wrote:

My web site consists of some hard-coded html but on the main, data is
stored in MySQL and through the use of PHP I generate pages of html.

Everything went well this year until around June/July time when I
started noticing quotes (') were escaped in the generated html, so
"it's" would appear as "it\'s".  I use Dreamweaver 8 to develop my
site.

Hard-coded html is fine, it also obeys any CSS within it, PHP
generated html however doesn't obey CSS or URL's.

Looking at my computer server setup everything runs properly on the PC
but not on my webspace, it ran OK for 18 months on both.  Looking at
php.ini on my PC I note magic_quotes_gpc is set to on and
magic_quotes_runtime is set to off.  On my webspace I note
magic_quotes_gpc is set to on as is magic_quotes_runtime, I assume
this is what's screwing up the PHP generated html.

Is there a way to avoid this?


http://stut.net/blog/2008/06/08/where-are-these-backslashes-coming-from/

-Stut

--
http://stut.net/

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



Re: [PHP] Login

2008-10-08 Thread Stut

On 8 Oct 2008, at 21:44, Ashley Sheridan wrote:

On Wed, 2008-10-08 at 16:33 -0400, Wolf wrote:



Redirects make sense IMO. IIRC the Yahoo guidelines say not to
redirect after a form POST, but unless you have a ka-jillion page
views a second (or, "a lot"), then I don't think it's a concern.


Wait, Yahell has guidelines?!?!?

You always have to look at the User Experience.  You don't want to  
annoy or p!ss off your users or they will find a site like yours  
that doesn't p!ss them off.  If it makes sense to re-direct the  
user after a successful login, then go ahead and do it.


Of course, I don't care if I p!ss off someone who is trying to run  
malicious code on my site or find a hidden piece.  Then a redirect  
to ratemypoo seems like a good idea to me!


Wolf


The only redirects that have p!ssed me off before are those ones that
big sites put in to make room for their adverts. On more than one
occassion I've decided to look elsewhere for whatever it was I was
looking for, although it tends only to be game and (legal) download
sites that do this.


Yeah, I hate it when companies try to make a profit. Don't they know  
everything on the Internet is supposed to be free?!?!?!?


Find your stuff elsewhere by all means, but don't slate sites for  
using advertising to pay for your FREE usage of their service.


-Stut

PS. For those sarcasm-detector-challenged out there the first  
paragraph was full of sarcasm.


--
http://stut.net/

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



Re: [PHP] Plotting Tool

2008-10-08 Thread Ashley Sheridan
On Wed, 2008-10-08 at 21:35 +0100, Richard Heyes wrote:
> >I think Richard Heyes was working on some of these, actually.  Not
> > positive if it was plotting or just display, though.  If you check the
> > archives, you might find something.  I'm CC'ing him personally, too.
> >
> >Here's one link of his I have from memory:
> >
> >http://www.phpguru.org/RGraph_dev/examples/bar.html
> 
> Working on it yes, but until MSIE supports the canvas tag (part of
> HTML5) it's not really usable for providing graphs to the public.
> 
> When it does though, it'll be a great way of reducing the strain on
> your server... :-)
> 
> -- 
> Richard Heyes
> 
> HTML5 Graphing for FF, Chrome, Opera and Safari:
> http://www.phpguru.org/RGraph
> 
What about splitting the output between using the canvas tag and VML
which only IE supports. From my only foray into VML, the syntax is
pretty simple, and similar to SVG, and is supported by IE5.5+.
Obviously, I'm only advocating this as a last ditch alternative for a
browser that can't get even the basics right yet ;)


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Login

2008-10-08 Thread Ashley Sheridan
On Wed, 2008-10-08 at 16:33 -0400, Wolf wrote:
> 
> > Redirects make sense IMO. IIRC the Yahoo guidelines say not to
> > redirect after a form POST, but unless you have a ka-jillion page
> > views a second (or, "a lot"), then I don't think it's a concern.
> 
> Wait, Yahell has guidelines?!?!?
> 
> You always have to look at the User Experience.  You don't want to annoy or 
> p!ss off your users or they will find a site like yours that doesn't p!ss 
> them off.  If it makes sense to re-direct the user after a successful login, 
> then go ahead and do it.
> 
> Of course, I don't care if I p!ss off someone who is trying to run malicious 
> code on my site or find a hidden piece.  Then a redirect to ratemypoo seems 
> like a good idea to me!
> 
> Wolf
> 
The only redirects that have p!ssed me off before are those ones that
big sites put in to make room for their adverts. On more than one
occassion I've decided to look elsewhere for whatever it was I was
looking for, although it tends only to be game and (legal) download
sites that do this.


Ash
www.ashleysheridan.co.uk


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



[PHP] magic_quotes

2008-10-08 Thread Bryan
My web site consists of some hard-coded html but on the main, data is 
stored in MySQL and through the use of PHP I generate pages of html.

Everything went well this year until around June/July time when I 
started noticing quotes (') were escaped in the generated html, so 
"it's" would appear as "it\'s".  I use Dreamweaver 8 to develop my 
site.

Hard-coded html is fine, it also obeys any CSS within it, PHP 
generated html however doesn't obey CSS or URL's.

Looking at my computer server setup everything runs properly on the PC 
but not on my webspace, it ran OK for 18 months on both.  Looking at 
php.ini on my PC I note magic_quotes_gpc is set to on and 
magic_quotes_runtime is set to off.  On my webspace I note 
magic_quotes_gpc is set to on as is magic_quotes_runtime, I assume 
this is what's screwing up the PHP generated html.

Is there a way to avoid this?

Bryan

-- 
Using an Iyonix Aria Cube running Risc OS 5.13 and Virtual RPC 
AdjustSA running RO 6.10 on a PC.

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



Re: [PHP] Plotting Tool

2008-10-08 Thread Richard Heyes
>I think Richard Heyes was working on some of these, actually.  Not
> positive if it was plotting or just display, though.  If you check the
> archives, you might find something.  I'm CC'ing him personally, too.
>
>Here's one link of his I have from memory:
>
>http://www.phpguru.org/RGraph_dev/examples/bar.html

Working on it yes, but until MSIE supports the canvas tag (part of
HTML5) it's not really usable for providing graphs to the public.

When it does though, it'll be a great way of reducing the strain on
your server... :-)

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.phpguru.org/RGraph

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



Re: [PHP] Login

2008-10-08 Thread Wolf

> Redirects make sense IMO. IIRC the Yahoo guidelines say not to
> redirect after a form POST, but unless you have a ka-jillion page
> views a second (or, "a lot"), then I don't think it's a concern.

Wait, Yahell has guidelines?!?!?

You always have to look at the User Experience.  You don't want to annoy or 
p!ss off your users or they will find a site like yours that doesn't p!ss them 
off.  If it makes sense to re-direct the user after a successful login, then go 
ahead and do it.

Of course, I don't care if I p!ss off someone who is trying to run malicious 
code on my site or find a hidden piece.  Then a redirect to ratemypoo seems 
like a good idea to me!

Wolf

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



Re: [PHP] Login

2008-10-08 Thread Richard Heyes
> I would recommend using the include method. Redirects should always
>> be second choice, because they are just evil.
>
> In this case I would disagree. On successful login it's normal to redirect
> to a useful page rather than just display a page that says "congratulations,
> you're a real user". In the case of an unsuccessful login why would you need
> to include another file? Surely the logic that follows is part of the login
> script.

Agreed. Flow could be described as this:

Not logged in --> Login page --> Logged in

Redirects make sense IMO. IIRC the Yahoo guidelines say not to
redirect after a form POST, but unless you have a ka-jillion page
views a second (or, "a lot"), then I don't think it's a concern.

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.phpguru.org/RGraph

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



Re: [PHP] sms interfaces?

2008-10-08 Thread Jignesh Thummar
www.frengo.com provides SMS alert service.

- Jignesh

On Thu, Oct 9, 2008 at 1:25 AM, Boyd, Todd M. <[EMAIL PROTECTED]> wrote:

> > -Original Message-
> > From: Rene Veerman [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, October 08, 2008 2:33 PM
> > To: php-general@lists.php.net
> > Subject: [PHP] sms interfaces?
> >
> > hi, i'd like my app to send sms warnings of some events.
> >
> > if you know of a free / cheap sms service that can be called from php,
> > please let me/us know.
> >
> > u earn extra points if it can send to dutch phones / any phone in the
> > world ;)
>
> AIM accounts can be used to send messages to SMS by using the full phone
> number (i.e., +15735551212) as the contact destination. There's probably
> APIs for the service already, be it WSDL or PHP, etc.
>
>
> Todd Boyd
> Web Programmer
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


RE: [PHP] sms interfaces?

2008-10-08 Thread Boyd, Todd M.
> -Original Message-
> From: Rene Veerman [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, October 08, 2008 2:33 PM
> To: php-general@lists.php.net
> Subject: [PHP] sms interfaces?
> 
> hi, i'd like my app to send sms warnings of some events.
> 
> if you know of a free / cheap sms service that can be called from php,
> please let me/us know.
> 
> u earn extra points if it can send to dutch phones / any phone in the
> world ;)

AIM accounts can be used to send messages to SMS by using the full phone
number (i.e., +15735551212) as the contact destination. There's probably
APIs for the service already, be it WSDL or PHP, etc.


Todd Boyd
Web Programmer

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



Re: [PHP] sms interfaces?

2008-10-08 Thread Rene Veerman

thanks!

Stut wrote:

On 8 Oct 2008, at 20:33, Rene Veerman wrote:

hi, i'd like my app to send sms warnings of some events.

if you know of a free / cheap sms service that can be called from 
php, please let me/us know.


u earn extra points if it can send to dutch phones / any phone in the 
world ;)


Best I've found is Clickatell (www.clickatell.com) but I've not really 
looked too hard.


-Stut




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



Re: [PHP] sms interfaces?

2008-10-08 Thread Stut

On 8 Oct 2008, at 20:33, Rene Veerman wrote:

hi, i'd like my app to send sms warnings of some events.

if you know of a free / cheap sms service that can be called from  
php, please let me/us know.


u earn extra points if it can send to dutch phones / any phone in  
the world ;)


Best I've found is Clickatell (www.clickatell.com) but I've not really  
looked too hard.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: Manipulating strings

2008-10-08 Thread Ashley Sheridan
On Wed, 2008-10-08 at 11:37 -0700, Yeti wrote:
>  #let's say we got following string:
> $some_string = 'blah blahblah blah';
> var_dump(explode('', $some_string));
> /* OUTPUT:
> array(4) {
>   [0]=>
>   string(0) ""
>   [1]=>
>   string(9) "blah blah"
>   [2]=>
>   string(9) "blah blah"
>   [3]=>
>   string(0) ""
> }
> */
> #So as you see index 0 and index 3 are empty strings. Keep that in mind
> ?>
> 
You could use trim() on it first. I believe that lets you take out the
delimiters at the ends of the string.


Ash
www.ashleysheridan.co.uk


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



[PHP] sms interfaces?

2008-10-08 Thread Rene Veerman

hi, i'd like my app to send sms warnings of some events.

if you know of a free / cheap sms service that can be called from php, 
please let me/us know.


u earn extra points if it can send to dutch phones / any phone in the 
world ;)


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



Re: [PHP] Re: Manipulating strings

2008-10-08 Thread Yeti
blah blahblah blah';
var_dump(explode('', $some_string));
/* OUTPUT:
array(4) {
  [0]=>
  string(0) ""
  [1]=>
  string(9) "blah blah"
  [2]=>
  string(9) "blah blah"
  [3]=>
  string(0) ""
}
*/
#So as you see index 0 and index 3 are empty strings. Keep that in mind
?>

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



Re: [PHP] Login

2008-10-08 Thread Ashley Sheridan
On Wed, 2008-10-08 at 20:02 +0100, Stut wrote:
> On 8 Oct 2008, at 19:52, Bernhard Kohl wrote:
> >  > # I would recommend using the include method. Redirects should always
> > be second choice, because they are just evil.
> 
> In this case I would disagree. On successful login it's normal to  
> redirect to a useful page rather than just display a page that says  
> "congratulations, you're a real user". In the case of an unsuccessful  
> login why would you need to include another file? Surely the logic  
> that follows is part of the login script.
> 
> It's all a personal preference tho. I used to think that redirects  
> should not be used unless absolutely necessary but the reasons people  
> give are generally religious rather than logical.
> 
> > # Example code below
> > $password = md5('swordfish');
> > $user = 'Trucker Joe';
> > if ($_POST['user'] == $user && md5($_POST['password']) == $password) {
> > include_once('login_successful.php');
> > } else {
> > include_once('login_failed.php');
> > }
> > # Some may also hash the user to prevent injection
> > # http://us.php.net/manual/en/function.include.php
> > # http://en.wikipedia.org/wiki/Code_injection#PHP_Injection
> 
> I see nothing in that code that would be open to code injection.
> 
> -Stut
> 
> -- 
> http://stut.net/
> 
I usually include verification on each page, so I'll redirect if they
are not logged in, but process them as normal throughout that script if
they are. I guess like all things PHP, there's 101 ways to do something,
and it's just down to preference and those little details...


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Re[2]: The 'at' sign (@) variable prefix

2008-10-08 Thread Ashley Sheridan
On Wed, 2008-10-08 at 12:01 -0700, mike wrote:
> On Wed, Oct 8, 2008 at 4:06 AM, ANR Daemon <[EMAIL PROTECTED]> wrote:
> 
> > If you're using it to deal with possible empty input data, you'd better do 
> > it
> > explicitly enstead.
> >
> > Something like this:
> >
> >  if(!array_key_exists('from_year', $_POST)
> >|| !array_key_exists('from_month', $_POST)
> >|| !array_key_exists('from_day', $_POST)
> >)
> >  {
> >throw new Exception('No start date given', 100);
> >  }
> 
> *cough*
> 
> filter_input does this elegantly too ;) as does an isset() on the array index
> 
I'm a fan of the isset() method for POST and GET variables, as usually
I'll still want to put something in the variables I'm assigning those
values to, rather than the NULL which gets returned by the @ prefix.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Login

2008-10-08 Thread Stut

On 8 Oct 2008, at 19:52, Bernhard Kohl wrote:



In this case I would disagree. On successful login it's normal to  
redirect to a useful page rather than just display a page that says  
"congratulations, you're a real user". In the case of an unsuccessful  
login why would you need to include another file? Surely the logic  
that follows is part of the login script.


It's all a personal preference tho. I used to think that redirects  
should not be used unless absolutely necessary but the reasons people  
give are generally religious rather than logical.



# Example code below
$password = md5('swordfish');
$user = 'Trucker Joe';
if ($_POST['user'] == $user && md5($_POST['password']) == $password) {
include_once('login_successful.php');
} else {
include_once('login_failed.php');
}
# Some may also hash the user to prevent injection
# http://us.php.net/manual/en/function.include.php
# http://en.wikipedia.org/wiki/Code_injection#PHP_Injection


I see nothing in that code that would be open to code injection.

-Stut

--
http://stut.net/

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



Re: [PHP] Re[2]: The 'at' sign (@) variable prefix

2008-10-08 Thread mike
On Wed, Oct 8, 2008 at 4:06 AM, ANR Daemon <[EMAIL PROTECTED]> wrote:

> If you're using it to deal with possible empty input data, you'd better do it
> explicitly enstead.
>
> Something like this:
>
>  if(!array_key_exists('from_year', $_POST)
>|| !array_key_exists('from_month', $_POST)
>|| !array_key_exists('from_day', $_POST)
>)
>  {
>throw new Exception('No start date given', 100);
>  }

*cough*

filter_input does this elegantly too ;) as does an isset() on the array index

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



Re: [PHP] Login

2008-10-08 Thread Ashley Sheridan
On Wed, 2008-10-08 at 11:52 -0700, Bernhard Kohl wrote:
>  # I would recommend using the include method. Redirects should always
> be second choice, because they are just evil.
> # Example code below
> $password = md5('swordfish');
> $user = 'Trucker Joe';
> if ($_POST['user'] == $user && md5($_POST['password']) == $password) {
> include_once('login_successful.php');
> } else {
> include_once('login_failed.php');
> }
> # Some may also hash the user to prevent injection
> # http://us.php.net/manual/en/function.include.php
> # http://en.wikipedia.org/wiki/Code_injection#PHP_Injection
> ?>
> 
Also, generally speaking, it is a good idea to verify a user against
their $_SESSION on every page to verify that they have gone through the
login procedure and not just gone directly to an URL in the site.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Login

2008-10-08 Thread Bernhard Kohl
http://us.php.net/manual/en/function.include.php
# http://en.wikipedia.org/wiki/Code_injection#PHP_Injection
?>

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



Re: [PHP] Selecting all records between a date range

2008-10-08 Thread Eric Butera
On Thu, Oct 2, 2008 at 12:35 PM, Jason Pruim <[EMAIL PROTECTED]> wrote:
> Hi Everyone,
>
> I am working on a app where I need to be able to select all the values from
> a database where the 'timein' field is between a certain date range...
> Essentially the last 7 days...
>
> here is the code that I am working with:
>
>$rangeBegin = strtotime("Last week thursday midnight");
>$rangeEnd = strtotime("Today now");
>
>
>$SQLTEST = "SELECT * FROM `timeStore` WHERE `timein` BETWEEN
> {$rangeBegin} AND {$rangeEnd}";
>echo "SQLTEST: " . $SQLTEST . "";
>SQLTEST: SELECT * FROM `timeStore` WHERE`timein` BETWEEN
> 1222315200 AND 122292
> Could not perform query: Query was empty
>
> All of my times are stored as unix timestamps in the database, such as:
>
> +--+
> | timein | timeout| empID | record |
> +++---++
> | 1222354037 | 1222382837 | 1 |107 |
> | 1222440437 | 1222469237 | 1 |108 |
> | 1222526837 | 1222555637 | 1 |109 |
> | 1222613237 | 1222642037 | 1 |110 |
> | 1222699637 | 1222728437 | 1 |111 |
> | 1222359217 | 1222359220 | 2 |115 |
> | 1222359214 | 1222359220 | 2 |114 |
> | 1222359219 | 1222359220 | 2 |116 |
> | 1222359231 | 1222359566 | 2 |117 |
> +--+
>
> Anyone has any ideas? Or maybe a better way? :)
>
> --
>
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 11287 James St
> Holland, MI 49424
> www.raoset.com
> [EMAIL PROTECTED]
>
>
>
>
>


You can do this:

$startTS = time() or mktime for today at midnight
strtotime("-1 week", $startTs)

and make your query use these params.

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



Re: [PHP] Re: Prefered Method for User authetification on VHosts

2008-10-08 Thread Per Jessen
Michelle Konzack wrote:

> Am 2008-10-07 08:34:42, schrieb Per Jessen:
>> > I like to know, whether this  is  good  enough  or  is  there  a
>> > better solution?
>> 
>> Good enough depends entirely on your security requirements, i.e. how
>> safe do you need the authenticated access to be?  Are you protecting
>> something that is valuable to others? Etc etc.
> 
> It is the admistrations interface to my  web-site  and  for  some 
> users parts of it.  It is NOT about steeling valuable data but 
> modifing web- content and such things..

Then I think your method is perfectly adequate.  I'd probably use a
database myself, but yours is just as good security-wise.


/Per Jessen, Zürich


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



Re: [PHP] Selecting all records between a date range

2008-10-08 Thread Andrew Ballard
On Tue, Oct 7, 2008 at 9:16 PM, Chris <[EMAIL PROTECTED]> wrote:
> Dan Joseph wrote:
>>
>> On Thu, Oct 2, 2008 at 12:35 PM, Jason Pruim <[EMAIL PROTECTED]> wrote:
>>
>>>   SQLTEST: SELECT * FROM `timeStore` WHERE`timein` BETWEEN
>>> 1222315200 AND 122292
>>> Could not perform query: Query was empty
>>>
>>> <[EMAIL PROTECTED]>
>>
>>
>> Put a ' around your timestamp numbers.  I think that should fix that
>> query.
>> Although I'll admitt, I have no way to test that on mysql, but that is how
>> MS SQL works...
>
> Int's don't need quoting in mysql (or postgres, or oracle).. not sure why
> ms-sql would need that.
>

MS SQL doesn't need them for integer values either. I'm not sure why
you would want to do that.

Andrew

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



Re: [PHP] Missing Env. Variables when called by AT Scheduler

2008-10-08 Thread Thodoris



JJB wrote:
We regularly send out massive mail blasts to our customers. Recently 
several mail blasts failed to transmit. After a serious amount of 
research we found the snippet of code below to be the place where it 
was breaking down. The issue it seems is that the Environment 
Variables HOST and SERVER_NAME are sometimes not returning true when 
executed from the Linux AT scheduler. (using atq commands).  doing a 
php -i from the command line returns the correct values, as does 
putting in a php info command at the top of the script and opening it 
from a browser.


I doubt php -i does that at all.

$ php -i | grep 'SERVER_NAME'
$


$_SERVER['SERVER_NAME'] and $_SERVER['HOST'] are set by web servers, 
they are not available through php-cli.




It makes sense doesn't it? Since you don't have a server when calling a 
script using cli and you don't make a request the $_SERVER and $_REQUEST 
arrays are not available.


--
Thodoris


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



Re: [PHP] strtotime problem

2008-10-08 Thread Thodoris




From your function name I assume you want to use it in MySQL. In that 
case, why don't you have MySQL do all the magic for you?

eg. INSERT INTO table (col) VALUES (FROM_UNIXTIME($timestamp));
(using FROM_UNIXTIME($timestamp) will give you the date-time in "mysql 
format" (-MM-DD HH:MM:SS) or any other format (if given via the 
2nd parameter)




Well I have made these two functions to solve this:

function dateMysqlToWeb($mysqldate){

   $format = 'd/m/Y';
   $timestamp = strtotime($mysqldate);

   return date($format,$timestamp);

}

function dateWebToMysql($webdate){
  
   $format = 'Y-m-d';

   $date_part = explode("/",$webdate);
   $timestamp = mktime(0,0,0,$date_part[1],$date_part[0],$date_part[2]);

   return date($format,$timestamp);

}

My basic problem was how to make the user input from a form into a 
timestamp not how to use it with mysql. Since the format used here is 
dd/mm/ I can't use the strtotime directly bacause as far as I know 
from the documentation I don't think that it changes with the timezone 
(as Stut suggested). So since strtotime understands all these variations 
like:


mm/dd/, m/d/yy, mm/d/yy etc

I can't use this flexible behavior to get the input if it is not in the 
American format (and correct me if I am wrong). If I explode I will have 
to use the fixed format dd/mm/ and I can't use other input formats 
beside this so I lose this flexible approach.


It does work for me now but I was wondering if there was a way to avoid 
this.


--
Thodoris


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



Re: [PHP] strtotime problem

2008-10-08 Thread Maciek Sokolewicz

Thodoris wrote:




Actually strtotime accepts all kinds of things... "Last week 
Thursday midnight" for example works perfectly.


You could do an explode on the field and then reorder the array 
anyway that you want...




Or something like that :)

That wasn't tested but should give you an idea...

php.net/explode for more info.






This is what I was doing before (which is a bit lame) so I am looking 
for a more elegant way using timestamps.


Well, If it's not already a timestamp, you can use mktime() to make it 
one, once it is then you should just be able to:




Of course this means that I will explode the date anyway so I will not 
need the intermediate transformation into timestamp.



to format and display it. I'm using that on a time card application 
right now and it's working great.


Is that more what you are looking for?




Actually this means that strtotime() was made with Americans *only* in 
mind... :-) .




From your function name I assume you want to use it in MySQL. In that 
case, why don't you have MySQL do all the magic for you?

eg. INSERT INTO table (col) VALUES (FROM_UNIXTIME($timestamp));
(using FROM_UNIXTIME($timestamp) will give you the date-time in "mysql 
format" (-MM-DD HH:MM:SS) or any other format (if given via the 2nd 
parameter)


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



Re: [PHP] strtotime problem

2008-10-08 Thread Jason Pruim


On Oct 8, 2008, at 7:58 AM, Thodoris wrote:





Actually strtotime accepts all kinds of things... "Last week  
Thursday midnight" for example works perfectly.


You could do an explode on the field and then reorder the array  
anyway that you want...




Or something like that :)

That wasn't tested but should give you an idea...

php.net/explode for more info.






This is what I was doing before (which is a bit lame) so I am  
looking for a more elegant way using timestamps.


Well, If it's not already a timestamp, you can use mktime() to make  
it one, once it is then you should just be able to:




Of course this means that I will explode the date anyway so I will  
not need the intermediate transformation into timestamp.


I was just giving that as an option incase it's not already a  
timestamp :)


I usually convert to timestamps as soon as the dates are given to the  
application and store them in the database.





to format and display it. I'm using that on a time card application  
right now and it's working great.


Is that more what you are looking for?




Actually this means that strtotime() was made with Americans only in  
mind... :-) .


As an American, I don't see a big issue with that :P But what Stut  
said is more then likely true... :)






--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]






[PHP] Re: Prefered Method for User authetification on VHosts

2008-10-08 Thread Michelle Konzack
Am 2008-10-07 08:34:42, schrieb Per Jessen:
> > I like to know, whether this  is  good  enough  or  is  there  a 
> > better solution?
> 
> Good enough depends entirely on your security requirements, i.e. how
> safe do you need the authenticated access to be?  Are you protecting
> something that is valuable to others? Etc etc.

It is the admistrations interface to my  web-site  and  for  some  users
parts of it.  It is NOT about steeling valuable data but  modifing  web-
content and such things..

Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator
24V Electronic Engineer
Tamay Dogan Network
Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
Michelle Konzack   Apt. 917  ICQ #328449886
+49/177/935194750, rue de Soultz MSN LinuxMichi
+33/6/61925193 67100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


Re: [PHP] strtotime problem

2008-10-08 Thread Stut

On 8 Oct 2008, at 12:58, Thodoris wrote:
Actually this means that strtotime() was made with Americans *only*  
in mind... :-) .


As far as I know it uses the configured timezone to decide between  
ambiguous formats.


-Stut

--
http://stut.net/

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



Re: [PHP] strtotime problem

2008-10-08 Thread Thodoris




Actually strtotime accepts all kinds of things... "Last week 
Thursday midnight" for example works perfectly.


You could do an explode on the field and then reorder the array 
anyway that you want...




Or something like that :)

That wasn't tested but should give you an idea...

php.net/explode for more info.






This is what I was doing before (which is a bit lame) so I am looking 
for a more elegant way using timestamps.


Well, If it's not already a timestamp, you can use mktime() to make it 
one, once it is then you should just be able to:




Of course this means that I will explode the date anyway so I will not 
need the intermediate transformation into timestamp.



to format and display it. I'm using that on a time card application 
right now and it's working great.


Is that more what you are looking for?




Actually this means that strtotime() was made with Americans *only* in 
mind... :-) .


--
Thodoris



Re: [PHP] strtotime problem

2008-10-08 Thread Jason Pruim


On Oct 8, 2008, at 7:08 AM, Thodoris wrote:

I know that *strtotime*() only recognises the formats mm/dd/,  
-mm-dd and mmdd

for numeric months but I need do something like that:

function dateWebToMysql($webdate){

$format = 'Y-m-d';
$timestamp = strtotime($webdate);

return date($format,$timestamp);

}

print dateWebToMysql('01/03/2008');

Where 01/03/2008 is in dd/mm/ format (not the American format).  
What is the best way of doing this?


Any ideas?


Actually strtotime accepts all kinds of things... "Last week Thursday  
midnight" for example works perfectly.


You could do an explode on the field and then reorder the array anyway  
that you want...




Or something like that :)

That wasn't tested but should give you an idea...

php.net/explode for more info.






--
Thodoris



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





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



Re: [PHP] Re: strtotime problem

2008-10-08 Thread Stut

On 8 Oct 2008, at 12:42, Nathan Rixham wrote:

Thodoris wrote:
I know that *strtotime*() only recognises the formats mm/dd/,  
-mm-dd and mmdd

for numeric months but I need do something like that:
function dateWebToMysql($webdate){
   $format = 'Y-m-d';
   $timestamp = strtotime($webdate);
   return date($format,$timestamp);
   }
print dateWebToMysql('01/03/2008');
Where 01/03/2008 is in dd/mm/ format (not the American format).  
What is the best way of doing this?

Any ideas?


completely random and never used myself [ie just made it up]

function dateWebToMysql( $webdate ){
return strtotime(strrev( str_replace('/','', $webdate) ));
}


What exactly do you expect strtotime('80023010') to return?

I tend to always normalise dates to Y-m-d before pushing them into  
strtotime, but in your case you don't need to do that. If you *know*  
the date always comes in as that format you can simply do this...


function dateWebToMysql($webdate)
{
list($day, $month, $year) = explode('/', $webdate);
return $year.'-'.$month.'-'.$day;
}

-Stut

--
http://stut.net/

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



[PHP] Re: strtotime problem

2008-10-08 Thread Nathan Rixham

Thodoris wrote:
I know that *strtotime*() only recognises the formats mm/dd/, 
-mm-dd and mmdd

for numeric months but I need do something like that:

function dateWebToMysql($webdate){

$format = 'Y-m-d';
$timestamp = strtotime($webdate);

return date($format,$timestamp);

}


print dateWebToMysql('01/03/2008');

Where 01/03/2008 is in dd/mm/ format (not the American format). What 
is the best way of doing this?


Any ideas?



completely random and never used myself [ie just made it up]

function dateWebToMysql( $webdate ){
 return strtotime(strrev( str_replace('/','', $webdate) ));
}

--
nathan ( [EMAIL PROTECTED] )
{
  Senior Web Developer
  php + java + flex + xmpp + xml + ecmascript
  web development edinburgh | http://kraya.co.uk/
}

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



Re: [PHP] strtotime problem

2008-10-08 Thread Jason Pruim


On Oct 8, 2008, at 7:24 AM, Thodoris wrote:





On Oct 8, 2008, at 7:08 AM, Thodoris wrote:

I know that *strtotime*() only recognises the formats mm/dd/,  
-mm-dd and mmdd

for numeric months but I need do something like that:

function dateWebToMysql($webdate){

   $format = 'Y-m-d';
   $timestamp = strtotime($webdate);
   return date($format,$timestamp);
   }

print dateWebToMysql('01/03/2008');

Where 01/03/2008 is in dd/mm/ format (not the American  
format). What is the best way of doing this?


Any ideas?


Actually strtotime accepts all kinds of things... "Last week  
Thursday midnight" for example works perfectly.


You could do an explode on the field and then reorder the array  
anyway that you want...




Or something like that :)

That wasn't tested but should give you an idea...

php.net/explode for more info.






This is what I was doing before (which is a bit lame) so I am  
looking for a more elegant way using timestamps.


Well, If it's not already a timestamp, you can use mktime() to make it  
one, once it is then you should just be able to:




to format and display it. I'm using that on a time card application  
right now and it's working great.


Is that more what you are looking for?

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





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



Re: [PHP] strtotime problem

2008-10-08 Thread Thodoris




On Oct 8, 2008, at 7:08 AM, Thodoris wrote:

I know that *strtotime*() only recognises the formats mm/dd/, 
-mm-dd and mmdd

for numeric months but I need do something like that:

function dateWebToMysql($webdate){

$format = 'Y-m-d';
$timestamp = strtotime($webdate);

return date($format,$timestamp);

}


print dateWebToMysql('01/03/2008');

Where 01/03/2008 is in dd/mm/ format (not the American format). 
What is the best way of doing this?


Any ideas?


Actually strtotime accepts all kinds of things... "Last week Thursday 
midnight" for example works perfectly.


You could do an explode on the field and then reorder the array anyway 
that you want...




Or something like that :)

That wasn't tested but should give you an idea...

php.net/explode for more info.






This is what I was doing before (which is a bit lame) so I am looking 
for a more elegant way using timestamps.


--
Thodoris


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



[PHP] strtotime problem

2008-10-08 Thread Thodoris
I know that *strtotime*() only recognises the formats mm/dd/, -mm-dd and mmdd 


for numeric months but I need do something like that:

function dateWebToMysql($webdate){

$format = 'Y-m-d';
$timestamp = strtotime($webdate);

return date($format,$timestamp);

}

print dateWebToMysql('01/03/2008');

Where 01/03/2008 is in dd/mm/ format (not the American format). What is the 
best way of doing this?

Any ideas?

--
Thodoris



[PHP] Re[2]: The 'at' sign (@) variable prefix

2008-10-08 Thread ANR Daemon
Greetings, ""Crash" Dummy".
In reply to Your message dated Tuesday, October 7, 2008, 15:54:14,

>>> mike schreef:

 Mon, Oct 6, 2008 at 12:17 PM, Daniel Brown <[EMAIL PROTECTED]
 wrote:

>> I will get an error, but if I prefix the value with '@',

>> [EMAIL PROTECTED]"q"];

> The @ is an error control operator, used to buffer the output
> and store it in a variable - $php_errormsg.   It's better to
> write clean, secure code, of course but sometimes error
> control is a good thing, too.  why not just use:
 $query = isset($_GET['q']) ? $_GET['q'] : '';

 that way it's always set.

 or even better (what I recommend):
 $query = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING);

 and get an empty string or a sanitized string, depending on if
 something exists.

>>> Mike's ways are both better than suppressing the error not only
>>> because error suppression in general sucks but because it's
>>> actually less performant to trigger this kind of error.

>> I second that. The @ symbol actually does this:

>> @action();

>> Becomes:

>> $old = ini_set("error_reporting", 0);
>> action();
>> ini_set("error_reporting", $old);

>> So, if you put that a hundred times all over your code, the errors
>> might be suppressed but your app is slow too.

> Thank you all. As I said, I learned this by osmosis, applying other
> people's code. I am not fluent in PHP. That is why I wanted a
> reference in the documents. I do not sprinkle the @ symbol through my
> code to avoid careful construction, I used it in a specific instance
> to deal with an empty query string, over which I had no control. I
> will study the alternatives offered here and do some recoding.

If you're using it to deal with possible empty input data, you'd better do it
explicitly enstead.

Something like this:

  if(!array_key_exists('from_year', $_POST)
|| !array_key_exists('from_month', $_POST)
|| !array_key_exists('from_day', $_POST)
)
  {
throw new Exception('No start date given', 100);
  }



-- 
Sincerely Yours, ANR Daemon <[EMAIL PROTECTED]>


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



Re: [PHP] Re: UTF-8 errors in RSS feed

2008-10-08 Thread Nathan Rixham

Ron Rademaker wrote:

Nathan Rixham wrote:

Ron Rademaker wrote:

Hi,

I'm trying to load an external rss feed into a DomDocument, the feed 
says it's uft-8 but DomDocument rightly disagrees. This causes a 
warning: Input is not proper UTF-8, indicate encoding ! Bytes: 0xA3 
0x36 0x35 0x20


Is there any way I can get DomDocument to skip that part of the feed. 
I'm not looking for the LIBXML_NOERROR option which results in not 
loading the feed at all. The feed has some incorrectly encoded pound 
sign in it that causes the problem. I'd much rather have the feed 
just without that pound sign (or maybe some weird character) than not 
having the feed at all.


Thanks,
Ron


it's probably in latin-1; try running it through utf8_encode first :)



That's not really an option when users can define their own RSS feeds, 
how can I tell which ones actually do as they say and which ones don't?


shameless plug; a few months ago I made a script rss_php which handles 
all of this for you; it's commercial however the classes which cover the 
encoding side are freely available here:

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

whether using them or simply checking the source, you'll find the 
solution :) [i hope! - works for me and 17k other people]


Regards!

--
nathan ( [EMAIL PROTECTED] )
{
  Senior Web Developer
  php + java + flex + xmpp + xml + ecmascript
  web development edinburgh | http://kraya.co.uk/
}

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



Re: [PHP] Prefered Method for User authetification on VHosts

2008-10-08 Thread Per Jessen
Jochem Maas wrote:

> seems like a lot of pain to go through, what with all that shell'ing
> out to grep data. I'd personally go for a simple DB table and
> use/store sha1() hashes.

My thoughts exactly. 


/Per Jessen, Zürich


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



Re: [PHP] Re: php framework vs just php?

2008-10-08 Thread Aschwin Wesselius

Luke wrote:

I can't say I've ever used a framework.

I like to be in control of all of my code, plus it's much more satisfying
when you write everything yourself (I've found anyway)...
If I want to make use of existing code, I rather have a good 
understanding and a grasp of the philosophy behind it. It is all about 
decisions anyway, so I better know why than just think 'whatever' or 'I 
don't care'.


Therefore I just make use of libraries. Most of it is my own code, some 
are just variations on existing code and I tweaked it to my needs (or 
philosophy).


Frameworks are nice. But I've never seen any other construction work in 
other fields making use of frameworks without customizing it over and 
over again. When people build a house, they can use ready-built parts 
etc. But when that house is finished, it doesn't need any backwards 
compatability. Housing has a lot of 'standards' and regulations or best 
practises. But they never use another framework exactly the same way as 
they did before.


You can say 'Software ain't the same as housing'. Correct. But there are 
similarities however that makes you think about what is a good practise 
and what not.


If you have a function and it works, but it is old code, you can still 
reuse it, modify it and apply it. That doesn't make a need for putting 
the modified version back into your old project, just for the sake of 
'maintainance'.


If I would be in the business of building houses, I would have to use 
pipes, cut them off, tweak them here and there to make them fit etc. 
That doesn't make a need for cut them all off already and tweak them for 
an older project, or next projects to come. No?


I rather have a good supply of small, workable, understandable pieces of 
code that could make up for a framework, but doesn't.


I don't want a house that is built on top of a factory framework with a 
lot of parts that makes it cloggy and won't be used at all.


That is just my idea of why I use a library, a toolkit, rather than 
frameworks that are oversized most of the time.

--

Aschwin Wesselius

/'What you would like to be done to you, do that to the other'/


Re: [PHP] Re: UTF-8 errors in RSS feed

2008-10-08 Thread Ron Rademaker

Nathan Rixham wrote:

Ron Rademaker wrote:

Hi,

I'm trying to load an external rss feed into a DomDocument, the feed 
says it's uft-8 but DomDocument rightly disagrees. This causes a 
warning: Input is not proper UTF-8, indicate encoding ! Bytes: 0xA3 
0x36 0x35 0x20


Is there any way I can get DomDocument to skip that part of the feed. 
I'm not looking for the LIBXML_NOERROR option which results in not 
loading the feed at all. The feed has some incorrectly encoded pound 
sign in it that causes the problem. I'd much rather have the feed 
just without that pound sign (or maybe some weird character) than not 
having the feed at all.


Thanks,
Ron


it's probably in latin-1; try running it through utf8_encode first :)



That's not really an option when users can define their own RSS feeds, 
how can I tell which ones actually do as they say and which ones don't?


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



Re: [PHP] Re: php framework vs just php?

2008-10-08 Thread Luke
I can't say I've ever used a framework.

I like to be in control of all of my code, plus it's much more satisfying
when you write everything yourself (I've found anyway)...

2008/10/8 paragasu <[EMAIL PROTECTED]>

> > PHP framework vs just php ?
> > http://paul-m-jones.com/?p=315
>
> according to the benchmark.Just PHP win by more than 100%  to average
> framework.
> even the fastest solar only manage to serve 154pages/sec compare to
> just php 1320pages/sec
>
> call me outdated. but i stay with just php!
>
> On 10/8/08, Eric Butera <[EMAIL PROTECTED]> wrote:
> > On Tue, Oct 7, 2008 at 2:47 PM, Ashley Sheridan
> > <[EMAIL PROTECTED]> wrote:
> >> On Tue, 2008-10-07 at 11:20 -0300, uaca man wrote:
> >>> Farid,
> >>>
> >>> I like to use PRADO(www.pradosoft.com), it is very easy to use for
> >>> those who are coming from Microsoft .Net platform as it uses the same
> >>> architecture. I did not like symfony, too much to read before the
> >>> first example.
> >>>
> >>> Angelo
> >>>
> >>> 2008/10/6 farid lópez <[EMAIL PROTECTED]>:
> >>> > what is your framework??? uacaman.
> >>> >
> >>> > i'm using symfony, but i'm reading the book. it's hard but there are
> so
> >>> > many
> >>> > things you can do easily with symfony!
> >>> >
> >>> > 2008/10/7 uaca man <[EMAIL PROTECTED]>
> >>> >
> >>> >> To be or not to be dump it your choice.
> >>> >>
> >>> >> My framework it not just awesome it is super awesome.
> >>> >>
> >>> >> Angelo
> >>> >>
> >>> >> 2008/10/6 Dan Joseph <[EMAIL PROTECTED]>:
> >>> >> > On Mon, Oct 6, 2008 at 1:01 PM, Jason Pruim <[EMAIL PROTECTED]>
> >>> >> > wrote:
> >>> >> >
> >>> >> >>
> >>> >> >> But... Which framework is better? :P
> >>> >> >>
> >>> >> >>
> >>> >> >>
> >>> >> >>
> >>> >> > Oh my.. now we're gonna get all those guys popping back up telling
> >>> >> > us how
> >>> >> > dumb we are and how awesome their frameworks are again!
> >>> >> >
> >>> >> > --
> >>> >> > -Dan Joseph
> >>> >> >
> >>> >> > www.canishosting.com - Plans start @ $1.99/month.
> >>> >> >
> >>> >> > "Build a man a fire, and he will be warm for the rest of the day.
> >>> >> > Light a man on fire, and will be warm for the rest of his life."
> >>> >> >
> >>> >>
> >>> >> --
> >>> >> PHP General Mailing List (http://www.php.net/)
> >>> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>> >>
> >>> >>
> >>> >
> >>> >
> >>> > --
> >>> > Atte
> >>> > Farid H. López Durán
> >>> >
> >>> > "La naturaleza del hombre es tal que puede conseguir la perfección
> >>> > únicamente cuando
> >>> > trabaja para el bienestar y la dignidad de sus conciudadanos".  Karl
> >>> > Marx
> >>> >
> >>>
> >> Don't frameworks introduce a lot more overhead to projects though?
> >>
> >>
> >> Ashhttp://
> mail.google.com/mail/?shva=1#label/php-general/11975743c3279e0f
> >> www.ashleysheridan.co.uk
> >>
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
> > Yep.  But there is always that balance between developer time versus
> > computing time.  Usually we can start with the quick developer win and
> > slowly attack slower areas.  Of course all of this is subjective and
> > every case requires a unique look.
> >
> > Look at this:
> >
> > http://paul-m-jones.com/?p=315
> >
>
> --
>  PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Luke Slater

-BEGIN PGP PUBLIC KEY BLOCK-
Version: GnuPG v1.4.9 (GNU/Linux)

mI0ESOkTJwEEAL4irZ9kb6VclXiNe4U8gTFGnyaRp4/29d0zwM6eIlAAP30o/iLM
QBLHSKAco0tNV+g9BAlm3QWRONLGNsPKBY4wqm75Scwri+wdrz0obdjO/rnwg0td
hQKpnBXULWJi3HwSEMruQJ6nEZfYCMvBxWIRZetsbbiFs5pLgpT6QLVHABEBAAG0
Nkx1a2UgU2xhdGVyIChJIGxvdmUgY29ybnkpIDx0aW5tYWNoaW4zQGdvb2dsZW1h
aWwuY29tPoi2BBMBAgAgBQJI6RMnAhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AA
CgkQe3smS6NtkbO24gP+Nt7aeYKK4R+HDQSXhr01rkcEpi6Jwdei3wmdX6knDyjE
mebI6ULyi7g+GCLjK6/9j04ri3j9kcGsKgI67kXt8iRaD0rPjLTdeJyInetNoOOJ
rEVp6HrthMW6g8j2PBDYnkPt0yR4K+Cn1krGbX7w41IWh3QO3FL+9OhLCaOd+u0=
=Zm5J
-END PGP PUBLIC KEY BLOCK-


[PHP] UTF-8 errors in RSS feed

2008-10-08 Thread Ron Rademaker

Hi,

I'm trying to load an external rss feed into a DomDocument, the feed 
says it's uft-8 but DomDocument rightly disagrees. This causes a 
warning: Input is not proper UTF-8, indicate encoding ! Bytes: 0xA3 0x36 
0x35 0x20


Is there any way I can get DomDocument to skip that part of the feed. 
I'm not looking for the LIBXML_NOERROR option which results in not 
loading the feed at all. The feed has some incorrectly encoded pound 
sign in it that causes the problem. I'd much rather have the feed just 
without that pound sign (or maybe some weird character) than not having 
the feed at all.


Thanks,
Ron

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



[PHP] Re: Manipulating strings

2008-10-08 Thread Nathan Rixham

Ron Piggott wrote:

I have a series of questions.

How do I count the number of  's in a string?

How do I add text in the middle of a string, let's say after the 3rd


Ron



simplest way from experience is to simply explode('', $the_string)
you can then count the array -1 for number of br's; and add text to the 
front and end of each; or indeed add/remove paragraphs before imploding 
it back together.


If you want more power, most would say use regex or str_ functions, 
however I'd recommend getting used to the DOMDocument to traverse the 
html and make fine grained adjustments.



regards,

--
nathan ( [EMAIL PROTECTED] )
{
  Senior Web Developer
  php + java + flex + xmpp + xml + ecmascript
  web development edinburgh | http://kraya.co.uk/
}

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



[PHP] Re: UTF-8 errors in RSS feed

2008-10-08 Thread Nathan Rixham

Ron Rademaker wrote:

Hi,

I'm trying to load an external rss feed into a DomDocument, the feed 
says it's uft-8 but DomDocument rightly disagrees. This causes a 
warning: Input is not proper UTF-8, indicate encoding ! Bytes: 0xA3 0x36 
0x35 0x20


Is there any way I can get DomDocument to skip that part of the feed. 
I'm not looking for the LIBXML_NOERROR option which results in not 
loading the feed at all. The feed has some incorrectly encoded pound 
sign in it that causes the problem. I'd much rather have the feed just 
without that pound sign (or maybe some weird character) than not having 
the feed at all.


Thanks,
Ron


it's probably in latin-1; try running it through utf8_encode first :)

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



Re: [PHP] PHP and getting part of URL

2008-10-08 Thread Per Jessen
Jason ML wrote:

> Hi PHP'ers,
> 
> PHP 4.4.8 and 5.
> 
> say I have a url like:
> 
> http://www.mydomain.tld/jason/index.php
> 
> In that index.php I want to have a piece of code that runs that tells
> me the 'jason' part of the URL so that I can run some custom read only
> queries for 'jason'
> 
> How can I do this? I know how to do everything except what PHP
> commands to run to get the info.


http://php.net/manual/en/function.parse-url.php


/Per Jessen, Zürich


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



[PHP] UTF-8 errors in RSS feed

2008-10-08 Thread Ron Rademaker

Hi,

I'm trying to load an external rss feed into a DomDocument, the feed 
says it's uft-8 but DomDocument rightly disagrees. This causes a 
warning: Input is not proper UTF-8, indicate encoding ! Bytes: 0xA3 0x36 
0x35 0x20


Is there any way I can get DomDocument to skip that part of the feed. 
I'm not looking for the LIBXML_NOERROR option which results in not 
loading the feed at all. The feed has some incorrectly encoded pound 
sign in it that causes the problem. I'd much rather have the feed just 
without that pound sign (or maybe some weird character) than not having 
the feed at all.


Thanks,
Ron

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