php-general Digest 3 Nov 2002 08:44:23 -0000 Issue 1682

Topics (messages 122532 through 122546):

Re: Problem with is_dir function
        122532 by: Andrew Brampton
        122533 by: Roger Lewis

XSLT Sablotron output
        122534 by: Daniele Baroncelli

Send $out embedded in a mail in HTML FORMAT
        122535 by: Kevin Fradkin

Geographic IP location
        122536 by: olinux
        122537 by: Jason Reid
        122538 by: olinux

ereg (Why,  Does sort of  work)?
        122539 by: David Jackson

Cookies disabled, new session ID each click!
        122540 by: Steve Fatula
        122545 by: Chris Shiflett

Re: Session Management
        122541 by: Robert Samuel White

need help with project
        122542 by: Karl James
        122543 by: David Jackson
        122544 by: David Jackson

Re: PHP 4.2.3 and Apache 2.0.43 on  FreeBSD 4.7
        122546 by: Peter Black

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 ---
what values of $user_dir are you passing to is_dir?

echo them out before the test, you might be sending paths which are most
certainly not directories... for example:
c:\windows
/home/blah
would be valid, but
c:\windows\win.com
/home/blah/myfile
http://somesite/somepath
ftp://someftpserver/incoming
are invalid

Hope this helps
Andrew
----- Original Message -----
From: "Roger Lewis" <[EMAIL PROTECTED]>
To: "Php-General" <[EMAIL PROTECTED]>
Sent: Saturday, November 02, 2002 7:06 PM
Subject: [PHP] Problem with is_dir function


> I'm having a problem with the is_dir function, or maybe I don't understand
> how it supposed to work.  I'm using the following code to check whether or
> not a directory called $user_dir exists.  If it exists, I am returned the
> proper message.  But if it doesn't exist, I get the following error
message
> that says that it doesn't exist. (I already knew that!)
>
>
> <ERROR Number="8" Description="Error: &quot;stat failed for
> /home/sites/home/users/demodocs/web/userforum/user
> (errno=2 - No such file or directory)&quot; on line 175 of
> /home/sites/home/users/demo/web/user_forum/messages.php."/
>
>
> Can someone please explain what I am doing wrong here, and how to return a
> usable value if the directory doesn't exist.
>
>
> $test = is_dir($user_dir);
> if($test){echo "You have a user directory.  It is $user_dir";}
> else{echo "Your user directory doesn't exist";
> return;}
>
>
> Thanks a lot.
>
> Roger Lewis
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
I believe the path is of the correct format.
So for example, if
$user_dir = /home/sites/home/users/demodocs/web/userforum/user
and $user_dir exists, then
is_dir($user_dir) should = 1
however, if $user_dir doesn't exist, then
is_dir($user_dir) should = 0

Isn't this the correct logic?

Roger


-----Original Message-----
From: Andrew Brampton [mailto:andrew@;bramp.freeserve.co.uk]
Sent: Saturday, November 02, 2002 11:24 AM
To: Roger Lewis; [EMAIL PROTECTED]
Subject: Re: [PHP] Problem with is_dir function

what values of $user_dir are you passing to is_dir?

echo them out before the test, you might be sending paths which are most
certainly not directories... for example:
c:\windows
/home/blah
would be valid, but
c:\windows\win.com
/home/blah/myfile
http://somesite/somepath
ftp://someftpserver/incoming
are invalid

Hope this helps
Andrew
----- Original Message -----
From: "Roger Lewis" <[EMAIL PROTECTED]>
To: "Php-General" <[EMAIL PROTECTED]>
Sent: Saturday, November 02, 2002 7:06 PM
Subject: [PHP] Problem with is_dir function


> I'm having a problem with the is_dir function, or maybe I don't understand
> how it supposed to work.  I'm using the following code to check whether or
> not a directory called $user_dir exists.  If it exists, I am returned the
> proper message.  But if it doesn't exist, I get the following error
message
> that says that it doesn't exist. (I already knew that!)
>
>
> <ERROR Number="8" Description="Error: &quot;stat failed for
> /home/sites/home/users/demodocs/web/userforum/user
> (errno=2 - No such file or directory)&quot; on line 175 of
> /home/sites/home/users/demo/web/user_forum/messages.php."/
>
>
> Can someone please explain what I am doing wrong here, and how to return a
> usable value if the directory doesn't exist.
>
>
> $test = is_dir($user_dir);
> if($test){echo "You have a user directory.  It is $user_dir";}
> else{echo "Your user directory doesn't exist";
> return;}
>
>
> Thanks a lot.
>
> Roger Lewis
>
>
>
>
> --
> 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 ---
Hi guys,

