php-general Digest 10 Aug 2006 11:46:28 -0000 Issue 4285

Topics (messages 240419 through 240457):

Re: Best way to get PHP5
        240419 by: Jochem Maas
        240422 by: Jack Gates
        240423 by: Chris W. Parker
        240450 by: Jochem Maas
        240457 by: Robin Vickery

List Meeting NNOT
        240420 by: Jay Blanchard
        240421 by: Richard Lynch
        240425 by: Jay Blanchard
        240426 by: Robert Cummings
        240427 by: Jay Blanchard
        240442 by: Paul Scott

Re: question about how php handles post'd and get'd data
        240424 by: Ligaya Turmelle

Re: Comment form spammer
        240428 by: Richard Lynch
        240430 by: Micky Hulse
        240432 by: Micky Hulse
        240436 by: Micky Hulse

Re: problem with quotes (single and double) in forms
        240429 by: Chris
        240433 by: J R
        240437 by: Chris
        240438 by: Chris
        240440 by: J R
        240441 by: Chris
        240447 by: Ivo F.A.C. Fokkema

Re: script stopped working- no output from unserialize()
        240431 by: Richard Lynch

Re: Create an EUC-JP encoded file just for download, not to be kept on server
        240434 by: Richard Lynch
        240435 by: Dave M G

Re: Dividing, and keeping, text from the first space
        240439 by: Dave M G

Including Google Ads
        240443 by: C.F. Scheidecker Antunes
        240444 by: Chris
        240445 by: Manuel Lemos
        240454 by: mwestern.sola.com.au

Re: Cron running 'Hello world' script dies with "Could not startup."
        240446 by: Ivo F.A.C. Fokkema

a quick one - case insensitive string comparison
        240448 by: Ross
        240449 by: Andries Seutens
        240451 by: Stut
        240452 by: Andries Seutens

Re: preg_match
        240453 by: Peter Lauri
        240456 by: Dave Goodchild

Re: Greek Characters from MySQL to PHP to the Browser: ??????
        240455 by: John Wells

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Jonathan Duncan wrote:
> 
> On Wed, 9 Aug 2006, Chris W. Parker wrote:
> 
>> Jack Gates <mailto:[EMAIL PROTECTED]>
>>    on Wednesday, August 09, 2006 10:16 AM said:
>>
>>> On Wednesday 09 August 2006 12:02, Chris W. Parker wrote:
>>>> I know that Fedora Core 5 offers PHP 5.1.2 but I've heard some
>>>> negative things about it in general (FC5).
>>>
>>> What sort of negative things have you heard in general about (FC5)?
>>
>> Honestly I don't remember. But I've now got a generally negative view of
>> FC5 versus previous versions (last one I used was 4 I think).
>>
>> If you're aware of any FUD that's been spread about it, feel free to
>> speak the truth.
>>
> 
> If you want to really learn Linux, try Gentoo.  If you just want a very
> good and easy to use Linux, go with SuSE.

sane words. debian is a good alterative to Gentoo (and there's Ubuntu which is a
more userfriendly derivative of debian).

personally I prefer eating razor blade than using something from redhat - I have
never used FC but if it's anything like RedHat Enterprise Server then I'd only 
use
as a bookend (if at all) if I were you. ;-)

FUD-tastic!

> 
> Jonathan
> 

--- End Message ---
--- Begin Message ---
On Wednesday 09 August 2006 19:24, Jochem Maas wrote:
> Jonathan Duncan wrote:
> > On Wed, 9 Aug 2006, Chris W. Parker wrote:
> >> Jack Gates <mailto:[EMAIL PROTECTED]>
> >>
> >>    on Wednesday, August 09, 2006 10:16 AM said:
> >>> On Wednesday 09 August 2006 12:02, Chris W. Parker wrote:
> >>>> I know that Fedora Core 5 offers PHP 5.1.2 but I've heard some
> >>>> negative things about it in general (FC5).
> >>>
> >>> What sort of negative things have you heard in general about
> >>> (FC5)?
> >>
> >> Honestly I don't remember. But I've now got a generally negative
> >> view of FC5 versus previous versions (last one I used was 4 I
> >> think).
> >>
> >> If you're aware of any FUD that's been spread about it, feel
> >> free to speak the truth.
> >
> > If you want to really learn Linux, try Gentoo.  If you just want
> > a very good and easy to use Linux, go with SuSE.
>
> sane words. debian is a good alterative to Gentoo (and there's
> Ubuntu which is a more userfriendly derivative of debian).
>
> personally I prefer eating razor blade than using something from
> redhat - I have never used FC but if it's anything like RedHat
> Enterprise Server then I'd only use as a bookend (if at all) if I
> were you. ;-)
>
> FUD-tastic!
>
> > Jonathan

