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 1 Dec 2005 04:33:27 -0000 Issue 3825

php-general-digest-helplists.php.net
Date: Wed Nov 30 2005 - 22:33:27 CST


php-general Digest 1 Dec 2005 04:33:27 -0000 Issue 3825

Topics (messages 226639 through 226674):

Re: Merging two images (GD & PNG)
        226639 by: Jochem Maas
        226643 by: Albert
        226651 by: Jochem Maas
        226652 by: Jochem Maas

Re: MVC platform choice.
        226640 by: Greg Donald

Re: checkboxes
        226641 by: Brent Baisley

PHP on Mobile Devices(Pocket PC specifically)
        226642 by: Kilbride, James
        226645 by: Jason Wong
        226650 by: Kilbride, James

XSS via curl
        226644 by: Sandy Keathley
        226646 by: Silvio Porcellana [tradeOver]
        226647 by: Jochem Maas
        226648 by: Chris Shiflett

Lowest PHP version to work with MySQL 4.1.x
        226649 by: AmirBehzad Eslami
        226662 by: Oliver Grätz
        226665 by: Brent Baisley

Re: Schroedinger's Bug - may require exorcism...
        226653 by: tg-php.gryffyndevelopment.com
        226655 by: Robert Cummings

Re: php related segmentation fault with Apache 2.0.55
        226654 by: kristina clair

include_once behaves differently in mod_php4 vs php5-cgi
        226656 by: Toomas Aas

Re: help avoid multiple login
        226657 by: mail.pmpa

page duration tracking
        226658 by: MikeL
        226660 by: Ben
        226666 by: Michael Crute
        226668 by: Jesús Fernández

script won't work on other server
        226659 by: Peppy
        226661 by: Peppy

custom CAD directory/file browser
        226663 by: Marlin Unruh
        226664 by: Jay Blanchard
        226667 by: Leonard Burton
        226673 by: Marlin Unruh

shortest possible check: field is set, integer or 0
        226669 by: Chris Lott
        226670 by: Richard Lynch
        226671 by: Ray Hauge

Regex to wrap <a href=""> tag around a <p> tag
        226672 by: Shaun

hi everyone
        226674 by: EasyHorpak.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:


imagecreatetruecolor() is probably what your after:

http://php.net/imagecreatetruecolor

Albert wrote:
> I have two images which I want to overlay on each other.
>
> Image1 is a satellite image.
> Image2 is contains the statistical data we collected. It has a transparent
> background and should be overlaid on top of the satellite image.
>
> Both are in PNG format.
>
> My current code:
>
> <?
> $dataImage = imagecreate(1000, 1000);
> $dIBack = imagecolorallocate($dataImage, 199, 199, 199);
> imagecolortransparent($dataImage, $dIBack);
> $darkGreen = imagecolorallocate($tileImage, 2, 123, 48 );
> $grey = imagecolorallocate($tileImage, 118, 131, 120);
> $fuchsia = imagecolorallocate($tileImage, 255, 0, 255);
> $aqua = imagecolorallocate($tileImage, 113, 168, 194);
> $brown = imagecolorallocate($tileImage, 177, 170, 107);
> $offwhite = imagecolorallocate($tileImage, 187, 210, 193);
> $black = imagecolorallocate($tileImage, 0, 0, 0 );
> $blue = imagecolorallocate($tileImage, 0, 0, 255);
> $red = imagecolorallocate($tileImage, 255, 0, 0 );
> $yellow = imagecolorallocate($tileImage, 255, 255, 0 );
>
> /* Code to draw data on image comes here */
>
> $satImage = imagecreatefrompng(‘sat_image.png’);
>
> $mergedImage = imagecreate(1000, 1000);
> imagealphablending($mergedImage, true);
> imagecopy($mergedImage, $satImage, 0, 0, 0, 0, 1000, 1000);
> imagecopy($mergedImage, $dataImage, 0, 0, 0, 0, 1000, 1000);
>
> imagepng($mergedImage, ‘merged_image.png’);
>
> imagedestroy($mergedImage);
> imagedestroy($satImage);
> imagedestroy($dataImage);
> ?>
>
> Notes:
> 1. When using imagecreatetruecolor the images turn black
> 2. When using imagealphablending = true or imagealphablending = false
> with imagecopy the result is the same. The top image is shown but it is
> almost transparent. Some images are also discoloured.
> 3. When using imagecopymerge to copy with a pct value of 99, and commenting
> out the imagealphablending line the top image does not appear at all
> 4. When using imagecopymerge to copy with a pct value of 99, and
> imagealphablending=true, it has the same result as 2. above.
> 5. When using imagecopymerge to copy with a pct value of 50, and
> Imagealphablending=true, it has the same result as 2. above.
>
> What is the effect of the pct value of imagecopymerge?
>
> Should I be using different values for the pct value of imagecopymerge or is
> there an alternative method which will do what I want to be done?
>
> It seems to me that the palette used in the top image is not merged with the
> palette used in the satellite image.
>
> Albert
>

attached mail follows:


Jochem Maas wrote:
> imagecreatetruecolor() is probably what your after:
>
> http://php.net/imagecreatetruecolor
>
> Albert wrote:
> > Notes:
> > 1. When using imagecreatetruecolor the images turn black

I did try imagecreatetruecolor() but then the images turn black.

Albert

attached mail follows:


Albert wrote:
> Jochem Maas wrote:
>
>>imagecreatetruecolor() is probably what your after:
>>
>>http://php.net/imagecreatetruecolor
>>
>>Albert wrote:
>>
>>>Notes:
>>>1. When using imagecreatetruecolor the images turn black
>
>
> I did try imagecreatetruecolor() but then the images turn black.

shit missed that sorry. question is where did you use then?

>
> Albert
>

attached mail follows:


Albert wrote:
> Jochem Maas wrote:
>
>>imagecreatetruecolor() is probably what your after:
>>
>>http://php.net/imagecreatetruecolor
>>
>>Albert wrote:
>>
>>>Notes:
>>>1. When using imagecreatetruecolor the images turn black
>
>
> I did try imagecreatetruecolor() but then the images turn black.

the output image resource you create should be created with $xxx = imagecreatetruecolor(1000,1000),
you should call imagealphablending($xxx, true) on the output image resource after you create and
before copying [which you are as far as I can tell], and you should use imagecopyresampled()
to actually copy the image data into the final image (instead of imagecopy()).

try this site:
http://php.amnuts.com/

I use a very hacked up version of his image masking class to do similar things to
what you want to do.

>
> Albert
>

attached mail follows:


On Wed, 30 Nov 2005, Gregory Machin wrote:

> Hi..
> Any body recomend a good MVC platform that is easy to work with,
> and build on...
> I'm looking at cakephp, solar, php on trax..
>
>Anything better out there.

Rubyonrails:

http://www.rubyonrails.com/

It's certainly better than any PHP MVC framework I've ever used.

--
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/

attached mail follows:


Excellent response. You should always be expecting certain data. So
if no checkboxes are checked, your code should realize that since it
was expecting the data and none was submitted.
The "lazy way" is much easier to code, but it is actually fairly
efficient. You are only hitting the database twice, once of the
delete and once for the bulk insert. On a fixed record length table,
the lazy way may actually be quicker.

On Nov 30, 2005, at 2:23 AM, Curt Zirzow wrote:

> So we have a form that will eventually need to knnow what values
> should be selected. Potentially data alreadly exists that may have
> the same records. There are two options (or perhaps more) to
> approach this:
>
> Decide as we go approach and clean up:
>
> 1) Grap the 'vehicles' currently assoicated with the 'lot'
> 2) if 'vehicle' is currently selected do nothing
> 3) if 'vehicle' is a new item we should add 'vehicle' as long as it
> is a valid 'vehicle;
> 4) repeat 2 and 3 until we looked at all the data
> 5) figure out which ones should be deleted and delete them.
>
>
> Forget everything, we'll add what is valid (the lazy way):
>
> 1) delete every associated record to the 'lot'
> 2) for each 'vehicle' add 'vehicle' as long as it is a valid
> 'vehicle'
>

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

attached mail follows:


Does anybody know of a way to run PHP files on a windows mobile
device(Pocket PC 2003)? Optimally I'd like to run it under a web server
running on the mobile device itself but barring that I'll take some form
of command line I guess. Realize that the mobile device will NOT be
running any active network connectivity. For all intents and purposes
the individual is sitting in a wireless empty room with no land
connectivity talking to the mobile device. I haven't been able to find
any web servers that run on the Pocket PC that can be viewed by the
mobile IE(or mobile Opera either I guess) when it doesn't have active
connectivity, at which point I might as well just be using a server for
all of the mobile devices rather than hiding it on the mobile device.

James Kilbride

attached mail follows:


On Wednesday 30 November 2005 22:48, Kilbride, James wrote:
> Does anybody know of a way to run PHP files on a windows mobile
> device(Pocket PC 2003)? Optimally I'd like to run it under a web server
> running on the mobile device itself but barring that I'll take some
> form of command line I guess. Realize that the mobile device will NOT
> be running any active network connectivity. For all intents and
> purposes the individual is sitting in a wireless empty room with no
> land connectivity talking to the mobile device. I haven't been able to
> find any web servers that run on the Pocket PC that can be viewed by
> the mobile IE(or mobile Opera either I guess) when it doesn't have
> active connectivity, at which point I might as well just be using a
> server for all of the mobile devices rather than hiding it on the
> mobile device.

If you're willing to ditch the "windows mobile" requirement (Wince/WM is
crap anyway) then you could have a look at the Sharp Zaurus series. Run
www.pocketworkstation.org on one of the Zaurus and you'll have access to
most of Debian in the palm of your hand. I've successfully run FUDforum
using Apache2/PHP4/MySQL on my Zaurus. Ruby on Rails works as well albeit
a tad slow -- I need to figure out how to get fastcgi working. And unlike
WM devices, you can run *real* browsers, Firefox and Mozilla are
available.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
New Year Resolution: Ignore top posted posts

