OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
php-general Digest 5 Mar 2008 08:08:47 -0000 Issue 5330

php-general-digest-helplists.php.net
Date: Wed Mar 05 2008 - 02:08:47 CST


php-general Digest 5 Mar 2008 08:08:47 -0000 Issue 5330

Topics (messages 270962 through 270997):

Re: maintaining [user] state without a session ...
        270962 by: tedd
        270969 by: Richard Lynch
        270970 by: Richard Lynch

Re: imap_setflags_full Seen [SOLVED]
        270963 by: Daniel Brown

regular expressions question
        270964 by: Adil Drissi
        270965 by: David Giragosian
        270966 by: Daniel Brown
        270967 by: Shawn McKenzie
        270968 by: Richard Lynch
        270988 by: Adil Drissi

Re: 2 Questions: Static variables and the nature of the online manual
        270971 by: Richard Lynch
        270975 by: Richard Lynch
        270980 by: Daniel Brown
        270989 by: Svevo Romano
        270990 by: Svevo Romano

mail() function HELP
        270972 by: Sofia Jacob \(CA\)
        270973 by: Stut
        270974 by: Shawn McKenzie
        270977 by: Shawn McKenzie
        270981 by: Stut
        270983 by: Shawn McKenzie

Re: Crop part of existing pdf
        270976 by: Richard Lynch
        270979 by: gary liang

Re: Fatal error: Call to a member function web_order_change() on a non-object
        270978 by: Richard Lynch

Re: GPS Locator
        270982 by: Daevid Vincent

Re: Making an interactive RGB color picker
        270984 by: Richard Lynch
        270994 by: Casey

Re: PHP performance
        270985 by: Richard Lynch

Re: Weird Zend IDE Issue
        270986 by: Richard Lynch

Re: Question about PHP Licence and it's future!
        270987 by: Richard Lynch

Re: Importing and exporting from MySQL, escape slash problem
        270991 by: Dave M G

validating mysql bound date
        270992 by: Larry Brown
        270993 by: Larry Brown
        270995 by: Chris
        270996 by: Larry Brown

Logging session timeout in DB
        270997 by: Angelo Zanetti

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


At 6:05 PM +0000 3/4/08, Nathan Rixham wrote:
>tedd wrote:
>>At 12:15 PM -0500 3/4/08, Daniel Brown wrote:
>>> Amazingly, I do get all of my stuff done. Granted, I'm in front
>>>of a computer seven days per week, and usually a minimum of 10-12
>>>hours per day, but what else would I do? Spend time with the
>>>pre-wife?
>>
>>
>>You're working on wife 1.0 beta -- wait until you're fully
>>developed into wife 2.0.
>>
>>Cheers,
>>
>>tedd
>>
>
>If I ever had any doublt I was reading a programmer's list, I don't now.
>
>ps: I'm on RC4

Let's not discuss your open-source girlfriend. :-)

Cheers,

tedd

PS: (RC4 == Remote Companion 4.0 3.95 per minute).

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

attached mail follows:


On Tue, March 4, 2008 8:22 am, Bojan Tesanovic wrote:
> Hi,
> It depends what do you need to track,
> if you need to track small amount of variables you can do it by cookie
> I often use it eg here is the state for one user
> $state = array{
> 'logedin'=>true,
> 'n'=>'Peter',
> 'id'=>'5',
> //anything else you need
> }
>
> //at end of you script before outputing any content
> //set cookie only for browser session and set path to '/' so it is
> available through whole site
> setcookie('user_data',serialize($state),null,'/');

Woof.

So anybody with half a clue could look in their cookies and change,
say, 'id' to '1' and masquerade as anybody they want in your system.

And with an 'id' of '1', they might even getting CMS 'admin' access or
something.

Probably not a Good Idea...

You could, perhaps, use a 2-way encryption algorithm and try to keep
your key as securely as possible, and do this much more safely.

> Also you can use some way to detect if the user is not Search engine
> to display message like
> "To properly use this site you need to enable cookies in your browser
> bla bla ...."
>
> This can be done via JS alert message which will not be triggered by
> SE but only by real user

Use robots.txt to keep out "real" search engines.

Anybody who REALLY wants to can run your JS with Webmonkey, the JS
engine of Firefox, released as a stand-alone command line tool.
(E.g., JS email obfuscation is useless against somebody with
webmonkey. Try it and see!)

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

attached mail follows:


On Tue, March 4, 2008 10:22 am, Jason Pruim wrote:
>
> On Mar 4, 2008, at 11:11 AM, Daniel Brown wrote:
>
>> On Tue, Mar 4, 2008 at 11:09 AM, Stut <stuttlegmail.com> wrote:
>>> On 4 Mar 2008, at 15:52, Daniel Brown wrote:
>>>> On Tue, Mar 4, 2008 at 9:10 AM, Stut <stuttlegmail.com> wrote:
>>>>> I'm working on an article
>>>>> for my website that describes exactly how I'm doing it and what
>>>>> the
>>>>> issues are but it's not ready yet. I'll let the list know when
>>>>> it's
>>>>> done.
>>>>
>>>> Is it done yet?
>>>
>>> No. I have a day job, that takes priority.
>>
>> You're full of crap. I have a day job, too, but I still feel
>> like
>> I spend half of my time reading and responding to list posts. ;-P
>
> Ummm... Mr. Brown... I'm pretty sure you do :P You need to talk to
> Richard and get the code for his AI so you don't get in trouble for
> not getting your work done :)

Richard is waiting for a lonnnnnng PHP script to push/pull a bunch of
cron output emails out of his Inbox and dump them to a DB so he can
figure out what's going on with the system for his boss, but that
script has cause php to segfault once already, and he is also trying
(and failing) to get a Gentoo Live CD to actually finish an install on
an ancient Compaq Proliant, so pretty much posts while waiting for the
other computers/softwares to crash...

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

attached mail follows:


On Tue, Mar 4, 2008 at 1:04 PM, Richard Lynch <ceol-i-e.com> wrote:
> I've added a note and submitted a Docs bug report.

    I submitted a patch about a half-hour ago. I don't have karma to
the phpdocs tree, so Phillip or Hannes will probably take care of it
in a little while.

--
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

attached mail follows:


Hi,