Chris,

Jochem just proved what I said earlier.

Every one has their own preference and some go so far as to claim that 
the ones they just don't like are evil.  That is why there are so 
many different flavors of Linux.  That is also what will continue to 
hold Linux back in the market place and allow the truly evil OS to 
hold there market share on the desktop.

> personally I prefer eating razor blades to using something from
> Redmond Washington

-- 
Jack Gates http://www.morningstarcom.net/

--- End Message ---
--- Begin Message ---
Jonathan Duncan <mailto:[EMAIL PROTECTED]>
    on Wednesday, August 09, 2006 3:55 PM said:

> If you want to really learn Linux, try Gentoo.  If you just want a
> very good and easy to use Linux, go with SuSE.

To keep this related to the question I asked...

Do either of the latest builds of these distros have PHP5?


Thanks,
Chris.

--- End Message ---
--- Begin Message ---
Jack Gates wrote:
> On Wednesday 09 August 2006 19:24, Jochem Maas wrote:
>> Jonathan Duncan wrote:
>>> On Wed, 9 Aug 2006, Chris W. Parker wrote:
>>>> Jack Gates <mailto:[EMAIL PROTECTED]>
>>>>

...

>> FUD-tastic!
>>
>>> Jonathan
> 
> Chris,
> 
> Jochem just proved what I said earlier.
> 
> Every one has their own preference and some go so far as to claim that 
> the ones they just don't like are evil.  That is why there are so 
> many different flavors of Linux.  That is also what will continue to 
> hold Linux back in the market place and allow the truly evil OS to 
> hold there market share on the desktop.

I would say that's more down to billion dollar marketing budgets, anti-trust
business practices and the fact that a labotomized monkey could operate Windows
(where as you are at a real advantage using Linux if you have a complete 
brain.);
not to mention that M$ is probably the largest purveyor of linux-FUD of them 
all.

look Microsoft is doing everything it can to protect my children online**,
how can linux compete with that?

> 
>> personally I prefer eating razor blades to using something from
>> Redmond Washington

so Bill is not your uncle then?

> 

** 'everything' being drawing imaginary cartoon castles around some kids laptop
(oh and don't forget the imaginary cartoon guard dogs)

--- End Message ---
--- Begin Message ---
On 10/08/06, Chris W. Parker <[EMAIL PROTECTED]> wrote:
Jonathan Duncan <mailto:[EMAIL PROTECTED]>
    on Wednesday, August 09, 2006 3:55 PM said:

> If you want to really learn Linux, try Gentoo.  If you just want a
> very good and easy to use Linux, go with SuSE.

To keep this related to the question I asked...

Do either of the latest builds of these distros have PHP5?

Why not just look?

http://packages.gentoo.org/packages/?category=dev-lang;name=php
http://www.novell.com/products/linuxpackages/suselinux/php5.html

Although I have to say - if you're scared of compiling PHP, Gentoo's
probably not the distribution for you.

-robin

--- End Message ---
--- Begin Message ---
Here is a thought that a couple of us have shared off-list; why don't we
list denizens plan a get together? A face-to-face with the good, the bad
and the ugly. A mano y' mano curly brace holy war. Beers and meat. The
whole 9.2 Mb's.

So, what say you? Shall we start a more formal process? Set a date and a
place some time in the near (6 mos. or so) future? All are welcome, from
the newest of new to the crotchitiest of old.

Double-dog dare you.

--- End Message ---
--- Begin Message ---
On Wed, August 9, 2006 6:26 pm, Jay Blanchard wrote:
> Here is a thought that a couple of us have shared off-list; why don't
> we
> list denizens plan a get together? A face-to-face with the good, the
> bad
> and the ugly. A mano y' mano curly brace holy war. Beers and meat. The
> whole 9.2 Mb's.
>
> So, what say you? Shall we start a more formal process? Set a date and
> a
> place some time in the near (6 mos. or so) future? All are welcome,
> from
> the newest of new to the crotchitiest of old.
>
> Double-dog dare you.

Isn't that what the conferences are for???

I'm happy to host a small get-together in Chicago...

I'll throw in a couple kegs of beer and some munchies at Uncommon
Ground where I work. :-)
http://uncommonground.com/

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
[snip]
Isn't that what the conferences are for???