attached mail follows:


The problem with this suggestion, unless people know of a good solution,
is that I need a ruggedized mobile system with built in 2d bar code
scanner that will treat the bar code data as keyboard entry so the user,
in the web browser, basically has the curser in the right form field,
scans the bar code, and the number gets dumped in directly. I haven't
found any ruggedized, builtin mobile scanners that run linux at this
time. Anybody have any suggestions on that?(Symbol makes really nice
ruggedized pocket pc based ones with built in scanners and an
application piece that treats it as keyboard entry)

James Kilbride

> -----Original Message-----
> From: Jason Wong [mailto:php-generalgremlins.biz]
> Sent: Wednesday, November 30, 2005 10:31 AM
> To: php-generallists.php.net
> Subject: Re: [PHP] PHP on Mobile Devices(Pocket PC specifically)
>
> On Wednesday 30 November 2005 22:48, Kilbride, James wrote:
> > Does anybody know of a way to run PHP files on a windows mobile
> > device(Pocket PC 2003)? Optimally I'd like to run it under a web
> > server running on the mobile device itself but barring that
> I'll take
> > some form of command line I guess. Realize that the mobile
> device will
> > NOT be running any active network connectivity. For all intents and
> > purposes the individual is sitting in a wireless empty room with no
> > land connectivity talking to the mobile device. I haven't
> been able to
> > find any web servers that run on the Pocket PC that can be
> viewed by
> > the mobile IE(or mobile Opera either I guess) when it doesn't have
> > active connectivity, at which point I might as well just be using a
> > server for all of the mobile devices rather than hiding it on the
> > mobile device.
>
> If you're willing to ditch the "windows mobile" requirement
> (Wince/WM is crap anyway) then you could have a look at the
> Sharp Zaurus series. Run www.pocketworkstation.org on one of
> the Zaurus and you'll have access to most of Debian in the
> palm of your hand. I've successfully run FUDforum using
> Apache2/PHP4/MySQL on my Zaurus. Ruby on Rails works as well
> albeit a tad slow -- I need to figure out how to get fastcgi
> working. And unlike WM devices, you can run *real* browsers,
> Firefox and Mozilla are available.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz Open
> Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications
> Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> New Year Resolution: Ignore top posted posts
>
> --
> PHP General Mailing List (http://www.php.net/) To
> unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


My company uses a home-grown formmail script for clients
<groan>, and someone is using curl to inject HTTP headers and
spam email addresses, and turn it into an open relay. Yes, I know
the right answer is to not use a formmail, but I don't make the rules
here.

Is there a way to detect that a script is being accessed by curl, and
not by a browser? ENV ($_SERVER) variables won't work, as
those can be forged.

Thanks.

Sandy Keathley

attached mail follows:


Sandy Keathley wrote:
>
> Is there a way to detect that a script is being accessed by curl, and
> not by a browser? ENV ($_SERVER) variables won't work, as
> those can be forged.
>

Use a CAPTCHA test:
http://en.wikipedia.org/wiki/Captcha

HTH, cheers!
Silvio

--
tradeOver | http://www.tradeover.net
....ready to become the King of the World?

attached mail follows:


Sandy Keathley wrote:
> My company uses a home-grown formmail script for clients
> <groan>, and someone is using curl to inject HTTP headers and
> spam email addresses, and turn it into an open relay. Yes, I know

1. cut out the ability for the poster (form submitter) to determine who is addressed.
2. strip out anything thst looks like its trying to be a mail 'field' in submitted
content.
3. use a CAPTCHA.
4. ask the 'Zend Certified Engineer' in your office???

> the right answer is to not use a formmail, but I don't make the rules
> here.
>
> Is there a way to detect that a script is being accessed by curl, and
> not by a browser? ENV ($_SERVER) variables won't work, as
> those can be forged.

no. the webserver only sees the incoming request - given that what
is sent (the _complete_ request) is totaly up to the client how could you
possibly tell who/what sent the request (other than trusting the client that
its telling the truth)?

granted there may be ways (hackish or not) to make some kind of determination
as to the legitimacy of the client - but that is probably in the realm of
"if you have to ask .... "

>
> Thanks.
>
> Sandy Keathley
>

attached mail follows:


Sandy Keathley wrote:
> My company uses a home-grown formmail script for clients
> <groan>, and someone is using curl to inject HTTP headers
> and spam email addresses, and turn it into an open relay.
> Yes, I know the right answer is to not use a formmail,
> but I don't make the rules here.
>
> Is there a way to detect that a script is being accessed
> by curl, and not by a browser?

It sounds like you have a PHP script with a security vulnerability, and
you think that restricting what the client uses to request the script is
going to fix it. This is not a good approach. Just fix the problem. :-)

For example, filter the data you receive from the client before passing
it as arguments to the mail() function.

Hope that helps.

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

attached mail follows:


Hi List,

I have noted that some versions of PHP are unable to work with MySQL 4.1.x.

1) Should I upgrade to PHP 5?
2) What is the lowest PHP version which works fine with MySQL 4.1.x?

Regards,
Behzad