Is there any way to limit the user to a set of characters for example say i want my user to enter any character between a and z (case insensitive). And if the user enters just one letter not belonging to [a-z], this will not be accepted.

I tried eregi('[a-z]', $fname) but this allows the user to enter abdg4512kdkdk for example.

Thank you

       
---------------------------------
Never miss a thing. Make Yahoo your homepage.

attached mail follows:


On 3/4/08, Adil Drissi <adil.drissiyahoo.com> wrote:
> Hi,
>
> Is there any way to limit the user to a set of characters for example say i want my user to enter any character between a and z (case insensitive). And if the user enters just one letter not belonging to [a-z], this will not be accepted.
>
> I tried eregi('[a-z]', $fname) but this allows the user to enter abdg4512kdkdk for example.
>
> Thank you
>

try here:

http://us2.php.net/ctype_alpha

--

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

attached mail follows:


On Tue, Mar 4, 2008 at 2:19 PM, Adil Drissi <adil.drissiyahoo.com> wrote:
> Hi,
>
> Is there any way to limit the user to a set of characters for example say i want my user to enter any character between a and z (case insensitive). And if the user enters just one letter not belonging to [a-z], this will not be accepted.

<?
if(preg_match('/^[a-z]+$/i',$argv[1])) {
        echo "Good.\n";
} else {
        echo "Bad.\n";
}
?>

--
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

attached mail follows:


Adil Drissi wrote:
> Hi,
>
> Is there any way to limit the user to a set of characters for example say i want my user to enter any character between a and z (case insensitive). And if the user enters just one letter not belonging to [a-z], this will not be accepted.
>
> I tried eregi('[a-z]', $fname) but this allows the user to enter abdg4512kdkdk for example.
>
> Thank you
>
>
> ---------------------------------
> Never miss a thing. Make Yahoo your homepage.

Keeping with your example, this works and doesn't allow an empty string
(to allow empty, replace the + with *):

eregi('^[a-z]+$', $fname)
-or-
ereg('^[A-Za-z]+$', $fname)

But ctype_alpha() is a better multi-locale solution.

-Shawn

attached mail follows:


On Tue, March 4, 2008 1:19 pm, Adil Drissi wrote:
> Is there any way to limit the user to a set of characters for example
> say i want my user to enter any character between a and z (case
> insensitive). And if the user enters just one letter not belonging to
> [a-z], this will not be accepted.
>
> I tried eregi('[a-z]', $fname) but this allows the user to enter
> abdg4512kdkdk for example.

What you tried only requires ONE a-z character somewhere in the input.

Try this:

preg_match('^[a-z]+$', $fname);

This will:
^ "anchor" the string at the beginning
[a-z]+ a to z, with at least one letter
$ "anchor" the string at the end

Note, however, that some people have other characters in their first
name, such as apostrophe, space, and dash.

Oh, and the digit 3, for "bo3b" who was a programmer on the first
Apple Macintosh. His parents were hippies, and that really is his
name...

You may want to obtain a LARGE list of "first names" and run them
through your validator as a test.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

attached mail follows:


Thank you guys,

The answers you gave me not only solved the problem,
but i included more characters like space and -.

Thank you again

--- Richard Lynch <ceol-i-e.com> wrote:

> On Tue, March 4, 2008 1:19 pm, Adil Drissi wrote:
> > Is there any way to limit the user to a set of
> characters for example
> > say i want my user to enter any character between
> a and z (case
> > insensitive). And if the user enters just one
> letter not belonging to
> > [a-z], this will not be accepted.
> >
> > I tried eregi('[a-z]', $fname) but this allows
> the user to enter
> > abdg4512kdkdk for example.
>
> What you tried only requires ONE a-z character
> somewhere in the input.
>
> Try this:
>
> preg_match('^[a-z]+$', $fname);
>
> This will:
> ^ "anchor" the string at the beginning
> [a-z]+ a to z, with at least one letter
> $ "anchor" the string at the end
>
> Note, however, that some people have other
> characters in their first
> name, such as apostrophe, space, and dash.
>
> Oh, and the digit 3, for "bo3b" who was a programmer
> on the first
> Apple Macintosh. His parents were hippies, and that
> really is his
> name...
>
> You may want to obtain a LARGE list of "first names"
> and run them
> through your validator as a test.
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some indie artist.
> http://cdbaby.com/from/lynch
> Yeah, I get a buck. So?
>
>

      ____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs

attached mail follows:


On Tue, March 4, 2008 6:16 am, Svevo Romano wrote:
> Hello,
>
> I got this e-mail address from the ŒAdd note¹ page within the php.net
> website. I was going to post something that was a question and I
> realised I
> was in the wrong place :)
>
> I have 2 basic questions and I¹m sorry if they may seem too basic. I¹m
> a bit
> new to php.
>
> The first question has to do with the static variables. I understand
> how
> this works from the examples, but there is something that I cannot
> seem to
> find clearly stated anywhere on that page.
>
> The example:
>
> <?php
> function Test()
> {
> static $a = 0;
> echo $a;
> $a++;
> }
> ?>
>
> Of course works (I¹ve tested it on my server), but it is still obscure
> to
> me, according to general programming principles, since I¹m still
> assigning
> zero (0) to $a on each call to the Test function. How does this
> exactly work
> when the static word is found? Is there and index that keeps track of
> each
> call to the function ignoring any assignment in subsequent calls to
> the
> function? Why doens¹t this work when you assign an expression result
> to the
> variable?

It's not an assignment, it's an initialization, and, yes, the compiler
does "keep track" and doesn't do that after the first time.

*THIS* would be what you describe:
function Test(){
  static $a;
  $a = 0;
  echo $a;
  $a++;
}

> The second question has to do with the online manual. I¹ve found
> several
> things on that manual specified in comments and not in the actual
> manual
> part of it. What is the nature of the manual? Contributions from
> voluteers?

The manual is contributions from volunteers who have been "blessed" by
the other volunteers (viz) to edit the manual.

The "Notes" is from anybody on the planet with a web browser that can
beat the CAPTCHA.

> Is there any official manual I can buy that documents everything about
> the
> language from the source? Or any official company that maintains the
> language and that possibly offers support as well?

There is nothing you can buy that's more official (nor more complete)
than the on-line manual.

