OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
php-general Digest 25 May 2007 22:25:35 -0000 Issue 4811

php-general-digest-helplists.php.net
Date: Fri May 25 2007 - 17:25:35 CDT


php-general Digest 25 May 2007 22:25:35 -0000 Issue 4811

Topics (messages 255620 through 255670):

Re: help with multi dimensional arrays
        255620 by: Jared Farrish

Re: Protecting MySQL Injection from PHP form
        255621 by: Jochem Maas
        255622 by: Jason Pruim
        255639 by: Jared Farrish
        255642 by: Darren Whitlen
        255643 by: Jason Pruim

Re: convert numerical day of week
        255623 by: tedd
        255626 by: Robert Cummings
        255647 by: Jochem Maas
        255651 by: Robert Cummings

Re: System wide variable
        255624 by: Darren Whitlen

Re: Form Validation Issues
        255625 by: tedd

Re: Include file questions
        255627 by: tedd
        255633 by: Tijnema
        255634 by: Robert Cummings
        255635 by: Edward Kay
        255637 by: Tijnema
        255638 by: Robert Cummings
        255641 by: Edward Kay
        255644 by: Tijnema
        255650 by: Robert Cummings
        255655 by: Tijnema
        255659 by: Robert Cummings
        255660 by: Tijnema
        255663 by: Robert Cummings
        255664 by: Tijnema
        255665 by: Richard Davey
        255668 by: Tijnema

Re: Include???
        255628 by: tedd
        255629 by: Richard Davey
        255631 by: Robert Cummings
        255636 by: tedd
        255640 by: tedd

Re: Cannot access file on Network Drive (Windows 2003)
        255630 by: Rahul Sitaram Johari

Re: setting windows folder to chmod 644
        255632 by: Tijnema
        255654 by: Daniel Brown
        255656 by: Edward Vermillion

Re: PHP Text-To-Speech Function txt2wav()
        255645 by: Daniel Brown

Re: Check if Record was Entered Today.
        255646 by: Rahul Sitaram Johari
        255648 by: Rahul Sitaram Johari
        255653 by: Jared Farrish

using mysql_escape_string with implode() !!
        255649 by: Rahul Sitaram Johari
        255652 by: Zoltán Németh
        255666 by: Rahul Sitaram Johari

Re: Creating an executer
        255657 by: Daniel Brown
        255662 by: Daniel Brown

Re: zend framework
        255658 by: Edward Vermillion
        255661 by: Greg Donald

Re: using mysql_escape_string with implode() - SOLVED!
        255667 by: Rahul Sitaram Johari

Re: PHP debugger
        255669 by: Jochem Maas

Downloading a file from MySQL
        255670 by: benc11.gmail.com

Administrivia:

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

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

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

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

attached mail follows:


> Hello Everyone,
>
> I have a problem with GET strings. I use
> $_SERVER["REDIRECT_QUERY_STRING"] to get the value-pairs in the URL.
> The problem is that there is a cID variable that keeps amending itself
> to the string continuously everytime someone clicks on a different
> category link on the website. For example, instead of this:
>
>
http://www.someexample.com/admin/index.html?cID=42&somevar=value&somevar2=value2
>
> it keeps amending another cID to it everytime it goes to a different
> link, like this:
>
>
http://www.someexample.com/admin/index.html?cID=42&cID=39&cID=44&cID=37&somevar=value&somevar2=value2
>
> I know that this is happening because I'm amending it with the dot (.)
> but is there a way to just inject a single cID and still have the rest
> of the values available? Something built into PHP, maybe a different
> predefined variable I don't know about? Or, do I have to make a
> complex function to separate each out and then put it back together
> again like humpty dumpty? Is there an easier way to do this and still
> have a single cID variable in the GET string? Thanks in advance to
> anyone that contributes, I really appreciate everyone's effort on this
> list in the past.

Please start a new thread with a more appropriate title.

Thanks!

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: "If the only tool you have is a hammer, you tend to see
every problem as a nail." $$

attached mail follows:


check this, check that.

granted the OP posted quite a bit of irrelevant code with regard to
SQL injection protection. BUT his use of parameterized queries should protect
against injection because MySQL knows what to do with the data (i.e. escape it),
which only leaves the question as to whether the character encoding is correctly
setup so that nothing funky can get through (although I believe an article by
Chris Shiftlett pointed out a situation where even if you got everything right it
was possible to do sql injection in some edge cases by submitting specific 'broken'
strings).

Jared Farrish wrote:
> Also, you should be checking against type (expecting a number? a boolean
> value? a string?) and then checking against expected length requirements
> (such as firstname can only be 80 characters long max, so maybe check for
>
> <code>
> if (strlen($var) > 80) {
> do something;
> }
> </code>
>
> In unit testing, you build your objects first against types and perform
> object checks using type verification and expected element attributes (such
> as length, non-null values, etc...).

attached mail follows:


On May 25, 2007, at 8:47 AM, Jochem Maas wrote:

> check this, check that.
>
> granted the OP posted quite a bit of irrelevant code with regard to
> SQL injection protection. BUT his use of parameterized queries
> should protect
> against injection because MySQL knows what to do with the data
> (i.e. escape it),
> which only leaves the question as to whether the character encoding
> is correctly
> setup so that nothing funky can get through (although I believe an
> article by
> Chris Shiftlett pointed out a situation where even if you got
> everything right it
> was possible to do sql injection in some edge cases by submitting
> specific 'broken'
> strings).

I apologize for posting the entire add script, but I wasn't sure what
was needed to check if I was doing it right or not. I figured in this
case it was better to give to much info rather then not enough. My
big main goal it to make this bit of software as secure/safe as
possible.

I will double check the character encoding, which would be done on
the database correct?

Now if only I could get a check box to show up so I can delete
multiple people at one time :) But I'm still learning about that.

Thanks for looking! I really appreciate it!

attached mail follows:


On 5/25/07, Jason Pruim <japruimraoset.com> wrote:
>
> I apologize for posting the entire add script, but I wasn't sure what
> was needed to check if I was doing it right or not. I figured in this
> case it was better to give to much info rather then not enough. My
> big main goal it to make this bit of software as secure/safe as
> possible.

No apology necessary. As long as you're not posting 90 lines for a one-line
question, you're ok.

Regardless of what one person or another thinks, I find that it's often
useful to see how other people approach problems and get around them. For
instance, checking for character encoding is something I really have never
done. I happen to think it's a useful best practice to use unit testing
techniques to verify posted data, but some people (obviously) view this as
overkill. To each his own.

Now if only I could get a check box to show up so I can delete
> multiple people at one time :) But I'm still learning about that.
>

I sure hope you're testing on test data, and not live data...
--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: "If the only tool you have is a hammer, you tend to see
every problem as a nail." $$

attached mail follows:


Jared Farrish wrote:
> On 5/25/07, Jason Pruim <japruimraoset.com> wrote:
>>
>> I apologize for posting the entire add script, but I wasn't sure what
>> was needed to check if I was doing it right or not. I figured in this
>> case it was better to give to much info rather then not enough. My
>> big main goal it to make this bit of software as secure/safe as
>> possible.
>
>
> No apology necessary. As long as you're not posting 90 lines for a one-line
> question, you're ok.
>
> Regardless of what one person or another thinks, I find that it's often
> useful to see how other people approach problems and get around them. For
> instance, checking for character encoding is something I really have never
> done. I happen to think it's a useful best practice to use unit testing
> techniques to verify posted data, but some people (obviously) view this as
> overkill. To each his own.
>
> Now if only I could get a check box to show up so I can delete
>> multiple people at one time :) But I'm still learning about that.
>>
>
> I sure hope you're testing on test data, and not live data...

Brings back bad memories :(

attached mail follows:


On May 25, 2007, at 10:44 AM, Darren Whitlen wrote:

> Jared Farrish wrote:
>> On 5/25/07, Jason Pruim <japruimraoset.com> wrote:
>>>
>>> I apologize for posting the entire add script, but I wasn't sure
>>> what
>>> was needed to check if I was doing it right or not. I figured in
>>> this
>>> case it was better to give to much info rather then not enough. My
>>> big main goal it to make this bit of software as secure/safe as
>>> possible.
>> No apology necessary. As long as you're not posting 90 lines for a
>> one-line
>> question, you're ok.
>> Regardless of what one person or another thinks, I find that it's
>> often
>> useful to see how other people approach problems and get around
>> them. For
>> instance, checking for character encoding is something I really
>> have never
>> done. I happen to think it's a useful best practice to use unit
>> testing
>> techniques to verify posted data, but some people (obviously) view
>> this as
>> overkill. To each his own.
>> Now if only I could get a check box to show up so I can delete
>>> multiple people at one time :) But I'm still learning about that.
>>>
>> I sure hope you're testing on test data, and not live data...
>
> Brings back bad memories :(

No... No live data, just a little web application I'm working on to
give my customers another option for their mailing lists.

I've done to much on live data before and I don't like it... Too many
issues happen :)

attached mail follows:


What a hoot!

When I saw the the number of post to this thread, I figured someone
got their shorts in a knot.

Only a bunch of geeks could get into this much discussion of what day
of the week it is. Aren't we a sad lot?

Cheers,

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

attached mail follows:


On Fri, 2007-05-25 at 09:10 -0400, tedd wrote:
> What a hoot!
>
> When I saw the the number of post to this thread, I figured someone
> got their shorts in a knot.
>
> Only a bunch of geeks could get into this much discussion of what day
> of the week it is. Aren't we a sad lot?

Only if we take criticism personally... I don't think anyone did :)
Sometimes it's quite enlightening to see other people's perspectives on
simple things like this :B

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

attached mail follows:


Robert Cummings wrote:
> On Fri, 2007-05-25 at 09:10 -0400, tedd wrote:
>> What a hoot!
>>
>> When I saw the the number of post to this thread, I figured someone
>> got their shorts in a knot.
>>
>> Only a bunch of geeks could get into this much discussion of what day
>> of the week it is. Aren't we a sad lot?
>
> Only if we take criticism personally... I don't think anyone did :)
> Sometimes it's quite enlightening to see other people's perspectives on
> simple things like this :B

<joking voice="sharks from Finding Nemo">denial.</joking>

>
> Cheers,
> Rob.

attached mail follows:


On Fri, 2007-05-25 at 17:26 +0200, Jochem Maas wrote:
> Robert Cummings wrote:
> > On Fri, 2007-05-25 at 09:10 -0400, tedd wrote:
> >> What a hoot!
> >>
> >> When I saw the the number of post to this thread, I figured someone
> >> got their shorts in a knot.
> >>
> >> Only a bunch of geeks could get into this much discussion of what day
> >> of the week it is. Aren't we a sad lot?
> >
> > Only if we take criticism personally... I don't think anyone did :)
> > Sometimes it's quite enlightening to see other people's perspectives on
> > simple things like this :B
>
> <joking voice="sharks from Finding Nemo">denial.</joking>

It's not just a river in Egypt!! (yeah, yeah, bad pun :)

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

attached mail follows:


Richard Lynch wrote:
> On Wed, May 23, 2007 4:27 am, Darren Whitlen wrote:
>> John Comerford wrote:
>> Not thought about the memory engine actually. Will give that a try and
>> see how it turns out.
>
> Let us know.

Finaly managed to get it going (uses AJAX which im not to great at..),
and the database memory engine seems to be holding up fine.
When it was reading/writing frm the file, after a short while I would
start getting "file is in use" errors which using mysql now solves.

>
> I'd have GUESSED that MySQL would have just cached something that
> small and oft-used in RAM anyway, so a MySQL memory engine table
> wouldn't perform any better than the MySQL half of things.
>
> Better than the File System, probably, though that also may be getting
> cached...
>
>> Think I'll leave the session_id idea then, if it locks it down
>> per-script, the performance will pretty much die.
>
> It won't be any better than your own file-system calls, but you could do:
>
> <?php
> session_start();
> //read-write $_SESSION here
> session_write_close();
> //don't touch session here
> ?>
>
> And it probably won't be any worse than the locking you presumably
> already have in your code...
>
> WHy is it sometimes MySQL and sometims file system?
>

I'm changing the yShout script (http://yurivish.com/yshout/) so that it
reads from a database, rather than the tx file it originaly used.
And my bad, it checks the database every 3 seconds, not .5 :)

attached mail follows:


At 8:57 AM -0700 5/23/07, Jim Lucas wrote:
>kvigor wrote:
>> if($value != 'Alabama' || $value!= 'AL' || $value != 'Alaska' ||
>>$value!= 'AK' || $value !=
>>-snip-
>>
>Ok, here is something that might help you.
>
>$states['AL'] => 'Alabama';
>$states['AK'] => 'Alaska';
>-snip-
>$states['WY'] => 'Wyoming';
>
>now use this like this
>
>if ( !isset($states[$value]) && !in_array($value, $states) ) {
> // do something because I can't find the state
>}
>
>use something like this so your logical errors will be reduced
>
>--
>Jim Lucas
>
> "Some men are born to greatness, some achieve greatness,
> and some have greatness thrust upon them."
>
>Unknown

Hi Jim:

You might try the array below and the quote above, I believe, was
Douglas MacArthur of WWII fame.

Cheers,

tedd

$states = array(
'AL' => 'Alabama',
'AK' => 'Alaska',
'AS' => 'American Samoa',
'AZ' => 'Arizona',
'AR' => 'Arkansas',
'CA' => 'California',
'CO' => 'Colorado',
'CT' => 'Connecticut',
'DE' => 'Delaware',
'DC' => 'District Of Columbia',
'FM' => 'Federated States Of Micronesia',
'FL' => 'Florida',
'GA' => 'Georgia',
'GU' => 'Guam',
'HI' => 'Hawaii',
'ID' => 'Idaho',
'IL' => 'Illinois',
'IN' => 'Indiana',
'IA' => 'Iowa',
'KS' => 'Kansas',
'KY' => 'Kentucky',
'LA' => 'Louisiana',
'ME' => 'Maine',
'MH' => 'Marshall Islands',
'MD' => 'Maryland',
'MA' => 'Massachusetts',
'MI' => 'Michigan',
'MN' => 'Minnesota',
'MS' => 'Mississippi',
'MO' => 'Missouri',
'MT' => 'Montana',
'NE' => 'Nebraska',
'NV' => 'Nevada',
'NH' => 'New Hampshire',
'NJ' => 'New Jersey',
'NM' => 'New Mexico',
'NY' => 'New York',
'NC' => 'North Carolina',
'ND' => 'North Dakota',
'MP' => 'Northern Mariana Islands',
'OH' => 'Ohio',
'OK' => 'Oklahoma',
'OR' => 'Oregon',
'PW' => 'Palau',
'PA' => 'Pennsylvania',
'PR' => 'Puerto Rico',
'RI' => 'Rhode Island',
'SC' => 'South Carolina',
'SD' => 'South Dakota',
'TN' => 'Tennessee',
'TX' => 'Texas',
'UT' => 'Utah',
'VT' => 'Vermont',
'VI' => 'Virgin Islands',
'VA' => 'Virginia',
'WA' => 'Washington',
'WV' => 'West Virginia',
'WI' => 'Wisconsin',
'WY' => 'Wyoming'
);
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


At 1:55 PM -0700 5/23/07, Kevin Murphy wrote:
>.inc files have a disadvantage in that if you view the file:
>
>http://www.yoursite.com/file.inc
>
>you can see the php code. I prefer not to use those just on the off
>chance that someone can see my code and use that as the basis for
>figuring out a way to exploit it (especially true of password files,
>etc).
>
>--
>Kevin Murphy

And the other side of that coin is if you have your files ending with
.php, then they can be called/run directly and do things you may not
want done.

That's a good reason to use some sort of token protection in your
include php files so that they cannot be run directly.

Cheers,

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

attached mail follows:


On 5/25/07, tedd <teddsperling.com> wrote:
> At 1:55 PM -0700 5/23/07, Kevin Murphy wrote:
> >.inc files have a disadvantage in that if you view the file:
> >
> >http://www.yoursite.com/file.inc
> >
> >you can see the php code. I prefer not to use those just on the off
> >chance that someone can see my code and use that as the basis for
> >figuring out a way to exploit it (especially true of password files,
> >etc).
> >
> >--
> >Kevin Murphy
>
> And the other side of that coin is if you have your files ending with
> .php, then they can be called/run directly and do things you may not
> want done.
>
> That's a good reason to use some sort of token protection in your
> include php files so that they cannot be run directly.
>
> Cheers,
>
> tedd

It's just the way you write script, my included files contain only
functions & variables, no executing code. 99% I have a class around
it.
If you write it like that, than there's no problem with execution the
included file directly, as it loads the class but doesn't do anything
with it :)

Tijnema

attached mail follows:


On Fri, 2007-05-25 at 16:00 +0200, Tijnema wrote:
> On 5/25/07, tedd <teddsperling.com> wrote:
> > At 1:55 PM -0700 5/23/07, Kevin Murphy wrote:
> > >.inc files have a disadvantage in that if you view the file:
> > >
> > >http://www.yoursite.com/file.inc
> > >
> > >you can see the php code. I prefer not to use those just on the off
> > >chance that someone can see my code and use that as the basis for
> > >figuring out a way to exploit it (especially true of password files,
> > >etc).
> > >
> > >--
> > >Kevin Murphy
> >
> > And the other side of that coin is if you have your files ending with
> > .php, then they can be called/run directly and do things you may not
> > want done.
> >
> > That's a good reason to use some sort of token protection in your
> > include php files so that they cannot be run directly.
> >
> > Cheers,
> >
> > tedd
>
> It's just the way you write script, my included files contain only
> functions & variables, no executing code. 99% I have a class around
> it.
> If you write it like that, than there's no problem with execution the
> included file directly, as it loads the class but doesn't do anything
> with it :)
>
> Tijnema

Yep, same with me. Only runnable code is in the config file that gets
run every page anyways and in the pages that get requested themselves.
At any rate, anything that shouldn't be requested is outside the web
tree.

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

attached mail follows:


> -----Original Message-----
> From: Tijnema [mailto:tijnemagmail.com]
> Sent: 25 May 2007 15:00
> To: tedd
> Cc: Kevin Murphy; Stephen; php
> Subject: Re: [PHP] Include file questions
>
>
> On 5/25/07, tedd <teddsperling.com> wrote:
> > At 1:55 PM -0700 5/23/07, Kevin Murphy wrote:
> > >.inc files have a disadvantage in that if you view the file:
> > >
> > >http://www.yoursite.com/file.inc
> > >
> > >you can see the php code. I prefer not to use those just on the off
> > >chance that someone can see my code and use that as the basis for
> > >figuring out a way to exploit it (especially true of password files,
> > >etc).
> > >
> > >--
> > >Kevin Murphy
> >
> > And the other side of that coin is if you have your files ending with
> > .php, then they can be called/run directly and do things you may not
> > want done.
> >
> > That's a good reason to use some sort of token protection in your
> > include php files so that they cannot be run directly.
> >
> > Cheers,
> >
> > tedd
>
> It's just the way you write script, my included files contain only
> functions & variables, no executing code. 99% I have a class around
> it.
> If you write it like that, than there's no problem with execution the
> included file directly, as it loads the class but doesn't do anything
> with it :)
>
> Tijnema
>

Why are your include files in your web root in the first place? Move them
elsewhere on your filesystem and then it's not even possible to access them
via the web.

Edward

attached mail follows:


On 5/25/07, Edward Kay <edwardlabhut.com> wrote:
>
>
> > -----Original Message-----
> > From: Tijnema [mailto:tijnemagmail.com]
> > Sent: 25 May 2007 15:00
> > To: tedd
> > Cc: Kevin Murphy; Stephen; php
> > Subject: Re: [PHP] Include file questions
> >
> >
> > On 5/25/07, tedd <teddsperling.com> wrote:
> > > At 1:55 PM -0700 5/23/07, Kevin Murphy wrote:
> > > >.inc files have a disadvantage in that if you view the file:
> > > >
> > > >http://www.yoursite.com/file.inc
> > > >
> > > >you can see the php code. I prefer not to use those just on the off
> > > >chance that someone can see my code and use that as the basis for
> > > >figuring out a way to exploit it (especially true of password files,
> > > >etc).
> > > >
> > > >--
> > > >Kevin Murphy
> > >
> > > And the other side of that coin is if you have your files ending with
> > > .php, then they can be called/run directly and do things you may not
> > > want done.
> > >
> > > That's a good reason to use some sort of token protection in your
> > > include php files so that they cannot be run directly.
> > >
> > > Cheers,
> > >
> > > tedd
> >
> > It's just the way you write script, my included files contain only
> > functions & variables, no executing code. 99% I have a class around
> > it.
> > If you write it like that, than there's no problem with execution the
> > included file directly, as it loads the class but doesn't do anything
> > with it :)
> >
> > Tijnema
> >
>
> Why are your include files in your web root in the first place? Move them
> elsewhere on your filesystem and then it's not even possible to access them
> via the web.
>
> Edward
>
Oh, I don't want my web files all over the filesystem, I want to keep
all files for a single project inside a single folder on my webserver.
So, that if i move them around, I have all files there.

Tijnema

attached mail follows:


On Fri, 2007-05-25 at 16:17 +0200, Tijnema wrote:
> On 5/25/07, Edward Kay <edwardlabhut.com> wrote:
> > Why are your include files in your web root in the first place? Move them
> > elsewhere on your filesystem and then it's not even possible to access them
> > via the web.
> >
> > Edward
> >
> Oh, I don't want my web files all over the filesystem, I want to keep
> all files for a single project inside a single folder on my webserver.
> So, that if i move them around, I have all files there.

I do that, then I run a build script and it migrates all the static
content from the CVS to the web tree that can be requested and builds
all the pages from the templates to the requestable pages. Everything is
in one location from an archival POV, but it all goes into the right
slot for visitor consumption :)

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

attached mail follows:


> -----Original Message-----
> From: Tijnema [mailto:tijnemagmail.com]
> > >
> > > It's just the way you write script, my included files contain only
> > > functions & variables, no executing code. 99% I have a class around
> > > it.
> > > If you write it like that, than there's no problem with execution the
> > > included file directly, as it loads the class but doesn't do anything
> > > with it :)
> > >
> > > Tijnema
> > >
> >
> > Why are your include files in your web root in the first place?
> Move them
> > elsewhere on your filesystem and then it's not even possible to
> access them
> > via the web.
> >
> > Edward
> >
> Oh, I don't want my web files all over the filesystem, I want to keep
> all files for a single project inside a single folder on my webserver.
> So, that if i move them around, I have all files there.
>
> Tijnema

This is exactly what I do - one folder per project. You just have you
web-root as a sub folder in this, eg:

/project
  /includes <- nicely protected
  /public_html <- web root
     /images
      index.php
     ...
  ...

Edward

attached mail follows:


On 5/25/07, Edward Kay <edwardlabhut.com> wrote:
>
> > -----Original Message-----
> > From: Tijnema [mailto:tijnemagmail.com]
> > > >
> > > > It's just the way you write script, my included files contain only
> > > > functions & variables, no executing code. 99% I have a class around
> > > > it.
> > > > If you write it like that, than there's no problem with execution the
> > > > included file directly, as it loads the class but doesn't do anything
> > > > with it :)
> > > >
> > > > Tijnema
> > > >
> > >
> > > Why are your include files in your web root in the first place?
> > Move them
> > > elsewhere on your filesystem and then it's not even possible to
> > access them
> > > via the web.
> > >
> > > Edward
> > >
> > Oh, I don't want my web files all over the filesystem, I want to keep
> > all files for a single project inside a single folder on my webserver.
> > So, that if i move them around, I have all files there.
> >
> > Tijnema
>
> This is exactly what I do - one folder per project. You just have you
> web-root as a sub folder in this, eg:
>
> /project
> /includes <- nicely protected
> /public_html <- web root
> /images
> index.php
> ...
> ...
>
> Edward
>
Hmm, way too complicated :P

I like to keep it simple, just like this:
/
  /data
    /http
      /project1
        /includes
          config.php << With passwords :P
        /images
      /project2
        /includes

Tijnema

attached mail follows:


On Fri, 2007-05-25 at 17:07 +0200, Tijnema wrote:
> On 5/25/07, Edward Kay <edwardlabhut.com> wrote:
> >
> > > -----Original Message-----
> > > From: Tijnema [mailto:tijnemagmail.com]
> > > > >
> > > > > It's just the way you write script, my included files contain only
> > > > > functions & variables, no executing code. 99% I have a class around
> > > > > it.
> > > > > If you write it like that, than there's no problem with execution the
> > > > > included file directly, as it loads the class but doesn't do anything
> > > > > with it :)
> > > > >
> > > > > Tijnema
> > > > >
> > > >
> > > > Why are your include files in your web root in the first place?
> > > Move them
> > > > elsewhere on your filesystem and then it's not even possible to
> > > access them
> > > > via the web.
> > > >
> > > > Edward
> > > >
> > > Oh, I don't want my web files all over the filesystem, I want to keep
> > > all files for a single project inside a single folder on my webserver.
> > > So, that if i move them around, I have all files there.
> > >
> > > Tijnema
> >
> > This is exactly what I do - one folder per project. You just have you
> > web-root as a sub folder in this, eg:
> >
> > /project
> > /includes <- nicely protected
> > /public_html <- web root
> > /images
> > index.php
> > ...
> > ...
> >
> > Edward
> >
> Hmm, way too complicated :P
>
> I like to keep it simple, just like this:
> /
> /data
> /http
> /project1
> /includes
> config.php << With passwords :P
> /images
> /project2
> /includes

You won't like mine then :)

    /wherever
        /Project
            /bin
            /build
                /source
                /static
                /templates
                patterns.txt
            /compilers
            /configs
            /cron
            /functions
            /modules
            /services
            /sql
            buildSite.php*
            config.interjinn.php (link to active config in /configs)

Running buildSite.php (which uses patterns.txt) generates the webtree:

    /wherever
        /DOC_ROOT

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

attached mail follows:


On 5/25/07, Robert Cummings <robertinterjinn.com> wrote:
> On Fri, 2007-05-25 at 17:07 +0200, Tijnema wrote:
> > On 5/25/07, Edward Kay <edwardlabhut.com> wrote:
> > >
> > > > -----Original Message-----
> > > > From: Tijnema [mailto:tijnemagmail.com]
> > > > > >
> > > > > > It's just the way you write script, my included files contain only
> > > > > > functions & variables, no executing code. 99% I have a class around
> > > > > > it.
> > > > > > If you write it like that, than there's no problem with execution the
> > > > > > included file directly, as it loads the class but doesn't do anything
> > > > > > with it :)
> > > > > >
> > > > > > Tijnema
> > > > > >
> > > > >
> > > > > Why are your include files in your web root in the first place?
> > > > Move them
> > > > > elsewhere on your filesystem and then it's not even possible to
> > > > access them
> > > > > via the web.
> > > > >
> > > > > Edward
> > > > >
> > > > Oh, I don't want my web files all over the filesystem, I want to keep
> > > > all files for a single project inside a single folder on my webserver.
> > > > So, that if i move them around, I have all files there.
> > > >
> > > > Tijnema
> > >
> > > This is exactly what I do - one folder per project. You just have you
> > > web-root as a sub folder in this, eg:
> > >
> > > /project
> > > /includes <- nicely protected
> > > /public_html <- web root
> > > /images
> > > index.php
> > > ...
> > > ...
> > >
> > > Edward
> > >
> > Hmm, way too complicated :P
> >
> > I like to keep it simple, just like this:
> > /
> > /data
> > /http
> > /project1
> > /includes
> > config.php << With passwords :P
> > /images
> > /project2
> > /includes
>
> You won't like mine then :)
>
> /wherever
> /Project
> /bin
> /build
> /source
> /static
> /templates
> patterns.txt
> /compilers
> /configs
> /cron
> /functions
> /modules
> /services
> /sql
> buildSite.php*
> config.interjinn.php (link to active config in /configs)
>
> Running buildSite.php (which uses patterns.txt) generates the webtree:
>
> /wherever
> /DOC_ROOT
>
> Cheers,
> Rob.