I have typed a simple script to test the Sablotron module recently
installed.
I found out that the HTML is output all in one line, without newlines, which
is very annoying.
Anyone can tell me if this is a bug of the module, or I have to specify
something somewhere?

Here is the script on the server, where you can watch the result:
http://www.rockit.it/redazione/sixth/prova.php

Below you can find my PHP, XML and XSL files.


Cheers

Daniele


==========

PHP file
----------


<?php

// Allocate a new XSLT processor
$xh = xslt_create();

// call the XSLT processor directly
xslt_process($xh, 'prova.xml', 'prova.xsl', 'prova.html');

// output the result
readfile('prova.html');

xslt_free($xh);

?>

==========

XML file
-----------

<?xml version="1.0"?>
<me>
 <name>John Doe</name>
 <address>94, Main Street, Nowheresville 16463, XY</address>
 <tel>738 2838</tel>
 <email>[EMAIL PROTECTED]</email>
 <url>http://www.unknown_and_unsung.com/</url>
</me>

===========

XSL file
---------

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template match="/">

 <html>
 <head>
 </head>
 <body>
 <h1>Contact information for <b><xsl:value-of select="me/name" /></b></h1>

 <h2>Mailing address:</h2>
 <xsl:value-of select="me/address" />

 <h2>Phone:</h2>
 <xsl:value-of select="me/tel" />

 <h2>Email address:</h2>
 <xsl:value-of select="me/email" />

 <h2>Web site URL:</h2>
 <xsl:value-of select="me/url" />

 </body>
 </html>

</xsl:template>

</xsl:stylesheet>

==========


--- End Message ---
--- Begin Message ---
I read from a template, insert data and save it as a new file with html
code...
i want to send that file that is the same as $out via mail embedded in it...

i do

$fifi = fopen ('/'.$cursada.$cuatrimestre.'/'.$registronro.'.htm', "w");
$fp = $fifi;
fputs ($fifi, $out . "");
fclose ($fifi);
mail("[EMAIL PROTECTED]", "subject",$out , "From: website");

but when i receive that mail.. i get the source of the file with <html>
<body> bla bla bla.... not in HTML FORMAT..

thnx in advance!..

Spooky

--- End Message ---
--- Begin Message ---
Hi all,

I am looking for a way to determine the geographic
location based on IP address. I understand that 100%
accuracy is impossible. 

Does anyone know of a good software or service
provider that provides quality geographic detection to
US state level based on IP of website visitors. I have
tried several and find that they simply use whois
records. This is great but seems highly inaccurate.

Ideally I am looking for a utility that I can feed a
list of IP's to and then use this data to update mysql
records. 

These two services look pretty decent.

http://www.geobytes.com

http://www.serviceobjects.com/products/dots_ipgeo.asp

Thanks for any input,
olinux

__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/
--- End Message ---
--- Begin Message ---
http://www.phpclasses.org/netgeoclass

that 'should' work for what you want... someone else suggested it a while
age for another project

Jason Reid
[EMAIL PROTECTED]
--
AC Host Canada
www.achost.ca

----- Original Message -----
From: "olinux" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, November 02, 2002 5:54 PM
Subject: [PHP] Geographic IP location


> Hi all,
>
> I am looking for a way to determine the geographic
> location based on IP address. I understand that 100%
> accuracy is impossible.
>
> Does anyone know of a good software or service
> provider that provides quality geographic detection to
> US state level based on IP of website visitors. I have
> tried several and find that they simply use whois
> records. This is great but seems highly inaccurate.
>
> Ideally I am looking for a utility that I can feed a
> list of IP's to and then use this data to update mysql
> records.
>
> These two services look pretty decent.
>
> http://www.geobytes.com
>
> http://www.serviceobjects.com/products/dots_ipgeo.asp
>
> Thanks for any input,
> olinux
>
> __________________________________________________
> Do you Yahoo!?
> HotJobs - Search new jobs daily now
> http://hotjobs.yahoo.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message ---
This is a great class, but NetGeo uses only whois
records, I think that the more accurate solutions also
use some sort of ip domain name analyisis to find city
location. 

Thanks,

olinux



