php-general Digest 22 Apr 2001 21:49:08 -0000 Issue 643

Topics (messages 49734 through 49765):

Re: Incrementing dates
        49734 by: PHPBeginner.com
        49738 by: Martin Skjöldebrand
        49742 by: PHPBeginner.com
        49747 by: Warren Vail

Re: UUdecode
        49735 by: Henrik Hansen

passing variables
        49736 by: Adam
        49737 by: PHPBeginner.com

Remove duplicates, as long as you have it.
        49739 by: Richard
        49740 by: Taylor, Stewart
        49749 by: Richard
        49750 by: Jack Dempsey

writing to file on server
        49741 by: Joeri Vankelst
        49743 by: chris herring
        49748 by: Plutarck
        49760 by: Joeri Vankelst

Re: Connecting to a MS Access database
        49744 by: John Lim

Re: Buttons and such...
        49745 by: Geir Eivind Mork
        49746 by: Plutarck

Getting a binary file from URL
        49751 by: Jaime Torres
        49752 by: Jaime Torres
        49754 by: Sigitas Paulavicius

weird mail() behaviour
        49753 by: Christian Dechery

strtok not working...
        49755 by: Christian Dechery

Apache, PHP, Windows XP, MSIE 6, Cheese, and Cookies.
        49756 by: Padraic Tynan
        49763 by: Steve Lawson

Link Color Questions
        49757 by: Mark Lo
        49762 by: Jeff Oien

Re: I'm a moron. So?
        49758 by: Geir Eivind Mork

imap ssl on port 993
        49759 by: Drew Adams

CGI x DSO: Output Buffering
        49761 by: Christian Dechery

Re: problem with storing & displaying image in db
        49764 by: Steve Lawson

Re: Linux Suggestion
        49765 by: Padraic Tynan

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]


----------------------------------------------------------------------


you can then do this:

INSERT INTO table SELECT date+INTERVAL 10 DAYS AS date FROM table WHERE
bla=bla;

it is just a way to do it. you will definitely have to play with it.

However you can easily make two queries to read the previous date combining
it with INTERVAL and then do an insert.


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-----Original Message-----
From: Martin Skjoldebrand [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 22, 2001 5:59 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Incrementing dates


PHPBeginner.com wrote:

> I am not sure on how your possibilities are,
> but doing this in PHP means literally "adding useless lines and loops"
>
> If possible, do it with SQL queries. Read the documentations on date
> datatypes, this is so much easier... almost magic.
>

AND

> You can (mySQL, right?) do the following:

>UPDATE table SET date=(date+INTERVAL 10 DAYS);

>so if date there was 04-28, it will be added 10 more days and so will
>become
>05-08

>Use SQL for this things, it treats dates as 'dates' while PHP treats them
>as
>integers and strings.

Sounds even easier. But what if I'm not doing an UPDATE but an INSERT? Can
it read the previous date? I am inserting a batch of bookings at one time.

Martin S.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






PHPBeginner.com wrote:

> 
> INSERT INTO table SELECT date+INTERVAL 10 DAYS AS date FROM table WHERE
> bla=bla;
> 
> it is just a way to do it. you will definitely have to play with it.
> 
> However you can easily make two queries to read the previous date
> combining it with INTERVAL and then do an insert.

I've looked at INTERVAL but it seems it only deals with one specific date 
at a time?

date=10 : SELECT date+INTERVAL 10 
would then mean date=20

Or have I got everything wrong?

What I looking at
from the value of date=10 ADD other dates for X days on, like this
(in a table, each record (row) has more data than the one given)
date=2001-04-10
date=2001-04-11
date=2001-04-12

This, if I'm mistaken can't be done with interval, at least not without 
looping in PHP? And using two queries would not perhaps save as much code 
as the way I solved it? Could be mistaken of course.

Martin S.




well, then you have to do it with PHP, as I said - if possible, then mySQL
does it better.

Try converting each date into UNIX timestamp adding to it 60*60*24*10 . It
will create you a set of dates incremented by 10 days.


What I previously meant was :

say you design a poll, you have a table called logs.
you want to see if the specific user have already voted within the last 10
days.

SELECT date FROM logs WHERE user='$user' AND date>=(NOW() - INTERVAL 10
DAY));

