php-general Digest 4 Oct 2002 05:56:45 -0000 Issue 1623

Topics (messages 118775 through 118808):

Is there a difference in this??
        118775 by: Roberto Ramírez

Re: no errors ?
        118776 by: gamin

Re: Is there a difference in this?
        118777 by: Leif K-Brooks

fopen()  limit
        118778 by: gamin

Installing PHP
        118779 by: Dan

Re: using fopen() to download remote files
        118780 by: Rusty Small
        118782 by: gamin
        118801 by: Rusty Small

Solution to MORE  Problems with PHP as CGI and Flash !!!!!!!!!!
        118781 by: Rebekah Garner

Include
        118783 by: Matias Silva
        118784 by: Philip Hallstrom

time of day
        118785 by: Bryan Koschmann - GKT
        118787 by: Kevin Stone
        118797 by: Michael Sims

Re: HYML Forms to Validate?
        118786 by: Stephen
        118792 by: Peter J. Schoenster

Mime Types
        118788 by: PHP List
        118789 by: Manuel Lemos

Thumbnail with GD
        118790 by: net php

Re: Calling Files from a different directory
        118791 by: John W. Holmes
        118793 by: Rick Beckman

Looking for feedback
        118794 by: Erich Kolb
        118800 by: Erich Kolb
        118804 by: Justin French
        118806 by: Erich Kolb

Re: PHP Generated web pages
        118795 by: Peter Goggin
        118796 by: John W. Holmes

Re: force download and file size issue
        118798 by: christian haines
        118802 by: Rasmus Lerdorf

Re: Glaring problem with libmcrypt!!!
        118799 by: Jeff Bluemel

recent encrpyt decrypt code... (problems)
        118803 by: Jeff Bluemel

No ouput until program end, why?
        118805 by: Jean-Christian Imbeault

--enable-trans-sid ?
        118807 by: try.neasys.com

Stuck at PHP4 installation( with Apache2 )
        118808 by: kramer

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 dont get the difference between this two instructions...


mail("[EMAIL PROTECTED]", "Subject", "Message") or die("It suck");


mail($mailto,$subject,$content) or die("It suck");



Im just getting a server error on the second instruction... I've checked the
vars with the is_string() function and all are strings... Ive used this mail
function many times... and it already worked in the script...but suddenly it
didnt work.

Im thinking about the smtp server, but i dont understand why the first
instruction is sent by the server and when i use the second, i get a server
error.
I dont get it!!!  why is that #"$%&% server error!!!

Note: I cant chage the second instruction's vars to simple text, because its
inside a for loop.


Using:
Apache/PHP 4.2.1 in Win2k

The SMTP is a Unix Service in another Server.

Any help would be appreciated...im gonna get bald if i stay like this...

Roberto Ramírez..

--- End Message ---
--- Begin Message ---
GOT IT,

   basically in a script like this
<?
kadsf;
kasdjfdsfj;garbage;
?>

php  treats these as contants, and issues a notice saying that undefined
constants are being used. The default setting for the php.ini file is :

error_reporting = E_ALL &~E_NOTICE

thus all notices are not displayed. setting error_reporting to E_ALL solves
this

thx everybody

gamin.


--- End Message ---
--- Begin Message ---
Try echoing those vars in the loop to see if their values are correct...
Roberto Ramírez wrote:

>I dont get the difference between this two instructions...
>
>
>mail("[EMAIL PROTECTED]", "Subject", "Message") or die("It suck");
>
>
>mail($mailto,$subject,$content) or die("It suck");
>
>
>
>Im just getting a server error on the second instruction... I've checked the
>vars with the is_string() function and all are strings... Ive used this mail
>function many times... and it already worked in the script...but suddenly it
>didnt work.
>
>Im thinking about the smtp server, but i dont understand why the first
>instruction is sent by the server and when i use the second, i get a server
>error.
>I dont get it!!!  why is that #"$%&% server error!!!
>
>Note: I cant chage the second instruction's vars to simple text, because its
>inside a for loop.
>
>
>Using:
>Apache/PHP 4.2.1 in Win2k
>
>The SMTP is a Unix Service in another Server.
>
>Any help would be appreciated...im gonna get bald if i stay like this...
>
>Roberto Ramírez..
>
>
>  
>


