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 09:38:19 -0000 Issue 4810

php-general-digest-helplists.php.net
Date: Fri May 25 2007 - 04:38:19 CDT


php-general Digest 25 May 2007 09:38:19 -0000 Issue 4810

Topics (messages 255552 through 255619):

Re: php hosting-mediatemple/dreamhost
        255552 by: Jared Farrish
        255563 by: Richard Lynch

Re: Check if Record was Entered Today.
        255553 by: Jared Farrish
        255559 by: Richard Lynch

Did I find a bug in PHP 5.2.2?
        255554 by: Patrick Baldwin
        255555 by: Jim Moseby
        255557 by: Richard Lynch

Developer / Client Documents
        255556 by: Anthony Hiscox
        255560 by: Jared Farrish

Re: Question about using ftp_put() for copying files
        255558 by: Richard Lynch
        255570 by: Al

Re: Protecting MySQL Injection from PHP form
        255561 by: Richard Lynch

Re: Creating an executer
        255562 by: Richard Lynch

Re: two php scripts with same $_SESSION variables
        255564 by: Richard Lynch
        255565 by: Richard Lynch
        255566 by: Stut
        255588 by: Richard Lynch

Re: Database error: Invalid SQL:
        255567 by: Richard Lynch

Re: help with multi dimensional arrays
        255568 by: Richard Lynch
        255613 by: Micky Hulse
        255615 by: Jared Farrish
        255617 by: Navid Yar

System log in problems
        255569 by: Rich Peterson
        255572 by: Stut
        255587 by: Richard Lynch
        255591 by: Stut
        255603 by: Richard Lynch

Re: Include file questions
        255571 by: Richard Lynch

Re: Weird behaviour with move_uploaded_file on CGI version of PHP.
        255573 by: Richard Lynch
        255593 by: Brett Davidson

Re: Cannot access file on Network Drive (Windows 2003)
        255574 by: Richard Lynch
        255575 by: Richard Lynch
        255576 by: Richard Lynch
        255578 by: David Giragosian
        255580 by: Jared Farrish
        255585 by: Richard Lynch
        255590 by: Stut
        255618 by: Tijnema

Re: format date field
        255577 by: Richard Lynch

Re: Form Processing Question - Empty Fields
        255579 by: Richard Lynch

Re: zend framework
        255581 by: Richard Lynch
        255598 by: Jochem Maas

Re: Include???
        255582 by: Richard Lynch
        255583 by: Richard Lynch
        255586 by: Jared Farrish

Re: Form Validation Issues
        255584 by: Richard Lynch
        255589 by: Richard Lynch
        255597 by: Robert Cummings

Re: Creating process and do actions with signals
        255592 by: Richard Lynch

Re: How to eject cd-rom with php code?
        255594 by: Richard Lynch

Re: php upload files
        255595 by: Richard Lynch

Re: Embedded Image from Database
        255596 by: Richard Lynch

Re: System wide variable
        255599 by: Richard Lynch
        255600 by: Richard Lynch
        255604 by: Richard Lynch

Re: problem with composing URL with GET Variables
        255601 by: Richard Lynch

Re: convert numerical day of week
        255602 by: Richard Lynch

Re: PHP Data Mining/Data Scraping
        255605 by: Richard Lynch
        255606 by: Richard Lynch

Re: ftp root dir?
        255607 by: Richard Lynch
        255608 by: Richard Lynch

Re: Bounty
        255609 by: Richard Lynch

Re: Scalable Site Architecture
        255610 by: Richard Lynch
        255611 by: Jared Farrish

Uploading Files into MySQL
        255612 by: benc11.gmail.com
        255614 by: Jared Farrish

Re: Send HTML from PHP scripts ...
        255616 by: Chris

setting windows folder to chmod 644
        255619 by: blueboy

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:


I use MediaTemple, and what I like is that it's a company geared towards a
category of developers, and not ANY person who wants a website. So the
services and support are commensurate for a company that offers services
primarily aimed at professional design-oriented firms and/or developers, and
not Joe Schmo "Website Author." Service request responses have always been
quick, I've never lost data, had a website disappear altogether, etc...

The GRID server configuration is nice at a $20 pricepoint. With PHP5
supported and safe_mode turned off, I can't wait to get off the shared
server.

Shawn Inman is a modestly-famous web designer/developer who uses MediaTemple
for his website:

http://www.shauninman.com/

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


On Thu, May 24, 2007 8:04 am, blackwater dev wrote:
> Forgive me if this is a bit off topic but I currenly have several
> sites
> hosted with dreamhost, it's cheap and well prone to be slow. Does
> anyone
> have experience with mediatemple? I would just be running php/mysql
> sites.

I found Media Temple more annoying than helpful as webhosts. Getting
SSH access was like pulling teeth.

Dreamhost mostly left me alone to do my job, except for the
stupid/funny newsletter. There is probably down-time, but I hacked a
fail-safe roll-over to another server elsewhere, so I don't even
notice it being down.

YMMV

I would not consider either one a "top notch" operation, frankly...

There are a few million other hosts to choose from, fortunately.

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

attached mail follows:


> 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

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


On Thu, May 24, 2007 12:42 pm, Rahul Sitaram Johari wrote:
>
> Ave,
>
> I have a dbase (dbf) database and Iım using PHPıs dbase function to
> open &
> search the database.
> Each row in the database contains an Account Number and the Date it
> was
> inserted.
>
> I want to search this database for to see if the Account number
> ($thekey)
> was inserted today (using date() to find out todayıs date).
>
> Essentially, hereıs the code:
>
> $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.";

> The problem is ­ the scripts stops at the first entry of the Account
> Number,
> and is not looping through all the rows which contain the Account
> Number. So
> if the Account Number was entered yesterday, it stops and gives ³The
> Account
> Number exists but not entered today² even though the Account Number
> does
> exist in another row with Todayıs Date.

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.

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

attached mail follows:


First off, I'd like to explain I'm not a PHP programmer, so please
bear with me. I'm trying to configure a Horde/IMP server. It worked
yesterday. I installed rsync via packages, rebooted, and now no one
can log into my Horde/IMP install. Why am I posting here? Well,
when I look in httpd-error.log, I see:
>
> [Thu May 24 14:05:59 2007] [notice] Apache/1.3.37 (Unix) PHP/5.2.2 with
> Suhosin-
> Patch configured -- resuming normal operations
> [notice] Accept mutex: flock (Default: flock)
> [Thu May 24 14:09:53 2007] [notice] child pid 729 exit signal
> Segmentation fault
> (11)
> [Thu May 24 14:13:30 2007] [notice] child pid 755 exit signal
> Segmentation fault
> (11)
> [Thu May 24 14:13:31 2007] [notice] child pid 759 exit signal
> Segmentation fault
> (11)
> [Thu May 24 14:25:09 2007] [notice] child pid 731 exit signal
> Segmentation fault
> (11)
> [Thu May 24 14:25:10 2007] [notice] child pid 727 exit signal
> Segmentation fault
>

As well as:

>
> webmail# tail messages
> May 24 14:09:52 webmail kernel: pid 729 (httpd), uid 80: exited on
signal 11
> May 24 14:10:11 webmail ntpd[545]: time reset +0.227112 s
> May 24 14:10:11 webmail ntpd[545]: kernel time sync disabled 2041
> May 24 14:13:29 webmail kernel: pid 755 (httpd), uid 80: exited on
signal 11
> May 24 14:13:30 webmail kernel: pid 759 (httpd), uid 80: exited on
signal 11
> May 24 14:25:08 webmail kernel: pid 731 (httpd), uid 80: exited on
signal 11
> May 24 14:25:09 webmail kernel: pid 727 (httpd), uid 80: exited on
signal 11
> May 24 14:25:17 webmail ntpd[545]: kernel time sync enabled 2001

 From http://wiki.horde.org/FAQ/Admin/Troubleshoot/IMP, I got the