P.S.
I don't use "Improved MySQL" extension in PHP.
I just need MySQL 4.1.x for multi-byte character support.

attached mail follows:


AmirBehzad Eslami schrieb:
> I have noted that some versions of PHP are unable to work with MySQL 4.1.x.

Would be new to me but...

> 1) Should I upgrade to PHP 5?
Disregarding your question about databases: Yes you should. PHP5 is
there since well over a year. The dev team WILL stop support for PHP4,
be it sooner or later. With the 5.1 release there are no speed arguments
for PHP4 anymore. If you switch now, you are avoiding bigger adjustment
problems in the future.

> 2) What is the lowest PHP version which works fine with MySQL 4.1.x?

Tip: Look at the relase notes of the different XAMPP versions. They
always bundle a PHP4 version with a MySQL version and they have changed
to MySQL 4.1 very early. Any download they offer means that the
contained versions work well together.

OLLi

attached mail follows:


PHP4 works just fine with MySQL 4.1. You may be encountering a
"problem" with the new password scheme in MySQL 4.1 that PHP 4 does
not support. In this case, PHP4 is considered and "old" client. Read
this part of the manual to get it working:
http://dev.mysql.com/doc/refman/5.0/en/old-client.html

Should you upgrade to PHP5 is a completely different story. There are
some great things in 5.

On Nov 30, 2005, at 11:13 AM, AmirBehzad Eslami wrote:

> Hi List,
>
> I have noted that some versions of PHP are unable to work with
> MySQL 4.1.x.
>
> 1) Should I upgrade to PHP 5?
> 2) What is the lowest PHP version which works fine with MySQL 4.1.x?
>
> Regards,
> Behzad
>
> P.S.
> I don't use "Improved MySQL" extension in PHP.
> I just need MySQL 4.1.x for multi-byte character support.

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

attached mail follows:


What to do next? I'd check to see if your page is being inadvertantly called twice (I've seen this happen when people used frames.. or like someone else mentioned, doing a double include() or sometimes redirecting back to itself via header())... anything that could possibly re-initiate the page, check into.

Failing that, do it old school... just inserted die() statements to break execution at various points and see where the probably first starts occuring and focus in that area. Crude but it works. At least helps narrow down where the problem could be.

It doesn't do something silly like include() itself inside a conditional somewhere does it?

You might also echo/var_dump/print_r/whatever some of your key variables (especially input variables like $_GET/$_POST/etc and variables used in conditionals) and try to isolate what combination causes your problem. Since it doesn't do it all the time, I'd guess you could have something like:

$x = 4;

if ($x > 1) {
  include('someinclude.inc');
}

if ($x < 5) {
  include('someinclude.inc');
}

Where 'someinclude.inc' contains your double declarations.

Next point... check your logic around your include()/require()s and such. Maybe you have a condition where something is falling into multiple categories.

The logic puzzle is as much about writing good logic as untangling possibly flawed logic.

If all else fails, trace through your code by hand... interpret it in your head like the computer would.. like by line.. maybe you'll see where something is ambiguous and under certain conditions creates a fail.

Let us know what you find.. kind of curious myself.

-TG

= = = Original message = = =

So... I have this script (being called in a perfectly typical way by
PHP 4.4.1 through mod_php in Apache 2.0.55) which sometimes runs
perfectly, and sometimes chooses, totally haphazardly, to seemingly
run itself twice, which of course causes it to die with a fatal error
after it tries to redefine some functions.

As mysterious as that is, it turns out it must be something
altogether more sinister. I tried putting die() at the end of the
script, on the assumption that it was for some reason executing
twice, yet behold: the problem is still present, and the PHP error
log still complains about constants and functions being redefined!
The problem, I therefore thought, cannot be that the script is being
run twice. (In retrospect, this was the most likely possibility,
because the page doesn't actually output anything if it dies with
this error.) So for debugging, I added a bit that logs one message to
a file immediately before the die() at the end of the file, and a
different message after the die(). The die() seems to be working
normally, in that it only logs the first message...

But wait a second! WTF? If the PHP error log is to be believed, then
the script should be dying with a fatal error before it even *gets*
to that point in the script, isn't it?

And the greater WTF is the fact that, as I mentioned above, every
time the page is requested, it unpredictably either does this or
works flawlessly. Oh my. How do I even *begin* to debug something
like this?

Thanks for any help.
-- Adam Atlas

___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

attached mail follows:


On Wed, 2005-11-30 at 11:48, tg-phpgryffyndevelopment.com wrote:
> What to do next? I'd check to see if your page is being inadvertantly called twice (I've seen this happen when people used frames.. or like someone else mentioned, doing a double include() or sometimes redirecting back to itself via header())... anything that could possibly re-initiate the page, check into.
>
> Failing that, do it old school... just inserted die() statements to break execution at various points and see where the probably first starts occuring and focus in that area. Crude but it works. At least helps narrow down where the problem could be.
>
> It doesn't do something silly like include() itself inside a conditional somewhere does it?
>
> You might also echo/var_dump/print_r/whatever some of your key variables (especially input variables like $_GET/$_POST/etc and variables used in conditionals) and try to isolate what combination causes your problem. Since it doesn't do it all the time, I'd guess you could have something like:
>
> $x = 4;
>
> if ($x > 1) {
> include('someinclude.inc');
> }
>
> if ($x < 5) {
> include('someinclude.inc');
> }