Definitely not.!

also way too complicated... :P

Tijnema

attached mail follows:


On Fri, 2007-05-25 at 18:04 +0200, Tijnema wrote:
> On 5/25/07, Robert Cummings <robertinterjinn.com> wrote:
> > On Fri, 2007-05-25 at 17:07 +0200, Tijnema wrote:
> > > I like to keep it simple, just like this:
> > > /
> > > /data
> > > /http
> > > /project1
> > > /includes
> > > config.php << With passwords :P
> > > /images
> > > /project2
> > > /includes
> >
> > You won't like mine then :)
> >
> > /wherever
> > /Project
> > /bin
> > /build
> > /source
> > /static
> > /templates
> > patterns.txt
> > /compilers
> > /configs
> > /cron
> > /functions
> > /modules
> > /services
> > /sql
> > buildSite.php*
> > config.interjinn.php (link to active config in /configs)
> >
> > Running buildSite.php (which uses patterns.txt) generates the webtree:
> >
> > /wherever
> > /DOC_ROOT
> >
> > Cheers,
> > Rob.
>
> Definitely not.!
>
> also way too complicated... :P
>
> Tijnema

I think the word you're looking for is "organized" ;)

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

attached mail follows:


On 5/25/07, Robert Cummings <robertinterjinn.com> wrote:
> On Fri, 2007-05-25 at 18:04 +0200, Tijnema wrote:
> > On 5/25/07, Robert Cummings <robertinterjinn.com> wrote:
> > > On Fri, 2007-05-25 at 17:07 +0200, Tijnema wrote:
> > > > I like to keep it simple, just like this:
> > > > /
> > > > /data
> > > > /http
> > > > /project1
> > > > /includes
> > > > config.php << With passwords :P
> > > > /images
> > > > /project2
> > > > /includes
> > >
> > > You won't like mine then :)
> > >
> > > /wherever
> > > /Project
> > > /bin
> > > /build
> > > /source
> > > /static
> > > /templates
> > > patterns.txt
> > > /compilers
> > > /configs
> > > /cron
> > > /functions
> > > /modules
> > > /services
> > > /sql
> > > buildSite.php*
> > > config.interjinn.php (link to active config in /configs)
> > >
> > > Running buildSite.php (which uses patterns.txt) generates the webtree:
> > >
> > > /wherever
> > > /DOC_ROOT
> > >
> > > Cheers,
> > > Rob.
> >
> > Definitely not.!
> >
> > also way too complicated... :P
> >
> > Tijnema
>
> I think the word you're looking for is "organized" ;)
>
> Cheers,
> Rob.
> --
Do you call your code organized?

Tijnema

attached mail follows:


On Fri, 2007-05-25 at 18:20 +0200, Tijnema wrote:
> On 5/25/07, Robert Cummings <robertinterjinn.com> wrote:
> > On Fri, 2007-05-25 at 18:04 +0200, Tijnema wrote:
> > > On 5/25/07, Robert Cummings <robertinterjinn.com> wrote:
> > > > On Fri, 2007-05-25 at 17:07 +0200, Tijnema wrote:
> > > > > I like to keep it simple, just like this:
> > > > > /
> > > > > /data
> > > > > /http
> > > > > /project1
> > > > > /includes
> > > > > config.php << With passwords :P
> > > > > /images
> > > > > /project2
> > > > > /includes
> > > >
> > > > You won't like mine then :)
> > > >
> > > > /wherever
> > > > /Project
> > > > /bin
> > > > /build
> > > > /source
> > > > /static
> > > > /templates
> > > > patterns.txt
> > > > /compilers
> > > > /configs
> > > > /cron
> > > > /functions
> > > > /modules
> > > > /services
> > > > /sql
> > > > buildSite.php*
> > > > config.interjinn.php (link to active config in /configs)
> > > >
> > > > Running buildSite.php (which uses patterns.txt) generates the webtree:
> > > >
> > > > /wherever
> > > > /DOC_ROOT
> > > >
> > > > Cheers,
> > > > Rob.
> > >
> > > Definitely not.!
> > >
> > > also way too complicated... :P
> > >
> > > Tijnema
> >
> > I think the word you're looking for is "organized" ;)
> >
> > Cheers,
> > Rob.
> > --
> Do you call your code organized?

Very. Each directory contains very specific types of code/content.
Tracking down where any given function, class, custom tag, behaviour,
etc is defined is extremely simple.

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

attached mail follows:


On 5/25/07, Robert Cummings <robertinterjinn.com> wrote:
> On Fri, 2007-05-25 at 18:20 +0200, Tijnema wrote:
> > On 5/25/07, Robert Cummings <robertinterjinn.com> wrote:
> > > On Fri, 2007-05-25 at 18:04 +0200, Tijnema wrote:
> > > > On 5/25/07, Robert Cummings <robertinterjinn.com> wrote:
> > > > > On Fri, 2007-05-25 at 17:07 +0200, Tijnema wrote:
> > > > > > I like to keep it simple, just like this:
> > > > > > /
> > > > > > /data
> > > > > > /http
> > > > > > /project1
> > > > > > /includes
> > > > > > config.php << With passwords :P
> > > > > > /images
> > > > > > /project2
> > > > > > /includes
> > > > >
> > > > > You won't like mine then :)
> > > > >
> > > > > /wherever
> > > > > /Project
> > > > > /bin
> > > > > /build
> > > > > /source
> > > > > /static
> > > > > /templates
> > > > > patterns.txt
> > > > > /compilers
> > > > > /configs
> > > > > /cron
> > > > > /functions
> > > > > /modules
> > > > > /services
> > > > > /sql
> > > > > buildSite.php*
> > > > > config.interjinn.php (link to active config in /configs)
> > > > >
> > > > > Running buildSite.php (which uses patterns.txt) generates the webtree:
> > > > >
> > > > > /wherever
> > > > > /DOC_ROOT
> > > > >
> > > > > Cheers,
> > > > > Rob.
> > > >
> > > > Definitely not.!
> > > >
> > > > also way too complicated... :P
> > > >
> > > > Tijnema
> > >
> > > I think the word you're looking for is "organized" ;)
> > >
> > > Cheers,
> > > Rob.
> > > --
> > Do you call your code organized?
>
> Very. Each directory contains very specific types of code/content.
> Tracking down where any given function, class, custom tag, behaviour,
> etc is defined is extremely simple.
>
> Cheers,
> Rob.

I don't agree with you, i have includes in includes dir inside my
project, images in images, etc. classes in includes dir start with
class. configuration files in includes start with config. etc.

But, this is all about personal preference ;) I like the way I do it,
you like the way you do it...

Tijnema

