[PHP] Implicit FTPS

2012-01-05 Thread Todd Nelson
My apologies if I'm in the wrong place, but I'm looking to discuss having 
PHP support implicit FTPS (currently only supports explicit.)  I'd like to 
find the author(s) of the 'ftp_ssl_connect' function to discuss if this 
has already been considered and offer assistance if desired.  Thank you.


Todd Nelson

Re: [PHP] Implicit FTPS

2012-01-05 Thread Todd Nelson
Thank you Nilesh, but ftp_ssl_connect is my problem!  I know what it does 
now - I'd like to extend it.  From that manual page:

 ftp_ssl_connect() opens an explicit SSL-FTP connection to the 
specified host.


Todd


From:   Nilesh Govindarajan cont...@nileshgr.com
To: Todd Nelson tnel...@mail.unomaha.edu
Cc: php-general@lists.php.net
Date:   01/05/2012 09:06 AM
Subject:Re: [PHP] Implicit FTPS
Sent by:nilesh...@gmail.com



On Thu, Jan 5, 2012 at 8:31 PM, Todd Nelson tnel...@mail.unomaha.edu 
wrote:
 My apologies if I'm in the wrong place, but I'm looking to discuss 
having
 PHP support implicit FTPS (currently only supports explicit.)  I'd like 
to
 find the author(s) of the 'ftp_ssl_connect' function to discuss if this
 has already been considered and offer assistance if desired.  Thank you.



http://www.php.net/manual/en/function.ftp-ssl-connect.php

-- 
Nilesh Govindarajan
http://nileshgr.com



[PHP] Calendar/Date

2009-03-17 Thread Jason Todd Slack-Moehrle

Hi All,

Does anyone have code and/or advice for how to get get the current  
week (with a passed current day, say) and what then end date is at  
Saturday.


So take today: Tuesday March 17, 2009

I want to get:
Sunday March 15, 2009
Monday March 16, 2009
Tuesday March 17, 2009
Wednesday March 18, 2009
Thursday March 19, 2009
Friday March 20, 2009
Saturday March 21, 2009

Thanks!
-Jason

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



[PHP] password field validation

2009-03-12 Thread Jason Todd Slack-Moehrle

Hi All,

I have an input field with type=password.

I am trying to do some error checking to see if the user puts a value  
in after they submit the form (i.e not left it blank)


Here is what I have:

on form:
Password: input id=PASSWORD name=PASSWORD type=password  
size=15


In PHP error checking:

if (empty($_POST[PASSSWORD]))
{ $GERROR=TRUE;}

even though I am putting characters in the field before I submit I am  
always getting TRUE returned.


This same tactic works for other fields I have that I need to make  
sure they put values in, just I have never done this before with a  
password field.


What am I doing wrong? I just want to make sure they put something  
there!


-Jason 


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



Re: [PHP] password field validation

2009-03-12 Thread Jason Todd Slack-Moehrle


if (empty($_POST[PASSSWORD]))
{ $GERROR=TRUE;}



If that's a direct copy/paste from your actual code, there is an extra
S in PASSWORD. Also, you should enclose the array key in quotes:

if (empty($_POST['PASSWORD']))
{ $GERROR='TRUE'; }


It is official I am a DOPE! Thank you, yes, I did not see the SSS in  
an hour of looking!


Why enclose in quotes? I have never done this!

-Jason

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



[PHP] Daily and Weekly Calendar classes

2009-03-12 Thread Jason Todd Slack-Moehrle

Hi All,

Does anyone have classes for creating a nice daily calendar? I can put  
the data in MySQL and be queried, etc.


Something that when I add events to the calendar it puts them in the  
right time slot, etc, etc.


I can do the rest of the coding

Free is best!

-Jason

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



RE: [PHP] whoami explanation

2009-03-04 Thread Boyd, Todd M.
 -Original Message-
 From: PJ [mailto:af.gour...@videotron.ca]
 Sent: Tuesday, March 03, 2009 5:56 PM
 To: Boyd, Todd M.
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] whoami explanation
 
 Boyd, Todd M. wrote:
  -Original Message-
  From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
  Sent: Tuesday, March 03, 2009 2:07 PM
  To: PJ
  Cc: Daniel Brown; Per Jessen; php-general@lists.php.net
  Subject: Re: [PHP] whoami explanation
 
  On Tue, 2009-03-03 at 11:16 -0500, PJ wrote:
 
  Daniel Brown wrote:
 
  On Tue, Mar 3, 2009 at 10:57, PJ af.gour...@videotron.ca wrote:
 
 
  forgot to add:
  What's the difference between back ticks or quotes and regular
 
  single
 
  quotes?
  How does one enter back quotes from the keyboard?
 
 
  Welcome to the Internet!
 
  The first place you should look when you have a question is
on
  Google.  The first result that comes up for backtick operator
is
 
  the
 
  PHP manual itself:
 
  http://php.net/language.operators.execution
 
  If you don't know where a key is on your keyboard, please
look
 
  down.
 
 
  I don't think it's necessary to be sarcastic...
  Hate to disappoint you, but on my computer (FreeBSD 7.0) on
Firefox
  Google does not go directly to the php manual... it goes to some
 
  nitwit
 
  site thinkexist.com
  So, this list is a much better source of information that waddling
  through the crap that's thrown at you on G.
  And I find that Googie is getting pretty garbagy even if there is
  nothing better around ;-)
  As for the keyboard, this is the first time I have ever, ever
 needed
 
  the
 
  back quote key although I have occasionally needed the ~ key for
 
  Windows
 
  stuff.
 
  --
 
  Phil Jourdan --- p...@ptahhotep.com
 http://www.ptahhotep.com
 http://www.chiccantine.com
 
 
 
  You tinker on Unix and you only ever use ~ for Windows?!
 
 
  I realize this thread is old and dead and buried, but I have to get
 my
  licks in on the new guy, too... but Ash beat me to it. I was going
to
  talk about how ~ was an alias for the current user context's home
  directory in any POSIX system I've ever used. :)
 
  Welcome aboard, PJ.
 
 Gee, thanks. So, when was I supposed to have used this alias? Hell, I
 can live with my ignorance. What's a POSIX system and why is it a
POSIX
 - a language, I think I heard
 
 But I'm sorry I missed the fun earlier about the American foibles...
 unfortunately that should go on some other list and I wish I knew
which
 one - one that had some smarts to it (like this one) and I'd like to
 really hear what people think about us and what's really going on in
 the world... oooh, well

http://lmgtfy.com/?q=posix

;)


// Todd

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



RE: [PHP] whoami explanation

2009-03-04 Thread Boyd, Todd M.
 -Original Message-
 From: paras...@gmail.com [mailto:paras...@gmail.com] On Behalf Of
 Daniel Brown
 Sent: Wednesday, March 04, 2009 10:16 AM
 To: Robert Cummings
 Cc: PJ; Boyd, Todd M.; php-general@lists.php.net
 Subject: Re: [PHP] whoami explanation
 
 On Wed, Mar 4, 2009 at 10:52, Robert Cummings rob...@interjinn.com
 wrote:
 
  *runs away while lightning bolts strike him over and over*
 
 Would the sound to accompany this mental image be one of a Daffy
 Duck or Woody Woodpecker nature?

I think it's a Queen song, actually...

;)


// Todd

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



RE: [PHP] 0.T Java IDE

2009-03-03 Thread Boyd, Todd M.
 -Original Message-
 From: Almog Friedman [mailto:ter...@gmail.com]
 Sent: Tuesday, March 03, 2009 7:55 AM
 To: php-general@lists.php.net
 Subject: [PHP] 0.T Java IDE
 
 Since I know theres alot of Java progarammers in this list and I don't
 want
 to sign upo to another mailing list i ask it here
 
 I'm searching for a Java ide (not netbeans, I'm sick of netbeans) which
 does
 gui in swing the best(i come from C# with visual studio and i'm
 searching
 for something that is as easy and powerful as the visual studio gui
 editor)

Having used Eclipse, Netbeans, JGrasp, Visual J#/J++, and Processing.org's 
notepad, I've got to say:

Developing UIs is easiest in Netbeans. Sorry. :(


// Todd


RE: [PHP] whoami explanation

2009-03-03 Thread Boyd, Todd M.
 -Original Message-
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
 Sent: Tuesday, March 03, 2009 2:07 PM
 To: PJ
 Cc: Daniel Brown; Per Jessen; php-general@lists.php.net
 Subject: Re: [PHP] whoami explanation
 
 On Tue, 2009-03-03 at 11:16 -0500, PJ wrote:
  Daniel Brown wrote:
   On Tue, Mar 3, 2009 at 10:57, PJ af.gour...@videotron.ca wrote:
  
   forgot to add:
   What's the difference between back ticks or quotes and regular
 single
   quotes?
   How does one enter back quotes from the keyboard?
  
  
   Welcome to the Internet!
  
   The first place you should look when you have a question is on
   Google.  The first result that comes up for backtick operator is
 the
   PHP manual itself:
  
   http://php.net/language.operators.execution
  
   If you don't know where a key is on your keyboard, please look
 down.
  
  
  I don't think it's necessary to be sarcastic...
  Hate to disappoint you, but on my computer (FreeBSD 7.0) on Firefox
  Google does not go directly to the php manual... it goes to some
 nitwit
  site thinkexist.com
  So, this list is a much better source of information that waddling
  through the crap that's thrown at you on G.
  And I find that Googie is getting pretty garbagy even if there is
  nothing better around ;-)
  As for the keyboard, this is the first time I have ever, ever needed
 the
  back quote key although I have occasionally needed the ~ key for
 Windows
  stuff.
 
  --
 
  Phil Jourdan --- p...@ptahhotep.com
 http://www.ptahhotep.com
 http://www.chiccantine.com
 
 
 You tinker on Unix and you only ever use ~ for Windows?!

I realize this thread is old and dead and buried, but I have to get my
licks in on the new guy, too... but Ash beat me to it. I was going to
talk about how ~ was an alias for the current user context's home
directory in any POSIX system I've ever used. :)

Welcome aboard, PJ.


// Todd

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



RE: [PHP] Re: How important is your Express or Web Edition database? Please weigh in--

2009-03-02 Thread Boyd, Todd M.
 -Original Message-
 From: Andrew Ballard [mailto:aball...@gmail.com]
 Sent: Saturday, February 28, 2009 12:05 AM
 To: a...@ashleysheridan.co.uk
 Cc: Boyd, Todd M.; PHP General list
 Subject: Re: [PHP] Re: How important is your Express or Web Edition
 database? Please weigh in--
 
 On Fri, Feb 27, 2009 at 7:32 PM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:
  On Fri, 2009-02-27 at 16:41 -0600, Boyd, Todd M. wrote:
   -Original Message-
   From: Andrew Ballard [mailto:aball...@gmail.com]
   Sent: Friday, February 27, 2009 3:26 PM
   To: Bastien Koert
   Cc: Shawn McKenzie; php-general@lists.php.net
   Subject: Re: [PHP] Re: How important is your Express or Web
 Edition
   database? Please weigh in--
  I use SQLExpress (SQL Server Express) all the time at work for
 prototyping and such... although, I have to say--if my company hadn't
 installed it on my machine to begin with, and they weren't running SQL
 Server 2005 on the production servers, I would rather just use a
 private MySQL installation for prototyping and then push to a MySQL
 production server. Alas...
 
 
  // Todd
  For me it's MySQL all the way. My company is too cheap to pay for
 later
  versions of MS SQL Server, so the versions we have there are *very*
  limited in features (for example, no limit function!) MySQL also
 seems a
  lot faster for me too. I regularly deal with large databases (think
  millions of records) and MSSQL is a real bottleneck here, whereas
 MySQL
  seems fine (althogh, it is running on Linux, which frees up more
  resources for actually getting stuff done!)
 
  Oh, funny thing. I filled in the questionnaire above, and when it got
 to
  the final 'thanks' page, I clicked the button, and it bombed out to a
  completely blank page. Doesn't bode too well for a company attempting
 to
  sell a product for use in enterprise situations!
 
 
  Ash
  www.ashleysheridan.co.uk
 
 
 It all depends on what you need. I know from your previous posts that
 you're not very well disposed to SQL Server, but I've used it quite a
 bit now for the last 8 years and haven't really had any problems with
 performance. I'll grant that it doesn't have the LIMIT clause (Is it
 part of the actual ANSI SQL spec, or is it something handy that MySQL
 added to their product?) The newer versions offer a row number
 function that can be used to provide the the same functionality, but
 I'll admit it is not nearly as simple as being able to say LIMIT 25,
 50.
 
 While I like MySQL, it has its oddities as well. I've run into
 situations where I had to add ORDER BY clauses to UPDATE statements
 (I'm not sure that's really valid SQL either) because it updated the
 rows sequentially and validated a unique index after each row rather
 than after all the rows were processed. I wish it would support CHECK
 constraints. And as convenient as I've found the SET and ENUM
 datatypes in simple databases, I'm coming to the notion that they are
 not a good idea in most situations. And while the availability of
 different engines has benefits, it can also cause issues.

Wait, wait, wait... I know SQL Server doesn't have LIMIT, but haven't you 
guys ever used TOP? As in...

select top 10 * from some_table where some_column = 'some_value';

?? I'm not sure about getting lower bounds (maybe there is a BOTTOM, but I'm 
too lazy right now)... but if you're just trying to limit the number of rows in 
your result with a cap, then TOP does the trick just fine.

I've had to do a lot of searching to find ways to do stuff in SQL Server that 
were already natural for me in MySQL (as I learned on MySQL and develop 
independently with it), but I have yet to be completely taken aback by 
something that's missing in SQL Server. (I am a little miffed that you have to 
do a sub-query on information_schema in order to test for object existence, 
though.)

Anyway, I don't see what all the anti-MSSQL sentiment is all about. I use it 
all the time (SQL Express, SQL Server 2000 and 2005 Professional) and I don't 
find myself wanting for something I could have done in MySQL but cannot do in 
MSSQL.

SSIS packages are pretty sweet to work with, BTW, if you've ever needed to 
build DTS solutions. :D

My 2c,


// Todd


RE: [PHP] Re: How important is your Express or Web Editiondatabase? Please weigh in--

2009-03-02 Thread Boyd, Todd M.
 -Original Message-
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
 Sent: Saturday, February 28, 2009 4:14 AM
 To: Andrew Ballard
 Cc: Boyd, Todd M.; PHP General list
 Subject: Re: [PHP] Re: How important is your Express or Web
 Editiondatabase? Please weigh in--

 I absolutely love enum datatypes; they allow you to use string values
 but internally stores them as numbers, and prevents the wrong data
from
 being inserted. Much simpler than joining extra tables of values onto
 it.
 
 As for mssql server, well, it's a bit of a hate/accept relationship.
 I'm
 forced to use it at work, and the Enterprise Manager tools we use to
 deal with it are slow and clumsy, and often do the strangest things.
 I'm
 generally not a fan of Windows much now, as I have seen what open
 source
 alternatives can really do.

You shouldn't blame the program on the operating system. :)


// Todd

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



RE: [PHP] upload progress (was www.soongy.com)

2009-03-02 Thread Boyd, Todd M.
 -Original Message-
 From: mike [mailto:mike...@gmail.com]
 Sent: Monday, March 02, 2009 12:17 AM
 To: Gevorg Harutyunyan
 Cc: tedd; German Geek; php-general@lists.php.net
 Subject: Re: [PHP] www.soongy.com
 
 I have a basic demo here. The code is not at it's best, you have to
 hit reload to upload a new file.
 
 http://mikehost.com/~mike/tmp/u/
 
 It does show you though with some javascript trickery and some math
 you can derive estimated time and approximate speed. I did have an
 example of multiple files too (I don't think this one supports that)
 
 At some point I'll publish all the components required and clean it up
 nicely.
 
 I also have an nginx module to complement it that should be available
 soon, to alleviate the need for the PHP processing piece (even though
 it does work like a charm)
 
 
 On Sun, Mar 1, 2009 at 10:05 PM, Gevorg Harutyunyan
 gevorg...@gmail.com wrote:
  Thank you all for your help!
 
  I tried to do without being dependent from flash, but as I see there
 are
  only two ways for this: flash and loading without tracking
 percentage. I
  choose second way :)
 
  On Mon, Mar 2, 2009 at 1:58 AM, mike mike...@gmail.com wrote:
 
  gears will allow you to do that, more or less. i have it going...

Gears will allow you to do a lot of things. So will site-proprietary Firefox 
extensions that go well outside the realm of basic client-server interaction 
via webpages. I was under the impression that Gears requires a local 
installation of their client library in order to work.

I don't think download this new extension so you can upload files to our site 
is going to go over so well.

  On Sun, Mar 1, 2009 at 12:34 PM, tedd tedd.sperl...@gmail.com
 wrote:
   At 12:13 PM -0800 3/1/09, mike wrote:
  
   you can use gears pretty easily to make a seamless multiple file
   upload now. it's all javascript too so you can make it look how
 you
   want, behave how you want, etc. without having to buy/tweak flash
   code.
  
  
   On Sun, Mar 1, 2009 at 12:07 PM, German Geek geek...@gmail.com
 wrote:
  
    Also check this one out: google uses it in gmail:
  
    
  
   http://code.google.com/p/jquery-multifile-
 plugin/downloads/detail?name=multiple-file-upload.zipcan=2q=
  
   Understood, but I don't think either of these do what the OP
 wanted,
   whcih
   was a real time file upload progress bar.


// Todd


RE: [PHP] upload progress (was www.soongy.com)

2009-03-02 Thread Boyd, Todd M.
 -Original Message-
 From: mike [mailto:mike...@gmail.com]
 Sent: Monday, March 02, 2009 12:59 PM
 To: Boyd, Todd M.
 Cc: PHP General list
 Subject: Re: [PHP] upload progress (was www.soongy.com)
 
 On Mon, Mar 2, 2009 at 7:45 AM, Boyd, Todd M. tmbo...@ccis.edu wrote:
 
  Gears will allow you to do a lot of things. So will site-proprietary
 Firefox extensions that go well outside the realm of basic client-
 server interaction via webpages. I was under the impression that Gears
 requires a local installation of their client library in order to work.
 
  I don't think download this new extension so you can upload files to
 our site is going to go over so well.
 
 Of course not, but
 
 a) browsers don't have it built-in, yet (I was working on trying to
 make a standard that I could pitch to browser creators)
 b) how do you think the flash or java applets got there anyway? :)
 
 Have a standard upload form. Tell people if they want more advanced
 multi-file support, progress support, etc, etc, install Gears as well.
 
 To me, Gears should be something just like Flash and Java... and I
 think is lighter-weight and allows for extending browser capabilities
 across nearly every platform without learning new languages.

Well it's just Javascript with access to local database storage and a caching 
facility, isn't it? I mean, I know Google threw a bunch of their API libraries 
in there with it (geolocation, for instance), but what little digging I've done 
into the matter has produced what I consider extended Javascript.

Again, I don't know a whole lot about it--I've just looked over the example 
scripts and read an article about its caching capabilities as applied to 
Wikipedia.


// Todd


RE: [PHP] retrieve multiple select

