php-general Digest 9 Oct 2005 22:47:13 -0000 Issue 3728

Topics (messages 223781 through 223793):

Re: per user php.ini
        223781 by: James Benson
        223782 by: Rory Browne
        223788 by: James Benson

Get Mac Address
        223783 by: Ben Sagal
        223793 by: Rory Browne

ID from lines?
        223784 by: Gustav Wiberg
        223785 by: Gustav Wiberg
        223786 by: Gustav Wiberg

Regular expressions
        223787 by: Gustav Wiberg
        223789 by: Jasper Bryant-Greene
        223792 by: Gustav Wiberg

Mystery about chmod and permissions
        223790 by: Al
        223791 by: Jeffrey Santos

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Nothing special on my configure line and the setting:-
Configuration File (php.ini) Path looks like /home/USERNAME/public_html

Only just noticed it's been switched over to CGI recently, It's also possible to have one php.ini per directory and the above mentioned setting always reflects the php.ini setting for that directory so must be something concerning httpd.



JB






Rory Browne wrote:
why not upload a phpinfo() file and see?

I'm personally not quite sure how this would work, and I'm interested
in finding out.

On 10/8/05, James Benson <[EMAIL PROTECTED]> wrote:

Hey everyone, probably missed the bit in the manual but my current
webhost allows uploading of my own php.ini to my home dir, my question
is how to do this?

My guess would be to set the ./configure line to something like
--with-config-file-path=/home/*/public_html

but I dont wanna re-compile if im wrong, can anyone tell me?

Using apache-1.3.33, php-4.4.0

Many thanks,
James Benson.

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



--- End Message ---
--- Begin Message ---
they probably use something along the lines of mapping PHP to php -c
$HOME/php.ini

In Linux this would generally be done using binfmt_misc.

On 10/9/05, James Benson <[EMAIL PROTECTED]> wrote:
> Nothing special on my configure line and the setting:-
> Configuration File (php.ini) Path looks like /home/USERNAME/public_html
>
> Only just noticed it's been switched over to CGI recently, It's also
> possible to have one php.ini per directory and the above mentioned
> setting always reflects the php.ini setting for that directory so must
> be something concerning httpd.
>
>
>
> JB
>
>
>
>
>
>
> Rory Browne wrote:
> > why not upload a phpinfo() file and see?
> >
> > I'm personally not quite sure how this would work, and I'm interested
> > in finding out.
> >
> > On 10/8/05, James Benson <[EMAIL PROTECTED]> wrote:
> >
> >>Hey everyone, probably missed the bit in the manual but my current
> >>webhost allows uploading of my own php.ini to my home dir, my question
> >>is how to do this?
> >>
> >>My guess would be to set the ./configure line to something like
> >>--with-config-file-path=/home/*/public_html
> >>
> >>but I dont wanna re-compile if im wrong, can anyone tell me?
> >>
> >>Using apache-1.3.33, php-4.4.0
> >>
> >>Many thanks,
> >>James Benson.
> >>
> >>--
> >>PHP General Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Thanks for the replies.







Rory Browne wrote:
they probably use something along the lines of mapping PHP to php -c
$HOME/php.ini

In Linux this would generally be done using binfmt_misc.

On 10/9/05, James Benson <[EMAIL PROTECTED]> wrote:

Nothing special on my configure line and the setting:-
Configuration File (php.ini) Path looks like /home/USERNAME/public_html

Only just noticed it's been switched over to CGI recently, It's also
possible to have one php.ini per directory and the above mentioned
setting always reflects the php.ini setting for that directory so must
be something concerning httpd.



JB






Rory Browne wrote:

why not upload a phpinfo() file and see?

I'm personally not quite sure how this would work, and I'm interested
in finding out.

On 10/8/05, James Benson <[EMAIL PROTECTED]> wrote:


Hey everyone, probably missed the bit in the manual but my current
webhost allows uploading of my own php.ini to my home dir, my question
is how to do this?