--- End Message ---
--- Begin Message ---
Hi,

  what sort of size limtis does fopen() have on a Linux based system ?



--- End Message ---
--- Begin Message ---
I am trying to create a message board. I setup a windows 2000 server and
installed IIS. In order to setup this messageboard i need to have PHP
installed. I downloaded the PHP installer and tried to run it but i get a
error message stating that there was a missing OCX component and it cant
configure the webserver. Does any know where i can get step by step
instructions in setting this up. The instructions that come from php.net are
too confusing.


THanks

Dan




--- End Message ---
--- Begin Message ---
Thanks for the help.  I made the assumption that all data from each page was
being downloaded but it is not.

I do have one other question.  I've used microtime() to test how long it
takes to download each page and have noticed that some pages may take as
long as 45 seconds to download!!!  I know that this lag is out of my control
as it is depends upon the status of the remote server.  However, I would
like to tell the script that if "x" amount of time has passed and the
fopen() function is not complete then stop and move on.  I've tried using
while and if...else statements using microtime() as the timeout limit but I
didn't have any success.  What kind of flow control mechanism should I use
for this??

RS
"Rusty Small" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have written a script in which the main purpose is to download html
pages
> from multiple web servers.  I'm using the fopen() function to download
these
> pages.  I would like to be able to download only the source (text) and no
> binary data as this would greatly improve the speed of my script.
>
> I've seen this on the client side with browsers being set to text only
mode.
> Is there a way to do this with php on the sever side to tell the remote
web
> server to not download the images associated a particular URL?  I'm
running
> Red Hat 7.3 and Apache web server.
>
> Any help would be greatly appreciated.
>
> Cliff
>
>


--- End Message ---
--- Begin Message ---

"Rusty Small" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Thanks for the help.  I made the assumption that all data from each page
was
> being downloaded but it is not.
>
> I do have one other question.  I've used microtime() to test how long it
> takes to download each page and have noticed that some pages may take as
> long as 45 seconds to download!!!  I know that this lag is out of my
control
> as it is depends upon the status of the remote server.  However, I would
> like to tell the script that if "x" amount of time has passed and the
> fopen() function is not complete then stop and move on.  I've tried using
> while and if...else statements using microtime() as the timeout limit but
I
> didn't have any success.  What kind of flow control mechanism should I use
> for this??
>
Hi,

  I have never done this give this is shot, try it it should work.

you can use passthru()/system() to call wget (you can specify the timeout in
wget) (wget will let u know the success or failure) and donwload the file in
a temporary folder. then you can use fopen to open the file.

HTH

gamin.


--- End Message ---
--- Begin Message ---
Thanks for the help Gamin.  I've been reading some posts and have noticed
that lots of people are having the same problem as I.  I'm using php 4.1.2
which came with redhat 7.3.  I think that there was a bug in 4.1.2 regarding
fopen() and unusually long delays with HTTP files.  I may try and compile
and install 4.2.3 and see if this resolves my problems.

Your suggestions may not be suited for what I need to do as I think that
writing to the disk would cause more overhead than I could live.  Although
it sounds very interesting.

Thanks,
Cliff
"Rusty Small" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have written a script in which the main purpose is to download html
pages
> from multiple web servers.  I'm using the fopen() function to download
these
> pages.  I would like to be able to download only the source (text) and no
> binary data as this would greatly improve the speed of my script.
>
> I've seen this on the client side with browsers being set to text only
mode.
> Is there a way to do this with php on the sever side to tell the remote
web
> server to not download the images associated a particular URL?  I'm
running
> Red Hat 7.3 and Apache web server.
>
> Any help would be greatly appreciated.
>
> Cliff
>
>