You can buy support from Zend, which is a separate company run by two
guys who happen to be core developers; You can probably buy support
elsewhere as well.

PS
If you can find a language with a better manual, I'd like to see it...
:-)

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

attached mail follows:


On Tue, March 4, 2008 10:12 am, Svevo Romano wrote:
> Still, I jusy wonder how Jochem knew that the line is only executed
> the
> first time a function is called while this info is not available on
> the
> online manual. It's maybe all about how close you are to the community
> and
> how many degrees are between yourself and the source?

That's how it works in C.
And Perl.
And Modula-2.
And Ada.
And Pascal.
And even Lisp.
.
.
.

After you've learned a couple computer languages, the rest are mostly
about "differences" and "gotchas" rather than learning something new.

Ok, except the Lisp/Scheme/Prolog stuff, where you have to think
inside-out. :-)

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

attached mail follows:


On Tue, Mar 4, 2008 at 5:05 PM, Richard Lynch <ceol-i-e.com> wrote:
> After you've learned a couple computer languages, the rest are mostly
> about "differences" and "gotchas" rather than learning something new.
>
> Ok, except the Lisp/Scheme/Prolog stuff, where you have to think
> inside-out. :-)

    You hit that nail right on the head!

    For those who don't know, Lisp, though spelled with an L, is
actually pronounced *Gasp*. ;-P

--
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

attached mail follows:


Cheers Thiago,

In fact this was going to be my next question. I think I will report a
documentation bug, just because, after all the discussion we had today, I
realize that this is quite a common behaviour in other languages, but for
somebody new to languages, being them programming or scripting ones, the
fact that the $a=0 line doesn't get executed on subsequent calls isn't so
obvious.

In other words, from the standpoint of someone that is relatively new to the
details (at least), the flow is: 'ok, I do appreciate that the engine keeps
memory of the value of that variable declared as static after the function
ends, but assigning a value to it at the very beginning of the function
seems like the next time the function is going to be called, it will assaign
that value again and again...and again'.

And I guess the manual wants to be as clear as possible, considering that
the examples are often 'foo 'and '$a' related :P In other words I think that
it is indeed targeted to beginners as wel, isn't it?

Thanks for all the valuable info btw. :)

In 4/3/08 16:59, Thiago Pojda, thiago.pojdasoftpartech.com.br ha scritto

>
>
> -----Mensagem original-----
> De: Svevo Romano [mailto:svevosvevoromano.it]
>
> Hi there,
>
> Many thanks for your answer. I've also gone through your
> example and it took me 10 minutes to understand how the
> operator precedence was working there.
> Was expecting 1 on the first call :)
>
> But this is not the point. You've nailed my question very
> preciseley in your first answer: 'the preceding line is only
> run on the first call to the function'.
>
> My only question is (at it is related to the nature of the
> online manual):
> how do you know it and I don't? This thing is the only logical
> explanation to the fact the $a doesn't get initialized again to
> 0 in any subsequent call to the function, but it's not written
> anywhere in the manual page. And it seems the most important
> statement in my opinion, that justifies what I see as an
> exception to a normal flow.
>
> Hope all this makes sense.
> Thanks,
> S
>
>
>
> <me>
> You can use http://bugs.php.net/report.php to report a documentation
> "bug" and they'll change the docs :)
>
> Thiago
> </me>
>
>

attached mail follows:


Yes Richard,

In fact I know ActionScript and JavaScript and I'm trying to nail the
peculiarities of php. I totally agree. I am not used to use ' -> ' to call a
method if you know what I mean, but the rest is quite familiar, phew! :)
Aside from that, this was just one of the things I could not really
understand properly: I could understand the effects, not the reasons behind
the effects, if it makes any sense. I think the manula is lacking a couple
of lines.

One funny thing: in the Welling Thomson - PHP and MySQL Web Development
book, at some point this thing is mentioned. They promised they would
explain the concept in full detail in chapter 5 and, in chap 5, they kinda
forgot to do it.. hehe

All the best.

In 4/3/08 22:05, Richard Lynch, ceol-i-e.com ha scritto

> On Tue, March 4, 2008 10:12 am, Svevo Romano wrote:
>> Still, I jusy wonder how Jochem knew that the line is only executed
>> the
>> first time a function is called while this info is not available on
>> the
>> online manual. It's maybe all about how close you are to the community
>> and
>> how many degrees are between yourself and the source?
>
> That's how it works in C.
> And Perl.
> And Modula-2.
> And Ada.
> And Pascal.
> And even Lisp.
> .
> .
> .
>
> After you've learned a couple computer languages, the rest are mostly
> about "differences" and "gotchas" rather than learning something new.
>
> Ok, except the Lisp/Scheme/Prolog stuff, where you have to think
> inside-out. :-)

attached mail follows:


I'm getting problems with the mail() function.

ERROR:

Warning: mail() [function.mail]: Failed to connect to mailserver at "" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\php_sandbox\user_auth_fns.php on line 170

I'm using Windows XP prof. and WAMP5 -server

Here what I did:

1) I download sendmail.zip from http://glob.com.au/sendmail/

2) I unzip this in a folder on c:\wamp\sendmail

3) I edited PHP.INI file

[mail function]
; For Win32 only.
SMTP =
smtp_port =

; For Win32 only.
;sendmail_from =

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path = "C:\wamp\sendmail\sendmail.exe -t"

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

4)I edited SENDMAIL.INI file

; configuration for fake sendmail

; if this file doesn't exist, sendmail.exe will look for the settings in
; the registry, under HKLM\Software\Sendmail

[sendmail]

; you must change mail.mydomain.com to your smtp server,
; or to IIS's "pickup" directory. (generally C:\Inetpub\mailroot\Pickup)
; emails delivered via IIS's pickup directory cause sendmail to
; run quicker, but you won't get error messages back to the calling
; application.

smtp_server=mail.yahoo.ca

; smtp port (normally 25)

smtp_port=465

; the default domain for this server will be read from the registry
; this will be appended to email addresses when one isn't provided
; if you want to override the value in the registry, uncomment and modify

default_domain=

; log smtp errors to error.log (defaults to same directory as sendmail.exe)
; uncomment to enable logging

error_logfile=error.log

