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 7 Jan 2009 20:15:17 -0000 Issue 5888

php-general-digest-helplists.php.net
Date: Wed Jan 07 2009 - 14:15:17 CST


php-general Digest 7 Jan 2009 20:15:17 -0000 Issue 5888

Topics (messages 285533 through 285599):

Re: Firebird Backup
        285533 by: Sándor Tamás (HostWare Kft.)
        285535 by: Lester Caine

Re: Request A Collection of YouTube Videos From Multiple User Accounts using YouTube API
        285534 by: Stuart
        285536 by: L. Herbert
        285537 by: Stuart
        285539 by: L. Herbert
        285542 by: paragasu
        285584 by: ceo.l-i-e.com

Re: Because you guys/gals/girls/women/insert pc term here are a smart lot
        285538 by: Richard Heyes
        285546 by: Ross McKay
        285547 by: Stuart
        285550 by: Richard Heyes
        285551 by: Ross McKay
        285554 by: Jim Lyons
        285557 by: David Giragosian
        285563 by: Baron Schwartz
        285583 by: Micah Gersten
        285587 by: Robert Cummings
        285589 by: Robert Cummings

Remote File Variable Injection Safety?
        285540 by: Daniel Kolbo
        285541 by: Stuart
        285573 by: Shawn McKenzie
        285574 by: Stuart
        285576 by: Daniel Kolbo
        285577 by: Daniel Kolbo
        285585 by: ceo.l-i-e.com
        285586 by: Daniel Kolbo

[Job] Senior Programmer - SQL, Python, C/C++, PHP, bash
        285543 by: Markus Wanner

Re: RSS Feed on my PHP site
        285544 by: DanBarker85

Testing a URL with regex
        285545 by: Sn!per
        285548 by: Nathan Rixham

Freeing memory for DOMDocument
        285549 by: Christoph Boget
        285564 by: Nathan Rixham
        285565 by: Nathan Rixham
        285569 by: Christoph Boget
        285572 by: Jesús Enrique Muñoz Fernández
        285581 by: Nathan Rixham

php-gtk2, anyone?
        285552 by: Zechim
        285566 by: Nathan Rixham
        285571 by: Nathan Nobbe
        285588 by: ceo.l-i-e.com

Re: [PHP-DB] data from db to a page and then to another page
        285553 by: Dan Shirah
        285570 by: Shawn McKenzie

redoing website after 7 years
        285555 by: Lamp Lists
        285556 by: Richard Heyes
        285558 by: Al
        285559 by: Carlos Medina
        285560 by: Stuart
        285561 by: Dan Shirah
        285562 by: Lamp Lists
        285567 by: Nathan Rixham
        285568 by: Nathan Rixham
        285591 by: Robert Cummings

trigger_error() when using php cli
        285575 by: Tom Worster
        285590 by: ceo.l-i-e.com

Re: A beginner´s question
        285578 by: Frank Stanovcak

XML package on PHP
        285579 by: Merlin Morgenstern
        285582 by: Jim Lucas
        285592 by: ceo.l-i-e.com
        285597 by: Merlin Morgenstern

weird curl problem
        285580 by: Rene Veerman
        285595 by: Nathan Nobbe

Re: [PHP-DB] Re: data from db to a page and then to another page
        285593 by: Dan Shirah
        285596 by: Dan Shirah

can a session be used in a query?
        285594 by: Terion Miller
        285599 by: Zechim

Adressing XML Objects
        285598 by: Merlin Morgenstern

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:


Sure, you're right. I wouldn't normally do this, but this is the only way.

I took a look at ibWebAdmin. It simply calls the host machine's Firebird
gbak utility. So I had to know the exact path to this utility on the linux
based web server. But I don't know. In fact I don't have any access to this
machine, only FTP and of course, web.

The PHP installation doesn't even let me to do exec_command().

SanTa

----- Original Message -----
From: "Lester Caine" <lesterlsces.co.uk>
To: <php-generallists.php.net>
Sent: Wednesday, January 07, 2009 9:07 AM
Subject: Re: [PHP] Firebird Backup

