php-general Digest 1 May 2005 00:15:48 -0000 Issue 3428
Topics (messages 214267 through 214277):
Re: only allowing php_flag register_globals off
214267 by: Jochem Maas
Re: inserting an auto incemented column in table already created
214268 by: Marek Kilimajer
Re: Templating engines
214269 by: rush
Extending Element class in a dom tree?
214270 by: Erik Franz�n
214274 by: Christian Stocker
214276 by: Christian Stocker
Re: About the mail().
214271 by: BAO RuiXian
making php go faster
214272 by: Sebastian
214273 by: Rasmus Lerdorf
Problem query (0T)
214275 by: Ryan A
214277 by: Ryan A
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 ---
Karin van den Berg wrote:
Hi,
I am on a quest for a new good webhost and I am currently using a trail
account at a host that seems pretty good, but has one problem. I cannot
turn register_globals off. They don't allow php_flag/php_value in
.htaccess for security reasons but in this case it's causing insecurity
... hi Karen, I notice you're (probably) dutch, that given I might recommend
http://webhosting.nedlinux.nl - always been very good for me.
Marc (the owner) is very generous guy (for instance he runs a php, myql
& gentoo mirrors). as a php programmer I have never been left wanting
for functionality..i.e. you want registers globals off on your site,
you got it.
klein maar fijn. :-)
Thanks a million!
Karin
--- End Message ---
--- Begin Message ---
Ross Hulford wrote:
Hi,
I have a table with 15 columns or so that has been inherited from an older
db and am trying to insert an auto increment column (in mysql) without
having to number it manually. This is fine when I add new colums via a form
but the old entries have a null value
Alternatively It has been converted from Excel soif anyone knows how to do
it that way that would help.I never use Excel so have no clue about it.
R.
$id = 1;
do {
mysql_query('update table_name set id = ' . $id++ . ' where id is
null limit 1');
} while(mysql_affected_rows() > 0);
--- End Message ---
--- Begin Message ---
> You also need to recognize that you are going to need presentation-layer
> logic. You simply can't get around that and you shouldn't confuse
> presentation-level logic, which can be quite complex, with the business
> logic behind your application. I often see people make the mistake of
> trying to separate their PHP code from their HTML which the article you
> referenced hinted at as well.
Yes, I completely agree that business logic should be separated from
presentation logic. Only problem I have is that from there people go on to
conclude that html does not need to be sseparated from presentation logic.
As far as I see It is a very good idea to keep all 3 of them separated.
Bussines logic from presentation logic by proper organization and code
design in php, and presentation logic from html by template engine.
> My main issue with general-purpose templating systems is that they
> always end up inventing a new language. It may start off as a subset of
> some other language, but eventually it turns into a new language. In
> Smarty, for example, you now have stuff like:
They have to define markup language, (begin/end of template, free variable
marker), but we are not talking about that.
What usually is the problem is that template systems define its own
programming language, with constrructs for loops, if's and whole other bunch
of stuff to model dynamic behavior. And I agree with you that this makes
diffrence between using such template system, and just php as template
system much, much smaller.
Where I do not agree, is that "fat template" syndrom is common to all
template engines, and that it is inveitable. For instance my TemplateTamer,
is now almost 5 years old, and it never had any sign of becomming
programming language in it self, and it never will. It has a markup language
of only 6 idioms:
<!--NAME: -->
<!--END: -->
<!--GLOBAL: -->
<!--USEGLOBAL: -->
{VARIABLE}
{#TRANSLATE}
and there is no single sign of presentation logic inside html template, no
ifs, no loops, no calls to the methods or functions, nada. All presentation
logic is written in php, and in nicely separated logic.php file.
rush
--
http://www.templatetamer.com/
http://www.folderscavenger.com/
--- End Message ---
--- Begin Message ---
The DOM implementation i PHP5 allows classes to be extended. Extending
the Document class is no problem, but how can I extend the Element class
and use it in a DOM tree?
DOMDocument::createElement returns a DOMElement object which you cannot
extend.
Could this be a solution?
class MyElement extends DomElement {
function __construct($a_stTagName) {
//has to be called!
parent::__construct($a_stTagName);
}
function myFunction() {
// do something
}
}
$oDom = new DomDocument();
$oMyElement = new MyElement('mytag');
$oMyElement = $oDom->importNode($oMyElement, true);
$oMyElement = $oDom->appendChild($oMyElement);
Regards
/Erik
--- End Message ---
--- Begin Message ---
On 4/30/05, Erik Franz�n <[EMAIL PROTECTED]> wrote:
> The DOM implementation i PHP5 allows classes to be extended. Extending
> the Document class is no problem, but how can I extend the Element class
> and use it in a DOM tree?
>
> DOMDocument::createElement returns a DOMElement object which you cannot
> extend.
>
> Could this be a solution?
>
> class MyElement extends DomElement {
> function __construct($a_stTagName) {
> //has to be called!
> parent::__construct($a_stTagName);
> }
>
> function myFunction() {
> // do something
> }
> }
>
> $oDom = new DomDocument();
> $oMyElement = new MyElement('mytag');
>
> $oMyElement = $oDom->importNode($oMyElement, true);
> $oMyElement = $oDom->appendChild($oMyElement);
Does not work, will never work, just forget about it ;)
chregu
>
> Regards
> /Erik
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71
http://www.bitflux.ch | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB
--- End Message ---
--- Begin Message ---
Hi again
On 4/30/05, Christian Stocker <[EMAIL PROTECTED]> wrote:
> On 4/30/05, Erik Franz�n <[EMAIL PROTECTED]> wrote:
> > The DOM implementation i PHP5 allows classes to be extended. Extending
> > the Document class is no problem, but how can I extend the Element class
> > and use it in a DOM tree?
> >
> > DOMDocument::createElement returns a DOMElement object which you cannot
> > extend.
> >
> > Could this be a solution?
> >
> > class MyElement extends DomElement {
> > function __construct($a_stTagName) {
> > //has to be called!
> > parent::__construct($a_stTagName);
> > }
> >
> > function myFunction() {
> > // do something
> > }
> > }
> >
> > $oDom = new DomDocument();
> > $oMyElement = new MyElement('mytag');
> >
> > $oMyElement = $oDom->importNode($oMyElement, true);
> > $oMyElement = $oDom->appendChild($oMyElement);
>
> Does not work, will never work, just forget about it ;)
Ok, that was not the really right answer ;) Of course it does work.
You can even do stuff on that element, if you use the variable, resp.
reference ($oMyElement) for doing this.
What doesn't work (and I referred to that) is getting this object
back from the DomDocument, so for example:
$oDom->documentElement will give you the DomElement back and not your
new MyElement.
Hope it's a little bit clearer now
chregu
>
> chregu
> >
> > Regards
> > /Erik
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> --
> christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
> phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71
> http://www.bitflux.ch | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB
>
--
christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71
http://www.bitflux.ch | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB
--- End Message ---
--- Begin Message ---
Hello,
Penghui Wang wrote:
Hi lists:
I am new here. And i know little about php. Sorry ask so stupid
question.
snipped ...
$headers .= "Content-Transfer-Encoding: UTF-8\n";
$headers .= "Content-Type: text/plain; charset=utf-8\n";
snipped ...
<head>
<title>åçæé</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
snipped ...
But all the chinese words could change to "????". The charset of this
file is UTF-8.
I wonder know how to deal with it. And i am blind with it now. Because
the lack of experience with php.
Maybe UTF-8 is not supported by your system. You may try GB2312 to see
what happends.
Good luck.
Ruixian
Best regards
Wang Penghui
--- End Message ---
--- Begin Message ---
i've been doing some reading on optimizing php for fastest performance.
are there any benifts to configure php with:
--enable-inline-optimization
also running eAccelerator.
these are my current options:
--with-apache=../apache_1.3.33 \
--with-mysql=/usr/local/mysql \
--with-xml \
--with-gd \
--with-jpeg-dir=/usr/lib \
--with-png-dir=/usr/lib \
--with-xpm \
--enable-magic-quotes \
--with-pear \
--enable-gd-native-ttf \
--with-zlib
just looking for tips.. that is all.
--- End Message ---
--- Begin Message ---
Sebastian wrote:
i've been doing some reading on optimizing php for fastest performance.
are there any benifts to configure php with:
--enable-inline-optimization
That's the default now, so no, you don't need that.
also running eAccelerator.
these are my current options:
--with-apache=../apache_1.3.33 \
That's a bit of a hassle for you, I bet. You have to recompile Apache
to upgrade PHP. You can get the same performance by using --with-apxs
to get a shared library and --without-pic to make sure you get a non-pic
library. For older PHP versions, --without-pic won't work and you need
to hack your configure scripts a bit. Just change all instances of
-prefer-pic to -prefer-non-pic. Or use this patch:
http://www.lerdorf.com/php/non-pic.txt
You can tell if it is working by looking at the compile line as it is
compiling. If you see -prefer-non-pic instead of -prefer-pic on each
line it is working.
--with-mysql=/usr/local/mysql \
--with-xml \
--with-gd \
--with-jpeg-dir=/usr/lib \
--with-png-dir=/usr/lib \
--with-xpm \
--enable-magic-quotes \
--with-pear \
--enable-gd-native-ttf \
--with-zlib
just looking for tips.. that is all.
Beyond the compile-time switches, look at your configuration. Check
your variables_order and turn off $_ENV population. That is, remove the
'E' from variables_order and look for any $_ENV instances in your code
and change them to getenv() calls.
Also, remove '.' from your include_path and always use:
include './foo.inc';
That will save you a system call on every include. At the same time,
for the real include_path includes, make sure that most of your includes
hit the first include path. If PHP has to scan multiple dirs on every
include it will be slower than it needs to be.
But most of your gains will come from profiling your actual code using
either apd or xdebug and optimizing the parts that show up as being the
bottlenecks.
-Rasmus
--- End Message ---
--- Begin Message ---
Hey,
I know this belongs more on the mysql list, but I'm not a member there and I
dont often have problems queries plus dont have time to join then ask just
this one q and then unsub...so if possible please help :-)
I have these two tables:
jappz_guestbook(owner_cno, sent_datetime, is_secret, accepted)
jappz_member_profile(cno, pic_name)
jappz_guestbook's owner_cno and jappz_member_profile's cno are the same
what i need to do is select * from jappz_guestbook where owner_cno=x and
also select pic_name from jappz_member_profile where cno=jappz_guestbook.cno
I have been fooling around with something like this:
SELECT * FROM jappz_guestbook
INNER JOIN jappz_member_profile ON jappz_guestbook.owner_cno =
jappz_member_profile.cno
WHERE jappz_guestbook.owner_cno = jappz_member_profile.cno;
but its not working, how do i get the pic name from the other table
(jappz_member_profile)?
Thanks,
Ryan
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.0 - Release Date: 4/29/2005
--- End Message ---
--- Begin Message ---
Hi Pablo,
Thanks for replying.
The problem is the images are not coming properly....
go here :http://www.jappz.com/prob.gif and you will see the results i am
getting when
i should be getting the images according to the red arrows there.
Thanks,
Ryan
On 5/1/2005 1:56:23 AM, Pablo Gosse ([EMAIL PROTECTED]) wrote:
> <snip>
>
> I have these two tables:
>
>
>
> jappz_guestbook(owner_cno, sent_datetime, is_secret, accepted)
>
> jappz_member_profile(cno, pic_name)
>
>
>
> jappz_guestbook's owner_cno and jappz_member_profile's cno are the same
>
>
>
> what i need to do is select * from jappz_guestbook where owner_cno=x and
>
> also select pic_name from jappz_member_profile where cno=jappz_guestbook.
> cno
>
>
>
> I have been fooling around with something like this:
>
>
>
> SELECT * FROM jappz_guestbook
>
> INNER JOIN jappz_member_profile ON jappz_guestbook.owner_cno =
>
> jappz_member_profile.cno
>
> WHERE jappz_guestbook.owner_cno = jappz_member_profile.cno;
>
>
>
> but its not working, how do i get the pic name from the other table
>
> (jappz_member_profile)?
>
> </snip>
>
>
>
> This should do it for you:
>
>
>
> select g.owner_cno, g.sent_datetime, g.is_secret, g.accepted, p.pic_name
>
> from jappz_guestbook g, jappz_member_profile p
>
> where g.owner_cno = x
>
> and g.owner_cno = p.cno
>
>
>
> HTH,
>
>
>
> Pablo
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.0 - Release Date: 4/29/2005
--- End Message ---