this will return you at least one row (hopefully one only) if there's such a
user voted less then 10 days ago, and will return you an empty set if
there's none.

Many use PHP to do that kind of checks while mySQL has it built in.

Since I am not sure I understood your situation right, I think you should
consider some mySQL (or any other DB) date functions. They often save you a
lot of code. Otherwise try to do it with PHP as you have already resolved
it.


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-----Original Message-----
From: Martin Skjoldebrand [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 22, 2001 8:13 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Incrementing dates


PHPBeginner.com wrote:

>
> INSERT INTO table SELECT date+INTERVAL 10 DAYS AS date FROM table WHERE
> bla=bla;
>
> it is just a way to do it. you will definitely have to play with it.
>
> However you can easily make two queries to read the previous date
> combining it with INTERVAL and then do an insert.

I've looked at INTERVAL but it seems it only deals with one specific date
at a time?

date=10 : SELECT date+INTERVAL 10
would then mean date=20

Or have I got everything wrong?

What I looking at
from the value of date=10 ADD other dates for X days on, like this
(in a table, each record (row) has more data than the one given)
date=2001-04-10
date=2001-04-11
date=2001-04-12

This, if I'm mistaken can't be done with interval, at least not without
looping in PHP? And using two queries would not perhaps save as much code
as the way I solved it? Could be mistaken of course.

Martin S.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






If you are looking for a PHP only solution you might try hand calculating
the amount of time you want to adjust in seconds (i.e. 60 seconds x 60
minutes x 24 hours x 10 days = 864000)

$newdatetime = (strtotime($otherdatetime) + 864000;
I often use something similar to adjust for timezone differences.

There are lots of other datetime functions in the manual ;)

Warren Vail

-----Original Message-----
From: PHPBeginner.com [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 22, 2001 3:09 AM
To: Martin Skjoldebrand; [EMAIL PROTECTED]
Subject: RE: [PHP] Incrementing dates


you can then do this:

INSERT INTO table SELECT date+INTERVAL 10 DAYS AS date FROM table WHERE
bla=bla;

it is just a way to do it. you will definitely have to play with it.

However you can easily make two queries to read the previous date combining
it with INTERVAL and then do an insert.


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-----Original Message-----
From: Martin Skjoldebrand [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 22, 2001 5:59 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Incrementing dates


PHPBeginner.com wrote:

> I am not sure on how your possibilities are,
> but doing this in PHP means literally "adding useless lines and loops"
>
> If possible, do it with SQL queries. Read the documentations on date
> datatypes, this is so much easier... almost magic.
>

AND

> You can (mySQL, right?) do the following:

>UPDATE table SET date=(date+INTERVAL 10 DAYS);

>so if date there was 04-28, it will be added 10 more days and so will
>become
>05-08

>Use SQL for this things, it treats dates as 'dates' while PHP treats them
>as
>integers and strings.

Sounds even easier. But what if I'm not doing an UPDATE but an INSERT? Can
it read the previous date? I am inserting a batch of bookings at one time.

Martin S.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






"Paul A. Owen" <[EMAIL PROTECTED]> wrote:

 > Is there an UUdecode function in PHP? If not then how would I implement
 > this under NT?

a base64 decode?

http://dk.php.net/manual/function.base64-decode.php

else look here, there are some more:

http://dk.php.net/manual-lookup.php?lang=en&function=uudecode

-- 
Henrik Hansen





how could i pass a variable between pages without them seeing the variable
stated in the URL?






using POST, Cookies or sessions.

session is the most appropriate way to do that.

php.net/sessions


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-----Original Message-----
From: Adam [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 22, 2001 8:00 PM
To: [EMAIL PROTECTED]
Subject: [PHP] passing variables


how could i pass a variable between pages without them seeing the variable
stated in the URL?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






Greetings.

    I have this link file which has been active for quite a while, but the
problem is that when I used a "admin" program to manage the links
(admin.php) it kinda wrote the file multiple times, which means that it has
sorted the file and added multiple instances of the lines.

    How I managed to create it? Well, by using the free linkadd/linkmanager
PHP script. Anyhow, what I need is how can I remove duplicates that are
sorted in arrays? Or does anyone of you has such a script or C++ program, so
you could sort the file for me or something?

Thanks
- Richard






Have you tried the array_unique function
http://www.php.net/manual/en/function.array-unique.php


-Stewart

-----Original Message-----
From: Richard [mailto:[EMAIL PROTECTED]]
Sent: 22 April 2001 12:36
To: [EMAIL PROTECTED]
Subject: [PHP] Remove duplicates, as long as you have it.


Greetings.

    I have this link file which has been active for quite a while, but the
problem is that when I used a "admin" program to manage the links
(admin.php) it kinda wrote the file multiple times, which means that it has
sorted the file and added multiple instances of the lines.

    How I managed to create it? Well, by using the free linkadd/linkmanager
PHP script. Anyhow, what I need is how can I remove duplicates that are
sorted in arrays? Or does anyone of you has such a script or C++ program, so
you could sort the file for me or something?

Thanks
- Richard



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




That removes instances in an array, I am talking about a file. Each line
contains non-duplicate words, but the lines are mixed and duplicated,
perhaps trippled.

- Richard

""Taylor, Stewart"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Have you tried the array_unique function
> http://www.php.net/manual/en/function.array-unique.php
>
>
> -Stewart
>
> -----Original Message-----
> From: Richard [mailto:[EMAIL PROTECTED]]
> Sent: 22 April 2001 12:36
> To: [EMAIL PROTECTED]
> Subject: [PHP] Remove duplicates, as long as you have it.
>
>
> Greetings.
>
>     I have this link file which has been active for quite a while, but the
> problem is that when I used a "admin" program to manage the links
> (admin.php) it kinda wrote the file multiple times, which means that it
has
> sorted the file and added multiple instances of the lines.
>
>     How I managed to create it? Well, by using the free
linkadd/linkmanager
> PHP script. Anyhow, what I need is how can I remove duplicates that are
> sorted in arrays? Or does anyone of you has such a script or C++ program,
so
> you could sort the file for me or something?
>
> Thanks
> - Richard
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






if the lines are exact duplicates, then you could open the file with PHP or
Perl, then scan through it, line by line, each time throwing the line in the
next cell of an array....then you should be able to sort by the values in
those cells, and after you have that, deleting duplicates would be
simple.....

-----Original Message-----
From: Richard [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 22, 2001 12:27 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Remove duplicates, as long as you have it.


That removes instances in an array, I am talking about a file. Each line
contains non-duplicate words, but the lines are mixed and duplicated,
perhaps trippled.

- Richard

""Taylor, Stewart"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Have you tried the array_unique function
> http://www.php.net/manual/en/function.array-unique.php
>
>
> -Stewart
>
> -----Original Message-----
> From: Richard [mailto:[EMAIL PROTECTED]]
> Sent: 22 April 2001 12:36
> To: [EMAIL PROTECTED]
> Subject: [PHP] Remove duplicates, as long as you have it.
>
>
> Greetings.
>
>     I have this link file which has been active for quite a while, but the
> problem is that when I used a "admin" program to manage the links
> (admin.php) it kinda wrote the file multiple times, which means that it
has
> sorted the file and added multiple instances of the lines.
>
>     How I managed to create it? Well, by using the free
linkadd/linkmanager
> PHP script. Anyhow, what I need is how can I remove duplicates that are
> sorted in arrays? Or does anyone of you has such a script or C++ program,
so
> you could sort the file for me or something?
>
> Thanks
> - Richard
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






Hi,

I've just started working with PHP. I've made a guest book using PHP
(nothing spectacular) that worked just fine when I tested it op my pc, but
when I uploaded it, it stopped working.
My specific problem is that I cannot write to a file that already exists and
contains data. When I try to I get these warnings:

    Warning: File already exists
    Warning: fopen("ftp:[EMAIL PROTECTED]/guestbook.txt","a") - File
exists

Is this problem related to the FTP fopen? And is there a way to correct this
problem?

Tnx!
Joeri Vankelst






unless that file you're writing to is on a different server, just put the
relative location to the file. ie: ./guestbook.txt

if this doesn't work I have nothing to offer you. :-\
----- Original Message -----
From: "Joeri Vankelst" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, April 22, 2001 7:43 AM
Subject: [PHP] writing to file on server


> Hi,
>
> I've just started working with PHP. I've made a guest book using PHP
> (nothing spectacular) that worked just fine when I tested it op my pc, but
> when I uploaded it, it stopped working.
> My specific problem is that I cannot write to a file that already exists
and
> contains data. When I try to I get these warnings:
>
>     Warning: File already exists
>     Warning: fopen("ftp:[EMAIL PROTECTED]/guestbook.txt","a") - File
> exists
>
> Is this problem related to the FTP fopen? And is there a way to correct
this
> problem?
>
> Tnx!
> Joeri Vankelst
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





When you are using that on your site, what basically happens is that you are
trying to open an FTP session with yourself. Not too efficient.

So just kill off the url and use the path to your file.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Joeri Vankelst"" <[EMAIL PROTECTED]> wrote in message
9bujcv$gtm$[EMAIL PROTECTED]">news:9bujcv$gtm$[EMAIL PROTECTED]...
> Hi,
>
> I've just started working with PHP. I've made a guest book using PHP
> (nothing spectacular) that worked just fine when I tested it op my pc, but
> when I uploaded it, it stopped working.
> My specific problem is that I cannot write to a file that already exists
and
> contains data. When I try to I get these warnings:
>
>     Warning: File already exists
>     Warning: fopen("ftp:[EMAIL PROTECTED]/guestbook.txt","a") - File
> exists
>
> Is this problem related to the FTP fopen? And is there a way to correct
this
> problem?
>
> Tnx!
> Joeri Vankelst
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






But when I try using the path to the file I get denied permission ...
How can I use my password then? Or can I bypass that in some way?

""Plutarck"" <[EMAIL PROTECTED]> wrote in message
9bupqt$b8s$[EMAIL PROTECTED]">news:9bupqt$b8s$[EMAIL PROTECTED]...
> When you are using that on your site, what basically happens is that you
are
> trying to open an FTP session with yourself. Not too efficient.
>
> So just kill off the url and use the path to your file.
>
>
> --
> Plutarck
> Should be working on something...
> ...but forgot what it was.
>
>
> ""Joeri Vankelst"" <[EMAIL PROTECTED]> wrote in message
> 9bujcv$gtm$[EMAIL PROTECTED]">news:9bujcv$gtm$[EMAIL PROTECTED]...
> > Hi,
> >
> > I've just started working with PHP. I've made a guest book using PHP
> > (nothing spectacular) that worked just fine when I tested it op my pc,
but
> > when I uploaded it, it stopped working.
> > My specific problem is that I cannot write to a file that already exists
> and
> > contains data. When I try to I get these warnings:
> >
> >     Warning: File already exists
> >     Warning: fopen("ftp:[EMAIL PROTECTED]/guestbook.txt","a") - File
> > exists
> >
> > Is this problem related to the FTP fopen? And is there a way to correct
> this
> > problem?
> >
> > Tnx!
> > Joeri Vankelst
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Your question is a bit too short to be answered. Explain why and we will try
to explain how. The other poster is wrong however, u can use ADO and use the
Jet OLEDB provider to connect to Microsoft Access.

Søren Soltveit <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> How can I connect to a Microsoft Access database, whitout using ODBC??
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






On Saturday 21 April 2001 20:15, Jason Caldwell wrote:
>  I know this is off-topic -- please forgive me.  But I figure someone here
>  would know.
>  I'm looking for some really nice *professional* looking (submit, logon,
> buy, help, etc....) buttons for my website... I've done all kinds of

try do it with css:
.button {
  font-size: 10px;
  font-family: Verdana, Arial, Helvetica, Sans-serif;
  color: #ffffff;
  font-weight: bold;
  background-color: #777777;
  border-color: #999999;
}

and just <input class="button" type="submit" value="text">

and the world is for your feets :)

> searches on MSN and Yahoo -- found a ton of sites that offer all kinds of
> .gifs and .jpegs -- but I must say 99% of them are garbage.

or hire somebody :)

-- 
 php developer / CoreTrek AS        | I think I'll KILL myself by leaping out 
 Sandnes / Rogaland / Norway        | of this 14th STORY WINDOW while reading 
 web: http://www.moijk.net/         | ERICA JONG'S poetry!! 




Another way of getting buttons without actually "hiring" someone is to kind
of trade them work. Works especially well with people you already know, or
people your friends know.

You'll do a little website programming for them (like a custom form-to-email
or user login system) and they'll make some graphics for you.

Also check out a program called IconToy, which rips out graphics from
windows programs.


--
Plutarck
Should be working on something...
...but forgot what it was.


"Geir Eivind Mork" <[EMAIL PROTECTED]> wrote in message
01042216125503.05150@maria">news:01042216125503.05150@maria...
> On Saturday 21 April 2001 20:15, Jason Caldwell wrote:
> >  I know this is off-topic -- please forgive me.  But I figure someone
here
> >  would know.
> >  I'm looking for some really nice *professional* looking (submit, logon,
> > buy, help, etc....) buttons for my website... I've done all kinds of
>
> try do it with css:
> .button {
>   font-size: 10px;
>   font-family: Verdana, Arial, Helvetica, Sans-serif;
>   color: #ffffff;
>   font-weight: bold;
>   background-color: #777777;
>   border-color: #999999;
> }
>
> and just <input class="button" type="submit" value="text">
>
> and the world is for your feets :)
>
> > searches on MSN and Yahoo -- found a ton of sites that offer all kinds
of
> > .gifs and .jpegs -- but I must say 99% of them are garbage.
>
> or hire somebody :)
>
> --
>  php developer / CoreTrek AS        | I think I'll KILL myself by leaping
out
>  Sandnes / Rogaland / Norway        | of this 14th STORY WINDOW while
reading
>  web: http://www.moijk.net/         | ERICA JONG'S poetry!!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Hi, I'm trying to get a binary file from an URL and then save it to a local
disk.