> Sándor Tamás (HostWare Kft.) wrote:
>> Hi,
>>
>> I don't know if it's Firebird or PHP question.
> Bit of both - probably worth moving to the firebird-php list
> http://groups.yahoo.com/group/firebird-php/
>
>> I want to use remote administration on one of my pages, at least do a
>> backup for a Firebird database. Because the database file is located on a
>> different intranet machine, I have to use service manager to do backup.
>> So I tried:
>>
>> $svc_mgr = ibase_service_attach(FBSERVER, FBUSER, FBPASS);
>> if ($svc_mgr)
>> {
>> $bkp = ibase_backup($svc_mgr, $source_db, $dest_file,
>> IBASE_BKP_NO_GARBAGE_COLLECT, true);
>> }
>>
>> ibase_service_detach($svc_mgr);
>>
>> The bad thing: if I include "server:" in $source_db string, it gives me
>> an "unkown ISC 0 error".
>> When I simply put the database alias in $source_db, it freezes the whole
>> apache, but at least it starts the backup...
>> Then, when I turn off verbose, it does nothing at all, but gives back a
>> "true" value.
>>
>> So I think the closest solution is the second one, but does anybody have
>> any idea why it shuts down apache? And what can I do to prevent this?
>>
>> I use Firebird 2.1, PHP 5.2.8 and Apache 2.2.3 on WinXP (as a development
>> environment)
> ibase_backup is not something we would use normally. I think that things
> have advanced somewhat since the function was created, and I suspect it
> simply does not know about those changes. I've not checked what ibWebAdmin
> does currently :(
> One of the nice features of Firebird is the ability to backup while still
> working with the database, and so it's more normal to have backup
> happening as a background task, or via one of the management tools.
>
> --
> Lester Caine - G8HFL
> -----------------------------
> Contact - http://lsces.co.uk/lsces/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk//
> Firebird - http://www.firebirdsql.org/index.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


Sándor Tamás (HostWare Kft.) wrote:
> Sure, you're right. I wouldn't normally do this, but this is the only way.
>
> I took a look at ibWebAdmin. It simply calls the host machine's Firebird
> gbak utility. So I had to know the exact path to this utility on the
> linux based web server. But I don't know. In fact I don't have any
> access to this machine, only FTP and of course, web.
>
> The PHP installation doesn't even let me to do exec_command().

It's difficult to manage a site when all the best tools are switched off
:( - I'm surprised Firebird is actually available :)

We probably need to add further testing for the ibase_service_attach
facilities, and look at what is missing. This is probably one that needs
a bug opening on the php tracker, but I suspect it's actually an area
where the fbird_ version of php_interbase may be a required split? Not
using Interbase, I don't know how different this area of facilities are
nowadays. One of the reasons for discussion on the php-firebird list so
we can bounce questions to the firebird development team.

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

attached mail follows:


2009/1/7 L. Herbert <lherbertiluvmydesign.com>:
> Does anyone know if it is possible to get a collection of YouTube videos
> from multiple user accounts? If so, can you provide some insight and
> direction?
>
> Someone more knowledgeable than me on this topic indicated that it is only
> possible get a collection of YouTube videos on a per account basis. On its
> face this make sense to me but I'm just getting a second opinion.
>
> I realize I can loop requests via the API and format the results as needed,
> but was hoping for a more streamlined option.

This question has nothing to do with PHP. I suggest you try the
YouTube developers site - I'm sure there's a resource there that can
help you... http://youtube.com/dev

-Stuart

--
http://stut.net/

attached mail follows:


Stuart,

Let me clarify, I am using PHP to call/receive via the YouTube API and
to format/display the return data within my PHP application. I
believe that has a little something to do with PHP. Forgive my
presumption if otherwise.

-- Eric

On Jan 7, 2009, at 4:40 AM, Stuart wrote:

> 2009/1/7 L. Herbert <lherbertiluvmydesign.com>:
>> Does anyone know if it is possible to get a collection of YouTube
>> videos
>> from multiple user accounts? If so, can you provide some insight and
>> direction?
>>
>> Someone more knowledgeable than me on this topic indicated that it
>> is only
>> possible get a collection of YouTube videos on a per account
>> basis. On its
>> face this make sense to me but I'm just getting a second opinion.
>>
>> I realize I can loop requests via the API and format the results as
>> needed,
>> but was hoping for a more streamlined option.
>
> This question has nothing to do with PHP. I suggest you try the
> YouTube developers site - I'm sure there's a resource there that can
> help you... http://youtube.com/dev
>
> -Stuart
>
> --
> http://stut.net/

attached mail follows:


2009/1/7 L. Herbert <lherbertiluvmydesign.com>:
> Let me clarify, I am using PHP to call/receive via the YouTube API and to
> format/display the return data within my PHP application. I believe that
> has a little something to do with PHP. Forgive my presumption if otherwise.

As I understand it you're wanting to request a collection of videos
from multiple user accounts in a single API call. PHP cannot help you
if the API does not support doing that, so you need to direct the
question at people who maintain and use the API.

PHP can do a great many things, but it cannot remotely change the
functionality of a third party API.

-Stuart

--
http://stut.net/

> On Jan 7, 2009, at 4:40 AM, Stuart wrote:
>
>> 2009/1/7 L. Herbert <lherbertiluvmydesign.com>:
>>>
>>> Does anyone know if it is possible to get a collection of YouTube videos
>>> from multiple user accounts? If so, can you provide some insight and
>>> direction?
>>>
>>> Someone more knowledgeable than me on this topic indicated that it is
>>> only
>>> possible get a collection of YouTube videos on a per account basis. On
>>> its
>>> face this make sense to me but I'm just getting a second opinion.
>>>
>>> I realize I can loop requests via the API and format the results as
>>> needed,
>>> but was hoping for a more streamlined option.
>>
>> This question has nothing to do with PHP. I suggest you try the
>> YouTube developers site - I'm sure there's a resource there that can
>> help you... http://youtube.com/dev
>>
>> -Stuart
>>
>> --
>> http://stut.net/

attached mail follows:


Stuart,

> PHP can do a great many things, but it cannot remotely change the
> functionality of a third party API.

Is that part of your understanding of my request? To clarify further
for you, I am simply asking my question here (in addition to other
reference/discussion forums) to see if any developer who frequents
this list may have some experience in this regard and offer some
helpful insight. You obviously feel my question is out of place... I
apologize for any discomfort this may have caused you.

On Jan 7, 2009, at 5:19 AM, Stuart wrote:

> 2009/1/7 L. Herbert <lherbertiluvmydesign.com>:
>> Let me clarify, I am using PHP to call/receive via the YouTube API
>> and to
>> format/display the return data within my PHP application. I
>> believe that
>> has a little something to do with PHP. Forgive my presumption if
>> otherwise.
>
> As I understand it you're wanting to request a collection of videos
> from multiple user accounts in a single API call. PHP cannot help you
> if the API does not support doing that, so you need to direct the
> question at people who maintain and use the API.
>
> PHP can do a great many things, but it cannot remotely change the
> functionality of a third party API.
>
> -Stuart
>
> --
> http://stut.net/
>
>> On Jan 7, 2009, at 4:40 AM, Stuart wrote:
>>
>>> 2009/1/7 L. Herbert <lherbertiluvmydesign.com>:
>>>>
>>>> Does anyone know if it is possible to get a collection of YouTube
>>>> videos
>>>> from multiple user accounts? If so, can you provide some insight
>>>> and
>>>> direction?
>>>>
>>>> Someone more knowledgeable than me on this topic indicated that
>>>> it is
>>>> only
>>>> possible get a collection of YouTube videos on a per account
>>>> basis. On
>>>> its
>>>> face this make sense to me but I'm just getting a second opinion.
>>>>
>>>> I realize I can loop requests via the API and format the results as
>>>> needed,
>>>> but was hoping for a more streamlined option.
>>>
>>> This question has nothing to do with PHP. I suggest you try the
>>> YouTube developers site - I'm sure there's a resource there that can
>>> help you... http://youtube.com/dev
>>>
>>> -Stuart
>>>
>>> --
>>> http://stut.net/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


hi Herbet,
i am interested on what your are looking for. maybe you just have to
write a PHP script to
loop through every yourtube account. btw, if you found the solutions,
please tell me or we can work on the solutions together?

On 1/7/09, L. Herbert <lherbertiluvmydesign.com> wrote:
> Stuart,
>
>> PHP can do a great many things, but it cannot remotely change the
>> functionality of a third party API.
>
> Is that part of your understanding of my request? To clarify further
> for you, I am simply asking my question here (in addition to other
> reference/discussion forums) to see if any developer who frequents
> this list may have some experience in this regard and offer some
> helpful insight. You obviously feel my question is out of place... I
> apologize for any discomfort this may have caused you.
>
> On Jan 7, 2009, at 5:19 AM, Stuart wrote:
>
>> 2009/1/7 L. Herbert <lherbertiluvmydesign.com>:
>>> Let me clarify, I am using PHP to call/receive via the YouTube API
>>> and to
>>> format/display the return data within my PHP application. I
>>> believe that
>>> has a little something to do with PHP. Forgive my presumption if
>>> otherwise.
>>
>> As I understand it you're wanting to request a collection of videos
>> from multiple user accounts in a single API call. PHP cannot help you
>> if the API does not support doing that, so you need to direct the
>> question at people who maintain and use the API.
>>
>> PHP can do a great many things, but it cannot remotely change the
>> functionality of a third party API.
>>
>> -Stuart
>>
>> --
>> http://stut.net/
>>
>>> On Jan 7, 2009, at 4:40 AM, Stuart wrote:
>>>
>>>> 2009/1/7 L. Herbert <lherbertiluvmydesign.com>:
>>>>>
>>>>> Does anyone know if it is possible to get a collection of YouTube
>>>>> videos
>>>>> from multiple user accounts? If so, can you provide some insight
>>>>> and
>>>>> direction?
>>>>>
>>>>> Someone more knowledgeable than me on this topic indicated that
>>>>> it is
>>>>> only
>>>>> possible get a collection of YouTube videos on a per account
>>>>> basis. On
>>>>> its
>>>>> face this make sense to me but I'm just getting a second opinion.
>>>>>
>>>>> I realize I can loop requests via the API and format the results as
>>>>> needed,
>>>>> but was hoping for a more streamlined option.
>>>>
>>>> This question has nothing to do with PHP. I suggest you try the
>>>> YouTube developers site - I'm sure there's a resource there that can
>>>> help you... http://youtube.com/dev
>>>>
>>>> -Stuart
>>>>
>>>> --
>>>> http://stut.net/
>>
>> --
>> 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
>
>

attached mail follows:


It is the wrong list to ask.

The answer is that the YouTube API does not support that.

You'll have to merge and sort in PHP.

I recommend you cache the results for all external web services, as a general principle.

For a large number of videos, you'll want to merge/sort in DB, not in PHP arrays.

attached mail follows:


>> it' may seem like a small amount of space but when you have 8
>> char(255) columns in a table with 10 million rows you'd noticed the
>> difference considerably.

It is a small amount of space. Perhaps it was necessary in the days
when 1Gb Hdds were a luxury, but those days are long gone. In the
example you gave you're still only wasting approx 1 GB. Hardly a lot
these days when you consider you buy a consumer 500Gb Hdd for £50.

--
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated January 4th)

attached mail follows:


Richard Heyes wrote:

>So where's the advantage of VARCHAR ?

Less space on disc = less data retrieved from disc = faster data
retrieval - sometimes. If you have small columns, a small number of
rows, or both, then char columns may be faster. If you have large
columns of varying actual length, lots of rows, or both, then varchar
columns may be faster.

The best thing for performance is reducing the number of times you hit
the disc. If you can cache (more of) a table by using varchars instead
of chars for some columns, then varchars have an advantage.

Knowing what your data requires leads to better results than picking in
advance whether to use char or varchar (or text). Measuring is even
better.

Oh, and for a column with a limited range of values, enum beats 'em all!
--
Ross McKay, Toronto, NSW Australia
"You can't control what you can't measure" - Tom DeMarco

attached mail follows:


2009/1/7 Ross McKay <roskozeta.org.au>:
> Oh, and for a column with a limited range of values, enum beats 'em all!

Got anything to back that up?

http://www.mysqlperformanceblog.com/2008/01/24/enum-fields-vs-varchar-vs-int-joined-table-what-is-faster/

-Stuart

--
http://stut.net/

attached mail follows:


>>So where's the advantage of VARCHAR ?
>
> Less space on disc = less data retrieved from disc = faster data
> retrieval - sometimes. If you have small columns, a small number of
> rows, or both, then char columns may be faster. If you have large
> columns of varying actual length, lots of rows, or both, then varchar
> columns may be faster.

I still think a CHAR field would be faster than a VARCHAR because of
the fixed row length (assuming every thing else is fixed). Perhaps
someone from the MySQL list could clarify...?

--
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated January 4th)