I'm happy to host a small get-together in Chicago...

I'll throw in a couple kegs of beer and some munchies at Uncommon
Ground where I work. :-)
http://uncommonground.com/
[/snip]

Yes, but not everyone can get to or goes to conferences. And this would
stand on its own don'tcha think? I think that Chicago is perfect,
because it is centrally located (kinda') and a neat place to boot.

--- End Message ---
--- Begin Message ---
On Wed, 2006-08-09 at 18:54 -0500, Jay Blanchard wrote:
> [snip]
> Isn't that what the conferences are for???
> 
> I'm happy to host a small get-together in Chicago...
> 
> I'll throw in a couple kegs of beer and some munchies at Uncommon
> Ground where I work. :-)
> http://uncommonground.com/
> [/snip]
> 
> Yes, but not everyone can get to or goes to conferences. And this would
> stand on its own don'tcha think? I think that Chicago is perfect,
> because it is centrally located (kinda') and a neat place to boot.

Sounds like fun, what kind of timeline are you imagining?

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.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
[snip]
> [snip]
> Isn't that what the conferences are for???
> 
> I'm happy to host a small get-together in Chicago...
> 
> I'll throw in a couple kegs of beer and some munchies at Uncommon
> Ground where I work. :-)
> http://uncommonground.com/
> [/snip]
> 
> Yes, but not everyone can get to or goes to conferences. And this
would
> stand on its own don'tcha think? I think that Chicago is perfect,
> because it is centrally located (kinda') and a neat place to boot.

Sounds like fun, what kind of timeline are you imagining?
[/snip]

Sometime in the next 6 months

--- End Message ---
--- Begin Message ---
On Wed, 2006-08-09 at 18:54 -0500, Jay Blanchard wrote:

> Yes, but not everyone can get to or goes to conferences. And this would
> stand on its own don'tcha think? I think that Chicago is perfect,
> because it is centrally located (kinda') and a neat place to boot.
> 

Kinda...Chicago is a bit of a drive for us in Cape Town, South
Africa... ;)

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

--- End Message ---
--- Begin Message ---
tedd wrote:
At 10:27 AM +1000 8/9/06, Ligaya Turmelle wrote:

jonathan wrote:

i was having a conversation and was wondering where in the source code for php is the process for writing get'd and post'd data to their corresponding arrays? Also, is there a way to view the source code online?

thanks,

jonathan

PHP's cvs is available online at http://cvs.php.net/viewvc.cgi/php-src/. Drill down far enough and you will get the source code.

Ex:
http://cvs.php.net/viewvc.cgi/php-src/main/fopen_wrappers.c?revision=1.183&view=markup


Damn, that's a lot of GET.

Where's the reference(s) for how to add your own code? Sorry, I haven't a clue as to where to look.

tedd
there are instructions to get the cvs download at - http://www.php.net/anoncvs.php For how to submit your code for the internals - join the internals mailing list and submit the patch. They will look it over (maybe suggest alterations) and decide whether to add it or not. If you want a bit more information on how the internals work - check out Sara Golemon's book "Extending and Embedding PHP" as well as http://lxr.php.net/

Hope that helps.

--

life is a game... so have fun.

--- End Message ---
--- Begin Message ---
On Wed, August 9, 2006 3:17 pm, Micky Hulse wrote:
> Recently, a client of mine was getting a ton of spam email from a site
> called hotbox.com. I updated her form to one with more spam security,
> but she is still receiving junk email.

If you are not already, PLEASE make sure that any headers you pass in
to mail(), including the "to", "subject", and "headers" args (1, 2,
and 4 args) do *NOT* have any newlines in the user-input data.

Cuz if you ain't doing that, you're not just letting them spam your
client, but also letting them inject spam to ALL OF US!

Don't do that. :-)

> Anyone feel like sharing code snippets that will help beef-up spam
> protection for a contact script?

I also just trash anybody trying to send HTML "enhanced" (cough,
cough) email through the website form -- You KNOW only a spammer is
going to sit there and type HTML into an email form on a website.

if (strip_tags($body) != $body) { die("spammer"); }

> Do you all enable a CAPTCHA system?

I did on one site that was just getting pounded -- Actually it was a
guestbook with site-owner approval, so the junk never went public, but
that didn't stop the automated spammers from trying anyway, and the
client sure didn't want to scroll through hundreds of "posts" to find
the one real one.  Sigh.

I *hate* CAPTCHA for various reasons, but I was stuck for any other
solution that would stop the junk...

YMMV

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
Quick note to Kevin Waterson:

Hehe, I think all this talk about spam sent my response to your reply into your spam filter... I got a bounce back. Thanks for help though... let me know if there is any way I can re-send the email without a bounce-back.

Richard Lynch wrote:
If you are not already, PLEASE make sure that any headers you pass in
to mail(), including the "to", "subject", and "headers" args (1, 2,
and 4 args) do *NOT* have any newlines in the user-input data.

Sounds good to me. Thanks for pointing that out.

I just found this link:

*Form Post Hijacking*
<http://www.anders.com/projects/sysadmin/formPostHijacking/>

Looks like the above article mentions the same thing and proposes this as a fix:

$_POST['email'] = preg_replace("/\r/", "", $_POST['email']); $_POST['email'] = preg_replace("/\n/", "", $_POST['email']);

This is another good one:

*Email Injection*
<http://www.securephpwiki.com/index.php/Email_Injection>

Cuz if you ain't doing that, you're not just letting them spam your
client, but also letting them inject spam to ALL OF US!
Don't do that. :-)

Man, spammers suck!!!!! I just had someone take over my own domain a couple weeks ago... thank god for Spam Assassin and Cpanel! :D

I also just trash anybody trying to send HTML "enhanced" (cough,
cough) email through the website form -- You KNOW only a spammer is
going to sit there and type HTML into an email form on a website.
if (strip_tags($body) != $body) { die("spammer"); }

Ahh, good point. So, with the above line, you are saying:

If the message body stripped of all html tags is not equal to the message body, then kill the script? Ah, makes perfect sense... a great way to test for html spam. Thanks for sharing! :D

Do you all enable a CAPTCHA system?

I did on one site that was just getting pounded -- Actually it was a
guestbook with site-owner approval, so the junk never went public, but
that didn't stop the automated spammers from trying anyway, and the
client sure didn't want to scroll through hundreds of "posts" to find
the one real one.  Sigh.

Man, that sucks. SMFing spammers. They really are annoying.

I *hate* CAPTCHA for various reasons, but I was stuck for any other
solution that would stop the junk...

Yeah, I would prefer to not setup a CAPTCHA too (although, I would like to learn how to script one)... hopefully implementing your (and everyone else's) great suggestions will really make my script hard to spam.

Thanks Richard, I really appreciate... you are always very helpful and your advice is top-notch. :)

Cheers,
Micky

--- End Message ---
--- Begin Message ---
Micky Hulse wrote:
Recently, a client of mine was getting a ton of spam email from a site called hotbox.com. I updated her form to one with more spam security, but she is still receiving junk email.

Hi all, thanks for the great responses (on/off list). I just realized that the spammer is not actually using the form to submit the spam, they are using the script directly... duH!

When I updated the form, I did not change the name or remove the old script... so she kept receiving tons of spam.

I just commented-out all of the PHP in the old script and added one line: die("#%$#@ off!");

Now that that is fixed, time to impliment all of your suggestions for making my script better. Thanks all for pointing-out the security holes and coding mistakes.

:: pats all who helped on back ::

You guys/gals rock!

Cheers,
Micky

--- End Message ---
--- Begin Message ---
Micky Hulse wrote:
I just commented-out all of the PHP in the old script and added one line: die("#%$#@ off!");

Actually... is there anything more I can do at this point to fight back? Can I use something better than die()? Or, is it best just to let them figure it out and go away?
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
Hi to all.

Have a web site on server where magic quote is turned On. Because of
problems with quotes within forms, I was thinking to turn it Off. I wonder
how much work I'll have to change code to accept new setting? Are we
talking about major changes or something that could be done in day or two
(the site has few couple-pages long forms and about 10 "regular" contact
us/register/edit membership/edit account/... forms)?

Copy it to a server where magic quotes is off and see what breaks. That will give you an idea of what needs fixing.

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

--- End Message ---
--- Begin Message ---
try to use this few lines of code.

function stripMagicQuotes(&$var)
{
   if (get_magic_quotes_gpc()) {
       $var    = stripslashes($var);
   }
   return $var;
}

this way you don't really have to worry if magic quotes is on or off.
**

On 8/10/06, Chris <[EMAIL PROTECTED]> wrote:

[EMAIL PROTECTED] wrote:
> Hi to all.
>
> Have a web site on server where magic quote is turned On. Because of
> problems with quotes within forms, I was thinking to turn it Off. I
wonder
> how much work I'll have to change code to accept new setting? Are we
> talking about major changes or something that could be done in day or
two
> (the site has few couple-pages long forms and about 10 "regular" contact
> us/register/edit membership/edit account/... forms)?

Copy it to a server where magic quotes is off and see what breaks. That
will give you an idea of what needs fixing.

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

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




--
GMail Rocks!!!

--- End Message ---
--- Begin Message ---
J R wrote:
try to use this few lines of code.

function stripMagicQuotes(&$var)
{
   if (get_magic_quotes_gpc()) {
       $var    = stripslashes($var);
   }
   return $var;
}

this way you don't really have to worry if magic quotes is on or off.

Then he has to modify all the code to call that function ;)

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