2009-03-02 Thread Boyd, Todd M.
 -Original Message-
 From: Shawn McKenzie [mailto:nos...@mckenzies.net]
 Sent: Monday, March 02, 2009 3:41 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] retrieve multiple select
 
 Shawn McKenzie wrote:
  Michael A. Peters wrote:
  PJ wrote:
  I'm sure this has been hashed over and over on the web, only I
 can't
  find anything that makes sense or the explanations given have been
  erroneous.
  This is what I am trying:
  select name=($categoriesIN).'[]' multiple
  OPTIONChoose Categories.../option
  OPTION VALUE=1History
  OPTION VALUE=2Temples
  OPTION VALUE=3Pharaohs and Queens
  OPTION VALUE=4Cleopatra
  OPTION VALUE=5Mummies
  /SELECT
  Whenever something doesn't work for me I always make sure what I am
  doing is valid html/xhtml
 
  That doesn't look valid to me - multiple=multiple might be.
  Maybe it is valid under older html.
 
  HTML 4.01
 
  multiple [CI]
  If set, this boolean attribute allows multiple selections. If
not
  set, the SELECT element only permits single selections.
 
 
 However, all the options should be closed.
 
 Instead of:  OPTION VALUE=1History
 
 Use:  OPTION VALUE=1History/OPTION
 
 Also, you should move the OPTIONChoose Categories.../option out of
 the select or you'll get it as an array item if someone actually
 selects
 it.  You could I guess set it to disabled also.

I believe if you just do option value=Choose something/option it's
pretty easy to discard an empty value if that's what they've selected.


// Todd

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



[PHP] Javascript question

2009-03-02 Thread Boyd, Todd M.
Before some of you newbies feel like being heroes and jump all over me:

I KNOW THIS IS A PHP-RELATED LIST. IF YOU DON'T LIKE MY QUESTION, DON'T
ANSWER IT.

Now that that's out of the way... I have a Javascript question (and
maybe a Browser/DOM question) for you folks. I'm not sure this is
anything they teach you in any online/in-seat/self-taught Javascript
course that I've ever seen before, so I figured I would bring it here.

My boss asked me if I knew of a tool that would change the !DOCTYPE of
a page on-the-fly to test validation in different schemes (i.e., XHTML
Strict, Transitional, Loose, etc.). After a bit of looking around, this
is the solution I came up with (as a bookmarklet):

javascript:document.write('!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0
Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;' +
document.getElementsByTagName('html')[0].innerHTML);

However, I'm not sure it will fire any validation events, since
technically the page has already been loaded (Javascript is just adding
more text). I fear the case will be the same if the current page's
source is sent to a new browser window.

I'm not asking for any coding suggestions, necessarily--just curious as
to whether or not anyone knew if this will invoke browser validation
events or not. Comments and questions are more than welcome, though. :)

Cheers!


// Todd

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



RE: [PHP] Javascript question

2009-03-02 Thread Boyd, Todd M.
 -Original Message-
 From: Robert Cummings [mailto:rob...@interjinn.com]
 Sent: Monday, March 02, 2009 4:18 PM
 To: Boyd, Todd M.
 Cc: PHP General list
 Subject: Re: [PHP] Javascript question
 
 On Mon, 2009-03-02 at 16:11 -0600, Boyd, Todd M. wrote:
  Before some of you newbies feel like being heroes and jump all over
 me:
 
  I KNOW THIS IS A PHP-RELATED LIST. IF YOU DON'T LIKE MY QUESTION,
 DON'T
  ANSWER IT.
 
  Now that that's out of the way... I have a Javascript question (and
  maybe a Browser/DOM question) for you folks. I'm not sure this is
  anything they teach you in any online/in-seat/self-taught Javascript
  course that I've ever seen before, so I figured I would bring it
 here.
 
  My boss asked me if I knew of a tool that would change the
!DOCTYPE
 of
  a page on-the-fly to test validation in different schemes (i.e.,
 XHTML
  Strict, Transitional, Loose, etc.). After a bit of looking around,
 this
  is the solution I came up with (as a bookmarklet):
 
  javascript:document.write('!DOCTYPE html PUBLIC -//W3C//DTD XHTML
 1.0
  Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;' +
  document.getElementsByTagName('html')[0].innerHTML);
 
  However, I'm not sure it will fire any validation events, since
  technically the page has already been loaded (Javascript is just
 adding
  more text). I fear the case will be the same if the current page's
  source is sent to a new browser window.
 
  I'm not asking for any coding suggestions, necessarily--just curious
 as
  to whether or not anyone knew if this will invoke browser validation
  events or not. Comments and questions are more than welcome, though.
 :)
 
 Can't you do it via PHP using a GET parameter? Seems more likely to
 work
 properly since it requires the page be reloaded on a fresh slate.
While
 at the same time, it will easily jump through the doctypes that the
 server deems suitable given the parameter
 
 http://www.www.www/foo.php?doctype=xmlstrict1.0

Rob,

Absolutely. However, requiring a server-side script was something I was
hoping to avoid. It may be useful as an intranet utility somewhere down
the road, but a bookmarklet was what I was shooting for for this first
test.

Great minds think alike, eh? :)


// Todd

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



RE: [PHP] Javascript question

2009-03-02 Thread Boyd, Todd M.
 -Original Message-
 From: Michael A. Peters [mailto:mpet...@mac.com]
 Sent: Monday, March 02, 2009 4:42 PM
 To: Boyd, Todd M.
 Cc: PHP General list
 Subject: Re: [PHP] Javascript question
 
 Boyd, Todd M. wrote:
  Before some of you newbies feel like being heroes and jump all over
 me:
 
  I KNOW THIS IS A PHP-RELATED LIST. IF YOU DON'T LIKE MY QUESTION,
 DON'T
  ANSWER IT.
 
  Now that that's out of the way... I have a Javascript question (and
  maybe a Browser/DOM question) for you folks. I'm not sure this is
  anything they teach you in any online/in-seat/self-taught Javascript
  course that I've ever seen before, so I figured I would bring it
 here.
 
  My boss asked me if I knew of a tool that would change the
!DOCTYPE
 of
  a page on-the-fly to test validation in different schemes (i.e.,
 XHTML
  Strict, Transitional, Loose, etc.).
 
 The validators generally don't trigger javascript.
 
 I use DOMDocument to create a valid xhtml page and then before sending
 it to the browser - if the browser does not report accepting valid
 xhtml
 (or I specify I want html) it filters the page to valid html 4.01.
 
 That's probably what you want to do - code for valid xhtml and filter
 the output to other DTD's you want to make available server side
rather
 than trying to use JS to alter the DOCTYPE.
 
 Remember, the proper header to send also relies on the DOCTYPE so if
 you
 sent a header for xhtml but send html (or vice versa) you are still
 breaking the standard regardless of how pristine your output is.
 
 Another advantage to building the document ahead of time and doing any
 translations server side is you can also filter the output for XSS in
 case you missed validating some input.

I think you guys are missing the point--this is not for proprietary use
on our own server with our own pages. I wanted to write a bookmarklet
that would work for any page, on any server. I'm beginning to think
that's not necessarily possible (using just JS and the browser).

Thanks for all of your suggestions, anyway. :)


// Todd

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



RE: [PHP] Re: catch the error

2009-02-27 Thread Boyd, Todd M.
 -Original Message-
 From: Chris [mailto:dmag...@gmail.com]
 Sent: Thursday, February 26, 2009 6:38 PM
 To: Boyd, Todd M.
 Cc: PHP General list
 Subject: Re: [PHP] Re: catch the error
 
 Boyd, Todd M. wrote:
  -Original Message-
  From: Chris [mailto:dmag...@gmail.com]
  Sent: Thursday, February 26, 2009 4:16 PM
  To: Boyd, Todd M.
  Cc: PJ; PHP General list
  Subject: Re: [PHP] Re: catch the error
 
 
  In examples sent to you, people foolishly replaced your $db var
 with
  $db_connect ONLY FOR PART OF THE SCRIPT. You've defined your
  database
  connection as $db_connect in some versions of the source, but then
  you
  reference $db (without _connect) in your mysql_select call in that
  same
  source.
 
  $db = mysql_connect([option list here]); # -- this code
  instantiates
  a
  connection
  mysql_select_db([some name], $db); # notice how $db is here?
  $result = mysql_query([some query], $db); # it's here, too!
 
  $db becomes your resource link when you use mysql_connect. That
  resource
  link must then be passed to your mysql functions. Otherwise, they
  have
  no idea which database connection you are attempting to use.
  RTFM?
 
  If no connection is specified, the last one is used.
 
  It is an optional argument (only *really* needed when you have
  multiple
  connections in the same script).
 
  RTF E-mail I sent?
 
  He had used $db_connect instead of $db. $db_connect hadn't been set
 to
  anything. He was specifying a connection, but it was null. Unless it
  falls back to the last connection used in the case of an empty
 variable,
  then this was most likely (read: proven to be) the problem.
 
 The last two emails I saw (no I haven't read the whole thread) were:
 
   $db = mysql_connect($db_host, $db_user, $db_pass);
 mysql_select_db($db_name,$db);
 
 snip
 
 $result1 = mysql_query($sql1,$db);
 
 and
 
   $db = mysql_connect($db_host, $db_user, $db_pass);
   mysql_select_db($db_name,$db);
 
 which have the right variables.
 
 Plus I was picking on the you must do this - using the link
 identifier
 is an optional thing as I already said.

Yes, it was solved before I replied. I just wanted to point out why it
worked in the situations that it did and why it did not work in the
situations that it did not. As the OP had been staring at it for too
long, all of the code started to blur together. :)

Anyway, it's a moot point now. I think the information you provided
about the link identifier was solid advice... I was just trying to point
out that using two different variables when specifying the link
identifier in mysql functions was what gave him so much guff.


// Todd

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



RE: [PHP] Re: How do I remove an array element from within a recursive function?

2009-02-27 Thread Boyd, Todd M.
 -Original Message-
 From: Chris [mailto:dmag...@gmail.com]
 Sent: Thursday, February 26, 2009 8:48 PM
 To: Daevid Vincent
 Cc: php-general@lists.php.net; Shawn McKenzie
 Subject: Re: [PHP] Re: How do I remove an array element from within a
 recursive function?
 
 Daevid Vincent wrote:
  I tried that and it still doesn't work. I even tried this hardcore
  test:
 
  public static final function removeMenuItems($menuItems,
 $removeArray)
  {
  foreach($menuItems as $value)
  {
  unset($value);
  }
  }
 
 You don't unset the value, you unset the key.
 
 ?php
 
 $items = array('menu1', 'menu2', 'menu3');
 
 echo Before:\n;
 print_r($items);
 
 foreach ($items as $_menuKey = $value) {
   if ($value == 'menu2') {
   unset($items[$_menuKey]);
   }
 }
 
 echo After:\n;
 print_r($items);
 
 
 $ php test.php
 Before:
 Array
 (
  [0] = menu1
  [1] = menu2
  [2] = menu3
 )
 After:
 Array
 (
  [0] = menu1
  [2] = menu3
 )

I would have gone with array_splice() on this one, I think. However, I
believe it will mangle associative arrays. Glad to know that there's a
way to use unset() on these, as I was unaware of it.

3 this list! :D

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



RE: [PHP] use strict or similar in PHP?

2009-02-27 Thread Boyd, Todd M.
 -Original Message-
 From: Bob McConnell [mailto:r...@cbord.com]
 Sent: Friday, February 27, 2009 7:44 AM
 To: h.schult...@yahoo.com; a...@ashleysheridan.co.uk
 Cc: php-general@lists.php.net; 9el
 Subject: RE: [PHP] use strict or similar in PHP?
 
 From: Hans Schultz
 
  Hahahah,I was thinking the same thing :D
 
  --- On Fri, 2/27/09, Ashley Sheridan a...@ashleysheridan.co.uk
 wrote:
  From: Ashley Sheridan a...@ashleysheridan.co.uk
  Subject: Re: [PHP] use strict or similar in PHP?
  To: Hans Schultz h.schult...@yahoo.com
  Cc: php-general@lists.php.net, 9el le...@phpxperts.net
  Date: Friday, February 27, 2009, 1:11 PM
 
  On Fri, 2009-02-27 at 14:04 +0100, Hans Schultz wrote:
  Sorry, I didn't want to offend anyone :-) It was just very weird
  argument
  - to quote:
  There is no compile time.  PHP is interpreted so it is
  compiled and
  then executed.
  Sounds like contradiction in this very sentence :-).
 
  My apologies
 
  But if it never compiles, it can never run, but it can't run without
  compiling? Arggh, my head. So does that mean if I go back in time
and
  shoot my grandfather, then nobody is in the woods to hear PHP try to
  compile?
 
 The compile process parses the text of the source file and translates
 it
 into an alternate form. This can by byte code, ala Pascal and Java, or

A la Pascal? What?! :D I had always thought when hit F9 in my Borland
studio back in the day that it built me a pretty little EXE file.

 executable code, ala COBOL and C. An interpreter, on the other hand,
 simply parses the source file, line by line and executes each line as
 it
 reads it, usually without saving it in an alternate form. This is the
 way JavaScript works. Some languages, such as Perl, are somewhere
 between the two. Perl parses the whole file, then executes only if it
 did not find any syntax errors or undefined variables (if certain
 strictures are turned on). Otherwise it prints out only the error
 message.
 
 From what I have seen of PHP, it is strictly interpreted. i.e. a line
 is
 read, and executed. Then the next line is read, and executed. etc. So
 there is no way to get it to block execution from the beginning even
 when there are fatal errors. It will already have printed out as much
 of
 the page as it executed before it finds those errors. This works fine
 in
 a development or test environment, but is a serious problem in
 production.
 
 So, I believe the question that was actually asked, is there any way
to
 induce PHP to completely parse the source file(s) and report any
errors
 before printing out anything, even the HTTP headers? Or can I set it
to
 redirect to an error page instead of sending an incomplete target page
 with error messages that might reveal information I don't want
exposed?

Well, take care of all of your logic before you display anything. It's
not that difficult, to be honest... especially if you're already using
an MVC design pattern/framework or a template system. If you are just
worried about displaying garbage and not about performing logic while
the page is being output to the browser, then I'd say use an output
buffer. If something bad happens, just clear the buffer out rather than
send it to the user, and forward to your error page instead.

http://www.php.net/ob_start

HTH,


// Todd

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



RE: [PHP] Development methods (was: use strict or similar in PHP?)

2009-02-27 Thread Boyd, Todd M.
 -Original Message-
 From: Bob McConnell [mailto:r...@cbord.com]
 Sent: Friday, February 27, 2009 9:56 AM
 To: PHP General list
 Subject: [PHP] Development methods (was: use strict or similar in
 PHP?)
 
 From: Boyd, Todd M.
  Well, take care of all of your logic before you display anything.
 It's
  not that difficult, to be honest... especially if you're already
 using
  an MVC design pattern/framework or a template system.
 
 That's an interesting string of buzzwords, but it carries no meaning
 for
 me. Would you care to elucidate further?
 
 As far as the code I am working with, I inherited over 160 files of
 mixed HTML and PHP, where the logic and presentation are intermingled
 (mangled) throughout. My initial toolset was TextPad4, WinSCP and
Putty
 on a WinXP workstation, with Apache on RHEL 5 as the server. (The
 original coder used vi on a clone of the server until they took it
away
 from him.) The chances of re-implementing the entire project are
 roughly
 equivalent to a zero with the edges rubbed out. I already have a six
 month to-do list just adding the new features already requested by
 current clients.

* MVC = Model-View-Controller [1]
* Template = Basically just the display (View) with variables injected
[2]
* Output Buffer = Output isn't sent to the browser until you deem it so
[3]

As far as inheriting more than 160 files with logic and presentation
intermingled... I think you're pretty much SOL with regard to converting
it to a framework or a new design pattern. It's possible, but that's
going to be quite a bit of work.

Links:
1. http://en.wikipedia.org/wiki/Model-View-Controller
2. http://www.smarty.net/ (just an example of one templating system)
3. http://www.php.net/ob_start

HTH,


// Todd

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



RE: [PHP] Re: How important is your Express or Web Edition database? Please weigh in--

2009-02-27 Thread Boyd, Todd M.
 -Original Message-
 From: Andrew Ballard [mailto:aball...@gmail.com]
 Sent: Friday, February 27, 2009 3:26 PM
 To: Bastien Koert
 Cc: Shawn McKenzie; php-general@lists.php.net
 Subject: Re: [PHP] Re: How important is your Express or Web Edition
 database? Please weigh in--
 
 On Fri, Feb 27, 2009 at 4:21 PM, Bastien Koert phps...@gmail.com
 wrote:
  On Fri, Feb 27, 2009 at 4:01 PM, Shawn McKenzie
 nos...@mckenzies.netwrote:
 
  Stan Stadelman wrote:
   Hello All:
  
   I'm trying to see how Web Edition databases are being used in your
  company
   for PHP-driven web-apps.  Our strategy team thought that free and
  community
   editions would be dominant, but we interviewed Zend Framework
 developers
   using Oracle, IBM, Microsoft, MySQL, PostgreSQL, and it looks
   like--surprise--that each vendors' market share is about the same
 as in
  the
   broad commercial market.
  
   We think this means that you--the PHP developer community--aren't
  actually
   using the lightweight Web/Express Edition for your corporate web-
 app
   deployment, and instead are building out on the licenses for
 databases
  your
   company is already running.
  
   Is the Express/Community/Web Edition important for you at work? Is
 it a
   critical sandboxing step for you? Do you run it live for internal
   applications?
  
   Answering these 10 multiple choice questions--should take about 90
   seconds--will help us understand what databases you need in your
   professional life, and how to deliver them to you.
  
   Happy cooking, and thanks!
  
  
 http://www.surveymonkey.com/s.aspx?sm=Jro0rkoIGJKuQNpfWZV_2bBQ_3d_3d
  
 
  What exactly are, Express or Web Edition databases?
 
  --
  Thanks!
  -Shawn
  http://www.spidean.com
 
 
  Just another marketing tool to sell a limited toolset db to punters
 who like
  marketing hype
 
 
  --
 
  Bastien
 
 I thought they were free. Limited, but free. (reduced functionality or
 limited number of connections compared to the commercial versions of
 the products) I've not heard of Web Edition, but I have heard of
 both SQL Server and Oracle Express. I haven't used them, but I guess
 the idea I have in mind is of products that are supposed to be just
 good enough to use in either embedded apps or else to entice
 developers into wanting the full version for server apps.

I use SQLExpress (SQL Server Express) all the time at work for prototyping and 
such... although, I have to say--if my company hadn't installed it on my 
machine to begin with, and they weren't running SQL Server 2005 on the 
production servers, I would rather just use a private MySQL installation for 
prototyping and then push to a MySQL production server. Alas...


// Todd


RE: [PHP] Re: catch the error

2009-02-26 Thread Boyd, Todd M.
 then be passed to your mysql functions. Otherwise, they have
no idea which database connection you are attempting to use.

# BAD:
$db = mysql_connect([options]);
$result = mysql_query([some query], $db_connect); # what's $db_connect?
who knows!

# GOOD:
$db = mysql_connect([options]);
$result = mysql_query([some query], $db); # same resource link from
mysql_connect

See?

HTH,


// Todd

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



RE: [PHP] Re: catch the error

2009-02-26 Thread Boyd, Todd M.
 -Original Message-
 From: Chris [mailto:dmag...@gmail.com]
 Sent: Thursday, February 26, 2009 4:16 PM
 To: Boyd, Todd M.
 Cc: PJ; PHP General list
 Subject: Re: [PHP] Re: catch the error
 
 
  In examples sent to you, people foolishly replaced your $db var with
  $db_connect ONLY FOR PART OF THE SCRIPT. You've defined your
database
  connection as $db_connect in some versions of the source, but then
 you
  reference $db (without _connect) in your mysql_select call in that
 same
  source.
 
  $db = mysql_connect([option list here]); # -- this code
