php-windows Digest 26 Oct 2002 05:48:39 -0000 Issue 1407

Topics (messages 16558 through 16565):

writing pdf files...
        16558 by: Brian McGarvie
        16560 by: Brian McGarvie

Re: Problem with set_time_limit() and uploading large f iles
        16559 by: Michael Hazelden
        16561 by: derek fong

appending text to start of file
        16562 by: Richard West

text file parsing
        16563 by: Max Graham

undefined function: mime_content_type() ??
        16564 by: Bob Bruce

Re: spam protection boxes
        16565 by: Dash McElroy

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 ---
I presently generate pdf files as required...

I use FPDF for writing PDF...

I require to save these to file... is it a simple case of:

where the script: generate_stats_view_table_pdf.php generates the PDF...

<?
    $fcontents= file
('http://www.domain.com/autoreport/generate_stats_view_table_pdf.php');
    while (list ($line_num, $line) = each ($fcontents)) {
        $display .= $line;
    }

$fp=fopen("/usr/local/psa/home/vhosts/domain.com/httpdocs/admin/hourly/stats
_detailed.pdf","w");
    fputs($fp,$display);
    fclose($fp);
?>

TIA...


--- End Message ---
--- Begin Message ---
yes it does...

/me answered myself again ;)

"Brian McGarvie" <[EMAIL PROTECTED]> wrote in message
news:20021025145601.71683.qmail@;pb1.pair.com...
> I presently generate pdf files as required...
>
> I use FPDF for writing PDF...
>
> I require to save these to file... is it a simple case of:
>
> where the script: generate_stats_view_table_pdf.php generates the PDF...
>
> <?
>     $fcontents= file
> ('http://www.domain.com/autoreport/generate_stats_view_table_pdf.php');
>     while (list ($line_num, $line) = each ($fcontents)) {
>         $display .= $line;
>     }
>
>
$fp=fopen("/usr/local/psa/home/vhosts/domain.com/httpdocs/admin/hourly/stats
> _detailed.pdf","w");
>     fputs($fp,$display);
>     fclose($fp);
> ?>
>
> TIA...
>
>


--- End Message ---
--- Begin Message ---
What happens when you execute the site.php seperately?

Does it give you a better error as to where in the file the execution fails?

Michael.

-----Original Message-----
From: derek fong [mailto:php-win@;subtitled.com]
Sent: 25 October 2002 15:54
To: Michael Hazelden
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] Problem with set_time_limit() and uploading large
f iles


Hi Michael,

Unfortunately, that is not the case.  The site is using custom-built 
code and functions from the PEAR repository, and this is the only 
occurrence of a set_time_limit() function call.  :(  I don't think PEAR 
uses set_time_limit() anywhere either, but I'll do a grep for that and 
see what turns up...

-f


On Friday, October 25, 2002, at 03:43  am, Michael Hazelden wrote:

> Derek - I was battling with this very problem myself ... but in the 
> end - I
> discovered that in a module I'd downloaded - there was (buried under 
> 5000
> lines of code) another set_time_limit function. I removed that and my
> problem went away.
>
> Check over site.php - follow the code path exactly and I'm sure you'll 
> find
> one.
>
> Michael.
>
> -----Original Message-----
> From: derek fong [mailto:php-win@;subtitled.com]
> Sent: 25 October 2002 03:55
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Problem with set_time_limit() and uploading large
> files
>
>
> Hi,
>
> I am having a major problem getting set_time_limit() to work at all
> with PHP 4.2.3 running as a CGI program under IIS.  I have a script
> that accepts large files for upload, with the following lines at the
> top of the script:
>
> <?php
> // let this script take as long as it needs to complete its work
> // and ignore if user hits stops button in his browser
> set_time_limit(0);
> ignore_user_abort(true);
>
> // include site-wide configs and other include files
> require_once('../includes/site.php');
> ...
>
> If the file upload takes longer than 30 seconds, PHP bombs out with the
> following error:
>
> "Fatal error: Maximum execution time of 30 seconds exceeded in
> D:\InetPub\test.php on line 3"
>
> I've also tried adding:
>
> ini_set('max_execution_time', 60000);
>
> before the set_time_limit() function, but to no avail.  PHP is not
> running in safe mode.  Does anyone have any ideas why this is not
> working as expected?  I'm sure it's something obvious, but I don't know
> what it is.
>
> Thanks in advance,
>
> -f
>
>
> -- 
> Derek Fong
> Web Application Developer
> subtitle designs inc. <http://www.subtitled.com/>
>
> "Mistakes are the portals of discovery." --James Joyce
>>> GPG key/fingerprint available upon request <<
>
>
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> _____________________________________________________________________
> This message has been checked for all known viruses by the
> MessageLabs Virus Control Centre.
>
> This message has been checked for all known viruses by the MessageLabs 
> Virus Control Centre.
>
>       
> *********************************************************************
>
> Notice:  This email is confidential and may contain copyright material 
> of Ocado Limited (the "Company"). Opinions and views expressed in this 
> message may not necessarily reflect the opinions and views of the 
> Company.
> If you are not the intended recipient, please notify us immediately 
> and delete all copies of this message. Please note that it is your 
> responsibility to scan this message for viruses.
>
> Company reg. no. 3875000.  Swallowdale Lane, Hemel Hempstead HP2 7PY
>
> *********************************************************************
>
>


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