--- End Message ---
--- Begin Message ---
Chris wrote:
J R wrote:
try to use this few lines of code.

function stripMagicQuotes(&$var)
{
   if (get_magic_quotes_gpc()) {
       $var    = stripslashes($var);
   }
   return $var;
}

this way you don't really have to worry if magic quotes is on or off.

Then he has to modify all the code to call that function ;)


Hmm actually:

$_POST = stripMagicQuotes($_POST);

should do it I guess.. not exactly ideal but would work quickly.

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

--- End Message ---
--- Begin Message ---
here's an improvement jwith recursion:

function stripMagicQuotes(&$var)
{
   if (get_magic_quotes_gpc()) {
       if(!is_array($var)) {
           $var    = stripslashes($var);
       } else {
           array_walk($var, stripMagicQuotes);
       }
   }
   return $var;
}

hth,

john
On 8/10/06, Chris <[EMAIL PROTECTED]> wrote:

Chris wrote:
> Chris wrote:
>> J R wrote:
>>> try to use this few lines of code.
>>>
>>> function stripMagicQuotes(&$var)
>>> {
>>>    if (get_magic_quotes_gpc()) {
>>>        $var    = stripslashes($var);
>>>    }
>>>    return $var;
>>> }
>>>
>>> this way you don't really have to worry if magic quotes is on or off.
>>
>> Then he has to modify all the code to call that function ;)
>>
>
> Hmm actually:
>
> $_POST = stripMagicQuotes($_POST);
>
> should do it I guess.. not exactly ideal but would work quickly.
>

