php-general Digest 10 Mar 2006 12:11:19 -0000 Issue 4008
Topics (messages 231738 through 231759):
Re: What is the effect of --enable-memory-limit
231738 by: Chris
Re: Building php-pcre extension on windows
231739 by: Chris
Re: Understanding system multiple steps
231740 by: Chris
Re: Extending a class with a static constructur (like PEAR::DB)
231741 by: Chris
231742 by: weston.leary.csoft.net
231743 by: Chris
231744 by: weston.leary.csoft.net
231752 by: Andreas Korthaus
231753 by: Andreas Korthaus
large file transfers
231745 by: Christopher Taylor
231746 by: Chris
231747 by: Shaunak Kashyap
Re: Random permission strangeness
231748 by: Paul Scott
231749 by: Chris
231750 by: Paul Scott
Re: highlight_string()
231751 by: Weber Sites LTD
231757 by: Chris
231758 by: Robin Vickery
displaying documents stored under web root
231754 by: Adrian Bruce
231756 by: Kevin Davies - Bonhurst Consulting
Re: Editing an existing pdf?
231755 by: Meron
DB calls vs Session solution
231759 by: Thomas
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 ---
Khai wrote:
If I compile php with --enable-memory-limit and set a memory limit in
php.ini, what will this do ?
http://www.php.net/manual/en/ini.core.php#ini.memory-limit
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
Manish Marathe wrote:
On 3/7/06, Manish Marathe <[EMAIL PROTECTED]> wrote:
PHP experts everywhere!!
I am building PHP 5.1.2 on windows without pcre-regex extension. I am
building building pcre independently and then I am building the extension
php_pcre.dll.
I build few other extensions too. I keep the extensions in
c:\php\extensions which is set in php.ini.
I am getting an error that php_pcre.dll extension is invalid or corrupt
whenever php call is being invoked.
I believe I am not building php_pcre.dll extension properly, although any
insights as to what could be the problem. Also is OK to build php
--without-pcre-regex extension at all?
If you don't want the perl-regular expressions, then don't build it.
If you do want them, then the installs list may be able to help you.
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
Mark Steudel wrote:
So I am using system() to try and access sftp from my php scripts. How do I
do multiple steps once I've initiated my command
e.g.
$file = 'filname.txt';
system( "C:\sftp\sftp.exe <login flags> | put ".$file );
Im on a windows box, so I don't know if I can do something like this ...
anyway any help would be ppreciated
THanks
Can you run that command from command line? System isn't designed for
interactive steps.
If you can't run a particular command from command line then you can't
run it with system.
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
So... I'm trying to extend PEAR::DB. It'd be great to keep everything it offers and just add a few more perhaps unconventional functions.
Intuitively, it seemed like this approach might work:
<?PHP
require_once("DB.php");
# Toy Extension of DB Class
class DBToyExt extends DB
{
var $foo = 1;
var $bar = 2;
function testext($x)
{
echo "\nHEY: $x";
}
}
$dte = DBToyExt::connect("mysql://weston_tssa:[EMAIL
PROTECTED]/weston_tssa");
$dte->testext('testing');
$dte->testext($dte->moo);
$dte->testext($dte->bar);
?>
However, it doesn't seem to understand that the method "testext" exists, and
gives me a fatal error to that effect, as you can see:
$dte will only have the return value of DBToyExt::connect() - it won't
allow you to access other methods in the class.
You'll need to:
$dbtoy = new DBToyExt();
$dbtoy->connect(....)
$dbtoy->testext('testing');
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
Weston wrote:
> > $dte = DBToyExt::connect("mysql://weston_tssa:[EMAIL
> > PROTECTED]/weston_tssa");
> >
> > $dte->testext('testing');
> > $dte->testext($dte->moo);
> > $dte->testext($dte->bar);
On Fri, Mar 10, 2006 at 10:43:02AM +1100, Chris wrote:
> $dte will only have the return value of DBToyExt::connect() - it won't
> allow you to access other methods in the class.
>
> You'll need to:
>
> $dbtoy = new DBToyExt();
> $dbtoy->connect(....)
> $dbtoy->testext('testing');
Thanks! Works like a charm:
http://weston.canncentral.org/web_lab/mlib/DBToyExt2.php
That's interesting. I think I just sortof expected that since the canonical
invocation is through a statically called method, calling it by dereferencing
a specific object wouldn't work.
Does anyone know if that would also work in PHP 5?
If not, is there another way to do what I'm trying to do?
Thanks,
Weston
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
Weston wrote:
$dte = DBToyExt::connect("mysql://weston_tssa:[EMAIL PROTECTED]/weston_tssa");
$dte->testext('testing');
$dte->testext($dte->moo);
$dte->testext($dte->bar);
>>>
$dte will only have the return value of DBToyExt::connect() - it won't
allow you to access other methods in the class.
You'll need to:
$dbtoy = new DBToyExt();
$dbtoy->connect(....)
$dbtoy->testext('testing');
Thanks! Works like a charm:
http://weston.canncentral.org/web_lab/mlib/DBToyExt2.php
That's interesting. I think I just sortof expected that since the canonical
invocation is through a statically called method, calling it by dereferencing
a specific object wouldn't work.
In your example, $dte holds whatever DBToyExt::connect returns (whether
that's a connection resource, a boolean, a string - doesn't matter).
It's the same as:
function connect() {
return true;
}
$x = connect();
$x will only hold what 'connect' returns.
If you do:
var_dump($dte);
It won't be an object, so you can't use that to reference other methods
in that (or the parent) class(es).
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
> > So... I'm trying to extend PEAR::DB. It'd be great to keep everything it
> > offers and just add a few more perhaps unconventional functions.
> >
> > $dte = DBToyExt::connect("mysql://weston_tssa:[EMAIL
> > PROTECTED]/weston_tssa");
> >
>
> DB::connect() is actually a factory call. So what is returned is an
> instance of (in your case) a DB_mysql object.
Ahhh! I'd kept thinking what connect() returned was a db object, but it does
look like
it returns varying objects depending on which database you're using.
Maybe I'd want to extend DB_common instead of DB_mysql, so that the methods
would
be inhereted by any object?
Thanks,
Weston
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
Ahhh! I'd kept thinking what connect() returned was a db object, but it does
look like
it returns varying objects depending on which database you're using.
correct
Maybe I'd want to extend DB_common instead of DB_mysql, so that the methods
would
be inhereted by any object?
But DB_mysql will not inherit from your object! Look at the source:
class DB_mysql extends DB_common {...}
If you inherit from a class, the parent class will not inherit your (the
child classes) methods. If a class should inherit from your object, it
must explicitly inherit from that class.
Best regards
Andreas
--- End Message ---
--- Begin Message ---
Chris wrote:
You'll need to:
$dbtoy = new DBToyExt();
$dbtoy->connect(....)
$dbtoy->testext('testing');
But you cannot do:
$dbtoy = new DBToyExt();
$dbtoy->connect(....)
$dbtoy->testext('testing');
$result = $dbtoy->query('SELECT...');
//[...]
You have to do something like this:
$dbtoy = new DBToyExt();
$db = $dbtoy->connect(....)
$dbtoy->testext('testing');
$result = $db->query('SELECT...');
//[...]
If you want to avoid that, you have to write a wrapper around DB.
best regards
Andreas
--- End Message ---
--- Begin Message ---
Has anyone seen a script or class that can handle file uploads of large
files (greater than 20 meg)? Any direction as to where to look would be
appreciated.
Chris
--- End Message ---
--- Begin Message ---
Christopher Taylor wrote:
Has anyone seen a script or class that can handle file uploads of large
files (greater than 20 meg)? Any direction as to where to look would be
appreciated.
PHP can handle it, whether your server will time out with large files
like that I don't know.
Look at http://www.php.net/manual/en/features.file-upload.php for what
you'll need to change to enable uploads of this size.
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
Try: http://www.heylove.de/
It walks you through creating your own file upload class and in the end
gives an example of how to use that class.
Shaunak Kashyap
Senior Web Developer
WPT Enterprises, Inc.
5700 Wilshire Blvd., Suite 350
Los Angeles, CA 90036
Direct: 323.330.9870
Main: 323.330.9900
www.worldpokertour.com
Confidentiality Notice: This e-mail transmission (and/or the
attachments accompanying) it may contain confidential information
belonging to the sender which is protected. The information is intended
only for the use of the intended recipient. If you are not the intended
recipient, you are hereby notified that any disclosure, copying,
distribution or taking of any action in reliance on the contents of this
information is prohibited. If you have received this transmission in
error, please notify the sender by reply e-mail and destroy all copies
of this transmission.
> -----Original Message-----
> From: Christopher Taylor [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 09, 2006 4:29 PM
> To: [email protected]
> Subject: [PHP] large file transfers
>
> Has anyone seen a script or class that can handle file uploads of
large
> files (greater than 20 meg)? Any direction as to where to look would
be
> appreciated.
>
> Chris
--- End Message ---
--- Begin Message ---
On Fri, 2006-03-10 at 10:26 +1100, Chris wrote:
> If you leave your browser open for 20 mins or something and then try to
> log in, does that replicate it?
>
Ah hah! The plot thickens!
It seems that I can:
1. Launch the app - thereby starting the initial session
2. Leave the session to time out
3. Log in - adding username and permissions to the *non-existant
session*!
4. Log out and voila! error.
So it seems that the session is timing out somewhere along the line, and
when it is going to be re-established, it can't because a fragment(?) of
it still kinda exists - in comes the error regarding cleanup of files.
--Paul
--- End Message ---
--- Begin Message ---
Paul Scott wrote:
On Fri, 2006-03-10 at 10:26 +1100, Chris wrote:
If you leave your browser open for 20 mins or something and then try to
log in, does that replicate it?
Ah hah! The plot thickens!
It seems that I can:
1. Launch the app - thereby starting the initial session
2. Leave the session to time out
3. Log in - adding username and permissions to the *non-existant
session*!
4. Log out and voila! error.
So it seems that the session is timing out somewhere along the line, and
when it is going to be re-established, it can't because a fragment(?) of
it still kinda exists - in comes the error regarding cleanup of files.
If you can produce a small test case might be time for a bug report. It
shouldn't give you "permission denied" errors.
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
On Fri, 2006-03-10 at 16:00 +1100, Chris wrote:
> If you can produce a small test case might be time for a bug report. It
> shouldn't give you "permission denied" errors.
>
Will work on it over the weekend. I am going to try something dead
simple with the session stuff and see what I can do with it. If that
also fails, will do the bug report, but I want to be dead sure before I
start causing trouble for other people!
Thanks for your help!
--Paul
--- End Message ---
--- Begin Message ---
Hi
I'm trying to go with your idea but I'm having difficulties with
preg_match_all.
I want the text between <?php and ?>. The use of preg_match_all bellow only
Returns text that is in a single line. If the <php is on one line and the ?>
is
A few lines bellow, it does not match.
preg_match_all('/<\?php(.*?)\?>/i',$text,$CodeArray,PREG_PATTERN_ORDER);
Thanks.
-----Original Message-----
From: Chris [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 07, 2006 3:08 AM
To: Weber Sites LTD
Cc: [email protected]
Subject: Re: [PHP] highlight_string()
Weber Sites LTD wrote:
> I was afraid of that...
> I need to do HTML manipulations on the text that is outside the <??>.
> After I run highlight_string the original text is messed up.
> If I run the manipulations before then they will look like HTML And
> not act as HTML...
>
> Any ideas?
You could get the php from your page, highlight it and replace it back in:
preg_replace('%<?(.*)?>%s', 'highlight_string(${1})', $content);
don't know if that will work straight out for you but that should give you
an idea on how to proceed.
Or you could temporarily remove them, do whatever then replace it back in:
$placeholders = array();
while(preg_match('%<?(.*)?>%s', $content, $matches)) {
$size = sizeof($placeholders);
$placeholders[$size] = $matches[1];
$content = str_replace($matches[0], '%%PLACEHOLDER['.$size.']%%',
$content);
}
... other processing here.
foreach($placeholders as $i => $text) {
$content = str_replace('%%PLACEHOLDER['.$i.']%%',
highlight_string($text), $content);
}
> -----Original Message-----
> From: chris smith [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 06, 2006 11:59 AM
> To: Weber Sites LTD
> Cc: [email protected]
> Subject: Re: [PHP] highlight_string()
>
> On 3/6/06, Weber Sites LTD <[EMAIL PROTECTED]> wrote:
>
>>The only way I could work around this was to put empty <??> at the
>>Beginning of the text and now highlight_string() highlights only what
>>Is inside <? ?>
>>
>>You can see an example of the problematic text in the example Area of
>>this page : http://www.weberdev.com/get_example-4345.html
>>
>>Notice the empty <? ?> at the beginning of the example.
>>Without them, all of the example, including the text and HTML Part
>>will be painted by highlight_string().
>>
>>Is this a bug?
>
>
> No. It will highlight html as well.
>
> You can give the illusion of it not highlighting the html by using:
>
> ini_set('highlight.html', '#000000');
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
>
>
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
On 3/10/06, Weber Sites LTD <[EMAIL PROTECTED]> wrote:
> Hi
>
> I'm trying to go with your idea but I'm having difficulties with
> preg_match_all.
> I want the text between <?php and ?>. The use of preg_match_all bellow only
> Returns text that is in a single line. If the <php is on one line and the ?>
> is
> A few lines bellow, it does not match.
>
> preg_match_all('/<\?php(.*?)\?>/i',$text,$CodeArray,PREG_PATTERN_ORDER);
Try /is
it will treat the string as one huge line.
> -----Original Message-----
> From: Chris [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 07, 2006 3:08 AM
> To: Weber Sites LTD
> Cc: [email protected]
> Subject: Re: [PHP] highlight_string()
>
> Weber Sites LTD wrote:
> > I was afraid of that...
> > I need to do HTML manipulations on the text that is outside the <??>.
> > After I run highlight_string the original text is messed up.
> > If I run the manipulations before then they will look like HTML And
> > not act as HTML...
> >
> > Any ideas?
>
> You could get the php from your page, highlight it and replace it back in:
>
> preg_replace('%<?(.*)?>%s', 'highlight_string(${1})', $content);
>
> don't know if that will work straight out for you but that should give you
> an idea on how to proceed.
>
>
> Or you could temporarily remove them, do whatever then replace it back in:
>
> $placeholders = array();
> while(preg_match('%<?(.*)?>%s', $content, $matches)) {
> $size = sizeof($placeholders);
> $placeholders[$size] = $matches[1];
> $content = str_replace($matches[0], '%%PLACEHOLDER['.$size.']%%',
> $content);
> }
>
> ... other processing here.
>
> foreach($placeholders as $i => $text) {
> $content = str_replace('%%PLACEHOLDER['.$i.']%%',
> highlight_string($text), $content);
> }
>
>
> > -----Original Message-----
> > From: chris smith [mailto:[EMAIL PROTECTED]
> > Sent: Monday, March 06, 2006 11:59 AM
> > To: Weber Sites LTD
> > Cc: [email protected]
> > Subject: Re: [PHP] highlight_string()
> >
> > On 3/6/06, Weber Sites LTD <[EMAIL PROTECTED]> wrote:
> >
> >>The only way I could work around this was to put empty <??> at the
> >>Beginning of the text and now highlight_string() highlights only what
> >>Is inside <? ?>
> >>
> >>You can see an example of the problematic text in the example Area of
> >>this page : http://www.weberdev.com/get_example-4345.html
> >>
> >>Notice the empty <? ?> at the beginning of the example.
> >>Without them, all of the example, including the text and HTML Part
> >>will be painted by highlight_string().
> >>
> >>Is this a bug?
> >
> >
> > No. It will highlight html as well.
> >
> > You can give the illusion of it not highlighting the html by using:
> >
> > ini_set('highlight.html', '#000000');
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
On 10/03/06, Weber Sites LTD <[EMAIL PROTECTED]> wrote:
> Hi
>
> I'm trying to go with your idea but I'm having difficulties with
> preg_match_all.
> I want the text between <?php and ?>. The use of preg_match_all bellow only
> Returns text that is in a single line. If the <php is on one line and the ?>
> is
> A few lines bellow, it does not match.
>
> preg_match_all('/<\?php(.*?)\?>/i',$text,$CodeArray,PREG_PATTERN_ORDER);
>
By default a '.' matches any character except for a newline. If you
want it to match *everything* you have to use the 's' pattern modifier
- just stick an 's' on the very end of your pattern, after the 'i'.
/<\?php(.*?)\?>/is
-robin
--- End Message ---
--- Begin Message ---
Hi
After some advice (surprise!)
I currently store restricted documents beneath the web root so they are
not accessible via the URL, when a valid user wishes to view a document
i copy it to a temporary folder above the root and load it in a new
page. the only way i can then manage to delete the copy is
automatically deleting all temp files when any user goes to the log out
page.
This is obviously not a very good way of doing this but unless i can
establish when a user is no longer viewing the doc then i dont know when
to delete it. I was wandering how others deal with these problems like this
any advice appreciated greatly
Ade
--- End Message ---
--- Begin Message ---
Hi Adrian,
I had the same dilemma on a project I was working on, and came across this:
http://www.vibralogix.com/linklokurl/index.php
It basically adds an authentication code, which can lock the download to an
IP address and also you can limit the life of the URL to a length of time.
You can also store all the documents below the web root.
It's not free, but for $30 dollars it was well worth the investment and
saved me plenty of time!
HTH,
Kev
-----Original Message-----
From: Adrian Bruce [mailto:[EMAIL PROTECTED]
Sent: 10 March 2006 11:02
To: [email protected]
Subject: [PHP] displaying documents stored under web root
Hi
After some advice (surprise!)
I currently store restricted documents beneath the web root so they are
not accessible via the URL, when a valid user wishes to view a document
i copy it to a temporary folder above the root and load it in a new
page. the only way i can then manage to delete the copy is
automatically deleting all temp files when any user goes to the log out
page.
This is obviously not a very good way of doing this but unless i can
establish when a user is no longer viewing the doc then i dont know when
to delete it. I was wandering how others deal with these problems like this
any advice appreciated greatly
Ade
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I wanted to add texts from an html form to existing pdf.
I was able to create a pdf but not to edit it.
Please give me guidance how to.
--
View this message in context:
http://www.nabble.com/Editing-an-existing-pdf--t1202479.html#a3337105
Sent from the PHP - General forum at Nabble.com.
--- End Message ---
--- Begin Message ---
Hi there,
Quick question on performance:
I have got some expensive sql queries (doing lots of LEFT JOINS) that result
in anything between 10 to 10000 results. I need to do paging on those. So
far I have used a LIMIT solution which will not do anymore because you don't
get the whole total.
Now, the idea is to store the results (or the sql query string?) in the
session to avoid too many db calls (on paging).
The question now is: is the serializing/unserializing more expensive than
another db call?
Thanks,
T
SPIRAL EYE STUDIOS
P.O. Box 37907, Faerie Glen, 0043
Tel: +27 12 362 3486
Fax: +27 12 362 3493
Mobile: +27 82 442 9228
Email: [EMAIL PROTECTED]
Web: www.spiraleye.co.za
--- End Message ---