Re: Another date exercise

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/8/17 Luke <luke@xxxxxxxxxxxxxx>

>
>
> 2009/8/17 tedd <tedd.sperling@xxxxxxxxx>
>
>> At 4:10 PM +0100 8/17/09, Luke wrote:
>>
>>  What would be really cool is if someone wrote a PHP script that generates
>>> some Javascript code that could do this.
>>>
>>> I mean while we're on the subject of complicating things ;)
>>>
>>> --
>>> Luke Slater
>>> :O)
>>>
>>
>> While writing/creating javascript from php can be done, that's not the
>> problem.
>>
>> The problem is that the data provided from a javascript program that
>> cannot be trusted. All data taken from javascript routines must be
>> sanitized.
>>
>> So if you want to talk about complicating things, start accepting data
>> from javascript routines without sanitizing and see how that works out for
>> you.
>>
>>
>> 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
>>
>>
> I didn't say anything about accepting unsanitized data now did I?
>
>
> --
> Luke Slater
> :O)
>
> this text is protected by international copyright. it is illegal for
> anybody apart from the recipient to keep a copy of this text.
> dieser text wird von internationalem urheberrecht geschuetzt. allen
> ausser dem/der empfaenger/-in ist untersagt, eine kopie dieses textes
> zu behalten.
>

Sorry to annoy you Tedd,

I guess stage one would be something like

$date = $_GET['datestring'];
$exploded_date = explode(' ', $date);

foreach($exploded_date as $constituent)
{
if(preg_match('/^{1,31}$/', $constituent))
{
$sane_date["day"] = $constituent;
}
}

Then in the foreach loop would also be something that would check for months
and years, setting the constituent to $sane_date["month"] and
$sane_date["year"] respectively.

Something like that?

I would try it out but I'm at work ;)

-- 
Luke Slater
:O)

this text is protected by international copyright. it is illegal for
anybody apart from the recipient to keep a copy of this text.
dieser text wird von internationalem urheberrecht geschuetzt. allen
ausser dem/der empfaenger/-in ist untersagt, eine kopie dieses textes
zu behalten.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux