[PHP] Re: test for ascii or binary string

2002-11-30 Thread Paul Chvostek

On Fri, Nov 29, 2002 at 10:27:05PM -0600, Jonathan Sharp wrote:
 
 Is there a way to determine if a string has ascii or binary data in it?

You could always see if it matches a regular expression that represents
the ascii range you're considering.  I.e., ereg('[^a-zA-Z0-9]',$string)
will return true if non-alphanumerics are in the string.

Remember that a string is just a string.  Whether the data contained in
it is represented as ASCII or something else is completely a matter of
implementation.  ALL 7-bit data can be represented as ASCII.  All 8-bit
data can be represented as IBM Extended ASCII or whatever you want to
call it.  But the string is just a string of bits.

-- 
  Paul Chvostek [EMAIL PROTECTED]
  Operations / Abuse / Whatever  +1 416 598-
  it.canada - hosting and development  http://www.it.ca/


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




[PHP] Re: Hello ! How to write a programme in PHP which executes a routine at a given time ?

2002-11-30 Thread Paul Chvostek

PHP itself does not have any facility for running things according to a
schedule in the way you describe.  It looks like you need to run some
additional software using cron (or your operating system's equivalent).
Unix systems have a command called at which can be used to execute
things at specific times, but what it actually executes is still a
problem.  If you want to be able to launch programs on external
machines, there are security issues which must be addressed as well.

And what does centian mean?


On Fri, Nov 29, 2002 at 01:18:16AM +0800, Jonathan wrote:
 
 Dear all ,
  Hello ! I am a student and going to write a suit of programme . The
 producers as follow
 
  producer 1.
  User A add an new appointment A ( open Winamp at 2:30 on computer B)
 through IE in his local computer A .
 
  producer 2.
  Computer A send the message to server A through http . The Servlet /
 ASP.net which locates on server A receives the message and send message to
 computer B (IP or domain name of computer B is given , named
 www.computerB.com) .
 
  producer 3.
  Computer B receives the message from server A through http at 1:01 . It is
 expected to implement the new added appointment A ( open Winamp at 2:30 on
 computer B ) at given time .
 
  I know what to implement the producer 1 and 2. However , I don't know how
 to implement producer 3. Do you mind to tell me how to make a PHP programme
 to execute a centian routine at a given time ? Thank you !

-- 
  Paul Chvostek [EMAIL PROTECTED]
  Operations / Abuse / Whatever  +1 416 598-
  it.canada - hosting and development  http://www.it.ca/


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




[PHP] Re: Multidimensional array

2002-11-30 Thread Paul Chvostek

A multidimensional array is just an array whose values are themselves
arrays.  So ...

$thing=2002-11; // or whatever
$issue=array();
$issue[$thing]=array();
$issue[$thing]['number']=this;
$issue[$thing]['headline']=that;

And if you ksort($issue), the key/value associations will be maintained;
you're just changing the order of the elements.  If you want to sort by
other fields, array_multisort() may be for you.

p

On Thu, Nov 28, 2002 at 09:11:03AM -0800, Mako Shark wrote:
 
 Here is a problem I'm having similar to somethnig
 someone just posted, but not quite the same. I'm not
 too experienced with the intricacies and
 complications of arrays, but I have a bunch of fields
 like this for a magazine organizer (best way to put
 it, I guess):
 
 $issuenumber[]
 $issueheadline[]
 $issuewriters[]
 $issuemonth[]
 $issueyear[]
 $issuedescription[]
 among other fields.
 
 I would like to store this all in one multidimensional
 array, like
 $issue-number[]
 $issue-headline[]
 etc.
 
 What is the syntax? I'm bumbling around right now.
 Also, if I sort() the array by number, would the rest
 of the fields be properly sorted? I assume so, but
 don't want to find out the hard way that it doesn't.
 
 __
 Do you Yahoo!?
 Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
 http://mailplus.yahoo.com
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
  Paul Chvostek [EMAIL PROTECTED]
  Operations / Abuse / Whatever  +1 416 598-
  it.canada - hosting and development  http://www.it.ca/


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




Re: [PHP] OpenSSL Encryption to a browser.

2002-11-30 Thread Tony Earnshaw
fre, 2002-11-29 kl. 12:50 skrev Comunica2 s. coop.:

 I would like to use OpenSSL to send encrypted information to a browser. The
 information would be encrypted to a public key that has its private
 counterpart installed in the browser. The idea is that the information would
 be decrypted automatically, but only when the destination browser has the
 right private key installed.

PKI encryption just does not work like that. Read up on the Openssl docs
and especially Ralf Engelschall's mod_ssl docs. The rsasecurity web site
PKI FAQ is also a good one to read, mark, learn and inwardly digest it
all. Given the existence of Carnivore and wireless networks, it's a
'must' for tomorrow's computing.

Best,

Tony


-- 

Tony Earnshaw

When all's said and done ...
there's nothing left to say or do.

e-post: [EMAIL PROTECTED]
www:http://www.billy.demon.nl




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




php-general Digest 30 Nov 2002 12:31:53 -0000 Issue 1735

2002-11-30 Thread php-general-digest-help

php-general Digest 30 Nov 2002 12:31:53 - Issue 1735

Topics (messages 126506 through 126526):

Method for displaying downline
126506 by: Daren Cotter
126510 by: Daren Cotter
126512 by: Daren Cotter

Re: How Do I install php on Apache 2.0
126507 by: -[ Rene Brehmer ]-

Re: First PHP
126508 by: -[ Rene Brehmer ]-

imap_open authentication failure
126509 by: Dumdeedum

Re: amp; in Query String
126511 by: Malcolm Brownell

test for ascii or binary string
126513 by: Jonathan Sharp
126514 by: Jonathan Sharp
126515 by: Morgan Hughes
126523 by: Paul Chvostek

string
126516 by: Remon Redika
126517 by: Kyle Gibson

PHP  Javascript compatibilty
126518 by: Wee Keat [Amorphosium]
126519 by: Kyle Gibson

About Speech
126520 by: Ing. Raúl González Rodríguez

Re: Test links?
126521 by: Jason Wong

Re: Upload wont work, OS X
126522 by: Jason Wong

Re: Hello ! How to write a programme in PHP which executes a routine at a given time ?
126524 by: Paul Chvostek

Re: Multidimensional array
126525 by: Paul Chvostek

Re: OpenSSL Encryption to a browser.
126526 by: Tony Earnshaw

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]


--

---BeginMessage---
I need to display an entire downline (info about all
members referred by another member). The query to
actually get the info I need is fairly simple, but
displaying it in a table is what's tripping me up.

There are two tables: Affiliates and Referrals.
Affiliates keeps track of all affiliate info.
Referrals keeps track of who referred who (AffID and
ReferredBy fields).

The output I need is something like:

 7
   10 11
   14  16 18  20
 26  28  31  34 36  38  41  44

Where 7 referred 10 and 11, 10 referred 14 and 16, 14
referred 26 and 28, etc. Each member can only refer
two others.

I know some sort of looping (possibly recursion?)
structure is needed, but I can't figure out how to
display the output in tables as shown above.

Any help would be greatly appreciated!

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

---End Message---
---BeginMessage---
I need to display an entire downline (info about all
members referred by another member). The query to
actually get the info I need is fairly simple, but
displaying it in a table is what's tripping me up.

There are two tables: Affiliates and Referrals.
Affiliates keeps track of all affiliate info.
Referrals keeps track of who referred who (AffID and
ReferredBy fields).

The output I need is something like:

 7
   10 11
   14  16 18  20
 26  28  31  34 36  38  41  44

Where 7 referred 10 and 11, 10 referred 14 and 16, 14
referred 26 and 28, etc. Each member can only refer
two others.

I know some sort of looping (possibly recursion?)
structure is needed, but I can't figure out how to
display the output in tables as shown above.

Any help would be greatly appreciated!


__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

---End Message---
---BeginMessage---
I need to display an entire downline (info about all
members referred by another member). The query to
actually get the info I need is fairly simple, but
displaying it in a table is what's tripping me up.

There are two tables: Affiliates and Referrals.
Affiliates keeps track of all affiliate info.
Referrals keeps track of who referred who (AffID and
ReferredBy fields).

The output I need is something like:

 7
   10 11
   14  16 18  20
 26  28  31  34 36  38  41  44

Where 7 referred 10 and 11, 10 referred 14 and 16, 14
referred 26 and 28, etc. Each member can only refer
two others.

I know some sort of looping (possibly recursion?)
structure is needed, but I can't figure out how to
display the output in tables as shown above.

Any help would be greatly appreciated!


__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

---End Message---
---BeginMessage---
Hi Adam Voigt,

On 27 Nov 2002 11:44:49 -0500, you wrote about Re: [PHP] How Do I install
php on Apache 2.0 something that looked like this:

A. What does having Adobe installed matter?

Where'd you get that??

B. Why are you trying to run 2.0? Apache 2.0 isn't even recommended for
use with PHP on 

[PHP] Re: Multidimensional arrays (more and more...)

2002-11-30 Thread Paul Chvostek

Well, counting is easy...  count($issue) will be correct.  If you want
to count things that match only specific elements, use things like:

  $c=0;
  foreach($issue as $what)
if ( $year==2003  $month=5 )
  $c++;

As I said in the previous email, to sort by array elements, you'd need
to use array_multisort.  Something like...

  $sortkey=array();
  foreach($issue as $what)
$sortkey[]=$what['number'];
  array_multisort($issue,$sortkey);

And for looping, foreach is still your best bet:

  foreach($issue as $key = $what) {
if ($what['senttosubscribers']==0)
  $issue[$key]['description'].= (EMPTY);
else
  $issue[$key]['description'].=str_replace( (EMPTY),,$what['description']);
  }

With regard to PHP being screwey, I haven't found this -- I use
multidimensional arrays quite a bit and find that they behave exactly as
I would predict.  Maybe I'm just lucky.  ;-)

p

On Thu, Nov 28, 2002 at 09:55:25AM -0800, Mako Shark wrote:
 
 Wow. This goes way beyond simply printing
 multidimensional arrays. Here's some sample data:
 
 $issue[][number] = number;
 $issue[][headline] = headling;
 $issue[][writers] = writers;
 $issue[][list] = list;
 $issue[][senttosubscribers] = 0;
 $issue[][month] = 05;
 $issue[][year] = 2003;
 $issue[][description] = description;
 
 What I need to do now is count(), sort() by number,
 and loop through this array.
 
 I read that PHP is screwy when counting and sorting
 multidimensional arrays, but they *have* to have come
 up with a method, right?

-- 
  Paul Chvostek [EMAIL PROTECTED]
  Operations / Abuse / Whatever  +1 416 598-
  it.canada - hosting and development  http://www.it.ca/


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




Re: [PHP] test for ascii or binary string

2002-11-30 Thread Beth Gore
Morgan Hughes wrote:


On Fri, 29 Nov 2002, Jonathan Sharp wrote:

 

Is there a way to determine if a string has ascii or binary data in it?
   

I just wrote this, it seems to work. I've used mhash to generate a 
binary string. It will fail if:

a) The strings use obscure ASCII control characters other than LF, CR 
and Horizontal Tab.
b) You're expecting strings with european charater's with umlouts and 
stuff like that.

You can add these characters to the list of exclusions on line 16 of 
this code.

Hope this helps!!!

Beth Gore


?php

function isbinary($input)
{
/* This simple function returns true if there's any non-standard Ascii 
characters */

$isbinary = 0;

for($x=0;$x  strlen($input); $x++)
{

$c = substr($input,$x,1);

if($c  chr(32) or $c  chr(127))
{
if($c != chr(10) or $c != chr(13) or $c != chr(9)) /* add expected 
european extended characters */
{
$isbinary = 1;
}
}
}

return $isbinary;

}

$binary = mhash(MHASH_MD5,test);

$ascii = Hello, this is a normal string;;

$strings = array(1 = $binary, 2= $ascii);

while(list($id, $string) = each($strings)){

if(isbinary($string)){
echo string .$id. verified as binarybr;
}else{
echo string .$id. verified as asciibr;
}

}

?

--



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



[PHP] Re: Multidimensional arrays (more and more...)

2002-11-30 Thread Paul Chvostek

On Thu, Nov 28, 2002 at 10:19:38AM -0800, Mako Shark wrote:
...
 My problem is I need to loop through these. So I can't
 just assume that the count is count($issue[]) divided
 by 8, because that won't work in a for loop. I suppose
 I could just iterate through my for loop in jumps of
 8, but that seems really hacky and unintuitive to
 whomever has to figure out my code when I'm gone.

By your description, count($issue)/count($issue[]) is the number of
real elements.  And a foreach loop will correctly step through whatever
array you pass to it, even if the values of that array are themselves
arrays.  Or could you try something like count(array_keys($issue)) ...
or the loop could be as simple as:

  $count=0; foreach($issue as $junk) $count++;

which is clear, though to my eye is the same as count();

I'm surprised that count($issue) would report something other than the
number of elements in $issue.  I never count my multidimensional arrays
so it's never come up for me.  :-/

-- 
  Paul Chvostek [EMAIL PROTECTED]
  Operations / Abuse / Whatever  +1 416 598-
  it.canada - hosting and development  http://www.it.ca/


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




Re: [PHP] Method for displaying Downline

2002-11-30 Thread Rick Widmer
At 06:47 PM 11/29/02 -0800, Daren Cotter wrote:

Must you send three separate requests to the list?  One is enough.


You might find some useful information here:

   http://marc.theaimsgroup.com/?l=php-generalm=95423103630080w=2



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




Re: [PHP] Method for displaying Downline

2002-11-30 Thread Rick Widmer

IT IS CONSIDERED VERY RUDE TO SPAM THE LIST WITH REPEATED MESSAGES

ONE IS ENOUGH!!

Yes, I am shouting.


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




Re: [PHP] test for ascii or binary string

2002-11-30 Thread Ernest E Vogelsinger
At 13:38 30.11.2002, Beth Gore said:
[snip]

Add a break statement once you've detected binary, for optimization
(binary might be just some length...)

?php
function isbinary($input)
{
/* This simple function returns true if there's any
   non-standard Ascii characters */

$isbinary = 0;
for($x=0;$x  strlen($input); $x++) {
$c = substr($input,$x,1);
if($c  chr(32) or $c  chr(127)) {
/* add expected european extended characters */
if($c != chr(10) or $c != chr(13) or $c != chr(9)) {
$isbinary = 1;
/*  */  break;
}
}
}
return $isbinary;
}


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] Test links?

2002-11-30 Thread Rob Packer
Well, the reason I didn't do that at first was that I could have done any of
the methods that I've tried incorrectly, which is why I figured I'd ask what
works and then focus on that method... but, I've tried to ping them, use
fopen, and use fsocketopen... but nothing says that I've used any of them
the way I should have :)  I also tried to use the scripts that I found at
hotscripts.com but I always seem to get inconsistent results and it must be
accurate.


Jason Wong [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Saturday 30 November 2002 06:53, Rob Packer wrote:
  First, I'd like to say that I'm not asking for anyone to write a
script...
  how would I go about checking a MySQL database of links to see if any
are
  down?
 
  I've had some varying results with all the methods I've tried, so would
  like to see if anyone has a proven method for doing this.

 Why don't you briefly summarise what methods you have tried? That way
people
 won't reply with methods that you already know of.

 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *

 /*
 Between grand theft and a legal fee, there only stands a law degree.
 */




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




[PHP] Quota function

2002-11-30 Thread EdwardSPL
Dear all,

How to write a Quota function with php code ?
Require : different Server machine, userid and password  also

Mine is Linux Redhat system...

Thank for your help !

Edward.



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




Re: [PHP] Quota function

2002-11-30 Thread Jason Wong
On Saturday 30 November 2002 21:47, [EMAIL PROTECTED] wrote:
 Dear all,

 How to write a Quota function with php code ?
 Require : different Server machine, userid and password  also

 Mine is Linux Redhat system...

  if ($current  $quota) { echo Quota exceeded; }

IOW please elaborate on what you're trying to do.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Writing about music is like dancing about architecture.
-- Frank Zappa
*/


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




[PHP] Language codes to textual languages.

2002-11-30 Thread Noodle Snacks
Via $_SERVER['HTTP_ACCEPT_LANGUAGE'] you can get the default language of a
browser (usually).

Does anyone know of a list that has the conversion from say: en-au to
Australia or en-us to U.S.A?


--
JJ Harrison
[EMAIL PROTECTED]



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




RE: [PHP] About Speech

2002-11-30 Thread Mark Charette
 -Original Message-
 From: Ing. Raúl González Rodríguez [mailto:[EMAIL PROTECTED]]

 I need to know if it's possible generate a wav, mid or mp3 file
 from php.

You could write a custom interface to _generate_ the file (MIDI is _very_
different than the other two types; are you sure you understand exactly what
you intend to do?), but where is the input coming from to begin with? The
currently available tools to make audio files are already pretty
sophisticated, and trying to replicate them in PHP would probably not be the
best use of your time.

Sending the files doesn't require any changes to anything. Just create an
ANCHOR link to the file and it'll be sent on its merry way when the user
clicks on the link.

Mark C.


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




Re: [PHP] Test links?

2002-11-30 Thread Jason Wong
On Saturday 30 November 2002 21:40, Rob Packer wrote:
 Well, the reason I didn't do that at first was that I could have done any
 of the methods that I've tried incorrectly, which is why I figured I'd ask
 what works and then focus on that method... but, I've tried to ping them,
 use fopen, and use fsocketopen... but nothing says that I've used any of
 them the way I should have :)  I also tried to use the scripts that I found
 at hotscripts.com but I always seem to get inconsistent results and it must
 be accurate.

Investigate the use of file(). It should be the most reliable indicator of 
whether or not a link is valid.

Using ping on it's own doesn't really help much. A server may be configured to 
ignore ping requests. And even if a server responds to a ping request it 
doesn't mean the webserver is up and running.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Nothing astonishes men so much as common sense and plain dealing.
-- Ralph Waldo Emerson
*/


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




Re: [PHP] Quota function

2002-11-30 Thread EdwardSPL
Jason Wong wrote:

 On Saturday 30 November 2002 21:47, [EMAIL PROTECTED] wrote:
  Dear all,
 
  How to write a Quota function with php code ?
  Require : different Server machine, userid and password  also
 
  Mine is Linux Redhat system...

   if ($current  $quota) { echo Quota exceeded; }

 IOW please elaborate on what you're trying to do.

There is a php code from Internet, it is enable Quota function with wu-imap
server, but I can't run it into my server ( Linux Redhat system ) like
http://www.ita.org.mo/~edward/imp/screenshot.gif...

if (!function_exists('imp_show_quota')) {
   function imp_show_quota ($imp) {
$imap_admin = $imp['user'];
$passwd_array = posix_getpwnam($imap_admin);
$homedir = split(/, $passwd_array['dir']);
$realname = split(,, $passwd_array['gecos']);

$quota_html = 'table width=100% border=0 cellpadding=0
cellspacing=0trtd class=itemtable border=0 cellspacing=0
cellpadding=0 width=100%tr';
$quota_html .= 'td align=left class=headerLogin: ' .
$realname[0] .  ( . $imap_admin . ) . '/td';

$junk = exec(sudo quota -u $imap_admin | grep $homedir[1],
 $quota_data,$return_code);
if ($return_code == 0  count($quota_data) == 1) {
   $splitted = split([[:blank:]]+, trim($quota_data[0]));
   $taken = $splitted[1] / 1000 ; $total = $splitted[2] / 1000 ;
   $percent = $taken * 100 / $total ;
   if ($percent = 90) {
   $class = 'quotaalert';
   } elseif ($percent = 80) {
   $class = 'quotawarn';
   } else {
   $class = 'header';
   }
   $quota_html .= 'td align=right class=' . $class . '';
   $quota_html .= sprintf(Quota on /%s: %.1fMB/%.1fMB (%.1f%%),
$homedir[1], $taken, $total, $percent);
} else {
$quota_html .= 'td align=right class=header';
$quota_html .= Quota not available;
}
$quota_html .= '/td/tr/table/td/tr/table';
return $quota_html;
}
}

Thank for your help !

Edward.




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




Re: [PHP] How Do I install php on Apache 2.0

2002-11-30 Thread Tweak2x
I got it working, thanks guys. I just Put on Apache 1.0.3 and emaild
support. They game me some thing to add into the httpd.conf. My site address
is http://tweak2x.yi.org
-- [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi Adam Voigt,

 On 27 Nov 2002 11:44:49 -0500, you wrote about Re: [PHP] How Do I install
 php on Apache 2.0 something that looked like this:

 A. What does having Adobe installed matter?

 Where'd you get that??

 B. Why are you trying to run 2.0? Apache 2.0 isn't even recommended for
 use with PHP on linux systems yet, let alone windows. You'd have much
 better luck with the 1.3.27 version.

 Why not??? I'm running a custom built Apache 2.0.40 with the latest PHP
 and it works trouble free on WinXP ...

 Granted, this is for experimental testing only ... I'd never have a public
 server running Windows in any shape or form any way...





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




Re: [PHP] Quota function

2002-11-30 Thread Michael Sims
On Sat, 30 Nov 2002 23:36:20 +0800, you wrote:

There is a php code from Internet, it is enable Quota function with wu-imap
server, but I can't run it into my server ( Linux Redhat system ) like

There is a mailing list that is specifically for Imp.  You'd have
better luck getting answers if you sent your question to that list:

[EMAIL PROTECTED]

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




[PHP] Going Mad

2002-11-30 Thread Andy
Can someone please help, i think i am going mad.
I have just installed Apache, php and Mysql, it all seems to be fine, the
Apache server says it is ok, i think i have set the config file correctly,
and Mysql look to be correct, but when i typed the code (My first code)
?php echo this is a php line; phpinfo(); ?
and save it test.php when i look at it in explorer all i see the preceding
html code.  hat have i done wrong?
I am using windows 2000 pro.

Thank you



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




Re: [PHP] Going Mad

2002-11-30 Thread Chris Hewitt
Andy wrote:


?php echo this is a php line; phpinfo(); ?
and save it test.php when i look at it in explorer all i see the preceding
html code.  hat have i done wrong?
I am using windows 2000 pro.


It seems as though you have not added the AddType line for php in 
httpd.conf and restarted Apache. If your file is test.php then the 
.php must be part of the AddType line.

HTH
Chris



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



Re: [PHP] Going Mad

2002-11-30 Thread Phil Driscoll
On Saturday 30 November 2002 5:31 pm, Chris Hewitt wrote:
 Andy wrote:
 ?php echo this is a php line; phpinfo(); ?
 and save it test.php when i look at it in explorer all i see the preceding
 html code.  hat have i done wrong?
 I am using windows 2000 pro.

 It seems as though you have not added the AddType line for php in
 httpd.conf and restarted Apache. If your file is test.php then the
 .php must be part of the AddType line.
...or you are viewing the page as file://foo.php rather than 
http://localhost/foo.php

Cheers
-- 
Phil Driscoll

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




Re: [PHP] Going Mad

2002-11-30 Thread Chris Hewitt
Andy Davey wrote:


Hi Chris

I have added AddType application/x-httpd-php .php to the httpd config file,
and restarted it, but still no luck.

Andy


Hmm. I take it the file you are trying to get at (via http:// as Phil 
says) has got a php extension? I assume there are no IfModule or 
Directory or VirtualHost tags around the line that are not applicable.

Is the httpd.conf you are editing the one being looked at by apache? To 
test this I usually put some rubbish into httpd.conf, restart apache and 
check that it groans and won't start.

Just some thoughts, hoping they help.

Chris
PS Please copy replies to the list.


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



Re: [PHP] Going Mad

2002-11-30 Thread Andy

Chris Hewitt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Andy Davey wrote:

 Hi Chris
 
 I have added AddType application/x-httpd-php .php to the httpd config
file,
 and restarted it, but still no luck.
 
 Andy
 
 Hmm. I take it the file you are trying to get at (via http:// as Phil
 says) has got a php extension? I assume there are no IfModule or
 Directory or VirtualHost tags around the line that are not applicable.

 Is the httpd.conf you are editing the one being looked at by apache? To
 test this I usually put some rubbish into httpd.conf, restart apache and
 check that it groans and won't start.

 Just some thoughts, hoping they help.

 Chris
 PS Please copy replies to the list.


There are two, one of which is the default  assume that is the one I edit?




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




Re: [PHP] Going Mad

2002-11-30 Thread Chris Hewitt
Andy Davey wrote:


There are two httpd config files, one of which is default, i take it that is
the one you edit?
I know it is something simple, which is why i cannot se it!


There should only be one. I suggest you put some rubbish into one and 
restart apache. If it does not complain then it is not the one apache is 
looking at.

If you have php compiled as a DSO then you will also need the LoadModule 
line.

HTH
Chris
PS Please copy replies to the list.


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



[PHP] How to override header info in mail()

2002-11-30 Thread Phil Powell
I am using this line:

if (!mail($to, $subject, $body, From:  . $from . ; . header(Content-type  . 
$contentType))) {..}

to use the mail() function in PHP to send simple text/plain or text/html email.  
However, upon attempting to send I get a warning message indicating that header 
information has already been set prior to emailing.  

Is there a way to overwrite only certain header information prior to emailing to 
ensure the content-type of the email being either text/plain or text/html?

Just wondering
Thanx
Phil



[PHP] last updated ?

2002-11-30 Thread Paul O'Neil
Dumb question here but whats the general practice regarding putting a
website last updated: entry on a web page? Does the web master manually
enter in today's date in a database table entry and let PHP display. Is it
statically added to the HTML page? Etc...


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




Re: [PHP] Test links?

2002-11-30 Thread Rob Packer
Okay, I'm confused... file, fopen, and fsockopen seem to say not found on
alot valid URLs...  does this look to be correct usage?
$url = $row[0]; // just get the url from the db
$fp = implode ('', file ($url));
 if (!$fp) {echo font color=redbUnable to access file/b/font; }
 else { fclose($fp); echo The link is working!; }

It seems I always get this warning...

Warning: Supplied argument is not a valid File-Handle resource in
/web/home/nrc.net/www/robert/links4.php on line 11

If someone can tell me what I'm doing wrong, I'd appreciate it.

Thanks,
Robert



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




Re: [PHP] last updated ?

2002-11-30 Thread Beth Gore
Paul O'Neil wrote:


Dumb question here but whats the general practice regarding putting a
website last updated: entry on a web page? Does the web master manually
enter in today's date in a database table entry and let PHP display. Is it
statically added to the HTML page? Etc...


 

I've just implimented that very thing in my site! Very simple. I have a 
MySQL table that features master site details, including the stylesheet, 
site title, that sort of thing. One column is a Datetime type.

In all the admin pages that add anything new to the site, the last 
update time is updated using:

?php
  $SQL = UPDATE site SET LastUpdate='.date(Y-m-d G:i:s).' WHERE 
SiteID=1;
$result = mysql_query($SQL);
?


Then, in the site's standard footer I have the following:


p class=scribblesLast Updated:
  ?php
  $timestamp = strtotime($sitedata[LastUpdate]);
  echo date(G:i, D \T\h\e jS of M, Y ,$timestamp);

  ?
/p

This then shows the last update time on the browser, and I also set the 
page to expire at that time, so in that way (I understand) browsers know 
if the page has been updated since you last looked.

--
Beth Gore
http://bethanoia.dyndns.org


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



[PHP] PHP confirmation window

2002-11-30 Thread Lars Espelid
Hello,

Working in php, the problem is how to create a window with some optional
text in it and get true or false in return. A confirmation window.

Example in javascript:

function formSubmit() {
  window.event.returnValue = false;
 if (confirm(Er du sikker på at du vil slette boenheten?))
  window.event.returnValue = true;
}


regards
lars



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




[PHP] Page break

2002-11-30 Thread Lars Espelid
Hello,

Is there some way to insert page breaks in a php document so that it becomes
more printer friendly.

thanks
lars



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




Re: [PHP] Test links?

2002-11-30 Thread Jason Wong
On Sunday 01 December 2002 02:06, Rob Packer wrote:
 Okay, I'm confused... file, fopen, and fsockopen seem to say not found on
 alot valid URLs...  does this look to be correct usage?
 $url = $row[0]; // just get the url from the db
 $fp = implode ('', file ($url));
  if (!$fp) {echo font color=redbUnable to access file/b/font; }
  else { fclose($fp); echo The link is working!; }

 It seems I always get this warning...

 Warning: Supplied argument is not a valid File-Handle resource in
 /web/home/nrc.net/www/robert/links4.php on line 11

Which is line 11?

In the above, if link was valid and returned something then $fp would be a 
string containing the HTML source of the $url. If the link was invalid (I'm 
not sure what exactly PHP would regard as an invalid link) then PHP would 
output a warning/error message (make sure you have error reporting set to an 
appropriately high level).

file() implicitly opens and closes the file for you so no need for fclose().

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
The rhino is a homely beast,
For human eyes he's not a feast.
Farewell, farewell, you old rhinoceros,
I'll stare at something less prepoceros.
-- Ogden Nash
*/


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




Re: [PHP] Going Mad

2002-11-30 Thread Phil Driscoll
On Saturday 30 November 2002 5:32 pm, Andy Davey wrote:
 Hi Phil

 It took me a while to get the local host to show the apache welcome screen,
 but now that I have I am still unable to see the page, I have the file
 saved on my desktop, should I have the test.php file saved anywhere else?

 I created the file in Dreamweaver MX, and saved it as test.php not sure if
 this can give you any clues?

 Andy
There's your problem.
Assuming you haven't messed about too much with the apache config, your php 
file needs to live inside apache's htdocs directory. Can't remember exactly 
where that would be on a windows box - something like c:/program files/apache 
group/apache/htdocs maybe.

Cheers
-- 
Phil Driscoll

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




Re: [PHP] How to override header info in mail()

2002-11-30 Thread Paul Nicholson
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hey,
The correct way of doing that is:
if (!mail($to, $subject, $body, From: . $from .\r\nContent-type. $contentType)) 
{..}
HTH!
~Paul

On Saturday 30 November 2002 12:58 pm, Phil Powell wrote:
 I am using this line:

 if (!mail($to, $subject, $body, From:  . $from . ; .
 header(Content-type  . $contentType))) {..}

 to use the mail() function in PHP to send simple text/plain or text/html
 email.  However, upon attempting to send I get a warning message indicating
 that header information has already been set prior to emailing.

 Is there a way to overwrite only certain header information prior to
 emailing to ensure the content-type of the email being either text/plain or
 text/html?

 Just wondering
 Thanx
 Phil

- -- 
~Paul Nicholson
Design Specialist @ WebPower Design
[EMAIL PROTECTED]
www.webpowerdesign.net
The webthe way you want it!


It said uses Windows 98 or better, so I loaded Linux!
Registered Linux User #183202 using Register Linux System # 81891
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE96QeuDyXNIUN3+UQRAkFEAJ0SBT8VZMHitu4zOOb+cf3jaRCX7QCffEpD
txhpy024829NozyhYq6H3Fk=
=Szfo
-END PGP SIGNATURE-

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




Re: [PHP] Going Mad

2002-11-30 Thread Chris Hewitt
Andy wrote:


Chris Hewitt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...


Can i type anything into the file or should it be code, you will have to


Yes, anything. If apache does not understand it then it will not start 
up. Don't put a hash at the beginning of your rubbish line as hash means 
a comment. Know what you have entered so that you can remove it afterwards.

Also compiled as a DSO?
Hmm.. not typed LoadModule...


There are three ways to compile php. One is as part of Apache itself, 
this is best if most of what the webserer does is php. Then there is a 
DSO (dynamic shared object), this is basically what Windows calls a 
dynamically linked library (.dll). It only gets called into memory if 
needed. This is best if most of what the webserver does is not php. Then 
there is php as a stand-alone executable (php.exe).

In order to configure httpd.conf you will need to know which you have. 
I've no experience of running php under Windows (only linux) but it 
seems most of the installations available are pre-compiled and easy to 
install. There should be instructions with your installation telling you 
how php is configured.

Running httpd -l from the command prompt (I assume this works in 
windows as well as linux), will show you what modules are compiled into 
apache. If mod_php4 comes up then php is compiled into apache and you 
do not need the LoadModule line. If mod_php4 is not shown but mod_so 
is then php may be an Apache module (DSO) or stand alone (sometimes 
called CLI or CGI). mod_so is the module that facilitates dynamic 
modules so that it is essential for any modules to work.

I think you need to refer to the instructions for your installation for 
this, not a book.


but the book which is PHP  MySQL for dummies BTW, whcih is about right,
says nothing about that.


I have not seen this book. It may simply assume an installation is 
already available and leave out installing it. Many books were written 
when register_globals was on by default, now it is off for security 
reasons. If, when you come to do code, you do not get variables passed 
from one page to another then either turn it back on (in php.ini) or 
(better) use the super-globals $_GET['var'} and $_POST['var'], but that 
is getting ahead, let's get your installation working first...

Chris



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



Re: [PHP] last updated ?

2002-11-30 Thread Chris Hewitt
Paul O'Neil wrote:


Dumb question here but whats the general practice regarding putting a
website last updated: entry on a web page? Does the web master manually
enter in today's date in a database table entry and let PHP display. Is it
statically added to the HTML page? Etc...


If you want website last updated then from a database sounds OK but 
where I'm working its commonly a page last updated wanted. In this 
case its just a manually entered date in html in the page.

Chris


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



Re: [PHP] Test links?

2002-11-30 Thread Beth Gore
Rob Packer wrote:


Okay, I'm confused... file, fopen, and fsockopen seem to say not found on
alot valid URLs...  does this look to be correct usage?
$url = $row[0]; // just get the url from the db
$fp = implode ('', file ($url));
if (!$fp) {echo font color=redbUnable to access file/b/font; }
else { fclose($fp); echo The link is working!; }

It seems I always get this warning...

Warning: Supplied argument is not a valid File-Handle resource in
/web/home/nrc.net/www/robert/links4.php on line 11

If someone can tell me what I'm doing wrong, I'd appreciate it.

Thanks,
   Robert



 

When fopen successfully opens a file it populates an array 
$http_response_header, which you can examine to see if the link works or 
not - I don't believe you can actually get the file itself, but since 
that's not what we're after that's not a problem!

Having said that, fopen produces a very annoying error if it doesn't 
find the page, but I found the following works:

?php

   $SQL = SELECT linkurl, linkID FROM links;
   $result = mysql_query($SQL);

   while($linkdata = mysql_fetch_array($result)){
  
   $fp = fopen($linkdata['linkurl'],r);
   if($fp)   
   {
   echo p.$linkdata['linkurl']. is still valid./p;
  
   }else{

   echo p.$linkdata['linkurl']. is invalid. Updating 
database... ;
  
   $SQL = UPDATE links SET status = 0 WHERE linkID = 
'.$linkdata['linkID'].';
   $result2 = mysql_query($SQL);
   if($result2)
   {
   echo Database updated/p;
   }
   }

   }
?

Rather than deleting the link, it's probably better to set a flag to 
show it was invalid last time you checked, but check it again next time. 
Or you could keep a count of the  number of failed attempts, and delete 
if it goes beyond 3 or so.

Not sure how to supress the warning message that PHP automatically does 
when you haven't got a valid URL though.

Hope this works for you!

Beth Gore
--
http://bethanoia.dyndns.org


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



[PHP] OS X and cURL Issues

2002-11-30 Thread Weston Houghton
I'm working on getting the following install working under OS 10.2.2:

./configure --prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/share/man \
--with-apxs=/usr/sbin/apxs \
--with-mysql \
--with-gd=/usr/local \
--with-png-dir=/usr/local \
--with-zlib-dir=/usr/local \
--with-jpg-dir=/usr/local \
--with-freetype-dir=/usr/local \
--enable-trans-sid \
--enable-exif \
--enable-ftp \
--enable-calendar \
--with-curl=/usr/lib \
--with-flatfile \
--with-ming=/Users/whoughto/src/ming-0.2a \
--enable-sockets \
--with-jave=/Library/Java/Home \
--with-xml

And Curl keeps throwing me the following error, but as you can see, I 
do indeed have 7.9.8 installed. Any ideas?

checking for CURL support... yes
checking for CURL in default path... found in /usr
checking for cURL 7.9.8 or greater... configure: error: cURL version 
7.9.8 or later is required to compile php with cURL support
[user/src/php4rc2] root# curl --help
curl 7.9.8 (powerpc-apple-darwin5.5) libcurl 7.9.8

Thanks,
Wes


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



Re: [PHP] Test links?

2002-11-30 Thread Chris Hewitt
Rob Packer wrote:


Okay, I'm confused... file, fopen, and fsockopen seem to say not found on
alot valid URLs...  does this look to be correct usage?
$url = $row[0]; // just get the url from the db
$fp = implode ('', file ($url));
if (!$fp) {echo font color=redbUnable to access file/b/font; }
else { fclose($fp); echo The link is working!; }

It seems I always get this warning...

Warning: Supplied argument is not a valid File-Handle resource in
/web/home/nrc.net/www/robert/links4.php on line 11


I think you have assigned $fp to be the imploded string, not a file 
pointer. Thus fclose($fp) would generate an error. Given this, I'm not 
sure what  if (!$fp) would mean.

HTH
Chris



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



Re: [PHP] PHP confirmation window

2002-11-30 Thread Jason Sheets
If you are wanting to do it on the client side you will need to do it in
javascript, not in PHP.

If you just want to make a confirmation screen in PHP you just present
an intermediate screen between the requested action and completing that
action.

An example would be:

1. Administrator clicks delete user link that is a GET query string
2. PHP application creates a page with 2 links or form buttons, Yes or
No
3. PHP application takes action as a result of the choice taken for
example a href=admin.php?action=deluseruserid=1confirm=tYes/a a
href=admin.php?action=deluseruserid=1confirm=fNo/a

Jason
On Sat, 2002-11-30 at 11:22, Lars Espelid wrote:
 Hello,
 
 Working in php, the problem is how to create a window with some optional
 text in it and get true or false in return. A confirmation window.
 
 Example in javascript:
 
 function formSubmit() {
   window.event.returnValue = false;
  if (confirm(Er du sikker på at du vil slette boenheten?))
   window.event.returnValue = true;
 }
 
 
 regards
 lars
 
 
 
 -- 
 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




Re: [PHP] OS X and cURL Issues

2002-11-30 Thread Sterling Hughes
you need to upgrade the bundled cURL to version 7.9.8 (soon to be 
7.10.2), or install a special version of the cURL library for PHP's 
installation.

-Sterling


 I'm working on getting the following install working under OS 10.2.2:
 
 ../configure --prefix=/usr \
 --sysconfdir=/etc \
 --localstatedir=/var \
 --mandir=/usr/share/man \
 --with-apxs=/usr/sbin/apxs \
 --with-mysql \
 --with-gd=/usr/local \
 --with-png-dir=/usr/local \
 --with-zlib-dir=/usr/local \
 --with-jpg-dir=/usr/local \
 --with-freetype-dir=/usr/local \
 --enable-trans-sid \
 --enable-exif \
 --enable-ftp \
 --enable-calendar \
 --with-curl=/usr/lib \
 --with-flatfile \
 --with-ming=/Users/whoughto/src/ming-0.2a \
 --enable-sockets \
 --with-jave=/Library/Java/Home \
 --with-xml
 
 And Curl keeps throwing me the following error, but as you can see, I 
 do indeed have 7.9.8 installed. Any ideas?
 
 checking for CURL support... yes
 checking for CURL in default path... found in /usr
 checking for cURL 7.9.8 or greater... configure: error: cURL version 
 7.9.8 or later is required to compile php with cURL support
 [user/src/php4rc2] root# curl --help
 curl 7.9.8 (powerpc-apple-darwin5.5) libcurl 7.9.8
 
 Thanks,
 Wes
 
 
 -- 
 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




Re: [PHP] Going Mad

2002-11-30 Thread Chris Hewitt
Phil Driscoll wrote:


There's your problem.
Assuming you haven't messed about too much with the apache config, your php 
file needs to live inside apache's htdocs directory. Can't remember exactly 
where that would be on a windows box - something like c:/program files/apache 
group/apache/htdocs maybe.

Yes, Phil has it. I'd assumed this, I should not have. The directory is 
given by the DocumentRoot line in httpd.conf. You did not say exectly 
what error you were getting, I'd assumed that you were just seeing the 
source of your file and that the only problem was php not parsing it. 
Presumably you were getting Document not found errors?

Chris



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



[PHP] Redirect opening in a new window

2002-11-30 Thread Troy May
Hello,

I'm playing with a portal system now and I need to edit a module to redirect
to another site/page.  I have done this with a header() redirection, but it
takes the current window.

How can I do this and have it open a new window for the redirect?



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




[PHP] Function passed as argument to function

2002-11-30 Thread Jeffrey B . Ferland
std_layout(Title here, list_writings(poetry))

both std_layout and list_writings are user-defined functions. std_layout() 
echo's the two arguments that it takes at select points in its execution. I 
want to the output of list_writings()  to be an argument for std_layout().

-Jeff
SIG: HUP

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




Re: [PHP] Redirect opening in a new window

2002-11-30 Thread Jason Sheets
Look at javascript, you could use javascript to both open a new window
and set the location or you could use javascript to open the new window
to a PHP script that uses header() to forward the user.

Be aware that some users disable javascript completely or just disable
new windows to avoid popups and pop under advertising.

Jason


On Sat, 2002-11-30 at 12:55, Troy May wrote:
 Hello,
 
 I'm playing with a portal system now and I need to edit a module to redirect
 to another site/page.  I have done this with a header() redirection, but it
 takes the current window.
 
 How can I do this and have it open a new window for the redirect?
 
 
 
 -- 
 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




RE: [PHP] Redirect opening in a new window

2002-11-30 Thread Troy May
That easy solution is not so easy for me.  This portal system is PHP-Nuke.
There's different themes, pages, etc.  It would take me 3 weeks to find and
edit all the links in a 2000 file directory.

I just need to be able to do this from the called module itself, and that
would take care of all the pages/themes in one shot.



-Original Message-
From: Jeffrey B.Ferland [mailto:[EMAIL PROTECTED]]
Sent: Saturday, November 30, 2002 12:02 PM
To: Troy May
Subject: Re: [PHP] Redirect opening in a new window


On Saturday 30 November 2002 02:55 pm, you wrote:
 Hello,

 I'm playing with a portal system now and I need to edit a module to
 redirect to another site/page.  I have done this with a header()
 redirection, but it takes the current window.

 How can I do this and have it open a new window for the redirect?

a href=/link.htm target=_blankDisplayed Link/a


-Jeff
SIG: HUP


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




[PHP] Read Files

2002-11-30 Thread Randum Ian
Hi all,

I have a directory of files which are split up into sections based on
'full', 'summary' and 'competitions'. This is shown in the filename as
follows:

ministry-full-6122002.inc

I want to be able to search thru the dir looking for all the 'full'
files, then sorting them by date and including them in my html page in
date order.

I am stuck however on how to get the relevant files, can anybody help
me?

Regards, Ian.



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




[PHP] Read Files

2002-11-30 Thread Randum Ian
Hi all,

I have a directory of files which are split up into sections based on
'full', 'summary' and 'competitions'. This is shown in the filename as
follows:

ministry-full-6122002.inc

I want to be able to search thru the dir looking for all the 'full'
files, then sorting them by date and including them in my html page in
date order.

I am stuck however on how to get the relevant files, can anybody help
me?

Regards, Ian.



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




Re: [PHP] Function passed as argument to function

2002-11-30 Thread Jason Wong
On Sunday 01 December 2002 03:54, Jeffrey B.Ferland wrote:
 std_layout(Title here, list_writings(poetry))

 both std_layout and list_writings are user-defined functions. std_layout()
 echo's the two arguments that it takes at select points in its execution. I
 want to the output of list_writings()  to be an argument for std_layout().

Hmm, what's the problem then?

Functions take any valid expressions as arguments. If list_writings() returns 
a valid expression then you should have no problems at all.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Play Rogue, visit exotic locations, meet strange creatures and kill them.
*/


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




Re: [PHP] Read Files

2002-11-30 Thread Chris Wesley
On Sat, 30 Nov 2002, Randum Ian wrote:

 I have a directory of files which are split up into sections based on
 'full', 'summary' and 'competitions'. This is shown in the filename as
 follows:

 ministry-full-6122002.inc

 I want to be able to search thru the dir looking for all the 'full'
 files, then sorting them by date and including them in my html page in
 date order.

To get an array full of the file names you want:

$interestingFiles = array();
$dir = opendir( /path/to/directory ) or die( Could not open dir );
while( $dirEntry = readdir( $dir ) ){
  if( ereg( full, $dirEntry) ){
   array_push( $interestingFiles, $dirEntry );
  }
}

I'll leave it up to you to sort $interestingFiles by the date in the
element values, since I don't recognize a date in your file-naming
convention.

g.luck,
~Chris



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




Re: [PHP] Function passed as argument to function

2002-11-30 Thread Jeffrey B . Ferland
On Saturday 30 November 2002 03:14 pm, you wrote:
 On Sunday 01 December 2002 03:54, Jeffrey B.Ferland wrote:
  std_layout(Title here, list_writings(poetry))
 
  both std_layout and list_writings are user-defined functions.
  std_layout() echo's the two arguments that it takes at select points in
  its execution. I want to the output of list_writings()  to be an argument
  for std_layout().

 Hmm, what's the problem then?

 Functions take any valid expressions as arguments. If list_writings()
 returns a valid expression then you should have no problems at all.

For reference, see http://autocracy.homelinux.org/template.php and 
http://autocracy.homelinux.org/error.php

template.php is the proper layout, and uses the same code as 
error.php, with the exception that LEFT SIDE TEXT has been replaced with 
'list_writings(poetry)'. Note that the output from that function occurs where 
it was placed within the code, not where it was called to...

Basically, instead of the output from list_writings(poetry) being passed to 
the function, it simply executes.

-Jeff
SIG: HUP

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




RE: [PHP] Read Files

2002-11-30 Thread Randum Ian
Thanks a lot Chris that was a great help.

The date is in the last part of the filename. In the example I have
posted below:

Ministry is the name of the club.
Full is the type of the content.
6122002 is the date - It is in the form ddmm so the example here is
6th December 2002.

Is there a simple way I can just grab the date and sort it by order?
Should I change the format of the date to make it easier or something?

-Original Message-
From: Chris Wesley [mailto:[EMAIL PROTECTED]] 
Sent: 30 November 2002 20:25
To: [EMAIL PROTECTED]
Cc: Randum Ian
Subject: Re: [PHP] Read Files

On Sat, 30 Nov 2002, Randum Ian wrote:

 I have a directory of files which are split up into sections based on
 'full', 'summary' and 'competitions'. This is shown in the filename as
 follows:

 ministry-full-6122002.inc

 I want to be able to search thru the dir looking for all the 'full'
 files, then sorting them by date and including them in my html page in
 date order.

To get an array full of the file names you want:

$interestingFiles = array();
$dir = opendir( /path/to/directory ) or die( Could not open dir );
while( $dirEntry = readdir( $dir ) ){
  if( ereg( full, $dirEntry) ){
   array_push( $interestingFiles, $dirEntry );
  }
}

I'll leave it up to you to sort $interestingFiles by the date in the
element values, since I don't recognize a date in your file-naming
convention.

g.luck,
~Chris



-- 
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




[PHP] domxml?

2002-11-30 Thread Devin

I am trying to compile PHP 4.3RC2 and enable the domxml
library but when I compile PHP it doesn't seem to work?

./configure --with-xml --with-domxml

Any ideas?


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




RE: [PHP] Read Files

2002-11-30 Thread Randum Ian
Would it just be easier to do it by file last modified date then?

-Original Message-
From: Jeffrey B.Ferland [mailto:[EMAIL PROTECTED]] 
Sent: 30 November 2002 21:57
To: Randum Ian
Subject: Re: [PHP] Read Files

On Saturday 30 November 2002 04:47 pm, you wrote:
 Thanks a lot Chris that was a great help.

 The date is in the last part of the filename. In the example I have
 posted below:

 Ministry is the name of the club.
 Full is the type of the content.
 6122002 is the date - It is in the form ddmm so the example here
is
 6th December 2002.

Date format is best set as -MM-DD, but most importantly having
leading 
0's. Ministry as in Ministry of Sounds?

 Is there a simple way I can just grab the date and sort it by order?
 Should I change the format of the date to make it easier or something?

Anyway, the easiest thing I can think of is to run a regex enumerating
all 
the files that are marked full and then sorting them from there by
regexing 
out the different dates. Even then, it'll take a good deal of coding...

-Jeff
SIG: HUP



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




Re: [PHP] Function passed as argument to function

2002-11-30 Thread Jason Wong
On Sunday 01 December 2002 04:43, Jeffrey B.Ferland wrote:
 For reference, see http://autocracy.homelinux.org/template.php and
 http://autocracy.homelinux.org/error.php

Unless you have a good reason to do otherwise please post your code here. 
People would be less inclined to help if they have to go about clicking on 
links to see what your problem is.

 template.php is the proper layout, and uses the same code as
 error.php, with the exception that LEFT SIDE TEXT has been replaced with
 'list_writings(poetry)'. Note that the output from that function occurs
 where it was placed within the code, not where it was called to...


1) Do you really mean list_writings(poetry), or did you in fact mean 
list_writings($poetry)?

 Basically, instead of the output from list_writings(poetry) being passed to
 the function, it simply executes.

2) How did you conclude that? Did you check that 
list_writings(poetry)/list_writings($poetry) gives the correct result? IE 
echo list_writings(poetry)/list_writings($poetry) ?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
You who hate the Jews so, why did you adopt their religion?
-- Friedrich Nietzsche, addressing anti-semitic Christians
*/


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




Re: [PHP] Test links?

2002-11-30 Thread Rob Packer
Thanks for the help and suggestions everybody!
I think some of my problems stemmed from the affiliate links being
redirected and PHP saw that as dead(so to speak)... but I think I got it
now. I made another column in the database to note a redirection for ones
that the url fails but the $url[host] passes.

Robert Packer


Chris Hewitt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Rob Packer wrote:

 Okay, I'm confused... file, fopen, and fsockopen seem to say not found on
 alot valid URLs...  does this look to be correct usage?
 $url = $row[0]; // just get the url from the db
 $fp = implode ('', file ($url));
  if (!$fp) {echo font color=redbUnable to access file/b/font; }
  else { fclose($fp); echo The link is working!; }
 
 It seems I always get this warning...
 
 Warning: Supplied argument is not a valid File-Handle resource in
 /web/home/nrc.net/www/robert/links4.php on line 11
 
 I think you have assigned $fp to be the imploded string, not a file
 pointer. Thus fclose($fp) would generate an error. Given this, I'm not
 sure what  if (!$fp) would mean.

 HTH
 Chris





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