attached mail follows:


Stuart wrote:

>Got anything to back that up?
>
>http://www.mysqlperformanceblog.com/2008/01/24/enum-fields-vs-varchar-vs-int-joined-table-what-is-faster/

Thanks, that'll do nicely. Even that strapped chicken test with tables
that are likely cached shows enum as the fasted, albeit only marginally.
Where disc reads are required, or even (hand-to-forehead) a large table
scan, the difference would be much more significant.

Not that I'd advocate enum columns widely instead of char or varchar (or
text); horses for courses, whatever suits the data best. As I said in
the last post, knowing what your data requires leads to better results
than picking in advance whether to use char or varchar (or text).
Measuring is even better.
--
Ross McKay, Toronto, NSW Australia
"There is more to life than simply increasing its speed." - Gandhi

attached mail follows:


There are other factors. If a table is completely fixed in size it makes
for a faster lookup time since the offset is easier to compute. This is
true, at least, for myisam tables. All books on tuning that I have read
have said the CHAR makes for more efficient lookup and comparison that
VARCHAR.

Also, I was told by the instructor at a MySQL class that all VARCHAR columns
are converted to CHAR when stored in memory. Can anyone else confirm this?

On Wed, Jan 7, 2009 at 7:26 AM, Richard Heyes <richardphp.net> wrote:

> >>So where's the advantage of VARCHAR ?
> >
> > Less space on disc = less data retrieved from disc = faster data
> > retrieval - sometimes. If you have small columns, a small number of
> > rows, or both, then char columns may be faster. If you have large
> > columns of varying actual length, lots of rows, or both, then varchar
> > columns may be faster.
>
> I still think a CHAR field would be faster than a VARCHAR because of
> the fixed row length (assuming every thing else is fixed). Perhaps
> someone from the MySQL list could clarify...?
>
> --
> Richard Heyes
>
> HTML5 Graphing for FF, Chrome, Opera and Safari:
> http://www.rgraph.org (Updated January 4th)
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=jlyons4435gmail.com
>
>

--
Jim Lyons
Web developer / Database administrator
http://www.weblyons.com

attached mail follows:


On 1/7/09, Jim Lyons <jlyons4435gmail.com> wrote:
>
> There are other factors. If a table is completely fixed in size it makes
> for a faster lookup time since the offset is easier to compute. This is
> true, at least, for myisam tables. All books on tuning that I have read
> have said the CHAR makes for more efficient lookup and comparison that
> VARCHAR.
>
> Also, I was told by the instructor at a MySQL class that all VARCHAR
> columns
> are converted to CHAR when stored in memory. Can anyone else confirm this?

That's my recollection, also, derived from a MySQL class. IIRC, the char
length is equal to the longest varchar record in the column.

David

attached mail follows:


On Wed, Jan 7, 2009 at 9:17 AM, David Giragosian <dgiragosiangmail.com> wrote:
> On 1/7/09, Jim Lyons <jlyons4435gmail.com> wrote:
>>
>> There are other factors. If a table is completely fixed in size it makes
>> for a faster lookup time since the offset is easier to compute. This is
>> true, at least, for myisam tables. All books on tuning that I have read
>> have said the CHAR makes for more efficient lookup and comparison that
>> VARCHAR.
>>
>> Also, I was told by the instructor at a MySQL class that all VARCHAR
>> columns
>> are converted to CHAR when stored in memory. Can anyone else confirm this?
>
>
> That's my recollection, also, derived from a MySQL class. IIRC, the char
> length is equal to the longest varchar record in the column.

Actually it's a fixed-length buffer big enough to hold the worst-case
possible value, not the worst-case existing value. In bytes, no less.
 If it's a utf8 varchar(100), that's 300 bytes, even if the biggest
value in the table is one character.

--
Baron Schwartz, Director of Consulting, Percona Inc.
Our Blog: http://www.mysqlperformanceblog.com/
Our Services: http://www.percona.com/services.html

attached mail follows:


Richard Heyes wrote:
>>> it' may seem like a small amount of space but when you have 8
>>> char(255) columns in a table with 10 million rows you'd noticed the
>>> difference considerably.
>>>
>
> It is a small amount of space. Perhaps it was necessary in the days
> when 1Gb Hdds were a luxury, but those days are long gone. In the
> example you gave you're still only wasting approx 1 GB. Hardly a lot
> these days when you consider you buy a consumer 500Gb Hdd for £50.
>
>
You also have to remember that server drives are more expensive as they
are of higher quality than consumer disks. They require a lot more MTBF
than your normal hard drive at your local computer store. Also, if you
waste 1GB in 1 column, imagine how much wasted space there is in the
whole DB.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com

attached mail follows:


On Wed, 2009-01-07 at 10:49 +0000, Richard Heyes wrote:
> >> it' may seem like a small amount of space but when you have 8
> >> char(255) columns in a table with 10 million rows you'd noticed the
> >> difference considerably.
>
> It is a small amount of space. Perhaps it was necessary in the days
> when 1Gb Hdds were a luxury, but those days are long gone. In the
> example you gave you're still only wasting approx 1 GB. Hardly a lot
> these days when you consider you buy a consumer 500Gb Hdd for £50.

That's for a single table. Now add another 20 to 50 tables depending on
the database. If you want to throw away money go ahead, but I don't know
too many clients that want to waste 10 gigs of mostly padded space.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

attached mail follows:


On Wed, 2009-01-07 at 13:26 +0000, Richard Heyes wrote:
> >>So where's the advantage of VARCHAR ?
> >
> > Less space on disc = less data retrieved from disc = faster data
> > retrieval - sometimes. If you have small columns, a small number of
> > rows, or both, then char columns may be faster. If you have large
> > columns of varying actual length, lots of rows, or both, then varchar
> > columns may be faster.
>
> I still think a CHAR field would be faster than a VARCHAR because of
> the fixed row length (assuming every thing else is fixed). Perhaps
> someone from the MySQL list could clarify...?

I would say it depends. For a single row request it certainly should be
since the entire row can be found by pre-computing the offset. However,
multiple rows would mean a larger spread accross the hard drive due to
data padding and this could incurr more slow seeks (remember just
because the data is contiguous doesn't mean it's stored that way
physically).

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

attached mail follows:


Hello,

suppose there is a file at http://otherhost.com/remote.php that looks
like this:

<?php
if (!isset($safe_flag))
{
    die("hacking attempt");
}
echo "You are in";
?>

Suppose i executed the following php file at http://myhost.com/local.php

<?php
require_once("http://otherhost.com/remote.php");
?>

Is there any way to get local.php to display "You are in", by only
modifying local.php? That is, is there a way to set $safe_flag on the
remote host as one requests a file from the remote host from within
local.php?

I have genuine, academic, non-belligerent intentions when asking this
question.

Thanks,
dK

attached mail follows:


2009/1/7 Daniel Kolbo <kolb0057umn.edu>:
> suppose there is a file at http://otherhost.com/remote.php that looks like
> this:
>
> <?php
> if (!isset($safe_flag))
> {
> die("hacking attempt");
> }
> echo "You are in";
> ?>
>
> Suppose i executed the following php file at http://myhost.com/local.php
>
> <?php
> require_once("http://otherhost.com/remote.php");
> ?>
>
> Is there any way to get local.php to display "You are in", by only modifying
> local.php? That is, is there a way to set $safe_flag on the remote host as
> one requests a file from the remote host from within local.php?
>
> I have genuine, academic, non-belligerent intentions when asking this
> question.

Doing this is evil and should be avoided if at all possible. However,
assuming you really need to do it this way...

The best way to validate inclusion is to check the value of
$_SERVER['REMOTE_ADDR'] in the remote script and only allow known IPs.
This is not foolproof but will kill off casual attempts to get the
code.

Alternatively if you change the test for $safe_flag to
$_GET['safe_flag'] and add ?safe_flag=1 to the end of the URL in the
require call that should also work, but is easily copied. You could
randomise "safe_flag" and the value to make it more difficult, but
checking the IP is far better IMHO.

-Stuart

--
http://stut.net/

attached mail follows:


Daniel Kolbo wrote:
> Hello,
>
> suppose there is a file at http://otherhost.com/remote.php that looks
> like this:
>
> <?php
> if (!isset($safe_flag))
> {
> die("hacking attempt");
> }
> echo "You are in";
> ?>
>
> Suppose i executed the following php file at http://myhost.com/local.php
>
> <?php
> require_once("http://otherhost.com/remote.php");
> ?>
>
> Is there any way to get local.php to display "You are in", by only
> modifying local.php? That is, is there a way to set $safe_flag on the
> remote host as one requests a file from the remote host from within
> local.php?
>
> I have genuine, academic, non-belligerent intentions when asking this
> question.
>
> Thanks,
> dK
>
>
>

local.php

<?php

$safe_flag = 1;
require_once("http://otherhost.com/remote.php");

?>

--
Thanks!
-Shawn
http://www.spidean.com

attached mail follows:


2009/1/7 Shawn McKenzie <nospammckenzies.net>:
> Daniel Kolbo wrote:
>> Hello,
>>
>> suppose there is a file at http://otherhost.com/remote.php that looks
>> like this:
>>
>> <?php
>> if (!isset($safe_flag))
>> {
>> die("hacking attempt");
>> }
>> echo "You are in";
>> ?>
>>
>> Suppose i executed the following php file at http://myhost.com/local.php
>>
>> <?php
>> require_once("http://otherhost.com/remote.php");
>> ?>
>>
>> Is there any way to get local.php to display "You are in", by only
>> modifying local.php? That is, is there a way to set $safe_flag on the
>> remote host as one requests a file from the remote host from within
>> local.php?
>>
>> I have genuine, academic, non-belligerent intentions when asking this
>> question.
>
> local.php
>
> <?php
>
> $safe_flag = 1;
> require_once("http://otherhost.com/remote.php");
>
> ?>

If the remote side is returning the code rather than running it then
anyone can see exactly what to do to get it to work. There is no
security there.

OP: Does otherhost.com run the code or return it?

-Stuart

--
http://stut.net/

attached mail follows:


Shawn McKenzie wrote:
> Daniel Kolbo wrote:
>
>> Hello,
>>
>> suppose there is a file at http://otherhost.com/remote.php that looks
>> like this:
>>
>> <?php
>> if (!isset($safe_flag))
>> {
>> die("hacking attempt");
>> }
>> echo "You are in";
>> ?>
>>
>> Suppose i executed the following php file at http://myhost.com/local.php
>>
>> <?php
>> require_once("http://otherhost.com/remote.php");
>> ?>
>>
>> Is there any way to get local.php to display "You are in", by only
>> modifying local.php? That is, is there a way to set $safe_flag on the
>> remote host as one requests a file from the remote host from within
>> local.php?
>>
>> I have genuine, academic, non-belligerent intentions when asking this
>> question.
>>
>> Thanks,
>> dK
>>
>>
>>
>>
>
> local.php
>
> <?php
>
> $safe_flag = 1;
> require_once("http://otherhost.com/remote.php");
>
> ?>
>
>
The proposed method does not work, as the script returned from
remote.php is "hacking attempt", because $safe_flag is in the scope of
myhost.com and not otherhost.com.
dK

attached mail follows:


Stuart wrote:
> 2009/1/7 Shawn McKenzie <nospammckenzies.net>:
>
>> Daniel Kolbo wrote:
>>
>>> Hello,
>>>
>>> suppose there is a file at http://otherhost.com/remote.php that looks
>>> like this:
>>>
>>> <?php
>>> if (!isset($safe_flag))
>>> {
>>> die("hacking attempt");
>>> }
>>> echo "You are in";
>>> ?>
>>>
>>> Suppose i executed the following php file at http://myhost.com/local.php
>>>
>>> <?php
>>> require_once("http://otherhost.com/remote.php");
>>> ?>
>>>
>>> Is there any way to get local.php to display "You are in", by only
>>> modifying local.php? That is, is there a way to set $safe_flag on the
>>> remote host as one requests a file from the remote host from within
>>> local.php?
>>>
>>> I have genuine, academic, non-belligerent intentions when asking this
>>> question.
>>>
>> local.php
>>
>> <?php
>>
>> $safe_flag = 1;
>> require_once("http://otherhost.com/remote.php");
>>
>> ?>
>>
>
> If the remote side is returning the code rather than running it then
> anyone can see exactly what to do to get it to work. There is no
> security there.
>
> OP: Does otherhost.com run the code or return it?
>
> -Stuart
>
>
otherhost.com runs the code.
dK

attached mail follows:


If register_globals is "on" (ewww!) at otherhost.com, then "?safe_flag" on the URL will get in.

This is one of the reasons why register_globals should be OFF.

NOTE:
The code you gave does not describe the circumstances whereby $safe_flag is "set". There could be all manner of other issues around that code that we cannot address without seeing more.

attached mail follows:


ceol-i-e.com wrote:
> If register_globals is "on" (ewww!) at otherhost.com, then "?safe_flag" on the URL will get in.
>
> This is one of the reasons why register_globals should be OFF.
>
> NOTE:
> The code you gave does not describe the circumstances whereby $safe_flag is "set". There could be all manner of other issues around that code that we cannot address without seeing more.
>
There is no other code. This is an example I created to help me
understand finer points of PHP.
thanks,
dK

attached mail follows:


Hello,

I'm pleased to announce the following position in our team of talented
engineers. I personally enjoy working here and recommend this job to the
dynamic, motivated self-starter looking for his/ her next career step in
the open source world. Please feel free to forward this to anybody
interested.

Based in beautiful Berlin, we are a medium sized but growing database
solutions provider for various industries and the public sector. Our
main product is easydb, a customizable web-based front-end for SQL
databases, which is being used to organize and share multimedia content.
Thanks to our commitment to provide State-of-the-Art technology, the
number of easydb clients is steadily growing.

Due to growth, we are currently seeking to hire a passionate A-class
senior programmer. You should be a good team player and be fluent in
written and spoken English. We would love to meet with you, if you have
these must-have skills:

 - Excellent SQL Database Knowledge ( Postgres, Oracle prefered )
 - Excellent Linux User Space Knowledge ( Bash Scripting )
 - Excellent Python, C/C++, PHP Knowledge ( Python Twisted Framework )
 - 5 years of Job or Similar Experience

As a group team leader your main task would be implementing new features
and maintaining easydb (PHP) and easydb Media Server (Python Twisted).

We offer you interesting and challenging projects in a stable environment:

 - successful company with a solid growth model and a corporate
   mission you can believe in
 - good working atmosphere within a highly motivated team with
   flat hierarchies
 - guided familiarization and extraordinary cooperativeness
   opportunity to improve your human and technical skills
 - chance to work on your own authority
 - based in Prenzlauer Berg, conveniently located near
   Alexanderplatz in an historical industrial building
 - excellent pay