; create debug log as debug.log (defaults to same directory as sendmail.exe)
; uncomment to enable debugging

;debug_logfile=debug.log

; if your smtp server requires authentication, modify the following two lines

auth_username=jacobsofia
auth_password= *******

; if your smtp server uses pop3 before smtp authentication, modify the
; following three lines

pop3_server=mail.yahoo.ca
pop3_username= jacobsofiayahoo.ca
pop3_password=******

; to force the sender to always be the following email address, uncomment and
; populate with a valid email address. this will only affect the "MAIL FROM"
; command, it won't modify the "From: " header of the message content

force_sender=jacobsofiayahoo.ca

; sendmail will use your hostname and your default_domain in the ehlo/helo
; smtp greeting. you can manually set the ehlo/helo name if required

hostname=

5) Here my code:

$email = mysql_result($result, 0, "email");
      $from = "From: jacobsofiayahoo.ca \r\n";
      $mesg = "Tu contraseña ha sido cambiado a $Password \r\n"
              ."Por favor utilízalo la próxima cuando hagas log in. \r\n";
      if (mail($email, "login información ", $mesg, $from))
        echo "Enviamos tu nueva contrasena a tu e-mail";
      else
        echo "Error";

Thanks for the help!!!!

Sofia.

attached mail follows:


On 4 Mar 2008, at 21:18, Sofia Jacob (CA) wrote:
> I'm getting problems with the mail() function.
>
> ERROR:
>
> Warning: mail() [function.mail]: Failed to connect to mailserver at
> "" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or
> use ini_set() in C:\wamp\www\php_sandbox\user_auth_fns.php on line 170
>
>
> I'm using Windows XP prof. and WAMP5 -server
>
> Here what I did:
>
> 1) I download sendmail.zip from http://glob.com.au/sendmail/
>
> 2) I unzip this in a folder on c:\wamp\sendmail
>
> 3) I edited PHP.INI file
>
> [mail function]
> ; For Win32 only.
> SMTP =
> smtp_port =
>
> ; For Win32 only.
> ;sendmail_from =
>
> ; For Unix only. You may supply arguments as well (default:
> "sendmail -t -i").
> ;sendmail_path = "C:\wamp\sendmail\sendmail.exe -t"

I don't mean to be rude, but what part of "For Unix only" confused you?

You need to point the "For Win32 only" settings at a mail server on
Windows. The error message pretty clearly states that it's trying to
connect to the server specified in those settings.

-Stut

--
http://stut.net/

attached mail follows:


Sofia Jacob (CA) wrote:
> I'm getting problems with the mail() function.
>
> ERROR:
>
> Warning: mail() [function.mail]: Failed to connect to mailserver at "" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\php_sandbox\user_auth_fns.php on line 170
>
>
> I'm using Windows XP prof. and WAMP5 -server
>
> Here what I did:
>
> 1) I download sendmail.zip from http://glob.com.au/sendmail/
>
> 2) I unzip this in a folder on c:\wamp\sendmail
>
> 3) I edited PHP.INI file
>
> [mail function]
> ; For Win32 only.
> SMTP =
> smtp_port =
>
> ; For Win32 only.
> ;sendmail_from =
>
> ; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
> ;sendmail_path = "C:\wamp\sendmail\sendmail.exe -t"
>
> ; Force the addition of the specified parameters to be passed as extra parameters
> ; to the sendmail binary. These parameters will always replace the value of
> ; the 5th parameter to mail(), even in safe mode.
> ;mail.force_extra_parameters =
>
> 4)I edited SENDMAIL.INI file
>
> ; configuration for fake sendmail
>
> ; if this file doesn't exist, sendmail.exe will look for the settings in
> ; the registry, under HKLM\Software\Sendmail
>
> [sendmail]
>
> ; you must change mail.mydomain.com to your smtp server,
> ; or to IIS's "pickup" directory. (generally C:\Inetpub\mailroot\Pickup)
> ; emails delivered via IIS's pickup directory cause sendmail to
> ; run quicker, but you won't get error messages back to the calling
> ; application.
>
> smtp_server=mail.yahoo.ca
>
> ; smtp port (normally 25)
>
> smtp_port=465
>
> ; the default domain for this server will be read from the registry
> ; this will be appended to email addresses when one isn't provided
> ; if you want to override the value in the registry, uncomment and modify
>
> default_domain=
>
> ; log smtp errors to error.log (defaults to same directory as sendmail.exe)
> ; uncomment to enable logging
>
> error_logfile=error.log
>
> ; create debug log as debug.log (defaults to same directory as sendmail.exe)
> ; uncomment to enable debugging
>
> ;debug_logfile=debug.log
>
> ; if your smtp server requires authentication, modify the following two lines
>
> auth_username=jacobsofia
> auth_password= *******
>
> ; if your smtp server uses pop3 before smtp authentication, modify the
> ; following three lines
>
> pop3_server=mail.yahoo.ca
> pop3_username= jacobsofiayahoo.ca
> pop3_password=******
>
> ; to force the sender to always be the following email address, uncomment and
> ; populate with a valid email address. this will only affect the "MAIL FROM"
> ; command, it won't modify the "From: " header of the message content
>
> force_sender=jacobsofiayahoo.ca
>
> ; sendmail will use your hostname and your default_domain in the ehlo/helo
> ; smtp greeting. you can manually set the ehlo/helo name if required
>
> hostname=
>
>
> 5) Here my code:
>
> $email = mysql_result($result, 0, "email");
> $from = "From: jacobsofiayahoo.ca \r\n";
> $mesg = "Tu contraseña ha sido cambiado a $Password \r\n"
> ."Por favor utilízalo la próxima cuando hagas log in. \r\n";
> if (mail($email, "login información ", $mesg, $from))
> echo "Enviamos tu nueva contrasena a tu e-mail";
> else
> echo "Error";
>
> Thanks for the help!!!!
>
> Sofia.

Number 1, in php.ini you left this uncommented so it's using this:
SMTP =
smtp_port =