I'm trying this:

$fd = fopen ($filename, "rb");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);

$fp = fopen ($tempfile, "wb");
fwrite ($fp,$contents);
fclose ($fp);

If I use $filename="local_file" the script works great, but if I use
$filename="http://myserver.com/remote_file" the resultant local file is
empty.

How can I do this?

Thanks in advance,
Jaime





Well, it use to happen...

[from function.filesize.html]
int filesize (string filename)
This function will not work on remote files; the file to be examined must be
accessible via the server's filesystem.

Ok, I screwed up. But now that I know what went wrong, how can I override
this? The docs said: "Fread() reads up to length bytes from the file pointer
referenced by fp. Reading stops when length bytes have been read or EOF is
reached, whichever comes first."

How do I use fread to read until EOF? Note: I don't know the file size, it
could be from 1 byte to xxx Mb.

Thanks,
Jaime

-----Mensaje original-----
De: Jaime Torres [mailto:[EMAIL PROTECTED]]
Enviado el: domingo 22 de abril de 2001 12:07
Para: [EMAIL PROTECTED]
Asunto: [PHP] Getting a binary file from URL


Hi, I'm trying to get a binary file from an URL and then save it to a local
disk.

I'm trying this:

$fd = fopen ($filename, "rb");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);

$fp = fopen ($tempfile, "wb");
fwrite ($fp,$contents);
fclose ($fp);