Re: [PHP] How to override header info in mail()

2002-11-30 Thread Paul Nicholson
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

ok, what is on line 13 and on line 104?
That error is saying that you have a header() call on line 104 that I don't 
think should be there(The header command is not used with mail)if it 
should you'll have to look at output buffering.
~Pauly
http://php.net/manual/en/function.header.php
http://php.net/manual/en/function.mail.php
http://php.net/manual/en/ref.outcontrol.php


On Saturday 30 November 2002 02:37 pm, Phil Powell wrote:
 I'm sorry that didn't work either.. here is my error:

 Warning: Cannot add header information - headers already sent by (output
 started at /users/ppowell/web/recommend.php:13) in
 /users/ppowell/web/recommend.php on line 104


 Phil
 - Original Message -
 From: Paul Nicholson [EMAIL PROTECTED]
 To: Phil Powell [EMAIL PROTECTED]; [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Sent: Saturday, November 30, 2002 1:46 PM
 Subject: Re: [PHP] How to override header info in mail()

  Hey,
  The correct way of doing that is:
  if (!mail($to, $subject, $body, From: . $from .\r\nContent-type.

 $contentType)) {..}

  HTH!
  ~Paul
 
  On Saturday 30 November 2002 12:58 pm, Phil Powell wrote:
   I am using this line:
  
   if (!mail($to, $subject, $body, From:  . $from . ; .
   header(Content-type  . $contentType))) {..}
  
   to use the mail() function in PHP to send simple text/plain or
   text/html email.  However, upon attempting to send I get a warning
   message

 indicating

   that header information has already been set prior to emailing.
  
   Is there a way to overwrite only certain header information prior to
   emailing to ensure the content-type of the email being either
   text/plain

 or

   text/html?
  
   Just wondering
   Thanx
   Phil

- -- 
~Paul Nicholson
Design Specialist @ WebPower Design
[EMAIL PROTECTED]
www.webpowerdesign.net
The webthe way you want it!


It said uses Windows 98 or better, so I loaded Linux!
Registered Linux User #183202 using Register Linux System # 81891
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE96VjYDyXNIUN3+UQRArAqAKCLtc0i7iNJyCcZ14/midkP3JFZXACaAgfk
FBrQwCIlYgxRyj9UFNhh4HQ=
=XosZ
-END PGP SIGNATURE-

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




php-general Digest 1 Dec 2002 00:36:26 -0000 Issue 1736

2002-11-30 Thread php-general-digest-help

php-general Digest 1 Dec 2002 00:36:26 - Issue 1736

Topics (messages 126527 through 126580):

Re: Multidimensional arrays (more and more...)
126527 by: Paul Chvostek
126529 by: Paul Chvostek

Re: test for ascii or binary string
126528 by: Beth Gore
126532 by: Ernest E Vogelsinger

Re: Method for displaying Downline
126530 by: Rick Widmer
126531 by: Rick Widmer

Re: Test links?
126533 by: Rob Packer
126538 by: Jason Wong
126551 by: Rob Packer
126555 by: Jason Wong
126560 by: Beth Gore
126562 by: Chris Hewitt
126579 by: Rob Packer

Quota function
126534 by: EdwardSPL.ita.org.mo
126535 by: Jason Wong
126539 by: EdwardSPL.ita.org.mo
126541 by: Michael Sims

Language codes to textual languages.
126536 by: Noodle Snacks

Re: About Speech
126537 by: Mark Charette

Re: How Do I install php on Apache 2.0
126540 by: Tweak2x

Going Mad
126542 by: Andy
126543 by: Chris Hewitt
126544 by: Phil Driscoll
126545 by: Chris Hewitt
126546 by: Andy
126547 by: Chris Hewitt
126548 by: Andy
126556 by: Phil Driscoll
126558 by: Chris Hewitt
126565 by: Chris Hewitt

How to override header info in mail()
126549 by: Phil Powell
126557 by: Paul Nicholson
126580 by: Paul Nicholson

last updated ?
126550 by: Paul O'Neil
126552 by: Beth Gore
126559 by: Chris Hewitt

PHP confirmation window
126553 by: Lars Espelid
126563 by: Jason Sheets

Page break
126554 by: Lars Espelid

OS X and cURL Issues
126561 by: Weston Houghton
126564 by: Sterling Hughes

Redirect opening in a new window
126566 by: Troy May
126568 by: Jason Sheets
126569 by: Troy May

Function passed as argument to function
126567 by: Jeffrey B.Ferland
126572 by: Jason Wong
126574 by: Jeffrey B.Ferland
126578 by: Jason Wong

Read Files
126570 by: Randum Ian
126571 by: Randum Ian
126573 by: Chris Wesley
126575 by: Randum Ian
126577 by: Randum Ian

domxml?
126576 by: Devin

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]