Which reminds me... make sure your using include() where appropriate,
and include_once() where appropriate. Obviously include_once() should
ALWAYS be used when the source contains function or class definitions.

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:


Hi again,

I tried compiling and installing php 4.4.1 with Apache 2.0.54, out of
curiosity (because php 4.3.10 and Apache 2.0.54 didn't give me any
problems).

With this combination, I still get a segmentation fault with at least
one php script. The gdb backtrace is:
#0 0xb7e207c1 in php_handler (r=0xda16ca8)
    at /home/sys/src/php-4.4.1/sapi/apache2handler/sapi_apache2.c:538
538 if (parent_req && strcmp(parent_req->handler,
PHP_MAGIC_TYPE) && strcmp(parent_req->handler, PHP_SOURCE_MAGIC_TYPE)
&& strcmp(parent_req->handler, PHP_SCRIPT)) {
(gdb) bt full
#0 0xb7e207c1 in php_handler (r=0xda16ca8)
    at /home/sys/src/php-4.4.1/sapi/apache2handler/sapi_apache2.c:538
        orig_bailout = {{__jmpbuf = {0, 0, 0, 0, 0, 0},
    __mask_was_saved = 0, __saved_mask = {__val = {
        0 <repeats 32 times>}}}}
        ctx = (php_struct *) 0xda08818
        conf = Variable "conf" is not available.

I think it is worth reiterating that this is only happening with one
script, to our knowledge. The actual file being served is a .shtml
file which includes a php script. I looked at the php script, and it
looks like a pretty straightforward database access script, using
mysql. Is there anything I should look for in that script?

Thanks,
Kristina

On 11/17/05, kristina clair <kclairgmail.com> wrote:
> I actually did that before emailing about php 4.3.10. With php 4.4.1,
> the traceback is different:
>
> Reading symbols from /home/sys/Zend/lib/ZendExtensionManager.so...done.
> Loaded symbols for /home/sys/Zend/lib/ZendExtensionManager.so
> Error while reading shared library symbols:
> .//home/sys/Zend/etc/pfpro.so: No such file or directory.
> Reading symbols from /home/sys/verisign/lib/libpfpro.so...done.
> Loaded symbols for /usr/local/verisign//lib/libpfpro.so
> #0 0xb7ca0c15 in php_handler (r=0xda05f90)
> at /home/sys/src/php-4.4.1/sapi/apache2handler/sapi_apache2.c:538538
> if (parent_req && strcmp(parent_req->handler,
> PHP_MAGIC_TYPE) && strcmp(parent_req->handler, PHP_SOURCE_MAGIC_TYPE)
> && strcmp(parent_req->handler, PHP_SCRIPT)) {
> warning: not using untrusted file ".gdbinit"
>
> (gdb) bt full
> #0 0xb7ca0c15 in php_handler (r=0xda05f90)
> at /home/sys/src/php-4.4.1/sapi/apache2handler/sapi_apache2.c:538
> orig_bailout = {{__jmpbuf = {0, 0, 0, 0, 0, 0}, __mask_was_saved = 0,
> __saved_mask = {__val = {0 <repeats 32 times>}}}}
> ctx = (php_struct *) 0xd9e9a80
> conf = Variable "conf" is not available.
> (gdb)
>
> On 11/17/05, Max Belushkin <m.belushkinfz-juelich.de> wrote:
> > I have had various problems with upgrading one or the other, until I took it
> > as a rule to recompile both upon an upgrade. On the machine I do things
> > completely manually on [which has it's drawbacks], I generally also upgrade
> > to the current version of PHP together with any Apache update, and
> > vice-versa. The current 4.x version is 4.4.1 [although on a FreeBSD install I
> > had some issues and downgraded to 4.4.0, but this behaviour hasn't been
> > confirmed outside of FreeBSD until now] - perhaps try recompiling PHP to the
> > current 4.x version (or if you feel up to it, upgrade to the 5.x versions?),
> > and see if it helps? Resolved a lot of my problems in the past...
> >
> > On Thursday 17 November 2005 22:31, kristina clair wrote:
> > > 2.0.54 to Apache 2.0.55. The scripts that are failing with the new
> > > Apache work with no problems with the old Apache.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> "In most cases, people, even wicked people, are far more naive and
> simple-hearted than one generally assumes. And so are we."
> /* last line, 1st ch., The Brothers Karamazov */
>

--
"In most cases, people, even wicked people, are far more naive and
simple-hearted than one generally assumes. And so are we."
/* last line, 1st ch., The Brothers Karamazov */

attached mail follows:


Hello!

There's a website with a following structure

index.php in the site's DocumentRoot directory (for this thread, let's
call it /www)

functions.php, init.php and db_connect.php in /www/library

index.php includes line:

include_once('library/functions.php');

functions.php includes lines:

include_once('db_connect.php');
include_once('init.php');

The website was running fine under PHP 4.4.0 installed as Apache module.

Then we tried it with PHP 5.0.5 installed as CGI. We got the following
errors:

PHP Warning: main() : open_basedir restriction in effect.
File(/db_connect.php) is not within the allowed path(s):
(/www:/usr/local/www/phpMyAdmin:/var/tmp/php) in
/www/library/functions.php on line 2
PHP Warning: main(db_connect.php) : failed to open stream: Operation
not permitted in /www/library/functions.php on line 2
PHP Warning: main() : Failed opening 'db_connect.php' for inclusion
(include_path='.:') in /www/library/functions.php on line 2

...and similar 3 messages about init.php.

Note that first warning is about '/db_connect.php', not 'db_connect.php'
or './db_connect.php'. /www/library should be inside the open_basedir,
since it is under /www, which is listed in open_basedir in php.ini. It
looks like something is changed in PHP's behaviour between versions 4
and 5 or is differently handled in CGI vs Apache SAPI, but I find it
unlikely since I can find no documentation regarding this. It's more
likely that I am overlooking something trivial, but I can't figure out
what it is.

I tried to change the include lines to

include_once('./db_connect.php');
include_once('./init.php');

but this made no difference.

However, when I specify the full path:

include_once('/www/library/db_connect.php');
include_once('/www/library/init.php');

then the errors disappear and 'everything' seems to work.

Also, I never get any errors about the

include_once('library/funcions.php');

line in index.php

I'm puzzled...

--
... ASCII stupid question, get a stupid ANSI!

attached mail follows:


-----Mensagem original-----
De: Jochem Maas [mailto:jochemiamjochem.com]

>>the normal way of doing session 'closing' is by way of 'garbage
>
> collection'
>
>>- every now and then a script/process/function is run that 'closes' any
>>sessions which are (according to your criteria) inactive. php has stuff
>>built it that will do this for you to a degree.
>>-----
>>
>>Is there a way I can access sessions from other users on a script?

what exactly do you mean by that last sentence? I don't quite follow it.
------

I mean if I knew all active session id's I could compare them to the
members_online table.

An example in pseudo code:

// Member logs in, store session id, login datetime, last visit datetime:
INSERT INTO members_online

// Get active session ids from table:
php code

// Compare active session ids with table sessions:
for ($i=0; $i < table rows; $i++){
      if ( !isset( session id from member $i )) {
            DELETE member from table
      }
}

>>If yes I could store the session id on a table and later check if isset.
>> You could write the session id into a table when the session is started,
>> along with the start time.
>> Something like
>> sessionid CHAR|starttime DATETIME|lastvisittime DATETIME
>> You could then update this table each time the user visits a page, and
>> delete it if the interval between starttime and lastvisittime is longer
than
>> you want. A cron job/scheduled task could be used to clean this table up
>> periodically

>a nice description of 'session garbage collection' :-) ....
>which is pretty much all you can do in terms of 'logoff'.

I already use a class to perform this task. The problem is if a member
closes the browser windows and then tries to login again before the
specified timeout.

Does Apache have a function like asp Session_OnStart, Session_OnEnd ?

I am using IIS and PHP 5.0.4

Thanks in advance.
Pedro.

attached mail follows:


Is there a way to incorporate some type of time in a page to track the
duration of time each individual visitor spent on a specific page with ..PHP?
 
I know I can keep a counter with JavaScript, but I would like it to keep
track in my stats file.
 
I can track & log the arrival time, but would like to either track the page
exit time, too. It would be great to convert it to minutes:seconds for time
spent viewing the page.
 
I only want to track how much time someone spends on my index.php page
before they leave the page. I can track when they click to the next page in
my site.
 
 
Thanks for any help and suggestions!
 
 
 
Mike Lewitz
Phoenix, AZ
Supra - the only way to FLY!
==========================
 
"Manage your destiny, or someone else will."
~Jack Welch, Former CEO, General Electric
 
 
 

attached mail follows:


MikeL said the following on 11/30/2005 11:39 AM:
> Is there a way to incorporate some type of time in a page to track the
> duration of time each individual visitor spent on a specific page with ..PHP?
>
> I know I can keep a counter with JavaScript, but I would like it to keep
> track in my stats file.
>
> I can track & log the arrival time, but would like to either track the page
> exit time, too. It would be great to convert it to minutes:seconds for time
> spent viewing the page.
>
> I only want to track how much time someone spends on my index.php page
> before they leave the page. I can track when they click to the next page in
> my site.

You can only track the amount of time between page/file loads within
your own site. Record the time when a page loads and then when the
person loads another page on your site you can compare the times to
figure out how long they were on the previous page.

There is no reliable way to record if they leave your stie for another
site or close their browser.

- Ben

attached mail follows:


On 11/30/05, MikeL <Mailme157mgte.com> wrote:
> Is there a way to incorporate some type of time in a page to track the
> duration of time each individual visitor spent on a specific page with ..PHP?
>
> I know I can keep a counter with JavaScript, but I would like it to keep
> track in my stats file.
>
> I can track & log the arrival time, but would like to either track the page
> exit time, too. It would be great to convert it to minutes:seconds for time
> spent viewing the page.
>
> I only want to track how much time someone spends on my index.php page
> before they leave the page. I can track when they click to the next page in
> my site.
>
>
> Thanks for any help and suggestions!

Theoretically you should be able to use a javascript function in the
page unload to submit back to your server when somebody navigates away
from your page. Not sure if it would work 100% of the time but its
worth a try.

-Mike

--
________________________________
Michael E. Crute
Software Developer
SoftGroup Development Corporation

Linux takes junk and turns it into something useful.
Windows takes something useful and turns it into junk.

attached mail follows:


I think you could use cookies for this.
When the user loads the page you can write a cookie with the timestamp
and the page loaded writen on it. Then when the user request another
page, load if the cookie exists and then you can calculate the time
spent on a certain page...

--
http://esu.proyectoanonimo.com
http://www.proyectoanonimo.com

attached mail follows:


I have a small script that I am testing out on two different servers. It uses the $_SERVER['HTTP_USER_AGENT'] to detect the browser and serve up a style sheet dependent on the results. (Please don't comment on its usefulness, it's just an example.)

On one server, I can get this script to run correctly in all browsers that I test. On another server, it will not run correctly in Netscape (testing for the word Gecko, but have used Netscape also). Any help would be appreciated.

Link to script:

http://www.asrm.org/class/php/angelia.php

In case it's needed, link to file with phpinfo():

http://www.asrm.org/test/test.php

attached mail follows:


Short tags are on on both servers.

----- Original Message -----
From: <replies-lists-phplistmail.innovate.net>
To: "Peppy" <peppyfoxedge.net>
Sent: Wednesday, November 30, 2005 2:23 PM
Subject: Re: [PHP] script won't work on other server

> you're using the short-tag form:
>
> <?
>
> rather than:
>
> <?php
>
> this may not be supported on both machines.
>
> haven't looked at other aspects of the script.
>
>
> ------------ Original Message ------------
> > Date: Wednesday, November 30, 2005 02:15:47 PM -0600
> > From: Peppy <peppyfoxedge.net>
> > To: php-generallists.php.net
> > Subject: [PHP] script won't work on other server
> >
> > I have a small script that I am testing out on two different
> > servers. It uses the $_SERVER['HTTP_USER_AGENT'] to detect the
> > browser and serve up a style sheet dependent on the results.
> > (Please don't comment on its usefulness, it's just an example.)
> >
> > On one server, I can get this script to run correctly in all
> > browsers that I test. On another server, it will not run correctly
> > in Netscape (testing for the word Gecko, but have used Netscape
> > also). Any help would be appreciated.
> >
> > Link to script:
> >
> > http://www.asrm.org/class/php/angelia.php
> >
> > In case it's needed, link to file with phpinfo():
> >
> > http://www.asrm.org/test/test.php
> >
> >
>
> ---------- End Original Message ----------
>
>

attached mail follows:


I have hundreds of CAD drawing files in binary format. Using the
strpos() function I can query embedded ASCII info from the CAD files. I
display the queried info along with an anchor element to the CAD file in
the web browser using a php script. Thus I can give the drawings
arbitrary file names but find the file I am looking for from the
description in the drawings title block. I can handle that aspect of
the project all right, the question is how to handle the directories. If
I create an anchor to the directories it drops out of the script and use
the browsers file viewing functionality. I think what I need is for the
php script to call itself and pass the name of the new directory so the
new directory can be queried and displayed.

Can I use an anchor element to pass info back to the self same php
script? If so how? I can't seem to find my way though this aspect of the
project.

Point me to a tutorial, give me a clue, or let me struggle on.

Thanks
--

Regards,
  Marlin Unruh
  Sunco Systems Inc.
  (308) 326-4400

attached mail follows:


[snip]
Can I use an anchor element to pass info back to the self same php
script? If so how? I can't seem to find my way though this aspect of the
project.
[/snip]

You can include information in the query string of the URL

<a href="foo.php?directory=/path/to/may/files/">Click Here</a>

The information would be available in the $_GET array as $_GET['directory']

attached mail follows:


Greetings,

>I think what I need is for the
> php script to call itself and pass the name of the new directory so the
> new directory can be queried and displayed.

Let me see if I got this right.

You have Dir x, y, z, w. In each dir you have files 1 through n.

What you want to do is loop through each dir and then loop through
each drawing and look for some pattern in the title block and then
append the query info there.

If this is the case: you should use chdir() to change dirs. Then you
can readdir() and loop through the files.

Does this help?

--
Leonard Burton, N9URK
leonardburtongmail.com

"You must understand, if you are on a plane you must behave yourself."

"The prolonged evacuation would have dramatically affected the
survivability of the occupants."

attached mail follows:


Jay Blanchard wrote:
> [snip]
> Can I use an anchor element to pass info back to the self same php
> script? If so how? I can't seem to find my way though this aspect of the
> project.
> [/snip]
>
> You can include information in the query string of the URL
>
> <a href="foo.php?directory=/path/to/may/files/">Click Here</a>
>
> The information would be available in the $_GET array as $_GET['directory']
>
>
This did the trick but, how do I clear out the $_GET array? As I move
around the directories the 'directory' string gets longer and longer.
I'm not sure if it is an Apache variable or what that I need to clear to
empty the ?directory= string. Below is what builds up in the browser
address window as I go in and out of directories. How do I dump it?

http://localhost/cad.php?directory=c:/suncosys/cyl/../sbr/../act/2d/obsolete/..

--

Regards,
  Marlin Unruh
  Sunco Systems Inc.
  (308) 326-4400

attached mail follows:


What is the shortest possible check to ensure that a field coming from
a form as a text type input is either a positive integer or 0, but
that also accepts/converts 1.0 or 5.00 as input?

c

attached mail follows:


On Wed, November 30, 2005 5:10 pm, Chris Lott wrote:
> What is the shortest possible check to ensure that a field coming from
> a form as a text type input is either a positive integer or 0, but
> that also accepts/converts 1.0 or 5.00 as input?

This might be good enough:

if (isset($_POST['x'])){
  if (!preg_match('/([0-9]*)(\\.0*)?/', $_POST['x']){
    //invalid
  }
  else{
    $_CLEAN['x'] = (int) $_POST['x'];
  }
}

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Richard Lynch wrote:

>On Wed, November 30, 2005 5:10 pm, Chris Lott wrote:
>
>
>>What is the shortest possible check to ensure that a field coming from
>>a form as a text type input is either a positive integer or 0, but
>>that also accepts/converts 1.0 or 5.00 as input?
>>
>>
>
>This might be good enough:
>
>if (isset($_POST['x'])){
> if (!preg_match('/([0-9]*)(\\.0*)?/', $_POST['x']){
> //invalid
> }
> else{
> $_CLEAN['x'] = (int) $_POST['x'];
> }
>}
>
>
>
You could also replace:

if (!preg_match('/([0-9]*)(\\.0*)?/', $_POST['x'])

with:

if(!is_numeric($_POST['x']) || $_POST['x'] < 0)

This would ensure that your value only contains numbers, and that it is
greater than zero. Then when you put it into the $_CLEAN array, you can
type-cast it as an int (as in the other script) and that would convert
any doubles to an integer value. If you wanted you could also round,
ceil, or floor the value.

attached mail follows:


Hi,

I am trying to read the contents of a file into a string and wrap an <a
href=""> tag around every <p> tag and output it to the browser. This is how
far I have got:

// Get file contents
$file_contents = file_get_contents($file);
// Replace <p> tags
$file_contents = preg_replace('/^<p\>[a-z][0-9]<\/p>$/', '/^<a
href="edit_paragraph&text="">\<p>[a-z][0-9]<\/p><\/a>$/', $file_contents);
// Output to browser
echo $file_contents;

I have two problems.

1. - The regex doesn't work!
2. - I need to add the <p> tags and all contents to the link

Here is an example

<html>
<body>
<p>Here is a paragraph</p>
<p>Here is another paragraph</p>
</body>
</html>

would become

<html>
<body>
<a href="edit_paragraph&text="<p>Here is a paragraph</p>"><p>Here is a
paragraph</p></a>
<a href="edit_paragraph&text="<p>Here is another paragraph</p>"><p>Here is
another paragraph</p></a>
</body>
</html>

Any advice would be greatly appreciated

attached mail follows:


Why this list very quiet?.
No one in this list.

Please feel free to reply to this email if you have additional questions or concerns

ªÇ¹ ¨Ø´ÒºØµÃ
01-7499093
µÔ´µèÍŧâ¦É³Ò ;ÒÃì·àÁ¹·ì, áÁ¹ªÑè¹, Ë;ѡ â·Ã. 01-749-9093, 02-938-8301
************************************************************************
http://www.EasyHorpak.com - áËÅ觤é¹ËÒË;ѡ, ¤Í¹â´, ·Õè¾Ñ¡, ;ÒÃì·àÁ¹·ì
http://www.EasyHorpak.com/webdesign - ºÃÔ¡ÒôÙáÅáÅÐÍ͡ẺàÇçºä«µì
http://www.EasyHorpak.com/internet - áËÅè§ÃÇÁ¼ÙéãËéºÃÔ¡ÒõԴµÑé§ÍÔ¹àµÍÃìà¹çµã¹Í¾ÒÃì·àÁ¹·ì
http://www.EasyHorpak.com/software - áËÅè§ÃÇÁâ»Ãá¡ÃÁÊÓËÃѺ;ÒÃì·àÁ¹·ì
http://www.EasyHorpak.com/move - áËÅè§ÃÇÁ¼ÙéãËéºÃÔ¡Òâ¹ÂéÒÂ
http://www.EasyHorpak.com/coin - áËÅè§ÃÇÁ¼ÙéãËéºÃÔ¡ÒõÙéËÂÍ´àËÃÕ­