Number 2, here you didn't uncomment the ;sendmail_path:
; For Unix only. You may supply arguments as well (default: "sendmail
-t -i").
;sendmail_path = "C:\wamp\sendmail\sendmail.exe -t"

Also, notice the *For Unix only.* comment. Dunno if it will work anyway
if you have sendmail.

-Shawn

attached mail follows:


Stut wrote:
> On 4 Mar 2008, at 21:18, Sofia Jacob (CA) wrote:
>> I'm getting problems with the mail() function.
>>
>> ERROR:
>>
>> Warning: mail() [function.mail]: Failed to connect to mailserver at ""
>> port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use
>> ini_set() in C:\wamp\www\php_sandbox\user_auth_fns.php on line 170
>>
>>
>> I'm using Windows XP prof. and WAMP5 -server
>>
>> Here what I did:
>>
>> 1) I download sendmail.zip from http://glob.com.au/sendmail/
>>
>> 2) I unzip this in a folder on c:\wamp\sendmail
>>
>> 3) I edited PHP.INI file
>>
>> [mail function]
>> ; For Win32 only.
>> SMTP =
>> smtp_port =
>>
>> ; For Win32 only.
>> ;sendmail_from =
>>
>> ; For Unix only. You may supply arguments as well (default: "sendmail
>> -t -i").
>> ;sendmail_path = "C:\wamp\sendmail\sendmail.exe -t"
>
> I don't mean to be rude, but what part of "For Unix only" confused you?
>
> You need to point the "For Win32 only" settings at a mail server on
> Windows. The error message pretty clearly states that it's trying to
> connect to the server specified in those settings.
>
> -Stut
>
Uh, yeah... Then I thought, why not just use the SMTP and smtp_port
settings.

-Shawn

attached mail follows:


Please include the list when replying. And please don't top-post, it
makes proper quoting difficult.

On 4 Mar 2008, at 22:10, Sofia Jacob (CA) wrote:
> Yes, I did that first and I get the error:
>
> Warning: mail() [function.mail]: Failed to connect to mailserver at
> "mail.yahoo.ca" port 465, verify your "SMTP" and "smtp_port" setting
> in php.ini or use ini_set() in C:\wamp\www\php_sandbox
> \user_auth_fns.php on line 170
> (I should told you that before, sorry!!) and then I started to look
> at php web site and I found:
>
> sendmail_path string
> Where the sendmail program can be found, usually /usr/sbin/sendmail
> or /usr/lib/sendmail. configure does an honest attempt of locating
> this one for you and set a default, but if it fails, you can set it
> here.
>
> Systems not using sendmail should set this directive to the sendmail
> wrapper/replacement their mail system offers, if any. For example, »
> Qmail users can normally set it to /var/qmail/bin/sendmail or/var/
> qmail/bin/qmail-inject.
>
> qmail-inject does not require any option to process mail correctly.
>
> This directive works also under Windows. If set, smtp, smtp_port and
> sendmail_from are ignored and the specified command is executed.
>
My mistake, the comments in the INI file really should be changed to
reflect that.

Given that your problem is that you haven't uncommented that line as
Shawn said. Remove the ; from the start of that line, restart your we
server and if the manual isn't lying it should work.

Incidentally, it probably didn't like the Yahoo settings you used
because that port is for SMTP over SSL which PHP doesn't support.

-Stut

--
http://stut.net/

> ----- Original Message -----
> From: "Stut" <stuttlegmail.com>
> To: "Sofia Jacob (CA)" <jacobsofiayahoo.ca>
> Cc: <php-generallists.php.net>
> Sent: Tuesday, March 04, 2008 4:57 PM
> Subject: Re: [PHP] mail() function HELP
>
> > On 4 Mar 2008, at 21:18, Sofia Jacob (CA) wrote:
> >> I'm getting problems with the mail() function.
> >>
> >> ERROR:
> >>
> >> Warning: mail() [function.mail]: Failed to connect to mailserver at
> >> "" port 25, verify your "SMTP" and "smtp_port" setting in php.ini
> or
> >> use ini_set() in C:\wamp\www\php_sandbox\user_auth_fns.php on
> line 170
> >>
> >>
> >> I'm using Windows XP prof. and WAMP5 -server
> >>
> >> Here what I did:
> >>
> >> 1) I download sendmail.zip from http://glob.com.au/sendmail/
> >>
> >> 2) I unzip this in a folder on c:\wamp\sendmail
> >>
> >> 3) I edited PHP.INI file
> >>
> >> [mail function]
> >> ; For Win32 only.
> >> SMTP =
> >> smtp_port =
> >>
> >> ; For Win32 only.
> >> ;sendmail_from =
> >>
> >> ; For Unix only. You may supply arguments as well (default:
> >> "sendmail -t -i").
> >> ;sendmail_path = "C:\wamp\sendmail\sendmail.exe -t"
> >
> > I don't mean to be rude, but what part of "For Unix only" confused
> you?
> >
> > You need to point the "For Win32 only" settings at a mail server on
> > Windows. The error message pretty clearly states that it's trying to
> > connect to the server specified in those settings.
> >
> > -Stut
> >
> > --
> > http://stut.net/

attached mail follows:


Stut wrote:
> Please include the list when replying. And please don't top-post, it
> makes proper quoting difficult.
>
> On 4 Mar 2008, at 22:10, Sofia Jacob (CA) wrote:
>> Yes, I did that first and I get the error:
>>
>> Warning: mail() [function.mail]: Failed to connect to mailserver at
>> "mail.yahoo.ca" port 465, verify your "SMTP" and "smtp_port" setting
>> in php.ini or use ini_set() in
>> C:\wamp\www\php_sandbox\user_auth_fns.php on line 170
>> (I should told you that before, sorry!!) and then I started to look at
>> php web site and I found:
>>
>> sendmail_path string
>> Where the sendmail program can be found, usually /usr/sbin/sendmail or
>> /usr/lib/sendmail. configure does an honest attempt of locating this
>> one for you and set a default, but if it fails, you can set it here.
>>
>> Systems not using sendmail should set this directive to the sendmail
>> wrapper/replacement their mail system offers, if any. For example, »
>> Qmail users can normally set it to /var/qmail/bin/sendmail
>> or/var/qmail/bin/qmail-inject.
>>
>> qmail-inject does not require any option to process mail correctly.
>>
>> This directive works also under Windows. If set, smtp, smtp_port and
>> sendmail_from are ignored and the specified command is executed.
>>
> My mistake, the comments in the INI file really should be changed to
> reflect that.
>
> Given that your problem is that you haven't uncommented that line as
> Shawn said. Remove the ; from the start of that line, restart your we
> server and if the manual isn't lying it should work.
>
> Incidentally, it probably didn't like the Yahoo settings you used
> because that port is for SMTP over SSL which PHP doesn't support.
>
> -Stut
>
Correct on the yahoo. I would tend to doubt that allow open relaying as
well.