attached mail follows:


Hi Tijnema,

Friday, May 25, 2007, 5:58:46 PM, you wrote:

> On 5/25/07, Robert Cummings <robertinterjinn.com> wrote:
>> Very. Each directory contains very specific types of code/content.
>> Tracking down where any given function, class, custom tag, behaviour,
>> etc is defined is extremely simple.
>>
>> Cheers,
>> Rob.

> I don't agree with you, i have includes in includes dir inside my
> project, images in images, etc. classes in includes dir start with
> class. configuration files in includes start with config. etc.

Oh to work on such little sized sites again :)

Not that I'm belittling your projects Tijnema, because I'm not - but
I've not worked on a site with a structure that could be that simple
for a long time now, I kinda miss it actually!! Hell even the 'images
folder' had to be split across multiple servers in the code I finished
today.

A lot of Robert's structure makes complete sense. I never keep
libraries inside the webroot that simply don't need to be there.
Infact if a script doesn't output anything 'web related' (image, rss,
html) or process data from the site, it doesn't need to live in the
webroot at all. I use a similar principal for the 'admin' area of the
site too, which I'm sure you'd hate ;) but I always code my admin
areas so that they can run on an entirely different domain name and/or
server if needs be. Only as a last resort do they ever live in /admin,
and never will they share libs that the 'public' site uses, they are
entirely stand-alone entities.

You're right in that it is down to personal preference though :)

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

attached mail follows:


On 5/25/07, Richard Davey <richcorephp.co.uk> wrote:
> Hi Tijnema,
>
> Friday, May 25, 2007, 5:58:46 PM, you wrote:
>
> > On 5/25/07, Robert Cummings <robertinterjinn.com> wrote:
> >> Very. Each directory contains very specific types of code/content.
> >> Tracking down where any given function, class, custom tag, behaviour,
> >> etc is defined is extremely simple.
> >>
> >> Cheers,
> >> Rob.
>
> > I don't agree with you, i have includes in includes dir inside my
> > project, images in images, etc. classes in includes dir start with
> > class. configuration files in includes start with config. etc.
>
> Oh to work on such little sized sites again :)
>
> Not that I'm belittling your projects Tijnema, because I'm not - but
> I've not worked on a site with a structure that could be that simple
> for a long time now, I kinda miss it actually!! Hell even the 'images
> folder' had to be split across multiple servers in the code I finished
> today.

I have actually very big projects, with hundreds of PHP files in the
includes folder. I just give them a logical name and it works for me,
so if I have for example about 10 scripts(classes) that all relate to
file handling, I name them like this
class.file.open.php
class.file.close.php
class.file.read.php
class.file.write.php
Of course this is just an example, as you don't need a seperate class
for file opening.., but you got the point of my file naming now. With
this I don't have any problems having 100s of php files in one
directory.

>
> A lot of Robert's structure makes complete sense. I never keep
> libraries inside the webroot that simply don't need to be there.
> Infact if a script doesn't output anything 'web related' (image, rss,
> html) or process data from the site, it doesn't need to live in the
> webroot at all. I use a similar principal for the 'admin' area of the
> site too, which I'm sure you'd hate ;) but I always code my admin
> areas so that they can run on an entirely different domain name and/or
> server if needs be. Only as a last resort do they ever live in /admin,
> and never will they share libs that the 'public' site uses, they are
> entirely stand-alone entities.
>
> You're right in that it is down to personal preference though :)
>
> Cheers,
>
> Rich

It doesn't need to be there, but I like to have all files for a
project in a single folder. And what does make the difference if it
doesn't output anything?

Tijnema

attached mail follows:


At 3:28 PM +0100 5/23/07, Richard Davey wrote:
>
>
>if ($_POST['status_code'] == 'C')
> ^^
>
>Read-up on the if/else structure and comparison operators. You'd never
>use a single equals sign in this example.

Rich:

Read up on different font sizes that people use and you'll never use
"^^" to show something. :-)

Cheers,

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

attached mail follows:


Hi Tedd,

Friday, May 25, 2007, 2:42:34 PM, you wrote:

> At 3:28 PM +0100 5/23/07, Richard Davey wrote:
>>
>>
>>if ($_POST['status_code'] == 'C')
>> ^^
>>
>>Read-up on the if/else structure and comparison operators. You'd never
>>use a single equals sign in this example.

> Rich:

> Read up on different font sizes that people use and you'll never use
> "^^" to show something. :-)

Font *size* is irrelevant as long as it's monospaced ;)

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

attached mail follows:


On Fri, 2007-05-25 at 09:42 -0400, tedd wrote:
> At 3:28 PM +0100 5/23/07, Richard Davey wrote:
> >
> >
> >if ($_POST['status_code'] == 'C')
> > ^^
> >
> >Read-up on the if/else structure and comparison operators. You'd never
> >use a single equals sign in this example.
>
> Rich:
>
> Read up on different font sizes that people use and you'll never use
> "^^" to show something. :-)

Email should be viewed in fixed width, like has been done since the 60s.

;)

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

attached mail follows:


At 9:49 AM -0400 5/25/07, Robert Cummings wrote:
>On Fri, 2007-05-25 at 09:42 -0400, tedd wrote:
>> At 3:28 PM +0100 5/23/07, Richard Davey wrote:
>> >
>> >
>> >if ($_POST['status_code'] == 'C')
>> > ^^
>> >
>> >Read-up on the if/else structure and comparison operators. You'd never
>> >use a single equals sign in this example.
>>
>> Rich:
>>
>> Read up on different font sizes that people use and you'll never use
>> "^^" to show something. :-)
>
>Email should be viewed in fixed width, like has been done since the 60s.
>
>;)
>
>Cheers,
>Rob.

Oh, the sixties -- I should have known. That was the decade that
started with strict adherence to standards and ended with an
explosion of free choice.

I agree, we shouldn't deviate from that standard too quickly. :-)

Anyone up for some ASCII art?

Cheers,

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

attached mail follows:


At 2:46 PM +0100 5/25/07, Richard Davey wrote:
>Hi Tedd,
>
>Friday, May 25, 2007, 2:42:34 PM, you wrote:
>
>> At 3:28 PM +0100 5/23/07, Richard Davey wrote:
>>>
>>>
>>>if ($_POST['status_code'] == 'C')
>>> ^^
>>>
>>>Read-up on the if/else structure and comparison operators. You'd never
>>>use a single equals sign in this example.
>
>> Rich:
>
>> Read up on different font sizes that people use and you'll never use
>> "^^" to show something. :-)
>
>Font *size* is irrelevant as long as it's monospaced ;)
>
>Rich

Like Henry Ford said when the model T came out "You can have it in
any color you want as long as it's black."

Cheers,

tedd

PS: Yes, I should have said font type or width and instead of size.

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

attached mail follows:


At this point having gone through all sorts of permissions and running
Apache as User and what not - I'm pretty close to giving up myself.
Fortunately I do have other alternates to running this particular
application - but it would have helped if things worked.

On 5/24/07 6:23 PM, "David Giragosian" <dgiragosiangmail.com> wrote:
 