--- End Message ---
--- Begin Message ---
I wrote in a message:
> Here is the URL to a project that is far as I am concerned was finished.
> http://www.overbrookfarm.myiglou.com
> It is a Flash site that uses PHP for dynamically updating text in some
text
> fields. <snip>.  There should already be text inside of it.
> I see it.  <snip>My client can't see it <snip>
<snip>Any ideas?


Ready people? Here is the solution:
He was using the url of
http://overbrookfarm.myiglou.com

Take note of the missing "www".  Anyone familiar with Flash will see where
the problem is with that. Sorry to bother the list with a problem that in
the end really ended up not being a PHP problem persay.  But something to
remember if you ever come across in the future.

Rebekah Garner
"Remember kiddies: CONTRACTS! CONTRACTS! CONTRACTS!"









--- End Message ---
--- Begin Message ---
This might sound like a dumb question but I just need verification so that
I can convince myself that I'm going insane!

I have this error in which I include 3 files (common_html.inc,
common_db.inc, common_functions.inc)
well I have a clean() function in the common_functions.inc file. But it
seems that it is not getting called
and then my script crashes.  If I comment out the clean() function then it
works.  The clean() function
is just for added security.

Is there a maximum number of times you can include different files?

-Matias


--- End Message ---
--- Begin Message ---
To my knowledge you can include as many files as you want.

If by commenting out the clean() function, I'd say you have a syntax error
in that function and you're just not seeing the error message.  Turn on
full error reporting and see what happens.

-philip

On Thu, 3 Oct 2002, Matias Silva wrote:

> This might sound like a dumb question but I just need verification so that
> I can convince myself that I'm going insane!
>
> I have this error in which I include 3 files (common_html.inc,
> common_db.inc, common_functions.inc)
> well I have a clean() function in the common_functions.inc file. But it
> seems that it is not getting called
> and then my script crashes.  If I comment out the clean() function then it
> works.  The clean() function
> is just for added security.
>
> Is there a maximum number of times you can include different files?
>
> -Matias
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Hello,

I was wondering if anyone has a good example of a way to do this. Kinda
lame, but like if the time is between 8am and 12pm, say "good morning",
between 12pm and 6pm, say good afternoon, and so on.

I know this is probably pretty trivial, but I just wanted to see what
ideas where out there.

Thanks in advance!

        Bryan

--- End Message ---
--- Begin Message ---
PHP can give you the server time, but for this I think it would be better to
have the user's local time, in which case Javascript would provide a better
solution.
-Kevin

----- Original Message -----
From: "Bryan Koschmann - GKT" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Thursday, October 03, 2002 3:43 PM
Subject: [PHP] time of day


> Hello,
>
> I was wondering if anyone has a good example of a way to do this. Kinda
> lame, but like if the time is between 8am and 12pm, say "good morning",
> between 12pm and 6pm, say good afternoon, and so on.
>
> I know this is probably pretty trivial, but I just wanted to see what
> ideas where out there.
>
> Thanks in advance!
>
> Bryan
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
On Thu, 3 Oct 2002 14:43:37 -0700 (PDT), you wrote:

>Hello,
>
>I was wondering if anyone has a good example of a way to do this. Kinda
>lame, but like if the time is between 8am and 12pm, say "good morning",
>between 12pm and 6pm, say good afternoon, and so on.
>
>I know this is probably pretty trivial, but I just wanted to see what
>ideas where out there.

How about this:

function getgreetingtime() {

  $hour = date("G");
        
  switch(true) {
    case($hour < 12):
      $time = "morning";
      break;
    case($hour >= 12 && $hour < 18):
      $time = "afternoon";
      break;
    case($hour >= 18):
      $time = "evening";
      break;
  }
        
  return $time;

}
--- End Message ---
--- Begin Message ---
Thanks! But, are there any others? This doesn't really explain the whole
multiple page part...

----- Original Message -----
From: "Justin French" <[EMAIL PROTECTED]>
To: "Stephen" <[EMAIL PROTECTED]>; "PHP List"
<[EMAIL PROTECTED]>
Sent: Thursday, October 03, 2002 12:33 PM
Subject: Re: [PHP] HYML Forms to Validate?