If I use $filename="local_file" the script works great, but if I use
$filename="http://myserver.com/remote_file" the resultant local file is
empty.

How can I do this?

Thanks in advance,
Jaime


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






Solution #1

$contents = fread ($pointer, 1000000000000);



Solution #2

$contents="";
while ($partial = fread ($pointer, 8192)) {
    $contents.=$partial;
};






I have a formmail script that works both under Win32 as in Linux.

It has a function email() that calls either mail() if in Win32 or 
sendmail() if in Linux... in Linux this sendmail() function works exactly 
as mail() but calling a popen() to sendmail... and it works fine..
but sometimes in Win mail() simply terminates the script and the email 
isn't sent.

It's weird, it's like mail() had some internall error and had to quit the 
entire script execution, cuz nothing after the mail() funcion is called 
happens, and it does not give me any error message either...
____________________________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer





I have a chunk of text like this:

$string="bla bla bla (12837) ble blo bli sjhs9 39udjkd";

I only want "bla bla bla" out of it...

what is wrong with:
$newString = strtok ($string,"(128");

altough this seems to work:
$newStrArray = explode("(128",$string);

so $newStrArray[0] would have exactly what I want... why doesn't strtok() 
works here?
____________________________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer





Hey, I'm new to the list, and this issue may have already been addressed...