--- Jason Reid <[EMAIL PROTECTED]> wrote:
> http://www.phpclasses.org/netgeoclass
> 
> that 'should' work for what you want... someone else
> suggested it a while
> age for another project
> 
> Jason Reid
> [EMAIL PROTECTED]
> --
> AC Host Canada
> www.achost.ca
> 
> ----- Original Message -----
> From: "olinux" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, November 02, 2002 5:54 PM
> Subject: [PHP] Geographic IP location
> 
> 
> > Hi all,
> >
> > I am looking for a way to determine the geographic
> > location based on IP address. I understand that
> 100%
> > accuracy is impossible.
> >
> > Does anyone know of a good software or service
> > provider that provides quality geographic
> detection to
> > US state level based on IP of website visitors. I
> have
> > tried several and find that they simply use whois
> > records. This is great but seems highly
> inaccurate.
> >
> > Ideally I am looking for a utility that I can feed
> a
> > list of IP's to and then use this data to update
> mysql
> > records.
> >
> > These two services look pretty decent.
> >
> > http://www.geobytes.com
> >
> >
>
http://www.serviceobjects.com/products/dots_ipgeo.asp
> >
> > Thanks for any input,
> > olinux
> >
> > __________________________________________________
> > Do you Yahoo!?
> > HotJobs - Search new jobs daily now
> > http://hotjobs.yahoo.com/
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit:
> http://www.php.net/unsub.php
> >
> 
> 


