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 22 Oct 2005 23:42:03 -0000 Issue 3752

php-general-digest-helplists.php.net
Date: Sat Oct 22 2005 - 18:42:03 CDT


php-general Digest 22 Oct 2005 23:42:03 -0000 Issue 3752

Topics (messages 224448 through 224475):

Re: Classes or functions
        224448 by: Oliver Grätz

Re: OOP Newbie - why does this not work?
        224449 by: Jochem Maas

Html_entities o que ??
        224450 by: Reynier Perez Mira

Re: PHP to read news
        224451 by: Chris Lott

PHP on Windows 2003 Server
        224452 by: Tomás Liendo

Re: Ugh, w32 anything is making me want to drink!
        224453 by: Jochem Maas

XML-RPC Error:-32300:transport error - could not open socket
        224454 by: Dan McCullough
        224455 by: Torgny Bjers
        224459 by: Dan McCullough

JPG Slide show
        224456 by: John Taylor-Johnston

Calling PostgreSQL & MySQL Stored Procedures
        224457 by: Colin Shreffler
        224458 by: Colin Shreffler

Re: Email Validation built-in? RFC
        224460 by: James Benson

looking for test code..
        224461 by: bruce

Memory Leak?
        224462 by: Richard Lynch
        224464 by: tg-php.gryffyndevelopment.com
        224465 by: Robert Cummings
        224467 by: Jasper Bryant-Greene

WWW-Authenticate
        224463 by: John Taylor-Johnston
        224466 by: Robert Cummings
        224468 by: John Taylor-Johnston
        224470 by: Robert Cummings
        224471 by: John Taylor-Johnston

Dynamically Loading Plugins
        224469 by: Todd Nine

Re: file_exists()
        224472 by: Oliver Grätz
        224473 by: Robert Cummings
        224475 by: Oliver Grätz

Using PHP-based form authentication, circumventing existing Apache .htaccess "require valid-user"
        224474 by: Dan Trainor

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:


I'd say it depends on the size of your project and on any plans to reuse
the code. Classes are better suited for building libraries of code you
use in other projects. And any large project runs into problems with
function names if the programmer doesn't use a rigorous naming system
(like "function package_subpackage_functionname() { ... }") and if such
names are used one could just as good use classes.

Technical difference: Functions are a little bit faster (think of PHP
having to look just one time instead of one time for findeing the class
and one time for finding the method).

Depending on PHP version: PHP4 has an affinity to using functions
because the classes are not as mature and full-featured as in PHP5.
So: with PHP4, you actively have to choose using classes;
with PHP5, you want to use classes.

OLLi

attached mail follows:


Andy Pieters wrote:
> While the use of () or not doesn't impede the function of his code, I consider
> it good programming habit to always add () to the class creator. Since it is

creator? you mean constructor (same difference).

> considered a function, you wouldn't call a function like x=function but

'method' would be more 'correct'. and I don't agree that it is considered
a function as you are not directly calling the constructor (if it even
exists), but rather instantiating an instance of a class.

but that is all rather purist, and not really in the spirit of php.
regardless you cant write ... :-)

class Test {}
$x = new (Test);

although you can do the following (for the benefit of the OP):

class Test {}
$a = "b"; $b = "Test"; $c = "a";
$d = ( ${${$c}} ); /* (the brackets are optional) */
$x = new $d; /* or: $x = $d(); */
$y = new ${("b")}; /* or: $y = new ${("b")}(); */
$z = new ${${$c}}; /* or: $z = new ${${$c}}(); */
${""} = new Test;
var_dump($x, $y, $z, ${""});

> rather x=function(). It is more consistent that way.

Consistency shares a house with Standards, and you know what
they say about Stan ;-)