impression that the Horde/IMP folks don't think it's very likely
that their software should be able to cause this sort of problem.

I'm using FreeBSD 6.2-RELEASE-p4, horde-base-3.1.4_2, imp-4.1.4_2,
Apache/1.3.37, and PHP 5.2.2 with the Suhosin patch.

If someone else has some idea about this already, that'd be
great. I'm willing to try and help figure it out if more
experienced (at all experienced, really) PHP people think this
is a worthwhile avenue of inquiry, but I'm afraid I'll need a
little help. For example, what does "must have PHP configured with
--enable-debug" mean I need to do, exactly? And where should I
be looking for php core files? I suspect there's probably more
questions I don't even know to ask yet, but you got to start
somewhere.

Regards,

Patrcik Baldwin

attached mail follows:


<snip>
> It worked yesterday.
</snip>

I don't have any idea what could cause your problem, but with your
permission I think I'll have some t-shirts printed up with this slogan. ;-)

JM

-----------------------------------
"It worked yesterday." - unknown

attached mail follows:


On Thu, May 24, 2007 3:15 pm, Patrick Baldwin wrote:
>
> First off, I'd like to explain I'm not a PHP programmer, so please
> bear with me. I'm trying to configure a Horde/IMP server. It worked
> yesterday. I installed rsync via packages, rebooted, and now no one
> can log into my Horde/IMP install. Why am I posting here? Well,
> when I look in httpd-error.log, I see:

> If someone else has some idea about this already, that'd be
> great. I'm willing to try and help figure it out if more
> experienced (at all experienced, really) PHP people think this
> is a worthwhile avenue of inquiry, but I'm afraid I'll need a
> little help. For example, what does "must have PHP configured with
> --enable-debug" mean I need to do, exactly? And where should I
> be looking for php core files? I suspect there's probably more
> questions I don't even know to ask yet, but you got to start
> somewhere.

I believe this site has sufficient info to de-mystify most of this:
http://bugs.php.net

You may have a rather steep learning curve if you've never installed
any Un*x software from source...

To address your specific questions:

--enable-debug is a flag you would pass to ./configure along with
--enable-mysql and --enable-imap and any other fun extensions you use
to compile PHP from source.

A 'core' file is generally dumped into the directory you started in
when you run a program... When Apache is started up and forks off
children and all that, this becomes a bit murky. Fortunately, you can
start Apache in "single user" (?) mode with -S at startup, and then
you can "surf" to the one and only Apache child, and almost-for-sure,
your core dump will be right there in the directory where you started,
or maybe in Apache's bin directory. But somewhere where you would
expect to find it.

You may also want to check with the Suhosin folks before you post a
bug to bugs.php.net, as the first response at bugs.php.net is to take
Suhosin out of the picture and see if the segfault still happens --
They really can't do much about it if Suhosin added in code that
"broke" things...

There may also be others using Horde/IMP who have posted similar
experiences in Horde/IMP forums/lists/etc.

Good luck!

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

attached mail follows:


First my problem, then a tiny bit of background information.

I am trying to start a small (Read: Tiny) web development company from home,
which will handle only a few light contracts. I have been spending some time
searching Google for common documents used by developers and their clients
to help layout all the goals and features the site might have. Unfortunately
since I have not obtained any formal education, I am experiencing a slight
fish-out-of-water syndrome, and am not even sure of the names of the
documents I am seeking. I would be eternally grateful if some experienced
developers would point me in the right direction; any documents related to
planning the website, contracts, really anything would be considered useful.

Now a little background, I am a stay at home father, with the majority of my
daily duties centralized around wiping feces from the rear end of a young
boy, feeding, and teaching. I don't have the time, money, nor resources to
go to school for this, but am quite happy reading about web development
whenever I get the opportunity (often 3-6 hours daily). I have what I
believe to be a solid understanding of PHP, MySQL and Javascript basics, as
well as w3c compliant HTML, and CSS. Currently I am spending some time
studying the CakePHP framework. I also have a (very) basic understanding of
XSS attacks, and SQL injections techniques and am working on improving this.

I welcome ALL advice, even if it is not related to my initial question
(Developer / Client documents) especially if the responder is, or was, a
stay at home parent. However advice from anyone would be greatly welcomed,
regardless of prior experiences.

--
---------------------------------
Anthony Hiscox

Video Watch Group
Public Site Currently Under Development
Group Members Site Fully Operational
---------------------------------

attached mail follows:


>
> I am trying to start a small (Read: Tiny) web development company from
> home,
> which will handle only a few light contracts. I have been spending some
> time
> searching Google for common documents used by developers and their clients
> to help layout all the goals and features the site might have.
> Unfortunately
> since I have not obtained any formal education, I am experiencing a slight
> fish-out-of-water syndrome, and am not even sure of the names of the
> documents I am seeking. I would be eternally grateful if some experienced
> developers would point me in the right direction; any documents related to
> planning the website, contracts, really anything would be considered
> useful.
>

What you are looking for are project development and project management
books that describe how projects are organized, documented, etc...

First, google "design patterns gang of four"
Second, visit
http://trac.seagullproject.org/wiki/Standards/SoftwareBestPractices
Third, look at: http://trac.seagullproject.org/wiki/Standards
Fourth, visit: http://www.oreilly.com/pub/topic/projectmanagement
    and http://www.oreilly.com/pub/topic/designpatterns

Also, I might suggest:

http://www.oreilly.com/catalog/webdbapps2/

This will give you most of what you're looking for. Think XAMPP for a
localhost install to run tests, and MySQL for a database backend (part of
XAMPP):

http://www.apachefriends.org/en/xampp.html

It will take time. Good luck!

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


On Thu, May 24, 2007 2:37 pm, Al wrote:
> Can anyone explain what's going on.
>
> If I assign $source= $source_dir . $file;
> $source_dir is the absolute path i.e.,
> /home/xxxxx/public_html/EditPage/
>
> And $dist= $dist_dir . $file;
> $dist_dir is simply relative to $_SERVER[document_root]; i.e., just
> plain /test
>
> To get ftp_put() to work, I must first chdir to the $dist_dir.
>
> ftp_chdir($dist_dir);
> ftp_put($conn_id, $dist, $source, flag];

Similar to 'document_root', FTP has its own idea of where a "root"
directory is for each login/user.

In your case, it would appear by coincidence to match up with
'document_root' -- well, perhaps not "coincidence" since many webhosts
restrict their users' FTP accounts to only be their own web
directories, so they can't go poking around in other people's stuff
quite as easily.

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

attached mail follows:


What puzzles me is that one path must be absolute and the other relative to the root. And, I've got chdir to the
destination dir.

I know about ftp having its own root. In my code, I have a check to make certain the ftp root is the same as the
$_SERVER[document_root].

Richard Lynch wrote:
>
> On Thu, May 24, 2007 2:37 pm, Al wrote:
>> Can anyone explain what's going on.
>>
>> If I assign $source= $source_dir . $file;
>> $source_dir is the absolute path i.e.,
>> /home/xxxxx/public_html/EditPage/
>>
>> And $dist= $dist_dir . $file;
>> $dist_dir is simply relative to $_SERVER[document_root]; i.e., just
>> plain /test
>>
>> To get ftp_put() to work, I must first chdir to the $dist_dir.
>>
>> ftp_chdir($dist_dir);
>> ftp_put($conn_id, $dist, $source, flag];
>
> Similar to 'document_root', FTP has its own idea of where a "root"
> directory is for each login/user.
>
> In your case, it would appear by coincidence to match up with
> 'document_root' -- well, perhaps not "coincidence" since many webhosts
> restrict their users' FTP accounts to only be their own web
> directories, so they can't go poking around in other people's stuff
> quite as easily.
>