instantiates
 a
  connection
  mysql_select_db([some name], $db); # notice how $db is here?
  $result = mysql_query([some query], $db); # it's here, too!
 
  $db becomes your resource link when you use mysql_connect. That
 resource
  link must then be passed to your mysql functions. Otherwise, they
 have
  no idea which database connection you are attempting to use.
 
 RTFM?
 
 If no connection is specified, the last one is used.
 
 It is an optional argument (only *really* needed when you have
multiple
 connections in the same script).

RTF E-mail I sent?

He had used $db_connect instead of $db. $db_connect hadn't been set to
anything. He was specifying a connection, but it was null. Unless it
falls back to the last connection used in the case of an empty variable,
then this was most likely (read: proven to be) the problem.

:p

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



RE: [PHP] XML - XSLT transformation using XSLTProcessor class

2009-02-20 Thread Boyd, Todd M.
 -Original Message-
 From: th.he...@gmail.com [mailto:th.he...@gmail.com] On Behalf Of
 German Geek
 Sent: Friday, February 20, 2009 9:18 AM
 To: PHP General list
 Subject: [PHP] XML - XSLT transformation using XSLTProcessor class
 
 Hi All,
 
 We are trying to import some xml data into the database. My idea was to
 make
 an xslt and then transform the xml to php code which generates the
 queries
 necessary and then gets evaled as php code for the actual import...
 
 Anyway, i got it working (mostly)!
 
 But i need to get the current element name with x-path. So i have the
 following:
 
 rootEl
   elementAchildOfAsome data 1/childOfA/elementA
   elementBchildOfBsome data 2/childOfB/elementB
   elementBchildOfBsome data 3/childOfB/elementB
   elementAchildOfAsome data 4/childOfA/elementA
   elementAchildOfAsome data 5/childOfA/elementA
 /rootEl
 
 xsl:for-each select=//elementA | //elementB
   // xsl:value-of select=childOfA / WORKS and gives the value of
 childOfA (e.g. some data 1)
   //... the php code...
 /xsl:for-each
 
 In the php code, I need to get the element tag name of the current
 element,
 so either elementA or elementB. How can i get that in an x-path
 expression?
 
 I know, this is not strictly a php question, but since the project is
 in php
 and this list has a very good response rate, i decided to ask here. I
 already looked on the web for hours, but maybe i just don't have the
 right
 keywords.
 
 Please help. Thanks.

I believe the name() XPath function is what you are looking for. It's been a 
while since I've worked with XPath query strings, but I believe .[name()] 
will get you the current element's tag name. Keep in mind: I'm not sure if this 
works with namespaced tags (like namespace:tagname /), but I have not tested 
this to be sure.

HTH,


// Todd


RE: [PHP] Opinions Please, Describing PHP as Web Framework of C and C++

2009-02-17 Thread Boyd, Todd M.
 -Original Message-
 From: Jim Lucas [mailto:li...@cmsws.com]
 Sent: Tuesday, February 17, 2009 1:14 PM
 To: Robert Cummings
 Cc: t...@kinetix.gr; Shawn McKenzie; php-general@lists.php.net
 Subject: Re: [PHP] Opinions Please, Describing PHP as Web Framework of
 C and C++
 
 Robert Cummings wrote:
  On Tue, 2009-02-17 at 21:05 +0200, Thodoris wrote:
  Virgilio Quilario wrote:
 
  Recently we had some serious discussion on local boards.
 
  I prefer calling PHP as Web Framework of C and C++
 
  if you had a time for this fruitless discussion. Please send
your
 opinions.
 
 
  PHP is a server side scripting language for the Web using a C
like
  language structure and conventions. The engine is built with C
 that is
  true but it is the engine that interprets the scripts not C.
  C has nothing to do with the operations of PHP engine.
  It is merely a code which is used to generate machine codes for
 the PHP engine.
 
  Good luck with your fruitless discussion as you like to call
it.
 
  Virgil
  http://www.jampmark.com
 
  I prefer calling C and C++ as Framework of Assembly language.
 
 
  Hahaha that was a good one Shawn. I almost fall of the chair :-) .
 
  What's so funny? Assembly is just a framework for microcode.
 
  Cheers,
  Rob.
 
 So, what is the level that actually polarizes the sectors on the hard
 drive?
 
 Anything more abstract then that is then an API right?

It's all just a neat wrapper for exchanging electron positions.


// Todd

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



RE: [PHP] Online Part Time Job Available

2009-02-16 Thread Boyd, Todd M.
 -Original Message-
 From: Al [mailto:n...@ridersite.org]
 Sent: Monday, February 16, 2009 3:00 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Online Part Time Job Available
 
  Please excuse us if this email is unwanted for you and we have
 disturbed you in some way, but this is a serious and sincere enquiry.
 
  Please reply to 15966nyazaha...@gmail.com
 
  Best regards,
  Stephanie Cunningham
 
  Die in a fire.
 
  Well, they did say your honest opinion was wanted ;)
 
 Several stipulations rule out most of the gang that hang out here. For
 example:
 * self-motivated
 * reliable individuals
 * honest opinion
 
 Oh well, next time maybe

Your lack of an emoticon accompanying this message can mean only one
thing: This is war!

* Most of the people on this list are independent developers (or do
independent development in addition to their day jobs)
* Hand-in-hand with independent development is sole responsibility
* Honest opinions abound on this list... that's why so many of the
discussions that would probably be passed over entirely on other lists
are discussed in great detail and from a wide variety of perspectives.

:p

(And yes, I realize you were [probably] joking.)


// Todd

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



RE: [PHP] Using DLL with PHP