>
> On Friday 21 October 2005 16:31, Jochem Maas wrote:
>
>>Nathan Tobik wrote:
>>
>>>You have to show us the definition for your class, also your syntax for
>>>new is wrong. It should be:
>>>
>>>$liveclass = new Test();
>>
>>it can also be (if you have nothing to pass to the constructor function):
>>
>>$liveclass = new Test;
>>
>>
>>>Nate Tobik
>>>(412)661-5700 x206
>>>VigilantMinds
>>>
>>>-----Original Message-----
>>>From: John Taylor-Johnston
>>>[mailto:John.Taylor-Johnstoncegepsherbrooke.qc.ca]
>>>Sent: Friday, October 21, 2005 7:57 AM
>>>To: php-generallists.php.net
>>>Subject: [PHP] Re: OOP Newbie - why does this not work?
>>>
>>>Here,s my guess:
>>>
>>>> var $liveclass;
>>>> $liveclass = new(Test);
>>>> echo $liveclass->get() ;
>>>> echo "<BR>" ;
>>>> echo "This is in the php code block" ;
>
>

attached mail follows:


Hola lista:
Resulta que estoy tratando de crear un RSS 2.0 para mi web y estoy medio que parado por ciertas y determinadas cosillas. La primera es que las noticias las introduzco en la BDatos usando un editor WYSIWYG (TinyMCE Editor) y entonces en los campos TEXT de la tabla me sale contenido HTML. Por ejemplo si alineo el contenido del TEXTAREA a la derecha me introduce esto en la Bdatos:
================================================
<div align="right">CONTENIDO</div>
================================================
Entonces a la hora de mostrar el fichero XML generado me da problemas porque en el área de la descripción me sale todo ese código HTML. Miren el código para hacer el RSS:
================================================
$contar_noticias = $db->Execute("SELECT COUNT(IDN) AS cantidad FROM noticia");
    $rscantidad = $contar_noticias->fetchRow();

    # RSS File
    $res = "";
    $res.= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
    $res.= "<rss version=\"2.0\">\n";
    $res.= "\t<channel>\n";
    $res.= "\t\t<title><![CDATA[RSS Portal de los Joven Club de Computaci&oacute;n y Electr&oacute;nica de Granma]]></title>\n";
    $res.= "\t\t<description><![CDATA[RSS Portal de los Joven Club de Computaci&oacute;n y Electr&oacute;nica de Granma]]></description>\n";
    $res.= "\t\t<language>es-es</language>\n";
    $res.= "\t\t<generator>RSS Portal JClub Granma</generator>\n";
    if ($rscantidad[0] > 0) {
        $fecha_noticias= $db->SQLDate('d M Y - h:i:s A', 'FechaN');
        $noticia = $db->Execute("SELECT IDN, IDC, $fecha_noticias, TituloN, DescN, AutorN FROM noticia WHERE (NACtiva<>0) ORDER BY FechaN DESC");
        while ($rs=$noticia->fetchRow()) {
            $res.="\t\t<item>\n";
            $res.="\t\t\t<title><![CDATA[" . stripslashes($rs['TituloN']) . "]]></title>\n";
            // $res.="\t\t\t<description><![CDATA[" . stripslashes($rs['DescN']) . "]]></description>\n";
            $res.="\t\t\t<pubDate>" . stripslashes($fecha_noticias) . "</pubDate>\n";
            $res.="\t\t\t<link>" . $PageAdress . "&amp;IDC=" . $rs['IDC'] . "&amp;IDN=" . $rs['IDN'] . "</link>\n";
            $res.="\t\t\t<author>" . stripslashes($rs["AutorN"]) . "</author>\n";
            $res.="\t\t</item>\n";
        }
    }
    $res.= "\t</channel>\n";
    $res.= "</rss>\n";
    $actual =date("Ymd");
    $handler=fopen("../noticias-" . $actual . ".xml", 'w+');
    if (!fputs($handler, $res)) {
        $tpl->assign("msg","No se pudo crear el RSS");
    } else {
        $tpl->assign("msg","El fichero RSS ha sido creado satisfactoriamente");
    }
    fclose($handler);
    $file = "noticias-" . $actual . ".xml";
    $tpl->assign('file', $file);
================================================

Luego el otro problema y un poco OFF TOPIC es que no se como decirle a un arhivo XML que use un fichero XSL para poder mostrar el fichero XML con estilo.

Salu2 y gracias de antemano

ReynierPM

attached mail follows:


On 10/19/05, Steve <stevefantasynetwork.biz> wrote:

> I'm looking for some help with reading freely available news files like
> this: news://newsclip.ap.org/NY16310182138news.ap.org
> <news://newsclip.ap.org/NY16310182138news.ap.org%22/%3E%3C/media>.
> I'm able to connect to the newsgroup with the IMAP functions just file,
> but this type of news url can be placed in a browser like mozilla and
> the message will be pulled, so i'm thinking it should be much easier
> than that.

When you use the browser to access using the news: protocol you are
actually invoking NNTP functions. That's whats the IMAP functions you
are using are also doing. So that is the proper way. I imagine if you
search for NNTP and PHP you will find some third party classes and
code that might help out too...

c
--
Chris Lott

attached mail follows:


Hi, I have enough experience working with PHP on Windows XP over IIS, but
now I need to work on Windows Server 2003, algo with IIS.
I installed PHP (With the installer that I downloaded from www.php.net) but
it doesn't work. When I try to see a PHP page I receive the following
message:

"The server can not found"

What can I do?

Ahead of time, thank you very much.

Tom.

attached mail follows:


John Nichel wrote:
> Jay Blanchard wrote:
>
>> [snip]
>>
>>> I just noticed that extension_dir in phpinfo is c:\php4 THAT AIN'T
>>> RIGHT!
>>> Why is PHP not loading the proper ini file? This is probably the
>>> source of
>>> my problems all along! ACK!!!!!
>>>
>>
>>
>> This is what happens when you go over to the dark side.
>> [/snip]
>>
>> It's not my fault! How do I fix this?
>>
>
> Hell if I know, I haven't touched a Windows machine in years. Move the
> ini file you want it to read to the location it's looking in?
>
> You could symbolic link it....oops...wait...no, you can't. ;)

actually the underlying 'OS' does support something I think they call
hard links - but you need a 3rd extension to use it (free download somewhere,
gives you an extra item in context menu) ... behold the power of the dark side. :-)

>

attached mail follows:


I'm having any issue finding out why this is happening and how to fix
it. Is it a permissions problem between php and the server or
something else?
Help

attached mail follows:


Dan McCullough wrote:

>I'm having any issue finding out why this is happening and how to fix
>it. Is it a permissions problem between php and the server or
>something else?
>Help
>

Without looking up this specific error code thoroughly through Google or
elsewhere, I would have to ask you to submit the code excerpt that
generates this error. If it is a permission error it could be because
you are trying to listen to a system reserved port in the 0-1024 range,
or it could be that the URL that you are trying to open is actually
invalid. For instance, if trying to connect to http:// you could have
forgotten a slash, or used backslashes, or any other common mistake.
Please submit more information the next time, and use Google, it
actually finds information for you. :)

Regards,
Torgny

attached mail follows:


Tried Google and the guy who created the snippet they had no helpful
information about the error.

On 10/22/05, Torgny Bjers <torgnyxorcode.com> wrote:
> Dan McCullough wrote:
>
> >I'm having any issue finding out why this is happening and how to fix
> >it. Is it a permissions problem between php and the server or
> >something else?
> >Help
> >
>
> Without looking up this specific error code thoroughly through Google or
> elsewhere, I would have to ask you to submit the code excerpt that
> generates this error. If it is a permission error it could be because
> you are trying to listen to a system reserved port in the 0-1024 range,
> or it could be that the URL that you are trying to open is actually
> invalid. For instance, if trying to connect to http:// you could have
> forgotten a slash, or used backslashes, or any other common mistake.
> Please submit more information the next time, and use Google, it
> actually finds information for you. :)
>
> Regards,
> Torgny
>

attached mail follows:


Hi,
Found this on one of my favourite tech show sites:
http://www.flickr.com/photos/globalhermit/sets/1134389/show/
Is there something in PHP I can script or find toproduce a slide show of
the contents of a Linux directory? (Baby pictures :) )
John

attached mail follows:


Can any one please tell me how you call a stored procedure in either
PostgreSQL or MySQL from php?

Cheers
-c

attached mail follows:


One more caveat: With an without parameters would be very helpful.

-c

On 10/22/05 11:55 AM, "Colin Shreffler" <colin.shrefflerwarp9software.com>
wrote:

> Can any one please tell me how you call a stored procedure in either
> PostgreSQL or MySQL from php?
>
> Cheers
> -c

Thank you,
Colin Shreffler
Principal
303.349.9010 - cell
colin.shrefflerwarp9software.com

Warp 9 Software, LLC.
6791 Halifax Avenue
Castle Rock, CO 80104

Confidentiality Notice: The information in this e-mail may be confidential
and/or privileged. This e-mail is intended to be reviewed by only the
individual or organization named in the e-mail address. If you are not the
intended recipient, you are hereby notified that any review, dissemination
or copying of this e-mail and attachments, if any, or the information
contained herein, is strictly prohibited.

attached mail follows:


It would be nice to have a php function valid_email or something but
until then i suppose we just make do with what is available, for what I
need I use the following:-

eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*"
.""."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email)

Ive never had problems with it but have up to now no need for
multilanguage validation.

What is wrong with that validation anyway?

Richard Lynch wrote:
> Given:
>
> It is unacceptable to reject perfectly valid email addresses, no
> matter how arcane. [Like mine. :-)]
>
> The CORRECT RegEx for validating an email is 3 pages long, and
> performance in PHP would probably not be so good...
>
> In today's Security-conscious world, data validation is a requirement.
>
> The (relatively) recent changes in domain names that allow UTF
> (Unicode?) characters.
>
> Checking MX records is not reliable at all.
>
> Forcing users to respond to email is A) burdensome to real users in
> many cases, and B) no real barrier to halfway intelligent fake users.
>
> ... would it not make sense for there to be a BUILT-IN PHP function of
> a TRUE email syntactic validation?
>
> So at least one KNOWS that the email is a valid construct, before you
> even try (if you try at all) to make sure that a person actually
> checks it at least once in their life.
>
> Currently, email syntax validation is being done in very limited
> fashion, if not outright "wrong" by rejecting what actually ARE valid
> email addresses in about 10,000,000 PHP scripts by users who don't
> have any realistic options to truly "do it right" because who can
> really live with that 3-page Regex in their PHP code?
>
> Yes, in the past, I may have come down squarely on the opposite side
> of this topic, but I've changed my mind.
>
> I believe PHP needs a built-in syntactically CORRECT email validation
> function, vetted and tested by professionals, instead of the mess we
> now have.
>
> PLEASE do not point me to any existing email validation code unless
> you believe it is not only 100% correct and complete with RFC
> definitions of syntactically valid email. Not interested. I've
> already seen them, and been burned by them.
>

attached mail follows:


hi..

before i reinvent the wheel...

i'm looking for some code that i can modify to use as a job posting
app...i've been looking over google/freshmeat/sourceforge/hotscripts/etc..

my basic needs:
 -allow user to enter job function, for a number of fields
 -allow user to maintain/update/delete/enable to jobs
 -allow admin to enable/disable users
 -allow user to login/register
 -allow company user to create jobs
 -allow regular user to submit resume for a job

if anybody knows of job posting/resume code, great! if you alos know of a
different app that i could look at, and possibly rewrite/reengineer to get
what i need, i'll take that as well..

this is for testing, more than anything...

thanks

bruce
bedouglasearthlink.net

attached mail follows:


I've written a script to munge and import 108,000+ records.

To avoid spiking the server, I'm sleep()ing 1 second for each record.

So it takes 30+ hours to run, so what?

This data changes "daily" but not really much more often than that,
mostly.

Anyway, it seems to be using an awful lot of RAM for what it's doing.

Like, 80 Meg or so.

php.ini memory_limit is set to 100M by my ISP. I can use my own
php.ini and change that, if needed.

Most of the fields are short, and the longest is maybe a varchar(255)
and there are only ~15 fields.

There's only a couple $query strings in each iteration, a couple MySQL
result handles, and 2 copies (raw and munged) of each field's data.

That don't sound like 80 Meg worth of data to this naive user.

I got worried about the RAM, so stopped the process and added some RAM
usage calls, started it over, and am logging the RAM usage at each
record.

I've written a "pretty" PNG graph and I'd like some experts to look at
the graph, look at the code, and then tell me.