_____________________________________________________________________
This message has been checked for all known viruses by the 
MessageLabs Virus Control Centre.

This message has been checked for all known viruses by the MessageLabs Virus Control 
Centre.

        
*********************************************************************

Notice:  This email is confidential and may contain copyright material of Ocado 
Limited (the "Company"). Opinions and views expressed in this message may not 
necessarily reflect the opinions and views of the Company.
If you are not the intended recipient, please notify us immediately and delete all 
copies of this message. Please note that it is your responsibility to scan this 
message for viruses.

Company reg. no. 3875000.  Swallowdale Lane, Hemel Hempstead HP2 7PY

*********************************************************************
--- End Message ---
--- Begin Message --- The site.php file is just for configuration and initialization. Here's the file in its entirety, with excess comments removed for clarity:

<?php
/* $Id: site.php,v 1.7 2002/10/16 07:05:08 fong Exp $ */

// define full filesystem path to includes directory for IIS compatibility
// with virtual hosting setup
define('INCLUDES_PATH', '.;d:/inetpub/includes');

// define the PEAR DB DSN to the database
define('DB_DSN', 'odbc://name:pass@systemdsn');

// attempt to use persistent DB connections?
define('DB_PCONNECT', true);

// define name of session to use
define('SESSION_NAME', 'ac');

// define the number of search results each page will display
define('PAGE_SIZE', 25);


/**
* DO NOT MODIFY ANYTHING BELOW THIS LINE *
*
*/

// we must set the include path for Windows IIS servers
if (!ini_set('include_path', INCLUDES_PATH)) {
exit('Fatal error setting include path.');
}

// get frequently used functions and files
require_once('DB.php');
?>

I'm not sure this has anything to do with site.php since set_time_limit is being called before I include site.php and PHP indicates that the script is stopping at the set_time_limit line. Moving the set_time_limit function call to the very top of the file (i.e., above the comments) makes PHP stop even earlier in the execution process (line 1 instead of line 3), which sort of indicates to me that it's not one of those weird, unrelated errors that PHP can spit out from time to time. Everything I've read indicates that I'm doing the right thing, but there still seems to be some variable I'm missing here which is completely frustrating me. :-/

Oh yes, I forgot to mention originally that this is running on a Windows 2000 setup accessing a Microsoft SQL Server 2000 database, if that makes any difference.

-f


On Friday, October 25, 2002, at 11:41 am, Michael Hazelden wrote:

What happens when you execute the site.php seperately?

Does it give you a better error as to where in the file the execution fails?

Michael.

-----Original Message-----
From: derek fong [mailto:php-win@;subtitled.com]
Sent: 25 October 2002 15:54
To: Michael Hazelden
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] Problem with set_time_limit() and uploading large
f iles


Hi Michael,

Unfortunately, that is not the case. The site is using custom-built
code and functions from the PEAR repository, and this is the only
occurrence of a set_time_limit() function call. :( I don't think PEAR
uses set_time_limit() anywhere either, but I'll do a grep for that and
see what turns up...

-f


On Friday, October 25, 2002, at 03:43 am, Michael Hazelden wrote:

Derek - I was battling with this very problem myself ... but in the
end - I
discovered that in a module I'd downloaded - there was (buried under
5000
lines of code) another set_time_limit function. I removed that and my
problem went away.

Check over site.php - follow the code path exactly and I'm sure you'll
find
one.