attached mail follows:


Yes, prepared statements protect from SQL injection because the "data"
is clearly separated from the SQL code, and MySQL knows what to do
with "data"

The rest of your code has absolutely NOTHING to do with SQL injection,
but with data validation and business logic.

On Thu, May 24, 2007 11:10 am, Jason Pruim wrote:
> I think I have found away to prevent SQL code injection into my
> database and just wanted to get everyones comments on my method.

> //Create the statement
> $stmt = mysqli_prepare($link, "INSERT INTO current VALUES
> (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
> mysqli_stmt_bind_param($stmt, 'sssssssssssssss', $FName, $LName,
> $Add1, $Add2, $City, $State, $Zip, $Date, $Record, $subName,
> $subEmail, $subPhone, $chkMember, $chkAdd, $chkDel);
> //Add the record
> mysqli_stmt_execute($stmt);

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

attached mail follows:


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 seam to get it to work. Anyone with
> some example code that does the same thing?
>
>
> =========
>
> More complex description
>
> I have some scripts (perl, c, php, or anything else) that simple
> independent scripts that do some stuff and output STDOUT and STDERR
> and exit with an exitcode. There scripts will be kept like this, and
> will not change their behavior.
>
> Now I need to control them and also log their STDOUT, STDERR and
> exitcode. Ok, that far I have come, so that I am logging the STDOUT,
> STDERR and exitcode. What I am doing is that I have created an
> executer that takes care of this and writing it to DB.
>
> Now I need to add a functionality so that when the executer receives a
> SIGTERM signal it should kill the script (that was started with a
> exec() call, and then log some information to the DB (that the script
> was killed etc).
>
> I have registered the signal SIGTERM with pcntl_signal(SIGTERM,
> "sig_handler"). When I am testing I just write some info to a file
> when the signal is received. I created a simple testing script with a
> while(true) loop and then send the signal to the script and it
> successfully writes the information to the logflie.
>
> Ok, now I instead of a while(true) loop make an exec() call to a
> script (that is running for ever) and send the signal, then it does
> not write to the file as it is supposed to. I guess it is because the
> script is busy running the exec command.
>
> I tried to then exec() it in the background. The problem there is that
> it becomes a daemon and then I cannot know what that script is doing,
> and it will not send any SIGCHLD to the parent, or it does, but to
> init. Or actually there will be a SIGCHLD sent, as the exec() will
> open its own shell, and then the shell will exit and we get the
> SIGCHLD from the shell instead of the executed script.
>
> Is there any way to get the "child" process PID when you exec() and
> send it to the background? But then, how can I capture the exitcode?
> The STDERR and STDOUT is fine as I can direct it to a file and get it
> from there.
>
> I have a really ugly workarounds: I could append an dummy variable to
> the execution of the script and then do a grep of the ps -ef to get
> the PID of that script.
>
> /Peter
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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

attached mail follows:


On Thu, May 24, 2007 6:23 am, Jean-Christophe Roux wrote:
> Hello,
> I have folder A with the following php script:
> <?php
> session_start();
> $_SESSION['dummy']=10;
> echo $_SESSION['dummy'];
> ?>
> in folder B (same level as A), there is
> <?php
> session_start();
> echo $_SESSION['dummy'];
> ?>
> when running the script in B, in can see the value 10. How can I make
> sure that the $_SESSION['dummy'] is not shared between the two
> scripts? I could change the name but that would not be convenient.

http://php.net/sesssion_set_cookie_params
Second arg can be set to '/A' in folder A and '/B' in folder B and the
session will not cross that border.

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

attached mail follows:


On Thu, May 24, 2007 7:44 am, Stut wrote:
> Darren Whitlen wrote:
>> Stut..
>> I've only been here one day, and I think I'm right in saying that
>> your
>> the one around here that gets annoyed really easy ;)
>
> Not really, I just tend to be a bit more vocal about it.

I daresay every regular has vented one time or another about their own
pet peeves...

Except me, of course, whose every post is on-topic and not at all biased.
:-)

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

attached mail follows:


Richard Lynch wrote:
> On Thu, May 24, 2007 7:44 am, Stut wrote:
>> Darren Whitlen wrote:
>>> Stut..
>>> I've only been here one day, and I think I'm right in saying that
>>> your
>>> the one around here that gets annoyed really easy ;)
>> Not really, I just tend to be a bit more vocal about it.
>
> I daresay every regular has vented one time or another about their own
> pet peeves...
>
> Except me, of course, whose every post is on-topic and not at all biased.
> :-)

Nicely contradicted yourself there. Colour me impressed! ;)

-Stut

attached mail follows:


On Thu, May 24, 2007 4:50 pm, Stut wrote:
> Richard Lynch wrote:
>> On Thu, May 24, 2007 7:44 am, Stut wrote:
>>> Darren Whitlen wrote:
>>>> Stut..
>>>> I've only been here one day, and I think I'm right in saying that
>>>> your
>>>> the one around here that gets annoyed really easy ;)
>>> Not really, I just tend to be a bit more vocal about it.
>>
>> I daresay every regular has vented one time or another about their
>> own
>> pet peeves...
>>
>> Except me, of course, whose every post is on-topic and not at all
>> biased.
>> :-)
>
> Nicely contradicted yourself there. Colour me impressed! ;)

tongue was planted firmly in cheek...

One dude made me a button with "got rant" on it as a direct result of
my posts here... :-)

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

attached mail follows:


On Wed, May 23, 2007 11:42 pm, wisuttorn wrote:
>
> I have a problem please help me
> when i loged in to egroup this show "
> Database error: Invalid SQL: SELECT DISTINCT
> egw_cal_repeats.*,egw_cal.*,cal_start,cal_end,cal_recur_date FROM
> egw_cal
> JOIN egw_cal_dates ON egw_cal.cal_id=egw_cal_dates.cal_id JOIN
> egw_cal_user
> ON egw_cal.cal_id=egw_cal_user.cal_id LEFT JOIN egw_cal_repeats ON
> egw_cal.cal_id=egw_cal_repeats.cal_id WHERE (cal_user_type='u' AND
> cal_user_id IN (6,-1)) AND cal_status != 'R' AND 1179939600 < cal_end
> AND
> cal_start < 1180025999 AND (recur_type IS NULL AND cal_recur_date=0 OR
> cal_recur_date=cal_start) ORDER BY cal_start
> mysql Error: 1064 (You have an error in your SQL syntax near 'ON
> egw_cal.cal_id=egw_cal_dates.cal_id JOIN egw_cal_user ON
> egw_cal.cal_id=egw_c' at line 1)

This is an SQL error.

Ask an SQL list.

At a guess, I'd say the version of SQL you have doesn't support all
JOIN types.

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

attached mail follows:


On Wed, May 23, 2007 9:59 pm, James Lockie wrote:
> I get a syntax error on strlen.
>
>
> $newTypes = array();
> $newTypes[0] = array();
> $newTypes[0][0] = "Starting with"
> $newTypes[0][1] = strlen( $newTypes[0][0] );

If you are missing the ; in the line before, PHP gets pretty confused
and tries to smush the two lines together, essentially, and then...

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

attached mail follows:


Micky Hulse wrote:
> Looks like you are missing a comma on line 3.

Doi, meant "semi-colon", not comma... Lol.

Also, when I get PHP errors, if not obvious, I check the previous line
also... If says something like "error on line 7" I will look at both
line six and seven.

Of course, depends on error message. Yadda yadda... I still feel like a
dork for saying comma.

Hehe,
Cheers
M

--
Wishlists: <http://snipurl.com/1gqpj>
    Switch: <http://browsehappy.com/>
      BCC?: <http://snipurl.com/w6f8>
        My: <http://del.icio.us/mhulse>

attached mail follows:


> Also, when I get PHP errors, if not obvious, I check the previous line
> also... If says something like "error on line 7" I will look at both
> line six and seven.

I used the notepad-error-of-death method:

1. Use only notepad for php scripting (or some BASIC text editor, with
exactly ONE undo).
2. Author horrid script without thinking.
3. Upload and cringe on blank white screen effect of ill-advised code
manipulation.
4. Figure out how to change code by slowing down and using Notepad's undo
(remember, ONE undo, and then you undo the undo) to make less-stupid
mistakes or omissions.

Pretty impractical for professional programming, but sure helped me out. At
least I make deliberately bad decisions now, instead of wholly ignorant
ones. At least not a whole string of them at one time.

> Of course, depends on error message. Yadda yadda... I still feel like a
> dork for saying comma.

Well, I got a chuckle. :D

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


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.

attached mail follows:


Hi All

Let me start by saying I am not 100% sure this
is the correct board to post this to. I hope it is
because as i have watched this list it contains
some very helpful people.

I have search for an answer to this and cannot
seem to find it. We have a subscription based
site that is developed mainly with php and mysql.
We have one person who each time he attempts
to log in it just rolls back to the login page. With
almost 2000 users this is the only time we have
come across this problem. He is not running your
average system at his home the details are.

Operating system is Ubuntu 7.04 released in April 2007
  also using Firefox Version 2.0.03
Mozilla/5.0 (x11; U; Linusi686; en-US;rv:1.8.13) Gecko/200611201
Firefox/ 2.0.0.3 (Ubuntu-feisty)

I can login using firefox and ie no problem but am running a
more common windows system. Is there something on our
end that could be causing this problem for him?

Thanks in advance
Rich

attached mail follows:


Rich Peterson wrote:
> Hi All
>
> Let me start by saying I am not 100% sure this
> is the correct board to post this to. I hope it is
> because as i have watched this list it contains
> some very helpful people.
>
> I have search for an answer to this and cannot
> seem to find it. We have a subscription based
> site that is developed mainly with php and mysql.
> We have one person who each time he attempts
> to log in it just rolls back to the login page. With
> almost 2000 users this is the only time we have
> come across this problem. He is not running your
> average system at his home the details are.
>
> Operating system is Ubuntu 7.04 released in April 2007
> also using Firefox Version 2.0.03
> Mozilla/5.0 (x11; U; Linusi686; en-US;rv:1.8.13) Gecko/200611201
> Firefox/ 2.0.0.3 (Ubuntu-feisty)
>
>
> I can login using firefox and ie no problem but am running a
> more common windows system. Is there something on our
> end that could be causing this problem for him?

How does the login work? Is it cookie based? Does this user have cookies
enabled? Does it do daft things like check the user agent? Have you
looked for the piece of code that would take the user back to the login
page and debugged it to see why that's happening?

Etc.

-Stut

attached mail follows:


On Thu, May 24, 2007 4:51 pm, Rich Peterson wrote:
> Let me start by saying I am not 100% sure this
> is the correct board to post this to. I hope it is
> because as i have watched this list it contains
> some very helpful people.
>
> I have search for an answer to this and cannot
> seem to find it. We have a subscription based
> site that is developed mainly with php and mysql.
> We have one person who each time he attempts
> to log in it just rolls back to the login page. With
> almost 2000 users this is the only time we have
> come across this problem. He is not running your
> average system at his home the details are.
>
> Operating system is Ubuntu 7.04 released in April 2007
> also using Firefox Version 2.0.03
> Mozilla/5.0 (x11; U; Linusi686; en-US;rv:1.8.13) Gecko/200611201
> Firefox/ 2.0.0.3 (Ubuntu-feisty)
>
>
> I can login using firefox and ie no problem but am running a
> more common windows system. Is there something on our
> end that could be causing this problem for him?

There are several/many things it COULD be...

First Guess:

header("Location: logged_in_page.php");

Some versions of IE will figure out what you meant with the above
WRONG code, but will NOT carry the Cookie for your session along with
it, so you're bounced back as if you never had a Cookie, even though
you did.

Use a full URI like you're supposed to for Location: and all is well.

The problem user may also have refused Cookies which are probably
being used for your session login to ID the user, and then they can
never login.

I also have long suspected that some versions of IE in some common
settings of their goofy "security" levels will not work unless your
server kicks out those ill-designed p3p headers, but have never taken
the time to prove/test/disprove this hypothesis.

Asking the user to switch to Firefox is just soooo much more
satisfying in the long run than trying to cater to IE broken-ness...
:-)

YMMV

There are probably a dozen things more that could be going wrong...
You'll have to dig deeper into what's happening to find out.

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

attached mail follows:


Richard Lynch wrote:
> There are several/many things it COULD be...
>
> First Guess:
>
> header("Location: logged_in_page.php");
>
> Some versions of IE will figure out what you meant with the above
> WRONG code, but will NOT carry the Cookie for your session along with
> it, so you're bounced back as if you never had a Cookie, even though
> you did.
>
> Use a full URI like you're supposed to for Location: and all is well.
>
> The problem user may also have refused Cookies which are probably
> being used for your session login to ID the user, and then they can
> never login.
>
> I also have long suspected that some versions of IE in some common
> settings of their goofy "security" levels will not work unless your
> server kicks out those ill-designed p3p headers, but have never taken
> the time to prove/test/disprove this hypothesis.
>
> Asking the user to switch to Firefox is just soooo much more
> satisfying in the long run than trying to cater to IE broken-ness...
> :-)
>
> YMMV
>
> There are probably a dozen things more that could be going wrong...
> You'll have to dig deeper into what's happening to find out.

I've just gotta ask which part of the following made you think IE...

> Operating system is Ubuntu 7.04 released in April 2007
> also using Firefox Version 2.0.03
> Mozilla/5.0 (x11; U; Linusi686; en-US;rv:1.8.13) Gecko/200611201
> Firefox/ 2.0.0.3 (Ubuntu-feisty)

Or were you just in the mood to continue your rant against MS products?

And I must congratulate you on the suggestion that the user switches
from Firefox to Firefox. Inspired advice there! :D

-Stut

attached mail follows:


On Thu, May 24, 2007 6:04 pm, Stut wrote:
> Richard Lynch wrote:
>> There are probably a dozen things more that could be going wrong...
>> You'll have to dig deeper into what's happening to find out.
>
> I've just gotta ask which part of the following made you think IE...
>
> > Operating system is Ubuntu 7.04 released in April 2007
> > also using Firefox Version 2.0.03
> > Mozilla/5.0 (x11; U; Linusi686; en-US;rv:1.8.13) Gecko/200611201
> > Firefox/ 2.0.0.3 (Ubuntu-feisty)
>
> Or were you just in the mood to continue your rant against MS
> products?

My fault -- I mis-read the post to think he was describing the
"working" User Agent and that the problem child was IE.

I can't imagine why I'd think IE was the broken one...

:-)

Most likely, the user has refused cookies, though it could be a
Firefox bug, of course.

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

attached mail follows:


On Wed, May 23, 2007 3:48 pm, Stephen wrote:
> 1) Does the filename extension matter? I prefer *.inc? It seems to
> work fine, but I only see others using *.php

From a strictly "will it work" stand-point, the extension can be
anything you want or none at all.

HOWEVER, there are various security code privacy issues revolving
around the chosen extension.

The point being that you probably don't want your code exposed to the
world, nor executed out of context, most likely.

Some will configure Apache to not serve up .inc files.

Others will add .php on the end, and [try to] make sure that the code
does nothing "bad" if executed out of context.

I personally think one should just move the include files out of the
web tree and use http://php.net/set_include_path (or similar php.ini
settings) to make it impossible for the code to have any chance at all
of being served up as plain text or getting executed out of sequence.

> 2) Does the include file need an opening <?php and ending ?> ?

Yes.

PHP jumps back to HTML "mode" for each include file, because Rasmus
liked it that way back in 1995... Or he couldn't figure out how to
make it work the other way around... Or whatever. It is the way it
is.

And technically, the closing ?> is optional, which some consider a
Feature. YMMV

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

attached mail follows:


On Wed, May 23, 2007 3:36 pm, Brett Davidson wrote:
> Platform : FreeBSD 6.2 Release with Apache 2.0.59 running PHP 5.2.1_3
> CGI under SuExec in FastCGI mode.
>
> Issue: move_uploaded_file ALWAYS crfeates uploaded files with Unix
> permissions 600 (read and write for user only) regardless of
> ownership,
> directory or umask settings.

Regardless of all those settings in what context/environment?...

Are you using http://php.net/umask and/or chmod?

PHP runs in the environment you've defined in SuExec and FCGI. Which
I got NO IDEA how that all works, but presumably there are
configuration settings within those.

> This works fine with php installed as a module.

Well, yeah, as a Module you're in an entirely different
context/environment. That's kinda the whole POINT of SuExec in the
first place -- to change the user and their environment for the
execution of the script.

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

attached mail follows:


Richard Lynch wrote:
> On Wed, May 23, 2007 3:36 pm, Brett Davidson wrote:
>
>> Platform : FreeBSD 6.2 Release with Apache 2.0.59 running PHP 5.2.1_3
>> CGI under SuExec in FastCGI mode.
>>
>> Issue: move_uploaded_file ALWAYS crfeates uploaded files with Unix
>> permissions 600 (read and write for user only) regardless of
>> ownership,
>> directory or umask settings.
>>
>
> Regardless of all those settings in what context/environment?...
>
> Are you using http://php.net/umask and/or chmod?
>
> PHP runs in the environment you've defined in SuExec and FCGI. Which
> I got NO IDEA how that all works, but presumably there are
> configuration settings within those.
>
>
>> This works fine with php installed as a module.
>>
>
> Well, yeah, as a Module you're in an entirely different
> context/environment. That's kinda the whole POINT of SuExec in the
> first place -- to change the user and their environment for the
> execution of the script.
>
>

Belay all of this!

Problem is not in php - it's in suexec. Just installed Ruby on rails
under fcgid and am having the same issue. :-(

Thanks for your reply (which came in just as I was typing this). :-)

Brett.

attached mail follows:


On Wed, May 23, 2007 1:46 pm, Rahul Sitaram Johari wrote:
> Apache 2.2, PHP5 & mySQL 5 on Windows 2003.
> I have some files sitting on a Network Drive accessible on the Windows
> 2003
> Server. But my php script is not able to open the files.
>
> Letıs say thereıs a database on X:\Transfer\test.dbf
> If I use:
>
> $db = dbase_open(³X:\Transfer\test.dbf², 0);
>
> It is not able to open the database. The X: Drive is a network drive.
> Any clues on how to make this happen?

Check permissions on that drive/share/file/directory?...

Google for "PHP Network Drive" and see if others have the same problem.

For all I know, the dang thing is just broken. It is Windows, after
all. :-)

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

attached mail follows:


On Thu, May 24, 2007 10:29 am, Rahul Sitaram Johari wrote:
>
> You may have something here.
> Problem is, I donıt know how to mess with how & under what user Apache
> is
> running ­ and no one else here does either so basically I have to
> figure
> this one out! I would like to, as you suggested, try and ³get Apache
> to run
> as a service under a user that can access the network resource².

http://php.net/phpinfo

This should at least tell you what User PHP thinks it is running as.

You would change that in httpd.conf User directive on a Un*x box, and
that may also work on Windows.

There is also that whole "Service" GUI junk in Windows that may
overlay the httpd.conf settings, or not... That's just a question of
opening up interminible dialogs and clicking around until it works,
like all of Windows.

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

attached mail follows:


On Thu, May 24, 2007 10:43 am, Jared Farrish wrote:
> For the advanced PHP gurus on the list, is it accurate to characterize
> PHP
> as relying on Apache for file manipulation? Is it accurately described
> as:
>
> Process Request->PHP->Apache->[File System
> Poof!]->Apache->PHP->Process

This *might* be correct with PHP as an Apache Module, but I doubt it.

I think it's more like:

Whatever -> PHP -> stdio.h File System calls

"Whatever" will affect what user is running PHP and thus what
permissions they have, but that's about it.

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

attached mail follows:


On 5/24/07, Richard Lynch <ceol-i-e.com> wrote:
>
> On Wed, May 23, 2007 1:46 pm, Rahul Sitaram Johari wrote:
> > Apache 2.2, PHP5 & mySQL 5 on Windows 2003.
> > I have some files sitting on a Network Drive accessible on the Windows
> > 2003
> > Server. But my php script is not able to open the files.
> >
> > Letıs say thereıs a database on X:\Transfer\test.dbf
> > If I use:
> >
> > $db = dbase_open(³X:\Transfer\test.dbf², 0);
> >
> > It is not able to open the database. The X: Drive is a network drive.
> > Any clues on how to make this happen?
>
> Check permissions on that drive/share/file/directory?...
>
> Google for "PHP Network Drive" and see if others have the same problem.
>
> For all I know, the dang thing is just broken. It is Windows, after
> all. :-)

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:


>
> This *might* be correct with PHP as an Apache Module, but I doubt it.
>
> I think it's more like:
>
> Whatever -> PHP -> stdio.h File System calls
>
> "Whatever" will affect what user is running PHP and thus what
> permissions they have, but that's about it.
>

Is it then:

Whatever['Apache.exe'] (owns) System Process (which) Requests (using)
stdio.h

How/what determines the active process that is requesting the directive (and
matches access privileges)?

If PHP is running in CLI, I could see how this might be seen as a different
process, but I'm fuzzy about file permissions extended through primary
processes (such as Apache using an executable)... The whole apache GUID mess
seems like cryptic middle ages eye gouging...

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


On Thu, May 24, 2007 5:29 pm, Jared Farrish wrote:
>>
>> This *might* be correct with PHP as an Apache Module, but I doubt
>> it.
>>
>> I think it's more like:
>>
>> Whatever -> PHP -> stdio.h File System calls
>>
>> "Whatever" will affect what user is running PHP and thus what
>> permissions they have, but that's about it.
>>
>
> Is it then:
>
> Whatever['Apache.exe'] (owns) System Process (which) Requests (using)
> stdio.h

I dunno what the heck is "System Process"...

If "System Process" means "Operating System" then, yes, sort of,
except that Apache doesn't "own" the OS, so that's not making sense...

> How/what determines the active process that is requesting the
> directive (and
> matches access privileges)?

Does Windows care what PROCESS is accessing the file, or does it care
what USER running that process is accessing the file?...