For consideration please send your full resume in German or English,
your reference projects and/ or a letter of recommendation to
jobsprogrammfabrik.de. Your first day would be 30th March 2009, on site
in Berlin.

Kind Regards

Markus Wanner

attached mail follows:


Thanks for the help guys, much appreciated!
--
View this message in context: http://www.nabble.com/RSS-Feed-on-my-PHP-site-tp21293513p21330097.html
Sent from the PHP - General mailing list archive at Nabble.com.

attached mail follows:


Let's say I have these URLs

http://example.com/index.php?q=gallery
http://example.com/index.php?q=gallery&g2_itemId=81
http://example.com/index.php?q=gallery&g2_itemId=100

I want to have a line of code that will extract just the
"http://example.com/index.php?q=gallery" part of the URL.

I am never good with regex, please help. TIA.

--
roger

--
Sign Up for free Email at http://ureg.home.net.my/

attached mail follows:


Sn!per wrote:
> Let's say I have these URLs
>
> http://example.com/index.php?q=gallery
> http://example.com/index.php?q=gallery&g2_itemId=81
> http://example.com/index.php?q=gallery&g2_itemId=100
>
> I want to have a line of code that will extract just the
> "http://example.com/index.php?q=gallery" part of the URL.
>
> I am never good with regex, please help. TIA.
>
> --
> roger
>
>
>
>
> --
> Sign Up for free Email at http://ureg.home.net.my/
>

http://uk3.php.net/parse_url may be more suited to you're needs

attached mail follows:


I'm running through a large dataset and am generating/manipulating XML
documents for each record. What's happening is that after a while, I
get a fatal error saying:

Fatal error: Allowed memory size of 167772160 bytes exhausted (tried
to allocate 32650313 bytes)

Each XML file I generate (an manipulate) can range from just a few
megs to upwards of 35 megs. Judging from the error above, it looks
like the memory for the DOMDocument objects I instantiate is not
getting freed; it just continues to stay in memory until the memory is
completely exhausted. The method (in my object) I am using to
instantiate a new DOMDocument is as follows:

    protected function createCleanDomDocument()
    {
/*
      if(( isset( $this->oDomXPath )) && ( !is_null( $this->oDomXPath )))
      {
        unset( $this->oDomXPath );
      }

      if(( isset( $this->oDomDocument )) && ( !is_null( $this->oDomDocument )))
      {
        unset( $this->oDomDocument );
      }
*/
      $this->oDomDocument = new DOMDocument( '1.0', 'iso-8859-1' );
      $this->oDomXPath = new DOMXpath( $this->oDomDocument );
    }

which is used in both the constructor of my object and in a few other
places. I would think that when the new DOMDocument is instantiated,
the memory used for the old value would get freed. As you can see,
I've even tried to unset the variables but that doesn't seem to help
matters much, either.

Does anyone know how (or even if) I can explicitly free the memory
used for the DOMDocument? Any help/advice would be greatly
appreciated!

thnx,
Christoph

attached mail follows:


Christoph Boget wrote:
> I'm running through a large dataset and am generating/manipulating XML
> documents for each record. What's happening is that after a while, I
> get a fatal error saying:
>
> Fatal error: Allowed memory size of 167772160 bytes exhausted (tried
> to allocate 32650313 bytes)
>
> Each XML file I generate (an manipulate) can range from just a few
> megs to upwards of 35 megs. Judging from the error above, it looks
> like the memory for the DOMDocument objects I instantiate is not
> getting freed; it just continues to stay in memory until the memory is
> completely exhausted. The method (in my object) I am using to
> instantiate a new DOMDocument is as follows:
>
> protected function createCleanDomDocument()
> {
> /*
> if(( isset( $this->oDomXPath )) && ( !is_null( $this->oDomXPath )))
> {
> unset( $this->oDomXPath );
> }
>
> if(( isset( $this->oDomDocument )) && ( !is_null( $this->oDomDocument )))
> {
> unset( $this->oDomDocument );
> }
> */
> $this->oDomDocument = new DOMDocument( '1.0', 'iso-8859-1' );
> $this->oDomXPath = new DOMXpath( $this->oDomDocument );
> }
>
> which is used in both the constructor of my object and in a few other
> places. I would think that when the new DOMDocument is instantiated,
> the memory used for the old value would get freed. As you can see,
> I've even tried to unset the variables but that doesn't seem to help
> matters much, either.
>
> Does anyone know how (or even if) I can explicitly free the memory
> used for the DOMDocument? Any help/advice would be greatly
> appreciated!
>
> thnx,
> Christoph

I've had exactly the same problem and couldn't find a way around it;
even after unsetting every variable in my scripts inside a for/while
loop; in the end I opted for a CLI script which opened worker threads
then killed/restarted them when memory usage was X.

attached mail follows:


Christoph Boget wrote:
> I'm running through a large dataset and am generating/manipulating XML
> documents for each record. What's happening is that after a while, I
> get a fatal error saying:
>
> Fatal error: Allowed memory size of 167772160 bytes exhausted (tried
> to allocate 32650313 bytes)
>
> Each XML file I generate (an manipulate) can range from just a few
> megs to upwards of 35 megs. Judging from the error above, it looks
> like the memory for the DOMDocument objects I instantiate is not
> getting freed; it just continues to stay in memory until the memory is
> completely exhausted. The method (in my object) I am using to
> instantiate a new DOMDocument is as follows:
>
> protected function createCleanDomDocument()
> {
> /*
> if(( isset( $this->oDomXPath )) && ( !is_null( $this->oDomXPath )))
> {
> unset( $this->oDomXPath );
> }
>
> if(( isset( $this->oDomDocument )) && ( !is_null( $this->oDomDocument )))
> {
> unset( $this->oDomDocument );
> }
> */
> $this->oDomDocument = new DOMDocument( '1.0', 'iso-8859-1' );
> $this->oDomXPath = new DOMXpath( $this->oDomDocument );
> }
>
> which is used in both the constructor of my object and in a few other
> places. I would think that when the new DOMDocument is instantiated,
> the memory used for the old value would get freed. As you can see,
> I've even tried to unset the variables but that doesn't seem to help
> matters much, either.
>
> Does anyone know how (or even if) I can explicitly free the memory
> used for the DOMDocument? Any help/advice would be greatly
> appreciated!
>
> thnx,
> Christoph

I've had exactly the same problem and couldn't find a way around it;
even after unsetting every variable in my scripts inside a for/while
loop; in the end I opted for a CLI script which opened worker threads
then killed/restarted them when memory usage was X.

attached mail follows:


>> Does anyone know how (or even if) I can explicitly free the memory
>> used for the DOMDocument? Any help/advice would be greatly
>> appreciated!
> I've had exactly the same problem and couldn't find a way around it; even
> after unsetting every variable in my scripts inside a for/while loop; in the
> end I opted for a CLI script which opened worker threads then
> killed/restarted them when memory usage was X.

Unfortunately, that is not an option for me. It just blows my mind
that a method to free memory used for a DOMDocument object wasn't
built in... :|

thnx,
Christoph

attached mail follows:


Maybe you could find and answer here:

http://drupal.org/node/81037

Some people have the same problem, i was this trouble in the past and i fix it increasing the memory_limit in php.ini file

Anyway read the posts in the url that i wrote.

