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 8 Apr 2008 04:01:03 -0000 Issue 5392

php-general-digest-helplists.php.net
Date: Mon Apr 07 2008 - 23:01:03 CDT


php-general Digest 8 Apr 2008 04:01:03 -0000 Issue 5392

Topics (messages 272645 through 272680):

Re: Include fails when "./" is in front of file name
        272645 by: Daniel Brown
        272646 by: Daniel Brown
        272650 by: Wolf
        272651 by: Dan Joseph
        272653 by: Daniel Brown
        272656 by: Wolf
        272657 by: Stut
        272660 by: Noah Spitzer-Williams
        272668 by: Daniel Brown
        272672 by: Lester Caine
        272673 by: Daniel Brown
        272674 by: Wolf

Date comparison Question
        272647 by: admin.buskirkgraphics.com
        272654 by: Nathan Nobbe
        272663 by: Mark J. Reed
        272664 by: admin.buskirkgraphics.com
        272665 by: admin.buskirkgraphics.com
        272666 by: Daniel Brown
        272670 by: admin.buskirkgraphics.com
        272671 by: Daniel Brown

Re: opening a big file
        272648 by: Richard Lee
        272649 by: Daniel Brown

How to make a directory / file only available to registered users using PHP code?
        272652 by: Rian Hidayanto
        272659 by: Jason Pruim
        272661 by: Daniel Brown
        272662 by: Wolf

Conditional popup driven from server-side
        272655 by: Arno Kuhl
        272658 by: Wolf

Re: Search engines and cookies
        272667 by: tedd

Re: PHP ssh2 problem
        272669 by: Michael Stroh

Re: date CDT CST UTC
        272675 by: Dee Ayy

Re: generate images of register definitions
        272676 by: Mike Frysinger

Re: [PHP-INSTALL] Can't enable use_trans_sid
        272677 by: Thiago Pojda

php local application send mouse click
        272678 by: Daniel Kolbo

Re: PHP gives session error on remote server, but not local test machine [SOLVED]
        272679 by: Dave M G

Array pointer to a function
        272680 by: hce

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:


On Mon, Apr 7, 2008 at 11:20 AM, Philip Thompson <philthathrilgmail.com> wrote:
>
> It's Windows. From experience, I know that it provides little to no error
> reporting in some instances. For example, if you're missing a semi-colon and
> you have error reporting turned on, all you get is a blank page - no other
> info. So, odds are is that he isn't receiving an error message.

    error_reporting() == error_reporting() !platform

--
</Daniel P. Brown>
Ask me about:
Dedicated servers starting $59.99/mo., VPS starting $19.99/mo.,
and shared hosting starting $2.50/mo.
Unmanaged, managed, and fully-managed!

attached mail follows:


On Mon, Apr 7, 2008 at 11:24 AM, Stut <stuttlegmail.com> wrote:
>
> To the OP: Check that your include_path contains '.', if it doesn't add it
> and see if that fixes your problem.

    He has . in the include path....

On Sun, Apr 6, 2008 at 2:17 PM, Noah Spitzer-Williams <noahswgmail.com> wrote:
> PHP.ini's include path is: include_path = ".;.\includes;.\pear"

    .... but even if it weren't, explicitly-calling ./ forces the
include to the local directory. You're right to point it out that it
should be included, though.... I've actually seen some boxes where .
was not in the path. I've even seen some cases where .. was
erroneously included instead. There's treachery afoot!

    However, take a look at his include path....

    Noah, I see no reason why PHP's include path should have .\pear in
there. Not sure about .\includes, but .\pear likely doesn't exist in
every CWD/PWD (depending on your preference in system semantics) from
where it's called, and the same would go for .\includes.

--
</Daniel P. Brown>
Ask me about:
Dedicated servers starting $59.99/mo., VPS starting $19.99/mo.,
and shared hosting starting $2.50/mo.
Unmanaged, managed, and fully-managed!

attached mail follows:


---- Daniel Brown <parasanegmail.com> wrote:
> On Sun, Apr 6, 2008 at 5:17 PM, Noah Spitzer-Williams <noahswgmail.com> wrote:
> > This works:
> > include("file.inc.php");
> >
> > This doesn't:
> > include("./file.inc.php");
>
> That's pretty vague, Noah. Is it unable to locate the file?
> What's the error message you're receiving?
>
> Also, what happens if you create two simple files in the same
> directory like so:
> <?php
> // file1.php
> echo "Okay.\n";
> ?>
>
> <?php
> // file2.php
> include(dirname(__FILE__).'/file1.php');
> ?>

Noah,

Looks like you need to be deciding on whether or not you are on windoze or *Nix.

If on Windoze, your include path is \
If on *Nix, your include path is /

Notice the direction of the slashes and code appropriately in all locations.

Wolf

attached mail follows:


On Mon, Apr 7, 2008 at 11:52 AM, Wolf <lonewolfnc.rr.com> wrote:

> Noah,
>
> Looks like you need to be deciding on whether or not you are on windoze or
> *Nix.
>
> If on Windoze, your include path is \
> If on *Nix, your include path is /
>
> Notice the direction of the slashes and code appropriately in all
> locations.
>
> Wolf
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

I'm working with a Windows server and able to use ./ in all my includes.
Example - require_once( "./library/urs/URS.Framework.php" ); His should
work fine also.