> Check out Kevin Yank's article on webmasterbase.com/sitepoint.com
>
> Cheers,
>
> Justin
>
>
> on 04/10/02 3:27 AM, Stephen ([EMAIL PROTECTED]) wrote:
>
> > Hello,
> >
> > I've been reading tutorials lately on user authentication in PHP and
they all
> > are for the HTTP way of authentication. How can I use the same system
but with
> > forms instead of that ugly pop-up box?
> >
> > Thanks,
> > Stephen Craton
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On 3 Oct 2002 at 12:27, Stephen wrote:

> I've been reading tutorials lately on user authentication in PHP and
> they all are for the HTTP way of authentication. How can I use the same
> system but with forms instead of that ugly pop-up box?

Of course the best solution for this is mod_perl (for those who know 
some Perl) but you can cheat in PHP. The problem in PHP is that you 
cannot intercept the Apache request phases as you can with mod_perl. 
I've mentioned this in other posts and even have an example up on my 
site:

http://www.schoenster.com/login.php

I tell apache to use my handler for access/authentication. 

One way to do this in PHP is to have ONE index.php or whatever you set 
the index file to in a folder. It determines who is requesting what and 
then determines if this person is is authorized to access what they 
wanted. You'd have to put the actual *data* outside the document root 
otherwise they might just find it. Your index.php could grab the files 
(if html) and just print them back. I used the same system in Perl 
before learning of mod_perl. So far this is the only case where I can 
do something in mod_perl that I cannot do as eloquently in PHP but 
since I don't mind the pop up box that's not a big deal and since most 
of my apps go through just a few php handlers I do my own auth/access 
for every request and return my custom login page when needed.

Peter


--- End Message ---
--- Begin Message ---
Hi,
Is it possible to get a mime type of a file? 
I need to be able to attach files, but I won't always know the mime type of what is 
being attached.
I could look at the extension of the file for a general Idea, but I wouldn't know if a 
.jpg file is an image/jpg or image/jpeg.(progressive) and there seems to be a 
difference between the two. 

Thanks for any help.
Chris
--- End Message ---
--- Begin Message ---
Hello,

On 10/03/2002 07:41 PM, Php List wrote:
> Hi,
> Is it possible to get a mime type of a file? 
> I need to be able to attach files, but I won't always know the mime type of what is 
>being attached.
> I could look at the extension of the file for a general Idea, but I wouldn't know if 
>a .jpg file is an image/jpg or image/jpeg.(progressive) and there seems to be a 
>difference between the two. 

This class that can compose and send messages with attachments already 
guess the MIME type for you from the file name extension:

http://www.phpclasses.org/mimemessage

-- 

Regards,
Manuel Lemos

--- End Message ---
--- Begin Message ---
Hi, I am pretty lost..
I am trying to create a php thumbnail with php without using any *sql database.this 
script was supposed to open a directory then read it resize the images without losing 
quality and displays it on screen.

ok, here is what I am trying to do and its now working:


           <?
$dir = "imagestrips";
if($abre = opendir($dir)) {

 
     while($arq = readdir($abre))
       {        $filename = "imagestrips/" . $arq;
       if(is_file($filename)) 
         {
           $neww = 100;
           $newh = 100;
           header("Content-type: image/jpeg");
           $dst_img=imagecreate($neww, $newh);
           $src_img=imagecreatefromjpeg($filename);
           
imagecopyresized($dst_img,$src_img,0,0,0,0,$neww,$newh,imagesx($src_img),imagesy($src_img));
           imagejpeg($dst_img);
                   

         }
     }
           } 
           
           closedir($abre);
           ?>

THANKS!
net.
-- 
Get your free email from www.linuxmail.org 


Powered by Outblaze
--- End Message ---
--- Begin Message ---
> I have a page set up that loads the contents of a text file into an
HTML
> template using PHP. (i.e. something.com/page.php?include=1 where "1"
is a
> simple no-extension text file in the same directoy as page.php). Is
there
> a
> way to modify the PHP code in the template page to search for the
included
> page in another directory? Right now, the only way to do it is to have
the
> URL as "page.php?include=files/1".
> 
> Currently, here is the code I use to takes the $include URL variable
and
> makes the file accessible in the template:
> 
> $info = file($include);