It seems that with Apache and PHP (running in Windows XP Beta 2, which identifies to 
Apache as an NT system) as the server and being accessed by MSIE 6.0b or MSIE 5.5 that 
cheese doesn't taste right.
No, wait, that's not the issue. The issue is that unless the page is what the browser 
opens with (ex: desktop shortcut, address bar request, being set as the browser's 
"home" -- anything where no page, not even the "Action cancelled." page, is opened) 
the cookies I setcookie() are saved as session cookies (yo know, not saved in a file), 
whereas if it's the first page the browser opens, they're saved in the Cookies folder 
where they're supposed to go, as a bona fide file.

Is there a solution to this issue yet? Has anyone else noticed it? :)




Yea, I got a solution.

Choose a flavor of linux, format your HD, install, and run the that server
like it was meant to run.

Apache is not even 100% on NT much less the XP beta, it's like your running
a beta on a beta...That's why it's not working.

Here is a good quote from apache.org:  "Please note that at this time,
Windows support is entirely experimental, and is recommended only for
experienced users."

:)

I'm not trying to be a linux zealot, but you will encounter more strange
problems like this on windows...

SL.

----- Original Message -----
From: "Padraic Tynan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, April 22, 2001 1:28 PM
Subject: [PHP] Apache, PHP, Windows XP, MSIE 6, Cheese, and Cookies.