If Windows denies access to user X running process P, but grants
access to user X running process Q, then it's even more messed up than
I thought, and that was pretty friggin messed up to start with...

> If PHP is running in CLI, I could see how this might be seen as a
> different
> process, but I'm fuzzy about file permissions extended through primary
> processes (such as Apache using an executable)... The whole apache
> GUID mess
> seems like cryptic middle ages eye gouging...

Apache starts up as "root" process to do some god-like things and then
immediately changes its user-ness to the setting in httpd.conf and
spawns off its children after that.

How that interacts with the goofy Windows "Services" and settings in
those interminible dialogs about which user runs which Service is
beyond me...

I can only guess that the Services User starts Apache initially, which
then changes itself to the httpd.conf User before PHP enters into the
picture.

So whatever you choose for the Services User only matters for the
first few nano-seconds of Apache's life, and httpd.conf User is what
matters after that...

But that's just a GUESS not really using Windows all that much, and
certainly not understanding the various Windows "security" (cough
cough) models over the years.

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

attached mail follows:


Richard Lynch wrote:
> Apache starts up as "root" process to do some god-like things and then
> immediately changes its user-ness to the setting in httpd.conf and
> spawns off its children after that.

Not under Win32 it doesn't.

> How that interacts with the goofy Windows "Services" and settings in
> those interminible dialogs about which user runs which Service is
> beyond me...
>
> I can only guess that the Services User starts Apache initially, which
> then changes itself to the httpd.conf User before PHP enters into the
> picture.
>
> So whatever you choose for the Services User only matters for the
> first few nano-seconds of Apache's life, and httpd.conf User is what
> matters after that...
>
> But that's just a GUESS not really using Windows all that much, and
> certainly not understanding the various Windows "security" (cough
> cough) models over the years.

Apache does no user switching under Windows. Whatever user the service
is configured to run as is the user it stays running as. The user/group
settings in httpd.conf are ignored under Windows.

Where I think the OP is falling down is that by default services *do not
have access to network resources*. So all (s)he needs to do is change
the user that the service runs as to a real user instead of LOCALSYSTEM
which is the default. However, the user should be aware that this is
considered a fairly major security hole unless you create a user
specifically for this purpose and lock it down so it can only get at
what it needs.

All of which is beyond the scope of this list and should probably be
directed at an Apache list, or my billing email address!!

-Stut

attached mail follows:


On 5/24/07, Rahul Sitaram Johari <sleepwalkerrahulsjohari.com> wrote:
>
> You may have something here.
> Problem is, I donıt know how to mess with how & under what user Apache is
> running ­ and no one else here does either so basically I have to figure
> this one out! I would like to, as you suggested, try and ³get Apache to run
> as a service under a user that can access the network resource².
>
> I definitely agree about using non-mapped addresses and using the actual
> Server Name addresses.

Ok, I don't know a lot of Apache & PHP under Windows, but did you try
to run the script through the PHP CLI? If you start your script
through the CLI it will run as the user you're currently working in,
so make sure you're logged in as Administrator, and then try running
it through the CLI. If you don't know how to do that, I believe you
should open a command line with start->run type "cmd" (without "") and
press enter. Then you should do a few cd commands to go to the actual
directory where php.exe is. Then you should type php.exe
C:/Full/Path/To/File.php

If it runs this way, then you're probably sure it is a permission
issue. I would recommend to use the code you posted on May 24, 2007
4:35 PM.

Tijnema
>
>
> On 5/24/07 11:24 AM, "Jared Farrish" <farrishjgmail.com> wrote:
> >
> Are you running Apache under a different (non-privileged) account on the
> Win2003 machine? If Apache is running as a service with a different username
> (with no extended access to network resources), you will need to get Apache
> to run as a service under a user that can access the network resource. And I
> still think you should use non-mapped addresses instead of mapped addresses,
> since a mapping is just a localized version of a resource name alias.
>
> If, after determing that Apache is running with the right permissions for
> the owned processes to connect to and use a network shared resource, then
> it's probably an Apache UID conflict (is PHP in safe mode?).
>
>
>

attached mail follows:


On Wed, May 23, 2007 11:45 am, Mike Ryan wrote:
> I am reading in a date field from a mysql database the field on the
> screen
> shows up as 2007-05-01 on the screen I would like the field to show
> 05-01-2007 currently I am issueing the following command print
> $row['open']; how can I format this field???
>
> while I am at it how can I accept the date field as 05-01-2007;

http://dev.mysql.com/

Search "date_format" will answer the first one.

The seocnd is probably a configurable setting at mysql startup, but
I'd be leery of altering that...

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

attached mail follows:


On Wed, May 23, 2007 11:40 am, Stephen wrote:
> I have a script to process the post from a form.
>
> The form is used to upload photos and has fields for the filename,
> alt text, caption and a checkbox to indicate if this photo is the
> main page image rotation.
>
> I wanted to build a general routine to build the form to allow for a
> varying number of photos to upload.
>
> I use main_image[] for the various checkboxes for each photo.
>
> I see that the checkbox is *not* set, I get nothing back, and if the
> second photo is checked (and the first not checked), I get
> main_image[0] = 'on'.
>
> And I see this happens for the caption[] array as well.
>
> This seems to me to be pretty ugly.
>
> Am I understanding this properly?
>
> Do I really have to use main_image1, main_image2....

No.

You can use:
name="main_image[0]"
name="main_image[1]"
name="caption[0]"
name="caption[1]"

and the keys will be pre-set by the HTML to make sense of your data
structures.

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

attached mail follows:


On Wed, May 23, 2007 9:58 am, Greg Donald wrote:
> Has anyone looked at the Zend Framework lately?
>
> http://framework.zend.com/manual
>
> I've been playing with a few parts of it off and on the past couple of
> days. It seems really heavy overall and there is no Javascript
> integration anywhere. Nothing on the roadmap about Javascript either:
>
> http://framework.zend.com/roadmap
>
> It might be worth using if it actually did something better than my
> current toolset. Right now it really doesn't.

Has anyone driven a Ford lately?

http://ford.com

I've been test driving a few of them off and on the past couple of
days. It seems really heavy overall and...

If you don't find anything useful in the Zend stuff, don't use it.

I just use "vi" but I daresay that doesn't mean you should.

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

attached mail follows:


Richard Lynch wrote:
> On Wed, May 23, 2007 9:58 am, Greg Donald wrote:
>> Has anyone looked at the Zend Framework lately?
>>
>> http://framework.zend.com/manual
>>
>> I've been playing with a few parts of it off and on the past couple of
>> days. It seems really heavy overall and there is no Javascript
>> integration anywhere. Nothing on the roadmap about Javascript either:
>>
>> http://framework.zend.com/roadmap
>>
>> It might be worth using if it actually did something better than my
>> current toolset. Right now it really doesn't.
>
> Has anyone driven a Ford lately?
>
> http://ford.com
>
> I've been test driving a few of them off and on the past couple of
> days. It seems really heavy overall and...

one thing Zend Framework has over your average [american] Ford is the
fact that it doesn't come fitted with an earth-destroying, war-inducing
5+ liter power source.

sorry, couldn't help myself.

>
> If you don't find anything useful in the Zend stuff, don't use it.
>
> I just use "vi" but I daresay that doesn't mean you should.
>

attached mail follows:


On Wed, May 23, 2007 9:24 am, Dan Shirah wrote:
> Okay, I think I'm doing everything right, but for whatever reason my
> include
> isn't working.
>
> <?php
> echo $_POST['status_code'];

Perhaps there is some whitespace before/after the 'C'...

echo "'$_POST[status_code]'<br />\n";

You should then see some whitespace inside the '' so you'll know it's
there.