Can I get the URL to your server, please, so I can pull up
page.php?include=/etc/passwd ?? Thanks, I would really appreciate that.

But seriously, I really hope you are validating what $include is. 

If you want the file to be included from a different directory, then you
have to pass some flag/variable to PHP to tell it where to look. If you
always want it to be in the same dir, then use

$info = file('files/' . $include);

---John Holmes...


--- End Message ---
--- Begin Message ---
Sarcasm aside, I do have the script set up (although I didn't note so in the
last response) to not accept files with '.' or '..' in the path. The URL can
accept directories within the one the PHP script is in, but not in a
different path or any directory above its own (i.e., the server files).

-- 
Kyrie Eleison,
Rick
www.spiritsword.com/phpBB2/


John W. Holmes wrote:
>> I have a page set up that loads the contents of a text file into an
>> HTML template using PHP. (i.e. something.com/page.php?include=1
>> where "1" is a simple no-extension text file in the same directoy as
>> page.php). Is there a
>> way to modify the PHP code in the template page to search for the
>> included page in another directory? Right now, the only way to do it
>> is to have the URL as "page.php?include=files/1".
>>
>> Currently, here is the code I use to takes the $include URL variable
>> and makes the file accessible in the template:
>>
>> $info = file($include);
>
> Can I get the URL to your server, please, so I can pull up
> page.php?include=/etc/passwd ?? Thanks, I would really appreciate
> that.
>
> But seriously, I really hope you are validating what $include is.
>
> If you want the file to be included from a different directory, then
> you have to pass some flag/variable to PHP to tell it where to look.
> If you always want it to be in the same dir, then use
>
> $info = file('files/' . $include);
>
> ---John Holmes...


--- End Message ---
--- Begin Message ---
I have setup a web-frontend to the PHP.net Usenet/Mailing List Groups. 
Could anyone take a look and give me some recommendations on enhancements?

--- End Message ---
--- Begin Message ---
Sorry for the ID10T, the address is: http://www.phpdiscuss.com

--- End Message ---
--- Begin Message ---
I'd really appreciate it if you masked email address with javascript or
something... or perhaps only showed email address' to logged in and
confirmed users... I already have my email address plastered all over the
marc archives... one more means twice as much spam :)

Justin


on 04/10/02 2:44 PM, Erich Kolb ([EMAIL PROTECTED]) wrote:

> Sorry for the ID10T, the address is: http://www.phpdiscuss.com
> 

--- End Message ---
--- Begin Message ---
Ok, I have removed the <a href="mailto:...></a> references.  It should
only show the actual name of the poster.  I am also currently working on a
login system.

Justin French wrote:

> I'd really appreciate it if you masked email address with javascript or
> something... or perhaps only showed email address' to logged in and
> confirmed users... I already have my email address plastered all over the
> marc archives... one more means twice as much spam :)

> Justin


> on 04/10/02 2:44 PM, Erich Kolb ([EMAIL PROTECTED]) wrote:

> > Sorry for the ID10T, the address is: http://www.phpdiscuss.com
> >


--- End Message ---
--- Begin Message ---
Can anyone refer me to the appropriat functions to be used for this?

Thanks in advance

Regards

Peter Goggin

----- Original Message -----
From: "1LT John W. Holmes" <[EMAIL PROTECTED]>
To: "Peter Goggin" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, October 04, 2002 12:17 AM
Subject: Re: [PHP] PHP Generated web pages


> > I want to transfer from a web page to a transient page to display a
> message
> > and carry out some database updates and then transfer back to the
original
> > page after a pause of 5 seconds.  Is this possible using php?
>
> Yes
>
> ---John Holmes....
>
>
http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-no-an
> swers.html
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
What have you tried so far?

Just make your PHP page that shows the message and does the updates...

Then use a META-REFRESH to redirect after 5 seconds...

---John Holmes...