--

---BeginMessage---

Well, counting is easy...  count($issue) will be correct.  If you want
to count things that match only specific elements, use things like:

  $c=0;
  foreach($issue as $what)
if ( $year==2003  $month=5 )
  $c++;

As I said in the previous email, to sort by array elements, you'd need
to use array_multisort.  Something like...

  $sortkey=array();
  foreach($issue as $what)
$sortkey[]=$what['number'];
  array_multisort($issue,$sortkey);

And for looping, foreach is still your best bet:

  foreach($issue as $key = $what) {
if ($what['senttosubscribers']==0)
  $issue[$key]['description'].= (EMPTY);
else
  $issue[$key]['description'].=str_replace( (EMPTY),,$what['description']);
  }

With regard to PHP being screwey, I haven't found this -- I use
multidimensional arrays quite a bit and find that they behave exactly as
I would predict.  Maybe I'm just lucky.  ;-)

p

On Thu, Nov 28, 2002 at 09:55:25AM -0800, Mako Shark wrote:
 
 Wow. This goes way beyond simply printing
 multidimensional arrays. Here's some sample data:
 
 $issue[][number] = number;
 $issue[][headline] = headling;
 $issue[][writers] = writers;
 $issue[][list] = list;
 $issue[][senttosubscribers] = 0;
 $issue[][month] = 05;
 $issue[][year] = 2003;
 $issue[][description] = description;
 
 What I need to do now is count(), sort() by number,
 and loop through this array.
 
 I read that PHP is screwy when counting and sorting
 multidimensional arrays, but they *have* to have come
 up with a method, right?