> I had a similar problem with a mysqldump file that I was trying to copy
> over, via a script, to a networked drive. The networked drive was on
> a Novell share, and I could see it and copy just fine using windows explorer
> but nothing I did ever allowed me to copy via the script. I even had Apache
> installed as a service on the windows box and had all permissions as open as
> possible on all directories just to test. I finally gave up and did it from
> a Linux server using ncpfs to mount the Novell drive.
>
> FWIT,
>
> David

attached mail follows:


On 5/25/07, blueboy <rossaztechost.com> wrote:
> How can I do the equivalent of this in windows or is there a tool I can
> use?
>
> R.

Windows file systems don't have permissions like Unix-bases file systems.
For FAT16/FAT32 there are only a few (Read-Only & Hidden), for NTFS
file system there are more permissions (user/group based), I have no
clue how to set them, except for the RMB->Properties->check boxes at
bottom.
But I don't even think you need them, default settings are fine, they
are at least 644 equivalent I believe.

Tijnema

attached mail follows:


On 5/25/07, Tijnema <tijnemagmail.com> wrote:
> On 5/25/07, blueboy <rossaztechost.com> wrote:
> > How can I do the equivalent of this in windows or is there a tool I can
> > use?
> >
> > R.
>
> Windows file systems don't have permissions like Unix-bases file systems.
> For FAT16/FAT32 there are only a few (Read-Only & Hidden), for NTFS
> file system there are more permissions (user/group based), I have no
> clue how to set them, except for the RMB->Properties->check boxes at
> bottom.
> But I don't even think you need them, default settings are fine, they
> are at least 644 equivalent I believe.
>
> Tijnema
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

    You may want to check out the DOS command 'attrib'. I used to use
that on DOS boxes before Windows was really much of anything. I'm
sure it's still in the modern Windows versions, too.

    In fact, I just checked, and it is.... here's a link from Microsoft:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/attrib.mspx?mfr=true

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

attached mail follows:


On May 25, 2007, at 10:50 AM, Daniel Brown wrote:

> On 5/25/07, Tijnema <tijnemagmail.com> wrote:
>> On 5/25/07, blueboy <rossaztechost.com> wrote:
>> > How can I do the equivalent of this in windows or is there a
>> tool I can
>> > use?
>> >
>> > R.
>>
>> Windows file systems don't have permissions like Unix-bases file
>> systems.
>> For FAT16/FAT32 there are only a few (Read-Only & Hidden), for NTFS
>> file system there are more permissions (user/group based), I have no
>> clue how to set them, except for the RMB->Properties->check boxes at
>> bottom.
>> But I don't even think you need them, default settings are fine, they
>> are at least 644 equivalent I believe.
>>
>> Tijnema
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> You may want to check out the DOS command 'attrib'. I used to use
> that on DOS boxes before Windows was really much of anything. I'm
> sure it's still in the modern Windows versions, too.
>
> In fact, I just checked, and it is.... here's a link from
> Microsoft:
> http://www.microsoft.com/resources/documentation/windows/xp/all/
> proddocs/en-us/attrib.mspx?mfr=true
>

I thought windows versions of PHP tried to do the "right thing" for
the chmod(), chown() and chgrp(), translating them to the best
windows equivalent it can? Can't seem to find it in the manual atm,
so I'm not sure where I picked it up.

Ed

attached mail follows:


On 5/25/07, tedd <teddsperling.com> wrote:
> > If you find
> >any bugs --- and I'm sure you will --- report them on the SourceForge
> >project page. And don't mind the cluttered code. It's also in the process
> >of being revamped.
> >
> > Thanks.
> >
> >--
> >Daniel P. Brown
>
>
> Daniel:
>
> Your demo:
>
> http://isawit.com/php-vox/
>
> Still doesn't work for me. I still get the Q with a ? in it.
>
> Cheers,
>
> tedd
>
> --
> -------
> http://sperling.com http://ancientstones.com http://earthstones.com
>

    It works fine for me on all platforms, but it sounds like it's not
working for you with the Quicktime plugin configured to handle all
.wav files within the browser. That would actually be a problem with
either the PHP streaming or your browser setup. After you generate a
file, go to http://www.isawit.com/php-vox/wavs/ and you can listen to
the waveform you created (as well as those done by anyone else who's
done it).

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

attached mail follows:


WORKS!!
Thanks.

On 5/24/07 5:34 PM, "Richard Lynch" <ceol-i-e.com> wrote:

>> $db = dbase_open(try.dbf", 0);
>> if ($db) {
>
> $exists = false;
> $today = false;
>
>> $record_numbers = dbase_numrecords($db);
>> for ($i = 1; $i <= $record_numbers; $i++) {
>> $row = dbase_get_record_with_names($db, $i);
>>
>> $thedate = date(mdY);
>> if(($row['ACC'] == $thekey) && ($row['DATE'] == $thedate))
>> {
> //> echo "The Account Number has already been entered once
> //> today";
> //> echo $row['DATE']." : ".$thedate;
> //> exit;
> $today = true;
>> }
>> else {
> //> echo "The Account Number exists but not entered
> //> today<br>";
> //> echo $row['DATE']." : ".$thedate;
> //> exit;
>
> $exists = true;
>
>> }
>> }
>> }
>
> if ($today) echo "Yes, today.";
> elseif ($exists) echo "Yes, but not today.";
> else echo "No.";
>
> exit; completely halts a script and does NOTHING else.
>
> You maybe thought you wanted 'continue' or 'break' but those wouldn't
> work for this either.

attached mail follows:


I guess one of the problems is that PHP has a limited number of dbase
functions and I'm not able to run SQL Queries on a dbf database. Basically I
have to make-do with the few dbase() functions I have available in PHP.

But I do get your logic and it's pretty helpful. I did re-write the code
using Boolean (flags) as Richard had also suggested and it works fine now!

Still wish I could run SQL Queries or do more to a dbase database using PHP.

Thanks!

On 5/24/07 4:07 PM, "Jared Farrish" <farrishjgmail.com> wrote:

>> I believe you need a "while" instead of an "if". The "if" will only run
>> until the first occurance is true. Whereas a "while" will run to find
> all
>> results that are true until it goes thru all of the result rows..
>
> No, I think he's checking to make sure that $db contains a resource id and
> not a boolean false (meaning the file did not load or contains no data).
>
> Maybe a more descriptive way may be to say:
>
> <code>
> if ($db !== false && is_resource($db)) {
> doStuff();
> }
> </code>
>
> To the next problem:
>
>> 'exit' terminates the script. You should not be using exit there.
>
> When you want a loop structure to stop and goto what flows next in the code,
> use break:
>
> <code>
> for ($i = 0; $i < count($items); $i++) {
> if ($items[$i] == $arbitraryCondition) {
> echo 'I do not need to doStuff() anymore.';
> break;
> }
> doStuff();
> }
> </code>
>
> When you want a loop structure to skip over something but still continue to
> loop, use continue:
>
> <code>
> for ($i = 0; $i < count($items); $i++) {
> if ($items[$i] == $arbitraryCondition) {
> echo 'I do not need to doStuff() on this item.';
> continue;
> }
> doStuff();
> }
> </code>
>
> When reading through values in an array or other structure, you can while or
> do/while loop:
>
> <code>
> $db = getDb('location/db.dbf');
> while($row = db_fetch_array($result)) {
> if ($row['AcctActivation'] != $date) {
> continue;
> } elseif ($row['AcctActivation'] == $date) {
> break;
> }
> doStuff();
> }
> </code>
>
> Isn't there a way to search for and select only the rows with the account
> number though? If you're looking for needles in a (potentially large)
> haystack, this sounds like an expensive process for something SQL or other
> could do better/faster.
>
> ========
>
> Incidentally, does this mean you solved the file access problems from this
> thread:
>
> http://news.php.net/php.general/255542

attached mail follows:


On 5/25/07, Rahul Sitaram Johari <sleepwalkerrahulsjohari.com> wrote:
> I guess one of the problems is that PHP has a limited number of dbase
> functions and I'm not able to run SQL Queries on a dbf database. Basically
I
> have to make-do with the few dbase() functions I have available in PHP.
>
> But I do get your logic and it's pretty helpful. I did re-write the code
> using Boolean (flags) as Richard had also suggested and it works fine now!
>
> Still wish I could run SQL Queries or do more to a dbase database using
PHP.
>
> Thanks!

If you have a database that is unchanging (archived), you can always
transribe it into another format (such as an array or object) if the data
doesn't change, or store it in an XML file, or insert it into a MySQL
database (per table, column names, then loop through each record, copying it
over as you go), and then use more robust queries offered by those
technologies.

I don't know how sophisticated you are with PHP, but the easiest (or at
least most well-documented) solution is to move it to a MySQL database if
the db is archived (and unchanging).