Hey, I'm new to the list, and this issue may have already been addressed...

It seems that with Apache and PHP (running in Windows XP Beta 2, which
identifies to Apache as an NT system) as the server and being accessed by
MSIE 6.0b or MSIE 5.5 that cheese doesn't taste right.
No, wait, that's not the issue. The issue is that unless the page is what
the browser opens with (ex: desktop shortcut, address bar request, being set
as the browser's "home" -- anything where no page, not even the "Action
cancelled." page, is opened) the cookies I setcookie() are saved as session
cookies (yo know, not saved in a file), whereas if it's the first page the
browser opens, they're saved in the Cookies folder where they're supposed to
go, as a bona fide file.

Is there a solution to this issue yet? Has anyone else noticed it? :)






Hi,

     I would like to know how to make different link in different color on
one page.

etc.  www.domain1.com in blue color
       www.domain2.com in red color
       www.domain3.com in orange color

Thank you for your help

Mark





You need to use style sheets:
http://www.awlonline.com/cseng/titles/0-201-41998-X/liebos/
http://www.builder.com/Authoring/CSS/?tag=st.bl.7258.dir1.bl_CSS
http://www.wdvl.com/Authoring/Style/Sheets/
Jeff Oien

> Hi,
>
>      I would like to know how to make different link in different color on
> one page.
>
> etc.  www.domain1.com in blue color
>        www.domain2.com in red color
>        www.domain3.com in orange color
>
> Thank you for your help
>
> Mark





On Saturday 21 April 2001 04:42, [EMAIL PROTECTED] wrote:
>  Alrighty.  I'm baack!  Anyways, I seem to be having stupid little
>  problems, al of which are driving me insane.  I'll feel really
>  stupid when you tell me the problem.  A friend told me something about
>  "seeding" for random() but I didn't find anything on that.

try this and learn from it :)

