php-general Digest 2 Dec 2006 11:33:10 -0000 Issue 4492
Topics (messages 245439 through 245445):
Re: magic_quotes
245439 by: Johannes Lindenbaum
signal handling
245440 by: Aras
Re: Tidy HTML source?
245441 by: Paul Novitski
245442 by: Robert Cummings
Re: problems with exec() SOLVED
245443 by: Ray
How to be sure to use SSL
245444 by: Alain Roger
Re: problem with register globals on new server
245445 by: Tony Marston
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 ---
Blah sorry, I saw your second example not your final code. Some
scripts I use have different database connections and because of that
it is very important to always make sure I am using the correct link
identifier.
The php best practice example checks the string to see if it is a
number. If it is there technically isn't any reason to escape because
there won't be any quotes.
Just out of curiosity how exactly are you going to put the link
identifier in your method since it is static?
Hey Eric,
The function standalone seems static, but it's implemented in a MySQL class I
wrote. I can just add $this->connId as the link identifier
And it should work no problem :)
Regards,
--- End Message ---
--- Begin Message ---
Hello
Despite all of my results to succeed, i can not make this work. What i want
to do is to write a simple socket server in PHP. My current example just
prints the same character, you send to server from keyboard. It is
successfull in forking, and generates child as people connect. However in
any way the client exits, the child process remains defunct on system. I am
trying to use signal handling, but some comments say through hanging
sockets, it is not possible to handle signals.
How can i stop this from happening, i am attaching the code i am working on,
the 2 signals added at the bottom are just for test there, i tried all other
signal types. Sending a posix_kill(posix_getpid(), SIGKILL) to the process
when the client exits does not kill it too, it still is defunct.
My code: http://pastey.net/2910
Thanks!
Aras
--- End Message ---
--- Begin Message ---
At 12/1/2006 02:22 PM, Richard Lynch wrote:
On Thu, November 30, 2006 6:47 pm, Paul Novitski wrote:
> A templating system requires the processor to merge content with
> template. An inline markup assembly system requires the processor to
> build the markup from function calls. Where is the technique that
> doesn't take machine cycles?
You did NOT just compare a function call with an fstat and disk seek
and disk read as if they were equal?!!!
Show me *ANY* machine on the planet where those two options have
similar performance metrics.
Actually I was referring to machine cycles, not disk access
time. But on the topic of disc access, most mid-to-large PHP
applications are going to be opening & reading various files -- PHP
includes, databases, and not uncommonly images and text files. Even
if a templating application had a somewhat higher different
disk-access profile from the average PHP app, I wouldn't consider
that by itself to be a reason not to open template files. I consider
that to be good use of the resources, not abuse.
>>You have to parse them.
>
> Not necessarily. But if you do need to parse them, you need to write
> the parsing engine only once.
You mean all those templating languages are still on version 1.0 of
their parser?
I think not.
I think not, either. The person I was replying to said, "You have to
parse them," as though parsing a lot of files meant a lot of human
labor. My reply meant that once you write the parser, your work is
done, and then the parser parses any and all files you give it for
lunch. Of course you're going to improve a parser over time, just as
you are going to improve all aspects of a maturing application.
>>Also you have to track and manage them.
>
> Yes, as you must manage all the files that make up a project. Adding
> a few more isn't a burden, especially if they bring clarity and
> efficiency to the work.
Few?
Try 10 X as many for most templating solutions.
Ten times as many templates as there are pages on the site? Wow,
that's a lot. Fortunately I don't use any of those templating
solutions you're referring to, and excessive templates isn't a
problem for me. My own software usually takes three templates per
page -- header, body, and footer, and the header and footer are
generally global throughout the site. That seems quite reasonable to me.
Warm regards,
Paul
--- End Message ---
--- Begin Message ---
On Fri, 2006-12-01 at 17:51 -0800, Paul Novitski wrote:
> > At 12/1/2006 02:22 PM, Richard Lynch wrote:
> >
> > Try 10 X as many for most templating solutions.
>
> Ten times as many templates as there are pages on the site? Wow,
> that's a lot. Fortunately I don't use any of those templating
> solutions you're referring to, and excessive templates isn't a
> problem for me. My own software usually takes three templates per
> page -- header, body, and footer, and the header and footer are
> generally global throughout the site. That seems quite reasonable to me.
This topic comes up so often... My template engine allows you to punt
any chunk of content you want to an extra template. Then when you
compile the page you get 1, yes, 1 php page that is directly accessed
from the browser. Thus, contrary to the kinds of template engines to
which Richard refers, my engine reduces the fstat call count while
keeping your content in nice maintainable and re-usable sized chunks.
layout.template
---------------
<html>
<head><jinn:template path="layout/meta.template"/></head>
<body>
<jinn:template path="layout/header.template"/>
<jinn:template path="layout/leftPane.template"/>
<jinn:template path="layout/rightPane.template"/>
<jinn:template path="layout/content.template"/>
<jinn:template path="layout/footer.template"/>
</body>
</html>
layout/content.template
-----------------------
<div class="content">
<div class="title"><jinn:title/></div>
<jinn:main/>
</div>
contactUs.source
----------------
Blah blah blah blah blah blah... please contact us.
patterns.txt
------------
array
(
'target' => 'contactUs.php',
'source' => '//contactUs.source',
'template' => '//layout.template',
'title' => 'Contact Us',
);
contactUs.php
-------------
Everything defined in patterns.txt compiled together such that the
<jinn:main/> tag is replaced by the source file. All <jinn:template/>
and <jinn:source/> tags are imported during compile time to produce a
single php file that IS the file accessed by visitors via their browser.
If there's no need to have dynamic code, this does a great job of
compiling static HTML files also... and I don't know many other template
systems that can compile their templates to statically accessible HTML
files.
NYAH, NYAH!
That said, in general my framework uses one source file for each class
(or two classes if it's a factory and what the factory produces)... so I
guess I save on content includes, and lose out on dynamic class
includes. But then, other than 5 or 6 core classes, if you don't use the
other classes, then they don't get loaded (on demand requests).
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 ---
Thanks for the help. :)
I posted to the freeBSD list and was given the answer there. in case
anyone is interested and for the sake of the archive, I needed a path
specified in the shell script. The following URL provides the necessary
info for fixing the script. http://linux.dbw.org/shellscript_howto.html
again thanks.
Ray
--- End Message ---
--- Begin Message ---
Hi,
I would like to know how can i be sure to make customer use the SSL all the
time.
all the time in my PHP code, i write links as relative links, so without
HTTPS.
I was thinking to check everything if the port is the SSL port (default :
443), but it does not mean that protocol is HTTPS.
So, how do you ensure that customer uses SSL protocol all the time ?
thanks a lot,
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.1.4
Apache 2.0.58
PHP 5
--- End Message ---
--- Begin Message ---
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>> [EMAIL PROTECTED] wrote:
>>> hi,
>>> I had to move my osComerce store to new hosting company. new server runs
>>> on php5/mysql5.
>>>
>>> got this error:
>>> FATAL ERROR: register_globals is disabled in php.ini, please enable it!
>>>
>>> since evenon old server globals was Off I was adding
>>> <ifModule mod_php4.c>
>>> php_value register_globals 1
>>> </ifModule>
>>>
>>> Now, I tried with
>>>
>>> <ifModule mod_php5.c>
>>> php_value register_globals On
>>> </ifModule>
>>>
>>> but it doesn't work.
>>
>> Maybe your host doesn't allow it to be changed through a htaccess..
>>
>> Is htaccess support enabled?
>>
>> Put garbage in the file (random chars) and if you get a 500 internal
>> server error, htaccess files work.. if you don't, that's the problem.
> yup! that was the problem.
> though, after I talked to administrator, he is not happy to reconfigure
> Apache to allow .htaccess because of security issue. Is this REALLY so big
> issue?
If you site administrator thinks that using an htaccess file is a security
issue then he is very much mistaken. The directives in an htaccess file DO
NOT enable you to access any one else's data on a shared server. All they do
is apply additional settings to your own site while leaving UNTOUCHED the
settings being used by other sites.
Most professional web hosting companies do not have an issue with htaccess
files, so if yours does I would suggest switching to one with a more
professional attuitude.
--
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
--- End Message ---