1. Do I have a memory leak that is gonna kill me and I have to fix it?

2. Is PHP's garbage-collection so non-aggressive that this is just
"normal"?

3. Is there some kind of 80/20 or 90/10 "rule" in the guts of PHP
garbage-collection, so that reducing my memory_limit would just "fix"
this?

4. Can you spot any obvious/easy ways to alter the source to reduce
memory usage without micro-managing or adding needless complications
nor, perhaps most important, adding too much time onto the 30-hour
process.

Below is a link to the graph, some commentary, and there's a link to
the PHP source code at the bottom-right of the web page.

Hope all this isn't too presumptious...

TIA!

http://l-i-e.com/feedbaby/memory_leak.htm

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

attached mail follows:


Because of the way it spikes and maintains, I'm guess that this is normal behavior, but we'll see what the real experts have to say.

In theory, if you allow a process 100MB of memory and it thinks it might need some stuff again later, it's likely to cache for faster reuse of that data later.

But putting all that aside, because I really have no idea, only hunches, I'm wondering if you might want to rethink how you're doing this in general.

Does it make a difference if instead of one record at a time, you pull 10, 20, 100... might speed up your process a little and if it doesn't use any more memory, then why not?

Another thought.. can you use database replication here? So instead of dumping all the records and processing and inserting the ones that are new, you'd only be acting on what's changed since the last backup. With real replication, you can do this realtime (or at least semi-realtime), but you could simulate replication in your PHP script as well.

The idea is to see what INSERT, UPDATE, DELETE and ALTER (maybe some other) commands are run on SourceDB and perform the same actions on DestinationDB. This can be done by either recording the actions for "playback" on the DestDB later or by performing the same actions on the DestDB at the same time as the SourceDB effectively mirroring the databases.

I'm not sure what 'data munging' is going on or if this is the right solution for you, but it might be worth checking into.

Here's the manual page for MySQL's replication:
http://dev.mysql.com/doc/refman/5.0/en/replication.html

But if you get the theory, you could easily keep a list of the INSERT/DELETE/UPDATE/etc that your scripts do on SourceDB and either do the same thing on DestDB right then, or "play it back" later like during nightly maintenance.

Good luck Richard!

-TG

= = = Original message = = =

I've written a script to munge and import 108,000+ records.

To avoid spiking the server, I'm sleep()ing 1 second for each record.

So it takes 30+ hours to run, so what?

This data changes "daily" but not really much more often than that,
mostly.

Anyway, it seems to be using an awful lot of RAM for what it's doing.

Like, 80 Meg or so.

php.ini memory_limit is set to 100M by my ISP. I can use my own
php.ini and change that, if needed.

Most of the fields are short, and the longest is maybe a varchar(255)
and there are only ~15 fields.

There's only a couple $query strings in each iteration, a couple MySQL
result handles, and 2 copies (raw and munged) of each field's data.

That don't sound like 80 Meg worth of data to this naive user.

I got worried about the RAM, so stopped the process and added some RAM
usage calls, started it over, and am logging the RAM usage at each
record.

I've written a "pretty" PNG graph and I'd like some experts to look at
the graph, look at the code, and then tell me.

1. Do I have a memory leak that is gonna kill me and I have to fix it?

2. Is PHP's garbage-collection so non-aggressive that this is just
"normal"?

3. Is there some kind of 80/20 or 90/10 "rule" in the guts of PHP
garbage-collection, so that reducing my memory_limit would just "fix"
this?

4. Can you spot any obvious/easy ways to alter the source to reduce
memory usage without micro-managing or adding needless complications
nor, perhaps most important, adding too much time onto the 30-hour
process.

Below is a link to the graph, some commentary, and there's a link to
the PHP source code at the bottom-right of the web page.

Hope all this isn't too presumptious...

TIA!

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

attached mail follows:


On Sat, 2005-10-22 at 17:36, Richard Lynch wrote:
> I've written a script to munge and import 108,000+ records.
>
> To avoid spiking the server, I'm sleep()ing 1 second for each record.
>
> So it takes 30+ hours to run, so what?
>
> This data changes "daily" but not really much more often than that,
> mostly.
>
> Anyway, it seems to be using an awful lot of RAM for what it's doing.
>
> Like, 80 Meg or so.
>
> php.ini memory_limit is set to 100M by my ISP. I can use my own
> php.ini and change that, if needed.
>
> Most of the fields are short, and the longest is maybe a varchar(255)
> and there are only ~15 fields.
>
> There's only a couple $query strings in each iteration, a couple MySQL
> result handles, and 2 copies (raw and munged) of each field's data.
>
> That don't sound like 80 Meg worth of data to this naive user.
>
> I got worried about the RAM, so stopped the process and added some RAM
> usage calls, started it over, and am logging the RAM usage at each
> record.
>
> I've written a "pretty" PNG graph and I'd like some experts to look at
> the graph, look at the code, and then tell me.
>
> 1. Do I have a memory leak that is gonna kill me and I have to fix it?
>
> 2. Is PHP's garbage-collection so non-aggressive that this is just
> "normal"?
>
> 3. Is there some kind of 80/20 or 90/10 "rule" in the guts of PHP
> garbage-collection, so that reducing my memory_limit would just "fix"
> this?
>
> 4. Can you spot any obvious/easy ways to alter the source to reduce
> memory usage without micro-managing or adding needless complications
> nor, perhaps most important, adding too much time onto the 30-hour
> process.
>
> Below is a link to the graph, some commentary, and there's a link to
> the PHP source code at the bottom-right of the web page.
>
> Hope all this isn't too presumptious...

The code looks fine, nothing being accumulated in the script itself so
my guess is that mysql is hanging onto something... possibly query
caching. Either that or as you say PHP itself though I can't say I've
experienced any huge memory issues in the past with long running
scripts. I'd definitely guess caching of some sort, especially since the
memory consumption levels out :)

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


On Sat, 2005-10-22 at 16:36 -0500, Richard Lynch wrote:
> I've written a script to munge and import 108,000+ records.
[snip]
> http://l-i-e.com/feedbaby/memory_leak.htm

It looks fine to me, but you might like to try accumulating the records
say up to 100 at a time and then doing extended INSERTs (if your MySQL
version supports them) like this:

INSERT INTO tablename
        (col1, col2)
VALUES
        ('value1', 'value2'),
        ('value3', 'value4'),
        ('value5', 'value6'),
        ('value7', 'value7')

... and so on.

These are apparently much nicer for MySQL to process, which may result
in lower memory usage and faster operation.

--
Jasper Bryant-Greene
General Manager
Album Limited

e: jasperalbum.co.nz
w: http://www.album.co.nz/
p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303
a: PO Box 579, Christchurch 8015, New Zealand

attached mail follows:


Does anyone see anything wrong with my code below? It works in other
files, on other servers. I copied and pasted it exactly?
It won't recognise the user name or password. Does Authenticate work on
all servers? Here is my phpinfo if that helps?!
http://www.royalarchmasonsofquebec.com/phpinfo.php
I don't get it.
John

<?php
if ( ( !isset( $PHP_AUTH_USER )) || (!isset($PHP_AUTH_PW))
     || ( $PHP_AUTH_USER != 'user' ) || ( $PHP_AUTH_PW != 'password' ) ) {

    header('WWW-Authenticate: Basic realm="Private"');
    header('HTTP/1.0 401 Unauthorized');
    echo 'Authorization Required.' . '<a href="' . $PHP_SELF . '">Try
again</a> or contact <a href="mailtoGSEfoo.com">GSE</a>';
    exit;

} else {
?>
in
<?php
}
?>

attached mail follows:


On Sat, 2005-10-22 at 17:59, John Taylor-Johnston wrote:
> Does anyone see anything wrong with my code below? It works in other
> files, on other servers. I copied and pasted it exactly?
> It won't recognise the user name or password. Does Authenticate work on
> all servers? Here is my phpinfo if that helps?!
> http://www.royalarchmasonsofquebec.com/phpinfo.php
> I don't get it.
> John
>
> <?php
> if ( ( !isset( $PHP_AUTH_USER )) || (!isset($PHP_AUTH_PW))
> || ( $PHP_AUTH_USER != 'user' ) || ( $PHP_AUTH_PW != 'password' ) ) {
>
> header('WWW-Authenticate: Basic realm="Private"');
> header('HTTP/1.0 401 Unauthorized');
> echo 'Authorization Required.' . '<a href="' . $PHP_SELF . '">Try
> again</a> or contact <a href="mailtoGSEfoo.com">GSE</a>';
> exit;
>
> } else {
> ?>
> in
> <?php
> }
> ?>