> To: php-generallists.php.net; jcbogetyahoo.com
> Date: Wed, 7 Jan 2009 15:21:50 +0000
> From: nrixhamgmail.com
> CC: php-generallists.php.net
> Subject: [PHP] Re: Freeing memory for DOMDocument
>
> Christoph Boget wrote:
> > I'm running through a large dataset and am generating/manipulating XML
> > documents for each record. What's happening is that after a while, I
> > get a fatal error saying:
> >
> > Fatal error: Allowed memory size of 167772160 bytes exhausted (tried
> > to allocate 32650313 bytes)
> >
> > Each XML file I generate (an manipulate) can range from just a few
> > megs to upwards of 35 megs. Judging from the error above, it looks
> > like the memory for the DOMDocument objects I instantiate is not
> > getting freed; it just continues to stay in memory until the memory is
> > completely exhausted. The method (in my object) I am using to
> > instantiate a new DOMDocument is as follows:
> >
> > protected function createCleanDomDocument()
> > {
> > /*
> > if(( isset( $this->oDomXPath )) && ( !is_null( $this->oDomXPath )))
> > {
> > unset( $this->oDomXPath );
> > }
> >
> > if(( isset( $this->oDomDocument )) && ( !is_null( $this->oDomDocument )))
> > {
> > unset( $this->oDomDocument );
> > }
> > */
> > $this->oDomDocument = new DOMDocument( '1.0', 'iso-8859-1' );
> > $this->oDomXPath = new DOMXpath( $this->oDomDocument );
> > }
> >
> > which is used in both the constructor of my object and in a few other
> > places. I would think that when the new DOMDocument is instantiated,
> > the memory used for the old value would get freed. As you can see,
> > I've even tried to unset the variables but that doesn't seem to help
> > matters much, either.
> >
> > Does anyone know how (or even if) I can explicitly free the memory
> > used for the DOMDocument? Any help/advice would be greatly
> > appreciated!
> >
> > thnx,
> > Christoph
>
> I've had exactly the same problem and couldn't find a way around it;
> even after unsetting every variable in my scripts inside a for/while
> loop; in the end I opted for a CLI script which opened worker threads
> then killed/restarted them when memory usage was X.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

_________________________________________________________________
Chatea en Messenger desde Hotmail.
http://download.live.com

attached mail follows:


Jesús Enrique Muñoz Fernández wrote:
> Maybe you could find and answer here:
>
> *http://drupal.org/node/81037
>
> Some people have the same problem, i was this trouble in the past and
> i fix it increasing the *memory_limit *in php.ini file*
>
> Anyway read the posts in the url that i wrote.
>
>
>
> > To: php-generallists.php.net; jcbogetyahoo.com
> > Date: Wed, 7 Jan 2009 15:21:50 +0000
> > From: nrixhamgmail.com
> > CC: php-generallists.php.net
> > Subject: [PHP] Re: Freeing memory for DOMDocument
> >
> > Christoph Boget wrote:
> > > I'm running through a large dataset and am generating/manipulating XML
> > > documents for each record. What's happening is that after a while, I
> > > get a fatal error saying:
> > >
> > > Fatal error: Allowed memory size of 167772160 bytes exhausted (tried
> > > to allocate 32650313 bytes)
> > >
> > > Each XML file I generate (an manipulate) can range from just a few
> > > megs to upwards of 35 megs. Judging from the error above, it looks
> > > like the memory for the DOMDocument objects I instantiate is not
> > > getting freed; it just continues to stay in memory until the memory is
> > > completely exhausted. The method (in my object) I am using to
> > > instantiate a new DOMDocument is as follows:
> > >
> > > protected function createCleanDomDocument()
> > > {
> > > /*
> > > if(( isset( $this->oDomXPath )) && ( !is_null( $this->oDomXPath )))
> > > {
> > > unset( $this->oDomXPath );
> > > }
> > >
> > > if(( isset( $this->oDomDocument )) && ( !is_null(
> $this->oDomDocument )))
> > > {
> > > unset( $this->oDomDocument );
> > > }
> > > */
> > > $this->oDomDocument = new DOMDocument( '1.0', 'iso-8859-1' );
> > > $this->oDomXPath = new DOMXpath( $this->oDomDocument );
> > > }
> > >
> > > which is used in both the constructor of my object and in a few other
> > > places. I would think that when the new DOMDocument is instantiated,
> > > the memory used for the old value would get freed. As you can see,
> > > I've even tried to unset the variables but that doesn't seem to help
> > > matters much, either.
> > >
> > > Does anyone know how (or even if) I can explicitly free the memory
> > > used for the DOMDocument? Any help/advice would be greatly
> > > appreciated!
> > >
> > > thnx,
> > > Christoph
> >
> > I've had exactly the same problem and couldn't find a way around it;
> > even after unsetting every variable in my scripts inside a for/while
> > loop; in the end I opted for a CLI script which opened worker threads
> > then killed/restarted them when memory usage was X.
> >
Just because.. I'm going to write out my thoughts on this and see if we
can come to any kind of fixed bug or solution.

The issue is that memory assigned to DOMDocuments is not being freed
correctly.

The job of freeing memory falls to the garbage collection; which
implements the following algorithm:
http://www.research.ibm.com/people/d/dfb/papers/Bacon03Pure.pdf

(root buffer size of 10000)

AFAIK a variable becomes a candidate for gc when it is no longer required (unset and no references to it?)

because of the way we use domdocument often we have many variables referencing existing or created nodes within the document; as well as xpath and suchlike; thus it stands to reason that unless all of these are also unset the DOMDocument will not be caught by gc.

first test then is to check that all variables that even sniff at the DOMDocument (or nodes within) are unset.

technically I'd guess that a script that loads an xml document in to a DOMDocument, then unsets it on a for loop should never grow the used memory. I'm going to write a little test script to prove this in a mo.

Regards

Nathan

attached mail follows:


anyone who works with php-gtk2 and can tell me if I can make something
like msn, skype, a little chat (is it possible to connect to a webserver
and sabe in my local server using gtk2?)

attached mail follows:


Zechim wrote:
> anyone who works with php-gtk2 and can tell me if I can make something
> like msn, skype, a little chat (is it possible to connect to a webserver
> and sabe in my local server using gtk2?)

probably best off asking on the php gtk list ;)

attached mail follows:


On Wed, Jan 7, 2009 at 6:49 AM, Zechim <zechim.phpgmail.com> wrote:

> anyone who works with php-gtk2 and can tell me if I can make something like
> msn, skype, a little chat (is it possible to connect to a webserver and sabe
> in my local server using gtk2?)
>

since gtk is just a gui layer, i would imagine you can do anything php cli
can do in a php-gtk2 app.

-nathan

attached mail follows:


Irrespective of the GTK2 bit, PHP can connect just fine with other servers using sockets and stream wrappers and good ol' file_get_contents on a URL.

Whether you can tweak those in useful ways at fast enough speeds to do what you want is more up to your skill than PHP's feature-set.

attached mail follows:


On Wed, Jan 7, 2009 at 4:54 AM, Mika Jaaksi <mika.jaaksigmail.com> wrote:

> I already can get the data from database to a page. Now I want to make link
> from that data to next page and on that new page it should show all the
> data
> that is related.
>
> example:
>
> data from database
> -->
> page1 where listed:
>
> band1 (a href)
> band2 (a href)
> band3 (a href)
> ...
>
> and when clicking for example band3
> -->
> page2 where listed band info:
>
> bandname
> bandhistory
> bandmembers
> ...
>
> So, how should I do this? Should I somehow use $_POST method to
> send/deliver
> band_id to the next page?
>

You could do several things.

1) Use javascript to make a link using the band3 value within the Javascript
to pass the ID to the next page.

Example:

Have a Javascript function -

<script language="JavaScript">
<!--
function openWin(band_id) {
 var link
 link = my/directory/display.php?band_id=' + band_id;
 MyWin = window.open(link,"OpenPage");
 MyWin.focus();
}
//-->
</script>

And then call that function when you click on the band you want.

<a href="javascript:openWin('<?php echo $band_id; ?>')"><?php echo $band;
?></a>

2) You could use form objects (radio buttons/check boxes/dropdown box etc)
to pass the band_id value via POST

Then on your second page all you would have to do is get the value.

Example:
<input type="radio" tabindex="1" name="band" value="<?php echo $band_id;
?>">
<input type="radio" tabindex="2" name="band" value="<?php echo $band_id;
?>">
<input type="radio" tabindex="3" name="band" value="<?php echo $band_id;
?>">