<? 
if (empty($name)) {
?>
<HTML>
<HEAD>
<TITLE>Horse Race v.1</TITLE>
</HEAD>
<BODY>
Welcome to horse racing v.1.  This is a simple PHP game where you can
train, race and win money for your animals.  Eventually I'll make it a
whole barn with feeding and horses, and costs, age, breeding.  So on.
But for now, this is just a simple game.<br><br>

Enter six names of horses.
<FORM ACTION="<?=$PHP_SELF?>" METHOD="post">
<? for ($i=1;$i<=6;$i++) { // I hate to repeat text ;)
        echo "Name$i : <INPUT TYPE=\"text\" NAME=\"name[]\" 
size=\"24\"><BR>\n";
?>
<input type="submit" name="submitNms" value="race them!">
</FORM>
<CENTER>Good luck!</CENTER>
</BODY>
</HTML>
<?
} else {
    srand((double)microtime()*1000000); // prepare the random sequence.
    $randomHorse = round(rand(1,6));      // makes a random horse
    $randomStrides = rand(1, 10);            // whatever strides are
    echo $name[$randomHorse] ." won the race by $randomStrides ! 
Congratulations."; // the var name is the array from the form.. 
}
?>

-- 
 php developer / CoreTrek AS        | Remembering is for those who have
 Sandnes / Rogaland / Norway        | forgotten.   -- Chinese proverb 
 web: http://www.moijk.net/         | 




Can anyone tell me the correct syntax for connecting to an imap server using
imap_open and an ssl connection.

    normally ---->   $link = imap_open ("{mail.whatever.com:143}",
"username", "password");

Is this the correct way to do it for ssl?  ... because it is not working for
me.

    ssl ---->     $link = imap_open ("{mail.whatever.com:993}", "username",
"password");

 Drew






As I've seen and tested, Apache running in Win2k won't do output buffering 
running PHP as CGI.

But will perfectly running PHP as DSO.

Any explanations?
____________________________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer





Why not just store the filename?

SL.

----- Original Message -----
From: "Keyur Kalaria" <[EMAIL PROTECTED]>
To: "php" <[EMAIL PROTECTED]>
Sent: Saturday, April 21, 2001 9:52 AM
Subject: [PHP] problem with storing & displaying image in db


> Hello everybody,
>
> I am facing a strange problem while uploading and displaying images in a
> database table.
>
> I have taken blob field to store the images.
>
> Images which are less then around 100kb are stored & displayed properly
but
> images which are greater than 100kb are giving problems while displaying
> although no errors were generated while inserting them in database.
>
> what could be the problem ? is it due to the blob type ?
>
> i am using the following statements to insert the file to database.
>
> insert.php
> ***********************************
> $imgsize=GetImageSize($photofile);
> $photo=addslashes(fread(fopen($photofile, "r"), filesize($photofile)));
> $query="insert into photo(photoformat,photo,photowidth,photoheight) values
> ('$photoformat','$photo',$imgsize[0],$imgsize[1])";
>
> $photoformat, $photofile are the input fields of the form which is
> submitted.
>
> ***********************************
>
> in my html pages i use the following <img> :
>
> <img src=display.php?id=1>
>
> and my display.php is as follows:
>
> display.php
> ***********************************
> $query="select * from photo where id='$id'";
> $result=mysql_query($query);
> $photo_rec=mysql_fetch_array($result);
> Header( "Content-type: image/$photo_rec[photoformat]; name=".microtime());
> echo $photo_rec["photo"];
>
> ***********************************
>
>
> Thanks in advance
>
> Keyur
> $$$$$$$
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





You know, that's a tad rude, just suggestion an OS switch like that. :þ
I mean, my http server isn't the only thing I run -- this is my personal use
computer. Windows XP Beta contains the sum total of what Windows has been up
to now, so I don't think the OS has very much to do with it.

I just wanted to know of this was an actual documented problem and if there
was a fix for it, or if I was the first person to experience it.

Not to mention, even though Apache.org says that Windows support is entirely
experimental and recommended only for experienced users, Linux itself (every
flavor) is still experimental, and you have to know beyond a shadow of a
doubt what you're doing to use it. Not to mention, every time I've tried to
set it up (RH6, Mandrake 7.1), nearly immediately following the
installation, it's messed up, without my editing any part of it.



Reply via email to