> -----Original Message-----
> From: Peter Goggin [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, October 03, 2002 10:25 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] PHP Generated web pages
> 
> Can anyone refer me to the appropriat functions to be used for this?
> 
> Thanks in advance
> 
> Regards
> 
> Peter Goggin
> 
> ----- Original Message -----
> From: "1LT John W. Holmes" <[EMAIL PROTECTED]>
> To: "Peter Goggin" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
> Sent: Friday, October 04, 2002 12:17 AM
> Subject: Re: [PHP] PHP Generated web pages
> 
> 
> > > I want to transfer from a web page to a transient page to display
a
> > message
> > > and carry out some database updates and then transfer back to the
> original
> > > page after a pause of 5 seconds.  Is this possible using php?
> >
> > Yes
> >
> > ---John Holmes....
> >
> >
>
http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-n
o-
> an
> > swers.html
> >
> >
> > --
> > 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


--- End Message ---
--- Begin Message ---
thanks rasmus,

i have tried read file but it gave me the same issues as fpassthru.. both cap
on the memory_limit directive withint the php.ini file

any other suggestions maybe?

cheers
christian

Rasmus Lerdorf wrote:

> readfile()
>
> On Fri, 4 Oct 2002, christian haines wrote:
>
> > hi all,
> >
> > i have successfully created a download script to force a user to
> > download, however attempting to download large files causes an error
> > saying that the file cannot be found.
> >
> > my code >
> >   header("Cache-control: private");
> >   header("Content-Type: application/force-download; name=\"$file\"");
> >   header("Content-Disposition: attachment; filename=\"$file \"");
> >   header("Content-Transfer-Encoding: binary");
> >   header("Content-Length: $content_length");
> >   $fp = fopen($file_fullpath,"r");
> >   fpassthru($fp);
> >   fclose($fp);
> > < my code
> >
> > this is a memory issue in the php.ini i.e. memory_limit = 8M then the
> > largest file i can download is 8M
> >
> > is there anyway to "force" a download without having to use the system
> > hungry fpassthru function?
> >
> > this is driving me nuts so any help would be greatly appreciated
> >
> > cheers
> > christian
> >
> > ps i read the following at php.net fpassthru man page but could not make
> > sense of it (it appears to be some kind of solution) >
> >
> > "fpassthru() works best for small files. In download manager scripts,
> > it's best to determine the URL of the file to download (you may generate
> > it locally in your session data if you need so), and then use HTTP
> > __temporary__ redirects (302 status code, with a "Location:" header
> > specifying the effective download URL).
> > This saves your web server from maintaining PHP scripts running for long
> > times during the file downloadn and instead the download will be managed
> > directly by the web server without scripting support (consequence: less
> > memory resources used by parallel downloads)..."
> >

--- End Message ---
--- Begin Message ---
readfile() reads 8k blocks at a time and dumps them out.  It does not read
the entire thing into ram, so that wouldn't be what was causing you to hit
a memory limit.  You must have done something else wrong then.

-Rasmus

On Fri, 4 Oct 2002, christian haines wrote:

> thanks rasmus,
>
> i have tried read file but it gave me the same issues as fpassthru.. both cap
> on the memory_limit directive withint the php.ini file
>
> any other suggestions maybe?
>
> cheers
> christian
>
> Rasmus Lerdorf wrote:
>
> > readfile()
> >
> > On Fri, 4 Oct 2002, christian haines wrote:
> >
> > > hi all,
> > >
> > > i have successfully created a download script to force a user to
> > > download, however attempting to download large files causes an error
> > > saying that the file cannot be found.
> > >
> > > my code >
> > >   header("Cache-control: private");
> > >   header("Content-Type: application/force-download; name=\"$file\"");
> > >   header("Content-Disposition: attachment; filename=\"$file \"");
> > >   header("Content-Transfer-Encoding: binary");
> > >   header("Content-Length: $content_length");
> > >   $fp = fopen($file_fullpath,"r");
> > >   fpassthru($fp);
> > >   fclose($fp);
> > > < my code
> > >
> > > this is a memory issue in the php.ini i.e. memory_limit = 8M then the
> > > largest file i can download is 8M
> > >
> > > is there anyway to "force" a download without having to use the system
> > > hungry fpassthru function?
> > >
> > > this is driving me nuts so any help would be greatly appreciated
> > >
> > > cheers
> > > christian
> > >
> > > ps i read the following at php.net fpassthru man page but could not make
> > > sense of it (it appears to be some kind of solution) >
> > >
> > > "fpassthru() works best for small files. In download manager scripts,
> > > it's best to determine the URL of the file to download (you may generate
> > > it locally in your session data if you need so), and then use HTTP
> > > __temporary__ redirects (302 status code, with a "Location:" header
> > > specifying the effective download URL).
> > > This saves your web server from maintaining PHP scripts running for long
> > > times during the file downloadn and instead the download will be managed
> > > directly by the web server without scripting support (consequence: less
> > > memory resources used by parallel downloads)..."
> > >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
yea - I'm having the exact same problem - trying to use that nice little
piece of encrypt /decript stuff that was posted earlier