On the second page you would simply check the posted value of you "band"
radio input:

$band_id = $_POST['band'];

Hope that helps.

Dan

attached mail follows:


Dan Shirah wrote:
> On Wed, Jan 7, 2009 at 4:54 AM, Mika Jaaksi <mika.jaaksigmail.com> wrote:
>
>> I already can get the data from database to a page. Now I want to make link
>> from that data to next page and on that new page it should show all the
>> data
>> that is related.
>>
>> example:
>>
>> data from database
>> -->
>> page1 where listed:
>>
>> band1 (a href)
>> band2 (a href)
>> band3 (a href)
>> ...
>>
>> and when clicking for example band3
>> -->
>> page2 where listed band info:
>>
>> bandname
>> bandhistory
>> bandmembers
>> ...
>>
>> So, how should I do this? Should I somehow use $_POST method to
>> send/deliver
>> band_id to the next page?
>>
>
> You could do several things.
>
> 1) Use javascript to make a link using the band3 value within the Javascript
> to pass the ID to the next page.
>
> Example:
>
> Have a Javascript function -
>
> <script language="JavaScript">
> <!--
> function openWin(band_id) {
> var link
> link = my/directory/display.php?band_id=' + band_id;
> MyWin = window.open(link,"OpenPage");
> MyWin.focus();
> }
> //-->
> </script>
>
> And then call that function when you click on the band you want.
>
> <a href="javascript:openWin('<?php echo $band_id; ?>')"><?php echo $band;
> ?></a>
>
> 2) You could use form objects (radio buttons/check boxes/dropdown box etc)
> to pass the band_id value via POST
>
> Then on your second page all you would have to do is get the value.
>
> Example:
> <input type="radio" tabindex="1" name="band" value="<?php echo $band_id;
> ?>">
> <input type="radio" tabindex="2" name="band" value="<?php echo $band_id;
> ?>">
> <input type="radio" tabindex="3" name="band" value="<?php echo $band_id;
> ?>">
>
> On the second page you would simply check the posted value of you "band"
> radio input:
>
> $band_id = $_POST['band'];
>
> Hope that helps.
>
> Dan
>

Maybe too simple, but just use a get var in the link of page1:

<a href="page2.php?band=1">Band1</a>
<a href="page2.php?band=2">Band2</a>

Then in page2 use $_GET['band'] and do your query. (of course checked
and sanitized, yadayada...)

--
Thanks!
-Shawn
http://www.spidean.com

attached mail follows:


hi guys,
I did php/mysql based website for one my client 7 years ago, in time when register_globals was on by default.
hosting company upgraded server to php5/mysql5 and turned globals off. the site is doesn't work any more.
I can define globals on again in .htaccess but rather not because it could be a big risk.
to work again I have to spend a lot of hours to modify the code. boring job. but, I'm more concern does client has to pay the changes/upgrade or it's still "my obligation"?
anybody had similar experience?

thanks for any help.

ll

      

attached mail follows:


> but, I'm more concern does client has to pay the changes/upgrade or it's still "my obligation"?

Of course you charge him. Christ if I was expected to maintain stuff
gratis that I wrote 7 years ago I'd be mullahed.

--
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated January 4th)

attached mail follows:


Lamp Lists wrote:
> hi guys,
> I did php/mysql based website for one my client 7 years ago, in time when register_globals was on by default.
> hosting company upgraded server to php5/mysql5 and turned globals off. the site is doesn't work any more.
> I can define globals on again in .htaccess but rather not because it could be a big risk.
> to work again I have to spend a lot of hours to modify the code. boring job. but, I'm more concern does client has to pay the changes/upgrade or it's still "my obligation"?
> anybody had similar experience?
>
> thanks for any help.
>
> ll
>
>
>
>
>
Looks like a case of: "It's not if, but when". Someday, some will have to do it.

Compare the situation with some other product. The customer should not expect
the designer to provide free maintenance forever. Have they paid you a yearly
maintenance fee?

Also, things have changed regarding register_globals. They became a major
security risk because hackers learned how to exploit them, since you designed
the code.

attached mail follows:


Lamp Lists schrieb:
> hi guys,
> I did php/mysql based website for one my client 7 years ago, in time when register_globals was on by default.
> hosting company upgraded server to php5/mysql5 and turned globals off. the site is doesn't work any more.
> I can define globals on again in .htaccess but rather not because it could be a big risk.
> to work again I have to spend a lot of hours to modify the code. boring job. but, I'm more concern does client has to pay the changes/upgrade or it's still "my obligation"?
> anybody had similar experience?
>
> thanks for any help.
>
> ll
>
>
>
>
>
Hi,
i think this is a contract Problem. I think this ist not your
"obligation", because you have doing this Work for seven Years. The
decision to change/Upgrade the Product was from the hosting Company and
the client shiould be prepared to change the software, if Changes are
known and new Versions will be set. If the Client offers you a Job to
change the Software is a new Job and must pay. PLease contact a lawyer
to get more Information about the legal practice on your Country.

Salut

Carlos Medina

attached mail follows:


2009/1/7 Lamp Lists <lamp.listsyahoo.com>:
> hi guys,
> I did php/mysql based website for one my client 7 years ago, in time when register_globals was on by default.
> hosting company upgraded server to php5/mysql5 and turned globals off. the site is doesn't work any more.
> I can define globals on again in .htaccess but rather not because it could be a big risk.

The first point to make is that the risk is no higher now than it has
been for the previous 7 years. Register_globals is not inherently
insecure, it's the way people code their scripts which makes it open
to abuse.

> to work again I have to spend a lot of hours to modify the code. boring job. but, I'm more concern does client has to pay the changes/upgrade or it's still "my obligation"?
> anybody had similar experience?

Personally I'd tell the client that the host has upgraded the server
software which has broken the site. It needs work and they need to pay
for it. If they object tell them you can work around the issue but it
means potentially exposing the site to potentially fatal security
risks.

-Stuart

--
http://stut.net/

attached mail follows:


>
> > but, I'm more concern does client has to pay the changes/upgrade or it's
> still "my obligation"?
>
> Of course you charge him. Christ if I was expected to maintain stuff
> gratis that I wrote 7 years ago I'd be mullahed.
>
> --
> Richard Heyes

I agree with Richard.

I bought a car 7 years ago. I decided to make some modifications to the
motor and now the car won't start!

Do you think the car company is going to give me a brand new car because I
messed it up? Nope, I'm going to have to buy a new car. :)

attached mail follows:


________________________________
From: Stuart <stuttlegmail.com>
To: lamp.listsyahoo.com
Cc: php-generallists.php.net
Sent: Wednesday, January 7, 2009 8:29:48 AM
Subject: Re: [PHP] redoing website after 7 years

2009/1/7 Lamp Lists <lamp.listsyahoo.com>:
> hi guys,
> I did php/mysql based website for one my client 7 years ago, in time when register_globals was on by default.
> hosting company upgraded server to php5/mysql5 and turned globals off. the site is doesn't work any more.
> I can define globals on again in .htaccess but rather not because it could be a big risk.

The first point to make is that the risk is no higher now than it has
been for the previous 7 years. Register_globals is not inherently
insecure, it's the way people code their scripts which makes it open
to abuse.

> to work again I have to spend a lot of hours to modify the code. boring job. but, I'm more concern does client has to pay the changes/upgrade or it's still "my obligation"?
> anybody had similar experience?

Personally I'd tell the client that the host has upgraded the server
software which has broken the site. It needs work and they need to pay
for it. If they object tell them you can work around the issue but it
means potentially exposing the site to potentially fatal security
risks.

-Stuart

--

thanks guys for your opinions. you gave me good points to talk to client
:-)

-ll

      

attached mail follows:


Richard Heyes wrote:
>> but, I'm more concern does client has to pay the changes/upgrade or it's still "my obligation"?
>
> Of course you charge him. Christ if I was expected to maintain stuff
> gratis that I wrote 7 years ago I'd be mullahed.
>

