Re: [PHP] Inserting single quotes

2007-07-07 Thread Jim Lucas

skip evans wrote:

Yes, it turns out the production server did not have a php.ini file!!!

I copied the php.ini-recommended file into place, and it has 
magic_quotes_gpc off and that did the trick.


Thanks much!

Skip



A good thing to use though, is code that will detect if it is turned on.

Something like this

if ( get_magic_quotes_gpc() ) {
  $_GET = array_map("stripslashes", $_GET);
  $_POST= array_map("stripslashes", $_POST);
  $_REQUEST = array_map("stripslashes", $_REQUEST);
}

This way, it doesn't matter what the setting is, it will be corrected if 
it is turned on, no matter what.



--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



[PHP] what trick is this? How to do it?

2007-07-07 Thread Man-wai Chang
http://xsojix.imeem.com/music/1zyLl7y9/lost_my_music/

How did he/she do it? I meant the modal login window...

-- 
  @~@   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Xubuntu 7.04)  Linux 2.6.21.5
  ^ ^   16:39:01 up 19 days 6:11 0 users load average: 1.08 1.05 1.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

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



[PHP] Re: what trick is this? How to do it?

2007-07-07 Thread Colin Guthrie
Man-wai Chang wrote:
> http://xsojix.imeem.com/music/1zyLl7y9/lost_my_music/
> 
> How did he/she do it? I meant the modal login window...
> 

Just simple Javascript stuff. Just create a large div block that is
absolutely positioned over the top of everything and spans the whole
width/height of the page.

The either use alpha levels or a small 2x2 gif/png image that produces
the greyed out effect

0X
X0


Then draw your login in the middle of your div.

Not PHP, but it does look nice :)

Col

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



Re: [PHP] Re: PHP Brain Teasers

2007-07-07 Thread Tijnema

On 7/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Isn't this a PHP list? Why is there discussion about chickens?

if ($this == "PHP List") {
 unset('chicken discussion!');
}


Hmm, I'm too bad with this things :(

For me, the chicken never predated the chicken egg, and the chicken
egg never predated the chicken :)

Tijnema