Check phpinfo() and let us know the value of "register_globals".

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Robert Cummings wrote:

>On Sat, 2005-10-22 at 17:59, John Taylor-Johnston wrote:
>
>
>>Does anyone see anything wrong with my code below? It works in other
>>files, on other servers. I copied and pasted it exactly?
>>It won't recognise the user name or password. Does Authenticate work on
>>all servers? Here is my phpinfo if that helps?!
>>http://www.royalarchmasonsofquebec.com/phpinfo.php
>>I don't get it.
>>John
>>
>><?php
>>if ( ( !isset( $PHP_AUTH_USER )) || (!isset($PHP_AUTH_PW))
>> || ( $PHP_AUTH_USER != 'user' ) || ( $PHP_AUTH_PW != 'password' ) ) {
>>
>> header('WWW-Authenticate: Basic realm="Private"');
>> header('HTTP/1.0 401 Unauthorized');
>> echo 'Authorization Required.' . '<a href="' . $PHP_SELF . '">Try
>>again</a> or contact <a href="mailtoGSEfoo.com">GSE</a>';
>> exit;
>>
>>} else {
>>?>
>>in
>><?php
>>}
>>?>
>>
>>
>
>Check phpinfo() and let us know the value of "register_globals".
>
>
>
register_globals On On

attached mail follows:


On Sat, 2005-10-22 at 18:21, John Taylor-Johnston wrote:
> Robert Cummings wrote:
>
> >On Sat, 2005-10-22 at 17:59, John Taylor-Johnston wrote:
> >
> >
> >>Does anyone see anything wrong with my code below? It works in other
> >>files, on other servers. I copied and pasted it exactly?
> >>It won't recognise the user name or password. Does Authenticate work on
> >>all servers? Here is my phpinfo if that helps?!
> >>http://www.royalarchmasonsofquebec.com/phpinfo.php
> >>I don't get it.
> >>John
> >>
> >><?php
> >>if ( ( !isset( $PHP_AUTH_USER )) || (!isset($PHP_AUTH_PW))
> >> || ( $PHP_AUTH_USER != 'user' ) || ( $PHP_AUTH_PW != 'password' ) ) {
> >>
> >> header('WWW-Authenticate: Basic realm="Private"');
> >> header('HTTP/1.0 401 Unauthorized');
> >> echo 'Authorization Required.' . '<a href="' . $PHP_SELF . '">Try
> >>again</a> or contact <a href="mailtoGSEfoo.com">GSE</a>';
> >> exit;
> >>
> >>} else {
> >>?>
> >>in
> >><?php
> >>}
> >>?>
> >
> >Check phpinfo() and let us know the value of "register_globals".
> >
> register_globals On On

