php-general Digest 10 Oct 2005 12:23:46 -0000 Issue 3729
Topics (messages 223794 through 223811):
Re: Get Mac Address
223794 by: M. Sokolewicz
223795 by: Andrew Brampton
223800 by: Rory Browne
Re: Mystery about chmod and permissions
223796 by: Al
mambo question..??
223797 by: bruce
223798 by: Wee Keat
Send postcard link
223799 by: Roger Thomas
223803 by: Torgny Bjers
I want to know if some link is online
223801 by: Jesús Alain Rodríguez Santos
223802 by: Jasper Bryant-Greene
GET variables and mySQL functions inside an Image header.
223804 by: Kristopher Kane
223805 by: Robert Cummings
223806 by: David Tulloh
223807 by: Gustav Wiberg
Re: caching parsed XML files as DOM objects in memory
223808 by: Petr Smith
Re: How do I POST data with headers & make the browser follow?
223809 by: Mark Rees
PHP5 Soap + .NET Webservice
223810 by: Chris Hemmings
getting php to generate a 503
223811 by: dnwo.xtra.co.nz
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 ---
That will give you the *local* mac address, not that of the user
visiting your page. The problem is the fact that the mac address is not
sent as part of the REQUEST. As such it's not possible for PHP to find
out what it is. So, unfortunately, no. (Though it's a very common
question on this list)
- tul
Rory Browne wrote:
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 ---
M. Sokolewicz have you ever typed arp at a command line?
It may give you a local mac address, but it is normally used to show your
arp cache.
Now if you are on the same physical segment as the requester than you can
obtain to mac address from parsing the output and matching it to the
requesting IP.
For example my machine is IP 192.168.0.10, and a client on my network
(192.168.0.188) just hit my webserver. Shelling out "arp -a" shows me this
(under windows):
Interface: 192.168.0.10 --- 0x2
Internet Address Physical Address Type
192.168.0.1 00-02-78-71-53-a8 dynamic
192.168.0.188 00-50-8d-e7-5d-6b dynamic
Now the trick is to match up _SERVER["REMOTE_ADDR"] with the correct line
from the output, and voila this gives me the mac address of the client
requesting from my server.
The problem you face is when the remote client is on a different physical
segment, as such its impossible (or extremely difficult without additional
technologies) to obtain their MAC address. As Ben said he was using a local
intranet server I'm sure Rory Browne's post is completely valid, for request
from his LAN.
Andrew
----- Original Message -----
From: "M. Sokolewicz" <[EMAIL PROTECTED]>
To: "Rory Browne" <[EMAIL PROTECTED]>
Cc: "Ben Sagal" <[EMAIL PROTECTED]>; <[email protected]>
Sent: Sunday, October 09, 2005 11:52 PM
Subject: Re: [PHP] Get Mac Address
That will give you the *local* mac address, not that of the user visiting
your page. The problem is the fact that the mac address is not sent as
part of the REQUEST. As such it's not possible for PHP to find out what it
is. So, unfortunately, no. (Though it's a very common question on this
list)
- tul
Rory Browne wrote:
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On 10/10/05, M. Sokolewicz <[EMAIL PROTECTED]> wrote:
> That will give you the *local* mac address, not that of the user
> visiting your page. The problem is the fact that the mac address is not
> sent as part of the REQUEST. As such it's not possible for PHP to find
> out what it is. So, unfortunately, no. (Though it's a very common
> question on this list)
>
Normally I would agree, but he said he was running a local intranet server.
arp will work, if you're on the same network as the computer you are
querying, but if not, then arp will give you the mac address of the
router.
arp can be used to get the mac of a certain machine as well(identified
by its IP), as well as listing out the cache of machines that have
recently connected.
> - tul
>
> Rory Browne wrote:
> > 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 ---
Jeffrey Santos wrote:
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.?
That did it. Thanks....
--- End Message ---
--- Begin Message ---
hi...
i'm going through the mambo app, trying to figure out where in the code the
app starts to generate the actual menus for the Admin functions. i've
tracked the actual code that gets generated "mod_fullmenu.php" but i can't
seem to tell exactly how this code in the jscript gets generated... it
appears that the "mod_fullmenu" page is somehow included, but i can't find
out where this happens.
and yeah, i've tried to ask/send emails to people on the mambo list with no
luck. so i figured i'd ask here, if anybody has experience with playing with
the code of mambo...
thanks
bruce
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Bruce,
I'm not sure what exactly you need to know, but I'll try to clarify a
few thing for you at best that I can.
bruce wrote:
> i'm going through the mambo app, trying to figure out where in the code the
> app starts to generate the actual menus for the Admin functions. i've
> tracked the actual code that gets generated "mod_fullmenu.php" but i can't
> seem to tell exactly how this code in the jscript gets generated... it
The full menu utilizes JSCookmenu class, where the menu items are
hardcoded in the mod_fullmenu.php, from around line: 60 - 320+
> appears that the "mod_fullmenu" page is somehow included, but i can't find
> out where this happens.
Here's what I don't quite understand what you mean by "where this
happens". Did you mean how the mod_fullmenu.php is eval'd?
The way Mambo works is by 'including' the scripts into different
sections by using the mosLoadAdminModule('position_name') function call.
The funcion just regurgitates the PHP code so that it is interpreted.
> and yeah, i've tried to ask/send emails to people on the mambo list with no
> luck. so i figured i'd ask here, if anybody has experience with playing with
> the code of mambo...
I have quite a few years of experience in dealing with Mambo, but I'm
definitely no expert. Hope that helps anyway.
--
Wee Keat Chin
--- End Message ---
--- Begin Message ---
On server-1 I have my photogallery working. On another box, server-2, I have my
postcard script also working great. Users can send postcards using ready
inhouse designs or upload their own (max 100K). Both have been serving our
community for the past 2 years or so.
Current requirement:
When I browsed my photogallery, I would like to have a button that says 'Send
this picture as postcard'. Behind the scenes, how do I send that picture to
server-2 postcard script?
Please advise.
--
Roger
---------------------------------------------------
Sign Up for free Email at http://ureg.home.net.my/
---------------------------------------------------
--- End Message ---
--- Begin Message ---
Roger Thomas wrote:
>On server-1 I have my photogallery working. On another box, server-2, I have
>my postcard script also working great. Users can send postcards using ready
>inhouse designs or upload their own (max 100K). Both have been serving our
>community for the past 2 years or so.
>
>Current requirement:
>
>When I browsed my photogallery, I would like to have a button that says 'Send
>this picture as postcard'. Behind the scenes, how do I send that picture to
>server-2 postcard script?
>
>
>
The easiest way would probably be to use file_get_contents, which is
binary safe. The file_get_contents function supports opening remote
files if allow_url_fopen is activated.
An example:
$handle = fopen("ftp://user:[EMAIL PROTECTED]/somefile.txt", "r");
Regards,
Torgny
--- End Message ---
--- Begin Message ---
I would like to know if a web is online, a have this code:
enlace.php
<?
$vivo = "verde.gif";
$muerto = "rojo.gif";
$enlinea = fopen("$enlace", "r");
if (!$enlinea){
header("Location: $muerto");
}
else {
header("Location: $vivo");
}
fclose($enlinea);
?>
In other page I hve this:
page.php
<img src="estado.php?enlace=http://www.cfg.jovenclub.cu">
Somebody can tell me what it's wrong, because the image did not
show, of course that the pages and bouth image are in the same
dorectory.
Please any suggestion
--
Este mensaje ha sido analizado por MailScanner
en busca de virus y otros contenidos peligrosos,
y se considera que está limpio.
--- End Message ---
--- Begin Message ---
Jesús Alain Rodríguez Santos wrote:
I would like to know if a web is online, a have this code:
enlace.php
<?
$vivo = "verde.gif";
$muerto = "rojo.gif";
$enlinea = fopen("$enlace", "r");
Why not use file_exists()? Also, you probably want to use
$_GET['enlance'] rather than $enlance.
if (!$enlinea){
header("Location: $muerto");
}
You need to specify an absolute URI here
(http://www.example.com/myimage.gif for example).
--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/
--- End Message ---
--- Begin Message ---
I am currently in Afghanistan and don't have much access to look these
questions up. I consider them basic and regret having to post them here.
When passing variables using GET as in:
index.php?first=value?second=value
My script is reading the first value, however through an included file and
another function, it can't read the second. What scope do these variables
have? Or what other reasons for not being able to read the variables might
there be?
Second:
When dynamcially creating an image:
I am drawing an image based on data retreived from a mySQL resource.
However, my DB code is in the same file as the php image file and I get the
non-descriptive error of "Error in the image 'url'" Are you allowed to do
any other functions inside an image header other than image functions?
(Functions being; open a connection to mySQL and do queries)
Thank you for your help,
-Kristopher Kane
--- End Message ---
--- Begin Message ---
On Mon, 2005-10-10 at 02:33, Kristopher Kane wrote:
> I am currently in Afghanistan and don't have much access to look these
> questions up. I consider them basic and regret having to post them here.
> When passing variables using GET as in:
> index.php?first=value?second=value
> My script is reading the first value, however through an included file and
> another function, it can't read the second. What scope do these variables
> have? Or what other reasons for not being able to read the variables might
> there be?
Register globals is set to OFF, which is good unless your script
previously relied on it being set to ON. To access the values use the
super global $_GET:
$first = isset( $_GET['first'] ) ? $_GET['first'] : '';
$second = isset( $_GET['second'] ) ? $_GET['second'] : '';
> Second:
> When dynamcially creating an image:
> I am drawing an image based on data retreived from a mySQL resource.
> However, my DB code is in the same file as the php image file and I get the
> non-descriptive error of "Error in the image 'url'" Are you allowed to do
> any other functions inside an image header other than image functions?
> (Functions being; open a connection to mySQL and do queries)
Is the error a PHP error or a browser error? You can do any PHP code you
want in an image generating page.
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. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
Kristopher Kane wrote:
I am currently in Afghanistan and don't have much access to look these
questions up. I consider them basic and regret having to post them here.
When passing variables using GET as in:
index.php?first=value?second=value
My script is reading the first value, however through an included file and
another function, it can't read the second. What scope do these variables
have? Or what other reasons for not being able to read the variables might
there be?
Your GET syntax is wrong, you should be using:
index.php?first=value&second=value
The way you were doing it you should see the second variable contained within
the first value.
Second:
When dynamcially creating an image:
I am drawing an image based on data retreived from a mySQL resource.
However, my DB code is in the same file as the php image file and I get the
non-descriptive error of "Error in the image 'url'" Are you allowed to do
any other functions inside an image header other than image functions?
(Functions being; open a connection to mySQL and do queries)
Thank you for your help,
-Kristopher Kane
You can use any valid PHP code before or after sending an image header
so long as you don't inadvertantly output to the browser. I am not sure
what that error message means though, I'm sure someone who uses the
image functions more frequently could give you some clues.
David
--- End Message ---
--- Begin Message ---
----- Original Message -----
From: "Kristopher Kane" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, October 10, 2005 8:33 AM
Subject: [PHP] GET variables and mySQL functions inside an Image header.
I am currently in Afghanistan and don't have much access to look these
questions up. I consider them basic and regret having to post them here.
When passing variables using GET as in:
index.php?first=value?second=value
My script is reading the first value, however through an included file and
another function, it can't read the second. What scope do these variables
have? Or what other reasons for not being able to read the variables might
there be?
Try index.php?first=value&second=value
(Use & instead of questionmark after first variable)
/G
http://www.varupiraten.se/
--- End Message ---
--- Begin Message ---
I'm writing template
library based on XML. But it's not very efficient to create new
DomDocument, load XML template, process it and show on every page hit.
XML parsing is not very fast, and because I'm parsing XHTML with
entities, all DTD's are parsed too. I thought about something similar
to
java - there I can have servlet which lives all the time the server
lives. It can load XML and parse it only for the first time and send
DOM
objects to another servlets.
I need something similar with PHP, can it be done?
I think you might want to avoid trying to do it the Java way in PHP.
PHP is share-none by architectural design, not accident, so that you
can scale up by throwing as much cheap/stock hardware at it as you can
afford instead of being forced to buy a single bigger hardware box in
the center for the shared data.
It would probably make a lot more sense to store whatever you use to
uniquely identify your XML source and the results in a database or
filesystem, and then compare time-stamps in some simple business logic
to decide to re-parse or serve from cache.
Yes, that does just foist off the shared-data to the database, or
file-system -- but those systems are specifically designed to handle
this task for a long time now with a lot of heavily tested and
optimized code. PHP and even Java can't really match that level of
testing/optimization yet simply due to relative ages.
If db and filesystem are "too slow" or you already have too many
machines running this code-base, you could write your own PHP "XML
cache server" that takes an XML id and either gets it from the db/file
cache, or parses the true original, and set up your own "server" for
this express purpose and really make it scream on speed... That's
quite a bit of work, though, and for the simplicity of the code
involved, you may be better off writing it as a C application... Or
out-sourcing that bit of code to be written with specific timing
targets for the employee to meet/beat to get their just due $$$.
Thanks for lot of ideas, you are probably right I'm trying to think it
the "java way".
But my main bottleneck is the XML parsing part, so I was trying to avoid
it somehow. It is also more slower because my XML is not "normal" XML,
but XHTML file so I need to have resolveExternals=true to parse files
with XHTML entities ( < etc.)
So I cannot cache my final objects to files or database, because it
involves some sort of serialization and later (when accessing the cache)
some unserialization (the slow parse part).
That was the reason I thought about caching in memory.
I'm sure I can setup some "XML cache server" but again, how will I
exchange data with it? I cannot move all object trees between servers
(XML files couldn't be serialized).
There is last chance to write some C extension, but why use PHP then? I
can write it all in C, also with my own HTTP server :)
I think there should be some way to have all objects (including PHP
internal) stored somewhere in memory and "living" all the time the web
server lives. It solves many types of problems.
Petr
--- End Message ---
--- Begin Message ---
> basically what I am working on is integrating a step inbetween the
checkout
> and the payment gateway processing.
>
> The cardholder information is checked for enrolment in the first step, if
> the cardholder is enrolled he will need to authenticate himself by
password
> (this is where the 2nd page comes in) if the authentication is successfull
> he is forwarded to the 3rd page where the payment gateway processing takes
> place.
>
> It's like any other online payment integration i have done before but this
> time there is this extra step required due to Visa's and Mastercards new
> security feature.
>
> I didn't see an issue with passing this information along since it's
already
> used in the verification of the cardholder which also requires
> the card number.
>
> I do require the payment info again on page 3 to pass it along to the
> payment gateway, but didn't want to store it on my end for that.
>
> What I gather from Richards answer earlier that the difference between
> $_POST, $_GET or $_COOKIE, $_SESSION is almost irrelevant, I might
> as well store the detail in a session to be able to use them on page
> 3 it seems.
Are you storing people's credit card numbers locally - if so, why? It seems
like you are using them to identify users? (if that's what I am to infer
from
" I didn't see an issue with passing this information along since it's
already used in the verification of the cardholder which also requires the
card number."
If you are, consider using email addresses instead.
If you need to check whether someone already has an account with you or
whatever, do it before you take their payment details and save yourself this
bother.
Or are you using 3d secure or similar, when the user has to enter their
password/security code on the payment provider's website? That means you
have to make 2 requests with the payment data, to different websites, is
that right? One way around this might be to ask for the security code anyway
at the first step, otherwise you are stuck with persisting the information
locally.
--- End Message ---
--- Begin Message ---
Hello,
Can anyone explain how this works, and, how to fix it. I'm can't find
any documentation on the problem I am having.
I'm using a .NET webservice and a PHP SOAP call using version 5.0.4.
The returned result does not seem correct because of all the stuff at
the top, the 'xs' stuff. This makes the result invalid XML because
there are two roots to the document, <xs:schema> and <diffgr:diffgram>
I use the following call to the service and this seems to work correctly.
<?php
$client = new
SoapClient(
"http://xxxxxxx/authorswebservice/authorsservice.asmx?WSDL"
);
$response=$client->GetAuthors();
$xmls=$response->GetAuthorsResult->any;
?>
$xmls then contains:
<xs:schema xmlns:mstns="http://www.tempuri.org/authors1.xsd"
xmlns="http://www.tempuri.org/authors1.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="authors1"
targetNamespace="http://www.tempuri.org/authors1.xsd"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="authors1" msdata:IsDataSet="true" msdata:Locale="en-GB">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="authors">
<xs:complexType>
<xs:sequence>
<xs:element name="au_id" type="xs:string" />
<xs:element name="au_lname" type="xs:string" />
<xs:element name="au_fname" type="xs:string" />
<xs:element name="city" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="Constraint1" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:authors" />
<xs:field xpath="mstns:au_id" />
</xs:unique>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<authors1 xmlns="http://www.tempuri.org/authors1.xsd">
<authors diffgr:id="authors19" msdata:rowOrder="1">
<au_id>807-91-6654</au_id>
<au_lname>Panteley</au_lname>
<au_fname>Sylvia</au_fname>
<city>Rockville</city>
</authors>
<authors diffgr:id="authors20" msdata:rowOrder="2">
<au_id>846-92-7186</au_id>
<au_lname>Hunter</au_lname>
<au_fname>Sheryl</au_fname>
<city>Palo Alto</city>
</authors>
<authors diffgr:id="authors21" msdata:rowOrder="3">
<au_id>893-72-1158</au_id>
<au_lname>McBadden</au_lname>
<au_fname>Heather</au_fname>
<city>Vacaville</city>
</authors>
<authors diffgr:id="authors22" msdata:rowOrder="4">
<au_id>899-46-2035</au_id>
<au_lname>Ringer</au_lname>
<au_fname>Anne</au_fname>
<city>Salt Lake City</city>
</authors>
<authors diffgr:id="authors23" msdata:rowOrder="5">
<au_id>998-72-3567</au_id>
<au_lname>Ringer</au_lname>
<au_fname>Albert</au_fname>
<city>Salt Lake City</city>
</authors>
</authors1>
</diffgr:diffgram>
Any thoughts why this is happening, and, how I can get rid of the 'xs'
stuff.
Thanks,
Chris.
--- End Message ---
--- Begin Message ---
I want to write a php page that can return a 503 with some useful
information.
<?php
header("HTTP/1.0 503 Service Unavailable");
echo "Page execution failed.\n";
?>
Is what I've done so far - yet it doesn't work, the headers don't seem to be
modified and my page just returns the echoed contet and both firefox and IE
blithely ignore the fact that I set the server unavailable header :( can
anyone give me a clue as to what I've done wrong?
Cheers,
- Alex
--- End Message ---