On 7/6/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
> On Fri, 2007-07-06 at 21:40 -0400, tedd wrote:
> > At 10:24 AM -0400 7/6/07, Robert Cummings wrote:
> > >On Fri, 2007-07-06 at 10:08 -0400, tedd wrote:
> > >  > I doubt that one can demarcate the non-chicken parents from the
> > >>  chicken offspring. So... it is perplexing.
> > >
> > >We don't need to demarcate, we only need to know that it happened.
> >
> > Yes, but knowing that something has happened, does not mean that we
> > know how it happened.  :-)
>
> Actually in this case there is only one possible way it could have
> happened. I'll lay it out simply for you if I must, but it's simple
> logical progression.
>
> > This, my friend, is one of those things we can debate forever without
> > reaching a definitive answer.
>
> No, it absolutely has a definitive answer.
>
> > Thus, my assertion that this question is perplexing still stands.
> > Unless, of course, you wish to challenge it and thus confirm my
> > assertion further.  Check and mate.  :-)
>
> The basis of your assertion is incorrect. Methinks you're being
> presumptuous by declaring check and mate prematurely.
>
> Cheers,
> Rob.
> --
> ..
> | InterJinn Application Framework - http://www.interjinn.com |
> ::
> | An application and templating framework for PHP. Boasting  |
> | a powerful, scalable system for accessing system services  |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for   |
> | creating re-usable components quickly and easily.  |
> `'
>
> --
> 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





--
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

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



Re: [PHP] Re: what trick is this? How to do it?

2007-07-07 Thread Tijnema

On 7/7/07, Colin Guthrie <[EMAIL PROTECTED]> wrote:

Man-wai Chang wrote:
> http://xsojix.imeem.com/music/1zyLl7y9/lost_my_music/
>
> How did he/she do it? I meant the modal login window...
>

Just simple Javascript stuff. Just create a large div block that is
absolutely positioned over the top of everything and spans the whole
width/height of the page.

The either use alpha levels or a small 2x2 gif/png image that produces
the greyed out effect

0X
X0


Then draw your login in the middle of your div.

Not PHP, but it does look nice :)

Col


If you also want users to login first, don't do it like this ;)

I'm listening to the song now without logging in, just running this in
the URL bar:
javascript:floatingWindow.hide();
and the login window is gone :)

Tijnrma

--
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

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



[PHP] Re: what trick is this? How to do it?

2007-07-07 Thread Man-wai Chang
> I'm listening to the song now without logging in, just running this in
> the URL bar:
> javascript:floatingWindow.hide();
> and the login window is gone :)

So is there a proper way to create a modal window inside a browser?

-- 
  @~@   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Xubuntu 7.04)  Linux 2.6.21.6
  ^ ^   18:44:06 up 5 min 0 users load average: 1.54 1.07 0.47
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

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



Re: [PHP] Finding text in a variable

2007-07-07 Thread Alan Milnes

On 07/07/07, Robert Cummings <[EMAIL PROTECTED]> wrote:

On Fri, 2007-07-06 at 22:46 +0100, Alan Milnes wrote:
> I have a piece of code which uses curl to get a web page and puts it
> into a variable.  I now need to search that variable and find
> everything between `div class="msgarea"` and the next `/div`
>
> >From what I have found elsewhere I think I will need to use a regular
> expression but can anyone point me in the right direction as to
> exactly how I would go about this?

Something like the following:




Cheers - that did the trick.

Alan

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



[PHP] Re: what trick is this? How to do it?

2007-07-07 Thread M. Sokolewicz
Man-wai Chang wrote:
>> I'm listening to the song now without logging in, just running this in
>> the URL bar:
>> javascript:floatingWindow.hide();
>> and the login window is gone :)
> 
> So is there a proper way to create a modal window inside a browser?
> 

There is no "proper" way. You have various tools to make one with,
namely pretty much all client-side scripting languages that work in
browsers. There are no standards dictating how it should be done, it's
all left up to the developer, there are just 'options' :)

On a sidenote, this has nothing whatsoever to do with PHP, it's
presentation in a client-browser we're looking at.

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



Re: [PHP] checking for duplicate values among five variables

2007-07-07 Thread Kenn Murrah

Thanks, Robert ... that was EXACTLY what I needed.

kennM


Robert Cummings wrote:

On Fri, 2007-07-06 at 23:03 -0400, Robert Cummings wrote:
  

On Fri, 2007-07-06 at 21:51 -0500, Kenn Murrah wrote:

Can anyone help me with a way to determine of two or more variables have 
the same value?  For instance,


$a1 = 1000
$a2 = 2000
$a3 = 2000
$a4 = 4000
$a5 = 5000

I want check these five variables and determine whether, as in this 
case, two or more of the variables  have the same value.


Any suggestions how I can do this?
  




Should be:

for( $i = 1; $i <= 5; $i++ )

  

{
$hits[${'a'.$i}][] = 'a'.$i;
}
 
foreach( $hits as $value => $vars )

{
if( count( $vars ) > 1 )
{
echo 'Value: '.$value."\n";
print_r( $vars );
}
}

?>



Cheers,
Rob.
  


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



[PHP] Re: what trick is this? How to do it?

2007-07-07 Thread Man-wai Chang
> On a sidenote, this has nothing whatsoever to do with PHP, it's
> presentation in a client-browser we're looking at.

I asked here because I believe good PHP programmers are usually
well-versed in client-side stuffs. :)

-- 
  @~@   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Xubuntu 7.04)  Linux 2.6.21.6
  ^ ^   20:58:01 up 2:19 0 users load average: 1.01 1.02 1.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

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



Re: [PHP] Re: PHP Brain Teasers

2007-07-07 Thread tedd

At 8:26 PM -0700 7/6/07, [EMAIL PROTECTED] wrote:

Isn't this a PHP list? Why is there discussion about chickens?

if ($this == "PHP List") {
unset('chicken discussion!');
}



Because obviously, we occasionally wander off topic.

Your php example made your point very well and was within the subject 
-- nicely done.


But, you should had given us time to guess without providing an 
explanation. Sometimes, less is more.


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] getting timestamp for first day of current week

2007-07-07 Thread Olav Mørkrid

what i need is that "monday" means "monday this week", regardless of
whether i ask on monday, tuesday, wednesday, thursday, friday,
saturday or sunday.

the way php works now, i have to something like this:

 if(date("l") == "monday")
   $from = date("Y-m-d"); // if today if monday, just give today's date
 else
   $from = date("Y-m-d", strtotime("last monday")); // when asking on
tuesday thru sunday

it would be nice if strtotime understood the form "monday this week".

On 04/07/07, Robert Cummings <[EMAIL PROTECTED]> wrote:

On Wed, 2007-07-04 at 22:14 +0200, Olav Mørkrid wrote:
> On 03/07/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
>
> > If that's ALWAYS the case then it sounds like you have all the
> > information you need to get the Monday you want :)
>
> what do you mean?
>
> php clearly makes a mistake in giving monday of the current week.

I don't see how you figure "clearly makes a mistake". For instance the
following script illustrates a VERY clear behaviour that doesn't seem
mistaken to me, it seems more like a design choice:



You'll notice that it always presents the first such date from TODAY
ONWARDS.

With that in mind it is trivial to get the date YOU want.

Cheers,
Rob.
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'




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



Re: [PHP] checking for duplicate values among five variables

2007-07-07 Thread tedd

At 9:51 PM -0500 7/6/07, Kenn Murrah wrote:
Can anyone help me with a way to determine of two or more variables 
have the same value?  For instance,


$a1 = 1000
$a2 = 2000
$a3 = 2000
$a4 = 4000
$a5 = 5000

I want check these five variables and determine whether, as in this 
case, two or more of the variables  have the same value.


Any suggestions how I can do this?

Thanks in advance.

kenn


kenn:

You could use an array.

$a = array(1000, 2000, 2000, 4000, 5000);

$num_before = count($a);

$num_after = count(array_unique($a));

If two, or more, variables have the same value, variables $num_before 
and $num_after will be different.


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] About PHP CMS

2007-07-07 Thread Nathan Nobbe

to keep html separate from php you can also look at XSLT.
ive heard good and bad things about smarty.

-nathan

On 7/6/07, Davi <[EMAIL PROTECTED]> wrote:


Em Sexta 06 Julho 2007 21:24, Kelvin Park escreveu:
> Is it possible to have PHP code completely separate from the HTML page
that
> needs to be completely dynamic? (That's how ASP.NET sort of works I
think).
> If this is possible, HTML CODE, PHP CODE, AND THE CSS CODE can be
> completely separate, increasing the clarity of all the source code.
>
Yes.
Take a look at Smarty. :-)

http://smarty.php.net

> My second question is:
> Is it more efficient to always code OOP PHP then just simple functions
here
> and there?

How big is your project?
If you're talking about a personal visit counter, run away OOP.
If you're talking about a really big project (And yes, CMS _is_ a
big
project), go ahead and use OOP.

OOP is better to mantain... :-)

HTH

--
Davi Vidal
[EMAIL PROTECTED]
[EMAIL PROTECTED]
--
"Religion, ideology, resources, land,
spite, love or "just because"...
No matter how pathetic the reason,
it's enough to start a war. "

Por favor não faça top-posting, coloque a sua resposta abaixo desta linha.
Please don't do top-posting, put your reply below the following line.





Fwd: [PHP] About PHP CMS

2007-07-07 Thread Nathan Nobbe

forgot to copy the list on this one, sorry

-- Forwarded message --
From: Nathan Nobbe <[EMAIL PROTECTED]>
Date: Jul 7, 2007 2:13 PM
Subject: Re: [PHP] About PHP CMS
To: Kelvin Park <[EMAIL PROTECTED]>


On 7/7/07, Kelvin Park <[EMAIL PROTECTED]> wrote:
Can XSLT be used to separate CSS/XHTML/PHP/AJAX completely?

yes

XSLT is used to map one set of XML to another set of XML, thats what the
transform is all about.
ive only been working with it for a while so im not that good yet, but what
i do is build up XML data in
PHP; that XML maps to points in an xsl file.  then i use the PHP XSLT
functions  to render XHTML
by combining the XML data and the xsl file.  the XHTML is what gets sent to
the browser via echo.
you can use tools in PHP like SimpleXML and DOM to build up an XML
document.  i can send you a sample
if youd like.

also, if you want to separate javascript from PHP and XHTML thats really a
different issue.  in order to do that
you need to link in javascript externally via the 

Re: [PHP] About PHP CMS

2007-07-07 Thread Nathan Nobbe

kelvin,

here is the example:
catalog.php
load('catalog.xsl');
$xsl->importStyleSheet($doc);
$doc->load('catalog.xml');
echo $xsl->transformToXML($doc);
?>

catalog.xml




Empire Burlesque
Bob Dylan
USA
Columbia
10.90
1985



catalog.xsl

http://www.w3.org/1999/XSL/Transform";>




My CD Collection


Title
Artist














in this example the xml data is imported from a file rather than built in
memory.  also, i would like to mention that most browsers, ie, firefox and
opera namely can render the xhtml themselves given the xml and xsl files
which is something you may want to consider.

-nathan


On 7/6/07, Kelvin Park <[EMAIL PROTECTED]> wrote:


Is it possible to have PHP code completely separate from the HTML page
that
needs to be completely dynamic? (That's how ASP.NET sort of works I
think).
If this is possible, HTML CODE, PHP CODE, AND THE CSS CODE can be
completely
separate, increasing the clarity of all the source code.

My second question is:
Is it more efficient to always code OOP PHP then just simple functions
here
and there?



Fwd: [PHP] About PHP CMS

2007-07-07 Thread Nathan Nobbe

fogot to copy the list on this as well; my bad :(

-- Forwarded message --
From: Nathan Nobbe <[EMAIL PROTECTED]>
Date: Jul 7, 2007 3:00 PM
Subject: Re: [PHP] About PHP CMS
To: Kelvin Park <[EMAIL PROTECTED]>


On 7/7/07, Kelvin Park <[EMAIL PROTECTED]> wrote:
Looks like its quite a few steps to generate XHTML tags, from

PHP->XML->XSLT->XHTML, wouldn't it be more cumbersome to build a big website
(ex. commercial website)? Compare to just PHP->XHTML?

life is full of tradeoffs.  my understanding is there is a  tradeoff between
simplicity / complexity and performance / mantainability.  so if youre
trying to build something small that runs fast you can use the standard PHP
facility, ie




this is my page


my name is 

there are other approaches as well; i personally prefer building the html as
a string, so the previous example would become



this is my page


my name is ' . $myName;
echo $htmlOut;
?>
some people even build templating systems around these core PHP facilities.

but when building a large site templating systems facilitate the separation
between PHP and XHTML youre looking for.  i havent used Smarty, though ive
looked at it.
one of the big issues it presents is it is basically its own little
language, because logic can be embedded within a template.  so for instance,
if you want to build an HTML table and you have several rows worth of
content in an array, lets say, you could loop over the array within the
template producing the rows during said iteration.  so there is this issue
where a mistake could be made in the logic thats embedded in a Smarty
template, which begs the awesome question, how do you debug a Smarty
template?
so, truth be told, logic can be embedded in an xsl file as well.  really you
just need to create a set of conventions that dictate how much logic, if
any, will be allowed in template files.  that must be enforced for all
development on your site; the same could be done for a site built using
Smarty.  and also, i suppose there is an issue w/ broken logic in XSL
templates as well.  but the main reason i prefer XSL is because its a W3C
standard whereas Smarty is not.  also, XSL can be used w/ any language, not
just PHP so i feel i am more valuable knowomg i might be able to use XSL w/
other languages on other projects like java or .net or w/e.

i will send a sample when i get home, im at the office right now.

-nathan

On 7/7/07, Kelvin Park < [EMAIL PROTECTED]> wrote:


Looks like its quite a few steps to generate XHTML tags, from
PHP->XML->XSLT->XHTML, wouldn't it be more cumbersome to build a big website
(ex. commercial website)? Compare to just PHP->XHTML?

Yes, I would like to receive a sample of SimpleXML/DOM/XML.

Thanks!

On 7/7/07, Nathan Nobbe < [EMAIL PROTECTED]> wrote:
>
> > On 7/7/07, Kelvin Park <[EMAIL PROTECTED] > wrote:
> > Can XSLT be used to separate CSS/XHTML/PHP/AJAX completely?
> yes
>
> XSLT is used to map one set of XML to another set of XML, thats what the
> transform is all about.
> ive only been working with it for a while so im not that good yet, but
> what i do is build up XML data in
> PHP; that XML maps to points in an xsl file.  then i use the PHP XSLT
> functions  to render XHTML
>  by combining the XML data and the xsl file.  the XHTML is what gets
> sent to the browser via echo.
> you can use tools in PHP like SimpleXML and DOM to build up an XML
> document.  i can send you a sample
> if youd like.
>
> also, if you want to separate javascript from PHP and XHTML thats really
> a different issue.  in order to do that
> you need to link in javascript externally via the 

Re: [PHP] About PHP CMS

2007-07-07 Thread Anton C. Swartz IV
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.476 / Virus Database: 269.10.1/889 - Release Date: 7/6/2007 8:00 PM

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