-Shawn

attached mail follows:


On Mon, March 3, 2008 8:14 pm, gary liang wrote:
> Is there any command line tool, which is able to crop part of pdf
> file? I ask for command line tool, because it can be used in php code.
> Any hint?

The commercial version of phpLib might do that.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

attached mail follows:


Ya, you are right. So there is no non-commercial option?

> Date: Tue, 4 Mar 2008 16:06:42 -0600
> Subject: Re: [PHP] Crop part of existing pdf
> From: ceol-i-e.com
> To: figo2476hotmail.com
> CC: php-generallists.php.net
>
> On Mon, March 3, 2008 8:14 pm, gary liang wrote:
> > Is there any command line tool, which is able to crop part of pdf
> > file? I ask for command line tool, because it can be used in php code.
> > Any hint?
>
> The commercial version of phpLib might do that.
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some indie artist.
> http://cdbaby.com/from/lynch
> Yeah, I get a buck. So?
>

_________________________________________________________________
What are you waiting for? Join Lavalife FREE
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2Eau%2Fclickthru%2Fclickthru%2Eact%3Fid%3Dninemsn%26context%3Dan99%26locale%3Den%5FAU%26a%3D30288&_t=764581033&_r=email_taglines_Join_free_OCT07&_m=EXT

attached mail follows:


register_globals got turned off.

All your $_SESSION variables (in your case, $_SESSION['SESSION']) need
to be reference explicitly now.

Add this at the top:

$SESSION = $_SESSION['SESSION'];
right after session_start();

On Mon, March 3, 2008 5:48 pm, Chris wrote:
> Ben Edwards wrote:
>> Our server has just been upgraded to PHP 5.2.5 and suddenly I am
>> getting the following error:
>>
>> Fatal error: Call to a member function web_order_change() on a
>> non-object in /var/www/vhosts/cultureshop.org/httpdocs/cart.php on
>> line 32
>>
>> The code is:
>>
>> $SESSION["cart"]->web_order_change( true );
>>
>> The command 'global $SESSION;' is the first line of the script.
>>
>> $SESSION is the session variable created with
>>
>> session_start();
>> session_register("SESSION");
>>
>> if ( !isset($SESSION["cart"]) ) {
>> $SESSION["cart"] = new Cart;
>> }
>>
>> I am guessing this is a change in OO handling, any idea what is
>> going
>> on and how to fix it?
>
> I don't think it's a change in OO handling, maybe it's a change in the
> error_reporting level for the new version and you hadn't noticed the
> problem before.
>
> The problem is that $SESSION['cart'] isn't an object - you'll have to
> work out why.
>
> It could be that $SESSION['cart'] is getting overridden at some point
> with another type of variable.
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

attached mail follows:


While this has deteriorated way off topic from PHP, I will just mention that
I've purchased several GPS from these cats and had great luck:
http://www.buygpsnow.com

You *might* be able to write a custom PHP extension that you compile into
PHP that can access the USB/Serial port as well. (and if you did got this
route, which would be the most beneficial to the PHP community, I hope you
would FOSS the extension so other's could use it perhaps)
http://devzone.zend.com/node/view/id/1021

Secondly, maybe you could have a little daemon written that simply spits out
the coordinates (lat/long/altitude/etc.) to a socket or something, and then
via PHP's socket functions you could continually read that in.

Alternatively, perhaps JAVA will also let you access hardware layers if
you're on a non Microsoft platform (which is generally the case for PHP
users).
 
Lastly, you could certainly do some low level hardware I/O with Ruby and
then perhaps use Rails for the web portion.

Chalk this all under the "best tool for the job" category, in this case I
doubt PHP is.

Daevid.

Remember, when coding, php.net and google are friends.
Everyone else hates you.
It is not personal, it's just a fact.
                                      --Stephen Johnson (12/03/07)