This is a VERY good debugging technique to adopt. :-)

> if ($_POST['status_code'] = "C") {

echo "GOT HERE!<br />";

This can distinguish between 2 possible issues: Your business logic
about "C" or the include "not working"

> include ('complete_save.php');
> }
> ?>
>
> The echo of my status_code retruns the correct value so the if should
> trigger.
>
> This is my include page:
>
> <?php
>
> echo "test";
>
> ?>
>
> VERY simple, but for some reason is not working????

Also be sure you have error_reporting(E_ALL) set, so you are seeing
any errors.

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

attached mail follows:


On Wed, May 23, 2007 10:53 am, Daniel Brown wrote:
> don't need a space in your include command. Just type it out as if it
> were
> a function: include('complete_save.php');

You don't need the parens either -- It's NOT a function at all.

It's a language construct.

The space should probably be left in there without the parens.

And you'll have to duke it out with a zillion other developers about
whether to have a space or not between function name and paren, as I
don't care enough to argue it.

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

attached mail follows:


>
> Perhaps there is some whitespace before/after the 'C'...
>
> echo "'$_POST[status_code]'<br />\n";
>
> You should then see some whitespace inside the '' so you'll know it's
> there.
>
> This is a VERY good debugging technique to adopt. :-)
>

My own methodology is to use one of the following to peer into an array (of
any sort):

<code>
echo '<pre>';
print_r($_POST);
echo '</pre>';

echo '<pre>';
var_dump($_POST);
echo '</pre>';
</code>

Wrap one of those in a function or put it in a static class to call when
needed, and voila!, instant array introspection. Useful for $_GET, $_COOKIE,
$GLOBALS, $_SERVER, etc...

p.s.: Could you use descriptive subjects; include???? doesn't really say
much...

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


On Wed, May 23, 2007 7:41 am, kvigor wrote:

> if($value != 'Alabama' || $value!= 'AL' || $value != 'Alaska' ||

This mess will *ALWAYS* evaluate to TRUE, because the $value is ALWAYS
only one value, and thus the other 99 values are going to evaluate to
TRUE and you have || between them...

So you have:

TRUE || TRUE || TRUE || FALSE || TRUE || TRUE ... || TRUE

which is always gonna boil down to TRUE.

You wanted && instead of ||

Actually, it would be MUCH better imho to set up a couple arrays like:

$states = array('Alabama', 'Alaska', ...);
$sts = array('AL', 'AK', ...);

if (!isset($states[$value]) && !isset($sts[$value])){
  echo "Bad Dog!";
}

YMMV

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

attached mail follows:


On Wed, May 23, 2007 10:48 am, Robert Cummings wrote:
> On Wed, 2007-05-23 at 10:10 -0500, Greg Donald wrote:
>> On 5/23/07, kvigor <k3cheeseinsightbb.com> wrote:
>> > [-- SNIPPITY SNIP SNIP --]
>> > != 'Texas' || $value!= 'TX' || $value != 'Utah' || $value!= 'UT'
>> || $value
>> > != 'Vermont' || $value!= 'VT' || $value != 'Virginia' || $value!=
>> 'VA' ||
>> > $value != 'Washington' || $value!= 'WA' || $value != 'West
>> Virginia'
>> > ||$value!= 'WV' || $value != 'Wisconsin' || $value!= 'WI' ||
>> $value !=
>> > 'Wyoming' || $value!= 'WY') //if they don't the match these
>>
>> You should really look into learning in_array() for stuff like this.
>
> Wouldn't that slow things down and increase the memory footprint? ;)

Not in any meaningful way.

And a huge gain in maintainability/readability for a meaningless loss
in performance is a "win"

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

attached mail follows:


On Thu, 2007-05-24 at 17:58 -0500, Richard Lynch wrote:
>
> On Wed, May 23, 2007 10:48 am, Robert Cummings wrote:
> > On Wed, 2007-05-23 at 10:10 -0500, Greg Donald wrote:
> >> On 5/23/07, kvigor <k3cheeseinsightbb.com> wrote:
> >> > [-- SNIPPITY SNIP SNIP --]
> >> > != 'Texas' || $value!= 'TX' || $value != 'Utah' || $value!= 'UT'
> >> || $value
> >> > != 'Vermont' || $value!= 'VT' || $value != 'Virginia' || $value!=
> >> 'VA' ||
> >> > $value != 'Washington' || $value!= 'WA' || $value != 'West
> >> Virginia'
> >> > ||$value!= 'WV' || $value != 'Wisconsin' || $value!= 'WI' ||
> >> $value !=
> >> > 'Wyoming' || $value!= 'WY') //if they don't the match these
> >>
> >> You should really look into learning in_array() for stuff like this.
> >
> > Wouldn't that slow things down and increase the memory footprint? ;)
>
> Not in any meaningful way.
>
> And a huge gain in maintainability/readability for a meaningless loss
> in performance is a "win"

*lol* You must have missed the other thread... hence the wink on the
end :)

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:


exec() will not return control to PHP to "listen" to SIGs until it is
done.

get testing2.php to background itself or tack " &" on to the end of
the exec command or...

On Wed, May 23, 2007 6:59 am, listsdwsasia.com wrote:
> Hi,
>
> I have this script testing.php that I run on a Linux machine thru the
> command line. In the end of the file you see two cases. One where it
> is just having a while(true) loop doing nothing, and the other calling
> an other script that is doing nothing but doesn't exit. When I send
> SIGTERM for the first case it does what it is supposed to do, but when
> sending SIGTERM to the other case it doesn't work.
>
> Might it be so that the signals cannot be handled if the script is
> busy creating its own process or similar? Because when executing it
> with case two doesn't leave the exec() part until the other script
> exits, and it will never exits.
>
> I try to send the signal with:
> # kill -s SIGTERM 24574
>
> The "ps -ef | grep testing.php | grep -v grep" looks like this as
> example:
> 500 24574 1 0 13:50 ? 00:00:00 /usr/bin/php
> ./testing.php
>
> Best regards,
> Peter Lauri
>
> Code:
>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> #!/usr/bin/php
> <?php
>
> declare(ticks = 1);
>
> $pid = pcntl_fork();
> if ($pid == -1) {
> die("could not fork");
> } else if ($pid) {
> exit(); // we are the parent
> } else {
> // we are the child
> }
>
> // detatch from the controlling terminal
> if (!posix_setsid()) {
> die("could not detach from terminal");
> }
>
> function sig_handle($signo) {
> switch($signo) {
> case SIGTERM:
> echo "I got the SIGTERM signal:".$signo."\n";
> break;
> case SIGCHLD:
> echo "I got the SIGCHLD signal:".$signo."\n";
> break;
> case SIGINT:
> echo "I got the SIGINT signal:".$signo."\n";
> break;
> }
> }
>
> pcntl_signal(SIGTERM, "sig_handle");
> pcntl_signal(SIGCHLD, "sig_handle");
> pcntl_signal(SIGINT, "sig_handle");
>
> //Case 1 with just a while loop is working
> //while(true) {
> //
> //}
>
> //Case 2 when executing the script testing2.php that also do a
> //infinite while loop does not work
> //exec("./testing2.php");
>
> ?>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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

attached mail follows:


On Wed, May 23, 2007 6:23 am, Chetan Graham wrote:
> Hi all,
> I am writing a script and need to eject the cd-rom drive at some
> point.
> Does anyone have an idea how to do this?
> This is a simple command isn't it?
> I greatly appreciate your help

If you need to eject the CD ROM drive on the same machine on which PHP
is running, a simple: exec("eject") might do the trick...