Argh, self-replying (*think before hitting send*) :(

Of course that function would need a bit more modification but should be
able to get it recursive without too many problems.

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




--
GMail Rocks!!!

--- End Message ---
--- Begin Message ---
Chris wrote:
Chris wrote:
J R wrote:
try to use this few lines of code.

function stripMagicQuotes(&$var)
{
   if (get_magic_quotes_gpc()) {
       $var    = stripslashes($var);
   }
   return $var;
}

this way you don't really have to worry if magic quotes is on or off.

Then he has to modify all the code to call that function ;)


Hmm actually:

$_POST = stripMagicQuotes($_POST);

should do it I guess.. not exactly ideal but would work quickly.


Argh, self-replying (*think before hitting send*) :(

Of course that function would need a bit more modification but should be able to get it recursive without too many problems.

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

--- End Message ---
--- Begin Message ---
In case anyone's interested, here's the function I use in the open source
project LOVD to undo Magic Quoting on all GPC arrays:


function lovd_magicUnquote ($var = '')
{

    if (!$var) {
        if (count($_GET)) {

            lovd_magicUnquote(& $_GET);
        }
        if (count($_POST)) {

            lovd_magicUnquote(& $_POST);
        }
        if (count($_COOKIE)) {

            lovd_magicUnquote(& $_COOKIE);
        }

    } else {

        if (is_array($var)) {

            foreach ($var as $key => $val) {

                if (is_array($val)) {

                    lovd_magicUnquote(& $var[$key]);

                } else {

                    $var[$key] = stripslashes($val);

                }

            }

        } else {

            $var = stripslashes($var);

        }

    }

}




// You can then just run on all scripts,
// for compatibility regardless of the settings:
if (get_magic_quotes_gpc()) {
    lovd_magicUnquote();
}




Typically, I make sure my values are quoted and unquote them when needed,
but I guess that's a matter of preference.

Ivo



On Thu, 10 Aug 2006 13:08:21 +0800, J R wrote:
> here's an improvement jwith recursion:
> 
> function stripMagicQuotes(&$var)
> {
>     if (get_magic_quotes_gpc()) {
>         if(!is_array($var)) {
>             $var    = stripslashes($var);
>         } else {
>             array_walk($var, stripMagicQuotes);
>         }
>     }
>     return $var;
> }
> 
> hth,
> 
> john
> On 8/10/06, Chris <[EMAIL PROTECTED]> wrote:
>>
>> Chris wrote:
>> > Chris wrote:
>> >> J R wrote:
>> >>> try to use this few lines of code.
>> >>>
>> >>> function stripMagicQuotes(&$var)
>> >>> {
>> >>>    if (get_magic_quotes_gpc()) {
>> >>>        $var    = stripslashes($var);
>> >>>    }
>> >>>    return $var;
>> >>> }
>> >>>
>> >>> this way you don't really have to worry if magic quotes is on or off.
>> >>
>> >> Then he has to modify all the code to call that function ;)
>> >>
>> >
>> > Hmm actually:
>> >
>> > $_POST = stripMagicQuotes($_POST);
>> >
>> > should do it I guess.. not exactly ideal but would work quickly.
>> >
>>
>> Argh, self-replying (*think before hitting send*) :(
>>
>> Of course that function would need a bit more modification but should be
>> able to get it recursive without too many problems.
>>
>> --
>> Postgresql & php tutorials
>> http://www.designmagick.com/
>>

--- End Message ---
--- Begin Message ---
On Wed, August 9, 2006 3:06 pm, Ross wrote:
> When I echo out the results from the db I get the serialized data but
> when I
> try and pass the serialized data to the function to unserialize the
> output
> it doesn't work - no output what-so-ever. Also when the serialized
> data is
> sent to the function and then echoed out before it is unserialized() I
> get
> the expected result .- eg
> a:4:{i:0;s:4:"pass";i:1;s:4:"pass";i:2;s:4:"pass";

This seems to be missing a closing } on the end, from this naive
reader's crude guess at what should be there...

Are you sure the DB text field length is "big enough"...?

> Which leads me to believe that the problem is with the php function
> unserialize().
>
> The same function works fine locally. I am working with php version 5
> locally and version 4.4.2 on the remote host Could that be the
> problem?

It's entirely possible that the serialize/unserialize functions
changed the internal data format from 4 to 5, I presume...

Compare the output from 4.4.2 of <?php echo serialize($foo);?> and the
same $foo on PHP 5.0 and then see if they are the same.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
On Wed, August 9, 2006 11:20 am, Dave M G wrote:
> How do I create a file that the user saves, and is not stored on the
> server?

http://richadlynch.blogger.com

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
Robert, Ray, Richard,

Thank you all for responding with helpful advice.

Robert said:
It's all about the headers... header( "Content-type: text/csv" ); header( "Content-disposition: inline; filename=$filename" );

Ah... that's something I think I never would have figured out with the manual alone. Now that I know, it seems super easy.

Thanks to everyone - those who responded directly as well as the PHP list in general.

With the right regular expressions and file handling mechanisms in place, I now have a script that does everything I set out for it to do.

Everyone's time and expertise is very much appreciated.

--
Dave M G

--- End Message ---
--- Begin Message ---
Robert,

Thank you for responding.

The extra slashes are to properly escape the backslash character since
you are using double quotes....
As I said you may want the following pattern in cases where no space
exists:
    '#^([^\s]*)\s?(.*)$#'
Thank you for your detailed explanation. Especially with regards to the impact of double quotes versus single quotes in an expression. I see now that I most likely will find it simpler to use single quotes and avoid having to escape characters excessively.

As you might have seen in a response of mine to another of your postings, all this advice has come together, and my script now accomplishes what I had hoped it would.

Thank you and the PHP list in general for the continued great support.

--
Dave M G

--- End Message ---
--- Begin Message ---
Hello all,

How do I include Google Ads on my PHP script?

I do not want to include it only but to be able to set the keywords for the add.

Maybe even have it to change from time to time, probably using AJAX.

Any good pointers on Google Ads?

Thanks,

C.F.

--- End Message ---
--- Begin Message ---
C.F. Scheidecker Antunes wrote:
Hello all,

How do I include Google Ads on my PHP script?

Read the google website.

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

--- End Message ---
--- Begin Message ---
Hello,

on 08/10/2006 03:07 AM C.F. Scheidecker Antunes said the following:
> How do I include Google Ads on my PHP script?

You need to apply to an AdSense account. When you are approved you
configure your ads in the AdSense site. The site gives you the necessary
HTML with Javascript code that you can include in any PHP generated HTML
page.


> I do not want to include it only but to be able to set the keywords for
> the add.

You do not define that. Google scans your pages and shows relevant ads
according to your pages content.


> Maybe even have it to change from time to time, probably using AJAX.

I am afraid that AdSense terms of service do not allow that.


> Any good pointers on Google Ads?

Look here if you want some tips to maximize your AdSense revenue:

http://www.phpclasses.org/tips.html?tip=site-revenue

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

--- End Message ---
--- Begin Message ---
 

> -----Original Message-----
> From: Chris [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, 10 August 2006 3:43 PM
> To: C.F. Scheidecker Antunes
> Cc: [email protected]
> Subject: Re: [PHP] Including Google Ads
> 
> C.F. Scheidecker Antunes wrote:
> > Hello all,
> > 
> > How do I include Google Ads on my PHP script?
> 
> Read the google website.
> 
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
> 
> --
> PHP General Mailing List (http://www.php.net/) To 
> unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
On Wed, 09 Aug 2006 11:14:11 +0100, Colin Guthrie wrote:
> Ivo F.A.C. Fokkema wrote:
>> SO: Loading the GTK library in your /etc/php4/cli/php.ini, KILLS the
>> PHP-cli functionality from cron. On Ubuntu Dapper, that is. Not sure about
>> other distros.
>> 
>> Thanks guys, for all of your suggestions!
> 
> Ahh it probably *needs* an X Server to work properly. I'll bet if you 
> logged into your machine via SSH or the console without beign logged 
> into a graphical env. that it would also fail.

Bingo! You're absolutely right. I copied my php.ini to one that includes
the module again, and when using that ini I can still run a 'Hello world'
script through the console, but NOT when logged in through ssh from
another machine. Good thinking!

> Well found tho', this would seem like a bug in the GTK stuff tho'.

I'll file a bug against this behaviour upstream :)

Thanks!

--- End Message ---
--- Begin Message ---
I want to get a positive resuly comparing

Apple with aPPLE

or CaR with car


anyone know if there is a built in php function?


R. 

--- End Message ---
--- Begin Message ---
Ross schreef:
I want to get a positive resuly comparing

Apple with aPPLE

or CaR with car


anyone know if there is a built in php function?


R.

if (strtolower('Apple') === strtolower('aPPLE')) {
  echo 'compared successfull case insensitive';
}


Regards,

Andriesss

--- End Message ---
--- Begin Message ---
Ross wrote:
I want to get a positive resuly comparing

Apple with aPPLE

or CaR with car

anyone know if there is a built in php function?

http://php.net/strcasecmp

-Stut

--- End Message ---
--- Begin Message ---
Stut schreef:
Ross wrote:
I want to get a positive resuly comparing

Apple with aPPLE

or CaR with car

anyone know if there is a built in php function?

http://php.net/strcasecmp

-Stut


Indeed better.

Andriesss

--- End Message ---
--- Begin Message ---
Hi there,

You are correct that I am stupid to call the manual bad, it was not meant
like that. It was that it was not suited to me, and that I actually just
wanted to find a solution to my problem directly, and it did not give me
that. I have never worked with Regular Expressions before, so I might need
to do some more research on that, it seams to be a good tool :)

I will do some testing in the CMD to learn how to use it, should not be that
big of a deal :)

Many times the regex looks like rubbish, but that is just because I do not
know the "language" :)