-- 
  Paul Chvostek [EMAIL PROTECTED]
  Operations / Abuse / Whatever  +1 416 598-
  it.canada - hosting and development  http://www.it.ca/


---End Message---
---BeginMessage---

On Thu, Nov 28, 2002 at 10:19:38AM -0800, Mako Shark wrote:
...
 My problem is I need to loop through these. So I can't
 just assume that the count is count($issue[]) divided
 by 8, because that won't work in a for loop. I suppose
 I could just iterate through my for loop in jumps of
 8, but that seems really hacky and unintuitive to
 whomever has to figure out my code when I'm gone.

By your description, count($issue)/count($issue[]) is the number of
real elements.  And a foreach loop will correctly step through whatever
array you pass to it, even if the values of that array are themselves
arrays.  Or could you try something like 

Re: [PHP] last updated ?

2002-11-30 Thread Morgan Hughes
 Dumb question here but whats the general practice regarding putting a
 website last updated: entry on a web page? Does the web master manually
 enter in today's date in a database table entry and let PHP display. Is it
 statically added to the HTML page? Etc...
 If you want website last updated then from a database sounds OK but
 where I'm working its commonly a page last updated wanted. In this
 case its just a manually entered date in html in the page.

  Or use stat() to get the page's mtime, something like

  ?
$stat = stat($HTTP_SERVER_VARS['SCRIPT_FILENAME']);
$date = strftime(%c, $stat[9]);
print Last update: $date;
  ?

  Which will be automatically updated...

-- 
   Morgan Hughes
   C programmer and highly caffeinated mammal.
   [EMAIL PROTECTED]
   ICQ: 79293356



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




RE: [PHP] Read Files

2002-11-30 Thread Chris Wesley
On Sat, 30 Nov 2002, Randum Ian wrote:

 Ministry is the name of the club.
 Full is the type of the content.
 6122002 is the date - It is in the form ddmm so the example here is
 6th December 2002.
 Is there a simple way I can just grab the date and sort it by order?
 Should I change the format of the date to make it easier or something?

It'd be easier to sort if you changed your date format a bit ... what you
have is rather difficult to work with, unless you take the string apart.
(i.e. - How is '7102002' not greater than '6122002'?)
For simplicity  ease, I work with date strings formatted as MMDD.
If your files were named something-full-MMDD, you could get a sorted
array of your files easily.

$interestingFiles = array();
$dir = opendir( /path/to/directory ) or die( Could not open dir );
while( $dirEntry = readdir( $dir ) ){
  if( ereg( full-([0-9]{8}), $dirEntry, $MATCH ) ){
   $interestingFiles[$MATCH[1]] = $dirEntry;
  }
}
ksort( $interestingFiles );

g.luck,
~Chris


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




[PHP] login_script_help needed.

2002-11-30 Thread Karl James
http://www.ultimatefootballleague.com/Create_Account.phps
 
hey people
 
I was wondering if anyone can tell me why I cant get this script to
work.
 
Or do you have an easier one I can use..
 
Thanks
Karl



Re: [PHP] Page break

2002-11-30 Thread Justin French
This is totally not PHP related.  There is a page-break: before; (or
similar) in CSS, so I suggest you go look around some CSS sites... like the
W3.org.

Justin

on 01/12/02 5:26 AM, Lars Espelid ([EMAIL PROTECTED]) wrote:

 Hello,
 
 Is there some way to insert page breaks in a php document so that it becomes
 more printer friendly.
 
 thanks
 lars
 
 

Justin French

http://Indent.com.au
Web Development  
Graphic Design



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




Re: [PHP] login_script_help needed.

2002-11-30 Thread Maxim Maletsky

what is on your line 22?

-- 
Maxim Maletsky
[EMAIL PROTECTED]


On Sat, 30 Nov 2002 20:46:12 -0800 Karl James [EMAIL PROTECTED] wrote:

 http://www.ultimatefootballleague.com/Create_Account.phps
  
 hey people
  
 I was wondering if anyone can tell me why I cant get this script to
 work.
  
 Or do you have an easier one I can use..
  
 Thanks
 Karl


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




Re: [PHP] Redirect opening in a new window

2002-11-30 Thread Maxim Maletsky

isn't there an only module you could modify? Do you really need to edit
2000 pages? I am not NUKE fan, but I am sure there is an easier way
-- 
Maxim Maletsky
[EMAIL PROTECTED]


On Sat, 30 Nov 2002 12:09:33 -0800 Troy May [EMAIL PROTECTED] wrote:

 That easy solution is not so easy for me.  This portal system is PHP-Nuke.
 There's different themes, pages, etc.  It would take me 3 weeks to find and
 edit all the links in a 2000 file directory.
 
 I just need to be able to do this from the called module itself, and that
 would take care of all the pages/themes in one shot.
 
 
 
 -Original Message-
 From: Jeffrey B.Ferland [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, November 30, 2002 12:02 PM
 To: Troy May
 Subject: Re: [PHP] Redirect opening in a new window
 
 
 On Saturday 30 November 2002 02:55 pm, you wrote:
  Hello,
 
  I'm playing with a portal system now and I need to edit a module to
  redirect to another site/page.  I have done this with a header()
  redirection, but it takes the current window.
 
  How can I do this and have it open a new window for the redirect?
 
 a href=/link.htm target=_blankDisplayed Link/a
 
 
 -Jeff
 SIG: HUP
 
 
 -- 
 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




[PHP] Problem importing LARGE text file.....

2002-11-30 Thread CDitty
Hello all,

I am trying to import a 400 meg pipe delimited text file, but I am having 
problems.  For some reason, it will only read in 320 lines and then it will 
cause a core dump.  I have used this same script to import a 350 meg file 
with no problems.  I have talked with my support and they believe it could 
be some type of problem or limitation with php.

Can anyone offer any advice on how to track this down?  When I look at the 
core file, this is what it says...core: ELF 32-bit LSB core file of 'php' 
(signal 11), Intel 80386, version 1

CDitty


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



Re: [PHP] Test links?

2002-11-30 Thread Hugh Danaher

Not sure how to supress the warning message that PHP automatically does
when you haven't got a valid URL though.

should be able to surpress errors by adding an * before the result variable

*$fp = fopen($linkdata['linkurl'],r);

Hope this helps--or even works for this particular problem.
Hugh

- Original Message -
From: Beth Gore [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, November 30, 2002 11:02 AM
Subject: Re: [PHP] Test links?


 Rob Packer wrote:

 Okay, I'm confused... file, fopen, and fsockopen seem to say not found on
 alot valid URLs...  does this look to be correct usage?
 $url = $row[0]; // just get the url from the db
 $fp = implode ('', file ($url));
  if (!$fp) {echo font color=redbUnable to access file/b/font; }
  else { fclose($fp); echo The link is working!; }
 
 It seems I always get this warning...
 
 Warning: Supplied argument is not a valid File-Handle resource in
 /web/home/nrc.net/www/robert/links4.php on line 11
 
 If someone can tell me what I'm doing wrong, I'd appreciate it.
 
 Thanks,
 Robert
 
 
 
 
 
 When fopen successfully opens a file it populates an array
 $http_response_header, which you can examine to see if the link works or
 not - I don't believe you can actually get the file itself, but since
 that's not what we're after that's not a problem!

 Having said that, fopen produces a very annoying error if it doesn't
 find the page, but I found the following works:

 ?php

 $SQL = SELECT linkurl, linkID FROM links;
 $result = mysql_query($SQL);

 while($linkdata = mysql_fetch_array($result)){

 $fp = fopen($linkdata['linkurl'],r);
 if($fp)
 {
 echo p.$linkdata['linkurl']. is still valid./p;

 }else{

 echo p.$linkdata['linkurl']. is invalid. Updating
 database... ;

 $SQL = UPDATE links SET status = 0 WHERE linkID =
 '.$linkdata['linkID'].';
 $result2 = mysql_query($SQL);
 if($result2)
 {
 echo Database updated/p;
 }
 }

 }
 ?

 Rather than deleting the link, it's probably better to set a flag to
 show it was invalid last time you checked, but check it again next time.
 Or you could keep a count of the  number of failed attempts, and delete
 if it goes beyond 3 or so.

 Not sure how to supress the warning message that PHP automatically does
 when you haven't got a valid URL though.

 Hope this works for you!

 Beth Gore
 --
 http://bethanoia.dyndns.org


 --
 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