"Scott Fletcher" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi!  I ran through the phpinfo and here's the result.  That's explain why
> I'm unable to get most of the mcrypt functions to work.  Features like
> "mcrypt_module_open", "mcrypt_list_algorithms", "mcrypt_get_block_size",
> etc.  So, what's the problem here?  PHP bugs?  Please spill your gut out
on
> this one if you know of one.  Thansk!
>
> --clip--
>
> mcrypt
>
> ----------------------------------
> |  mcrypt support        |  enabled  |
> ----------------------------------
> |  Version                   |  2.4.x      |
> |  Supported Ciphers  |  none      |
> |  Supported Modes   |  none      |
> ----------------------------------
>
> ---------------------------------------------------------
> |  Directive                     |  Local Value  |  Master Value  |
> ---------------------------------------------------------
> |  mcrypt.algorithms_dir  |  no value       |  no value          |
> |  mcrypt.modes_dir       |  no value       |  no value          |
> ---------------------------------------------------------
>
> --clip--
>
>


--- End Message ---
--- Begin Message ---
I've seen a few other post on this, and it sounds like there is more then
one of use that is trying this script.  I've got it so that I can use the
commands, but I still get errors on the page...

here is what I have done.

I downloaded libmycrpt from
ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt and configured it with
the following options;

./configure \
 --with-included-algos="rijndael-128 arcfour stream cbc cfb"\
 --disable-posix-threads

I then reconfigured php with the --with-mcrpty option.  now when I try to
run the code I get the following errors;  (the php code I will repost inc
ase there are any questions)

 Usage
Warning: key size is 0 in /usr/local/apache/htdocs/test.phtml on line 15

Warning: mcrypt_generic_init: Key length incorrect in
/usr/local/apache/htdocs/test.phtml on line 15

Warning: mcrypt_generic(): 1 is not a valid MCrypt resource in
/usr/local/apache/htdocs/test.phtml on line 16

Warning: mcrypt_generic_deinit(): 1 is not a valid MCrypt resource in
/usr/local/apache/htdocs/test.phtml on line 17
encrypted =

Warning: key size is 0 in /usr/local/apache/htdocs/test.phtml on line 25

Warning: mcrypt_generic_init: Key length incorrect in
/usr/local/apache/htdocs/test.phtml on line 25

Warning: mdecrypt_generic(): 2 is not a valid MCrypt resource in
/usr/local/apache/htdocs/test.phtml on line 26

Warning: mcrypt_generic_deinit(): 2 is not a valid MCrypt resource in
/usr/local/apache/htdocs/test.phtml on line 29
decrypted =
Oops they don't match