Thanks,
Peter


-----Original Message-----
From: Jochem Maas [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 09, 2006 6:06 PM
To: Peter Lauri
Cc: [email protected]
Subject: Re: [PHP] preg_match

Peter Lauri wrote:
> Hi,
> 
>  
> 
> How do I add so that it checks for a comma , in this preg_match. I think
the
> documentation is not that good for the pref_match:

it's a lot better than you spelling of preg_match. the subject of regexps is
very
complex, the documentation reflects that - but to call them 'not that good'
is
rather a disservice to the people that wrote them imho.

I taught myself regexps primarily using the php docs -
which is a testament to how good they are. :-)

> 
>  
> 
> preg_match('/^[a-z0-9-_\'() +]*$/i', $s);


$q = chr(39); // makes for easier cmdline testing !?E#$@
function test($s) {
        global $q;
        echo "\"$s\" is ",(preg_match("#^[a-z0-9\\-_\\$q\\(\\), \\+]*$#i",
$s)?"true":"false"),"\n";
        // I escaped everything char that has special meaning in a regexp
        // backslashes are themselves escaped in double quotes strings.
        // I used different regexp delimiters (#) - just my preference
}

test("foo");
test(",");
test("()");
test("(123)");
test("(123,456)");
test("(+123,456)");
test(" (+123,456) ");
test(" $q(+123,456) $q");