> -----Original Message-----
> From: Paul Scott [mailto:pscottuwc.ac.za]
> Sent: Tuesday, March 04, 2008 9:46 AM
> To: ceol-i-e.com
> Cc: Jay Blanchard; [php] PHP General List
> Subject: Re: [PHP] GPS Locator
>
>
> On Tue, 2008-03-04 at 11:42 -0600, Richard Lynch wrote:
> > Almost for sure, browser security will not let you do this in a web
> > browser.
> >
> > You'll probably have to write a custom desktop C application, or get
> > the user to install some kind of glue widget...
> >
> > PEAR|PECL *might* have some USB stuff in a library you could use to
> > write the PHP desktop widget and keep this on-topic, but I dunno...
>
> DIO should let you do it, but that extension is pretty buggy
> last I used
> it (OK like 5 years back with PHP4).
>
> What I did was got high end barcode scanners to scan directly
> into a db
> through a long running PHP script with it, so that should work just
> fine.
>
> That being said, though, something like a Winders COM object will
> probably be a better bet (I have never used COM objects before as I
> don't use Windows at all, ever) so correct me if I am wrong please!
>
> --Paul
>
>

attached mail follows:


for ($red = 0; $red < 256; $red++){
  for ($green = 0; $green < 256; $green++){
    for ($blue = 0; $blue < 256; $blue++){
      $output = <<<EOC
\$drawrect(\$get...
EOC;
    }
  }
}

On Mon, March 3, 2008 2:13 pm, Keikonium wrote:
> This may not be exactly what you think, but I didn't know how else to
> word
> the title. I basically need to make a script that will go through
> every
> possible color combination and print them to look just like (or
> similar) to
> the windows color picker. I need it in the format X-Y-Z. For example:
>
> 255-255-255
> 255-254-254
> 255-253-253
>
> What I have so far is this:
>
> ***********************
> <?php
> $break = print"<br>";
> $n1 = "255";
> $n2 = "12";
> $n3 = "186";
>
> $output = print"
> \$drawrect(\$get(color_x),\$get(color_y),\$get(color_w),\$get(color_h),brushColor-$n1-$n2-$n3
> penColor-$n1-$n2-$n3)
> \$button2(\$get(color_x),\$get(color_y),0,0,\$get(color_w),\$get(color_h),,,PVAR:SET:colorize_global:brushcolor-$n1-$n2-$n3
> pencolor-$n1-$n2-$n3,TOOLTIP:\"$n1-$n2-$n3\")
> ";
>
> $output
> ?>
> ***********************
>
> The $drawrect, $button2, and $get are NOT php functions, but to be
> printed
> as actual text (which is why I have escaped them with the backslash).
> Anyways, I thought it would be easiest to separate each R-G-B value
> into its
> own variable ($n1, $n2, and $n3). That way I could just use some code
> (regex?) to cycle through the numbers 0 to 255.
>
> The HARD part (that I can't seem to even think of a way to make it
> possible)
> is to change JUST the G and B values while keeping the R value at 255.
> Then
> when the G and B values both hit 0, the R value is set to 254 and
> repeated
> until it also hits 0 with the other two. I think (?) that will do
> every
> possible color? I also need to print each string with the individual
> color
> output, and I don't know how to do that either.
>
> In short, I would like something that looks just like the windows
> color
> picker, and when each pixel of it is clicked, it will show me the
> R-G-B
> value in the format I would like.
>
> If anyone understands what I am after,and could help, that would be
> awesome!
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

attached mail follows:


On 3/3/08, Keikonium <Keikoniumhotmail.com> wrote:
> This may not be exactly what you think, but I didn't know how else to word
> the title. I basically need to make a script that will go through every
> possible color combination and print them to look just like (or similar) to
> the windows color picker. I need it in the format X-Y-Z. For example:
>
> 255-255-255
> 255-254-254
> 255-253-253
>
> What I have so far is this:
>
> ***********************
> <?php
> $break = print"<br>";
> $n1 = "255";
> $n2 = "12";
> $n3 = "186";
>
> $output = print"
> \$drawrect(\$get(color_x),\$get(color_y),\$get(color_w),\$get(color_h),brushColor-$n1-$n2-$n3
> penColor-$n1-$n2-$n3)
> \$button2(\$get(color_x),\$get(color_y),0,0,\$get(color_w),\$get(color_h),,,PVAR:SET:colorize_global:brushcolor-$n1-$n2-$n3
> pencolor-$n1-$n2-$n3,TOOLTIP:\"$n1-$n2-$n3\")
> ";
>
> $output
> ?>
> ***********************
>
> The $drawrect, $button2, and $get are NOT php functions, but to be printed
> as actual text (which is why I have escaped them with the backslash).
> Anyways, I thought it would be easiest to separate each R-G-B value into its
> own variable ($n1, $n2, and $n3). That way I could just use some code
> (regex?) to cycle through the numbers 0 to 255.
>
> The HARD part (that I can't seem to even think of a way to make it possible)
> is to change JUST the G and B values while keeping the R value at 255. Then
> when the G and B values both hit 0, the R value is set to 254 and repeated
> until it also hits 0 with the other two. I think (?) that will do every
> possible color? I also need to print each string with the individual color
> output, and I don't know how to do that either.
>
> In short, I would like something that looks just like the windows color
> picker, and when each pixel of it is clicked, it will show me the R-G-B
> value in the format I would like.
>
> If anyone understands what I am after,and could help, that would be awesome!
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
HTML
<a href="color.php"><img src="colormap.png" ismap="ismap" /></a>
PHP color.php
list($coords) = array_keys($_GET);
$coords = explode(',', $coords); // Easier way...?
$im = imagecreatefrompng('colormap.png');
$color = imagepixelat($im, $coords[0], $coords[1]);
I wouldn't do it like this, though. I'd use Javascript.
--
-Casey

attached mail follows:


#1
Get the code, install it on a box in the closet, run valgrind --callgrind

This will give you a stack trace of what gets called the MOST in your
application.

Look for "tall" trees in the call graph, and fix those first.

#2
You can use 'ab' (apache benchmark) or similar to test it externally.

#3
You can also script things with Selenium IDE and then use Selenium
remote control to run them repeatedly, for the end-user experience.

Don't let server non-access stop you from doing #1 though...

On Mon, March 3, 2008 11:09 am, Thiago Pojda wrote:
> Guys,
>
> I've been asked to build a performance report for a PHP app. I can't
> profile
> it using automated tools as I don't have full access to the server,
> only to
> the application itself.
>
> It's a PHP4 Object-Oriented app, which uses ADODB as abstraction layer
> with
> a Oracle 8i databse. The system also uses a VB.NET socket server for
> some
> data manipulation.
>
> As for migrating to PHP5 I think it's crucial, but I need facts that
> it
> really runs faster than PHP4. Anyone? :)
>
> Any ideas on what might be the bottleneck?
>
> Thanks guys
>
> Atenciosamente,
>
>
> <http://www.softpartech.com.br/> www.softpartech.com.br
>
>
> Thiago Henrique Pojda
> Desenvolvimento Web
> +55 41 3033-7676
> thiago.pojdasoftpartech.com.br
> Excelência em Softwares Financeiros
>
>
>

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

attached mail follows:


On Mon, March 3, 2008 10:49 am, Jochem Maas wrote:
> Richard Lynch schreef:
>> On Sun, March 2, 2008 11:07 pm, Steve Finkelstein wrote:
>>> Hi all,
>>>
>>> I know this isn't a forum for Zend IDE, but since there's probably
>>> a
>>> decent population here using it, I figured I'd ask away.
>>>
>>> I'm using 5.5.1 Professional on Mac OSX 10.5.2. My issue here is
>>> that
>>> all left brackets, (eg: [ ) are not showing up in the code editor.
>>> I
>>> have a screenshot of it here: http://catalyst.httpd.org/zend.png
>>>
>>> Has anyone ever experienced anything similar?
>>
>> Looks to me like your monitor needs adjusting, and it's just not
>> showing that column of pixels.
>
> I think it's more a case of grubby font display in Java apps running
> on
> Mac OS X (leopard at least).
>
> when is the last time you saw a Mac (iMac or MacBook) with dodgy
> monitor settings?

I dunno about iMac or MacBook, but I saw a TON of Macs with dodgy
monitor settings all the time back in the day!

Sometimes on the desk of Graphic Artist who then got cranky when their
images were messed up on a well-tuned monitor...

So unless Apple has perfected the auto-tuning of a monitor or
something, I'd be surprised if it *was* correctly-tuned.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

attached mail follows:


On Sat, February 23, 2008 10:50 pm, Tamer Higazi wrote:
> I have asked myself a question. After I saw, that SAP will no more
> release future Versions of their open source Database MaxDB under the
> GPL License, I have asked myself either if this could happen with PHP.

No.

For starters, all the core developers are very committed to PHP being
Open Source.

Secondly, Zend has gone "on record" saying that the Zend Engine will
always be Open Source. I know, cuz I said so when I worked there. :-)

> Who owns PHP? Is it Zend Technologies or the PHP Group itself? "Who"
> is
> the PHP Group and what makes the PHP Group?

Who owns any GPL for FOSS-licensed software?

The community.

> Who guaranties that future Versions of PHP stays open source and are
> being released under the Terms of the General Public Licenses?

The community.

There are MORE than enough users who would fork it in an instant if
anybody was foolish enough to try and close it.

> Can future Versions from one day to the other no more being released
> under the GPL, only under a closed source license? Let us say, PHP
> would
> be distributed for several architectures only in binary forms and the
> PECL modules stay open source.

Not gonna happen.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

attached mail follows:


Richard, Jed,

Thank you for replying.

Richard said:
> It's possible that there is an .htaccess file in phpMyAdmin that has
> Magic Quotes on that is messing you up...

The .htaccess file for phpMyAdmin says "php_flag magic_quotes_gpc Off",
so I guess that means I'm okay there.

> Other than that, it's specific to phpMyAdmin, so maybe ask those guys
> what they did...

I joined their list through Sourceforge, but I haven't seen any mail
from it, and any mail I send gets bounced back to me. I'm not sure what
the issue is.

Jed said:
> If you're having trouble importing a mysql dump using phpMyAdmin, it might be simpler not to use it, and use mysqldump instead.

I suppose I'll have to if I can't get phpMyAdmin to behave. It's too
bad, though, as phpMyAdmin is so convenient otherwise.

--
Dave M G

attached mail follows:


Does anyone know if there is a builtin function for checking the
formatting of an incoming date to verify it is YYYY/MM/DD. I know how
to convert between formats but want a quick way to check an incoming
variable to ensure it will be handled properly by mysqld.

Larry

attached mail follows:


Its been a long week already... YYYY-MM-DD.

On Tue, 2008-03-04 at 20:16 -0500, Larry Brown wrote:
> Does anyone know if there is a builtin function for checking the
> formatting of an incoming date to verify it is YYYY/MM/DD. I know how
> to convert between formats but want a quick way to check an incoming
> variable to ensure it will be handled properly by mysqld.
>
> Larry
>
>
--
Larry Brown <larry.browndimensionnetworks.com>

attached mail follows:


Larry Brown wrote:
> Its been a long week already... YYYY-MM-DD.
>
> On Tue, 2008-03-04 at 20:16 -0500, Larry Brown wrote:
>> Does anyone know if there is a builtin function for checking the
>> formatting of an incoming date to verify it is YYYY/MM/DD. I know how
>> to convert between formats but want a quick way to check an incoming
>> variable to ensure it will be handled properly by mysqld.

I normally provide dropdown fields for each (except the year which is a
text-field) and put it together how I need it. Validate each part
separately and you're off and racing.

If you accept any date you'll probably have to split it up first but the
principles will be the same.

$date = '0000-00-00';
// if they didn't use exactly two dashes? invalid
if (substr_count($date, '-') !== 2) {
   die("Invalid date");
}

list($year, $month, $day) = explode('-', $date);
if (strlen($year) != 4) {
   die("Invalid year");
}

and so on.

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

attached mail follows:


Thanks,

I ended up doing:

$incomingQuestDatePieces = explode("-", $incomingQuestDate );

if(checkdate($incomingQuestDatePieces[1],$incomingQuestDatePieces[2],
$incomingQuestDatePieces[0]))
{
        return true;
}
else
{
        return false;
}

I was just wondering since a lot of people have to verify correct format
of the date when working with mysql that there might be some built in
that is faster etc.

Thanks though...

On Wed, 2008-03-05 at 14:34 +1100, Chris wrote:
> Larry Brown wrote:
> > Its been a long week already... YYYY-MM-DD.
> >
> > On Tue, 2008-03-04 at 20:16 -0500, Larry Brown wrote:
> >> Does anyone know if there is a builtin function for checking the
> >> formatting of an incoming date to verify it is YYYY/MM/DD. I know how
> >> to convert between formats but want a quick way to check an incoming
> >> variable to ensure it will be handled properly by mysqld.
>
> I normally provide dropdown fields for each (except the year which is a
> text-field) and put it together how I need it. Validate each part
> separately and you're off and racing.
>
> If you accept any date you'll probably have to split it up first but the
> principles will be the same.
>
>
> $date = '0000-00-00';
> // if they didn't use exactly two dashes? invalid
> if (substr_count($date, '-') !== 2) {
> die("Invalid date");
> }
>
> list($year, $month, $day) = explode('-', $date);
> if (strlen($year) != 4) {
> die("Invalid year");
> }
>
>
> and so on.
>
--
Larry Brown <larry.browndimensionnetworks.com>

attached mail follows:


Hi all,

I am implementing a system where when a user is logged in and out that a
date time is set in a database for each action for each used. We can then
trace who logged in a and when.

No what I would like to know is how can I record when a user closes the
browser or the session expires? There is no action for these items. So what
would the best way be to keep a record of this? Would the use of a cron job
be appropriate? I read in the archives that the banks use javascript but I
don't want to go that route.

If anyone has any idea how to do this please let me know, thanks in advance.

Elemental
Telephone: +27 (021) 552 9799
Mobile: +27 (0) 72 441 3355
Fax: +27 (0) 86 681 5885

Web: http://www.elemental.co.za
E-Mail: angeloelemental.co.za