<?PHP
class encrypt_decrypt
{
        var $secret;
        function encrypt_class(){
                $this->secret = 'this is a very long key, even too long for
the cipher';
        }
        Function encode($id){
                $eid = $iv = 0;
                $len = strlen($id);
                $id = $len.'-'.$id;
                $td = mcrypt_module_open(MCRYPT_TripleDES, "",
MCRYPT_MODE_ECB, "");
                $key = substr($this->secret, 0, mcrypt_enc_get_key_size
($td));
                $iv = pack("a".mcrypt_enc_get_iv_size($td),$iv);
                mcrypt_generic_init ($td, $key, $iv);
                $eid = base64_encode(mcrypt_generic ($td, $id));
                mcrypt_generic_deinit($td);
          return $eid;
        }
        Function decode($eid){
                $id = $iv = 0;
                $td = mcrypt_module_open (MCRYPT_TripleDES, "",
MCRYPT_MODE_ECB, "");
                $key = substr($this->secret, 0, mcrypt_enc_get_key_size
($td));
                $iv = pack("a".mcrypt_enc_get_iv_size($td),$iv);
                mcrypt_generic_init ($td, $key, $iv);
                $id = mdecrypt_generic ($td, base64_decode($eid));
                $len = strtok($id,'-');
                $id = substr($id,(strlen($len)+1),$len);
                mcrypt_generic_deinit($td);
                return $id;
        }
}
?>

Usage

<?
$word = 'Hello';
$e = new encrypt_decrypt();
$encrypted = $e->encode($word);
echo "encrypted = $encrypted <br>";
$decrypted = $e->decode($encrypted);
echo "decrypted = $decrypted <br>";
if($word == $decrypted){
        echo "They match <br>";
}
else{
        echo "Oops they don't match <br>";
}
?>


--
Jeff Bluemel


--- End Message ---
--- Begin Message ---
I am running a PHP program under Linux on the command line. The problem 
I have is that I get no output to the screen until the program finishes.

I have lots of echo statements throughout the program to help me debug 
but none of them are printed until the program finishes, which is really 
a pain since the prog takes 30 minutes to run ...

The main() looks something like this. Can someone help me figure out why 
it is not printing anything until the program exists?

pg_exec($CONN, "BEGIN");
for ($i = 0; $i < 6001; $i++) {
   $retval = process($aFields);
   if ( ($i % 100) == 0 ) echo "$i\n";
   if ($retval == 1) echo "error on line $i \n";
}

echo "COMMIT \n";
pg_exec($CONN, "COMMIT");

Thanks,

Jc

--- End Message ---
--- Begin Message ---
Hi,

I am trying to re-compile php 4.2.2. It seems that the option
"--enable-trans-sid" is no longer there (but still in the manual).
The reason for a re-compilation is that I was not able to have SID
printed out. Here is the code I tried, but SID is empty:
<?php
session_start();
echo SID;
?>

However, session_id() does tells the current sid.

Anyone knows why. I am using linux (glibc=2.2.5 and kernel=2.4.18).

Thanks,

-T
--- End Message ---
--- Begin Message ---
hi,

I've Apache 2 running fine in my Windows 2000 machine. I installed PHP
4.2.3( from the zip-file method ).
I copied php4apache.dll and php4apache2.dll to /WINNT/system32 and /WINNT as
well( to be safe ).

In my httpd.conf, either of the following startments are causing the Apache
to not start...
LoadModule php4_module F:/Progra~1/php-4.2.3-Win32/sapi/php4apache2.dll
LoadModule php4_module "D:/WINNT/system32/php4apache2.dll"

I tried to give "F:/Program Files/php-4.2.3-Win32/sapi/php4apache2.dll" and
all possible combinations of quotes, spaces, names, but it doesn't start if
I include any of those combinations. Otherwise it works !

Besides the above mentioned problematic line, these are the other entries(
in diff. lines ofcourse ) I've in my httpd.conf...
-> DirectoryIndex index.html index.html.var index.htm index.shtml index.php
index.php3 index.php4
-> ScriptAlias /php/ "F:/Program Files/php-4.2.3-Win32/"
-> AddType application/x-httpd-php .php .php3 .php4 .phtml
-> AddType application/x-httpd-php-source .phps
-> Action application/x-httpd-php "F:/Program Files/php-4.2.3-Win32/php.exe"

I'm new PHP & Apache2. Can someone help me to make this work. Thanks a lot.

kramer.


--- End Message ---

Reply via email to