> 
>  
> 
> /Peter
> 
>  
> 
>  
> 
> 

--- End Message ---
--- Begin Message ---
On 10/08/06, Peter Lauri <[EMAIL PROTECTED]> wrote:

Hi there,

You are correct that I am stupid to call the manual bad, it was not meant
like that. It was that it was not suited to me, and that I actually just
wanted to find a solution to my problem directly, and it did not give me
that. I have never worked with Regular Expressions before, so I might need
to do some more research on that, it seams to be a good tool :)

I will do some testing in the CMD to learn how to use it, should not be
that
big of a deal :)

Many times the regex looks like rubbish, but that is just because I do not
know the "language" :)



Indeed - remember, regex is a language all of its own and it takes a while
to get comfortable with the syntax and think in regex. The Regex Coach is
great by the way. Also, when you build expressions, build them up slowly,
testing each part as you go.

--- End Message ---
--- Begin Message ---
Thanks to everybody's suggestions, problem solved.  Yes, the default
encoding for PHP's mysql client is latin1.  So a quick query of:

"SET NAMES 'utf8'"

*per connection* works it all out.

The articles and links were very helpful in alluminating some of the
other particulars of working with utf-8.  These will take a bit more
reading and studying...

Thanks to all!

--- End Message ---

Reply via email to