My guess would be to set the ./configure line to something like
--with-config-file-path=/home/*/public_html

but I dont wanna re-compile if im wrong, can anyone tell me?

Using apache-1.3.33, php-4.4.0

Many thanks,
James Benson.

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



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



--- End Message ---
--- Begin Message ---
I have a local intranet server, running apache1.3+php4.  Is it
possible to get the mac address of computes which access on of my php
pages?

Ben

--- End Message ---
--- Begin Message ---
On unix
man arp

on windows
arp/h
arp/help
arp/?

sorry for short and sweet resp, but I'm falling asleep.

On 10/9/05, Ben Sagal <[EMAIL PROTECTED]> wrote:
> I have a local intranet server, running apache1.3+php4.  Is it
> possible to get the mac address of computes which access on of my php
> pages?
>
> Ben
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Hi there!

How do I get ID number from these lines? Do I have to use regular expressions?

Line #3 : NH01<><>LiteOn DVD±RW 16<>725<>http://www.varupiraten.se/web/spec_product.php?ID=1711<>PC-CD-DVD-LDW-1653S-09C<>1<> Line #4 : NH01<><>LITEON 8x<>725<>http://www.varupiraten.se/web/spec_product.php?ID=2250<>CD-DVD-LDW-811S<>1<>

/G
http://www.varupiraten.se/

--- End Message ---
--- Begin Message --- ----- Original Message ----- From: "Al Hafoudh" <[EMAIL PROTECTED]>
To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Sent: Sunday, October 09, 2005 4:38 PM
Subject: Re: [PHP] ID from lines?


/ID=([0-9]*)\</

Thanx!

/G
@varupiraten.se


Gustav Wiberg wrote:

Hi there!

How do I get ID number from these lines? Do I have to use regular expressions?

Line #3 : NH01<><>LiteOn DVD±RW 16<>725<>http://www.varupiraten.se/web/spec_product.php?ID=1711<>PC-CD-DVD-LDW-1653S-09C<>1<> Line #4 : NH01<><>LITEON 8x<>725<>http://www.varupiraten.se/web/spec_product.php?ID=2250<>CD-DVD-LDW-811S<>1<>

/G
http://www.varupiraten.se/




--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.13/124 - Release Date: 2005-10-07



--- End Message ---
--- Begin Message ---
Hi

Yes, it would work in these cases... But if there would be two or three =, then you couldn't generalize it in that matter...

/G
@varupiraten.se


----- Original Message ----- From: "Kevin Waterson" <[EMAIL PROTECTED]>
To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Sent: Sunday, October 09, 2005 4:37 PM
Subject: Re: [PHP] ID from lines?


This one time, at band camp, "Gustav Wiberg" <[EMAIL PROTECTED]> wrote:


Line #3 : NH01<><>LiteOn DVD±RW
16<>725<>http://www.varupiraten.se/web/spec_product.php?ID=1711<>PC-CD-DVD-LDW-1653S-09C<>1<>
Line #4 : NH01<><>LITEON
8x<>725<>http://www.varupiraten.se/web/spec_product.php?ID=2250<>CD-DVD-LDW-811S<>1<>

explode on "="

Kevin
--
"Democracy is two wolves and a lamb voting on what to have for lunch.
Liberty is a well-armed lamb contesting the vote."


--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.13/124 - Release Date: 2005-10-07

--- End Message ---
--- Begin Message ---
Hi there!

I'm no good at reg exp... Yes, I confess..

Here's my code


<?php
$lines = file('export/nhExportVarupiraten.txt');

// Loop through our array, show HTML source as HTML source; and line numbers too.
foreach ($lines as $line_num => $line) {

echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";

if ($line_num > 0 ) {
 $getName = explode('<>', $line);
 $pattern = "/ID=([0-9]*)\</";
 $subject = $line;
 $idNumber = preg_split($pattern, $subject);

 echo "NAME = " . $getName[2] . " has ID number=$idNumber[0]<br>";
}
//require("phpfunctions/opendb.php");
//$sql = "UPDATE beskrivandeVarunamn=" . safeQuote($bNamn) . " WHERER"
//mysql_close();

}

?>

Output of this code is something like this:
Line #0 : Varupiraten<>http://www.varupiraten.se/ NH01<><>Liteon DVD±RW<>1225<>http://www.varupiraten.se/web/spec_product.php?ID=2252<>PC-CD-DVD-LDW-SOHW-852SX<>0<> Line #1 : NH01<><>LiteOn DVD±RW 16 x<>655<>http://www.varupiraten.se/web/spec_product.php?ID=2251<>PC-CD-DVD-LDW-1653S-01C<>1<> NAME = LiteOn DVD±RW 16 x has ID number=NH01<><>LiteOn DVD±RW 16 x<>655<>http://www.varupiraten.se/web/spec_product.php? Line #2 : NH01<><>LiteOn DVD±RW 8x<>599<>http://www.varupiraten.se/web/spec_product.php?ID=1708<>PC-CD-DVD-LDW-832S-11C<>1<> NAME = LiteOn DVD±RW 8x has ID number=NH01<><>LiteOn DVD±RW 8x<>599<>http://www.varupiraten.se/web/spec_product.php? Line #3 : NH01<><>LiteOn DVD±RW 16<>725<>http://www.varupiraten.se/web/spec_product.php?ID=1711<>PC-CD-DVD-LDW-1653S-09C<>1<> NAME = LiteOn DVD±RW 16 has ID number=NH01<><>LiteOn DVD±RW 16<>725<>http://www.varupiraten.se/web/spec_product.php? Line #4 : NH01<><>LITEON 8x<>725<>http://www.varupiraten.se/web/spec_product.php?ID=2250<>CD-DVD-LDW-811S<>1<> NAME = LITEON 8x has ID number=NH01<><>LITEON 8x<>725<>http://www.varupiraten.se/web/spec_product.php?


Just focus on $idNumber[0] in the code above... In the last row I get an output of LITEON 8x<>725<>http://www.varupiraten.se/web/spec_product.php?

I want to get an output of 2250. I do I achieve that?

/G
http://www.varupiraten.se/

--- End Message ---
--- Begin Message ---
Gustav Wiberg wrote:
<?php
$lines = file('export/nhExportVarupiraten.txt');

// Loop through our array, show HTML source as HTML source; and line numbers too.
foreach ($lines as $line_num => $line) {

echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";

if ($line_num > 0 ) {
 $getName = explode('<>', $line);
 $pattern = "/ID=([0-9]*)\</";
 $subject = $line;
 $idNumber = preg_split($pattern, $subject);

// instead of preg_split, use preg_match

$idNumber = preg_match($pattern, $subject, $matches);

// your ID number is now in $matches[1]


 echo "NAME = " . $getName[2] . " has ID number=$idNumber[0]<br>";
}
//require("phpfunctions/opendb.php");
//$sql = "UPDATE beskrivandeVarunamn=" . safeQuote($bNamn) . " WHERER"
//mysql_close();

}

?>

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

--- End Message ---
--- Begin Message --- ----- Original Message ----- From: "Jasper Bryant-Greene" <[EMAIL PROTECTED]>
To: "PHP General" <[email protected]>
Sent: Sunday, October 09, 2005 8:06 PM
Subject: Re: [PHP] Regular expressions


Gustav Wiberg wrote:
<?php
$lines = file('export/nhExportVarupiraten.txt');

// Loop through our array, show HTML source as HTML source; and line numbers too.
foreach ($lines as $line_num => $line) {

echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";

if ($line_num > 0 ) {
 $getName = explode('<>', $line);
 $pattern = "/ID=([0-9]*)\</";
 $subject = $line;
 $idNumber = preg_split($pattern, $subject);

// instead of preg_split, use preg_match

$idNumber = preg_match($pattern, $subject, $matches);

// your ID number is now in $matches[1]


 echo "NAME = " . $getName[2] . " has ID number=$idNumber[0]<br>";
}
//require("phpfunctions/opendb.php");
//$sql = "UPDATE beskrivandeVarunamn=" . safeQuote($bNamn) . " WHERER"
//mysql_close();

}

?>

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

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



--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.13/124 - Release Date: 2005-10-07


Hi there!

Thanx, I'll try that! :-)

/G
http://www.varupiraten.se/

--- End Message ---
--- Begin Message ---
I've got a script that checks a directory's permissions for 757 and if they are 
not correct, chmods them with a cgi script.

That part works just fine. Can alternately switch the permissions from 755 to 757 and back. I can use a ftp utility to check the permissions and they are correct.

The mystery is that I have a permissions check following the chmod and it reports the permissions that existed before the change.

snippets:

include "http://$server/cgi-bin/chg_perms.cgi?name=$fp_name&perms=$fperms";;  
//e.g., $fperms= 0757;

[I've tried sleep(10) here; doesn't help]

echo "Directory permissions for $dirname:  ". substr(sprintf('%o', 
fileperms($dirname)), -3). "  //reports 0755;

If I run the script again with the same permissions, the report shows the 
correct permissions.

It's as if permissions check code is executed before the chmod; but it isn't. I've tried echoed the times for the chmod code and the permissions check and the chmod code is definitely before the permissions check.

Anyone have an explanation.?

--- End Message ---
--- Begin Message ---
To save on computing time, the results of the fileperms command are
cached... I assume when you run a new instance of the program, it uses a new
cache / old one is deleted when the first instance ends.  Either way, you
should clear the cache first:

clearstatcache();

echo "Directory permissions for $dirname:  ". substr(sprintf('%o',
fileperms($dirname)), -3). "  //reports 0755;

Give that a try

- Jeff
-----Original Message-----
From: Al [mailto:[EMAIL PROTECTED] 
Sent: Sunday, October 09, 2005 3:50 PM
To: [email protected]
Subject: [PHP] Mystery about chmod and permissions

I've got a script that checks a directory's permissions for 757 and if they
are not correct, chmods them with a cgi script.

That part works just fine.  Can alternately switch the permissions from 755
to 757 and back. I can use a ftp utility to 
check the permissions and they are correct.

The mystery is that I have a permissions check following the chmod and it
reports the permissions that existed before 
the change.

snippets:

include "http://$server/cgi-bin/chg_perms.cgi?name=$fp_name&perms=$fperms";;
//e.g., $fperms= 0757;

[I've tried sleep(10) here; doesn't help]

echo "Directory permissions for $dirname:  ". substr(sprintf('%o',
fileperms($dirname)), -3). "  //reports 0755;

If I run the script again with the same permissions, the report shows the
correct permissions.

It's as if permissions check code is executed before the chmod; but it
isn't.  I've tried echoed the times for the chmod 
code and the permissions check and the chmod code is definitely before the
permissions check.

Anyone have an explanation.?

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

--- End Message ---

Reply via email to