concurred, personally I'd be tempted to offer to find or indeed resetup
on an old server if they could find one for free, but as for upgrading
certainly quote/charge.

attached mail follows:


Richard Heyes wrote:
>> but, I'm more concern does client has to pay the changes/upgrade or it's still "my obligation"?
>
> Of course you charge him. Christ if I was expected to maintain stuff
> gratis that I wrote 7 years ago I'd be mullahed.
>

concurred, personally I'd be tempted to offer to find or indeed resetup
on an old server if they could find one for free, but as for upgrading
certainly quote/charge.

attached mail follows:


On Wed, 2009-01-07 at 06:07 -0800, Lamp Lists wrote:
> hi guys,
> I did php/mysql based website for one my client 7 years ago, in time when register_globals was on by default.
> hosting company upgraded server to php5/mysql5 and turned globals off. the site is doesn't work any more.
> I can define globals on again in .htaccess but rather not because it could be a big risk.
> to work again I have to spend a lot of hours to modify the code. boring job. but, I'm more concern does client has to pay the changes/upgrade or it's still "my obligation"?
> anybody had similar experience?

It's the client's responsibility to either pay you to upgrade or battle
out the upgrade issues with his ISP. If the client wants maintenance
then they need to pay for that.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

attached mail follows:


php is delivering error messages to STDERR when i call trigger_error() in
the script. i'm using the command:

php -c /usr/local/etc/php.ini -f script.php

and the config file has log_errors and error_log set correctly afaict (it
works for scripts run via apache).

is this to be expected (and hence i need to rewrite with error_log()) or is
the maybe some other explanation?

tom

attached mail follows:


As I recall, PHP CLI overrides the error_log setting and uses STDERR by design.

You'll have to re-direct it elsewhere in the shell.

Or a custom error_handler that uses a specific file name in error_log call.

Using error_log alone will not help.

attached mail follows:


and on occasion they even show up!

"Vicente" <sysvicgmail.com> wrote in message
news:127952710.20090105050920gmail.com...
>
>
> Eduardo don't worry it's the new year hangover. Really you are in a
> guru list :)
>
>
>> Vicente wrote:
>>>> <p><textarea rows="5" name="tastes" cols="28"></textarea></p>
>>>>
>>>
>>> eps, sorry.. Micah Gersten is right. You will need the echo among
>>> them.
>>>
>>> <textarea rows="5" name="tastes" cols="28"> <? echo $tastes;?>
>>> </textarea>
>>>
>>>
>>>
>
>> Yep, but you caught the quotes mix-up. :)
>
>
>

attached mail follows:


Hi there,

I need pars an xml file with php 4. There seems to be a good package out
there "active link xml". However, last development was 2004. Is there
something new around which you would recommend over active link?

Thank you for any hints.

Best regards,

Merlin

attached mail follows:


Merlin Morgenstern wrote:
> Hi there,
>
> I need pars an xml file with php 4. There seems to be a good package out
> there "active link xml". However, last development was 2004. Is there
> something new around which you would recommend over active link?
>
> Thank you for any hints.
>
> Best regards,
>
> Merlin
>

Give this a shot

http://www.cmsws.com/examples/xml/xml2php/xml2php2xml-2005-09-09.tar.gz

if you go to

http://www.cmsws.com/examples/xml/xml2php/example.php

you can see an example of the output

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

attached mail follows:


XML in PHP4? Don't. :-)

It was very painful and with all kinds of quirks, from my limited experience.

PHP5 was a breeze.

Consider hosting a quick/easy service on a PHP5 box to convert XML to PHP serialized data or something as well. Could be less painful.

Or just upgrade, since PHP4 has passed EOL.

attached mail follows:


^THANX: Will upgrade to php5.

ceol-i-e.com wrote:
> XML in PHP4? Don't. :-)
>
> It was very painful and with all kinds of quirks, from my limited experience.
>
> PHP5 was a breeze.
>
> Consider hosting a quick/easy service on a PHP5 box to convert XML to PHP serialized data or something as well. Could be less painful.
>
> Or just upgrade, since PHP4 has passed EOL.
>

attached mail follows:


Hi..

I have created a setup between my shared hoster and my home debian box,
where the shared hosting accepts video uploads, and forwards them to the
home server for video-conversion (which isn't allowed on shared hosting).

In order to kick off the import process, I need the shared hoster to
make a POST call through php native curl functions to my home server.

Up to a few weeks ago, this worked just fine.

But now, since i (had to) re-installed the debian box, when i call it
myself, the shared hoster returns a curl error "cannot connect to host".
Other people on the net still get the proper response if they call the
shared hoster script, the forward is performed, and they get to see what
my homeserver replied.

So in other words, i'm the only one who can't import video's / pictures
into my own CMS at the moment..
Free laughs for everyone ;)

But if you have any clues about why this could happen, i'd very much
like to hear them.

My debian is 4.0, upgraded and all.
Apache2 ofcourse.

If you want to see any config files or logs please tell me..

attached mail follows:


On Wed, Jan 7, 2009 at 11:21 AM, Rene Veerman <rene7705gmail.com> wrote:

> Hi..
>
> I have created a setup between my shared hoster and my home debian box,
> where the shared hosting accepts video uploads, and forwards them to the
> home server for video-conversion (which isn't allowed on shared hosting).
>
> In order to kick off the import process, I need the shared hoster to make a
> POST call through php native curl functions to my home server.
>
> Up to a few weeks ago, this worked just fine.
>
> But now, since i (had to) re-installed the debian box, when i call it
> myself, the shared hoster returns a curl error "cannot connect to host".
> Other people on the net still get the proper response if they call the
> shared hoster script, the forward is performed, and they get to see what my
> homeserver replied.
>
> So in other words, i'm the only one who can't import video's / pictures
> into my own CMS at the moment..
> Free laughs for everyone ;)
>
> But if you have any clues about why this could happen, i'd very much like
> to hear them.
>
> My debian is 4.0, upgraded and all.
> Apache2 ofcourse.
>
> If you want to see any config files or logs please tell me..

have you tried to ping or traceroute your box from the shared hosting server
since the os upgrade?

-nathan

attached mail follows:


>
> Thanks for the aswers, but there is still some problems.
>
> I tested this code(below) and it works but when I add it to the rest of my
> code it stops working.
>
> Here's the working code:
>
> page1:
>
> <?php
> $bandname = "Someband";
> ?>
> <form name="goto_info" action="band_info.php" method="post">
> <input type="hidden" name="bandname" value="<?php echo $bandname; ?>">
> <a href="band_info.php?bandname=$bandname" onclick="goto_info.submit();
> return false;"><?php echo $bandname; ?></a>
> </form>
>
> and page2:
>
> Bandname is <?php echo $_POST["bandname"]; ?>!
>
> _________________________________________________
>
> Now, here's the one I've been fighting with:
>
> <?
> include("XXXXXXX.inc.php");
> mysql_connect($host,$username,$password);
> mysql_select_db($database) or die( "Unable to select database");
> $query="SELECT * FROM band";
> $result=mysql_query($query);
>
> $num=mysql_numrows($result);
>
> mysql_close();
>
> echo "<b><center>Bands</center></b><br><br>";
>
> ?>
> <table border="0" cellspacing="2" cellpadding="2">
> <tr>
> <th><font face="Arial, Helvetica, sans-serif">bandname</font></th>
> </tr>
>
> <?
> $i=0;
> while ($i < $num) {
> $bandname=mysql_result($result,$i,"bandname");
> ?>
> <tr>
> <form name="goto_info" action="band_info.php" method="post">
> <input type="hidden" name="bandname" value="<?php echo $bandname; ?>">
> <a href="band_info.php?bandname=$bandname" onclick="goto_info.submit();
> return false;"><?php echo $bandname; ?></a>
> </form>
> </tr>
> <?
> ++$i;
> }
> echo "</table>";
> ?>
>
> For some reason this doesn't post bandname to band_info page...