Michael.

-----Original Message-----
From: derek fong [mailto:php-win@;subtitled.com]
Sent: 25 October 2002 03:55
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Problem with set_time_limit() and uploading large
files


Hi,

I am having a major problem getting set_time_limit() to work at all
with PHP 4.2.3 running as a CGI program under IIS. I have a script
that accepts large files for upload, with the following lines at the
top of the script:

<?php
// let this script take as long as it needs to complete its work
// and ignore if user hits stops button in his browser
set_time_limit(0);
ignore_user_abort(true);

// include site-wide configs and other include files
require_once('../includes/site.php');
...

If the file upload takes longer than 30 seconds, PHP bombs out with the
following error:

"Fatal error: Maximum execution time of 30 seconds exceeded in
D:\InetPub\test.php on line 3"

I've also tried adding:

ini_set('max_execution_time', 60000);

before the set_time_limit() function, but to no avail. PHP is not
running in safe mode. Does anyone have any ideas why this is not
working as expected? I'm sure it's something obvious, but I don't know
what it is.

Thanks in advance,

-f


--
Derek Fong
Web Application Developer
subtitle designs inc. <http://www.subtitled.com/>

"Mistakes are the portals of discovery." --James Joyce
GPG key/fingerprint available upon request <<

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


_____________________________________________________________________
This message has been checked for all known viruses by the
MessageLabs Virus Control Centre.

This message has been checked for all known viruses by the MessageLabs
Virus Control Centre.

	
*********************************************************************

Notice:  This email is confidential and may contain copyright material
of Ocado Limited (the "Company"). Opinions and views expressed in this
message may not necessarily reflect the opinions and views of the
Company.
If you are not the intended recipient, please notify us immediately
and delete all copies of this message. Please note that it is your
responsibility to scan this message for viruses.

Company reg. no. 3875000.  Swallowdale Lane, Hemel Hempstead HP2 7PY

*********************************************************************



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


_____________________________________________________________________
This message has been checked for all known viruses by the
MessageLabs Virus Control Centre.

This message has been checked for all known viruses by the MessageLabs Virus Control Centre.


*********************************************************************

Notice: This email is confidential and may contain copyright material of Ocado Limited (the "Company"). Opinions and views expressed in this message may not necessarily reflect the opinions and views of the Company.
If you are not the intended recipient, please notify us immediately and delete all copies of this message. Please note that it is your responsibility to scan this message for viruses.

Company reg. no. 3875000. Swallowdale Lane, Hemel Hempstead HP2 7PY

*********************************************************************

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--- End Message ---
--- Begin Message ---
Hey, was wondering if someone could help me out. I am trying to append a
string of text to the start of a file. I know you can easily append
information to the end of a file easily when you open the file by setting
the mode to "a". The only way I can think of doing this is by making a temp
copy of my original file and then add the string I want to append to the
start of the original file then append the temp file to the original file.
Does anyone know another way of making this work??


--- End Message ---
--- Begin Message ---
There are a couple of ways to do this, depending on what you're looking to
accomplish. One involves treating the contents of the text file as literal
text, not as HTML. This comes directly from the manual, under the
get_html_translation_table() function. Here's a quick copy & paste:

$trans = get_html_translation_table(HTML_ENTITIES);
$str = "Hallo & <Frau> & Krämer";
$encoded = strtr($str, $trans);

The $encoded variable will now contain: "Hallo &amp; &lt;Frau&gt; &amp;
Kr&auml;mer".

Another possibility is this: If you have your text files set up in a
specified format, you can make your code parse the tables and put them out
in a specific format. I use that option, simply because I find it easier to
use. A file structured like this:

------------------text file start------------------
-identity
Litany Against Fear|http://www.bbc.co.uk/dna/h2g2/A594489|Bene Gesserit
Litany Against Fear (From Frank Herbert's "Dune")|-
You In Lego|http://www.reasonablyclever.com/|Picture yourself made in
Lego!|-
You In South Park|http://southpark.gamesweb.com/flash/sp-studio.html|Picture
yourself in South Park|-
You As A Virtual Model|http://www.myvirtualmodel.com/|You as a virtual
model|-
*
-software
Mailwasher Email Filter|http://www.mailwasher.net/|Preview, delete, bounce
emails from your server before downloading them to your computer|-
EO Video|http://www.eo-video.com|All-in-one video player, converter|hot
*

..
..
..
..
and so on (no blank lines at the end of the file; one line per link
description)
------------------text file end------------------
is parsed by this routine of code:
------------------code start------------------
// initialize variables; not necessary but generally good coding practice
$linkcat = "";
$catcount = 0;
$ltf = 0;
$linkref = file("links.txt"); // load text file
$linkcount = count($linkref); // count links/lines
echo "  <table border=1 cellpadding=1 cellspacing=1>\n"; // start the table
for ($lrcount = 0; $lrcount < $linkcount; $lrcount++) { // go through all li
nks
  $lcomptobj = $linkref[$lrcount]; // set a comparison object
  if (substr_count($lcomptobj, "*") < 1) { // if the line isn't a "*" for a
category divider
    if (substr($linkref[$lrcount],0,1) == '-') { // if it's prefaced by a -,
for a category name
      $linkcat = trim(substr($linkref[$lrcount],1));
   $outstr = "  <tr><th colspan=2>".$linkcat."</th></tr>\n"; // display a
table header with category name
    } else {
   list($_hname, $_url, $_title, $_linkstat) = explode("|",
$linkref[$lrcount]); // separate the line at the | characters
      $outstr = "  <tr><td><a title=\"".$_hname."\" href=\"".$_url."\"
target=\"_blank\">".$_hname."</a></td>";
   $outstr .= "<td>".$_title.(($_linkstat == "hot") ? " (hot link)" :
"")."</td></tr>\n"; // format the table line with descriptions and URL
titles
    }
 if (($linktype == $linkcat)||($linktype == "all")) { echo $outstr; }//
display the line if the category matches or if all categories selected
  }
}
echo "  </table>\n\n";
------------------code end------------------

I made this code for my site because I wanted to display by categories and
let me choose only one category if I wanted to, by calling a URL like
"links.php?linktype=identity". It's not the best method, and not the most
efficient, but it's just the one I wanted to use. Sorry if the text in this
message seemed tough to read :P


> Message-ID: <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> From: "Bryan Luisana" <[EMAIL PROTECTED]>
> Date: Thu, 24 Oct 2002 19:38:44 -0400
> Subject: text file parsing
>
> Hello,
>
> I have only been working with php for about 2 hours now so bare with me if
I
> type something stupid.
>
> I am trying to open up a remote text file, parse the file, and output the
> parsed text as html.  As of now I can open the file read characters into a
> buffer and then output them as html.  My problem is with parsing the
buffer
> to get to the text I want to output.
>
> Should I read the entire file into an array?  Then output the parts of the
> array I want to show?  If so please post some type of example code.
>
> Does php have functions to move through a file and choose which characters
> you want to put into an array or a buffer?
>
> Any help would be greatly appreciated.
>
> Thanks for your time

--- End Message ---
--- Begin Message ---
Hi:

when I try implementing a tutorial program for learning how to store images
in a database and try to call the function mime_content_type I get the
following error message:

Fatal error: Call to undefined function: mime_content_type() in G:\Program
Files\Apache Group\Apache2\htdocs\BruceGang\insert.php on line 80

when I checked the PHP documentation I read that this function is only
available in the PHP 4 CVS. Being new to PHP, I don't know what this means.

I also read that "The behaviour of these functions is affected by settings
in php.ini"
Can someone help me to get this function working?

Ref: http://www.php.net/manual/en/ref.mime-magic.php

thanks,
            Bob Bruce
            Winnipeg, Manitoba



--- End Message ---
--- Begin Message ---
I actually just got back from the PHPCon convention in Milbrae (South San
Francisco), Ca. I honestly forget who suggested the idea, it may have been
Rasmus himself (my short term memory is shot), but the idea mentioned was
to have some random text pushed into a GD call to automatically generate
the image. Obviously then, if you supply the data to GD, you can verify
the input as well.

Voila!

-Dash

Weiler's Law:
        Nothing is impossible for the man who doesn't have to do it
himself.

On Thu, 24 Oct 2002, Blue Presley wrote:

> Yahoo and a couple other companies use boxes to help block spam.  before
> posting an ad on their classifieds, you see a box with  word in it.. it's a
> graphic.  and you have to type the letters or words from the box into a
> text box to proceed, and that ensures that a real person is at the
> keyboard.  anyone know how this can be accomplished in PHP?
>
> thx
>
> blue
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---

Reply via email to