Re: [PHP] Re: help condensing regular expressions

2002-04-06 Thread Tom Rogers

Hi
I have never used .htaccess but I'll read up on it, I am the ISP so it 
won't be a problem :)

Tom

At 06:12 PM 6/04/2002, Chris Adams wrote:
In article [EMAIL PROTECTED], Tom
Rogers wrote:
  Thats what I was after :)

Glad I could help.

  At the top of each page I now do
 
  $reltoroot = preg_replace(|/[^/]+|, ../, 
 dirname($_SERVER['PHP_SELF']));
  ini_set 
 (include_path,ini_get(include_path).:.$reltoroot.../include);
 
  which takes care of the include path

Out of curiosity, couldn't you put something like
php_value include_path .:/document/root/include:/usr/lib/php

in a .htaccess file? Or has your ISP disabled .htaccess files?

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] Re: Headers not working

2002-04-06 Thread Michael Virnstein

this might be because you use the cgi version of php. to be able to send
e.g.
404 header, you have to run php as webserver module which currently only
works with apache and linux afaik. otherwise these headers get send by the
webserver and you cannot affect them.

if you use php with apache as module, you should use this:

header('WWW-Authenticate: Basic realm=Private');
header('HTTP/1.0 401 Unauthorized');

or look at this tutorial: http://www.zend.com/zend/tut/authentication.php



Sheridan Saint-Michel [EMAIL PROTECTED] schrieb im Newsbeitrag
002501c1dccb$75fd7060$[EMAIL PROTECTED]">news:002501c1dccb$75fd7060$[EMAIL PROTECTED]...
 I was trying to write a some code that would disallow specific users
access
 to certain pages.  I had thought this would be as simple as looking at
 $PHP_AUTH_USER and sending a 401 header if it was a user that shouldn't
have
 access to that page.

 The problem is the HTTP header was not going out.  I tried 404 and 401,
and
 then I thought perhaps the HTTP authentication was preventing me from
 sending the header, so I tried several different headers (all copied and
 pasted from the PHP manual) in an unprotected directory.  I also tried
both
 IE6 and Mozilla to make sure there wasn't a borwser issue.

 The header line seems to be completely overlooked as things echoed below
the
 header were appearing in the original script.

 The test scripts in the unprotected directory are all very simple, for
 example:

 ?php
   header(Status: 404 Not Found);
 ?

 I have saved three test scripts as both .php and .phps so you can view
them.
 In addition, I put up an info.php so you can see my entire PHP config in
 case that is the problem. (links below).  Also header(Location:) seems to
 work without any problems.

 So what am I overlooking?

 http://www.foxjet.com/info.php
 http://www.foxjet.com/test1.php
 http://www.foxjet.com/test1.phps
 http://www.foxjet.com/test2.php
 http://www.foxjet.com/test2.phps
 http://www.foxjet.com/test3.php
 http://www.foxjet.com/test3.phps

 Sheridan Saint-Michel
 Website Administrator
 FoxJet, an ITW Company
 www.foxjet.com




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




[PHP] limit posts and have a next page?

2002-04-06 Thread Hawk

This is just speculations, but I thought I'd as well ask now before I get to
work
Lets say I have a news page, and I only want the last ten posts to show on
it, then I ORDER BY id ASC LIMIT 10 right?
but how do I add the next page?
count rows from the database and see if its more than 10 lines, and then ?
saw something about a MAX and a MIN mysql command, but how do I use it? and
should I use it for that purpose? :)
like... ORDER BY id ASC LIMIT 10 MIN(10) MAX(20) or something?
I dont know really.. just speculations as I said :)

Håkan



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




Re: [PHP] limit posts and have a next page?

2002-04-06 Thread Jason Wong

On Saturday 06 April 2002 16:57, Hawk wrote:
 This is just speculations, but I thought I'd as well ask now before I get
 to work
 Lets say I have a news page, and I only want the last ten posts to show on
 it, then I ORDER BY id ASC LIMIT 10 right?
 but how do I add the next page?
 count rows from the database and see if its more than 10 lines, and then ?
 saw something about a MAX and a MIN mysql command, but how do I use it? and
 should I use it for that purpose? :)
 like... ORDER BY id ASC LIMIT 10 MIN(10) MAX(20) or something?
 I dont know really.. just speculations as I said :)

Rather than indulging in idle speculation, consult the mysql manual :)

For the first 10:

  ... ORDER BY id ASC LIMIT 0, 10 


For the next 10:

  ... ORDER BY id ASC LIMIT 10, 10 


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

/*
Nothing is so firmly believed as that which we least know.
-- Michel de Montaigne
*/

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




[PHP] htmlentities

2002-04-06 Thread Joerg Hanke [ML-php]

hi!

i've got the following problem and hope one of you is able to help me
solving that:

i've got a system in php that writes data (e.g. variable-name = $data)
to a mysql database. there are two more scripts: one for displaying the
data and one for writing the data into a formular. the displaying-script
includes a link to the formular-script which submits the values for
$data. i use the command 'htmlentities' to express the value (there is
an html-tag like img src=http:...) correctly. when the
formular-script is executed via this link i get a wrong result: img
src=\\ there are these backslashes...


what 2 do??

thX,
George


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




Re: [PHP] nl2br returns BR /? normality or a bug?

2002-04-06 Thread James Arthur

On Saturday 06 Apr 2002 07:56, Miguel Cruz wrote:
 On Sat, 6 Apr 2002, Justin French wrote:
  on 06/04/02 11:05 AM, Maxim Maletsky ([EMAIL PROTECTED]) 
wrote:
  It DOES NOT work fine in every browser. I'd love to give you a prov, but
  because I am lazy I will just tell you this formula:
 
  Again.  I was only stating MY experience.  Every browser I can get my
  hands on.  I do extensive testing, and have never seen a BR or BR/
  or BR / misbehave.
 
  If you have seen it perform unexpectedly, I'm keen to hear about.

 For what it's worth, I just tried on the following browsers (all I have at
 my disposal at home) and it works fine:

 links 0.96
 lynx 2.8.3
 Opera 5.0.498 (Mac)
 IE 5.1.3 (Mac)
 Mozilla 0.9.9 (Mac)
 Netscape 6.1 (Mac)

Add Konqueror on Linux to this list.

Also note that links 0.84 (the latest version on Debian Stable) does _not_ 
parse XHTML tags correctly.

--jaa

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




Re: [PHP] htmlentities

2002-04-06 Thread Jason Wong

On Saturday 06 April 2002 18:34, Joerg Hanke [ML-php] wrote:
 hi!

 i've got the following problem and hope one of you is able to help me
 solving that:

 i've got a system in php that writes data (e.g. variable-name = $data)
 to a mysql database. there are two more scripts: one for displaying the
 data and one for writing the data into a formular. the displaying-script
 includes a link to the formular-script which submits the values for
 $data. i use the command 'htmlentities' to express the value (there is
 an html-tag like img src=http:...) correctly. when the
 formular-script is executed via this link i get a wrong result: img
 src=\\ there are these backslashes...


 what 2 do??

You most likely have magic_quotes_runtime enabled in php.ini. Either 
disable it or use stripslashes() on the data you retrieve from the db.

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

/*
Loan-department manager:  There isn't any fine print.  At these
interest rates, we don't need it.
*/

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




[PHP] using font properties in generated posts.

2002-04-06 Thread Randum Ian

Hi there, I want to use text in a textarea to be submitted and converted
into an email with Rich Text.

Can someone please tell me what I need to add in the additional headers in
order for me to do this please?

Kind Regards,

Ian Roke
Webmaster, DancePortal (UK) Limited
[EMAIL PROTECTED]
http://www.danceportal.co.uk
DancePortal.co.uk - Global dance music media


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




[PHP] How to convert a website to a txtfile....?

2002-04-06 Thread Raymond Lilleodegard

Hi!

I have this website with a webshop that customers can order some products.
And when the products are listed up in the cart on the screen, would I like
to get the output
into a new txtfile and save it on the server. Then it is possible to get it
faxed, and that is the goal.

Anyone who has done this before?

Thanks for all help!

Best regards

Raymond Lilleodegard



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




[PHP] regular expressions: HUGE speed differences

2002-04-06 Thread Ando

Im using a regular expression, to get all urls from a file.
When using it on the webserver, it processes a 25kb html file
about 0.25 seconds (PIII 350, 128mb ram, linux 2.2.13-7mdk, php 3.0.12).

When i try the same on my machine (Celeron 300A, 192mb ram.), it does it
about 14-17 seconds, which is about 60-70 times slower.
Tested it on:
redhat 7.2, php 4.1.1 - 16 seconds
windows 98, php 4.1.1 - 14 seconds
windows 98, php 3.0.12 - 17 seconds.

The machine speed differences arent that big, especially considering
that other(simpler) regexps run at the almost the same speed (20-30%
difference).

Where can this enourmous speed difference come from

Regexp im using is following:

while
(eregi((frame[^]*src[[:blank:]]*=|href[[:blank:]]*=|http-equiv=['\]refresh['\]
*content=['\][0-9]+;url[[:blank:]]*=|window[.]location[[:blank:]]*=|window[.]open[[:blank:]]*[(])[[:blank:]]*[\'\]?(([[a-z]{3,5}://(([.a-zA-Z0-9-])+(:[0-9]+)*))*([:%/?=;\\,._a-zA-Z0-9-]*))(#[.a-zA-Z0-9-]*)?[\'\
]?,$file,$regexp))
{
print $regexp[2].\n;
$file=str_replace($regexp[0], , $file);
}

Anyone care to test it on there machine? Full code (20 lines) with
timing function would be:
?
function getmicrotime(){
list($usec, $sec) = explode( ,microtime());
return ((float)$usec + (float)$sec);
}
//change to some html file around 25kb in size
$lines = file('test.html');
if (is_array($lines))
{
while (list($id,$line) = each($lines))
   $file .= $line;
   }

$start_time=getmicrotime();

while
(eregi((frame[^]*src[[:blank:]]*=|href[[:blank:]]*=|http-equiv=['\]refresh['\]
*content=['\][0-9]+;url[[:blank:]]*=|window[.]location[[:blank:]]*=|window[.]open[[:blank:]]*[(])[[:blank:]]*[\'\]?(([[a-z]{3,5}://(([.a-zA-Z0-9-])+(:[0-9]+)*))*([:%/?=;\\,._a-zA-Z0-9-]*))(#[.a-zA-Z0-9-]*)?[\'\
]?,$file,$regexp))
 {
 print $regexp[2].\n;
 $file=str_replace($regexp[0], , $file);
 }
$end_time = getmicrotime()- $start_time;
print Completed in .$end_time. seconds;
?


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




[PHP] Executing functions within ereg_replace() output

2002-04-06 Thread Adam Wan

I'm really curious as to how to output data from ereg_replace() in a
standard way.

I'm familiar with \\1 to ouput the original string, but not sure as to how
I can use functions within the output parameter to process this value
further.

-
// here is a simple example of what i'm trying to do

$content = 'string string 12463409834234 string string';
$content = ereg_replace( [0-9]{14} , substr(\\1,0,5) , $content );

// this is the output i want, but the above doesnt seem to be the right way
to generate it.

string string 12363 string string


any ideas?
-Adam



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




[PHP] Mystery Binary Characters in My Files

2002-04-06 Thread Jeff Levy

or How I Learned To Stop Breathing and Oxygenate By Osmosis...

Hello,

I'm having a problem, hopefully the experts in this group can help me
around it.

I read in the contents of an old mysql database, and made XML files out
of the data contained in it. The total job came out to about 6800 files,
or Documents.

I'm finding that, sporadically, when reading these XML files, and passing
the xmldata to sablotron, I'm getting sablotron errors. These errors stem
from characters I'm finding throughout these documents. This is the meat
of my problem.

I take a look at a file which is giving errors by using 'less'. When
looking at the file, I'll see chars like this: A1 or 91 or 92 and
so on, and so on. The chars are hilighted in bold reverse text,
indicating that they are 'binary'??. I'm not sure whether to call them
binary or hex... perhaps someone can tell me how to appropriately address
these chars...

Anyhow... these chars sometimes correspond to valid characters. Such as
A9... this is a copyright char, or amp;copy.

I've been manually replacing these characters as errors are generated,
but it's getting a little tiring.

Is there anyway I can force PHP to either strip out these 'binary'
characters, or whatever they are, when I read the file?

Is there any way to keep php from saving these chars to NEW documents
when they are created?

Does anyone even know what I'm talking about?? hehe.

Thanks for any help, I hope to hear from someone about this.

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




[PHP] F/U on Returned Mail

2002-04-06 Thread Anthony Rodriguez

In line 6 (below) I tried both Return_Path:[EMAIL PROTECTED] and 
[EMAIL PROTECTED]. I still don't get back the e-mail sent to a 
non-existent address.

Can you help?

Thank you!

Anthony Rodriguez
([EMAIL PROTECTED])

--- PHP script ---

(1) ?php
(2) mail([EMAIL PROTECTED],
(3) Test,
(4) Test,
(5) From:SBW Research [EMAIL PROTECTED]\r\n.
(6) [EMAIL PROTECTED]\r\n);
(7) exit;
(8) ?


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




Re: [PHP] F/U on Returned Mail

2002-04-06 Thread Jason Wong

On Saturday 06 April 2002 21:33, Anthony Rodriguez wrote:
 In line 6 (below) I tried both Return_Path:[EMAIL PROTECTED] and

There needs to be a space after the colon -

Return_Path: [EMAIL PROTECTED]

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

/*
I'm pretending I'm pulling in a TROUT!  Am I doing it correctly??
*/

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




Re: [PHP] regular expressions: HUGE speed differences

2002-04-06 Thread heinisch


PIII 400MHz, 512Mb, SuSe 6.4, 2.2.14 smp, php 3.0.16, Completed in 
0.76187908649445 seconds
PIII 350MHz, 256Mb, Suse 7.3, 2.4.9, php 4.0.6, Completed in 
2.6342689990997 seconds
File Size:28537kb,
But for real tests, send the original file you use direct

BTW How the hell did you develop this monstrous eregi?
For better maintenance, I´d cut it in several pieces,
or first make the inputfile smaller using grep  a href  to test.file , 
This will reduce
fileaccess a lot, and takes microseconds to proceed.
Oliver
At 06.04.2002  15:01, you wrote:

Im using a regular expression, to get all urls from a file.
When using it on the webserver, it processes a 25kb html file
about 0.25 seconds (PIII 350, 128mb ram, linux 2.2.13-7mdk, php 3.0.12).

When i try the same on my machine (Celeron 300A, 192mb ram.), it does it
about 14-17 seconds, which is about 60-70 times slower.
Tested it on:
redhat 7.2, php 4.1.1 - 16 seconds
windows 98, php 4.1.1 - 14 seconds
windows 98, php 3.0.12 - 17 seconds.

The machine speed differences arent that big, especially considering
that other(simpler) regexps run at the almost the same speed (20-30%
difference).

Where can this enourmous speed difference come from
snip

Anyone care to test it on there machine? Full code (20 lines) with
timing function would be:
?
function getmicrotime(){
 list($usec, $sec) = explode( ,microtime());
 return ((float)$usec + (float)$sec);
 }
//change to some html file around 25kb in size
$lines = file('test.html');
if (is_array($lines))
 {
 while (list($id,$line) = each($lines))
$file .= $line;
}

$start_time=getmicrotime();

while
(eregi((frame[^]*src[[:blank:]]*=|href[[:blank:]]*=|http-equiv=['\]refresh['\]
*content=['\][0-9]+;url[[:blank:]]*=|window[.]location[[:blank:]]*=|window[.]open[[:blank:]]*[(])[[:blank:]]*[\'\]?(([[a-z]{3,5}://(([.a-zA-Z0-9-])+(:[0-9]+)*))*([:%/?=;\\,._a-zA-Z0-9-]*))(#[.a-zA-Z0-9-]*)?[\'\
]?,$file,$regexp))
  {
  print $regexp[2].\n;
  $file=str_replace($regexp[0], , $file);
  }
$end_time = getmicrotime()- $start_time;
print Completed in .$end_time. seconds;
?


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




Re: [PHP] F/U on Returned Mail

2002-04-06 Thread heinisch

At 06.04.2002  08:33, you wrote:
In line 6 (below) I tried both Return_Path:[EMAIL PROTECTED] and 
[EMAIL PROTECTED]. I still don't get back the e-mail sent to a 
non-existent address.

Can you help?


(1) ?php
(2) mail([EMAIL PROTECTED],
(3) Test,
(4) Test,
(5) From:SBW Research [EMAIL PROTECTED]\r\n.
(6) [EMAIL PROTECTED]\r\n);

try Reply-To: [EMAIL PROTECTED]\r\n);

(7) exit;
(8) ?
Maybe you should replace \r\n by a single \n (only a suggestion as I work 
on LAMP, never dealed
with \r\n, but never had probs)
HTH Oliver


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




Re: [PHP] Mystery Binary Characters in My Files

2002-04-06 Thread heinisch

At 06.04.2002  08:36, you wrote:

I read in the contents of an old mysql database, and made XML files out
of the data contained in it. The total job came out to about 6800 files,
or Documents.

I'm finding that, sporadically, when reading these XML files, and passing
the xmldata to sablotron, I'm getting sablotron errors. These errors stem
from characters I'm finding throughout these documents. This is the meat
of my problem.

I take a look at a file which is giving errors by using 'less'. When
looking at the file, I'll see chars like this: A1 or 91 or 92 and
so on, and so on. The chars are hilighted in bold reverse text,
indicating that they are 'binary'??. I'm not sure whether to call them
binary or hex... perhaps someone can tell me how to appropriately address
these chars...

Anyhow... these chars sometimes correspond to valid characters. Such as
A9... this is a copyright char, or amp;copy.

I've been manually replacing these characters as errors are generated,
but it's getting a little tiring.

Is there anyway I can force PHP to either strip out these 'binary'
characters, or whatever they are, when I read the file?

Is there any way to keep php from saving these chars to NEW documents
when they are created?

Does anyone even know what I'm talking about?? hehe.
Seems that you work on a win*box, as a tip (don´t know if it works, as I 
use LAMP)
try manual - string functions -

get_html_translation_table — Returns the translation table used by 
htmlspecialchars() and htmlentities()
htmlentities — Convert all applicable characters to HTML entities
htmlspecialchars — Convert special characters to HTML entities

Maybe here you´ll find something that make you happy.
Otherwise, as I learned the last two weeks on the list, ereg_replace or 
eregi could
make your life easier.
HTH Oliver


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




Re: [PHP] F/U on Returned Mail

2002-04-06 Thread Jason Wong

On Saturday 06 April 2002 22:58, [EMAIL PROTECTED] wrote:

 Maybe you should replace \r\n by a single \n (only a suggestion as I work
 on LAMP, never dealed
 with \r\n, but never had probs)


The standard (ie correct) way is \r\n.

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

/*
Q:  Why did the chicken cross the road?
A:  He was giving it last rites.
*/

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




Re: [PHP] limit posts and have a next page?

2002-04-06 Thread The_RadiX

Yes I have built many a forums and product listings/search engines like this..


simply make it check using COUNT how many rows there are total..


now let's say your viewing page 1..

so we can see listing 1 - 10 therefore the first offset is 1

so the next set will logically be 11-20

so with this info:

?
$page=(isset($HTTP_GET_VARS[page])?$HTTP_GET_VARS[page]?1);
$item_count=mysql_fetch_array(mysql_query(SELECT count(*) FROM tablename,$DB));
if($item_count-$page10) echo a href=.$PHP_SELF.?page=.($page+10).Next Page 
/a;
?


now as you can see I use $HTTP_GET_VARS[page] here so this means that the page will 
add in the GET var by itself as the user browses around the place..

For extra functionality: (code from before plus some new bits)

?
$page=(isset($HTTP_GET_VARS[page])?$HTTP_GET_VARS[page]?1);
$item_count=mysql_fetch_array(mysql_query(SELECT count(*) FROM tablename,$DB));
if($page10) echo a href=.$PHP_SELF.?page=.($page-10). Previous Page/a;
if($item_count-$page10) echo a href=.$PHP_SELF.?page=.($page+10).Next Page 
/a;
?

this simply adds a backward control to the form as well..


from here you can design it as you wish... generally placed in a table on bottom left 
and right, using this same system you can also expand it to create a numerical fast 
page index at the bottom with a listing of available pages (1 2 3 4 5 6) as links etc..


endless possibilities..





okay then... I hope I was able to help someone out here..






:::
Julien Bonastre [The-Spectrum.org CEO]
A.K.A. The_RadiX
[EMAIL PROTECTED]
ABN: 64 235 749 494
Mobile: 0407 122 268
QUT Student #: 04475739
:::




- Original Message - 
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, April 06, 2002 7:25 PM
Subject: Re: [PHP] limit posts and have a next page?


 On Saturday 06 April 2002 16:57, Hawk wrote:
  This is just speculations, but I thought I'd as well ask now before I get
  to work
  Lets say I have a news page, and I only want the last ten posts to show on
  it, then I ORDER BY id ASC LIMIT 10 right?
  but how do I add the next page?
  count rows from the database and see if its more than 10 lines, and then ?
  saw something about a MAX and a MIN mysql command, but how do I use it? and
  should I use it for that purpose? :)
  like... ORDER BY id ASC LIMIT 10 MIN(10) MAX(20) or something?
  I dont know really.. just speculations as I said :)
 
 Rather than indulging in idle speculation, consult the mysql manual :)
 
 For the first 10:
 
   ... ORDER BY id ASC LIMIT 0, 10 
 
 
 For the next 10:
 
   ... ORDER BY id ASC LIMIT 10, 10 
 
 
 -- 
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 
 /*
 Nothing is so firmly believed as that which we least know.
 -- Michel de Montaigne
 */
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 



[PHP] - Flock manual clarification please ;-)

2002-04-06 Thread Matt Friedman

From the manual:

snip
Note: Because flock() requires a file pointer, you may have to use a
special lock file to protect access to a file that you intend to
truncate by opening it in write mode (with a w or w+ argument to
fopen()).
/snip

The manual indicates that you may need to use a special lock file if
you intend to open a file with w or w+. I wrote some code to examine
this. (2 files) Each file locks a file after opening using w to do so.
Then, the file is locked using LOCK_EX. Subsequently executed, each file
appears to respect the lock applied by the other file. (Each file waits
for the lock to be released by the other) - So, I don't see this manual
entry applying in this case.

In regards to the snip above, under what circumstances might you have
to create a separate lock file? Is this an OS issue? Is it an issue when
concurrency is high? The manual says you may have to; I am looking for
some clarification as to when exactly you may have to follow the
snip advice.

Thanks as always,

Matt Friedman
Web Applications Developer
www.SpryNewMedia.com




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




Re: [PHP] Mystery Binary Characters in My Files

2002-04-06 Thread Jeff Levy

I already do an htmlentities/specialchars on input data, but some of
these characters are still creeping in...

is there any way, on fread(), to strip out these boolsh*t chars?

On Sat, 06 Apr 2002 10:04:11 -0500, heinisch wrote:

 At 06.04.2002  08:36, you wrote:
 
I read in the contents of an old mysql database, and made XML files out
of the data contained in it. The total job came out to about 6800 files,
or Documents.

I'm finding that, sporadically, when reading these XML files, and
passing the xmldata to sablotron, I'm getting sablotron errors. These
errors stem from characters I'm finding throughout these documents. This
is the meat of my problem.

I take a look at a file which is giving errors by using 'less'. When
looking at the file, I'll see chars like this: A1 or 91 or 92 and
so on, and so on. The chars are hilighted in bold reverse text,
indicating that they are 'binary'??. I'm not sure whether to call them
binary or hex... perhaps someone can tell me how to appropriately
address these chars...

Anyhow... these chars sometimes correspond to valid characters. Such as
A9... this is a copyright char, or amp;copy.

I've been manually replacing these characters as errors are generated,
but it's getting a little tiring.

Is there anyway I can force PHP to either strip out these 'binary'
characters, or whatever they are, when I read the file?

Is there any way to keep php from saving these chars to NEW documents
when they are created?

Does anyone even know what I'm talking about?? hehe.
 Seems that you work on a win*box, as a tip (don´t know if it works, as I
 use LAMP)
 try manual - string functions -
 
 get_html_translation_table — Returns the translation table used by
 htmlspecialchars() and htmlentities() htmlentities — Convert all
 applicable characters to HTML entities htmlspecialchars — Convert
 special characters to HTML entities
 
 Maybe here you´ll find something that make you happy. Otherwise, as I
 learned the last two weeks on the list, ereg_replace or eregi could make
 your life easier.
 HTH Oliver


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




[PHP] how to sort by value in associative array

2002-04-06 Thread Peter J. Schoenster

Hi,

I have the array below and I want to sort on language. Can't figure it 
out. Below the array is what I tried

$ArrayOfNewsLinks = array(
  http://dailynews.yahoo.com/fc/World/Brazil/; = array(
title = 'Yahoo Brazil News',
category  = 'news',
language = 'English',

  ),
  http://news.bbc.co.uk/hi/english/world/americas/default.stm; = 
array(
title = 'BBC News',
category  = 'news',
language = 'English',

  ),
);

function cmp ($a, $b) {
if ($a[2] == $b[2]) return 0;
//return strcmp ( $a[2], $b[2]); // thought this would work
return ($a[1]$b[1])?1:-1; 
}


uksort ($ArrayOfNewsLinks, cmp);

But then I do this:

while (list ($key, $val) = each ($ArrayOfNewsLinks)) {  
$NewsLinks .= 
p class=\CompactLinks\
a href=\$key\ title=\$val[language] $val[title]\ 
target=\new\$val[title]/a
/p

;

}

And the order is not by language.

Peter

http://www.readbrazil.com/
Answering Your Questions About Brazil

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




[PHP] MAC file upload

2002-04-06 Thread Shane McBride

Hello,

I am able to upload and download Macintosh files but they seem to lose their
MIME type or extensions. I'm not sure what it is. I'm not a Mac dude.

When you download the file It loses the file association. It's for a company
I do work for that uses a lot of .ai and .psd files.


Any ideas on this?


Shane McBride
RDI Technologies
www.rditech.net
Office: 410-575-6326
Fax:410-575-6327


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




Re: [PHP] Can't get this code to work...

2002-04-06 Thread Analysis Solutions

On Sat, Apr 06, 2002 at 12:32:33AM -0500, Analysis  Solutions wrote:
 
 input type=checkbox name=checkbox['Name'] value=validate /

And following up to my own following up...  As I shut down the computer, 
I realized I made a boo boo.  The single quotes shouldn't be there.  So, 
make that:
  input type=checkbox name=checkbox[Name] value=validate /

Later,

--Dan

-- 
PHP scripts that make your job easier
  http://www.analysisandsolutions.com/code/
 SQL Solution  |  Layout Solution  |  Form Solution
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409

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




[PHP] Newbie and includes

2002-04-06 Thread Dean Ouellette

Newbie who has my include working with this
?php
include ('includes/footer.php');
?
 
Problem is when I try to use this with files in other directories I use
?php
include ('/includes/footer.php');
?
 
Then get file cannot be found.  Is there a way to do this?
 
Dean



[PHP] Re: Newbie and includes

2002-04-06 Thread Timothy J. Luoma

On Sat, 6 Apr 2002, Dean Ouellette wrote:

 Newbie who has my include working with this
 ?php
 include ('includes/footer.php');
 ?

 Problem is when I try to use this with files in other directories I use
 ?php
 include ('/includes/footer.php');
 ?

 Then get file cannot be found.  Is there a way to do this?

You have to prepend the directory that the web server knows, such as
/usr/local/apache/htdocs/includes/footer.php


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




Re: [PHP] MAC file upload

2002-04-06 Thread Miguel Cruz

On Sat, 6 Apr 2002, Shane McBride wrote:
 I am able to upload and download Macintosh files but they seem to lose
 their MIME type or extensions. I'm not sure what it is. I'm not a Mac
 dude.
 
 When you download the file It loses the file association. It's for a
 company I do work for that uses a lot of .ai and .psd files.

Macs running OS=9 don't natively rely on extensions to keep track of file
types; something ending in .psd can be a Word file, .doc can be a PDF,
.pdf can be a JPEG, what have you. The name is just the name, nothing
more, nothing less.

Instead, they rely on metadata stored in the directory entry (parallel to 
name, creation date, etc.) that identifies the application that created 
the file and the data type contained inside. 

When you transfer a file between a Mac and another system, it's up to the
application doing the transferring to reconstruct the data type info. Many
apps do it based on extension, but not all of them know a huge number of
extensions (they may know .gif, .html, .txt, etc.). And the MIME type you
send may override their guess. You should find out what MIME type you are 
sending and what 4-character Type and Creator info is getting saved; 
that'll help immensely in troubleshooting.

Macs running OSX are willing to use extensions in addition to the Mac
style system.

miguel


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




[PHP] HELP!

2002-04-06 Thread Georgie Casey

I need to execute a script on another server in one of my scripts, eg by
visiting a link
http://www.com.com/script.php?var1=blahvar2=blah

i cant use curl or sockets as my server dont have them insatlled. what other
options do i have?
the variables being passed are sensitive so they cant be viewed in the
source HTML

--
Regards,
Georgie Casey
[EMAIL PROTECTED]

***
http://www.filmfind.tv
Online Film Production Directory
***



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




Re: [PHP] using font properties in generated posts.

2002-04-06 Thread Miguel Cruz

On Sat, 6 Apr 2002, Randum Ian wrote:
 Hi there, I want to use text in a textarea to be submitted and converted
 into an email with Rich Text.
 
 Can someone please tell me what I need to add in the additional headers in
 order for me to do this please?

Content-Type: text/enriched

http://www.cis.ohio-state.edu/cgi-bin/rfc/rfc1896.html

miguel


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




Re: [PHP] HELP!

2002-04-06 Thread Miguel Cruz

On Sat, 6 Apr 2002, Georgie Casey wrote:
 I need to execute a script on another server in one of my scripts, eg by
 visiting a link
 http://www.com.com/script.php?var1=blahvar2=blah
 
 i cant use curl or sockets as my server dont have them insatlled. what
 other options do i have? the variables being passed are sensitive so
 they cant be viewed in the source HTML

You can use almost any of the filesystem functions to send that request to 
the remote server and collect the output. The request data will not be 
visible in the HTML you send to the end-user's browser unless you choose 
to make it so.

miguel


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




Re: [PHP] How to convert a website to a txtfile....?

2002-04-06 Thread Miguel Cruz

On Sat, 6 Apr 2002, Raymond Lilleodegard wrote:
 I have this website with a webshop that customers can order some products.
 And when the products are listed up in the cart on the screen, would I like
 to get the output
 into a new txtfile and save it on the server. Then it is possible to get it
 faxed, and that is the goal.

If it's your web site, you have all the data, so why not just generate the 
text yourself at the same time as you're generating the HTML? You can 
write it to a file or email it to your fax server.

miguel


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




Re: [PHP] nl2br returns BR /? normality or a bug?

2002-04-06 Thread Justin French

 links 0.96
 lynx 2.8.3
 Opera 5.0.498 (Mac)
 IE 5.1.3 (Mac)
 Mozilla 0.9.9 (Mac)
 Netscape 6.1 (Mac)
 Add Konqueror on Linux to this list.
 
 Also note that links 0.84 (the latest version on Debian Stable) does _not_
 parse XHTML tags correctly.

Okay, I've tested it on everything I've got, and didn't have a problem at
all.

This includes (Mac):
- IE
  4.0
  4.5
  5.0
  5.1

- Netscape
  2.02
  3.01
  3.04
  4.04
  4.6
  6.2
- iCab 2.71

- Opera 5.0

I couldn't get IE3 to run (missing an extension?), but on the above lists,
I'm pretty satisfied that br / works for 99.% of Mac users.

I'm sure a PC user can fill in the blanks to confirm everything, but I'm
pretty comfortable using br /, or using nl2br() as is on my sites, and
won't be going back thru all my code :)


Justin French

Creative Director
http://Indent.com.au




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




[PHP] redirector

2002-04-06 Thread Joerg Hanke [ML-php]

hi,

i've got the possibility to create alias subdomains, which redirect all
to the document-root...

e.g.:

http://adam.domain.com redirects to http://domain.com

i want to redirect the users who access http://adam.domain.com to
http://domain.com/home/adam

how to do this best in php??

reguards,
george


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




Re: [PHP] Can't get this code to work...

2002-04-06 Thread Rob Packer

Dan,
Really, thanks for the help. Yeah, as you know I'm not experienced near
enough with PHP. Maybe you could provide me with an e-mail and prices for
consultation(I suppose this is what  'Analysis  Solutions' does?)

Regards,
Robert Packer
Analysis  Solutions [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Sat, Apr 06, 2002 at 12:32:33AM -0500, Analysis  Solutions wrote:
 
  input type=checkbox name=checkbox['Name'] value=validate /

 And following up to my own following up...  As I shut down the computer,
 I realized I made a boo boo.  The single quotes shouldn't be there.  So,
 make that:
   input type=checkbox name=checkbox[Name] value=validate /

 Later,

 --Dan

 --
 PHP scripts that make your job easier
   http://www.analysisandsolutions.com/code/
  SQL Solution  |  Layout Solution  |  Form Solution
  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
  4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409



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




Re: [PHP] redirector

2002-04-06 Thread Miguel Cruz

On Sat, 6 Apr 2002, Joerg Hanke [ML-php] wrote:
 i've got the possibility to create alias subdomains, which redirect all
 to the document-root...
 
 e.g.:
 
 http://adam.domain.com redirects to http://domain.com
 
 i want to redirect the users who access http://adam.domain.com to
 http://domain.com/home/adam
 
 how to do this best in php??

Do you really need to use PHP for this? The fastest and easiest way is 
using Apache's mod_rewrite.

miguel


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




[PHP] superglobals -sessions-clookies

2002-04-06 Thread cyberskydive

I think I've got down how to use the new superglobals with data sent from
forms using whichever method needed.

Now I need to learn how to do it with sessions!

this is what I'm trying to accomplish.

my website/ client list is growing and I want to add the ability for them to
login, edit account info, check proress, order new services etc.

How do I use sessions, with the new superglobals, to gather the information
I will need to write to the database?



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




[PHP] PHP on Apache 2.0 -- Does it work?

2002-04-06 Thread Steve Magruder, D2 Director

Hello,

  I'm currently running PHP 1.1.2 on Apache 1.3.24/Win2K in SAPI mode (and
this configuration has run incredibly well since last summer, albeit with
changing PHP and Apache sub-versions).  I couldn't find any info at php.net
that indicated whether the current or the next version of PHP (1.2.x) will
successfully run on Apache 2.0 (just GA'd).

  Any info on this will be greatly appreciated.

Regards,
   Steve



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




Re: [PHP] superglobals -sessions-clookies

2002-04-06 Thread heinisch

At 06.04.2002  12:48, you wrote:
I think I've got down how to use the new superglobals with data sent from
forms using whichever method needed.

Now I need to learn how to do it with sessions!

this is what I'm trying to accomplish.

my website/ client list is growing and I want to add the ability for them to
login, edit account info, check proress, order new services etc.

How do I use sessions, with the new superglobals, to gather the information
I will need to write to the database?

Aeh, what about the manual ?
  http://www.php.net/manual/en/

Oliver


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




[PHP] Re: redirector

2002-04-06 Thread phplists

First things first, when you say domain.com/home/adam do you mean
/home/httpd/htdocs/home/adam or /home/adam/public_html.. Once you know that
you can make a more educated decision.. Either way, you should be able to
specifiy DocumentRoot /home/adam/public_html or DocumentRoot
/home/httpd/htdocs/home/adam in your httpd.conf file for VirtualHost
adam.domain.com:80. Unless you are talking about authenticating users or
something and redirecting specific users to the target and the rest
somewhere else..

Bob

Joerg Hanke [EMAIL PROTECTED] wrote in message
002701c1dd9a$69c08010$0400a8c0@Joerg">news:002701c1dd9a$69c08010$0400a8c0@Joerg...
 hi,

 i've got the possibility to create alias subdomains, which redirect all
 to the document-root...

 e.g.:

 http://adam.domain.com redirects to http://domain.com

 i want to redirect the users who access http://adam.domain.com to
 http://domain.com/home/adam

 how to do this best in php??

 reguards,
 george




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




Re: [PHP] nl2br returns BR /? normality or a bug?

2002-04-06 Thread Lars Torben Wilson

On Fri, 2002-04-05 at 18:34, Justin French wrote:
 on 06/04/02 11:05 AM, Maxim Maletsky ([EMAIL PROTECTED]) wrote:
 
  You're deadly wrong, Justin. Years of coding and I have never seen this
  behavior of nl2br(). Perhaps I missed its new behavior's introduction
  (guilty as charged if so) but I only remember it returning me BR not
  BR. I have several regex depending on it.

'Deadly' wrong? Wow.

 Well, I've been at this PHP thing for 2 years, and like I said, for as long
 as *I* can remember, it's been BR /.  Perhaps it was introduced in PHP4,
 perhaps earlier.  I was not an in depth user of PHP3.

Justin is right on this one. This was changed on Dec 27, 2000. So it's 
been around for quite a long time.

It was added because it's valid XML *and* valid HTML. It is true that 
some browsers will not correctly interpret br/ (note the lack of a 
space before the /) but everything I've ever tested has been just fine
with br /. As they should.

This has been discussed a zillion times on the mailing lists. Maxim, you
could have found lots of background on the change by searching the list
archives (http://marc.theaimsgroup.com) the bug database 
(http://bugs.php.net) and the CVS repository (http://cvs.php.net). Some
links which may explain things a bit better:

A thread on the topic:
http://marc.theaimsgroup.com/?l=php-devm=99321596031773w=2

The CVS entry itself:
http://cvs.php.net/diff.php/php4/ext/standard/string.c?r1=1.176r2=1.177


Torben
 
 But I can't be deadly wrong :)
 
 
  False!
  
  It DOES NOT work fine in every browser. I'd love to give you a prov, but
  because I am lazy I will just tell you this formula:
  
  
  if(I found this issue==I noticed screwed pages on my site) {
  All I did: preg_replace(BR[^]*, BR, $text); {
  ...and pages became pretty again.
  }
  }
  
  /// preg 'couse I had no idea what comes up next :-)
 
 Again.  I was only stating MY experience.  Every browser I can get my hands
 on.  I do extensive testing, and have never seen a BR or BR/ or BR /
 misbehave.
 
 If you have seen it perform unexpectedly, I'm keen to hear about.
 
 
 In fact, if this is the case, then I'll be writing my own nl2br function
 which returns a br, to avoid this problem ever again.
 
 
 Perhaps in future releases, nl2br() should have an option flag for switching
 between XHTML and HTML?  I can't see why the powers that be would have
 included XHTML compliance if it wasn't backwards compatible.
 
 
 
  when was it changed? Is there any reference?
 
 I went to php.net/nl2br and this line of text was in there:
 
 Note: Starting with PHP 4.0.5, nl2br() is now XHTML compliant. All versions
 before 4.0.5 will return string with 'br' inserted before newlines instead
 of 'br /'.
 
 :)
 
 So it would appear that I've only been using nl2br since I got my hands on
 PHP4.05+, which according to the earliest date I can find, was released
 sometime around 2001-04-30.
 
 
 
 Justin French
 
 Creative Director
 http://Indent.com.au
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
 Torben Wilson [EMAIL PROTECTED]
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


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




php-general Digest 6 Apr 2002 20:30:48 -0000 Issue 1271

2002-04-06 Thread php-general-digest-help


php-general Digest 6 Apr 2002 20:30:48 - Issue 1271

Topics (messages 91849 through 91888):

Re: help condensing regular expressions
91849 by: Tom Rogers

Re: Headers not working
91850 by: Michael Virnstein

limit posts and have a next page?
91851 by: Hawk
91852 by: Jason Wong
91867 by: The_RadiX

htmlentities
91853 by: Joerg Hanke [ML-php]
91855 by: Jason Wong

Re: nl2br returns BR /? normality or a bug?
91854 by: James Arthur
91880 by: Justin French
91888 by: Lars Torben Wilson

using font properties in generated posts.
91856 by: Randum Ian
91877 by: Miguel Cruz

How to convert a website to a txtfile?
91857 by: Raymond Lilleodegard
91879 by: Miguel Cruz

regular expressions: HUGE speed differences
91858 by: Ando
91863 by: heinisch.creaction.de

Executing functions within ereg_replace() output
91859 by: Adam Wan

Mystery Binary Characters in My Files
91860 by: Jeff Levy
91865 by: heinisch.creaction.de
91869 by: Jeff Levy

F/U on Returned Mail
91861 by: Anthony Rodriguez
91862 by: Jason Wong
91864 by: heinisch.creaction.de
91866 by: Jason Wong

- Flock manual clarification please  ;-)
91868 by: Matt Friedman

how to sort by value in associative array
91870 by: Peter J. Schoenster

MAC file upload
91871 by: Shane McBride
91875 by: Miguel Cruz

Re: Can't get this code to work...
91872 by: Analysis  Solutions
91882 by: Rob Packer

Newbie and includes
91873 by: Dean Ouellette
91874 by: Timothy J. Luoma

HELP!
91876 by: Georgie Casey
91878 by: Miguel Cruz

redirector
91881 by: Joerg Hanke [ML-php]
91883 by: Miguel Cruz
91887 by: phplists.woodenpickle.com

superglobals -sessions-clookies
91884 by: cyberskydive
91886 by: heinisch.creaction.de

PHP on Apache 2.0 -- Does it work?
91885 by: Steve Magruder, D2 Director

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

Hi
I have never used .htaccess but I'll read up on it, I am the ISP so it 
won't be a problem :)

Tom

At 06:12 PM 6/04/2002, Chris Adams wrote:
In article [EMAIL PROTECTED], Tom
Rogers wrote:
  Thats what I was after :)

Glad I could help.

  At the top of each page I now do
 
  $reltoroot = preg_replace(|/[^/]+|, ../, 
 dirname($_SERVER['PHP_SELF']));
  ini_set 
 (include_path,ini_get(include_path).:.$reltoroot.../include);
 
  which takes care of the include path

Out of curiosity, couldn't you put something like
php_value include_path .:/document/root/include:/usr/lib/php

in a .htaccess file? Or has your ISP disabled .htaccess files?

Chris

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


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

this might be because you use the cgi version of php. to be able to send
e.g.
404 header, you have to run php as webserver module which currently only
works with apache and linux afaik. otherwise these headers get send by the
webserver and you cannot affect them.

if you use php with apache as module, you should use this:

header('WWW-Authenticate: Basic realm=Private');
header('HTTP/1.0 401 Unauthorized');

or look at this tutorial: http://www.zend.com/zend/tut/authentication.php



Sheridan Saint-Michel [EMAIL PROTECTED] schrieb im Newsbeitrag
002501c1dccb$75fd7060$[EMAIL PROTECTED]">news:002501c1dccb$75fd7060$[EMAIL PROTECTED]...
 I was trying to write a some code that would disallow specific users
access
 to certain pages.  I had thought this would be as simple as looking at
 $PHP_AUTH_USER and sending a 401 header if it was a user that shouldn't
have
 access to that page.

 The problem is the HTTP header was not going out.  I tried 404 and 401,
and
 then I thought perhaps the HTTP authentication was preventing me from
 sending the header, so I tried several different headers (all copied and
 pasted from the PHP manual) in an unprotected directory.  I also tried
both
 IE6 and Mozilla to make sure there wasn't a borwser issue.

 The header line seems to be completely overlooked as things echoed below
the
 header were appearing in the original script.

 The test scripts in the unprotected directory are all very simple, for
 example:

 ?php
   header(Status: 404 Not Found);
 ?

 I have saved three test scripts as both .php and .phps so you can view
them.
 In addition, I put up an info.php so you can see my entire PHP config in
 case that is the problem. (links below).  Also header(Location:) seems to
 work without any problems.

 So what am I overlooking?

 http://www.foxjet.com/info.php
 

[PHP] Re: regular expressions: HUGE speed differences

2002-04-06 Thread Chris Adams

On Sat, 06 Apr 2002 15:01:24 +0300, Ando [EMAIL PROTECTED] wrote:
 (eregi((frame[^]*src[[:blank:]]*=|href[[:blank:]]*=|http-equiv=['\]refresh['\]

You might want to try using preg_match instead. The PCRE engine should
be significantly faster. You might also find the ability to pass an
array of expressions would simplify your code significantly.

Chris

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




[PHP] Re: how to sort by value in associative array

2002-04-06 Thread Chris Adams

On Sat, 6 Apr 2002 10:36:18 -0600, Peter J. Schoenster
[EMAIL PROTECTED] wrote:
 $ArrayOfNewsLinks = array(
   http://dailynews.yahoo.com/fc/World/Brazil/; = array(
 title = 'Yahoo Brazil News',
 category  = 'news',
 language = 'English',
 
   ),
...
 function cmp ($a, $b) {
 if ($a[2] == $b[2]) return 0;
 //return strcmp ( $a[2], $b[2]); // thought this would work
 return ($a[1]$b[1])?1:-1; 
 }
 
 
 uksort ($ArrayOfNewsLinks, cmp);

Try changing those subscripts to keys:
if ($a[language] == $b[language])

etc. You should have a ton of PHP warnings generated from the code
above, as numeric elements won't exist.

As a side note, an interesting addition would be using the title as a
second sort key:

if ($a[language] == $b[language]) {
return strnatcasecmp($a[title], $b[title]);
}


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




[PHP] The PHP Filter did not receive suitable input data

2002-04-06 Thread bvr


Hello!

I'm expirimenting with apache 2 and PHP, I've got things running but 
there's one problem left:

When I request a directory, and the index is a PHP script, the following 
error is reported to the client:

'The PHP Filter did not receive suitable input data'

Apache also reports this error to his error_log:

'Directory index forbidden by rule: name of the PHP script!'

And when I enable the 'Indexes' option, Apache logs:

'Not a directory: Can't open directory for index: name of the PHP script!'


I'm using my Apache 1.3 configuration but with Filters instead of 
AddType , I hope this is simply a configuration issue.

versions used:
Apache 2.0.35
PHP 4.3.0-cvs (03 Apr 2002 23:53 GMT+1)


apache conf:
# PHP
LoadModule php4_module modules/libphp4.so
FilesMatch \.(phpc?|phtml)$
   SetOutputFilter PHP
   SetInputFilter PHP
/FilesMatch

# Indexes
DirectoryIndex index.phtml index.html index.php


Any clues ?

Thanks,
bvr.



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




Re: [PHP] Re: redirector

2002-04-06 Thread Bob

Well, then you probably can't do much with Apaches mod_rewrite then either..
I know of a Javascript command for doing that history.replace() but if
you're looking for something in PHP, I'm pretty new to PHP and don't know of
anything offhand.. My programmer integrates some Javascript into our stuff I
think (maybe window.location()).. And then sends a location= value to it..
Here's what I could find in the stuff he does for us:

function javascriptJump( $location )
{
 global $PHPSESSID, $HTTP_USER_AGENT;

 if( ( $PHPSESSID or ini_get( session.use_cookies ) == 0 ) and ereg( \?,
$location ) ) $location .= PHPSESSID=$PHPSESSID;

 if( !headers_sent() ) header( Location: $location );
  else {
   print html\n;
   print head\n;
   print script language=javascript\n;
   print location='$location';\n;
   print /script\n;
   print /head\n;
   print body bgcolor=white\n;
   print Jumping to a href=\$location\$location/a via javascript.  If
you don't have javascript enabled, click on the link.\n;
   print /body\n;
   print /html;
  }
 exit;
}

This is one parts he calls that javascriptJump() function from:

javascriptJump( $PHP_SELF?command=updateInventoryupdate=done );

Hope this might help out some..

Later,

Bob Weaver

- Original Message -
From: Joerg Hanke [ML-php] [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, April 06, 2002 4:20 PM
Subject: AW: [PHP] Re: redirector


 i do not own a server, i just own a virtual host, an ordinary
 webspace... i can't do anything in httpd.conf

 -Ursprüngliche Nachricht-
 Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Gesendet: Samstag, 06. April 2002 21:30
 An: [EMAIL PROTECTED]
 Betreff: [PHP] Re: redirector


 First things first, when you say domain.com/home/adam do you mean
 /home/httpd/htdocs/home/adam or /home/adam/public_html.. Once you know
 that you can make a more educated decision.. Either way, you should be
 able to specifiy DocumentRoot /home/adam/public_html or DocumentRoot
 /home/httpd/htdocs/home/adam in your httpd.conf file for VirtualHost
 adam.domain.com:80. Unless you are talking about authenticating users
 or something and redirecting specific users to the target and the rest
 somewhere else..

 Bob

 Joerg Hanke [EMAIL PROTECTED] wrote in message
 002701c1dd9a$69c08010$0400a8c0@Joerg">news:002701c1dd9a$69c08010$0400a8c0@Joerg...
  hi,
 
  i've got the possibility to create alias subdomains, which redirect
  all to the document-root...
 
  e.g.:
 
  http://adam.domain.com redirects to http://domain.com
 
  i want to redirect the users who access http://adam.domain.com to
  http://domain.com/home/adam
 
  how to do this best in php??
 
  reguards,
  george
 



 --
 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] Re: redirector

2002-04-06 Thread Bob

Oh hey, I found this.. It looks like it might be something along the lines
of what you need..

http://www.php.net/manual/en/function.header.php#AEN23288

Now that I look back through the stuff my programmer did that I send
earlier, he uses the header() function.. I just has to be send first and he
tests for that then uses Javascript to redirect if they have it seems..
Anyway, hope this is useful to you..

Later,

Bob Weaver

- Original Message -
From: Joerg Hanke [ML-php] [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, April 06, 2002 4:20 PM
Subject: AW: [PHP] Re: redirector


 i do not own a server, i just own a virtual host, an ordinary
 webspace... i can't do anything in httpd.conf

 -Ursprüngliche Nachricht-
 Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Gesendet: Samstag, 06. April 2002 21:30
 An: [EMAIL PROTECTED]
 Betreff: [PHP] Re: redirector


 First things first, when you say domain.com/home/adam do you mean
 /home/httpd/htdocs/home/adam or /home/adam/public_html.. Once you know
 that you can make a more educated decision.. Either way, you should be
 able to specifiy DocumentRoot /home/adam/public_html or DocumentRoot
 /home/httpd/htdocs/home/adam in your httpd.conf file for VirtualHost
 adam.domain.com:80. Unless you are talking about authenticating users
 or something and redirecting specific users to the target and the rest
 somewhere else..

 Bob

 Joerg Hanke [EMAIL PROTECTED] wrote in message
 002701c1dd9a$69c08010$0400a8c0@Joerg">news:002701c1dd9a$69c08010$0400a8c0@Joerg...
  hi,
 
  i've got the possibility to create alias subdomains, which redirect
  all to the document-root...
 
  e.g.:
 
  http://adam.domain.com redirects to http://domain.com
 
  i want to redirect the users who access http://adam.domain.com to
  http://domain.com/home/adam
 
  how to do this best in php??
 
  reguards,
  george
 



 --
 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] Re: how to sort by value in associative array

2002-04-06 Thread Peter J. Schoenster

On 6 Apr 2002, at 14:38, Chris Adams wrote:

 On Sat, 6 Apr 2002 10:36:18 -0600, Peter J. Schoenster
 [EMAIL PROTECTED] wrote:
  $ArrayOfNewsLinks = array(
http://dailynews.yahoo.com/fc/World/Brazil/; = array(
  title = 'Yahoo Brazil News',
  category  = 'news',
  language = 'English',
  
),
 ...
  function cmp ($a, $b) {
  if ($a[2] == $b[2]) return 0;
  //return strcmp ( $a[2], $b[2]); // thought this would work
  return ($a[1]$b[1])?1:-1; 
  }
  
  
  uksort ($ArrayOfNewsLinks, cmp);
 
 Try changing those subscripts to keys:
 if ($a[language] == $b[language])
 
 etc. You should have a ton of PHP warnings generated from the code
 above, as numeric elements won't exist.

Not running with warnings on that server (bad thing I know).

I tried the above.

uksort ($ArrayOfNewsLinks, SortByValue);

function SortByValue ($a, $b) {
if ($a[language] == $b[language]) return 0;
return ($a[language]  $b[language]) ? 1 : -1; 
}


or this

function SortByValue ($a, $b) {
  return strcmp ( $a[language], $b[language]);
}

Doesn't work.

Peter
http://www.readbrazil.com/
Answering Your Questions About Brazil

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




[PHP] Re: Executing functions within ereg_replace() output

2002-04-06 Thread CC Zona

In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Adam Wan) wrote:

 $content = 'string string 12463409834234 string string';
 $content = ereg_replace( [0-9]{14} , substr(\\1,0,5) , $content );
 
 // this is the output i want, but the above doesnt seem to be the right way
 to generate it.
 
 string string 12363 string string
 
 
 any ideas?

For future reference:
http://www.php.net/preg-replace-callback

For this instance:
$content = ereg_replace( ([0-9]{5})[0-9]{9} , \\1, $content);

-- 
CC

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




RE: [PHP] nl2br returns BR /? normality or a bug?

2002-04-06 Thread Maxim Maletsky

Thanks Torben,

I have rushed into this discussion because I didn't know anything about
this change. Later on I've discovered the rest.

Thank you all.


Sincerely,

Maxim Maletsky
Founder, Chief Developer

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



 -Original Message-
 From: Lars Torben Wilson [mailto:[EMAIL PROTECTED]] On Behalf Of Lars
Torben Wilson
 Sent: Saturday, April 06, 2002 10:30 PM
 To: Justin French
 Cc: php
 Subject: Re: [PHP] nl2br returns BR /? normality or a bug?
 
 On Fri, 2002-04-05 at 18:34, Justin French wrote:
  on 06/04/02 11:05 AM, Maxim Maletsky ([EMAIL PROTECTED])
wrote:
 
   You're deadly wrong, Justin. Years of coding and I have never seen
this
   behavior of nl2br(). Perhaps I missed its new behavior's
introduction
   (guilty as charged if so) but I only remember it returning me BR
not
   BR. I have several regex depending on it.
 
 'Deadly' wrong? Wow.
 
  Well, I've been at this PHP thing for 2 years, and like I said, for
as long
  as *I* can remember, it's been BR /.  Perhaps it was introduced
in PHP4,
  perhaps earlier.  I was not an in depth user of PHP3.
 
 Justin is right on this one. This was changed on Dec 27, 2000. So it's
 been around for quite a long time.
 
 It was added because it's valid XML *and* valid HTML. It is true that
 some browsers will not correctly interpret br/ (note the lack of a
 space before the /) but everything I've ever tested has been just fine
 with br /. As they should.
 
 This has been discussed a zillion times on the mailing lists. Maxim,
you
 could have found lots of background on the change by searching the
list
 archives (http://marc.theaimsgroup.com) the bug database
 (http://bugs.php.net) and the CVS repository (http://cvs.php.net).
Some
 links which may explain things a bit better:
 
 A thread on the topic:
 http://marc.theaimsgroup.com/?l=php-devm=99321596031773w=2
 
 The CVS entry itself:

http://cvs.php.net/diff.php/php4/ext/standard/string.c?r1=1.176r2=1.177
 
 
 Torben
 
  But I can't be deadly wrong :)
 
 
   False!
  
   It DOES NOT work fine in every browser. I'd love to give you a
prov, but
   because I am lazy I will just tell you this formula:
  
  
   if(I found this issue==I noticed screwed pages on my site) {
   All I did: preg_replace(BR[^]*, BR, $text); {
   ...and pages became pretty again.
   }
   }
  
   /// preg 'couse I had no idea what comes up next :-)
 
  Again.  I was only stating MY experience.  Every browser I can get
my hands
  on.  I do extensive testing, and have never seen a BR or BR/ or
BR /
  misbehave.
 
  If you have seen it perform unexpectedly, I'm keen to hear about.
 
 
  In fact, if this is the case, then I'll be writing my own nl2br
function
  which returns a br, to avoid this problem ever again.
 
 
  Perhaps in future releases, nl2br() should have an option flag for
switching
  between XHTML and HTML?  I can't see why the powers that be would
have
  included XHTML compliance if it wasn't backwards compatible.
 
 
 
   when was it changed? Is there any reference?
 
  I went to php.net/nl2br and this line of text was in there:
 
  Note: Starting with PHP 4.0.5, nl2br() is now XHTML compliant. All
versions
  before 4.0.5 will return string with 'br' inserted before newlines
instead
  of 'br /'.
 
  :)
 
  So it would appear that I've only been using nl2br since I got my
hands on
  PHP4.05+, which according to the earliest date I can find, was
released
  sometime around 2001-04-30.
 
 
 
  Justin French
  
  Creative Director
  http://Indent.com.au
  
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 --
  Torben Wilson [EMAIL PROTECTED]
  http://www.thebuttlesschaps.com
  http://www.hybrid17.com
  http://www.inflatableeye.com
  +1.604.709.0506
 
 
 --
 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] What's wrong with php??

2002-04-06 Thread Gerard Samuel

Well yesterday, my test box went down because of the powersupply failed.
I replaced it today, and I just so happened to pull up a phpinfo() page, 
and it would display half the page and hang.
The test site seems to be operating normally, but phpinfo page isn't 
like it should.
I tried reinstalling, and its still giving the same behaviour.
Anyone heard of this before??

Try and see http://www.trini0.org:81/test.php


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




[PHP] Phone number validation

2002-04-06 Thread Gary

Hi All,
  I tried to cut a corner and use an  alphabetic validation I am using 
elsewhere
  $stuff = /^[a-zA-Z]+$/;
if(preg_match($stuff, $value))

looks like I forgot about +( )- being in phone number. What is the 
easiest way to allow these 4  characters? Are there any other characters 
that people use?

TIA
Gary


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




Re: [PHP] Phone number validation

2002-04-06 Thread Jason Cribbins

Some people use period '.' in between fields...me for one.  Its an old habit
I have although I forget where I picked that up from.  I am sure it was when
I was working overseas...maybe Asia where I saw all phone numbers using .
between fields.

- Original Message -
From: Gary [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, April 06, 2002 8:52 PM
Subject: [PHP] Phone number validation


: Hi All,
:   I tried to cut a corner and use an  alphabetic validation I am using
: elsewhere
:   $stuff = /^[a-zA-Z]+$/;
: if(preg_match($stuff, $value))
:
: looks like I forgot about +( )- being in phone number. What is the
: easiest way to allow these 4  characters? Are there any other characters
: that people use?
:
: TIA
: Gary
:
:
: --
: 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] Phone number validation

2002-04-06 Thread Justin French

FWIW, In Australia, phone numbers are commonly formatted with brackets for
area codes:

(03) 9876 5432
+61 (3) 9876 5432
+61 3 9876 5432

Also the usual array of +,-,.,etc

I'd include ()'s in your reg exp for sure.

Justin


on 07/04/02 1:47 PM, Jason Cribbins ([EMAIL PROTECTED]) wrote:

 Some people use period '.' in between fields...me for one.  Its an old habit
 I have although I forget where I picked that up from.  I am sure it was when
 I was working overseas...maybe Asia where I saw all phone numbers using .
 between fields.
 
 - Original Message -
 From: Gary [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, April 06, 2002 8:52 PM
 Subject: [PHP] Phone number validation
 
 
 : Hi All,
 :   I tried to cut a corner and use an  alphabetic validation I am using
 : elsewhere
 :   $stuff = /^[a-zA-Z]+$/;
 : if(preg_match($stuff, $value))
 :
 : looks like I forgot about +( )- being in phone number. What is the
 : easiest way to allow these 4  characters? Are there any other characters
 : that people use?
 :
 : TIA
 : Gary
 :
 :
 : --
 : 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] Phone number validation

2002-04-06 Thread Richard Baskett

What I do is strip all non-numeric numbers out and just store the number as
a string of numbers.. Then do validation on those numbers.. Make sure the
right amount of numbers are there, valid country, city codes etc.  Probably
an easier approach :)

Rick

Nothing is more common than unsuccessful men with talent. Genius will not;
unrewarded genius is almost a proverb. Education alone will not; the world
is full of educated derelicts. Persistence and determination alone are
omnipotent. - Calvin Coolidge

 From: Jason Cribbins [EMAIL PROTECTED]
 Reply-To: Jason Cribbins [EMAIL PROTECTED]
 Date: Sat, 6 Apr 2002 22:47:46 -0500
 To: [EMAIL PROTECTED], Gary [EMAIL PROTECTED]
 Subject: Re: [PHP] Phone number validation
 
 Some people use period '.' in between fields...me for one.  Its an old habit
 I have although I forget where I picked that up from.  I am sure it was when
 I was working overseas...maybe Asia where I saw all phone numbers using .
 between fields.
 
 - Original Message -
 From: Gary [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, April 06, 2002 8:52 PM
 Subject: [PHP] Phone number validation
 
 
 : Hi All,
 :   I tried to cut a corner and use an  alphabetic validation I am using
 : elsewhere
 :   $stuff = /^[a-zA-Z]+$/;
 : if(preg_match($stuff, $value))
 :
 : looks like I forgot about +( )- being in phone number. What is the
 : easiest way to allow these 4  characters? Are there any other characters
 : that people use?
 :
 : TIA
 : Gary
 :
 :
 : --
 : 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Can I fopen() files in .htaccess protected directories?

2002-04-06 Thread Dalton Hunter

Hi, does fopen() support the opening and reading of remote files in
directories protected with .htaccess files like ...

fopen(http://user:[EMAIL PROTECTED]/directory/file.php,r;);

If not, is there an alternative way to do this? Thanks!



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




Re: [PHP] PHP on Apache 2.0 -- Does it work?

2002-04-06 Thread Tyler Longren

Well, php 4.1.2 for windows probably wasn't compiled to work with apache 2.
Apache 2 has changed too much for the php developers to keep on top of it.
If you were using unix/linux, you could compile php to work with apache 2,
but since you're using Windows, you're stuck with using Apache 1.3.24 until
the php group releases a new version for Apache 2.

;-)

Tyler Longren
Captain Jack Communications
[EMAIL PROTECTED]
www.captainjack.com

- Original Message -
From: Steve Magruder, D2 Director [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, April 06, 2002 12:52 PM
Subject: [PHP] PHP on Apache 2.0 -- Does it work?


 Hello,

   I'm currently running PHP 1.1.2 on Apache 1.3.24/Win2K in SAPI mode (and
 this configuration has run incredibly well since last summer, albeit with
 changing PHP and Apache sub-versions).  I couldn't find any info at
php.net
 that indicated whether the current or the next version of PHP (1.2.x) will
 successfully run on Apache 2.0 (just GA'd).

   Any info on this will be greatly appreciated.

 Regards,
Steve



 --
 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] /usr/bin/php Question

2002-04-06 Thread Chris Kay


Hi

I have compiled php -with-apxs option and I read in the archives it
don't create a /usr/bin/php.
But I wish to run 2 scripts I have made by command line, I have the 2
scripts outside the web server
Root.

Is there a way to compile a php binary to use for my scripts?

Or does someone have any idea's what's the best way to go about this
would be...

---
Chris Kay, Eleet Internet Services
[EMAIL PROTECTED]
---


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




Re: [PHP] /usr/bin/php Question

2002-04-06 Thread Rasmus Lerdorf

Just compile again with --with-apxs

On Sun, 7 Apr 2002, Chris Kay wrote:


 Hi

 I have compiled php -with-apxs option and I read in the archives it
 don't create a /usr/bin/php.
 But I wish to run 2 scripts I have made by command line, I have the 2
 scripts outside the web server
 Root.

 Is there a way to compile a php binary to use for my scripts?

 Or does someone have any idea's what's the best way to go about this
 would be...

 ---
 Chris Kay, Eleet Internet Services
 [EMAIL PROTECTED]
 ---


 --
 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] /usr/bin/php Question

2002-04-06 Thread Jason Wong

On Sunday 07 April 2002 13:18, Chris Kay wrote:
 Hi

 I have compiled php -with-apxs option and I read in the archives it
 don't create a /usr/bin/php.
 But I wish to run 2 scripts I have made by command line, I have the 2
 scripts outside the web server
 Root.

 Is there a way to compile a php binary to use for my scripts?

Yes.

 Or does someone have any idea's what's the best way to go about this
 would be...

From the manual The default is to build PHP as a CGI program. 

By using the --with-apxs option you're telling it to build an Apache module 
and not a standalone binary.

So just:

./configure; make;

then copy the resulting php executable somewhere.


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

/*
Show business is just like high school, except you get paid.
- Martin Mull
*/

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




Re: [PHP] What's wrong with php??

2002-04-06 Thread Tyler Longren

It's very possible something went horribly wrong with your entire box when
your ps went out.  Was is a violent outing (sparks), or was is silent (no
sparking or explosions)?  I've had violent ps failures really screw up some
of my machines before.

Tyler Longren
Captain Jack Communications
[EMAIL PROTECTED]
www.captainjack.com

- Original Message -
From: Gerard Samuel [EMAIL PROTECTED]
To: PHP [EMAIL PROTECTED]
Sent: Saturday, April 06, 2002 7:38 PM
Subject: [PHP] What's wrong with php??


 Well yesterday, my test box went down because of the powersupply failed.
 I replaced it today, and I just so happened to pull up a phpinfo() page,
 and it would display half the page and hang.
 The test site seems to be operating normally, but phpinfo page isn't
 like it should.
 I tried reinstalling, and its still giving the same behaviour.
 Anyone heard of this before??

 Try and see http://www.trini0.org:81/test.php


 --
 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] Re: Newbie and includes

2002-04-06 Thread G-no / |{iller

try
?php
require (includes/footer.php)
?
Hint: You May or may-not need parenthesis around includes/footer.php.

Dean Ouellette [EMAIL PROTECTED] wrote in message
005801c1dd8c$4c6e9500$0200a8c0@yoda">news:005801c1dd8c$4c6e9500$0200a8c0@yoda...
 Newbie who has my include working with this
 ?php
 include ('includes/footer.php');
 ?

 Problem is when I try to use this with files in other directories I use
 ?php
 include ('/includes/footer.php');
 ?

 Then get file cannot be found.  Is there a way to do this?

 Dean




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




Re: [PHP] Re: Newbie and includes

2002-04-06 Thread Rasmus Lerdorf

But you will most certainly need quotes.

And no, you don't need the ()'s but it works for exactly the same reason
that (1)+(2) is a valid expression with unneccesary brackets.

-Rasmus

On Sun, 7 Apr 2002, G-no / |{iller wrote:

 try
 ?php
 require (includes/footer.php)
 ?
 Hint: You May or may-not need parenthesis around includes/footer.php.

 Dean Ouellette [EMAIL PROTECTED] wrote in message
 005801c1dd8c$4c6e9500$0200a8c0@yoda">news:005801c1dd8c$4c6e9500$0200a8c0@yoda...
  Newbie who has my include working with this
  ?php
  include ('includes/footer.php');
  ?
 
  Problem is when I try to use this with files in other directories I use
  ?php
  include ('/includes/footer.php');
  ?
 
  Then get file cannot be found.  Is there a way to do this?
 
  Dean
 



 --
 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] move_uploaded_file returning true but not working

2002-04-06 Thread Leif K-Brooks

I run a site where users can, among other things, adopt virtual pets.  I
have several admisistrators on the site, and I am trying to create a thing
that adds a new pet species through the administrator control panel without
me having to ftp it.  It takes four files: red happy, red sad, blue happy,
and blue sad.  Move_uploaded_file returns true on all 4, but doesn't seem to
be uploading.  Here is my code:
if($HTTP_POST_FILES['redhappy']['type'] != image/gif){
print bError:/b picture not a gif image;
eval($footertext);
exit;
}
if($HTTP_POST_FILES['redsad']['type'] != image/gif){
print bError:/b picture not a gif image;
eval($footertext);
exit;
}
if($HTTP_POST_FILES['bluehappy']['type'] != image/gif){
print bError:/b picture not a gif image;
eval($footertext);
exit;
}
if($HTTP_POST_FILES['bluesad']['type'] != image/gif){
print bError:/b picture not a gif image;
eval($footertext);
exit;
}
if((move_uploaded_file($HTTP_POST_FILES['redhappy']['tmp_name'],
/hsphere/local/home/ecritter/ecritters.biz/images/$speciesname_red_happy.gi
f))  (move_uploaded_file($HTTP_POST_FILES['redsad']['tmp_name'],
/hsphere/local/home/ecritter/ecritters.biz/images/$speciesname_red_sad.gif
))  (move_uploaded_file($HTTP_POST_FILES['bluehappy']['tmp_name'],
/hsphere/local/home/ecritter/ecritters.biz/images/$speciesname_blue_happy.g
if))  (move_uploaded_file($HTTP_POST_FILES['bluesad']['tmp_name'],
/hsphere/local/home/ecritter/ecritters.biz/images/$speciesname_blue_sad.gif
))){
mysql_query(insert into species(name) values('$speciesname'));
}else{
print Unable to upload;
}


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




[PHP] counter for HIGH traffic site

2002-04-06 Thread Craig Westerman

I'm needing counter for site that receives 60 to 80 hits a minute. Many I
have tried cause excessive server load and need to be deactivated or they
lose data and return to zero without warning. All tried so far have been
written in Perl.

Anyone here know of a PHP counter that would handle HIGH traffic with little
added server load? Would using MySQL to store count be of any benifit?

Thanks

Craig 
[EMAIL PROTECTED]



RE: [PHP] How to convert a website to a txtfile....?

2002-04-06 Thread Sebastian A.

You can try using fopen() and fwrite(), they are the primary file
manipulation tools you should use in this instance.

-Original Message-
From: Raymond Lilleodegard [mailto:[EMAIL PROTECTED]]
Sent: Saturday, April 06, 2002 5:52 PM
To: [EMAIL PROTECTED]
Subject: [PHP] How to convert a website to a txtfile?

Hi!

I have this website with a webshop that customers can order some products.
And when the products are listed up in the cart on the screen, would I like
to get the output
into a new txtfile and save it on the server. Then it is possible to get it
faxed, and that is the goal.

Anyone who has done this before?

Thanks for all help!

Best regards

Raymond Lilleodegard



--
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] Multiple Selection Menu Dilemma

2002-04-06 Thread Phillip S. Baker

Okay I have the following code so far.

 $sql = SELECT stass_warrior FROM staff_assignments WHERE 
stass_pos = $pos_id AND stass_weekend = $initiation;
 if (!$query = mysql_query($sql))error(mysql_error());
 $query = mysql_fetch_row($query);

 $sql = SELECT war_id, CONCAT(war_lname, ', ', war_fname) FROM 
warrior, staff_roster WHERE war_id != 1 AND staff_weekend = $initiation AND 
staff_warrior=war_id ORDER BY war_lname;
 if (!$res = mysql_query($sql))  error(mysql_error());

 tr();
 echo TTT . 'th class=format width=25%' . $row[1] . '/th' . B;
 echo TTT . 'td class=format' . B;
 echo TTT . 'select name=position_' . $n . '[] size=5 
multiple' . B;
 while($rec = mysql_fetch_row($res)) {
 ($query[0] == $rec[0] ? $selected = selected : $selected 
= );
 printf(\t\t\t\toption value=\%s_%s\%s%s/option\n, 
$pos_id, $rec[0], $selected, $rec[1]);
 }
 echo TTT . '/select' . B;
 echo TTT . '/td' . B;
 trc();

Now my problem is with the multiple feature of the drop down menu.
The first query to the db resulting in the $query variable may contain more 
then one result.
However only the last result will appear with the selected option.

I need some code that is is going to display the selected option next to 
all the correct results in the drop down.
Understand what I am needing?

Thanks for your help
Phillip



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