2009-02-09 Thread Boyd, Todd M.
 -Original Message-
 From: Andrew Ballard [mailto:aball...@gmail.com]
 Sent: Monday, February 09, 2009 10:30 AM
 To: Dan Shirah
 Cc: Phpster; PHP-General list
 Subject: Re: [PHP] Using DLL with PHP
 
 On Mon, Feb 9, 2009 at 11:10 AM, Dan Shirah mrsqua...@gmail.com
 wrote:
 
  Check out the com [www.php.net/com] functionality
 
  Bastien
 
  Alrighty, I'm trying to use the COM function, but not getting much of
  anywhere.
 
  This is what I have:
 
  ?php
  // The VB function for reference
  /*function DTM_CONVDMSToMultiTIFF Lib D32_CONV.DLL _
  (ByVal FullPathFrom As String, ByVal FullPathTo As String) As
 Integer*/
 
  //Create a function in PHP to call the DLL
  function DMStoTIFF() {
  $my_com = new COM('D32_CONV.DLL');
  $output = $my_com-DTM_CONVDMSToMultiTIFF(C:\TEST\04186177.dms,
  C:\TEST\04186177.tiff);
  }
  DMStoTIFF();
  ?
 
  But I am getting the error below:
 
  *Fatal error*: Uncaught exception 'com_exception' with message
 'Failed to
  create COM object `D32_CONV.DLL': Invalid syntax
 
  Any ideas?
 
 
 I can't help much, but this might get you started.
 
 1) Does the DLL you are trying to use actually supports COM. I know
 some don't.
 
 2) I'm pretty sure that the string you pass to new COM('...') should
 be the name the class as registered with Windows, not the actual file
 name. They are usually something like 'Scripting.FileSystemObject',
 'word.application', 'ADODB.Recordset', etc.

I believe you can also call it by its Public Key Token (a GUID), though that 
may be a new convention introduced with the .NET framework that is not 
backwards-compatible with plain COM objects...


// Todd


RE: [PHP] php validate user password

2009-02-09 Thread Boyd, Todd M.
 -Original Message-
 From: tedd [mailto:tedd.sperl...@gmail.com]
 Sent: Monday, February 09, 2009 10:30 AM
 To: Bruno Fajardo
 Cc: PHP General
 Subject: Re: [PHP] php validate user password
 
 At 12:20 PM -0300 2/9/09, Bruno Fajardo wrote:
 tedd,
 
 I think that the problem of the duplicated hashes in the database
 (in the case of two users using the same password) persists with a
 constant prefix in the passwords. Although the random salt portion
get
 stored in the database concatenated to the hash, the attacker don't
 know the string length of the salt, making the attack very difficult.
 
 
 I've seen many duplicate password hashes in databases. Get a user
 number in the thousands and it's almost certain you'll have duplicate
 passwords. People just cannot create unique passwords.
 
 The article discussed using a random salt to avoid this, I got the
 message.
 
 I was just saying that even if there are duplicates, that doesn't
 make solving the hash any easier -- it just focuses the attention of
 the cracker to those duplicates. In some cases, I could see that as
 another way to foil a cracker by deliberately having those records in
 a database without a solution.
 
 For example, I could have a duplicate hash appear five times in a 5K
 population -- that certainly would become a focus for a cracker.
 However, I could also have my code looking for that hash and never
 provide a solution regardless of what the cracker does -- do you see
 what I mean?
 
 Granted, there are things here that are above my head -- I am not
 passing myself off as an expert but rather as someone proposing ideas
 to see if they pass or fail.

I don't think Security By Obscurity gets a fair shake anymore in
today's security world. Sure, it would be horrible to employ it
exclusively, but I think the added layer of abstraction that comes along
with it is a wonderful benefit to any application's security procedures.

The salt itself could be considered security by obscurity, since it is
being passed through the same algorithm as what you're hashing to begin
with. This might be a stretch, though. :)

I say, Huzzah, tedd. Good idea.

Hash + Obscurity  Hash + Nothing


// Todd

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



RE: [PHP] Using DLL with PHP

2009-02-09 Thread Boyd, Todd M.
 -Original Message-
 From: Andrew Ballard [mailto:aball...@gmail.com]
 Sent: Monday, February 09, 2009 11:21 AM
 To: Dan Shirah
 Cc: Phpster; PHP-General list
 Subject: Re: [PHP] Using DLL with PHP
 
 On Mon, Feb 9, 2009 at 12:10 PM, Dan Shirah mrsqua...@gmail.com
 wrote:
  I can't help much, but this might get you started.
 
  1) Does the DLL you are trying to use actually supports COM. I know
 some
  don't.
 
  2) I'm pretty sure that the string you pass to new COM('...') should
  be the name the class as registered with Windows, not the actual
 file
  name. They are usually something like 'Scripting.FileSystemObject',
  'word.application', 'ADODB.Recordset', etc.
 
 
 
  Andrew
 
  The DLL I am trying to work with was written by an outside agency.
 
  Their application uses this dll to convert DMS images (Their
 proprietary
  format) to TIFF images.
 
  Naturally they are not very forth coming to share the functionality
 of their
  software, but I was able to get the VB function that calls the DLL
 for
  conversion.
 
  Private Declare Function DTM_CONVDMSToMultiTIFF Lib D32_CONV.DLL _
  (ByVal FullPathFrom As String, ByVal FullPathTo As
 String) As
  Integer
 
  So, I was hoping to be able to call that DLL in PHP and pass it the
 two
  values I specify in my application.
 
  In order to be used by COM is the DLL required to be placed in the
 SYSTEM or
  SYSTEM32 folder?
 
 No. When I was doing an ASP (not .NET) site, we registered them from a
 custom path just for our web app.
 
  Or does it have to be a DLL that can be registered?
 
 I believe you do have to register it with regsvr32 for it to be
 visible.
 
 I think the GUID that Todd mentioned might even work, but I've only
 ever used the ProgID. If you don't know the ProgID that is registered,
 you should be able to find it in the Windows registry after you've
 registed it with regsvr32. If you search for the file name, it should
 find an entry somewhere under \HKEY_CLASSES_ROOT\CLSID\(some
 GUID)\InprocServer32 that has a value of the full path to your DLL
 file. The ProgID is the next key down below InprocServer32, labeled
 aptly ProgID.

I believe that the GUID will only be used to look-up class libraries that have 
already been registered (either via regsvr32 or via the Global Assembly Cache 
in c:\Windows\Assembly). I believe your ProgID suggestion will work just fine 
for pre-.NET DLLs, anyway. :)


// Todd


RE: [PHP] How can I use a function's default arguments but change one of the end ones in the list?

2009-02-06 Thread Boyd, Todd M.
 -Original Message-
 From: Daevid Vincent [mailto:dae...@daevid.com]
 Sent: Friday, February 06, 2009 2:26 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] How can I use a function's default arguments but
 change one of the end ones in the list?
 
 On Fri, 2009-02-06 at 14:10 +1300, German Geek wrote:
 
  I've thought about this problem before but couldn't think of a
  solution either.
 
 
 Well, I guess I *did* think of a solution, it just happens that PHP
 doesn't do the logical thing(tm)
 
 ;-)
 
 I would hope the PHP developers would implement this idea for a future
 version. The concept is simple, just specify which parameters in the
 function call you want to change and leave the others as their
default.
 
 I've added it here: http://bugs.php.net/bug.php?id=47331 with comments
 about similar/related bugs.
 
 Feel free to vote on this. I think it's a necessary addition to the
 language and often a source of frustration for me in large projects
 especially where functions get older and older and more parameters are
 needed to maintain backwards compatibility yet get new functionality
 too.

Just tell 'em that .NET already has it; that'll light a fire under them!
:D
C# can do function calls like:

FunctionName(VariableName:=Value);

I wholeheartedly prefer PHP to .NET for most things... but you've got to
admit--that's a pretty slick feature. Me likey.


// Todd

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



RE: [PHP] Garbage Collection

2009-02-05 Thread Boyd, Todd M.
 -Original Message-
 From: tedd [mailto:t...@sperling.com]
 Sent: Thursday, February 05, 2009 10:07 AM
 To: php-general@lists.php.net
 Subject: [PHP] Garbage Collection
 
 Hi gang:
 
 A related question to my last Clarity needed post.
 
 I have a tutor table (showing all the tutors), a course table
 (showing all the courses), and a course-to-tutor table (showing all
 the instances of what tutor teaches what course).
 
 Okay, everything works. Whenever I want to find out what courses a
 specific tutor teaches OR what tutors teach a specific course, I
 simply search the course-to-tutor table and bingo out pops the answer.
 
 Now, how do you handle the situation when a tutor quits or when a
 course is no longer offered?
 
 If I search the course-to-tutor table for all the tutors who teach a
 course and find a tutor who is no longer there OR search the
 course-to-tutor table for all the courses a tutor teaches and find a
 course that is no longer offered, how do you handle the record?
 
 I realize that if either search turns up nothing, I can check for
 that situation and then handle it accordingly. But my question is
 more specifically, in the event of a tutor quilting OR removing a
 course from the curriculum, what do you do about the course-to-tutor
 orphaned record?
 
 As I see it, my choices are to a) ignore the orphaned record or b)
 delete the orphaned record. If I ignore the record, then the database
 grows with orphaned records and searches are slowed. If I delete the
 orphaned record, then the problem is solved, right?
 
 I just want to get a consensus of how you people normally handle it.
 Do any of you see in danger in deleting an orphaned record?

tedd,

I believe relational integrity can solve your problem. In MySQL (and
maybe MSSQL, but I am less versed with that product) you should be
able to put a CASCADE option on the DELETE action for your tutor table
so that when a record is deleted, its associated record in
tutors-to-courses is also deleted. I'm assuming you would want to do the
same for removing a record in tutors-to-courses when a course is removed
(but not remove the tutor, the same as you do not remove the course
itself when the tutor is deleted).

I suppose you could also do it yourself with PHP code when a failed link
is turned up, but why bother separating DB logic from the DB itself? :)

HTH,


// Todd

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



RE: [PHP] CLI not obeying php.ini

2009-02-05 Thread Boyd, Todd M.
 -Original Message-
 From: Philip Thompson [mailto:philthath...@gmail.com]
 Sent: Thursday, February 05, 2009 3:45 PM
 To: PHP General list
 Subject: [PHP] CLI not obeying php.ini
 
 In my php.ini, I have
 
 error_reporting = E_ALL  ~E_NOTICE
 
 When I run a script from the command line, I get a lot of notices
 even when I said I don't want them. Also, in my script, I specified
 error_reporting(E_ERROR) in attempts to explicitly tell it what I
 want. It doesn't work either.
 
 Why am I still getting notices?! BTW, I don't receive notices via a
 web browser, just CLI.
 
 I double-checked to see what INI file was loaded and it's the one I
 expected to see:
 
 [pthomp...@pthompson scripts]$ php --ini
 Configuration File (php.ini) Path: /etc
 Loaded Configuration File: /etc/php.ini
 
 Thoughts on what's happening would be awesome! Thanks in advance.

In addition to what's already been said, you could try forcing a php.ini
file in the current directory by trying the -c command line option. I've
done it to try messing with a handful of values here and there for
particular scripts.

HTH,


// Todd

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



RE: [PHP] function_exists question

2009-02-05 Thread Boyd, Todd M.
 -Original Message-
 From: th.he...@gmail.com [mailto:th.he...@gmail.com] On Behalf Of
 German Geek
 Sent: Thursday, February 05, 2009 5:02 PM
 To: t...@kinetix.gr
 Cc: Matt Pagel; php-general@lists.php.net
 Subject: Re: [PHP] function_exists question
 
 Why can't you update to Version 5? I might be a bit anal about trying
 to
 always get the newest version of everything, but seriously version 3
 has
 surely more known security issues as well as performance costs.
 
 What's the cost of upgrading compared to the cost of writing code that
 works
 in every version? I think upgrading the system to PHP 5 will take you
 maybe
 half an hour, while you can spend a lot more hours on writing backward
 compatible code. PHP is not very good with compatibility across
 versions
 anyway. Hopefully all PHP 5 code will work in PHP 6.
 
 How about this PHP developers: You could make a global variable (or
 constant) the user can set like
 
 define('PHP_COMPATIBLE_VERSION', '5.0.1');
 
 or something to tell PHP 6 to interpret it like PHP 5.x . That way, at
 least
 you are guaranteed that the code will work like on that version. It
 might
 make PHP 6 (a lot?) bigger but it might be worth the cost, since all
 Sites
 written in PHP will still work. The functions could still have a
 performance
 boost that way if there are better algorithms.
 
 Sorry for steeling the thread.
 
 Regards,
 Tim
 
 Tim-Hinnerk Heuer
 
 http://www.ihostnz.com
 
 
 On Fri, Feb 6, 2009 at 12:55 AM, Thodoris t...@kinetix.gr wrote:
 
 
   Is there a way to check not only if a function exists, but also to
 check
  that the number and types of parameters desired match a function
 definition?
 
  The reason being that additional options have been added in php 4
 and 5 to
  various standard function calls, but I'm still running a php3 and
 php4
  server in addition to a php5 server.  I would like to make sure
that
 certain
  extended function calls still work in all versions (or I'll
 perform the
  tasks manually, albeit less efficiently).
 
  One example I can think of is the round() function.  The $precision
  parameter was added in php4, so will not work in php3.  However,
  function_exists would return TRUE for both 3 and 4, but round
itself
 would
  fail if I tried to send a precision level to the php3 server.
 
  Thanks much,
  Matt
 
  P.S. Of course the modified function_exists would unfortunately
 have to
  be a recognized function/method in php3 in order for me to call it
 to check
  parameter counts on a php3 server :(
 
 
  I am sure you have some good reasons for keeping php3 right?
 
  Why don't you consider updating to at least php4 ??
 
  PHPv3 is not even maintained and PHPv4 is not being developed any
 more.
 
  So by the end of this year (I hope) we will start using a stable
 PHPv6.
 
  IMHO you should consider changing your code (if this is possible) to
 a more
  mainstream version.

I think it would be much easier to run several versions of PHP in tandem
on the same server, and let an .htaccess file (or some other such
convention) determine the version of PHP to run particular
files/directories/etc. with.

My 2c,


// Todd

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



RE: [PHP] Re: Hidden costs of PHP arrays?

2009-01-30 Thread Boyd, Todd M.
 -Original Message-
 From: Paul M Foster [mailto:pa...@quillandmouse.com]
 Sent: Thursday, January 29, 2009 8:02 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Re: Hidden costs of PHP arrays?
 
 On Fri, Jan 30, 2009 at 11:10:16AM +1100, Clancy wrote:
 
 snip
 
  As a former assembly language programmer I have some idea of the
vast
  amount of thumb
  twiddling which is going on behind-the-scenes when I make some
 apparently
  simple request
  like the one to get my phone number. Undoubtedly most of this occurs
 in
  the murky depths
  of the operating system, but if there were any simple way to avoid
 adding
  to it
  unnecessarily it would be nice to know about it.
 
 Ahhh, finally someone who understands this principle. There's simply
no
 reason to waste cycles if you don't have to.

If that's REALLY your bag, just plot all of your functions in Assembly,
first!

https://www.scriptlance.com/cgi-bin/freelancers/project.cgi?id=121743701
3order=bid%20DESC

I, for one, will keep efficiency in mind--but if I spend a couple extra
cycles to relieve myself of an extra 20 lines of code, I think I'll
sleep just fine. :)

Now, if I was programming embedded systems or time-critical transaction
processing software, that might be another story. (Then again, if that
were the case, I might not be playing with an interpreted language to
begin with.)

My 2c.


// Todd

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



RE: [PHP] CURL vs stream_socket_client

2009-01-30 Thread Boyd, Todd M.
 -Original Message-
 From: Yves Arsenault [mailto:yves.arsena...@gmail.com]
 Sent: Friday, January 30, 2009 9:40 AM
 To: PHP List
 Subject: [PHP] CURL vs stream_socket_client
 
 Hi there,
 I'm not in PHP on a daily basis, but from time to time I get to
program
 a
 little in PHP for certain projects.
 
 Recently, I've installed a Magento system... and I've installed a
 canada
 post shipping module for this system.
 
 One thing that seems to be tripping it up is that it's using curl.
 
 curl is attempting to send xml data to canada post's server on port
 3.
 The response from canada post's system is always an html page...
 
 I've run a test using stream_socket_client and have gotten it to work,
 the
 canada post's system responds with the corresponding XML data with
 shipping
 info.
 
 I'm wondering if there are any curlopt_ options that should be set
that
 aren't currently set...
 Could be that curl is not sending properly formatted XML.

This may be a stretch, but try to set the User Agent string to mimic
Firefox before sending your request. I wrote a PHP scrape to gather
guild member information from the World Of Warcraft Armory [1] a few
years back, and it kept giving me HTML instead of XML until I used the
User Agent of a browser that most sites accept is capable of parsing
XML.

A lot of sites conditionally send IE (and unknown browsers) XHTML
instead of XML if there is any transformation of data involved.

Also--your comment Could be that curl is not sending properly formatted
XML is possible. Have you looked at the resulting HTML that is sent to
curl to make sure that it's not a server error message? If it's the
results you were looking for (but in XHTML format instead of XML), I'll
bet it's a User Agent thing.

Just a thought...


// Todd

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



RE: [PHP] Switch statement Question

2009-01-29 Thread Boyd, Todd M.
 -Original Message-
 From: Alice Wei [mailto:aj...@alumni.iu.edu]
 Sent: Thursday, January 29, 2009 3:02 PM
 To: php-general@lists.php.net
 Subject: [PHP] Switch statement Question
 
 
 Hi,
 
   I have a code snippet here as in the following:
 
 //Switch statements between the four options
 switch($string) {
 case :
 $string= NOT book.author='All';
 break;
 default:
 $string= $string . AND NOT book.author='All';
 break;
 }
   This code does work, but I am wondering if it is possible in the
 switch statement clauses for me to do something like case does not
 equal to a certain author name if I don't want $string with that
 content to be processed. or, do I always use default in this case?

It's a bit non-conventional, but the switch block can be used like so:

switch(true) {
case (x  y):
dosomething();
break;
case (y == 0):
dosomethingelse();
break;
default:
somethingelseentirely();
break;
}

...this way, your case statements can be expressions themselves, and it
will always pick at least one of them to fire.

HTH,


// Todd

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



[PHP] PHP Content Management

2009-01-29 Thread Jason Todd Slack-Moehrle

Hi All,

I am looking for an open-sourced CMS that is PHP/MySQL based.

I would like something simple to setup, but also would be good for a  
storefront as I want to use it for my indie business.


Thoughts?

-Jason

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



RE: [PHP] validating directory and file name with preg_match

2009-01-28 Thread Boyd, Todd M.
 -Original Message-
 From: Frank Stanovcak [mailto:blindspot...@comcast.net]
 Sent: Wednesday, January 28, 2009 11:08 AM
 To: php-general@lists.php.net
 Subject: [PHP] validating directory and file name with preg_match
 
 I'm limiting access to certain proceedures based on the file trying to
 use
 them, and the directory they are located in on my server.  Right now I
 am
 using two preg_match statments as you will see.  What I want to know
is
 this.  Is there a way to write a single regex for this that will
supply
 the
 file name as a match, and only return if the directory is valid?
 
 
 //make sure we are calling from the propper directory, and get the
file
 name
 that included to determine
 //database access needs

preg_match('#^C:Inetpubwwwrootfolder(entry|edit)(\w
 *\\.(php|pdf))#i',
 $included_files[0], $check1);

preg_match('#^C:Inetpubwwwrootfolder(\w*\\.(php|pdf))#i
 ',
 $included_files[0], $check2);
 if(isset($check1)){
  if(is_array($check1)){
   $matches[4] = $check1[2];
  };
  unset($check1);
 };
 if(isset($check2)){
  if(is_array($check2)){
   $matches[4] = $check2[1];
  };
  unset($check2);
 };
 if(isset($matches[4]){
 more code here
 };

I don't see why you're double-escaping the backslashes like that. If you
want a period, \. will do it for you. \\. Will match a backslash and
then any character (or delimiter).

As for failing if the directory isn't valid, read up on regex
look-arounds [1]. You could do a look-ahead to ensure that the directory
matches before continuing with the file portion of the pattern.

But, seriously... why are you double-escaping? Why not just C:\\Inetpub
instead of C:Inetpub? I would think that C:Inetpub would turn
into C:\\Inetpub, which is not a valid FAT/NTFS/etc. locator.

Try this:

/^c:\\inetpub\\wwwroot\\folder\\(?=entry|edit)\\(\w+\.(?:php|pdf))$/i

The (?=entry|edit) group is the look-ahead. If folder\\ isn't followed
by entry or edit, the look-ahead fails. The (?:php|pdf) group uses the
?: syntax to tell the regex engine not to save this capture group. You
could just as easily remove the ?: and ignore the extra capture in your
code (as you have done).

1. http://www.regular-expressions.info/lookaround.html 

HTH,


// Todd

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



RE: [PHP] Re: validating directory and file name with preg_match

2009-01-28 Thread Boyd, Todd M.
 -Original Message-
 From: Frank Stanovcak [mailto:blindspot...@comcast.net]
 Sent: Wednesday, January 28, 2009 1:04 PM
 To: php-general@lists.php.net
 Subject: [PHP] Re: validating directory and file name with preg_match
 
 
 Frank Stanovcak blindspot...@comcast.net wrote in message
 news:a8.d6.08436.5cf80...@pb1.pair.com...
  I'm limiting access to certain proceedures based on the file trying
 to use
  them, and the directory they are located in on my server.  Right now
 I am
  using two preg_match statments as you will see.  What I want to know
 is
  this.  Is there a way to write a single regex for this that will
 supply
  the file name as a match, and only return if the directory is valid?
 
  
  //make sure we are calling from the propper directory, and get the
 file
  name that included to determine
  //database access needs
 

preg_match('#^C:Inetpubwwwrootfolder(entry|edit)(\w
 *\\.(php|pdf))#i',
  $included_files[0], $check1);
 

preg_match('#^C:Inetpubwwwrootfolder(\w*\\.(php|pdf))#i
 ',
  $included_files[0], $check2);
  if(isset($check1)){
  if(is_array($check1)){
   $matches[4] = $check1[2];
  };
  unset($check1);
  };
  if(isset($check2)){
  if(is_array($check2)){
   $matches[4] = $check2[1];
  };
  unset($check2);
  };
  if(isset($matches[4]){
  more code here
  };
 
 
 --Then Robyn Sed--
 Looks like the difference between the 2 patterns is the
 '(entry|edit)' part -- couldn't you make that optional and combine
 it into one expression? Ie,  '((entry|edit))*'
 
 As for returning the filename, basename() is your friend.
 
 R
 --end--
 
 I would use basename, but I want only the two file types specified to
 trigger a return.  They are the only two valid php types on this
 server.
 
 Your suggestion worked like a charm!  Thank you very much!

Upon reading this, I realize that I over-thought my suggestion.

/^c:\\inetpub\\wwwroot\\folder\\(?:entry|edit)\\(\w+\.(?:php|pdf))$/i

That's my final answer. :)


// Todd

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



RE: [PHP] New to PHP question

2009-01-28 Thread Boyd, Todd M.
 -Original Message-
 From: Stephen [mailto:stephe...@rogers.com]
 Sent: Wednesday, January 28, 2009 1:41 PM
 To: Paul M Foster
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] New to PHP question
 
 Paul M Foster wrote:
  If you want exact layout (columns
  lined up, etc.), the simplest solution is to use HTML tables.
 
 
 
 The horror.
 
 Do not use tables for layout.
 
 Use CSS.
 
 Especially now that Microsoft, just this week, is sending out IE 8
 which
 seems to be fully CCS standards compliant.

Your high horse--get off of it.

Are you not familiar with div-itis? If I need to represent data in a
grid-style layout, I am going to use a table every time instead of
making tons of div elements and tying them into the appropriate CSS.

http://www.giveupandusetables.com

Also... as far as I know, XHTML 1.0 Strict and XHTML 1.1 still include
the table tags. I can understand wanting to separate style from
structure, but I think that tables are more structural than stylish. You
have to draw the line somewhere.

If you're displaying tabular data, use a table. If you just want stuff
to be in a grid and the structure has no bearing on the content, then
it's time to weigh in. 

Finally, just because IE8 is (supposed to be) fully CSS standards
compliant doesn't mean anything for IE7, IE6, IE5, etc.


// Todd

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



RE: [PHP] New to PHP question

2009-01-28 Thread Boyd, Todd M.
 -Original Message-
 From: Stephen [mailto:stephe...@rogers.com]
 Sent: Wednesday, January 28, 2009 4:40 PM
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] New to PHP question
 
 Boyd, Todd M. wrote:
 
  Finally, just because IE8 is (supposed to be) fully CSS standards
  compliant doesn't mean anything for IE7, IE6, IE5, etc.
 
 Microsoft is pushing IE 8 with their bug fix process.
 
 Not a bad idea to include a little JS to warm users with IE8 to
 upgrade.

If you're going to go that far, just ask them to install a worthwhile
browser. :P It's sad, but the burden falls on us web developers to
remain backwards-compatible (at least until EOL of the particular
browser(s) in question).

Personally, I look at that in the same light as I do pages that have a
disclaimer at the bottom that says, Best viewed in SomeResolution
with SomeBrowser. I understand that the programmer didn't want to go
through the nightmare of getting it to work across-the-board, but your
typical site visitor is going to look at that and frown.

Also, with that in mind, remember that Microsoft does not design their
web browser line with efficiency or speed of execution in mind. With
each iterative release, there is more feature bloat, more memory
required, and more processor cycles used up. Older PCs may very well be
stuck with IE6. This may not be your target market, but it's something
to consider.

This is just my opinion... but I know I'm not alone.


// Todd

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



RE: [PHP] Coding for email response forms

2009-01-27 Thread Boyd, Todd M.
 (variables in
the URL or the user's request, the time of day, the color of your
socks... whatever). If you want your form to be e-mailed, then it will
need to submit itself TO something. Right now, it's not submitting
anywhere but to itself. Since it is not a PHP script that e-mails forms,
POSTing it to itself does absolutely nothing but refresh the page.

It works kinda like this:

1.) Client requests the form
2.) Web server sends the form down (no PHP)
3.) User fills out the form and clicks SUBMIT
4.) Form POSTs to a PHP page
5.) PHP page grabs form data and e-mails it somewhere
6.) PHP page creates HTML that says success/failure
7.) User sees PHP-created success/failure page.

The thing isn't going to e-mail itself, and Javascript certainly isn't
enough to pull it off. I think you need to buff up a tad bit on the
basic concepts of server-side languages before you try to tackle even
the simplest task. People who don't fully understand PHP tend to further
confuse themselves when they try to mix Javascript with it before
knowing what they're dealing with.

http://www.w3schools.com/php 

HTH,


// Todd

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



RE: [PHP] Global Changes With Loop To Allow Nulls In A Table...

2009-01-27 Thread Boyd, Todd M.
 -Original Message-
 From: Andrew Ballard [mailto:aball...@gmail.com]
 Sent: Tuesday, January 27, 2009 11:39 AM
 To: revDAVE
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Global Changes With Loop To Allow Nulls In A
 Table...
 
 On Tue, Jan 27, 2009 at 11:53 AM, revDAVE c...@hosting4days.com
 wrote:
  Hi Folks,
 
  Newbie question
 
  I have a mysql table with 100 fields, currently all do not allow
 nulls.
  Rather than hand typing in phpMyAdmin, I would like a way to loop
 through
  all fields and update them to allow nulls
 
  My Beginning attempt needs help...
 
 
  $i = 1;
  while ($i = 100):
 
  // how do I word this to just change whatever field we are on to
 allow
  nulls?
 
  $sql = 'ALTER TABLE `mytable` ?*update*?
 `'.$???WhatEverField??[$i].'`
  ?ALLOWNULL?;';
 
  //mysql_query($sql);
 
  $result = mysql_query($sql) or die(br /br / Could not renumber
 dB $sql
  br /br / . mysql_error());
 
 
 $i++;
  endwhile;
 
 
 The other responses should get you started if this is something you
 really want to do. However, I'll play devil's advocate here and just
 raise the question why you would want to make this change in the first
 place. I'm not quite as anti-NULL as a lot of arguments I've read
 against them, but I tend to agree that the number of columns that
 accept NULL values should be kept as small as possible. Even if you
 decide that you need to allow NULL values in some cases, IMHO I
 wouldn't write a script that ran through my entire database and opened
 every column in every table to accept.

I just thought I'd throw this out there...

A lot of people who post questions on this list are programming their 
algorithms and structuring their applications in a certain way because that's 
what the client wants, or that's what their boss told them to do. Yes, 
accepting NULL values in a database is frowned upon (unless the table is a 
transaction table)... but I doubt his boss or his client cares in the least.

My 2 cents. ;)


// Todd


RE: [PHP] Global Changes With Loop To Allow Nulls In A Table...

2009-01-27 Thread Boyd, Todd M.
 -Original Message-
 From: Chris [mailto:dmag...@gmail.com]
 Sent: Tuesday, January 27, 2009 4:04 PM
 To: Boyd, Todd M.
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Global Changes With Loop To Allow Nulls In A
 Table...
 
 
  The other responses should get you started if this is something you
  really want to do. However, I'll play devil's advocate here and just
  raise the question why you would want to make this change in the
 first
  place. I'm not quite as anti-NULL as a lot of arguments I've read
  against them, but I tend to agree that the number of columns that
  accept NULL values should be kept as small as possible. Even if you
  decide that you need to allow NULL values in some cases, IMHO I
  wouldn't write a script that ran through my entire database and
 opened
  every column in every table to accept.
 
  I just thought I'd throw this out there...
 
  A lot of people who post questions on this list are programming their
 algorithms and structuring their applications in a certain way because
 that's what the client wants, or that's what their boss told them to
 do. Yes, accepting NULL values in a database is frowned upon (unless
 the table is a transaction table)... but I doubt his boss or his client
 cares in the least.
 
 I don't understand what you mean about a transaction table - you
 should only use nulls if you understand what they do and why you'd need
 them in that particular case. I'd ask why and find specifically what
 they want/why they suggested it and make sure they understand the
 repercussions.

A transaction table -- a table that is used to house the state of a 
transaction. If the transaction is incomplete, some of its values will be NULL. 
This is, of course, only one method for employing a transaction system. There 
exist others that use many disparate tables for separate steps in the 
transaction, but I've seen several that use one table with NULL columns for 
steps that haven't yet been processed.


// Todd


RE: [PHP] profiler web server

2009-01-26 Thread Boyd, Todd M.
 -Original Message-
 From: Jim Lucas [mailto:li...@cmsws.com]
 Sent: Monday, January 26, 2009 9:48 AM
 To: soussou97
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] profiler web server
 
 soussou97 wrote:
  Hi;
 
  I have a web server (apache 2.2 + PHP5) which process must be
watched
 for
  measuring the perf ?
 
  Regards;
 
 All I see here is a statement.  Do you actually have a question for
us?

Statements do not end with question marks... He is asking a question.

It looks to me like he wants to know which process he should watch to
determine the performance of Apache v2.2.

I believe it's httpd.

HTH,


// Todd

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



RE: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-26 Thread Boyd, Todd M.
 -Original Message-
 From: Bastien Koert [mailto:phps...@gmail.com]
 Sent: Monday, January 26, 2009 12:23 PM
 To: Per Jessen
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] best practice wrt multi-lingual websites, gettext()
 etc.

---8---
 
 At work, we don't use gettext() since :
 a) its an classic ASP shop (  :-(  ), therefore no Linux and no PHP
 b) the db current doesn't support multi-byte charsets

If database size (on disk, not spatially) isn't a concern, you might
consider encoding the multi-byte strings, storing them encoded, and then
decoding them when that language is requested. There will be overhead
involved in the codec operations, obviously, but you could help to curb
that with client- or server-side caching.

Just a thought. It might not be feasible for your situation at all...


// Todd

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



RE: [PHP] Java / PHP Bridge

2009-01-23 Thread Boyd, Todd M.
 -Original Message-
 From: c...@l-i-e.com [mailto:c...@l-i-e.com]
 Sent: Friday, January 23, 2009 9:02 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Java / PHP Bridge
 
 
 Zero real experience, but what I hear is that the Java / PHP bridges
 are a bit brittle and difficult to shore up properly...
 
 You may want to consider going with HTTP REST / RPC services instead,
 as those are quite solid, and you can get what you want.
 
 Note that this is all hearsay on my part.
 
 ymmv

About 3 years ago, I played with an earlier implementation of the
Java-PHP bridge on SourceForge. I could get some rudimentary stuff to
work just fine, but anything complex required a migraine's-worth of
configuration and nit-picky settings on both sides. The technology may
have improved since I played with it last, but I would also recommend
using a web service to accomplish the interoperability.

I'm currently working with a .NET project... I turned the entire thing
into a WCF REST service that will conditionally send SOAP or JSON
replies based on the service client. I can now hook it into Javascript
with a prototype built in jQuery, call it using a PHP SOAP interface,
reference it directly in other ASP.NET projects, and so on and so forth.

You'll get a wealth of benefits aside from making your life easier with
bridging the two languages. :)

HTH,


// Todd

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



RE: [PHP] Java / PHP Bridge

2009-01-23 Thread Boyd, Todd M.
 -Original Message-
 From: Bastien Koert [mailto:phps...@gmail.com]
 Sent: Friday, January 23, 2009 1:13 PM
 To: c...@l-i-e.com
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Java / PHP Bridge
 
 On Fri, Jan 23, 2009 at 10:02 AM, c...@l-i-e.com wrote:
 
 
  Zero real experience, but what I hear is that the Java / PHP bridges
 are a
  bit brittle and difficult to shore up properly...
 
  You may want to consider going with HTTP REST / RPC services
instead,
 as
  those are quite solid, and you can get what you want.
 
  Note that this is all hearsay on my part.
 
  ymmv
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 Is that hearsay or heresy?

Heresy is introducing change to a system of belief. Most commonly, you
see it in religious context.


// Todd

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



RE: [PHP] Java / PHP Bridge

2009-01-23 Thread Boyd, Todd M.
 -Original Message-
 From: Boyd, Todd M.
 Sent: Friday, January 23, 2009 1:44 PM
 To: 'Bastien Koert'
 Cc: php-general@lists.php.net
 Subject: RE: [PHP] Java / PHP Bridge
 
  -Original Message-
  From: Bastien Koert [mailto:phps...@gmail.com]
  Sent: Friday, January 23, 2009 1:13 PM
  To: c...@l-i-e.com
  Cc: php-general@lists.php.net
  Subject: Re: [PHP] Java / PHP Bridge

---8---

   Note that this is all hearsay on my part.

---8---

  Is that hearsay or heresy?
 
 Heresy is introducing change to a system of belief. Most commonly, you
 see it in religious context.

Grr... I meant to write system or belief. Since I'm writing another
e-mail, I'll go ahead and add that hearsay is more or less, I heard
it. Now I'm saying it.


// Todd

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



RE: [PHP] Please explain: index.php/index/index

2009-01-21 Thread Boyd, Todd M.
 -Original Message-
 From: clive [mailto:clive_li...@immigrationunit.com]
 Sent: Wednesday, January 21, 2009 3:36 AM
 To: leledumbo
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Please explain: index.php/index/index
 
 leledumbo wrote:
  Is this web server specific? I can't get it to run under Microsoft
 IIS, but
  it works flawlessly in Apache.
 
 IIS 6 and below dont have an option like mod_rewrite, apparently IIS 7
 does, I haven't tried it yet. There are a number of 3rd party apps
that
 can add this functionality to IIS 6, some are free and some paid for,
 Im
 currently using Isap/rewrite from helicontech which works for my needs
 (
 zend framework).

IIRF - Ionics ISAPI Rewrite Filter [1] is totally free... and it
supports the use of Regular Expressions [2] in your rewrite rules. If
you're going to use any sort of MVC-based URLs in IIS, this library is a
must-have.

1. http://www.codeplex.com/IIRF
2. http://www.regular-expressions.info

HTH,


// Todd

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



RE: [PHP] Looking for an app...

2009-01-16 Thread Boyd, Todd M.
. I am WELL aware of that. However, the last time I
tested it, I could upload a 2gb video file with a little bit of garbling
on the other end. Now that Base64 encoding is being employed (and
again--this part has NOT been tested!!), maybe it will get it across
without any garbling at all.

Note - the Java files have two caveats: First, they need to be compiled
into a *.jar and run from the user's machine or run as a SIGNED applet
from the server. Second, they are all included in a package named
postmusic. This can be easily changed to whatever you would rather use
(or don't use packages--it's your call).

Again, I stress that this has not been tested since the addition of
Base64 encoding/decoding, and that I am well aware of the code's...
um... simplicity. However, last time I checked, it uploaded huge videos
with 90% accuracy. Hopefully, that encoding/decoding bubble wrap will
get the file parts across without incident (although Base64 is adding
quite a few bytes to be transferred beyond just the underlying data).

Use at your own risk. Hopefully, this will spark someone else to take
the algorithms a bit further. :) I may do so myself if I find time, but
I've been very busy with other projects lately [3].

Links:
1. http://www.devx.com/java/Article/17679/0/page/3
2. http://iharder.sourceforge.net/current/java/base64/
3. http://sites.google.com/site/rexcrawler

HTH,


// Todd

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



RE: [PHP] Parsing HTML href-Attribute

2009-01-16 Thread Boyd, Todd M.
 -Original Message-
 From: farn...@googlemail.com [mailto:farn...@googlemail.com] On Behalf
 Of Edmund Hertle
 Sent: Thursday, January 15, 2009 4:13 PM
 To: PHP - General
 Subject: [PHP] Parsing HTML href-Attribute
 
 Hey,
 I want to parse a href-attribute in a given String to check if there
 is a
 relative link and then adding an absolute path.
 Example:
 $string  = 'a class=sample [...additional attributes...]
 href=/foo/bar.php ';
 
 I tried using regular expressions but my knowledge of RegEx is very
 limited.
 Things to consider:
 - $string could be quite long but my concern are only those href
 attributes
 (so working with explode() would be not very handy)
 - Should also work if href= is not using quotes or using single quotes
 - link could already be an absolute path, so just searching for href=
 and
 then inserting absolute path could mess up the link
 
 Any ideas? Or can someone create a RegEx to use?

Just spitballing here, but this is probably how I would start:

RegEx pattern: /a.*? href=(.+?)/ig

Then, using the capture group, determine if the href attribute uses quotes 
(single or double, doesn't matter). If it does, you don't need to worry about 
splitting the capture group at the first white space. If it doesn't, then you 
must assume the first whitespace is the end of the URL and the beginning of 
additional attributes, and just grab the URL up to (but not including) the 
first whitespace.

So...

?php

# here is where $anchorText (text for the a tag) would be assigned
# here is where $curDir (text for the current directory) would be assigned

# find the href attribute
$matches = Array();
preg_match('#a.*? href=(.+?)#ig', $anchorText, $matches);

# determine if it has surrounding quotes
if($matches[1][0] == '\'' || $matches[1][0] == '')
{
# pull everything but the first and last character
$anchorText = substr($anchorText, 1, strlen($anchorText) - 3);
}
else
{
# pull up to the first space (if there is one)
$spacePos = strpos($anchorText, ' ');   
if($spacePos !== false) 
$anchorText = substr($anchorText, 0, strpos($anchorText, ' '))
}

# now, check to see if it is relative or absolute
# (regex pattern searches for protocol spec (i.e., http://), which will be
# treated as an absolute path for the purpose of this algorithm)
if($anchorText[0] != '/'  preg_match('#^\w+://#', $anchorText) == 0)
{
# add current directory to the beginning of the relative path
# (nothing is done to absolute paths or URLs with protocol spec)
$anchorText = $curDir . '/' . $anchorText;
}

echo $anchorText;

?

...UNTESTED.

HTH,


// Todd


RE: [PHP] Parsing HTML href-Attribute

2009-01-16 Thread Boyd, Todd M.
 -Original Message-
 From: Shawn McKenzie [mailto:nos...@mckenzies.net]
 Sent: Friday, January 16, 2009 1:08 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Parsing HTML href-Attribute
 
 Shawn McKenzie wrote:
  Boyd, Todd M. wrote:
  -Original Message-
  From: farn...@googlemail.com [mailto:farn...@googlemail.com] On
 Behalf
  Of Edmund Hertle
  Sent: Thursday, January 15, 2009 4:13 PM
  To: PHP - General
  Subject: [PHP] Parsing HTML href-Attribute
 
  Hey,
  I want to parse a href-attribute in a given String to check if
 there
  is a
  relative link and then adding an absolute path.
  Example:
  $string  = 'a class=sample [...additional attributes...]
  href=/foo/bar.php ';
 
  I tried using regular expressions but my knowledge of RegEx is very
  limited.
  Things to consider:
  - $string could be quite long but my concern are only those href
  attributes
  (so working with explode() would be not very handy)
  - Should also work if href= is not using quotes or using single
 quotes
  - link could already be an absolute path, so just searching for
 href=
  and
  then inserting absolute path could mess up the link
 
  Any ideas? Or can someone create a RegEx to use?
  Just spitballing here, but this is probably how I would start:
 
  RegEx pattern: /a.*? href=(.+?)/ig
 
  Then, using the capture group, determine if the href attribute uses
 quotes (single or double, doesn't matter). If it does, you don't need
 to worry about splitting the capture group at the first white space. If
 it doesn't, then you must assume the first whitespace is the end of the
 URL and the beginning of additional attributes, and just grab the URL
 up to (but not including) the first whitespace.
 
  So...
 
  ?php
 
  # here is where $anchorText (text for the a tag) would be assigned
  # here is where $curDir (text for the current directory) would be
 assigned
 
  # find the href attribute
  $matches = Array();
  preg_match('#a.*? href=(.+?)#ig', $anchorText, $matches);
 
  # determine if it has surrounding quotes
  if($matches[1][0] == '\'' || $matches[1][0] == '')
  {
 # pull everything but the first and last character
 $anchorText = substr($anchorText, 1, strlen($anchorText) - 3);
  }
  else
  {
 # pull up to the first space (if there is one)
 $spacePos = strpos($anchorText, ' ');
 if($spacePos !== false)
 $anchorText = substr($anchorText, 0, strpos($anchorText, '
 '))
  }
 
  # now, check to see if it is relative or absolute
  # (regex pattern searches for protocol spec (i.e., http://), which
 will be
  # treated as an absolute path for the purpose of this algorithm)
  if($anchorText[0] != '/'  preg_match('#^\w+://#', $anchorText) ==
 0)
  {
 # add current directory to the beginning of the relative path
 # (nothing is done to absolute paths or URLs with protocol spec)
 $anchorText = $curDir . '/' . $anchorText;
  }
 
  echo $anchorText;
 
  ?
 
  ...UNTESTED.
 
  HTH,
 
 
  // Todd
 
  Wow, that's alot!  This should work with or without quotes and
 assumes
  no spaces in the URL:
 
  $prefix = http://example.com/;;
  $html = preg_replace(|(href=['\]?)(?!$prefix)([^'\\s]+)(\s)?|,
  $1$prefix$2$3, $html);
 
 
 Might need to keep a preceding slash out of there:
 
 $html = preg_replace(|(href=['\]?)(?!$prefix)[/]?([^'\\s]+)(\s)?|,
 $1$prefix$2$3, $html);

I believe the OP wanted to leave already-absolute paths alone (i.e., only 
convert relative paths). The regex does not take into account fully-qualified 
URLs (i.e., http://www.google.com/search?q=php) and it does not determine if a 
given path is relative or absolute. He was wanting to take the href attribute 
of an anchor tag and, **IF** it was a relative path, turn it into an absolute 
path (meaning to append the relative path to the absolute path of the current 
script).

That was my understanding. Perhaps you saw it differently, but I don't believe 
your pattern is enough to accomplish what the OP was asking for--hence a lot 
of code was in my reply. ;)

Believe me, I'm the first guy to hop on the do it with a regex! bandwagon... 
but there are just some circumstances where regex can't do what you need to do 
(such as more-than-superficial contextual logic).

HTH,


// Todd


RE: [PHP] preg_match_all question

2009-01-16 Thread Boyd, Todd M.
 -Original Message-
 From: Robert Cummings [mailto:rob...@interjinn.com]
 Sent: Friday, January 16, 2009 4:31 AM
 To: Phil Ewington - iModel Ltd.
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] preg_match_all question
 
 On Fri, 2009-01-16 at 09:42 +, Phil Ewington - iModel Ltd. wrote:
  Hi All,
 
  Having an issue with regular expressions, never been my strong
point!
 
  The following pattern only picks up one instance per line, if more
 than
  one instance exists all text from first {{ to last }} is included,
 can
  anyone point out where I am going wrong?
 
  preg_match_all(/\{\{lang:(.*)\}\}/, $str, $tags);
 
 You need the ungreedy modifier:
 
 preg_match_all(/\{\{lang:(.*)\}\}/U, $str, $tags);

FWIW, you can tell just the .* to be un-greedy using a ? like so:

preg_match_all('/\{\{lang:(.*?)\|\|/', $str, $tags);


// Todd

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



RE: [PHP] Parsing HTML href-Attribute

2009-01-16 Thread Boyd, Todd M.
 thing I noticed: If the href attribute is not surrounded in 
quotes (as the OP said it might not be in certain cases), then the remainder of 
the URL should be discarded... but your regex will also discard the remainder 
if it HAS been enclosed in quotes. (a href=http://www.google.com/search?q=php 
is cool is totally valid, and will work by converting the   to + [or 
maybe %20] when it is requested.)

I don't really have the time right now to further the regex, but you can bet 
your shirt I'm going to give it another look when I get home. :)


// Todd


RE: [PHP] preg_match_all question

2009-01-16 Thread Boyd, Todd M.
 -Original Message-
 From: Boyd, Todd M. [mailto:tmbo...@ccis.edu]
 Sent: Friday, January 16, 2009 2:13 PM
 To: php-general@lists.php.net
 Subject: RE: [PHP] preg_match_all question
 
  -Original Message-
  From: Robert Cummings [mailto:rob...@interjinn.com]
  Sent: Friday, January 16, 2009 4:31 AM
  To: Phil Ewington - iModel Ltd.
  Cc: php-general@lists.php.net
  Subject: Re: [PHP] preg_match_all question
 
  On Fri, 2009-01-16 at 09:42 +, Phil Ewington - iModel Ltd.
wrote:
   Hi All,
  
   Having an issue with regular expressions, never been my strong
 point!
  
   The following pattern only picks up one instance per line, if more
  than
   one instance exists all text from first {{ to last }} is included,
  can
   anyone point out where I am going wrong?
  
   preg_match_all(/\{\{lang:(.*)\}\}/, $str, $tags);
 
  You need the ungreedy modifier:
 
  preg_match_all(/\{\{lang:(.*)\}\}/U, $str, $tags);
 
 FWIW, you can tell just the .* to be un-greedy using a ? like so:
 
 preg_match_all('/\{\{lang:(.*?)\|\|/', $str, $tags);

Correction:

preg_match_all('/\{\{lang:(.*?)\}\}/', $str, $tags);

...turned my squiggly brackets into pipe chars in a fit of randomness.


// Todd

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



RE: [PHP] Basic Authentication

2009-01-15 Thread Boyd, Todd M.
 -Original Message-
 From: tedd [mailto:tedd.sperl...@gmail.com]
 Sent: Wednesday, January 14, 2009 5:18 PM
 To: Shawn McKenzie; php-general@lists.php.net
 Subject: Re: [PHP] Basic Authentication
 
 At 2:19 PM -0600 1/14/09, Shawn McKenzie wrote:
 
 
 As others have said, use crypt().
 http://php.net/manual/function.crypt.php has Example #2 Using crypt()
 with htpasswd.
 
 
 Thanks, but that doesn't really solve my problem.
 
 You see, I know the password and I know the encoded result -- what I
 don't know is what algorithm was used to generate the encoding.
 
 Here are all the algorithms I know of (this includes the above link
 you provided).
 
 http://webbytedd.com//md5/index.php
 
 However, none of them match what have.

tedd,

It would appear your Standard DES and MD5 labels are actually both MD5.
Also--there is more than just Standard DES. Once DES was determined to
be relatively IN-secure, more algorithms like Triple DES, G-DES, DES-X,
LOKI89, and ICE were created. You might be looking at a Triple DES hash.

HTH,


// Todd



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



RE: [PHP] Zend Framework...where to start? -- don't.

2009-01-15 Thread Boyd, Todd M.
 -Original Message-
 From: Paul M Foster [mailto:pa...@quillandmouse.com]
 Sent: Wednesday, January 14, 2009 8:18 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Zend Framework...where to start? -- don't.
 

---8---

 I agree and disagree. I agree there's waaay too much herd mentality in
 the programming field. (Fortunately, Linus Torvalds didn't listen to
 the
 academics who insisted that microkernels where THE WAY, or we wouldn't
 have Linux today.) OO is nifty for some things, but it's certainly not
 the fountain of reusability it was originally promoted to be. And I
 also agree about tables versus CSS. I can render a page very precisely
 with tables that would take me hours to get right with CSS. And I
 really
 don't give a crap about what experts say about anything. I find
 experts to be wrong much of the time.
 
 OTOH, I just finished writing about 80K lines of PHP/HTML, all by
hand,
 no OO, no classes, no nothing. Each page in one file, except for a few
 helper functions in a couple of common files. I wouldn't want to go
 through that again. I've opted for a framework on rewriting this code,
 just to cut down on the number of lines of code I have to manually
 write. But I built my own framework, which doesn't call in 20 files
for
 each page load. Very compact. Probably not suitable for every kind of
 project, but it works for this.
 
 Incidentally, I would differ from the reviewer in the link above only
 in
 this respect: He maintains that every line of code adds time. While
 this
 is true, I believe it's the number of files which have to be opened
 which drags down framework numbers the most. When I wrote C code, the
 CPU would blaze through the actual code, but file opens and reads
 consumed far more time than in-memory code execution.

http://www.giveupandusetables.com

'nuff said.


// Todd




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



RE: [PHP] Data trasfer between PHP pages

2009-01-12 Thread Boyd, Todd M.
 -Original Message-
 From: Chris Carter [mailto:chandan9sha...@yahoo.com]
 Sent: Monday, January 12, 2009 11:00 AM
 To: php-general@lists.php.net
 Subject: [PHP] Data trasfer between PHP pages
 
 
 Hi,
 
 I have one form where user fills data using radio buttons. Only one
 answer
 goes from here to another page.
 
 FORM 1
 
 form action=form2.php method=post
 input type=radio name=myname value=Answer 5 id=1 /
 label for=15/label
 br /
 input type=radio name=myname value=Answer 1 id=2 /
 label for=21/label
 br /
 input type=radio name=myname value=Answer 3 id=3 /
 label for=33/label
 br /
 input type=submit value=Enter /
 /form
 
 ---
 
 FORM 2
 
 There is another page has a form with 14 fields PLUS I need the data
of
 the
 previous form to be hidden somewhere in this form.
 
 Once this form is submitted I need to put the combined data into the
 database.
 
 I know this is so simple. But not sure why this is not working. I
tried
 to
 use ?$_GET[myname] ? from the first form but its not working.
 
 My module page has to go live tomorrow morning, I am stuck, please
 help.

$_GET['var'] is used for GET-method data retrieval. You have specified
POST-method data in your form. Try $_POST['myname'] and see if that
doesn't grab the value you're looking for.

HTH,


// Todd

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



RE: [PHP] Regex Problem

2008-12-18 Thread Boyd, Todd M.
 -Original Message-
 From: MikeP [mailto:mpel...@princeton.edu]
 Sent: Thursday, December 18, 2008 8:43 AM
 To: php-general@lists.php.net
 Subject: [PHP] Regex Problem
 
 Hello,
 I have  a quirky behavior I'm trying to resolve.
 I have a REGEX that will find a function definition in a php file:
 .function InsertQuery($table,$fields,$values).
 the REGEX is:
 $regex='/function [a-z]* *([$a-zA-Z]*)/';
 the problem is that:
 1. a slash is automattically put in front of the $. This is good but I
 dont
 know how it gets there.
 2.a slash is NOT put in front of the parenthesis. Thats bad
 3. If I try to escape the parenthesis with a \ , I get \\.
 Help

Mike,

Certain characters are considered special in RegEx. The $ means end
of the line, so it must be escaped to avoid confusing its meaning. I
was not sure it had to be escaped within a character set [], but that
may very well be the case. Try this:

$regex = '/function\s+[-_a-z0-9]+\s*\((\s*\$?[-_a-z0-9]+\s*,?)*\s*\)/i';

The word function is followed by 1 or more spaces (or tabs). The
function name [-_a-z0-9] can be a combination of alpha-numeric
characters, underscore, and dash. Then, there is optional whitespace
between the name of the function and its parameters. The opening
parenthesis ( for parameters has been escaped (as has the closing
parenthesis). Then, in a repeatable capture group, the parameters can be
grabbed: Indefinite whitespace, an optional $ (because maybe you're not
using a variable, eh?), one or more alpha-numeric, underscore, or dash
characters, followed by indefinite whitespace and an optional comma (if
there are more arguments). After any number of instances of the capture
group, the regex continues by looking for indefinite whitespace followed
by the closing parenthesis for the function text. The i switch at the
end simply means that this regex pattern will be treated as
case-insensitive ('APPLE' == 'apple').

If you're not worried about actually splitting up the function
parameters into capture groups, then you can just use a look-ahead to
ensure that you grab everything up till the LAST parenthesis on the
line.

$regex = '/function\s+[-_a-z0-9]+\s*\(.*?\)(?=.*\)[^)]*)/i';

That one probably needs to be tweaked a bit in order to actually grab
the last parenthesis (instead of just checking for its existence). If
you're willing to trust the text you'll be searching through, you can
probably avoid that last parenthesis rule altogether, and make a lazy
regex:

$regex = '/function\s+[-_a-z0-9]+\s*\(.*?/i';

Once you get to the opening parenthesis for the function parameters,
that last regex assumes that the rest of the line will also include that
function declaration, and just grabs everything left. If you are using a
regex setup to where the dot marker can also consume newline or carriage
return characters, just throw a $ at the end of the regex (before the
flags part /i) in order to tell it just to grab characters until it
reaches the end of the line:

$regex = '/function\s+[-_a-z0-9]+\s*\(.*?$/i';

These are all untested, but hopefully I've given you a nudge in the
right direction. If you are still getting strange behavior out of your
PCRE engine, then perhaps you have a different version installed than
what I'm used to--all of the above should work (perhaps with some very
minor changes) in PHP.

HTH,


// Todd

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



RE: [PHP] fread question

2008-12-18 Thread Boyd, Todd M.
 -Original Message-
 From: MikeP [mailto:mpel...@princeton.edu]
 Sent: Thursday, December 18, 2008 7:33 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] fread question
 
 Still having problems:
 magic_quotes_runtime is off
 BUT
 magic_quotes_gpc is on
 I cant change them myself so I tried
 stripslashes
 That doesnt work though:
 
 $_POST[$fname] = fread($fileHandle, $_POST[$fname.'_size']);
 $test=$_POST[$fname];
 $test3=stripslashes($test);
 
 $test3 and $test are the same.
 
 Any other Ideas?
 
 Robert Cummings rob...@interjinn.com wrote in message
 news:1229567238.8302.35.ca...@localhost...
  On Wed, 2008-12-17 at 19:54 -0500, MikeP wrote:
  Hello,
  I have been trying to use fread to open a file, but it always
 escapes
  special characters.
  How do I open  afile without it modifying my original file:
 
  $_POST[$fname] = fread($fileHandle, $_POST[$fname.'_size']);
  I use this and get slashes everywhere.This kills my REGex that gets
 coded
  next.
 
  Check this magically shitty setting in your php.ini:
 
 magic_quotes_runtime
 
  It should be off unless someone with less brains than a turd got a
 hold
  of your ini file.

The PHP site's page on ini_set() [1] talks a bit about how to set that
particular option in an .htaccess file:

set PHP_INI_PERDIR settings in a .htaccess file with 'php_flag'
like this:

php_flag register_globals off
php_flag magic_quotes_gpc on

If you can get at your .htaccess, maybe you could do it that way (since
I don't believe you can change magic_quotes_gpc using ini_set() or
similar methods).

HTH,


// Todd

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



RE: [PHP] fread question

2008-12-18 Thread Boyd, Todd M.
Hah! Forgot to add the link:

1. http://php.net/ini_set

How would you guys have ever figured out that was the page on PHP's
website you need to visit in order to view information about the
ini_set() function?!

;)


// Todd

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



[PHP] RE: Php question from Newsgroup

2008-12-18 Thread Boyd, Todd M.
Mike -- I've bottom posted my reply, as is the convention for this list (and 
most others). Scroll down.



From: Mike Peloso [mailto:mpel...@princeton.edu] 
Sent: Thursday, December 18, 2008 9:56 AM
To: Boyd, Todd M.
Subject: Php question from Newsgroup

Todd,
I have attached a few jpgs to show the problems I am having (With both of my 
recent posts)
Any questions you can call me.
The first one shows the value of the php file I am trying to parse.( I cant set 
any of those directives,) I can't set php.ini per dir
The second shows what your REGEX looks like as its being sent to: 
preg_match_all($regex, $test2, $result, PREG_PATTERN_ORDER);
As you can see there is a whole lot of escaping going on here.
Thanks
Mike 

Heres all the code:
?php
process_uploaded_file('letter');
function process_uploaded_file($fname) {
    // Assumes set of $_POST variables in the form: name, name_fname, 
name_size, name_type
    $_POST[$fname.'_fname'] = $_FILES[$fname]['name'];
    $_POST[$fname.'_size'] = $_FILES[$fname]['size'];
    $_POST[$fname.'_type'] = $_FILES[$fname]['type'];
    $_POST[$fname.'_fname'] = strtr($_POST[$fname.'_fname'],' 
%*;:{}[]|\,/()%...@!',''); //fix special chars in 
name
    $_POST[$fname.'_fname'] = strtr($_POST[$fname.'_fname'],',_);
    $fileHandle = fopen($_FILES[$fname]['tmp_name'], r);
    $_POST[$fname] =stripslashes(fread($fileHandle, $_POST[$fname.'_size']));
    $test=$_POST[$fname];
    $test3=stripslashes($test);
    //$regex='/function [a-z]* *([$a-zA-Z]*)/';
    //$regex='/function [a-z]* *(?$[a-z]*)?/';
    $regex = '/function\s+[-_a-z0-9]+\s*\((\s*$\?[-_a-z0-9]+\s*,?)*\s*\)/i';

    $functions=do_reg($regex,$test);
}

  function do_reg($regex,$test)
{   $test2=preg_quote($test);
    preg_match_all($regex, $test2, $result, PREG_PATTERN_ORDER);
    return $result = $result[0];
}
?



Mike,

You are using preg_quote(). This will add slashes to every special RegEx 
character in your pattern (i.e., parentheses and dollar signs, etc.). Try 
performing your RegEx search without using preg_quote() and let me know if it 
does any better. Also--try to keep your replies on the PHP List, as the 
information in them can be used by others on their own projects.

// Todd 


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



RE: [PHP] Read/decode barcodes from an image

2008-12-18 Thread Boyd, Todd M.
 -Original Message-
 From: c...@l-i-e.com [mailto:c...@l-i-e.com]
 Sent: Thursday, December 18, 2008 10:06 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Read/decode barcodes from an image
 
 The barcodes are on faxes and whatnot, with no predictable skew,
 position, nor orientation.
 
 You've tried JOCR/GOCR, and they don't do very well.
 
 Here are your options:
 1) Shell out the money for that PaperPort OMNI or whatever it is
 commercial OCR product. It *is* better than JOCR/GOCR, in my
 experience.
 [If you Google for OCR you'll find it, as it's the only/best
contender,
 and referenced everywhere.]
 
 2) Roll your own with GD. With sufficient skill and time, you can
 utilize very specific knowledge of your content to do even better than
 the generalized commercial solution. I have done this myself for
 standardized medical documents that were scanned in, getting a
 percentage point or two better than 1)
 
 No matter what you do, OCR will never ever get you 100%.  You WILL
need
 a human oversight process on the results that hand-checks everything,
 or be prepared to accept a (small) failure rate.
 
 Set your [client's] expectations properly, or be doomed to frustration
 [failure].

I had always thought that faxes were a big no-no for character
recognition software? I know that we can't use it for one of our OCR
solutions because it is just too... well, crappy. The image quality is
nowhere near what it should be for a successful OCR pass.

As for client expectations: hell yes--tell them not to use a fax machine
in the digital age. Scan the document and e-mail it or something. Where
I work, we've done away with 90% of any fax machine usage in order to
have documents that can be used by our OCR solution.

My 2c,


// Todd

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



RE: [PHP] CLI in background on windows

2008-12-18 Thread Boyd, Todd M.
 -Original Message-
 From: Fanda [mailto:d...@sidak.net]
 Sent: Thursday, December 18, 2008 10:50 AM
 To: php-general@lists.php.net
 Subject: [PHP] CLI in background on windows
 
 Hi,
 I am looking for some method, how to run php cli script on background
 in
 windows. It should be started by windows task manager.
 
 Do you have any idea?

I assume by task manager you mean task scheduler? The Task Manager
is more of a process listing, like ps or top in Linux.

In the Windows command-line interface (cmd.exe), type start /? to give
you an idea of what your options are. As far as in the background
goes, Vista's task scheduler can hide the programs it executes from
being viewed by the user. Pre-vista, I think you can just minimize it
(unless it's run on a different account on the same machine other than
the one logged in)...

start /min /b php myscript.php

The /b option MIGHT prevent pre-Vista machines from showing the user
that a task is being executed. If it doesn't, then at least /min will
keep the window minimized rather than slapping them in the face with it.

HTH,


// Todd

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



RE: [PHP] Re: Foreign Keys Question

2008-12-12 Thread Boyd, Todd M.
 -Original Message-
 From: clive [mailto:clive_li...@immigrationunit.com]
 Sent: Friday, December 12, 2008 1:07 AM
 To: PHP LIST
 Subject: Re: [PHP] Re: Foreign Keys Question
 
 Colin Guthrie wrote:
  'Twas brillig, and tedd at 11/12/08 18:46 did gyre and gimble:
  As for my Foreign Keys Question, I think the answer is that it
  enforces rules upon the configuration (i.e., deleting, altering, and
  such), but does not provide any significant service beyond that.
 
  Well that's a fairly significant service in itself. The whole
  deleting data case is where FK's have saved me significant amount
 of
  coding.
 
  The ON DELETE CASCADE option is key here... DELETE FROM students
  where student_id=1 will remove all traces of that student from the
  db... all the course they've attended, all the instructors who have
  taught them etc. keeps things nice and tidy without having to put the
  structure in your code all over the place.
 
  Col
 
 Is it just me or does anyone else here not like deleting from a
 database, I normally have a status field to indicated if a row has been
 deleted.
 
 What about historical data, would you not want to know that studentX
 was
 enrolled at some point in the past, if you just delete that student and
 all related data how would you know this?
 
 You could also have a 2nd database with the same table structure and
 move old/delete data into there.

You are describing a data warehouse, or a data mart. That is not what 
transactional databases are there for. Make a historical database, and make a 
transactional database... but don't make one that tries to be both, or you're 
just shooting yourself in the foot.


// Todd


RE: [PHP] Re: Poll of Sorts: Application Frameworks--Zend, Cake etc

2008-12-12 Thread Boyd, Todd M.
 -Original Message-
 From: Terion Miller [mailto:webdev.ter...@gmail.com]
 Sent: Friday, December 12, 2008 7:55 AM
 To: Colin Guthrie
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Re: Poll of Sorts: Application Frameworks--Zend,
 Cake etc
 
 On Thu, Dec 11, 2008 at 4:25 PM, Colin Guthrie gm...@colin.guthr.ie
 wrote:
 
  'Twas brillig, and Terion Miller at 11/12/08 14:56 did gyre and
 gimble:
 
  Hey Everyone, I am wondering if using a framework such as one of
 these may
  make my life easier, which do any of you use and what has been your
  experience with the learning curve of them?
  I just put Cake on my local server, basically I want to know which
 is
  easiest? LOL...
 
 
  Personally I'm a ZF fan, but each to their own.
 
  Col
 
  --
 
  Colin Guthrie
  gmane(at)colin.guthr.ie
  http://colin.guthr.ie/
 
  Day Job:
   Tribalogic Limited [http://www.tribalogic.net/]
  Open Source:
   Mandriva Linux Contributor [http://www.mandriva.com/]
   PulseAudio Hacker [http://www.pulseaudio.org/]
   Trac Hacker [http://trac.edgewall.org/]
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
  Thanks for the responses, CakePhp was seemingly very easy for me to
 catch
 on to and get started in (which means its super super easy folks)
 unfortunately when I got to the viewing of my files (pretty important)
 I
 couldn't get the IIS (yep I know sucks) to work with it, and I
 installed a
 mod_rewrite.dll for IIS and everything along with setting it to Cakes
 pretty urls and removing the htdocs, but then it just kept resolving
 all
 urls to the root ... no matter what I changed the path to, and no
 matter if
 I set it only to that directory...so by end of day yesterday I
 downloaded
 the zend and will attempt to see what I can do with it, I want off
this
 windows box but that isn't going to happen anytime soon ...sigh...

I recommend the Ionic ISAPI Rewrite Filter [1]. Also, this [2] webpage
can probably help you with your Cake/IIS configuration, although they
use a different rewrite filter [3].

1. http://www.codeplex.com/IIRF 
2. http://bakery.cakephp.org/articles/view/cakephp-on-iis 
3. http://www.creativepark.it/downloads/iismod_rewrite.zip 

HTH,


// Todd

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



RE: [PHP] Poll of Sorts: Application Frameworks--Zend, Cake etc

2008-12-11 Thread Boyd, Todd M.
 -Original Message-
 From: Eric Butera [mailto:eric.but...@gmail.com]
 Sent: Thursday, December 11, 2008 9:25 AM
 To: Bastien Koert
 Cc: Terion Miller; PHP General
 Subject: Re: [PHP] Poll of Sorts: Application Frameworks--Zend, Cake
 etc
 
 On Thu, Dec 11, 2008 at 10:22 AM, Bastien Koert phps...@gmail.com
 wrote:
 
 
  On Thu, Dec 11, 2008 at 10:15 AM, Eric Butera eric.but...@gmail.com
 wrote:
 
  On Thu, Dec 11, 2008 at 9:56 AM, Terion Miller
  wrote:
   Hey Everyone, I am wondering if using a framework such as one of
 these
   may
   make my life easier, which do any of you use and what has been
 your
   experience with the learning curve of them?
   I just put Cake on my local server, basically I want to know which
 is
   easiest? LOL...
  
 
  Define easiest.  What is it that you need to code?  If you mean
 cookie
  cutter sites that have been done a million times with minimal
  flexibility... :)  I'm in the same boat as you though.  I don't know
  which one meets the needs I have the best.  There's stuff like cake
  which is really easy to start up, then there's stuff like symphony
  that will let you do anything, but you really have to work at it.
 
  There are definite learning curves when picking these up.
 
  symfony and ZF have the largest because they either do more (symfony)
 or are
  designed to be used piecemeal (ZF)
 
  CodeIgnitor is one of the easiest ones to start using with Cake not
 far
 
 One huge part of this that I didn't mention before is the community
 around the frameworks too.  Do they have good docs, examples, stuff
 like that.  Can you ask questions and get quality answers?

I see people talk about the same handful of frameworks every time this question 
comes up. Has anyone used one of the underdog frameworks that are sprouting up 
at the fringes?

PRADO?
Yii?
Simple PHP Framework?
Akelos (Ruby on Rails port)?
Seagull?
BlueShoes?
EvoCore?
PHOCOA?
Zoop?
Stratos?
Picora?
SOLAR?
FLOW3?
Maintainable?
Adventure-Framework?
...the list goes on.

I thought Yii [1] seemed interesting, at the least.

1. http://www.yiiframework.com


// Todd


RE: Re: [PHP] file_exists and wildcard/regex

2008-12-10 Thread Boyd, Todd M.
 -Original Message-
 From: Per Jessen [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, December 10, 2008 1:43 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] file_exists and wildcard/regex
 
 Ashley Sheridan wrote:
 
  If you're on a Linux system, you could look at ls and the regular
  expressions it lets you use with it. You could exec out and get the
  returned results. Also, as it's a system call, it should be very
  speedy.
 
 'ls' is just a plain binary (/bin/ls), not a system call.  The regex
 functionality is part of the shell, usually bash.

I think the fact that you have to exec() in order to perform it disqualifies it 
from being a system call.

Ash - a system call is a mechanism for software to request a particular kernel 
service. There's a somewhat-outdated list from Linux kernel 2.2 at [1]. You 
might be able to get crafty with sys_*stat, but I wouldn't recommend it. ;)

FWIW, I would probably do the file search like this (UNTESTED):

?php

$filereg = '/bfile[1-9]?\d+\.txt/i';
$pathstr = '/whatever/your/path/is';

if(is_dir($pathstr)) {
if($dir = opendir($pathstr)) {
$found = false;

while(($file = readdir($dir)) !== false  !$found) {
if(preg_match($filereg, $file)  0) {
echo $file . 'br /';
$found = true;
}
}

closedir($dir);
}
}

?

If you want back more than the first match, do away with the $found -related 
stuff.

1. http://docs.cs.up.ac.za/programming/asm/derick_tut/syscalls.html

HTH,


// Todd


RE: Re: [PHP] file_exists and wildcard/regex

2008-12-10 Thread Boyd, Todd M.
 -Original Message-
 From: Boyd, Todd M. [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, December 10, 2008 8:28 AM
 To: php-general@lists.php.net
 Subject: RE: Re: [PHP] file_exists and wildcard/regex
 
 FWIW, I would probably do the file search like this (UNTESTED):
 
 ?php
 
 $filereg = '/bfile[1-9]?\d+\.txt/i';

Erp. I meant '/bfile[1-9]?\d\.txt/i', with no '+' after the '\d'... assuming 
you want 0-99 to be the range of values.

 $pathstr = '/whatever/your/path/is';
 
 if(is_dir($pathstr)) {
   if($dir = opendir($pathstr)) {
   $found = false;
 
   while(($file = readdir($dir)) !== false  !$found) {
   if(preg_match($filereg, $file)  0) {
   echo $file . 'br /';
   $found = true;
   }
   }
 
   closedir($dir);
   }
 }
 
 ?


// Todd


RE: [PHP] how to not show login info in the url ...what am I looking for?

2008-12-10 Thread Boyd, Todd M.
 -Original Message-
 From: APseudoUtopia [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, December 10, 2008 9:12 AM
 To: tedd
 Cc: [EMAIL PROTECTED]; PHP General
 Subject: Re: [PHP] how to not show login info in the url ...what am I
 looking for?
 
 On Wed, Dec 10, 2008 at 10:03 AM, tedd [EMAIL PROTECTED] wrote:
  At 9:52 PM + 12/9/08, Ashley Sheridan wrote:
 
  You shouldn't be passing info like that over the URL; use sessions
  instead.
 
  I saw a shopping cart system once that passed the price of items
 over
  the URL, and when I found out and alerted them, we won the contract
 for
  a rebuild and then got accused of hacking by their previous web guys
  (who incidentally built the system!)
 
  Ash:
 
  Even if you did hack the site, all that means is that site was hack-
 able and
  thus should have been fixed anyway.
 
  In my mind, hacking a site (without doing damage) is a good
 introduction to
  a client.
 
 *Ahem*You mean 'cracking'? :-P

IMHO...

Cracking: breaking encryption/obfuscation methods in order to gain unauthorized 
access to information. I cracked the admin's password using a brute force 
algorithm.

Hacking: circumvent or leverage security flaws in order to gain unauthorized 
access to information. For example - I hacked into the Gibson by re-routing 
their logon routine. (No, that doesn't make any sense. Maybe it's straight out 
of the movie Hackers.)

I realize that people have been using cracker as a malicious form of 
hacker, and that a hacker is not malicious; but that is stupid. Cracking 
started out dealing with cryptography in my experience, and that's how I will 
continue to identify it.

Think about it--people were safe crackers (discovering the combination to 
safety deposit boxes) before there were computers in existence.

My 2c,


// Todd


RE: [PHP] converting a vid with ffmpeg - howto do progress bars?

2008-12-10 Thread Boyd, Todd M.
 -Original Message-
 From: Rene Veerman [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, December 10, 2008 3:47 PM
 To: [EMAIL PROTECTED]
 Cc: php php
 Subject: Re: [PHP] converting a vid with ffmpeg - howto do progress
 bars?
 
 I call it from php with exec() atm.
 
 just running the ffmpeg command shows some details and then a sort of
 continually updated status report;
 
 Input #0, avi, from

'/home/rene/web/LIVE_WEBSITES/www/veerman.name/mediaBeez_content/media/
 upload/20081210
 220610/work/original/xy.avi':
   Duration: 00:43:03.3, start: 0.00, bitrate: 1137 kb/s
   Stream #0.0: Video: mpeg4, yuv420p, 624x352, 23.98 fps(r)
   Stream #0.1: Audio: mp3, 48000 Hz, stereo, 112 kb/s
 Output #0, flv, to

'/home/rene/web/LIVE_WEBSITES/www/veerman.name/mediaBeez_content/media/
 upload/20081210
 220610/work/highres/t.flv':
   Stream #0.0: Video: flv, yuv420p, 624x352, q=2-31, 999 kb/s, 23.98
 fps(c)
   Stream #0.1: Audio: mp3, 22050 Hz, stereo, 0 kb/s
 Stream mapping:
   Stream #0.0 - #0.0
   Stream #0.1 - #0.1
 Press [q] to stop encoding
 frame= 1031 fps= 21 q=2.6 size=5752kB time=43.0
 bitrate=1095.8kbits/s
 
 (the last line continually updates)
 
 
 since it doesnt print the number of input frames, i can't calculate
 progress from frame-count in the last line.
 not even when i put ffmpeg -v verbose, do i get the frame count..
 
 
 
 Ashley Sheridan wrote:
  On Wed, 2008-12-10 at 22:13 +0100, Rene Veerman wrote:
 
  Hi, i got ffmpeg to convert videos for my CMS to Flash-video.
  With debian, it was real easy to set up.
 
  The only drawback is that if i can't advance the progressbar during
 the
  call to ffmpeg..
  If i encode longer videos, it can take up to an hour each, and to
 halt
  the progressbar for that long is just bad imo.
 
  Any ideas on how to read what ffmpeg is up to?
 
 
 
 
  First, what does running just the ffmpeg command do (without getting
 PHP
  involved) ? Is there any information you see which it gives as a
  prediction of how long the transcode will take? Also, how are you
  running the command? When I do my transcodes I tend to do it in the
  background, as this will then continue should the user break the
  connection, and avoids timeout issues.

Top posting BAD! Hulk SMASH!

Anyway, moving on...

I believe ffmpeg -i filename.ext should give you frame count
information (along with a bunch of other stuff). It will have to be
parsed, of course, but... meh. Also--were you aware that there is an
ffmpeg PHP extension? It's even got a nifty instance-frameCount member!
:)

So, use ffmpeg to check on its current frame number, and ffmpeg -i
filename.ext to find out how many there are in total. As Ashley
already stated, it won't be completely accurate--but the bar will move a
heck of a lot more often/accurately than if you only bump it each time a
file is finished transcoding.

HTH,


// Todd

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



RE: [PHP] error messaages - $DOXPath Wrong

2008-12-05 Thread Boyd, Todd M.
 -Original Message-
 From: Maciek Sokolewicz [mailto:[EMAIL PROTECTED]
 Sent: Friday, December 05, 2008 2:07 AM
 To: php-general@lists.php.net; [EMAIL PROTECTED]
 Subject: Re: [PHP] error messaages - $DOXPath Wrong
 
 ddg2sailor wrote:
  Hi
 
  Here are the error messages:
 
  Warning: move_uploaded_file(C: mpp\htdocs\dox/th_dsc_076.jpg)
  [function.move-uploaded-file]: failed to open stream: Invalid
 argument in
  C:\xampp\htdocs\dox.php on line 40
 
  Warning: move_uploaded_file() [function.move-uploaded-file]: Unable
 to move
  'C:\xampp\tmp\php2F.tmp' to 'C: mpp\htdocs\dox/th_dsc_076.jpg' in
  C:\xampp\htdocs\dox.php on line 40
 
  Warning: Cannot modify header information - headers already sent by
 (output
  started at C:\xampp\htdocs\dox.php:40) in
  C:\xampp\htdocs\include\bittorrent.php on line 478
 
  Il make this as painless as possiable I know the third error can
 be
  caused by a dangling white space.. this time it isnt.
 
  This happens when a user uploads a 'dox file. Now we can download
 them all
  we want.
  The file Uploads to the right dir : 'C:\xampp\tmp\php2F.tmp'
  But when It tries to copy.. it tries to copy from this dir: C:
  mpp\htdocs\dox/th_dsc_076.jpg
  And tries to copy to this dir : 'C: mpp\htdocs\dox/th_dsc_076.jpg'
 
  the correct dirs are c:\xampp\tmp and c:\xampp\dox
 
  //code that kicked my butt
 
  ?
  require include/bittorrent.php;
 
  dbconn(false);
 
  loggedinorreturn();
 
  if (get_user_class()  UC_USER)
  stderr(Error , Permission denied.);
 
  if ($_SERVER[REQUEST_METHOD] == POST)
  {
 
  $file = $_FILES['file'];
 
  if (!$file || $file[size] == 0 || $file[name] == )
  stderr(Error, Nothing received! The selected file may have been
 too
  large. );
 
  if (file_exists($DOXPATH/$file[name]))
  stderr(Error, A file with the name
 .htmlspecialchars($file['name']).
  already exists! );
 
  $title = trim($_POST[title]);
  if ($title == )
  {
  $title = substr($file[name], 0, strrpos($file[name], .));
  if (!$title)
  $title = $file[name];
  }
 
  $r = mysql_query(SELECT id FROM dox WHERE title= . sqlesc($title))
 or
  sqlesc();
  if (mysql_num_rows($r)  0)
  stderr(Error, A file with the title ,
 .htmlspecialchars($title).
  already exists!);
 
  $url = $_POST[url];
 
  if ($url != )
  if (substr($url, 0, 7) != http://;  substr($url, 0, 6) !=
 ftp://;)
  stderr(Error, The URL ,  . htmlspecialchars($url) .  does not
 seem to
  be valid.);
 
  if (!move_uploaded_file($file[tmp_name], $DOXPATH/$file[name]))
  stderr(Error, Failed to move uploaded file. You should contact an
  administrator about this error.);
   [SNIP]
 
 
  Sorry its so long But this thing has me beat. I was trying to
 cross it
  with this line from another piece of code that does it fact know the
 right
  dir with no luck:
 
  //working code
 
  $file = $DOXPATH/$arr[filename];
 
  //end
 
  Maybe its apples and oranges
 
 Ok, first of all, stop pasting entire pages of code in here when they
 have absolutely nothing to do with the problem. An error on line x
 almost *NEVER* has anything to do with *anything* on page  41. So,
 just... don't.
 
 Next: Unable to move
 'C:\xampp\tmp\php2F.tmp' to 'C: mpp\htdocs\dox/th_dsc_076.jpg'
 actually
 tells you what's going wrong:
 1. It can't move the file from an existing place to a place with a
path
 that is invalid. C: mpp\ is an invalid path on windows. Of course
you
 didn't include the definition of $DOXPath for us, but I bet it looks
 like:
 $DOXPath = C:\xampp\htdocs\dox;
 Now, you're using double quotes here (for no good reason), which means
 it interprets all escape sequences. What do we do? In the PHP docs
 lookup escape sequences:

http://www.php.net/manual/en/language.types.string.php#language.types.s
 tring.syntax.double
 
 Note that:
 \x[0-9A-Fa-f]{1,2} the sequence of characters matching the
 regular
 expression is a character in hexadecimal notation
 You have an expression which is basically the same as:
 'C:'.\xa.'ampp\htdocs\dox'; where the first and last part work as
you
 intended, but the second one gets replaced by the char with ordinal 10
 (which is a space. A in hexadecimal notation is 10 in decimal).
 
 Fix your definition of it (ie. use SINGLE quotes, or double escape it
 to
 look like \\xa so the interpreter won't see it as a special escape
 sequence anymore.

Lots of good points there. I think it's also worth mentioning that
mixing back slashes in file paths with forward slashes is a terrible,
terrible idea. Pick one and stick with it. To be honest, I'm not even
sure Windows-branded PHP is capable of dissecting a local file system
address when it uses forward slashes.

So.. yes, the \xa is being turned into hexadecimal garbage... but if you
continue to have errors after replacing it with \\xa (and doubling up
all of the other back slashes in your paths), try:

C:\\xampp\\htdocs\\dox\\th_dsc_076.jpg

Instead of

C:\\xampp\\htdocs\\dox/th_dsc_076.jpg

HTH,


// Todd

--
PHP General Mailing List (http://www.php.net

[PHP] How to fetch .DOC or .DOCX file in php

2008-12-05 Thread Boyd, Todd M.
 -Original Message-
 From: Andrew Ballard [mailto:[EMAIL PROTECTED]
 Sent: Friday, December 05, 2008 9:11 AM
 To: Jim Lucas
 Cc: Shawn McKenzie; php-general@lists.php.net
 Subject: Re: [PHP] How to fetch .DOC or .DOCX file in php
 
 On Thu, Dec 4, 2008 at 10:35 PM, Jim Lucas [EMAIL PROTECTED] wrote:
  I was going to say that I haven't yet decided on what the final
 output format is going to be.  Probably either rtf or OpenXML.
 
  How about I ask for suggestions on what would be the best format to
 store the final copy.
 
  I figured that this tool would mainly be used for .doc to web
 conversion, but I guess it could be used to also convert to other
 document formats too.
 
  But, I would like to have the ability to at least store the formating
 inline with the text.  So, either some form of xml.  Be it (x)HTML or
 plain XML
  or even OpenXML.
 
  A question to all then.  How would you like to see the text, with
 formating, stored?
 
 It's an excellent start. It pulled in some additional control
 characters in some of the documents I tried, and some documents had
 extra stuff at the end of the document. It was still text, but it
 looked like the text from the page header/footer definitions. It would
 be cool to see this polished and released. I just wish there was
 something this basic that worked this well on PDF files! :-)

Andrew,

There's something to be said about inter-language operability. I've become 
enamored with the iText package for manipulating, creating, and extracting PDF 
documents and associated info/bookmarks/tags/etc. There was, for a time, an 
OpenSource PDF editor built with JPedal/iText that looked like it would soon 
compete with Acrobat for PDF fillable forms; but the author has little time to 
play with it.

Anyway, you can setup a Java program (yes, iText is Java) to extract the text 
from the fields--or entire document--and spit it out however you format it 
(text, XML, whatev).

iText - http://www.lowagie.com/iText/ 
PHP/Java bridge - http://php-java-bridge.sourceforge.net/pjb/

HTH,


// Todd


[PHP] PEAR Help

2008-12-05 Thread Jason Todd Slack-Moehrle

Hi All,

I installed PEAR fine.

How I need to install OLE and Spreadsheet_Excel_Writer and I dont see  
how


pear install .

fails every time with channel errors and not found errors.

I have downloaded the .tgz files, but I dont know where to put the  
contents.


Any thoughts?

-Jason




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



[PHP] File Uploads Help!!!

2008-12-05 Thread Jason Todd Slack-Moehrle

Hi All,

I am uploading a file and it says it worked, but I dont see it in the  
directory


Here is my code so far:

$allowed_ext = array('csv','xls');
$ext = end(explode('.',$_FILES['uploadedfile']['name']));
$ran2 = rand()..;
$target = tempUploads/;
$target = $target . $ran2.$ext;

if($_FILES['uploadedfile']['size']  200){
$message = 'File over 2MB';
echo $message;
exit;
}

if($message == NULL  !in_array($ext,$allowed_ext)){
$message = 'File extension not allowed'.' extension is:'.$ext;
echo $message;
exit;
}

if($message == NULL) {
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], 
$target))
{
$message = Uploaded The File.;
echo $message;

// upload was successful, now lets work with it
include '_functions.inc'; // Utility Functions

			include '_fileHeaders.inc'; // CSV File Headers that we expect, in  
the proper order


include '_fileParse.inc'; // CSV File Parsing
}
else
{
$message = Sorry, there was a problem uploading your 
file.;
echo $message;
}
}

How can I verify it is there? I ftp in and I dont see it.

-Jason


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



Re: [PHP] File Uploads Help!!! --Forgot

2008-12-05 Thread Jason Todd Slack-Moehrle

Here is the output I am printing:

'tempUploads/1425182872.xlsUploaded The File.'

What is the issue?

-Jason


On Dec 5, 2008, at 2:11 PM, Jason Todd Slack-Moehrle wrote:


Hi All,

I am uploading a file and it says it worked, but I dont see it in  
the directory


Here is my code so far:

$allowed_ext = array('csv','xls');
$ext = end(explode('.',$_FILES['uploadedfile']['name']));
$ran2 = rand()..;
$target = tempUploads/;
$target = $target . $ran2.$ext;

if($_FILES['uploadedfile']['size']  200){
$message = 'File over 2MB';
echo $message;
exit;
}

if($message == NULL  !in_array($ext,$allowed_ext)){
$message = 'File extension not allowed'.' extension is:'.$ext;
echo $message;
exit;
}

if($message == NULL) {
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], 
$target))
{
$message = Uploaded The File.;
echo $message;

// upload was successful, now lets work with it
include '_functions.inc'; // Utility Functions

			include '_fileHeaders.inc'; // CSV File Headers that we expect,  
in the proper order


include '_fileParse.inc'; // CSV File Parsing
}
else
{
$message = Sorry, there was a problem uploading your 
file.;
echo $message;
}
}

How can I verify it is there? I ftp in and I dont see it.

-Jason


--
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



Re: [PHP] File Uploads Help!!! --Forgot

2008-12-05 Thread Jason Todd Slack-Moehrle

Hi Eric,



'tempUploads/1425182872.xlsUploaded The File.'


http://us2.php.net/manual/en/function.is-uploaded-file.php
http://us2.php.net/manual/en/features.file-upload.errors.php


So do I still use move_uploaded_file?

-Jason

Re: [PHP] File Uploads Help!!! --Forgot

2008-12-05 Thread Jason Todd Slack-Moehrle

Hi Eric,


So do I still use move_uploaded_file?



Absolutely.  I just didn't see anywhere in your code where you were
checking for an error with the file upload itself or that it did exist
on the server before moving it.


Got it, thanks!!

-Jason

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



[PHP] Parsing Strings

2008-12-05 Thread Jason Todd Slack-Moehrle

OK, making good learning progress today.

I have a string that is: Jason Slack

and I want it broken at the space so i get Jason and then Slack

I am looking at parse_str, but I dont get how to do it with a space.  
The example is using []=.


Then I want to assign like:

$fname = Jason;
$lname = Slack;

Any ideas?

-Jason

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



Re: [PHP] Parsing Strings

2008-12-05 Thread Jason Todd Slack-Moehrle


How might I also parse and address like: SCOTTSDALE, AZ 85254

It has a comma and a space

-Jason

On Dec 5, 2008, at 4:02 PM, Jason Todd Slack-Moehrle wrote:


OK, making good learning progress today.

I have a string that is: Jason Slack

and I want it broken at the space so i get Jason and then Slack

I am looking at parse_str, but I dont get how to do it with a space.  
The example is using []=.


Then I want to assign like:

$fname = Jason;
$lname = Slack;

Any ideas?

-Jason

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





Re: AW: [PHP] Parsing Strings

2008-12-05 Thread Jason Todd Slack-Moehrle


Konrad,

On Dec 5, 2008, at 4:22 PM, Konrad Priemer wrote:


$array = explode( , Jason Slack);


Awesome, thanks, yup that does it.

Can you explain how to do an address now into City, State, Zip

Like: cortland, ny 13045

It has a comma and a space!

-Jason


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



Re: AW: [PHP] Parsing Strings

2008-12-05 Thread Jason Todd Slack-Moehrle

Conny,


Can you explain how to do an address now into City, State, Zip
Like: cortland, ny 13045



$string = cortland, ny 13045;
$search = array(, , ,);
$replace = array( ,  );
$newString = str_replace($search, $replace, $string);
$array = explode( , $newString);


Ah ha! Nice that makes sense, why did I not think of that!

-Jason

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



RE: [PHP] How to fetch .DOC or .DOCX file in php

2008-12-04 Thread Boyd, Todd M.
 -Original Message-
 From: Jagdeep Singh [mailto:[EMAIL PROTECTED]
 Sent: Thursday, December 04, 2008 8:39 AM
 To: php-general@lists.php.net
 Subject: [PHP] How to fetch .DOC or .DOCX file in php
 Importance: Low
 
 Hi !
 
 I want to fetch text from .doc / .docx file and save it into database
 file.
 But when  I tried to fetch text with fopen/fgets etc ... It gave me
 special
 characters with text.
 
 (With .txt files everything is fine)
 Only problem is with doc/docx files.
 I dont know whow to remove SPECIAL CHARACTERS from this text ...

A.) This has been handled on this list several times. Please search the
archives before posting a question.
B.) Did you even TRY to Google for this? In the first 5 matches for php
open ms word I found this:

http://www.developertutorials.com/blog/php/extracting-text-from-word-doc
uments-via-php-and-com-81/

You will need an MS Windows machine for this solution to work. If you're
using *nix... well... good luck.


// Todd

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



RE: [PHP] Last working day of a month

2008-12-04 Thread Boyd, Todd M.
 -Original Message-
 From: Andrew Ballard [mailto:[EMAIL PROTECTED]
 Sent: Thursday, December 04, 2008 8:32 AM
 To: Angelo Zanetti
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Last working day of a month
 Importance: Low
 
 On Thu, Dec 4, 2008 at 9:03 AM, Angelo Zanetti [EMAIL PROTECTED]
 wrote:
  Hi all,
 
  I am busy trying to figure out how to get the last working day in a
 month.
 
  I was wondering if there was a script already written, but this is
 what I
  imagine should work:
 
  Get the current day and see if it's the last day of the month. If its
 true
  check if it's a Saturday or Sunday if it's either of those 2 days
 then
  return false else return true?
 
  I also need to take public holidays into account. What would be the
 best
  solution for that? Store the public holidays in a table and check if
 the
  current day isn't a public holiday?
 
 
 If your application is already using a database, I would use a date
 table rather than a holiday table. You can add columns to indicate
 whether each date is a workday, weekday, weekend, holiday, or any
 other date category/group that you need to track.

That seems like a waste of space and database calls to me. (Yes, I know space 
is cheap... but it should at least be thought about briefly. Using that space 
costs cycles, etc.) Since the exceptions to his rule are so few in comparison 
to the days that follow, I think documenting the exceptions and assuming it's a 
workday if it's not an exception makes more sense (IMHO).

I'd probably store all holidays in a table and assume that Saturdays/Sundays 
are not workdays unless they have a corresponding entry in the same table that 
holds the holidays. Call the table exceptions. The exception to a workday is 
a holiday. The exception to a weekend is a workday. :)

HTH,


// Todd


RE: [PHP] IE8 and HTML5

2008-12-04 Thread Boyd, Todd M.
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
 Behalf Of Richard Heyes
 Sent: Thursday, December 04, 2008 11:10 AM
 To: Bastien Koert
 Cc: Jay Moore; php-general@lists.php.net
 Subject: Re: [PHP] IE8 and HTML5
 
  I have less issues
  with Chrome and its beta
 
 Not thrashing my HDD is also kinda basic, but Chrome 0.2 was more than
 happy to do that.

http://www.srware.net/en/software_srware_iron.php

Iron: Chromium source re-worked for efficiency and privacy. Not sure if
it will solve your thrashing issue, but then again... I'm not sure how
or why a browser would cause your HDD to thrash in the first place. Got
a lot of questionable videos open in several tabs, eh? ;) I've had
Firefox thrash sometimes when it's loading lots of Applets and Flash
objects, etc., though, so I guess I can understand.

(And don't get me wrong--I had tons of problems with Chrome; mostly
about crashing unexpectedly.)


// Todd

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



RE: [PHP] IE8 and HTML5

2008-12-04 Thread Boyd, Todd M.
 -Original Message-
 From: Benjamin Hawkes-Lewis [mailto:[EMAIL PROTECTED]
 Sent: Thursday, December 04, 2008 4:15 PM
 To: Richard Heyes
 Cc: php List
 Subject: Re: [PHP] IE8 and HTML5
 
 Richard Heyes wrote:
  From a recent IEBlog post:
 
  http://blogs.msdn.com/ie/archive/2008/12/03/compatibility-view-
 improvements-to-come-in-ie8.aspx
 
  ...and our start on HTML5 support.
 
  Does this mean canvas support?
 
 Not in IE8.
 
 http://blogs.msdn.com/ie/archive/2008/11/19/ie8-what-s-after-beta-
 2.aspx#9129600
 
 Everyone has their favorite unstandardized feature they'd love IE to
 support. (Personally I'd be delighted by -ms-border-radius and
 content:uri() support.)
 
 Experimental support for Canvas and other unstandardized features
might
 be a good thing; I know the spec editors would welcome implementor
 feedback. It would be a shame, however, if we were locked into a
 technically poor solution thanks to the most popular browser
 implementing an early version of the specification, websites beginning
 to rely on that behaviour, and subsequent versions of the
specification
 being forced to mandate such behaviour. I haven't used Canvas much,
but
 it seems to me there a lot of areas of Canvas where there's room for
 further evolution, e.g. proper text width calculations? an accessible
 Canvas example? what about 3D?
 
  Is it as a direct result of Chrome
  being released and MS realising (finally) they are going to have to
  remain competitive?
 
 Given Chrome's poor rate of take-up and tendency to canibalize the
 userbases of non-MS browsers, I somewhat doubt it.
 
 http://blog.statcounter.com/2008/09/chrome-whos-losing/
 
 Regardless of Chrome's technical merits, it seems to me that it's
 Firefox's growing userbase, tailed by the other popular browsers in
 some
 markets, that has long represented the market challenge to IE.
 
 http://www.upsdell.com/BrowserNews/stat.htm
 
 Could be I'm underestimating the effects of press hype about chrome on
 MS's strategy, but I think actually Microsoft's turn towards a
stronger
 emphasis on standards support long preceded the release of Chrome. For
 example:
 
 http://blogs.msdn.com/ie/archive/2008/03/03/microsoft-s-
 interoperability-principles-and-ie8.aspx
 
 Given that IE8 was already in beta when Chrome was released, standard
 support in IE8 is mostly a product of decisions taken before that
time.

Well, as far as canvas / in IE, you can fake it with Javascript:

http://me.eae.net/archive/2005/12/29/canvas-in-ie/

Yes, this is another patchwork circumvention routine to drag IE, kicking
and screaming, into the world of web browsing that exists outside of
Quirks Mode... but it works.

HTH,


// Todd

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



RE: [PHP] HTMLEntities as NUMERIC for XML

2008-11-25 Thread Boyd, Todd M.
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, November 25, 2008 11:28 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] HTMLEntities as NUMERIC for XML
 
 
  I came across a similar problem using an AJAX thing, with MSWord
  characters in the text. The way round the problem was to enclose
  everything inside CDATA blocks, which made the browsers happy to
  receive as the entities only had to be understood by the HTML
browser
  now, not the XML parser. As RSS is an XML format, maybe this would
 help
  you?
 
 I suspect not.
 
 The RSS+XML standard[1] seems to be quite finicky, and wrapping in
 CDATA block, from what I've read, will simply make some
 readers/aggregators decide to not carry the RSS feed at all.
 
 I have no idea if some means a handful or most however.
 
 But trying to maximize audience, I'm being conservative and using KISS
 principle until I know more.
 
 [1]
 Actually, it's 9 different incompatible standards, with no two
 published RSS standards being compatible:
 http://diveintomark.org/archives/2004/02/04/incompatible-rss
 I personally found this blog post brilliant
 YMMV

You are correct. Some feed readers will just throw everything in a
![CDATA[]] block away. It can be useful when you are the only one
reading/manipulating the XML ... but getting it into a universal code
page is the way to go if aggregators are going to be touching your
content.

My 2c,


// Todd

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



RE: [PHP] php cURL with SSL problem ??

2008-11-25 Thread Boyd, Todd M.
 -Original Message-
 From: LKSunny [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, November 25, 2008 2:32 PM
 To: php-general@lists.php.net
 Subject: [PHP] php cURL with SSL problem ??
 
 Hello,
 
 i want get https data with cURL, however just can via set
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
 
 by the moment, i need turn curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,
 true);
 i got some idea is ca certificates, however how can i do it ?
 
 this is crt file ? can not make from openssl ? if can make from
 openssl, any
 sample command ?
 and how to use ?
 
 i am using Windows (WIN32)
 apache2.2+php5

I'm not sure I entirely understand your question... but here goes:

Yes, you can make your own CRT/KEY/CER files using OpenSSL.
http://www.freebsd.org/doc/en/books/handbook/openssl.html has some
instructions.

Hope this helps,


// Todd

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



RE: [PHP] Model Web Site

2008-11-20 Thread Boyd, Todd M.
 -Original Message-
 From: Stephen [mailto:[EMAIL PROTECTED]
 Sent: Thursday, November 20, 2008 4:17 PM
 To: PHP-General
 Subject: [PHP] Model Web Site
 
 My prime hobby is photography and the next is web site building.
 
 So now I have a young model (18+) asking me about getting a web site.
 
 The idea is members can see content, that will include, photos, her
 blog
 and a discussion forum.
 
 I like the idea of building it, but it includes a lot of things I have
 no experience in.
 
 Can someone point me to documentation/tutorials/scripts or anything
 that
 might help.
 
 I don't want a turnkey solution. I want to learn how to do this.

http://www.w3schools.com/html
http://www.w3schools.com/xhtml
http://www.w3schools.com/css
http://www.w3schools.com/js 
http://www.w3schools.com/php
http://www.w3schools.com/sql
http://www.php.net
http://www.mysql.com

most important link:

http://www.google.com

Get comfortable with programming; with algorithms; with data structures;
with databases; with client-server relationships.

HTH,


// Todd

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



RE: [PHP] Re: anchor name on URL

2008-11-19 Thread Boyd, Todd M.
 -Original Message-
 From: Ashley Sheridan [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, November 18, 2008 5:09 PM
 To: Yeti
 Cc: Boyd, Todd M.; PHP General Mailing List
 Subject: Re: [PHP] Re: anchor name on URL
 
 On Tue, 2008-11-18 at 14:58 -0800, Yeti wrote:
   I look forward to the day when markup isn't so bloated
   due to the inability of certain web browser franchises to get it
 right.
 
  Although I usually look at the future through an optimistic point of
  view, that day may never come.
 
 You say that, have you heard the latest for IE9? They're already
 planning it, and apparently it's going to use the Webkit engine!

I've heard folks at Microsoft say, basically, Speed/efficiency was not
a consideration.

Ugh. Still waiting on Mozilla Minefield.


// Todd

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



RE: [PHP] Re: anchor name on URL

2008-11-19 Thread Boyd, Todd M.
 -Original Message-
 From: Ashley Sheridan [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, November 18, 2008 5:58 PM
 To: Richard Heyes
 Cc: Yeti; Boyd, Todd M.; PHP General Mailing List
 Subject: Re: [PHP] Re: anchor name on URL
 
 On Tue, 2008-11-18 at 23:51 +, Richard Heyes wrote:
   Yeah, but it will mean that there will still be about 3 different
   rendering versions of IE out there by the time it comes out; 7, 8
 and 9
   (I'm fairly sure 6 will have gone to that good ol' web in the sky
 by
   that time)
 
  Sure, but depending on how closely it follows WebKit, could make
  testing on IE9, Safari and Chrome a breeze.
 
  --
  Richard Heyes
 
  HTML5 Graphing for FF, Chrome, Opera and Safari:
  http://www.rgraph.org (Updated November 15th)
 
 Don't forget Konqueror in that list ;) It's not exactly the same
engine
 after Apple forked it from KHTML, but it's quite close, and both
 Konqueror and Safari are said to be working a little more closely than
 before to share the work done to the rendering engines since the fork.
 
 I'm waiting for the day when Firefox starts using Google's V8
scripting
 engine!

Firefox will probably go with their own improvements a la Minefield
(instead of V8). As for WebKit, I think you guys are forgetting--it's an
APPLE product. Do you seriously think they're going to let Microsoft use
it in their web browser after they've hacked it to pieces and strung it
back together into some bloated, inefficient monster?

Well... maybe if the price is right.

/shrug


// Todd

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



RE: [PHP] Invalid Arguements

2008-11-19 Thread Boyd, Todd M.
 -Original Message-
 From: Terion Miller [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, November 19, 2008 8:32 AM
 To: php-general@lists.php.net
 Subject: [PHP] Invalid Arguements
 
 I am still getting the Invalid arguement error on this implode:
 
 if (isset($_POST['BannerSize'])){$BannerSize =
 implode(',',$_POST['BannerSize']);} else {$BannerSize = ;}
 
 I have moved the ',', from the beginning to the end of the statement
 and
 nothing works is there any other way to do this, basically there is a
 form
 and the people entering work orders can select different sized banners
 they
 need, which goes into the db as text so...argh...

Take the time to read what people have suggested. I seem to remember
people asking you if you had run is_array() on your so-called array.
Well, if you didn't, and it's NOT an array, and therefore will NOT work
with implode(), then feel free to facepalm ahead of time.


// Todd

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



RE: [PHP] HTTP Authentication

2008-11-19 Thread Boyd, Todd M.
 -Original Message-
 From: Craige Leeder [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, November 19, 2008 8:35 AM
 To: Thiago H. Pojda
 Cc: PHP-General List
 Subject: Re: [PHP] HTTP Authentication
 
 Thiago H. Pojda wrote:
  Guys,
 
  I have to access a WS that uses HTTP auth directly with PHP.
 
  I've tried using the usual http://user:[EMAIL PROTECTED]/ but I
couldn't
 get it
  working. I believe it has something to do with the password
 containing a #
  (can't change it) and the browser thinks it's an achor or something.
 
  All I've seen were scripts to implement HTTP Auth in PHP, nothing
 about
  actually logging in with PHP.
 
  Is it possible to send the authentication headers the first time I
 access
  the link? I could send all necessary headers to the page I'm trying
 to
  access and retrieve it's content at once.
 
 
  Thanks,
 
 
 
 Why don't you let yourself in regardless of the credentials and print
 them out to make sure they're being evaluated as you expect.

Well... he said he needs to access a WS, not that he administrates it or
has any control over the authentication, etc.

As for the Basic Authentication, I believe you can send the
authentication info in the headers (instead of the URL). If you have
problems implementing that in straight PHP, perhaps cURL could be of
some assistance.

http://www.httprevealer.com/article_basic_authentication.htm - this
outlines the header formats, etc... just remember--you will need to
Base64 encode username:password for the Authorization header.

HTH,


// Todd

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



RE: [PHP] Invalid Arguements

2008-11-19 Thread Boyd, Todd M.
Taking this back on-list...


From: Terion Miller [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 19, 2008 8:44 AM
To: Boyd, Todd M.
Subject: Re: [PHP] Invalid Arguements

I don't know how to run is_array this is the problem I'm a designer that
is stuck doing a coders job 


On Wed, Nov 19, 2008 at 8:36 AM, Boyd, Todd M. [EMAIL PROTECTED] wrote:
 -Original Message-
 From: Terion Miller [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, November 19, 2008 8:32 AM
 To: php-general@lists.php.net
 Subject: [PHP] Invalid Arguements

 I am still getting the Invalid arguement error on this implode:

 if (isset($_POST['BannerSize'])){$BannerSize =
 implode(',',$_POST['BannerSize']);} else {$BannerSize = ;}

 I have moved the ',', from the beginning to the end of the statement
 and
 nothing works is there any other way to do this, basically there is a
 form
 and the people entering work orders can select different sized banners
 they
 need, which goes into the db as text so...argh...

Take the time to read what people have suggested. I seem to remember
people asking you if you had run is_array() on your so-called array.
Well, if you didn't, and it's NOT an array, and therefore will NOT work
with implode(), then feel free to facepalm ahead of time.

---

?php
if(is_array($myvar)) {
$newvar = implode(',', $myvar);
} else {
echo 'Cats and dogs living together! Mass hysteria!';
}
?

I believe something to that effect was posted, with fully intact code,
on the list. Not to be rude, but if you're tasked with PHP programming
and you don't understand what it is to run a function, you should
probably bone up on procedural fundamentals and PHP in general before
you go much further... or you're going to SERIOUSLY screw something up
and be at a loss as to what you did (or how to fix it). Again--I'm not
trying to be rude. I am giving honest advice.

http://www.w3schools.com/php 

Hope this helps (sincerely),


// Todd

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



RE: [PHP] Stats (was anchor name on URL)

2008-11-19 Thread Boyd, Todd M.
 -Original Message-
 From: Yeti [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, November 19, 2008 9:09 AM
 To: PHP General Mailing List
 Subject: Re: [PHP] Stats (was anchor name on URL)
 
 I think it's also interesting to know what browsers web developers
 prefer [1].
 
 Also what people would like to know more about [2].
 Number 1: howto kiss
 Number 5: howto hack (lol?)
 
 [1] http://www.w3schools.com/browsers/browsers_stats.asp
 [2] http://www.google.com/intl/en/press/zeitgeist2007/mind.html

who is god ??!

I'm beginning to think people put a bit too much faith (no pun
intended) in Google. Ugh.


// Todd

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



RE: [PHP] Invalid Arguements

2008-11-19 Thread Boyd, Todd M.
From: Terion Miller [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 19, 2008 9:39 AM
To: Boyd, Todd M.
Cc: PHP General Mailing List
Subject: Re: [PHP] Invalid Arguements

I've been trying to catch on to php on the fly, I started with Cold fusion 
years ago then did asp for a long time, for some reason php gives me problems, 
it doesn't at all seem intuitive to me or even logical for that matterguess 
I'm just used to the easy stuff.

when I use the var_dump as suggested I get: 
Parse error: syntax error, unexpected '' in 
C:\Inetpub\wwwroot\WorkOrderSystem\WorkOrder.php on line 136

On Wed, Nov 19, 2008 at 8:51 AM, Boyd, Todd M. [EMAIL PROTECTED] wrote:
Taking this back on-list...


From: Terion Miller [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 19, 2008 8:44 AM
To: Boyd, Todd M.
Subject: Re: [PHP] Invalid Arguements

I don't know how to run is_array this is the problem I'm a designer that
is stuck doing a coders job


On Wed, Nov 19, 2008 at 8:36 AM, Boyd, Todd M. [EMAIL PROTECTED] wrote:
 -Original Message-
 From: Terion Miller [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, November 19, 2008 8:32 AM
 To: php-general@lists.php.net
 Subject: [PHP] Invalid Arguements

 I am still getting the Invalid arguement error on this implode:

 if (isset($_POST['BannerSize'])){$BannerSize =
 implode(',',$_POST['BannerSize']);} else {$BannerSize = ;}

 I have moved the ',', from the beginning to the end of the statement
 and
 nothing works is there any other way to do this, basically there is a
 form
 and the people entering work orders can select different sized banners
 they
 need, which goes into the db as text so...argh...

Take the time to read what people have suggested. I seem to remember
people asking you if you had run is_array() on your so-called array.
Well, if you didn't, and it's NOT an array, and therefore will NOT work
with implode(), then feel free to facepalm ahead of time.
---

?php
       if(is_array($myvar)) {
               $newvar = implode(',', $myvar);
       } else {
               echo 'Cats and dogs living together! Mass hysteria!';
       }
?

I believe something to that effect was posted, with fully intact code,
on the list. Not to be rude, but if you're tasked with PHP programming
and you don't understand what it is to run a function, you should
probably bone up on procedural fundamentals and PHP in general before
you go much further... or you're going to SERIOUSLY screw something up
and be at a loss as to what you did (or how to fix it). Again--I'm not
trying to be rude. I am giving honest advice.

http://www.w3schools.com/php

---

Bottom posting will prevail, damnit! :D

As for your error, it is generally good list etiquette (and will help you, as 
well!) to post THE ACTUAL CODE that threw the error instead of here's my error 
message and what line it happened on. We don't know the code on that line in 
question. We don't know the context (code surrounding it). As such, it is very 
difficult to derive anything whatsoever from your error message.

Details!

Also--if you're versed in Classic ASP, is PHP seriously all that different? 
Their function declarations and usage, opening/closing delimiters (% and ?), 
etc. are all incredibly similar... anyway, I digress.

It looks like you probably forgot to put something inside quotation marks, or 
some of your mark-up bled through into your code. Hard to tell, as I said, with 
just the error message.


// Todd

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



RE: [PHP] HTTP Authentication [ SOLVED ]

2008-11-19 Thread Boyd, Todd M.
 -Original Message-
 From: Thiago H. Pojda [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, November 19, 2008 11:47 AM
 To: Andrew Ballard
 Cc: PHP-General List
 Subject: Re: [PHP] HTTP Authentication [ SOLVED ]
 
 On Wed, Nov 19, 2008 at 12:15 PM, Andrew Ballard [EMAIL PROTECTED]
 wrote:
 
  On Wed, Nov 19, 2008 at 9:26 AM, Thiago H. Pojda
 [EMAIL PROTECTED]
  wrote:
   Guys,
  
   I have to access a WS that uses HTTP auth directly with PHP.
  
   I've tried using the usual http://user:[EMAIL PROTECTED]/ but I
 couldn't
  get it
   working. I believe it has something to do with the password
 containing a
  #
   (can't change it) and the browser thinks it's an achor or
 something.
  
   All I've seen were scripts to implement HTTP Auth in PHP, nothing
 about
   actually logging in with PHP.
  
   Is it possible to send the authentication headers the first time I
 access
   the link? I could send all necessary headers to the page I'm
trying
 to
   access and retrieve it's content at once.
  
  
   Thanks,
   --
   Thiago Henrique Pojda
  
 
  You're passing the username and password as part of a URL, so
  shouldn't the username and password be urlencoded? I'm thinking it
  will work if you replace the '#' sign with %23.
 
  Andrew
 
 
 I only tried thworing urlencode on everything, which obviously didn't
 work.
 
 Both ways worked, using %23 for '#' and the snippet from Nathan.
 
 
 Thanks a lot everyone, I was about to build all the headers and stuff
 :P

All the headers, meaning 2? :) Glad to hear you've solved your
problem, anyway..


// Todd

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



  1   2   3   4   5   6   7   8   >