PHP5 supports xQuery, which is also compelling, but the xml classes are
alittle dense to figure out, I think, if you've never gone through
programmatic XML parsing and searching before.

If, though, the database is used by some other software and you're using it
as a bridge (meaning the data changes and transcription isn't a viable
alternative), you may be stuck using the method you're describing.

Although, another alternative may be to configure a command line interpreter
on the db host machine to handle a script that pushes the work to another
machine (db host), that then returns a plaintext-formatted array that can
then be searched using array functions or whatnot, and is then used as an
include() file. This way, the data is rebuilt each go around, but the
overhead is pushed to another machine, similar to a SOAP service (which is
another...). Pass a variable id to the CLI script...

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: "If the only tool you have is a hammer, you tend to see
every problem as a nail." $$

attached mail follows:


Ave,

I¹m inserting values out of an array into mySQL. There¹s other values
besides the array values that are being inserted as well. This is my simple
INSERT code:

$sql = "INSERT INTO db
(Date,Time,Phone,Account,AccountType,RateClass,VoltLevel,IsoZone,TaxDist,Loa
dProfile,ServiceName,ServiceAddress,ServiceCity,ServiceState,ServiceZip,Dema
nd,Kwh,Cost) VALUES ('$dt','$tm','$thephone','".implode("','",
array_values($var))."')";

$var can contain values that have special characters that I need to escape.
I¹d like to use mysql_escape_string() but I¹m not sure how to integrate
mysql_escape_string here with the INSERT statement. I tried it, but it¹s not
working. Any clues?

Thanks.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rahul Sitaram Johari
CEO, Twenty Four Seventy Nine Inc.

W: http://www.rahulsjohari.com
E: sleepwalkerrahulsjohari.com

³I morti non sono piu soli ... The dead are no longer lonely²

attached mail follows:


2007. 05. 25, péntek keltezéssel 11.32-kor Rahul Sitaram Johari ezt
írta:
> Ave,
>
> I¹m inserting values out of an array into mySQL. There¹s other values
> besides the array values that are being inserted as well. This is my simple
> INSERT code:
>
> $sql = "INSERT INTO db
> (Date,Time,Phone,Account,AccountType,RateClass,VoltLevel,IsoZone,TaxDist,Loa
> dProfile,ServiceName,ServiceAddress,ServiceCity,ServiceState,ServiceZip,Dema
> nd,Kwh,Cost) VALUES ('$dt','$tm','$thephone','".implode("','",
> array_values($var))."')";
>
> $var can contain values that have special characters that I need to escape.
> I¹d like to use mysql_escape_string() but I¹m not sure how to integrate
> mysql_escape_string here with the INSERT statement. I tried it, but it¹s not
> working. Any clues?

you should do the escaping before assembling the INSERT statement
a useful tool for this is array_map():
http://hu.php.net/array_map

then you can use the above method for creating the query string

greets
Zoltán Németh

>
> Thanks.
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Rahul Sitaram Johari
> CEO, Twenty Four Seventy Nine Inc.
>
> W: http://www.rahulsjohari.com
> E: sleepwalkerrahulsjohari.com
>
> ³I morti non sono piu soli ... The dead are no longer lonely²
>

attached mail follows:


Ok, I'm not able to use array_map() at all to my benefit, or at least I
can't figure out how to.

I'm trying to generate the string with escape slashes before I put it in the
INSERT statement, but it's not working primarily because values have to be
enclosed in Single Quotes while inserting into mySQL and Single Quote itself
is escape when using mysql_escape_string!!!

On 5/25/07 11:41 AM, "Zoltán Németh" <znemethalterationx.hu> wrote:

>> Ave,
>>
>> I¹m inserting values out of an array into mySQL. There¹s other values
>> besides the array values that are being inserted as well. This is my simple
>> INSERT code:
>>
>> $sql = "INSERT INTO db
>> (Date,Time,Phone,Account,AccountType,RateClass,VoltLevel,IsoZone,TaxDist,Loa
>> dProfile,ServiceName,ServiceAddress,ServiceCity,ServiceState,ServiceZip,Dema
>> nd,Kwh,Cost) VALUES ('$dt','$tm','$thephone','".implode("','",
>> array_values($var))."')";
>>
>> $var can contain values that have special characters that I need to escape.
>> I¹d like to use mysql_escape_string() but I¹m not sure how to integrate
>> mysql_escape_string here with the INSERT statement. I tried it, but it¹s not
>> working. Any clues?
>
> you should do the escaping before assembling the INSERT statement
> a useful tool for this is array_map():
> http://hu.php.net/array_map
>
> then you can use the above method for creating the query string
>

attached mail follows:


On 5/24/07, Richard Lynch <ceol-i-e.com> wrote:
> I only skimmed this, but afaik the only way to get the child PID is to
> "fork" rather than to "exec".
>
> On Thu, May 24, 2007 10:10 am, listsdwsasia.com wrote:
> > Hi,
> >
> > Summary:
> >
> > 1. I execute script1 that will run in the background (daemon)
> > 2. script1 needs to execute script2 and capture STDERR, STDOUT and
> > exitcode from script2 if script2 exits before SIGTERM is received.
> > 3. If I send SIGTERM to script1 it should kill script2, and write to
> > DB (or log file some information that it was stopped)
> >
> > Simple, isn't it? But I cannot s