__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/
--- End Message ---
--- Begin Message --- I'm comparing the values of a check box, against another form field, and it sort of works, but I don't understand why (A better solution? is listed below it?

TIA,
David Jackson

---------------------------
And part of the HTML Form:
---------------------------
<td><b>Account Type:</b></td>
<td>Asset</td><td><input type="radio" name="transid" value="1000"></td>
<td>Liability</td><td><input type="radio" name="transid" value="2000"></td>

<input type="text" name="coa_acct" size="5" maxlength="5">

----------------------------------
Here's the one that's puzzling me:
----------------------------------
if ( ereg("^1",$_POST['transid'])== ereg("^1",$_POST['coa_acct'])):
echo $_POST['coa_acct'];
else :
echo "Get off you Asset!";
exit;
endif;

---------------------------------------
The "better" solution using substrings?
---------------------------------------
if ( substr($_POST['transid'],0,1)== substr($_POST['coa_acct'],0,1)):
echo $_POST['coa_acct'];
else :
echo "Get off you Asset!";
exit;
endif;



--- End Message ---
--- Begin Message --- I posted this but not sure Google works, so using my own account as it did not show up yet.

I am fairly new to PHP, and am running a shopping cart app written in PHP. Most people using this cart do not have this issue, but I do!

I have boiled the program down to a few lines, and it doesn't work. When you click on the link in the code, it gives you a session ID. Then, when you click again, it goes away. The SID appears to be blank every other time.

Why would that be? I am using PHP 4.2.0 and 4.2.2, BSD and Linux, and Apache 1.3.20 something. Two different hosts. Same result. Client is IE5.5 with cookies disabled, running on NT. New session file is generated even though one already existed. This happens every other click as SID is blank every other click.

Please help me understand what the issue is.

Steve

<?php
session_name('Steve');
session_start();
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html">
<title>Test Page</title>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<?php echo '<a href="http://linux.office.home/catalog/default_test.php?' . SID . '">link to me</a>'; ?>
</body>
</html>


--- End Message ---
--- Begin Message --- Steve,

Check your php.ini file. PHP uses cookies for maintaining your Web client's unique ID, and unless you have use_trans_sid set, it will not attempt to pass the unique ID on the URL for those who have cookies disabled.

Chris

Steve Fatula wrote:

When you click on the link in the code, it gives you a session ID. Then, when you click again, it goes away. The SID appears to be blank every other time.

Why would that be? I am using PHP 4.2.0 and 4.2.2, BSD and Linux, and Apache 1.3.20 something. Two different hosts. Same result. Client is IE5.5 with cookies disabled, running on NT.

--- End Message ---
--- Begin Message ---
These were all the same assumptions I made, thanks.  I knew that it was
more of an "HTTP" thing than a "PHP" thing when it came to the "blind
faith" thing...  I was just hoping that was something "better out
there."  I'm not willing to use session management as blindly as it is
currently implemented.  I will find my own solution.

-----Original Message-----
From: John W. Holmes [mailto:holmes072000@;charter.net] 
Sent: Saturday, November 02, 2002 7:42 AM
To: 'Robert Samuel White'; [EMAIL PROTECTED]
Subject: RE: [PHP] Session Management

> I've created a class for handling session management across an
unlimited
> number of domains (without using cookies) however it has some inherent
> problems.  In order to differentiate between users, it is using the IP
> Address.  I realize this is completely inefficient, and I was hoping
> that someone could give me some pointers on how exactly PHP handles
> session management from the backend.  When not using cookies, PHP
> propagates the Session ID in the URL and a hidden variable in forms.
> However, is this even safe?  Or is this completely blind faith that
the
> Session belongs to that person?

It's blind faith, just like every other system. That's the nature of
HTTP. PHP makes a "unique" session id that it passes around to identify
the user and link all of the requests. 

> Basically, I want to know if PHP *knows for sure* the right user is
> using the right session.  In other words, can it detect hijacked
> sessions?  My guess is a resounding no.

No...and neither can any program you write that uses HTTP. The only
thing you can do is make it unique enough so that it can't be hijacked. 

> I'm wondering if there is some way to determine the real IP Address of
a
> user, even if that user is behind a proxy farm, etc., and if this is,
in
> fact, what PHP does.

No. The PHP session management isn't related to IP at all, that I know
of. It shouldn't have to be because of the problem with proxies and
people having changing IPs or people sharing IP addresses.

> If not, I'm stuck with figuring out how best to accomplish my goals
> using cookies.  The problem:  a cookie can only bet set for a single
> domain; therefore, the session will not be carried with the person if
> they browse to another domain which also uses the same eNetwizard
> Content Management Server.  A possibility is to always propagate a
State
> Id with the URL and forms, however even this would not prevent the
exact
> same problem:  Is this blind faith?

If you want the session to maintain over different domains, your only
option is to pass the unique id in the URL or POST data. It's just as
safe as cookies, but, like you said, you can't pass cookies across
domains. 

Put everything behind SSL and that's as secure as you can get. 

Hopefully I'm not too confusing. Feel free to ask more questions.

---John Holmes...





--- End Message ---
--- Begin Message ---
Hello people
 
Im in need help with creating a system where it will let me 
Add/drop players off a web page..basically of a roster with salary cap
control
And I want to do trades as well
This is for a fantasy football page.
 
And I need to have username and passwords so my owners can login and
there is no cheating..
 
http://www.ultimatefootballleague.com/index4.shtml
 
This is my site.
 
Please email me directly if you are interested in helping.
 
Thanks
Karl james 
 
 
--- End Message ---
--- Begin Message --- Karl --
Before you go "reinventing the wheel" , you might check http://freshmeat.net ... of course there is nothing actually wrong with "reinventing the wheel" *grin*

David Jackson

Karl James wrote:
Hello people
Im in need help with creating a system where it will let me Add/drop players off a web page..basically of a roster with salary cap
control
And I want to do trades as well
This is for a fantasy football page.
And I need to have username and passwords so my owners can login and
there is no cheating..
http://www.ultimatefootballleague.com/index4.shtml
This is my site.
Please email me directly if you are interested in helping.
Thanks
Karl james

--- End Message ---
--- Begin Message --- Karl --
Before you go "reinventing the wheel" , you might check http://freshmeat.net ... of course there is nothing actually wrong with "reinventing the wheel" *grin*

David Jackson

Karl James wrote:
Hello people
Im in need help with creating a system where it will let me Add/drop players off a web page..basically of a roster with salary cap
control
And I want to do trades as well
This is for a fantasy football page.
And I need to have username and passwords so my owners can login and
there is no cheating..
http://www.ultimatefootballleague.com/index4.shtml
This is my site.
Please email me directly if you are interested in helping.
Thanks
Karl james



--- End Message ---
--- Begin Message ---
Hello,

I have been running into problems getting Apache 2.0.43 to work with PHP
4.2.3 as a module. The following is the error I get ... 

"Cannot load /usr/local/APACHE/modules/libphp4.so into server:
/usr/local/APACHE/modules/libphp4.so: Undefined symbol
"pthread_getspecific"

Having said that, I did my research and found that many have come across
the same error and managed to get passed it by installing pthreads. Any
references and/or information on how to get passed this issue would be
greatly appreciated.

Regards,
Peter

--- End Message ---

Reply via email to