--
-Dan Joseph

"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."

attached mail follows:


On Mon, Apr 7, 2008 at 11:52 AM, Wolf <lonewolfnc.rr.com> wrote:
>
> Noah,
>
> Looks like you need to be deciding on whether or not you are on windoze or *Nix.
>
> If on Windoze, your include path is \
> If on *Nix, your include path is /
>
> Notice the direction of the slashes and code appropriately in all locations.

    Actually, PHP is "smart" enough to allow both on Windows.
Otherwise, everyone would need to update their code for each different
system, which destroys PHP's cross-platform nature.

--
</Daniel P. Brown>
Ask me about:
Dedicated servers starting $59.99/mo., VPS starting $19.99/mo.,
and shared hosting starting $2.50/mo.
Unmanaged, managed, and fully-managed!

attached mail follows:


---- Daniel Brown <parasanegmail.com> wrote:
> On Mon, Apr 7, 2008 at 11:52 AM, Wolf <lonewolfnc.rr.com> wrote:
> >
> > Noah,
> >
> > Looks like you need to be deciding on whether or not you are on windoze or *Nix.
> >
> > If on Windoze, your include path is \
> > If on *Nix, your include path is /
> >
> > Notice the direction of the slashes and code appropriately in all locations.
>
> Actually, PHP is "smart" enough to allow both on Windows.
> Otherwise, everyone would need to update their code for each different
> system, which destroys PHP's cross-platform nature.
>
> --

I've heard that to be the case, but sometimes it's not just the PHP but the underlying server doing the serving...

At any rate, how hard is it to convert slashes if you have to convert your OSs if you use a managed include file or keep the includes directive in the .htaccess folder. ;)

YMMV, but I always just change them to be on the safe side, but that's just how I roll...

Wolf

attached mail follows:


Wolf wrote:
> ---- Daniel Brown <parasanegmail.com> wrote:
>> On Mon, Apr 7, 2008 at 11:52 AM, Wolf <lonewolfnc.rr.com> wrote:
>>> Noah,
>>>
>>> Looks like you need to be deciding on whether or not you are on windoze or *Nix.
>>>
>>> If on Windoze, your include path is \
>>> If on *Nix, your include path is /
>>>
>>> Notice the direction of the slashes and code appropriately in all locations.
>> Actually, PHP is "smart" enough to allow both on Windows.
>> Otherwise, everyone would need to update their code for each different
>> system, which destroys PHP's cross-platform nature.
>>
>> --
>
> I've heard that to be the case, but sometimes it's not just the PHP but the underlying server doing the serving...
>
> At any rate, how hard is it to convert slashes if you have to convert your OSs if you use a managed include file or keep the includes directive in the .htaccess folder. ;)
>
> YMMV, but I always just change them to be on the safe side, but that's just how I roll...

If you're worried about is use DIRECTORY_SEPARATOR rather than
hard-coding it. Writing portable code is not difficult in PHP.

-Stut

--
http://stut.net/

attached mail follows:


Here's the error I get:

*Warning*: include(.\file.inc.php)
[function.include<http://www.emsplannertest.com/function.include>]:
failed to open stream: No such file or directory in *
C:\Inetpub\httpdocs\test.php* on line *3*

*Warning*: include()
[function.include<http://www.emsplannertest.com/function.include>]:
Failed opening '.\file.inc.php' for inclusion
(include_path='.;.\includes;.\pear') in *C:\Inetpub\httpdocs\test.php* on
line *3*

This works fine on my old server which is running PHP 4.3.9.

I honestly feel like I'm overlooking some stupid tiny thing. Are my
permissions correct? Is it possible to debug this and look at the full path
of file.inc.php that PHP is trying to load?

Thanks!

On Mon, Apr 7, 2008 at 7:36 AM, Daniel Brown <parasanegmail.com> wrote:

> On Sun, Apr 6, 2008 at 5:17 PM, Noah Spitzer-Williams <noahswgmail.com>
> wrote:
> > This works:
> > include("file.inc.php");
> >
> > This doesn't:
> > include("./file.inc.php");
>
> That's pretty vague, Noah. Is it unable to locate the file?
> What's the error message you're receiving?
>
> Also, what happens if you create two simple files in the same
> directory like so:
> <?php
> // file1.php
> echo "Okay.\n";
> ?>
>
> <?php
> // file2.php
> include(dirname(__FILE__).'/file1.php');
> ?>
>
> --
> </Daniel P. Brown>
> Ask me about:
> Dedicated servers starting $59.99/mo., VPS starting $19.99/mo.,
> and shared hosting starting $2.50/mo.
> Unmanaged, managed, and fully-managed!
>

attached mail follows:


On Mon, Apr 7, 2008 at 12:24 PM, Noah Spitzer-Williams <noahswgmail.com> wrote:
> Here's the error I get:
>
> Warning: include(.\file.inc.php) [function.include]: failed to open stream:
> No such file or directory in C:\Inetpub\httpdocs\test.php on line 3
>
> Warning: include() [function.include]: Failed opening '.\file.inc.php' for
> inclusion (include_path='.;.\includes;.\pear') in
> C:\Inetpub\httpdocs\test.php on line 3

    If you're going to use Windows-style paths, try escaping your
slashes and see what happens.

<?php
include(".\\file.inc.php");
?>

--
</Daniel P. Brown>
Ask me about:
Dedicated servers starting $59.99/mo., VPS starting $19.99/mo.,
and shared hosting starting $2.50/mo.
Unmanaged, managed, and fully-managed!

attached mail follows:


Daniel Brown wrote:
> On Mon, Apr 7, 2008 at 12:24 PM, Noah Spitzer-Williams <noahswgmail.com> wrote:
>> Here's the error I get:
>>
>> Warning: include(.\file.inc.php) [function.include]: failed to open stream:
>> No such file or directory in C:\Inetpub\httpdocs\test.php on line 3
>>
>> Warning: include() [function.include]: Failed opening '.\file.inc.php' for
>> inclusion (include_path='.;.\includes;.\pear') in
>> C:\Inetpub\httpdocs\test.php on line 3
>
> If you're going to use Windows-style paths, try escaping your
> slashes and see what happens.
>
> <?php
> include(".\\file.inc.php");
> ?>

People seem to be missing the point here. These are PUBLIC applications that
are failing to work for Noah. He should not need to re-write PHPMyAdmin in
order to get it to work?

Next people will be saying that we should re-write PHP if it does not work for
us.

Noah - I know that some 'security' has been added to the include function, but
I'm not sure why you are having problems. I'm running applications on windows
and Linux and the "./otherdir/" select is working fine.

--
Lester Caine - G8HFL
-----------------------------
Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://home.lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

attached mail follows:


On Mon, Apr 7, 2008 at 1:05 PM, Lester Caine <lesterlsces.co.uk> wrote:
>
> People seem to be missing the point here. These are PUBLIC applications
> that are failing to work for Noah. He should not need to re-write PHPMyAdmin
> in order to get it to work?
>
> Next people will be saying that we should re-write PHP if it does not work
> for us.

    Oh, did I say that? Must not have been paying attention as I
typed in words to that effect. Sorry.

    I'm giving steps to debug and recreate the issue, not to rewrite
anyone else's code. You may have noticed where I mentioned
cross-platform portability.

--
</Daniel P. Brown>
Ask me about:
Dedicated servers starting $59.99/mo., VPS starting $19.99/mo.,
and shared hosting starting $2.50/mo.
Unmanaged, managed, and fully-managed!

attached mail follows:


---- Lester Caine <lesterlsces.co.uk> wrote:
> Daniel Brown wrote:
> > On Mon, Apr 7, 2008 at 12:24 PM, Noah Spitzer-Williams <noahswgmail.com> wrote:
> >> Here's the error I get:
> >>
> >> Warning: include(.\file.inc.php) [function.include]: failed to open stream:
> >> No such file or directory in C:\Inetpub\httpdocs\test.php on line 3
> >>
> >> Warning: include() [function.include]: Failed opening '.\file.inc.php' for
> >> inclusion (include_path='.;.\includes;.\pear') in
> >> C:\Inetpub\httpdocs\test.php on line 3
> >
> > If you're going to use Windows-style paths, try escaping your
> > slashes and see what happens.
> >
> > <?php
> > include(".\\file.inc.php");
> > ?>
>
> People seem to be missing the point here. These are PUBLIC applications that
> are failing to work for Noah. He should not need to re-write PHPMyAdmin in
> order to get it to work?
>
> Next people will be saying that we should re-write PHP if it does not work for
> us.
>
> Noah - I know that some 'security' has been added to the include function, but
> I'm not sure why you are having problems. I'm running applications on windows
> and Linux and the "./otherdir/" select is working fine.
>
> --

Funny, none of the code *I* have seen posted to the list looks like it it phpMyAdmin or anything else public.... And since when did basic debugging mean you look past the basics?

Noah- Change the includes to REQUIRE and see if the path that it outputs helps you out any with trying to figure out where things have gone wrong.

HTH,
Wolf

attached mail follows:


I am having a date time comparison issue.
I have statically set the values here. But the data is fed from the database, CaldTime is timestamp and since it will not allow me to have 2 timestamps in the same table I set the CallEnd varchar(12). Storing the data they seem to be the same for output. I checked hexadecimal and binary to look for obscurities.

$sqldata['CaldTime'] = "2008-04-07 11:15:32";
$sqldata['CallEnd'] = "2008-04-07 11:17:17";

$time1 = strtotime("$sqldata[CaldTime]");
$time2 = strtotime("$sqldata[CallEnd]");
$interval = $time2 - $time1;

echo $interval;

+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Displays like 1.75:0
I am looking for a more precise time like 1:45 instead.
Am I looking at this all wrong for time difference?

Richard L. Buskirk
Sorry my murloc got pawned in AV, and ever since I cant think right!

attached mail follows:


On Mon, Apr 7, 2008 at 9:42 AM, <adminbuskirkgraphics.com> wrote:

> I am having a date time comparison issue.
> I have statically set the values here. But the data is fed from the
> database, CaldTime is timestamp and since it will not allow me to have 2
> timestamps in the same table I set the CallEnd varchar(12). Storing the data
> they seem to be the same for output. I checked hexadecimal and binary to
> look for obscurities.
>
>
> $sqldata['CaldTime'] = "2008-04-07 11:15:32";
> $sqldata['CallEnd'] = "2008-04-07 11:17:17";
>
> $time1 = strtotime("$sqldata[CaldTime]");
> $time2 = strtotime("$sqldata[CallEnd]");
> $interval = $time2 - $time1;
>
> echo $interval;
>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Displays like 1.75:0
> I am looking for a more precise time like 1:45 instead.
> Am I looking at this all wrong for time difference?

hmm.
different results for me w/ this code

<?php
$time1 = strtotime('2008-04-07 11:15:32');
$time2 = strtotime('2008-04-07 11:17:17');

echo "time1: $time1" . PHP_EOL;
echo "time2: $time2" . PHP_EOL;

$interval = $time2 - $time1;
echo $interval . PHP_EOL;
?>

time1: 1207588532
time2: 1207588637
105

-nathan

attached mail follows:


On Mon, Apr 7, 2008 at 11:42 AM, <adminbuskirkgraphics.com> wrote:
>t the data is fed from the database, CaldTime is timestamp and since
it will not allow me to have 2 timestamps in
> the same table

?? What database are you using? It sounds like it has a specific
meaning of "timestamp" - probably "the last time this row was
modified" - and you want an arbitrary date column, which would
probably be a different column type. Not a string, though. An actual
date type. possible names are date, datetime, datestamp...

, and you I set the CallEnd varchar(12). Storing the data they seem
to be the same for output. I checked hexadecimal and binary to look
for obscurities.
>
>
> $sqldata['CaldTime'] = "2008-04-07 11:15:32";
> $sqldata['CallEnd'] = "2008-04-07 11:17:17";
>
> $time1 = strtotime("$sqldata[CaldTime]");
> $time2 = strtotime("$sqldata[CallEnd]");
> $interval = $time2 - $time1;
>
> echo $interval;
>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Displays like 1.75:0
> I am looking for a more precise time like 1:45 instead.
> Am I looking at this all wrong for time difference?

strtotime returns an integer number of seconds. The difference
between $time1 and $time2 is 105. If you want minutes and seconds,
you have to do the math yourself.

$interval_min = floor($interval/60);
$interval_sec = $interval % 60;

echo "$interval_min:$interval_sec";

--
Mark J. Reed <markjreedmail.com>

attached mail follows:


Yes my mistake was looking at another record and published another.
But I figured it out now i can publish 1:45 like i wanted. Having a moment there.
Thank you
Richard L. Buskirk 

 
On Mon, Apr 7, 2008 at 9:42 AM, <adminbuskirkgraphics.com> wrote:

I am having a date time comparison issue.
I have statically set the values here. But the data is fed from the database, CaldTime is timestamp and since it will not allow me to have 2 timestamps in the same table I set the CallEnd varchar(12). Storing the data they seem to be the same for output. I checked hexadecimal and binary to look for obscurities.

$sqldata['CaldTime']  = "2008-04-07 11:15:32";
$sqldata['CallEnd'] = "2008-04-07 11:17:17";

$time1 = strtotime("$sqldata[CaldTime]");
$time2 = strtotime("$sqldata[CallEnd]");
$interval = $time2 - $time1;

echo $interval;

+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Displays like 1.75:0
I am looking for a more precise time like 1:45 instead.
Am I looking at this all wrong for time difference?

hmm.
different results for me w/ this code

<?php
$time1 = strtotime('2008-04-07 11:15:32');
$time2 = strtotime('2008-04-07 11:17:17');

echo "time1: $time1" . PHP_EOL;
echo "time2: $time2" . PHP_EOL;

$interval =  $time2 - $time1;
echo $interval . PHP_EOL;
?>

time1: 1207588532
time2: 1207588637
105
 -nathan

attached mail follows:


Thank you that is exactly what i did to figure it out.
Just was having a brain fart there for a minute.

On Mon, Apr 7, 2008 at 11:42 AM, <adminbuskirkgraphics.com> wrote:
>t the data is fed from the database, CaldTime is timestamp and since
it will not allow me to have 2 timestamps in
> the same table

?? What database are you using? It sounds like it has a specific
meaning of "timestamp" - probably "the last time this row was
modified" - and you want an arbitrary date column, which would
probably be a different column type. Not a string, though. An actual
date type. possible names are date, datetime, datestamp...

, and you I set the CallEnd varchar(12). Storing the data they seem
to be the same for output. I checked hexadecimal and binary to look
for obscurities.
>
>
> $sqldata['CaldTime'] = "2008-04-07 11:15:32";
> $sqldata['CallEnd'] = "2008-04-07 11:17:17";
>
> $time1 = strtotime("$sqldata[CaldTime]");
> $time2 = strtotime("$sqldata[CallEnd]");
> $interval = $time2 - $time1;
>
> echo $interval;
>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Displays like 1.75:0
> I am looking for a more precise time like 1:45 instead.
> Am I looking at this all wrong for time difference?

strtotime returns an integer number of seconds. The difference
between $time1 and $time2 is 105. If you want minutes and seconds,
you have to do the math yourself.

$interval_min = floor($interval/60);
$interval_sec = $interval % 60;

echo "$interval_min:$interval_sec";

--
Mark J. Reed <markjreedmail.com>

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

attached mail follows:


On Mon, Apr 7, 2008 at 11:42 AM, <adminbuskirkgraphics.com> wrote:
> I am having a date time comparison issue.
> I have statically set the values here. But the data is fed from the database, CaldTime is timestamp and since it will not allow me to have 2 timestamps in the same table I set the CallEnd varchar(12). Storing the data they seem to be the same for output. I checked hexadecimal and binary to look for obscurities.
>
>
> $sqldata['CaldTime'] = "2008-04-07 11:15:32";
> $sqldata['CallEnd'] = "2008-04-07 11:17:17";
>
> $time1 = strtotime("$sqldata[CaldTime]");
> $time2 = strtotime("$sqldata[CallEnd]");
> $interval = $time2 - $time1;
>
> echo $interval;
>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Displays like 1.75:0
> I am looking for a more precise time like 1:45 instead.
> Am I looking at this all wrong for time difference?
>
> Richard L. Buskirk
> Sorry my murloc got pawned in AV, and ever since I cant think right!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

    This could be simplified to a function, but using some basic math....

<?php
$sqldata['CaldTime'] = "2008-04-07 11:15:32";
$sqldata['CallEnd'] = "2008-04-07 11:17:17";

$converted = explode('.',((strtotime($sqldata['CallEnd']) -
strtotime($sqldata['CaldTime'])) / 60));
$converted[1] = (($converted[1] / 6) * 3.6);
echo implode(':',$converted)."\n";

?>

--
</Daniel P. Brown>
Ask me about:
Dedicated servers starting $59.99/mo., VPS starting $19.99/mo.,
and shared hosting starting $2.50/mo.
Unmanaged, managed, and fully-managed!

attached mail follows:


Dan I made a solution as below.

$time1 = strtotime("$sqldata[CaldTime]");
$time2 = strtotime("$sqldata[CallEnd]");
$interval = $time2 - $time1;
$TLength = date("i:s", strtotime("2008-01-01 01:00:$interval"));

Result 01:45

Works perfect for me. Do you agree or disagree dan?

On Mon, Apr 7, 2008 at 11:42 AM, <adminbuskirkgraphics.com> wrote:
> I am having a date time comparison issue.
> I have statically set the values here. But the data is fed from the
database, CaldTime is timestamp and since it will not allow me to have 2
timestamps in the same table I set the CallEnd varchar(12). Storing the data
they seem to be the same for output. I checked hexadecimal and binary to look
for obscurities.
>
>
> $sqldata['CaldTime'] = "2008-04-07 11:15:32";
> $sqldata['CallEnd'] = "2008-04-07 11:17:17";
>
> $time1 = strtotime("$sqldata[CaldTime]");
> $time2 = strtotime("$sqldata[CallEnd]");
> $interval = $time2 - $time1;
>
> echo $interval;
>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Displays like 1.75:0
> I am looking for a more precise time like 1:45 instead.
> Am I looking at this all wrong for time difference?
>
> Richard L. Buskirk
> Sorry my murloc got pawned in AV, and ever since I cant think right!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

    This could be simplified to a function, but using some basic math....

<?php
$sqldata['CaldTime'] = "2008-04-07 11:15:32";
$sqldata['CallEnd'] = "2008-04-07 11:17:17";

$converted = explode('.',((strtotime($sqldata['CallEnd']) -
strtotime($sqldata['CaldTime'])) / 60));
$converted[1] = (($converted[1] / 6) * 3.6);
echo implode(':',$converted)."\n";

?>

--
</Daniel P. Brown>
Ask me about:
Dedicated servers starting $59.99/mo., VPS starting $19.99/mo.,
and shared hosting starting $2.50/mo.
Unmanaged, managed, and fully-managed!

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

attached mail follows:


On Mon, Apr 7, 2008 at 1:03 PM, <adminbuskirkgraphics.com> wrote:
> Dan I made a solution as below.
>
>
> $time1 = strtotime("$sqldata[CaldTime]");
> $time2 = strtotime("$sqldata[CallEnd]");
> $interval = $time2 - $time1;
> $TLength = date("i:s", strtotime("2008-01-01 01:00:$interval"));
>
> Result 01:45
>
> Works perfect for me. Do you agree or disagree dan?

    There ya' go!

--
</Daniel P. Brown>
Ask me about:
Dedicated servers starting $59.99/mo., VPS starting $19.99/mo.,
and shared hosting starting $2.50/mo.
Unmanaged, managed, and fully-managed!

attached mail follows:


Daniel Brown wrote:
> On Sun, Apr 6, 2008 at 10:36 PM, Richard Lee <rich.japhgmail.com> wrote:
>
>> I am trying to open a big file and go through line by line while limiting
>> the resource on the system.
>> What is the best way to do it?
>>
>> Does below read the entire file and store them in memory(not good if that's
>> the case)..
>>
>> open(SOURCE, "/tmp/file") || die "not there: $!\n";
>> while (<SOURCE>) {
>> ## do something
>> }
>>
>
> Was there a reason this was sent to the PHP list as well? Maybe
> just a typo?
>
>
def a typo.. sorry about that

attached mail follows:


On Mon, Apr 7, 2008 at 11:44 AM, Richard Lee <rich.japhgmail.com> wrote:
> Daniel Brown wrote:
> >
> > Was there a reason this was sent to the PHP list as well? Maybe
> > just a typo?
> >
> def a typo.. sorry about that
>

    No problem at all. Just checking in case the PHP question was
missed or something. I know all about typos. I keep typing "funeral"
instead of "wedding" for June 28th.

    Yes, dear, it was just a typo.... seventeen times....

--
</Daniel P. Brown>
Ask me about:
Dedicated servers starting $59.99/mo., VPS starting $19.99/mo.,
and shared hosting starting $2.50/mo.
Unmanaged, managed, and fully-managed!

attached mail follows:


hi,

I put a file "setup.exe" in a directory "downloaddir\"

I want to build PHP code, so that only registered users are able to
download the file.

How to make the directory / files only available to registered users using
PHP code?

(So that other users cannot download the file using direct url
"http:\\www.abcd.org\downloaddir\setup.exe" )

TIA
Rian

attached mail follows:


On Apr 7, 2008, at 11:56 AM, Rian Hidayanto wrote:
> hi,
>
> I put a file "setup.exe" in a directory "downloaddir\"
>
> I want to build PHP code, so that only registered users are able to
> download the file.
>
> How to make the directory / files only available to registered users
> using
> PHP code?
>
> (So that other users cannot download the file using direct url
> "http:\\www.abcd.org\downloaddir\setup.exe" )
>

I can give you the basics of this and hopefully someone can fill in
the gaps... What you need to do is put the actual file above the
webroot... and then set the include path to include that, then you
have your script go and fetch it.

Maybe this way makes more sense:
<HD>
        <Web>
                <Downloads>
                        <mydispatchscript.php>
        <INC>
                <setup.exe>
</HD>

so basically, in your php.ini file make sure you include the <INC>
directory and include the whole path to it. and you will be able to
access it but no one will be able to access the file directly.

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

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
japruimraoset.com

attached mail follows:


On Mon, Apr 7, 2008 at 11:56 AM, Rian Hidayanto <rian.smartgmail.com> wrote:
> hi,
>
> I want to build PHP code, so that only registered users are able to
> download the file.
>
> (So that other users cannot download the file using direct url
> "http:\\www.abcd.org\downloaddir\setup.exe" )

    This is just to get you started. Polishing,
modifying/customizing, and sanitizing, you're on your own.

<?php
// download.php
session_start();

if(!isset($_SESSION['username'])) {
    die("Unauthorized access.");
}

// Keep the directory out of the web root.
$download = '../downloads/download.exe';

$filename = basename($download);

header("Pragma: public")
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=".$filename.";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".sizeof($download);
readfile($download);
exit(0);

?>

--
</Daniel P. Brown>
Ask me about:
Dedicated servers starting $59.99/mo., VPS starting $19.99/mo.,
and shared hosting starting $2.50/mo.
Unmanaged, managed, and fully-managed!

attached mail follows:


---- Jason Pruim <japruimraoset.com> wrote:
>
> On Apr 7, 2008, at 11:56 AM, Rian Hidayanto wrote:
> > hi,
> >
> > I put a file "setup.exe" in a directory "downloaddir\"
> >
> > I want to build PHP code, so that only registered users are able to
> > download the file.
> >
> > How to make the directory / files only available to registered users
> > using
> > PHP code?
> >
> > (So that other users cannot download the file using direct url
> > "http:\\www.abcd.org\downloaddir\setup.exe" )
> >
>
> I can give you the basics of this and hopefully someone can fill in
> the gaps... What you need to do is put the actual file above the
> webroot... and then set the include path to include that, then you
> have your script go and fetch it.
>
> Maybe this way makes more sense:
> <HD>
> <Web>
> <Downloads>
> <mydispatchscript.php>
> <INC>
> <setup.exe>
> </HD>
>
> so basically, in your php.ini file make sure you include the <INC>
> directory and include the whole path to it. and you will be able to
> access it but no one will be able to access the file directly.
>

You could also just use the inherent apache .htaccess pieces to disable access unless they are logged in people, and allow the internal verifiers to work.

But if you aren't running on Apache, then you'll need to work along Jason's suggestion and put the files in other locations and use the scripts to access them, just build a login checker to check the user is logged in first.

HTH,
Wolf

attached mail follows:


I know popup windows are a client-side issue, but I can't figure how to
create and close a popup window from the server side only on condition,
otherwise display normal browser page.

What I want is to accept a form, check the input, if there are errors return
them to the browser, if there aren't errors then popup a modal window and
start processing (a possibly long process) while displaying results in the
popup window, then automatically close the popup after processing is
complete and redirect to normal browser page with the final results. I want
to use the popup to (a) feedback ongoing progress to the user, and (b) keep
the browser side alive because the process could take several minutes.

Googling for +php +popup is getting me nowhere, all the results are for
javascript. I know how to create a link or button that when clicked will
create a popup that will display the results of a php script, but I need to
do it the other way round. Can anyone please suggest some pointers on how to
generate a conditional popup from the server, and then get the server to
close it when done.

Thanks
Arno

attached mail follows:


---- Arno Kuhl <akuhltelkomsa.net> wrote:
> I know popup windows are a client-side issue, but I can't figure how to
> create and close a popup window from the server side only on condition,
> otherwise display normal browser page.
>
> What I want is to accept a form, check the input, if there are errors return
> them to the browser, if there aren't errors then popup a modal window and
> start processing (a possibly long process) while displaying results in the
> popup window, then automatically close the popup after processing is
> complete and redirect to normal browser page with the final results. I want
> to use the popup to (a) feedback ongoing progress to the user, and (b) keep
> the browser side alive because the process could take several minutes.
>
> Googling for +php +popup is getting me nowhere, all the results are for
> javascript. I know how to create a link or button that when clicked will
> create a popup that will display the results of a php script, but I need to
> do it the other way round. Can anyone please suggest some pointers on how to
> generate a conditional popup from the server, and then get the server to
> close it when done.
>
> Thanks
> Arno

That's because it is a CLIENT side issue, the server isn't able to do it.

If you want to provide feedback on the form, then look into Ajax or use output buffering and flushing to push out a status message as the form is processed. You could do this in a javascripted pop-up window or on the window they submitted the form.

If it takes your script minutes to process a form you need to look into your processes. I'd suggest verifying the form had all the pieces and then advising them you will email them when the registration or what-not is complete.

HTH,
Wolf

attached mail follows:


At 3:29 PM +0200 4/7/08, Emil Edeholt wrote:
>Hi,
>
>Do you guys how search engines like cookies? One site I'm working on
>now requires the user to select which region he/she is from on the
>start page. That value is stored in a cookie. So without cookies you
>can't get past the start page. Does this leave the search engines at
>the start page? Right now google only index the start pages on my
>site and I'm trying to figure out why.
>
>If I can't use cookies, how would you force users to select a region
>but letting the search engine spiders in on the site somehow?
>
>Hope this wasn't too off topic.
>
>Kind Regards Emil

Emil:

My advice -- give the SE what it's looking for. Place a description
of what your site is about on the start page. If you don't want users
to see it, then place the text off-left via css position. This would
also help those with assistive technologies and thus SE's shouldn't
complain.

Cheers,

tedd

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

attached mail follows:


Thanks so much! That seems to have done the trick. I commented out those
files in my php.ini file and then a reinstallation of ssh2 worked. Zend
must have been installed by some default setting.

Thanks again for your help Daniel!

Cheers,
Michael

On Mon, April 7, 2008 11:29 am, Daniel Brown wrote:
> On Mon, Apr 7, 2008 at 11:25 AM, Michael Stroh <strohastroh.org> wrote:
>> Thanks for your advice Daniel.
>>
>>
>> I checked the Zend forums and it is believed that they will not support
>> Mac OS 10.5 and thus the error. Is there another package I can use to
>> replace Zend for the purpose of ssh2?
>
> If you're using it for Zend Encoder-encoded files, the answer is
> no. If you just have it installed because it seems like a good idea,
> then your best bet would be to comment-out the [Zend] section of your
> php.ini and restart your HTTP server (Apache?) so that the changes
> take effect. Then try the SSH code again.
>
> --
> </Daniel P. Brown>
> Ask me about:
> Dedicated servers starting $59.99/mo., VPS starting $19.99/mo.,
> and shared hosting starting $2.50/mo.
> Unmanaged, managed, and fully-managed!
>

attached mail follows:


> Daylight Savings Time must die!

Oh, by the way, thanks for your reply.

So last night my clock went forward an hour on this cool DST-aware
dual alarm clock radio I bought in 1999. Apparently DST rules have
changed http://en.wikipedia.org/wiki/Year_2007_problem so now my clock
isn't as cool anymore. Luckily I found out before I went to sleep.

attached mail follows:


On Mon, Jun 18, 2007 at 9:49 PM, Mike Frysinger <vapier.adigmail.com> wrote:
> On 6/9/07, Richard Lynch <ceol-i-e.com> wrote:
> > On Sat, June 9, 2007 4:27 pm, Mike Frysinger wrote:
> > > anyone know of some software to generate images like this:
> > > http://wh0rd.org/register.png
> > > idea is i have a list of registers and their bit meanings, and i want
> > > to automatically generate images like the above one from this data
> > >
> > > yes, i can write some custom code in PHP using GD, but i'd much rather
> > > use someone else's work than start from scratch
> >
> > It's remotely possible that you could hack something from JP Graph to
> > look not completely unlike that...
> >
> > Though I suspect you might find it easier to start from scratch,
> > honestly...
>
> yeah ive just started from scratch ... here's what ive got so far in
> case anyone happens to wander across this ...
>
> $reg = new register("WDOG_CTL", "Watchdog Control Register",
> 0xFFC00200, 0x0AD0, 16,
> array(
> array(15, 15, "WDRO", "0 - Watchdog timer has not expired\n1 -
> Watchdog timer has expired", W1C),
> array(11, 4, "WDEN", "0xAD - Counter disabled\nAll other
> values - Counter enabled"),
> array(2, 1, "WDEV", "00 - Generate reset event\n01 - Generate
> NMI\n10 - Generate GP interrupt\n11 - Disable event generation")
> )
> );
> register_to_png($reg);
>
> http://wh0rd.org/register2.png
>
> maybe i'll start a cheesy sf project for it

anyone who is interested in such a beast:
http://docs.blackfin.uclinux.org/lib/plugins/register/register.phps

and some examples:
http://docs.blackfin.uclinux.org/lib/plugins/register/register/pll_ctl.png
http://docs.blackfin.uclinux.org/lib/plugins/register/register/seqstat.png
http://docs.blackfin.uclinux.org/lib/exe/fetch.php?cache=&media=register%3A4141379fb2519eb98ab596d6d08f4e1e.png

hopefully someone else will find it useful
-mike

attached mail follows:


{sorry for top-posting, but outlook can't do better}

I executed "cat /usr/local/lib/php.ini | grep -i session" and found out that
there was already one entry for that conf option by default, and it was set
to 0.

It fixed it, sorry I was that dumb.

Just saw the source and it is adding the phpsessid hidden input field, now
have to find out why my app does not let me login :)

Another question:

        Is there a way to make php use these fields instead of cookies for
session control? I still want to let cookies enabled for other stuff, but as
it's messing up with multiple sessions because of poor cookie handling.

Thanks!!

-----Mensagem original-----
De: Keith Roberts [mailto:keithkarsites.net]
Enviada em: segunda-feira, 7 de abril de 2008 17:38
Para: php-installlists.php.net
Assunto: Re: [PHP-INSTALL] Can't enable use_trans_sid

On Mon, 7 Apr 2008, Thiago Pojda wrote:

> To: php-installlists.php.net
> From: Thiago Pojda <thiago.pojdasoftpartech.com.br>
> Subject: [PHP-INSTALL] Can't enable use_trans_sid
>
> Guys,
>
> I can't enable trans_sid, I've tried set these to php.ini :
>
> session.use_trans_sid = On [tried 1 also] url_rewriter.tags =
> "a=href,area=href,frame=src,input=src,form=fakeentry,fieldset="
>
> Tried recompile it with --enable-trans-sid but still doesn't work. I
> just realized that my phpinfo spits "session.use_trans_sid Off".
>
> Any hints?
>
> -- VERSIONS --
>
> PHP Version 4.4.8
>
>
> System Linux debian 2.6.18-6-486 #1 Sun Feb 10
22:06:33 UTC 2008 i686
> Build Date Apr 7 2008 10:46:06
> Configure Command './configure' '--with-apxs2=/usr/bin/apxs2'
> '--with-oci8-instant-client=/oracle/instantclient/' '--disable-zts'
> Server API Apache 2.0 Handler
> Virtual Directory Support enabled
> Configuration File (php.ini) Path /usr/local/lib/php.ini

Are you sure you are editing the correct php.ini file Thiago?

Can you also post the section from your php.ini that has all
the session.* directives in it?

It maybe that there are other session.* configuration options
that need to be set as well to enable you to use PHP sessions.

Kind Regards,

Keith Roberts

-----------------------------------------------------------------
Websites:
http://www.php-debuggers.net
http://www.karsites.net
http://www.raised-from-the-dead.org.uk

All email addresses are challenge-response protected with TMDA
[http://tmda.net]
-----------------------------------------------------------------

attached mail follows:


Hello,

I am mostly familiar with php for serving up web pages; however,
recently I have been writing a local command line script on my WinXP
machine. I have spent the better part of this last week and all of
today trying to figure out a way to send a mouse click to a particular
window on the screen.

I first saw w32api.dll on the php.net site. However, I cannot find this
dll, but this searching took me to winbinder and php-gtk2. It seems
that I can only get winbinder to get (not send) mouse information: event
type and x,y positions. I am not too familiar with php-gtk nor creating
dlls.

I want to use my local php command line script on my winXP machine to
send mouse events (click) to a window. I am open to any ideas on how to
do this.

For C++ and VB there seems to be the SendMessage() function. Is there a
way to tap into that function from my php script?

winbinder has a function that wraps the SendMessage() function called
wb_send_message, but after literally 9 hours i quit.

on the MSDN.microsoft site, I saw the functions mouse_event() and
SendInput() of the "user32.dll"

http://msdn2.microsoft.com/en-us/library/ms646310.aspx
http://msdn2.microsoft.com/en-us/library/aa932376.aspx

I copied the "user32.dll" to my php/ext folder and tried loading the
"user32.dll" both as an extension directive in php.ini and by using the
dl() function in my script (dl() is enabled). However, both methods
gave me a PHP warning:

as an extension in php.ini it gives the following error:

PHP Warning: PHP Startup: Invalid library (maybe not a PHP library)
'user32.dll
' in Unknown on line 0

get_loaded_extensions() confirms user32.dll never gets loaded.

invoking dl("user32.dll") yields the warning:

PHP Warning: dl(): Invalid library (maybe not a PHP library)
'user32.dll' in [my script]

Possible ideas:
-Load a dll with the dl() function? (Write the dll with VB or C++)
-use the w32api_register_function() in php somehow to 'tap' into windows
api functions.
-use a project that can assist me in this like php-gtk2 or winbinder
-maybe someone has a copy of w32api.dll
-something about COM objects, though i am really not familiar

It seems as though the C languages and VB languages can do this.
Perhaps I could write and compile a dll in that language, somehow load
it up in php (even though i am having errors doing that currently), then
I can use those functions in my dll to send my mouse clicks through php.

I am throwing out this question to the community and wondering what your
suggestions would be for how to go about sending a mouse click event to
my windows api from a php script.

I am not interested in writing javascript as this is not a web application.

Any thoughts, comments, suggestions, about how to do send mouse events
from a php script will be much appreciated.

Thanks in advance,

attached mail follows:


PHP list,

Solving my own issue:

It turns out that some PHP scripts had an extra carriage return
character at the end of the file. Once I removed these, the problem went
away.

Strange that it only happened on some servers, not others, but there it is.

--
Dave M G
Articlass - open source CMS
http://articlass.org

attached mail follows:


Hi,

Is it possible for an array to point a function:

Asignmanet

$ArrayPointer = $this->MyFunction;

Invoke:

$ArraryPointer();