If you're trying to eject the CD ROM drive on my local box from your
server, ummm, no, you can't do that...

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

attached mail follows:


On Wed, May 23, 2007 6:07 am, kats Ant wrote:
> Hi all a i am running a windows 2003 server with IIS. I have created a
> php script that uploads a file to a server.
>
> in the server i have users and a user1 has permission to folder1,
> user2 has permissions to folder2. I want an administrator to run the
> script and upload a file to these foldes. how can the script access
> the folders that only various users have access?

Assuming 'administrator' is more or less like 'root', you could use
http://php.net/move_uploaded_file in the upload script to dump the
files into some staging directory, and record the meta-data about
which file belongs to whom and goes where in, say, a database.

You could then have a cron job ^H^H^H^H^H^H^H^H Scheduled Task run by
'administrator' to check the DB and shuffle files around and change
their permissions as needed.

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

attached mail follows:


On Wed, May 23, 2007 9:09 am, Bagus Nugroho wrote:
> I was trying to put embedded image on HTML Mail using PHP Mailer, my
> problem is my image does not located on filesystem but located within
> MySQL Server.
>
> How I can put image from database into HTML Mail.

Well, it's got to get attacehd to the email and assigned a cid: just
like any embedded image in HTML Enhanced (cough cough) email...

Where's the problem?...

I have no idea how PHP Mailer works, but it shouldn't be TOO hard to
track down where it adds in the file and gives it a cid: and hack that
to use MySQL instead of file-system.

Or, if it is, toss the file into a temporary location out of mysql and
then erase it after the email is composed and sent.

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

attached mail follows:


On Wed, May 23, 2007 3:52 am, Darren Whitlen wrote:
> Hi,
> I have a PHP script that reads and updates either a small file or a
> mysql database. This script is called from several places every .5
> seconds.

Errr. Okay.

Seems kind of frequent to me...

What/why is going on here?

You may get a MUCH better solution if you post the Big Picture.

> I would like to move this file to a variable for extra speed as the
> file
> is causing a few problems being accessed so many times.
> Is it possible to have a writeable variable that has the scope of
> EVERY
> script that is run through the parser?

Well, you have Sys V shared memory and shmget shared memory and...

http://php.net/shmop
http://php.net/sem
.
.
.

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

attached mail follows:


On Wed, May 23, 2007 4:08 am, Darren Whitlen wrote:
> Stut wrote:
>> Darren Whitlen wrote:
>>> I have a PHP script that reads and updates either a small file or a
>>> mysql database. This script is called from several places every .5
>>> seconds.
>>>
>>> I would like to move this file to a variable for extra speed as the
>>> file is causing a few problems being accessed so many times.
>>> Is it possible to have a writeable variable that has the scope of
>>> EVERY script that is run through the parser?
>>
>> Not really. Your options are basically 1) use the database instead
>> of
>> the file, or 2) try memcached (Google for it).
>>
>> -Stut
>
> Hmmm caching really isnt an option here as the data is always
> changing.
> Just a wild idea here.. would it cause major overhead if a script was
> to
> start a session, update some session vars, then switch to a common
> session_id that each script can access? Then use that session to store
> to my info.
> Would that cause any obvious problems?

The $_SESSION is coupled to the user/browser sending the ID back n
forth...

If you can hack things that run this script, I guess you could do
that, but all that does is use the file system that's already not
working, so I doubt it will help much.

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

attached mail follows:


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.

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?

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

attached mail follows:


On Wed, May 23, 2007 1:39 am, Angelo Zanetti wrote:
> Dear all.
>
> I have a script that is called by an AJAX popup. Now I use an image
> file to get the path of an image for an <img> tag
>
> eg:
>
> <img border="0" id="middleImage" name="middleImage" src="<? echo
> $getImageURL; ?>" >
>
>
> the $getImageURL is composed as follows:
>
> $getImageURL = "getImage.php?imageid=".
> $imageID."&height=275&width=375&quality=65";

This isn't valid HTML. The & should be changed to &amp; before the
browser tries to render them:

echo htmlentities($getImageURL);

> However when I look at the URL that gets sent its as follows:
>
> getImage.php?imageid=10&amp;height=275&amp;width=375&amp;quality=65

It seems VERY unlikely that this is what actually being requested, and
MUCH more likely that what you are viewing is post-processed to "fix"
the & to be &amp; for a browser output, which is what you should have
done way back when you sent it out...

Though it's POSSIBLE that something is trying to correct your mistake
above, far too late, and just making things worse rather than
better...

> Which is obviously incorrect.

Actually, it's not incorrect, most likely.

> $getImageURL = html_entity_decode("getImage.php?imageid=".
> $imageID."&height=275&width=375&quality=65");

This is most definetly wrong as it's going to try to decode things
that weren't html entities in the first place, and should have been.

So it's going 90 miles an hour in the exact opposite direction of
where it should...

> But that doesn't seem to be working. . . As the html_entity_decode
> should the &amp sign to the & sign?
>
> Am I going in the right direction or can anyone else let me know if
> there is something I am missing or should be doing?

Exactly what are you using to examing the Request URI which is showing
the &amp; bit?

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

attached mail follows:


On Tue, May 22, 2007 11:46 am, Bosky, Dave wrote:
> How can I convert the numerical day of week to the string version?
>
> Example, if the day of the week is 1 I would like to print out
> 'Sunday'.

$days = array(1=>'Sunday', 'Mondy', 'Tuesday', 'Wednesday',
'Thursday', 'Friday', 'Saturday');
echo $days[$dow];

You could also probably play games with date() function and mktime...

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

attached mail follows:


On Wed, May 23, 2007 5:25 am, Shannon Whitty wrote:
> THanks,
>
> I will have far to much data to append to a GET request so a POST is
> the
> best option I think.

Also consider RSS, REST, RPC and SOAP as long-term solutions with
increasing overhead/functionality.

These have the advantage of having standards and tons of toolkits
around instead of a custom-brewed client-server hack you may come up
with.

This all presumes you have control over the "success" outputting
server...

If not, you're stuck with scraping what they send, unless they offer
RSS, REST, RPC or SOAP.

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

attached mail follows:


On Wed, May 23, 2007 5:37 am, Shannon Whitty wrote:
> THanks,
>
> That's what I thought...
>
> I really only need to check for one value = "success" - anything else
> should
> redirect back to the form entry page and display whatever result has
> been
> returned from the remote site.
>
> cUrl should be able to differentiate between a connection and an
> application
> failure shouldn't it?
>
> The way I see it:
>
> 1: If I can connect to port80 THEN continue ELSE goto:6
> 2: If I get a response THEN continue ELSE goto:6
> 3: If response contains "result tags" THEN continue ELSE goto:6
> 4: If "result tags" contains "success" THEN goto:5 ELSE goto:7
> 5: Display "success" and finish
> 6: Display connection error and resort to email and finish
> 7: Reload form and display error returned within "result tags"

This looks right, though I won't swear to it with all the goto:s...

I'm more of an if/else kinda guy... :-)

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

attached mail follows:


On Tue, May 22, 2007 9:50 am, Al wrote:
> Can I assume that all ftp_connect()s will make the current dir the
> DOC_ROOT?

Probably not.

If I FTP connect to *my* webhosted servers, I'm put into a directory
which contains 'www' and 'php' and 'private' which are set up by the
host for 'DOCUMENT_ROOT' 'include_path' and 'openbase_dir'
respectively, as well as any other directories/files I chose to add
there.

It all depends how FTP and www server are configured, and they are not
tied at the hip by any means.

> If not, how can I insure the ftp root dir is the same as DOC_ROOT?

You'l