Sorry to have asked, just re-read the post and realized you posted a
link to your phpinfo(). (man I'm not sleeping enough lately :/) Anyways
viewing your phpinfo() shows that the server is in CGI mode contrary to
the requirements listed here :(

    http://ca.php.net/features.http-auth

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Robert Cummings wrote:

>On Sat, 2005-10-22 at 18:21, John Taylor-Johnston wrote:
>
>
>>Robert Cummings wrote:
>>
>>
>>
>>>On Sat, 2005-10-22 at 17:59, John Taylor-Johnston wrote:
>>>
>>>
>>>
>>>
>>>>Does anyone see anything wrong with my code below? It works in other
>>>>files, on other servers. I copied and pasted it exactly?
>>>>It won't recognise the user name or password. Does Authenticate work on
>>>>all servers? Here is my phpinfo if that helps?!
>>>>http://www.royalarchmasonsofquebec.com/phpinfo.php
>>>>I don't get it.
>>>>John
>>>>
>>>><?php
>>>>if ( ( !isset( $PHP_AUTH_USER )) || (!isset($PHP_AUTH_PW))
>>>> || ( $PHP_AUTH_USER != 'user' ) || ( $PHP_AUTH_PW != 'password' ) ) {
>>>>
>>>> header('WWW-Authenticate: Basic realm="Private"');
>>>> header('HTTP/1.0 401 Unauthorized');
>>>> echo 'Authorization Required.' . '<a href="' . $PHP_SELF . '">Try
>>>>again</a> or contact <a href="mailtoGSEfoo.com">GSE</a>';
>>>> exit;
>>>>
>>>>} else {
>>>>?>
>>>>in
>>>><?php
>>>>}
>>>>?>
>>>>
>>>>
>>>Check phpinfo() and let us know the value of "register_globals".
>>>
>>>
>>>
>>register_globals On On
>>
>>
>
>Sorry to have asked, just re-read the post and realized you posted a
>link to your phpinfo(). (man I'm not sleeping enough lately :/) Anyways
>viewing your phpinfo() shows that the server is in CGI mode contrary to
>the requirements listed here :(
>
> http://ca.php.net/features.http-auth
>
>Cheers,
>Rob.
>
>
Back to the drawing board. Thanks Rob!
Good grief. I know why too. They are running a client admin that needs
it that way probably.
J

attached mail follows:


Hi all.
I have need to dynamically load some classes. I have created an
abstract class that defines a function. Note that I'm using PHP 4 so
abstract is not enforced. 3rd party plugins will then implement this
interface. Users will upload their plugins via a web interface. After
I save the php class file to the directory ./plugins, I will need to
load it later. Basically I need to do something like.

$dir = dir("plugins");

while($entry=$dir->read() ) {

    //skip non class php files.
    if(!eregi(".+\.class\.php$", $entry )) {
        continue;
    }//end if

    //dynamically load class and call it

    //require class
    require_once("plugins/".$entry);

    //get the class name from the entry

    $classname = ??? ?;

    $plugin = new $classname();

    //result array
    $results = $plugin->getObjects();

    //do other stuff

}//end while

attached mail follows:


Jonny Bergström schrieb:
> Hi
>
> file_exists('å­—.gif') always returns false.
>
> Can anyone help me find out a way to make it work also for these kind of
> filenames?
>
Unicode filenames can't be properly handled up to now for all I know.
Perhaps waiting for PHP6 might be your only solution.

OLLi

attached mail follows:


On Sat, 2005-10-22 at 19:19, Oliver Grätz wrote:
> Jonny Bergström schrieb:
> > Hi
> >
> > file_exists('å­—.gif') always returns false.
> >
> > Can anyone help me find out a way to make it work also for these kind of
> > filenames?
> >
> Unicode filenames can't be properly handled up to now for all I know.
> Perhaps waiting for PHP6 might be your only solution.

You could try execing a shell command to give you the answer. I don't
know if it'll work, but worth a shot if you're in a bind.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Robert Cummings schrieb:
> You could try execing a shell command to give you the answer. I don't
> know if it'll work, but worth a shot if you're in a bind.

Yep, good idea. Use the native code of the OS ofr listing the file (dir,
ls...) and parse the result.

OLLi
____________
"Manche sagen, Computer seien besser als Menschen - aber viel Spaß
im Leben haben sie nicht." [Peter Ustinov]

attached mail follows:


Hello, all -

I'm trying to think of how this might be possible, but I can't seem to
come up with anything.

I'd like to make a login form of sorts, which would enable a user to
authenticate against. A simple HTML form, with a PHP back-end, where a
user enters a username and password. If this authentication succeeds,
the user is redirected to the protected area. However, this protected
area was originally protected by an Apache .htaccess-style "require
valid-user".

After authentication succeeds, I'd like to redirect the user to the
Apache protected directory, circumventing the .htaccess "require
valid-user" method - because the user has already authenticated by some
other means, and there's no need to re-authenticate against HTTP Basic
Authentication.

Anyone know if this is possible, and if so, how this might work? I'm
just looking for some ideas here.

As always, thanks for the time
-dant