Re: [PHP] dynamic website screenshot/screen capture

2003-02-22 Thread Justin French
on 22/02/03 5:55 PM, olinux ([EMAIL PROTECTED]) wrote:

> Hi all - 
> While I know that this is not possible with PHP alone,
> Does anyone know how to capture website screen shots
> using PHP. I have recieved many spam mails featuring a
> screen shot of our company website and I imagine that
> it would be quite possible combined with some sort of
> web browser.

I doubt PHP will have anything to do with it... My guess is there MUST be
some form of automation/macro tool available on Windows or Linux, which
enables you to load a URL in a browser, and take a screen shot.  I get the
feeling it could also be done with AppleScript on the Mac.

Afterall, PHP, Perl, etc aren't a browser.  But it's possible that PHP can
trigger a command-line program to do the above.



Justin French


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



[PHP] MSSQL Stored procedure return values

2003-02-22 Thread Leo Spalteholz
Hi,
I'm doing a small project at work with php, ms sql server on w2k IIS5.  
All the data access is done through stored procedures.  This seems to 
be working fine, the record sets are returned and the stored 
procedures execute without error however I can't get any return 
values from them.  
For example I have the following php code:

// setup stored procedure
$sp = mssql_init("spGetReseller", $conObj);
mssql_bind($sp, "@ResellerID", $loginID, SQLINT4, FALSE);
mssql_bind($sp, "@ReturnCode", &$retVal, SQLINT4, TRUE);

$rs = mssql_execute($sp);

So the @ReturnCode variable is defined as OUTPUT in the SP and I am 
passing in $retVal by reference.  This is my stored procedure.

ALTER PROCEDURE spGetReseller
@ResellerID int
, @ReturnCode int OUTPUT
AS

SELECT Something
FROM SomeTable
WHERE SomeField = 1

-- set return code
IF @@ROWCOUNT > 0
  SET @ReturnCode = 0
ELSE
  SET @ReturnCode = 1

This should set the returncode to be 1 if there are no rows returned.  
However no matter what, it will never get this returncode from the 
stored procedure.  (ie $retVal will not be changed by the mssql_bind 
function)  I ran the stored procedure and the @returnCode variable is 
set correctly there so that isn't the problem.  

Does anyone know what could be the problem there?  I guess I could 
return @ReturnCode in the recordset but that would be kinda hokey.

Thanks,
Leo

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



Re: [PHP] PHP running on Win 2000 and IIS

2003-02-22 Thread Leo Spalteholz
For help with getting MSSQL to work with php, check the comments for 
the mssql_execute and mssql_bind functions in the online php manual. 
You need some extra dlls.

Leo

On February 21, 2003 09:43 pm, John W. Holmes wrote:
> > I wish to run PHP on a Win 2000 server, MS SQL and IIS. Can
> > someone
>
> please
>
> > guide me to some place where there are some tutorials on how to
>
> install
>
> > and run the above?
>
> The PHP manual has an installation channel the works.
>
> > Also are there any problems by running PHp on Win 2000, MS SQL
> > and
>
> IIS?
>
> Not that I've noticed. I use all that except for MSSQL, thankfully.
>
> ---John Holmes...


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



[PHP] Re: Getting a Multiple Select Form Field's Value

2003-02-22 Thread Markas
Just replace the name of your  element to "select[]" , and you'll
get all the selected values as a php array under the name of
$_GET['select'].

"Mike Walth" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello:
>
> I'm trying to get the value from the following form field.
>
> 
>   Value1
>   Value2
>   Value3
> 
>
> I can get it to return one value, but if I select multiple values I can't
> get all the values form it.  Any ideas would be appreciated.
>
> Mike Walth
> CinoFusion
>
>



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



Re: [PHP] Array instead of Switch

2003-02-22 Thread Markas

"David Otton" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On 22 Feb 2003 03:28:22 -, you wrote:
>
> >Let's say I need to take one of 20 actions depending on a form selection.
I
> >could use a switch statement with 20 cases, but I could also do something
> >like:
> >
> >// Pretend this comes from a form
> >$formchoice = "mars";
> >
> >
> >$response = array(
> > "mars" => "go_mars()",
> > "mercury" => "go_mercury()",
> > "earth" => "go_earth()");
> >
> >foreach ($response as $choice => $action)
> >{
> > if (strtoupper($formchoice) == strtoupper($choice))
> >  {
> >  eval("$action;");
> >  }
> >}
> >
> >But are there even better ways?
>
> $formchoice = "mars";
>
> go_planet ($formchoice);
>
> Keep the high-levels of the script as simple as possible, push the
> complexity down into functions where it's hidden from view.
>
> Maybe go_planet() just calls go_mercury(), go_venus(), etc., or, more
> likely,  there's enough shared-functionality for only go_planet() to be
> necessary.
>
> Either way, you've replaced 11 lines in the main body of your script
> with 1 line, and the next person to deal with your code will be
> grateful.

:) I think if You use go_planet($choice), the problem will still remain,
bacause that "big switch" should reside in go_planet() func, so we come to
the start of the problem. (of course if we should take different actions
depending on the choice).

I think the one way is like described in upper message, to use variable
names of functions. Ok, that's nice, but I personally wouldnt use this as it
is very language specific (of course we could regard it like pointers to
funcs in C :)), and I think doing many such tricks of this increases the
complexity of your code and so on.

I'd use OO principals for that, making an object for each planet, and each
shoud have a method like go_planet() for THIS particular planet, as they all
this objects would inplement the interface with the same method (of course u
may not do that inheritance in PHP explicitely), So u'd have smth like this:
$response = array(
> > "mars" => object, //mars object
> > "mercury" =>  object, //mercury object
> > "earth" => " object, //earthobject

and if your choice is "mars", u'd call $response['mars']->go_planet();
Its a known OO principal for avoiding switch'es and if's, and PHP is a nice
OO style language, so doing in OO like this should give valuable practice
for migrating to any other "real" OO language.

Sorry, if wrong,
Mark.






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



Re: [PHP] preg_match question: locating unmatched HTML tags

2003-02-22 Thread Ernest E Vogelsinger
At 03:35 22.02.2003, Andy Crain said:
[snip]
>My apologies in advance if this too basic or there's a solution easily
>found out there, but after lots of searching, I'm still lost.
>
>I'm trying to build a regexp that would parse user-supplied text and
>identify cases where HTML tags are left open or are not properly
>matched-e.g.,  tags without closing  tags. This is for a sort of
>message board type of application, and I'd like to allow users to use
>some HTML, but just would like to check to ensure that no stray tags are
>input that would screw up the rest of the page's display. I'm new to
>regular expressions, and the one below is as far as I've gotten. If
>anyone has any suggestions, they'd be very much appreciated.
>
>$suspect_tags = "b|i|u|strong|em|font|a|ol|ul|blockquote ";
>$pattern = '/<(' . $suspect_tags . '[^>]*>)(.*)(?!<\/\1)/Ui';
>if (preg_match($pattern,$_POST['entry'],$matches)) {
>   //do something to report the unclosed tags
>} else {
>   echo 'Input looks fine. No unmatched tags.';
>}
[snip] 

Hi,

I don't believe you can create a regular expression to look for something
that's NOT there.

I'd take this approach (tested with drawbacks, see below):

function check_tags($text) {
$suspect_tags = "b|i|u|strong|em|font|a|ol|ul|blockquote";
$re_find = '/<\s*(' . $suspect_tags . ').*?>(.*)/is';

while (preg_match($re_find,$text,$matches)) {
// a suspect tag was found, check if closed
$suspect = $matches[1];
$text = $matches[2];
$re_close = '/<\s*\/\s*' . $suspect . '\s*?>(.*)/is';
if (preg_match($re_close, $text, $matches)) {
// fine, found matching closer, continue loop
$text = $matches[1];
}
else {
// not closed - return to report it
return $suspect;
}
}
return null;
}

$text = << an
unclosed suspect tag.

EOT;

$tag = check_tags($text);
if ($tag) echo "Unmatched: \"$tag\"\n";
else echo "Perfect!\n";

The drawbacks: This approach is softly targeted at unintended typos, such
as in the example text. It won't catch deliberate attacks, such as
   Blindtext http://www.vogelsinger.at/



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



[PHP] Re: cookie problem..

2003-02-22 Thread Lord Loh.
Cookies are loaded the next time the page is loaded. So you may have to
refresh the page to see the cookie...

or

Submit to a html page which will redirect to the page which shows cookie
value...

Hope this helps...This should work...

Lord Loh



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



[PHP] is_writable for a dir?

2003-02-22 Thread David T-G
Hi, all --

How can I tell if a directory is writable?  It seems that is_writable
only works on file, and the mode I get out of stat() is [in this case,
anyway] '16895' for a 0777 dir.


TIA & HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] Problem with Arrays?

2003-02-22 Thread Patrick Teague
I ran into something interesting & the only thing I can figure out is that
functions won't use any variables other than globals, those past to the
function, or those created inside the function?

here's what I had that didn't print anything other than 3 blank lines for
this section of code -

$byteSize[0] = "bytes";
$byteSize[1] = "kb";
$byteSize[2] = "mb";

function getMaxSize( $maxSize )
{
 echo $byteSize[0] . "\n";
 echo $byteSize[1] . "\n";
 echo $byteSize[2] . "\n";
 
}


but, if I put the array inside the function it would actually work -

function getMaxSize( $maxSize )
{
 $byteSize[0] = "bytes";
 $byteSize[1] = "kb";
 $byteSize[2] = "mb";

 echo $byteSize[0] . "\n";
 echo $byteSize[1] . "\n";
 echo $byteSize[2] . "\n";
 
}

what's up with this?  Maybe I'm just up way to late again.

Patrick



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



Re: [PHP] Problem with Arrays?

2003-02-22 Thread Ernest E Vogelsinger
At 13:46 22.02.2003, Patrick Teague said:
[snip]
>here's what I had that didn't print anything other than 3 blank lines for
>this section of code -
>
>$byteSize[0] = "bytes";
>$byteSize[1] = "kb";
>$byteSize[2] = "mb";
>
>function getMaxSize( $maxSize )
>{
> echo $byteSize[0] . "\n";
> echo $byteSize[1] . "\n";
> echo $byteSize[2] . "\n";
> 
>}
[snip] 

if you declare $bytesize global within the function it will work:

function getMaxSize( $maxSize )
{
 global $bytesize;
 echo $byteSize[0] . "\n";
}

You'd be still better off passing the array as variable:

function getMaxSize( $bytesize, $maxSize )
{
 echo $byteSize[0] . "\n";
}

And lastly, for performance issues, pass it as a reference:

function getMaxSize( &$bytesize, $maxSize )
{
 echo $byteSize[0] . "\n";
}

Without a reference, the array is copied to the function. By passing a
reference the function is working on the original array, no copy overhead.
Note: When passed as reference, any modification on the array within the
function will effect the original array (same is true if declared global).
Without reference the original array remains unchanged.


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



php-general Digest 22 Feb 2003 13:05:48 -0000 Issue 1898

2003-02-22 Thread php-general-digest-help

php-general Digest 22 Feb 2003 13:05:48 - Issue 1898

Topics (messages 136577 through 136619):

ssi problem
136577 by: Hans Prins

Re: ob_gzhandler problems under 4.3.0???
136578 by: Gerard Samuel

Re: including in shtml
136579 by: Tom Rogers
136581 by: Hans Prins
136588 by: Matt Honeycutt
136590 by: Tom Rogers
136600 by: John W. Holmes
136602 by: Matt Honeycutt
136604 by: John W. Holmes

Re: Convert *.PST Files to Something Else (LDAP...)
136580 by: David T-G

Re: Logging Referer
136582 by: Justin French
136585 by: Matt Honeycutt
136594 by: Tom Rogers

preg_match question: locating unmatched HTML tags
136583 by: Andy Crain
136603 by: John W. Holmes
136615 by: Ernest E Vogelsinger

Re: Mysql DB connect failure
136584 by: Tom Rogers

Re: user registration system
136586 by: olinux

Array instead of Switch
136587 by: Chris
136593 by: David T-G
136596 by: David Otton
136598 by: John W. Holmes
136614 by: Markas

PHP Job Opening
136589 by: Chris

PHP running on Win 2000 and IIS
136591 by: Denis L. Menezes
136599 by: John W. Holmes
136612 by: Leo Spalteholz

Utah PHP User
136592 by: Ray Hunter

Re: "Constants" for dummies, please?
136595 by: Philip Olson

Re: passing variables to flash
136597 by: Lord Loh.

Re: MAC address user recognition?
136601 by: Larry Brown

Re: session expiration
136605 by: John W. Holmes

Re: Memory used by script...
136606 by: John W. Holmes

Re: selection in form-field
136607 by: John W. Holmes

cookie problem..
136608 by: Terry Lau
136616 by: Lord Loh.

dynamic website screenshot/screen capture
136609 by: olinux
136610 by: Justin French

MSSQL Stored procedure return values
136611 by: Leo Spalteholz

Re: Getting a Multiple Select Form Field's Value
136613 by: Markas

is_writable for a dir?
136617 by: David T-G

Problem with Arrays?
136618 by: Patrick Teague
136619 by: Ernest E Vogelsinger

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
--- Begin Message ---
Could anyone please shed some light on the following issue?

I have a problem with including a "test.php" into a "test.shtml" and passing
a variable to the "test.shtml" which should be available and processed in
the "test.php"

the "test.php" document includes the following:
---





";
}

?>

the "test.shtml" document includes the following:
-



poll






I've also tried using the POST method but I got an error stating that post
is not a valid method in shtml.

I have also considered a session variable but since a session needs to
initiated or continued before anything is output to the browser that wont
work (I think).

does anyone have a solution to get this to work?

thanks,
Hans


--- End Message ---
--- Begin Message ---
Thanks.  Worked like a charm...

Jason Sheets wrote:

PHP is starting output buffering automatically for you and then you are
starting it in your script as well, that is why you are receiving the
message ob_gzhandler can not be used twice.
Use ob_get_level to check if output buffering is not already started.


You may want additional logic that checks to see if the output buffer
hander is ob_gzhandler.
Jsaon
 

--
Gerard Samuel
http://www.trini0.org:81/
http://test1.trini0.org:81/

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

Saturday, February 22, 2003, 8:22:44 AM, you wrote:
HP> anyone?

HP> "Hans Prins" <[EMAIL PROTECTED]> schreef in bericht
HP> news:[EMAIL PROTECTED]
>> Hello,
>>
>> I have a problem with including a "test.php" into a "test.shtml" and
HP> passing
>> a variable to the "test.shtml" which should be processed in the "test.php"
>>
>> the "test.php" document includes the following:
>> ---
>>
>> >
>> if ($HTTP_GET_VARS['theValue']) {
>> print $HTTP_GET_VARS['theValue'];
>> } else {
>> print"
>> 
>> 
>> 
>> 
>> ";
>> }
>>
>> ?>
>>
>> the "test.shtml" document includes the following:
>> -
>>
>> 
>> 
>> poll
>> 
>> 
>> 
>> 
>> 
>>
>> I've also tried using the POST method but I got an error stating that post
>> is not a valid method in shtml.
>>
>> I have also considered a session variable but since a session needs to
>> initiated or continued before anything is output to the browser that wont
>> work (I think).
>>
>> does anyone have a solution to get this to wo

Re: [PHP] Problem with Arrays?

2003-02-22 Thread Justin French
on 22/02/03 11:46 PM, Patrick Teague ([EMAIL PROTECTED]) wrote:

> I ran into something interesting & the only thing I can figure out is that
> functions won't use any variables other than globals, those past to the
> function, or those created inside the function?

exactly :)

you bring the array or variable into the scope of the function

\n";
echo $byteSize[1] . "\n";
echo $byteSize[2] . "\n";
}
?>


Justin French


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



[PHP] what's the matter?

2003-02-22 Thread X
index.php:
choice your gender
  male
 female
 
 

x.php:
 

but at last it said that the gender had not been defined???
help me!
thank u!~


[PHP] forward to a html file

2003-02-22 Thread qt
Dear Sirs,

I need forward a html file in my php.

If I use include, it comes a part of .php result. In the navigation window
shows that myscript.php

But I want to show that destination.html.

I can not find good procedure in the manual, can you help; how can I do?

Best Regards



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



Re: [PHP] forward to a html file

2003-02-22 Thread David Otton
On Sat, 22 Feb 2003 15:25:36 +0300, you wrote:

>I need forward a html file in my php.
>
>If I use include, it comes a part of .php result. In the navigation window
>shows that myscript.php
>
>But I want to show that destination.html.

Not absolutely sure what you're asking for, but I think you want
myscript.php to redirect to destination.html?

You need a Location header.

header("Location: http://www.site.com/destination.html";);

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

Note: headers have to be set /before/ any other text is sent, including
blank lines. If this is impossible, use output buffering :

http://www.php.net/manual/en/ref.outcontrol.php


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



Re: [PHP] what's the matter?

2003-02-22 Thread Chris Hayes
At 14:36 22-2-2003, you wrote:
index.php:
choice your gender
  male
 female
 

x.php:

but at last it said that the gender had not been defined???




help me!
"by your command."
( a 'please' would be nice, X!)
Since PHP 4.1 form data are not automatically available as variables in the 
followup file.

http://nl.php.net/release_4_1_0.php explains it all, for now it's enough to say
- either turn register_globals on in php.ini (google knows how)
 - or read $_POST['gender'], e.g.
$gender=$_POST['gender'];




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


[PHP] how fast is Vulcan Logic SRM and unix sockets

2003-02-22 Thread Tamas Arpad
Hi,
The question is mainly for the developers of SRM, but I'm sure there are 
others who use it.
I'm implementing a caching method where cached data is stored in hashes. Now 
it works with file storage, files' names are the keys and the values are 
stored in within the files. I'm considering making this cache to work with 
SRM, storing it's key->value pairs in associative arrays.
What do you think, would it caouse reasonable speed improvement? Are unix 
sockets that much faster than using the file system?
I have very sort of time installing/implementing this, and have many things to 
do yet, that's why I'm asking instead of trying it out, hope someone has 
experience/opinion on this topic.
Thanks,
Arpi

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



Re: [PHP] dynamic website screenshot/screen capture

2003-02-22 Thread olinux
right - I was thinking more along the lines that php
would loop thru URL database and then trigger IE
somehow (have to be on windows box but not production
server)

The macro idea sounds like the best bet. Thanks

olinux 

--- Justin French <[EMAIL PROTECTED]> wrote:
> on 22/02/03 5:55 PM, olinux ([EMAIL PROTECTED]) wrote:
> 
> > Hi all - 
> > While I know that this is not possible with PHP
> alone,
> > Does anyone know how to capture website screen
> shots
> > using PHP. I have recieved many spam mails
> featuring a
> > screen shot of our company website and I imagine
> that
> > it would be quite possible combined with some sort
> of
> > web browser.
> 
> I doubt PHP will have anything to do with it... My
> guess is there MUST be
> some form of automation/macro tool available on
> Windows or Linux, which
> enables you to load a URL in a browser, and take a
> screen shot.  I get the
> feeling it could also be done with AppleScript on
> the Mac.
> 
> Afterall, PHP, Perl, etc aren't a browser.  But it's
> possible that PHP can
> trigger a command-line program to do the above.
> 
> 
> 
> Justin French
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

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



Re: [PHP] PHP running on Win 2000 and IIS

2003-02-22 Thread Denis L. Menezes
Hello John. Thanks.

Do you mean you run win 2000 + PHP + MySQL?

For MySQL to run properly, will the standard binary downloaded from the
website suffice or do I need to purchase some other version of MySQL? Also
is there a good MySQL GUI for Windows machines?

Thanks very much.
Denis

Thanks
denis
- Original Message -
From: "John W. Holmes" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, February 22, 2003 1:43 PM
Subject: RE: [PHP] PHP running on Win 2000 and IIS


> > I wish to run PHP on a Win 2000 server, MS SQL and IIS. Can someone
> please
> > guide me to some place where there are some tutorials on how to
> install
> > and run the above?
>
> The PHP manual has an installation channel the works.
>
> > Also are there any problems by running PHp on Win 2000, MS SQL and
> IIS?
>
> Not that I've noticed. I use all that except for MSSQL, thankfully.
>
> ---John Holmes...
>


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



Re: [PHP] what's the matter?

2003-02-22 Thread Rick Emery
 


- Original Message - 
From: "X" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 22, 2003 7:36 AM
Subject: [PHP] what's the matter?


index.php:
choice your gender
  male
 female
 
 

x.php:
 

but at last it said that the gender had not been defined???
help me!
thank u!~



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



Re: [PHP] Re: including in shtml

2003-02-22 Thread Hans Prins
thank you |Tom :)
That helped me out a lot

"Tom Rogers" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> Hi,
>
> Saturday, February 22, 2003, 12:29:36 PM, you wrote:
> HP> Im trying to write a poll script that is easy to intergrate into other
> HP> documents of a site and thought that since shtml is a much used
method, I
> HP> want to make it available.
>
> HP> "Hans Prins" <[EMAIL PROTECTED]> schreef in bericht
> HP> news:[EMAIL PROTECTED]
> >> Hello,
> >>
> >> I have a problem with including a "test.php" into a "test.shtml" and
> HP> passing
> >> a variable to the "test.shtml" which should be processed in the
"test.php"
> >>
> >> the "test.php" document includes the following:
> >> ---
> >>
> >>  >>
> >> if ($HTTP_GET_VARS['theValue']) {
> >> print $HTTP_GET_VARS['theValue'];
> >> } else {
> >> print"
> >> 
> >> 
> >> 
> >> 
> >> ";
> >> }
> >>
> >> ?>
> >>
> >> the "test.shtml" document includes the following:
> >> -
> >>
> >> 
> >> 
> >> poll
> >> 
> >> 
> >> 
> >> 
> >> 
> >>
> >> I've also tried using the POST method but I got an error stating that
post
> >> is not a valid method in shtml.
> >>
> >> I have also considered a session variable but since a session needs to
> >> initiated or continued before anything is output to the browser that
wont
> >> work (I think).
> >>
> >> does anyone have a solution to get this to work?
> >>
> >> thanks,
> >> Hans
> >>
> >>
>
> POST won't work easily with .shtml files so you are limited to GET and its
> length limitations but the following works for me:
>
>
>
>
> //test.php
> 
> if(isset($_SERVER['QUERY_STRING_UNESCAPED'])){
> parse_str($_SERVER['QUERY_STRING_UNESCAPED']);
> if(!empty($theValue)){
> echo 'Value = '.stripslashes($theValue).'';
> }
> }
> print'
> 
> 
> 
> 
> ';
>
> ?>
>
> (parse string seems to like adding slashes)
>
> To use post you will have to post to a .php file to do the processing and
> redirect to the .shtml file.
>
> --
> regards,
> Tom
>



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



Re: [PHP] what's the matter?

2003-02-22 Thread Ernest E Vogelsinger
At 15:03 22.02.2003, Chris Hayes said:
[snip]
>Since PHP 4.1 form data are not automatically available as variables in the 
>followup file.
>
>http://nl.php.net/release_4_1_0.php explains it all, for now it's enough
>to say
>- either turn register_globals on in php.ini (google knows how)
>  - or read $_POST['gender'], e.g.
>$gender=$_POST['gender'];
[snip] 

if "gender" is left empty when submitting the form this will still trigger
a different warning (unknown index, or something like that).

if (array_key_exists('gender', $_POST))
$gender = $_POST['gender'];
else $gender = null;

Being paranoid you might even check if $_POST is available:
   if (is_array($_POST))


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



[PHP] Retrieving data via a proxy server

2003-02-22 Thread Siddharth Hegde
Hello,

I am a bit new to the concept of a proxy server. Could someone tell me
how to
a) Connect to a Web Server and retrieve data from it
b) Connect to an mail server and send an e-mail (via a proxy)

I know how to do these tasks without a proxy server, but not behing one.

Thanks

- Sid



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



RE: [PHP] dynamic website screenshot/screen capture

2003-02-22 Thread Siddharth Hegde
My company researched on the topic sometime back. We even did a test run
(on our local machines where there are no user restrictions set). The
machine running this will need IE 5.x or above and another software
(um... forgot its name) that uses this IE engine to capture whatever IE
see into an .jpg file. We then copy this jpeg file and generate
thumbnails using the  GD library.

Since we tried this only on our local machines, we are not sure if we
would be able to install a third party software on a server (unless it
was dedicated). Anyways this was just done in some free time, so we
never really pursued the matter any further.

- Sid

> -Original Message-
> From: olinux [mailto:[EMAIL PROTECTED]
> Sent: Saturday, February 22, 2003 12:25 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] dynamic website screenshot/screen capture
> 
> Hi all -
> While I know that this is not possible with PHP alone,
> Does anyone know how to capture website screen shots
> using PHP. I have recieved many spam mails featuring a
> screen shot of our company website and I imagine that
> it would be quite possible combined with some sort of
> web browser.
> 
> It would be great for a couple projects I'm working on
> to use this in the same style as alexa.com. (featuring
> screenshots next to search results.).
> 
> thanks for any info!
> 
> olinux
> 
> __
> Do you Yahoo!?
> Yahoo! Tax Center - forms, calculators, tips, more
> http://taxes.yahoo.com/
> 
> --
> 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] is_writable for a dir?

2003-02-22 Thread Michael Sims
On Sat, 22 Feb 2003 07:23:20 -0500, you wrote:

>Hi, all --
>
>How can I tell if a directory is writable?  It seems that is_writable
>only works on file, and the mode I get out of stat() is [in this case,
>anyway] '16895' for a 0777 dir.

The 16895 is in decimal.  Use decoct() to convert it to octal and drop
the leading digit (which seems to be 4 for directories):

$statInfo = stat('./testDir');
$dirMode = substr(decoct($statInfo['mode']), 1);

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



Re: [PHP] Serial communiction

2003-02-22 Thread Ian
O.K. Thanks, so it could be an active X control then ?


"Ernest E Vogelsinger" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> At 23:12 21.02.2003, Ian said:
> [snip]
> >Is it possible to read information on the client serial port and return
it
> >to the server ?
> [snip]
>
> Sure. But not with PHP.
>
> PHP is working "behind the scenes", at the webserver. Not at the client.
>
> What you can do is write a program (intended for the client operating
> system). Associate this plugin with a specific mimetype so the browser
will
> execute it when this mimetype (or extension) is received from the server,
> then let this program respond to the server with serial data.
>
>
> --
>>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



[PHP] timer problem

2003-02-22 Thread Michael Gaab
hi.

i want to automate some activities by date.  on a certain date i want to do
some specific processing. the application is web based using apache. i guess
i would need some way of calling the program daily to see if "today is the
day."  thread/daemon?  any suggestions appreciated.

mike



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



RE: [PHP] PHP running on Win 2000 and IIS

2003-02-22 Thread John W. Holmes
> Do you mean you run win 2000 + PHP + MySQL?

Yes, with IIS as the web server. 
 
> For MySQL to run properly, will the standard binary downloaded from
the
> website suffice or do I need to purchase some other version of MySQL?
Also
> is there a good MySQL GUI for Windows machines?

The regular windows binary works great. We've never had any issues with
it. Download MyCC from the MySQL site for a GUI. There are others, but
that one is a good interface and it's free. A good cheap one is Mascon,
which adds a lot of features. If you can find a copy of the last version
of MySQLFront, that's a great program, too. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



RE: [PHP] timer problem

2003-02-22 Thread John W. Holmes
> i want to automate some activities by date.  on a certain date i want
to
> do
> some specific processing. the application is web based using apache. i
> guess
> i would need some way of calling the program daily to see if "today is
the
> day."  thread/daemon?  any suggestions appreciated.

Use cron  on *nix, or Task Scheduler if on Windows. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



Re: [PHP] Threading

2003-02-22 Thread Steve Vernon
Hiya Greg or anyone else!
I realise that PHP does not have inherent thread support as yet. But is
it possible to simulate threads?

What I would like is for the user in a web site in a rare condition to
cause a long script to be completed. Now as far as I can make out you can
make it not time out, but the user will sit there being boored.

Is it possible to call a URL from PHP? And just ignore it? I mean call
another PHP script that takes ages, but wont affect he initial script
ending?

Steve
- Original Message -
From: "Greg Donald" <[EMAIL PROTECTED]>
To: "Bruce Miller" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, February 18, 2003 8:03 PM
Subject: Re: [PHP] Threading


> On Tue, 18 Feb 2003, Bruce Miller wrote:
>
> >Will PHP allow multiple-thread execution?
>
> PHP4 does not have thread support.
>
>
> --
> Greg Donald
> http://destiney.com
>
>
> --
> 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] Threading

2003-02-22 Thread Joshua Moore-Oliva
You can use the curl libs to call an external script.

Josh.
On February 22, 2003 11:05 am, Steve Vernon wrote:
> Hiya Greg or anyone else!
> I realise that PHP does not have inherent thread support as yet. But is
> it possible to simulate threads?
>
> What I would like is for the user in a web site in a rare condition to
> cause a long script to be completed. Now as far as I can make out you can
> make it not time out, but the user will sit there being boored.
>
> Is it possible to call a URL from PHP? And just ignore it? I mean call
> another PHP script that takes ages, but wont affect he initial script
> ending?
>
> Steve
> - Original Message -
> From: "Greg Donald" <[EMAIL PROTECTED]>
> To: "Bruce Miller" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Tuesday, February 18, 2003 8:03 PM
> Subject: Re: [PHP] Threading
>
> > On Tue, 18 Feb 2003, Bruce Miller wrote:
> > >Will PHP allow multiple-thread execution?
> >
> > PHP4 does not have thread support.
> >
> >
> > --
> > Greg Donald
> > http://destiney.com
> >
> >
> > --
> > 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] is_writable for a dir?

2003-02-22 Thread David T-G
Michael --

...and then Michael Sims said...
% 
% On Sat, 22 Feb 2003 07:23:20 -0500, you wrote:
% 
% >How can I tell if a directory is writable?  It seems that is_writable
% >only works on file, and the mode I get out of stat() is [in this case,
% >anyway] '16895' for a 0777 dir.
% 
% The 16895 is in decimal.  Use decoct() to convert it to octal and drop
% the leading digit (which seems to be 4 for directories):

Ahhh...  I get it!


% 
% $statInfo = stat('./testDir');
% $dirMode = substr(decoct($statInfo['mode']), 1);

Hey, lookit that...  My mode is now 40777, just as I would figure :-)
Thanks!

The real problem still remains, however; if it's not writable for all,
then I need to see whether or not its writable, and preferably without
checking the making of a temp file or digging into UID/GID and group
membership and so on...


Thanks & TIA for more & HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] Sitewide Header & Footer Includes || Trouble with Relative Paths..........

2003-02-22 Thread CF High
Hey All.

Got a perhaps easy question here:

How can I create a global header and footer include to my site pages where I
don't rely on absolute paths to include and image files?

I'm having trouble including my header and footer .inc's within a
multi-level directory structure -- the relative paths to images (and to
includes within includes) are not currently accessed within the current
directory structure.

I'm assuming I'll need to prepend all image and include files with a path
variable that I set within each page, or something along those lines?

Any help much appreciated,

--Confused

--




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



Re: [PHP] is_writable for a dir?

2003-02-22 Thread Michael Sims
On Sat, 22 Feb 2003 11:49:09 -0500, you wrote:

>The real problem still remains, however; if it's not writable for all,
>then I need to see whether or not its writable, and preferably without
>checking the making of a temp file or digging into UID/GID and group
>membership and so on...

I wouldn't know of any other way to do it except for the two that you
mentioned.  Maybe someone else has some better ideas...

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



Re: [PHP] is_writable for a dir?

2003-02-22 Thread David T-G
Michael --

...and then Michael Sims said...
% 
% On Sat, 22 Feb 2003 11:49:09 -0500, you wrote:
% 
% >checking the making of a temp file or digging into UID/GID and group
% >membership and so on...
% 
% I wouldn't know of any other way to do it except for the two that you

Oh, well.  Thanks for the help otherwise!


% mentioned.  Maybe someone else has some better ideas...

I'm listening :-)


HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] Displaying images

2003-02-22 Thread Robert Stermer-Cox
Greetings, All,

I'm a newbe to php and am trying to develop a routine to display artwork on
my wife's site.  I want to load from a flat file information about the
artwork and image file names of the pieces.  Then using the image file name,
I want to display the image to the browser.  I've figured out how to load
the data from the file, but I could only find ("PHP and MySQL Web
Development", Welling & Thomson) two functions to display the images:
ImageCreateFromxxx or Imagexxx.  Neither one works.  In fact, Dreamweaver MX
doesn't even show them as valid php functions.

Any suggestions would be greatly appreciated

Robert



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



RE: [PHP] Displaying images

2003-02-22 Thread Matt Honeycutt
Robert,

The image functions do indeed work, check the PHP docs for more info:

http://www.php.net/manual/en/ref.image.php

However, your server must have the GD libraries installed and PHP must be
properly configured.  The docs should be a good starting point if nothing
else.

---Matt

-Original Message-
From: Robert Stermer-Cox [mailto:[EMAIL PROTECTED]
Sent: Saturday, February 22, 2003 11:20 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Displaying images


Greetings, All,

I'm a newbe to php and am trying to develop a routine to display artwork on
my wife's site.  I want to load from a flat file information about the
artwork and image file names of the pieces.  Then using the image file name,
I want to display the image to the browser.  I've figured out how to load
the data from the file, but I could only find ("PHP and MySQL Web
Development", Welling & Thomson) two functions to display the images:
ImageCreateFromxxx or Imagexxx.  Neither one works.  In fact, Dreamweaver MX
doesn't even show them as valid php functions.

Any suggestions would be greatly appreciated

Robert



--
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] Displaying images

2003-02-22 Thread Siddharth Hegde
I had the same problem. This is due to bad documentation I think. Just
ImageCreateFromxxx to imagecreatefromxxx and DW MX will show it as a
valid func AND more importantly, it will work.

Let me know if this helps

- Sid

> -Original Message-
> From: Robert Stermer-Cox [mailto:[EMAIL PROTECTED]
> Sent: Saturday, February 22, 2003 10:50 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Displaying images
> 
> Greetings, All,
> 
> I'm a newbe to php and am trying to develop a routine to display
artwork
> on
> my wife's site.  I want to load from a flat file information about the
> artwork and image file names of the pieces.  Then using the image file
> name,
> I want to display the image to the browser.  I've figured out how to
load
> the data from the file, but I could only find ("PHP and MySQL Web
> Development", Welling & Thomson) two functions to display the images:
> ImageCreateFromxxx or Imagexxx.  Neither one works.  In fact,
Dreamweaver
> MX
> doesn't even show them as valid php functions.
> 
> Any suggestions would be greatly appreciated
> 
> Robert
> 
> 
> 
> --
> 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] Help with Multiple Checkboxes

2003-02-22 Thread Shad Kaske
I am having some difficulty getting a list of check boxes to work 
properly. I have dug through the list archives, usenet, PHP Manuals, 
etc. and still I am unable to process multiple checkboxes from a form 
submission properly. The following is what I am running into.

Form:



PHP:
for ($i = 0; $i < count($_POST['add']); $i++)
{
echo $_POST['add'][$i];
echo "\n";
}
Output:
2
0
Any assistance will be greatly appreciated. Thanks in advance.

Shad

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


RE: [PHP] timer problem

2003-02-22 Thread Siddharth Hegde
Just a little curious. Is there any other way other than cron to do
this. Is it possible to run a PHP script in an endless loop and when the
clock strikes, run another script?

- Sid

> -Original Message-
> From: John W. Holmes [mailto:[EMAIL PROTECTED]
> Sent: Saturday, February 22, 2003 9:40 PM
> To: 'Michael Gaab'; [EMAIL PROTECTED]
> Subject: RE: [PHP] timer problem
> 
> > i want to automate some activities by date.  on a certain date i
want
> to
> > do
> > some specific processing. the application is web based using apache.
i
> > guess
> > i would need some way of calling the program daily to see if "today
is
> the
> > day."  thread/daemon?  any suggestions appreciated.
> 
> Use cron  on *nix, or Task Scheduler if on Windows.
> 
> ---John W. Holmes...
> 
> PHP Architect - A monthly magazine for PHP Professionals. Get your
copy
> today. http://www.phparch.com/
> 
> 
> 
> --
> 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] Help with Multiple Checkboxes

2003-02-22 Thread John W. Holmes
> I am having some difficulty getting a list of check boxes to work
> properly. I have dug through the list archives, usenet, PHP Manuals,
> etc. and still I am unable to process multiple checkboxes from a form
> submission properly. The following is what I am running into.
> 
> Form:
> 
> 
> 
> 
> PHP:
> for ($i = 0; $i < count($_POST['add']); $i++)
> {
>   echo $_POST['add'][$i];
>   echo "\n";
> }
> 
> Output:
> 2
> 0

The name attribute should be "add[]", not the ID. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



RE: [PHP] Sitewide Header & Footer Includes || Trouble with Relative Paths..........

2003-02-22 Thread John W. Holmes
> How can I create a global header and footer include to my site pages
where
> I
> don't rely on absolute paths to include and image files?
> 
> I'm having trouble including my header and footer .inc's within a
> multi-level directory structure -- the relative paths to images (and
to
> includes within includes) are not currently accessed within the
current
> directory structure.
> 
> I'm assuming I'll need to prepend all image and include files with a
path
> variable that I set within each page, or something along those lines?

When you call file.php, all includes and any nested includes are
relative to the directory that file.php is in. That means if you include
a file called subdir/file2.php and it attempts to include something,
it's going to start looking for it in the same directory as file.php. No
way around that.

What's your fear of absolute paths? I always set two variables, the
absolute path of my files and the web address. 

$_CONF['path'] = '/home/me/www/program';
$_CONF['html'] = 'http://www.domain.com/program';

for example. Then do all of your paths based off of those. 

If you don't want to do that, then you can probably play around with
$_SERVER['PHP_SELF'] and basename() and the like to do what you want. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



RE: [PHP] timer problem

2003-02-22 Thread John W. Holmes
> Just a little curious. Is there any other way other than cron to do
> this. Is it possible to run a PHP script in an endless loop and when
the
> clock strikes, run another script?

Yeah, I think so, but it'd be worth the effort to just learn cron. You
can use set_time_limit() to zero and run your loop and do your stuff.
Not sure how that is for performance, though...

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



Re: [PHP] Displaying images

2003-02-22 Thread Sam A. Funk
Robert,

I am fairly new to php as well, but I think I may be able to help.

Unless you need to modify the images when you display them, you 
should be able to just use html to display them as thus:

--Start Code Here

/* These variables would be filled in by the information you have 
from your flat file */
$img_loc_filename = "032902.jpg";
$img_width = 300;
$img_height = 200;
$img_description = "Description Here";

echo "";

--End Code Here

Or something along those line

Sam


I'm a newbe to php and am trying to develop a routine to display artwork on
my wife's site.  I want to load from a flat file information about the
artwork and image file names of the pieces.  Then using the image file name,
I want to display the image to the browser.  I've figured out how to load
the data from the file, but I could only find ("PHP and MySQL Web
Development", Welling & Thomson) two functions to display the images:
ImageCreateFromxxx or Imagexxx.  Neither one works.  In fact, Dreamweaver MX
doesn't even show them as valid php functions.
Any suggestions would be greatly appreciated

Robert


--
 
|Sam A. Funk   http://www.samafunk.com  [EMAIL PROTECTED]|
|Wichita, KS Guitarist (self-proclaimed)Macintosh Fanatic|
|Kansas Bluegrass Associationhttp://www.kansasbluegrass.org/ |
 
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Sitewide Header & Footer Includes || Trouble with Relative Paths..........

2003-02-22 Thread Sebastian
What I did on my site is made a file called config.php, I then made a
variable for all the files that need to be included, example, header,
footer, leftnav, rightnav, etc..

My config file looks like this:



Then I simply call config.php into all my pages and when I want to include a
file I just do:



my config.php has all my site includes and it allows me to dynamically
change anything throughout the site in a matter of seconds.
hope this helps.

Sebastian - [BBR] Gaming Clan
http://www.BroadBandReports.com

- Original Message -
From: "CF High" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 22, 2003 3:14 PM
Subject: [PHP] Sitewide Header & Footer Includes || Trouble with Relative
Paths..


> Hey All.
>
> Got a perhaps easy question here:
>
> How can I create a global header and footer include to my site pages where
I
> don't rely on absolute paths to include and image files?
>
> I'm having trouble including my header and footer .inc's within a
> multi-level directory structure -- the relative paths to images (and to
> includes within includes) are not currently accessed within the current
> directory structure.
>
> I'm assuming I'll need to prepend all image and include files with a path
> variable that I set within each page, or something along those lines?
>
> Any help much appreciated,
>
> --Confused



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



Re: [PHP] Sitewide Header & Footer Includes || Trouble with Relative Paths..........

2003-02-22 Thread Tom Rogers
Hi,

Sunday, February 23, 2003, 6:14:32 AM, you wrote:
CH> Hey All.

CH> Got a perhaps easy question here:

CH> How can I create a global header and footer include to my site pages where I
CH> don't rely on absolute paths to include and image files?

CH> I'm having trouble including my header and footer .inc's within a
CH> multi-level directory structure -- the relative paths to images (and to
CH> includes within includes) are not currently accessed within the current
CH> directory structure.

CH> I'm assuming I'll need to prepend all image and include files with a path
CH> variable that I set within each page, or something along those lines?

CH> Any help much appreciated,

CH> --Confused

CH> --

I do this at the top of my scripts

ini_set ("include_path",'path/to/inc/dir:'.ini_get("include_path"));

that way you just do include('file.inc') from anywhere and it will find your
files.

-- 
regards,
Tom


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



Re: [PHP] Sitewide Header & Footer Includes || Trouble with Relative Paths..........

2003-02-22 Thread Noah
Hey John.

Do you ever sleep?  You've got a zillion posts in this news group..

To answer your question, it's not that I'm afraid of absolute paths, it's
that I don't properly understand how to implement them.

I understand why the path references are not working when I move beyond the
root level directory, but getting the file reference to work beyond the root
is the tricky part for me.

For example, with $_CONF['path'] = '/home/me/www/program';  set in my
global_vars.inc how will I reference my image files? As
$path.image_file_name?

Could you provide an image file reference code snippet?

Let me know.  Thanks,

--Noah



- Original Message -
From: "John W. Holmes" <[EMAIL PROTECTED]>
To: "'CF High'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, February 22, 2003 10:31 AM
Subject: RE: [PHP] Sitewide Header & Footer Includes || Trouble with
Relative Paths..


> > How can I create a global header and footer include to my site pages
> where
> > I
> > don't rely on absolute paths to include and image files?
> >
> > I'm having trouble including my header and footer .inc's within a
> > multi-level directory structure -- the relative paths to images (and
> to
> > includes within includes) are not currently accessed within the
> current
> > directory structure.
> >
> > I'm assuming I'll need to prepend all image and include files with a
> path
> > variable that I set within each page, or something along those lines?
>
> When you call file.php, all includes and any nested includes are
> relative to the directory that file.php is in. That means if you include
> a file called subdir/file2.php and it attempts to include something,
> it's going to start looking for it in the same directory as file.php. No
> way around that.
>
> What's your fear of absolute paths? I always set two variables, the
> absolute path of my files and the web address.
>
> $_CONF['path'] = '/home/me/www/program';
> $_CONF['html'] = 'http://www.domain.com/program';
>
> for example. Then do all of your paths based off of those.
>
> If you don't want to do that, then you can probably play around with
> $_SERVER['PHP_SELF'] and basename() and the like to do what you want.
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
>


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



[PHP] sending results by email

2003-02-22 Thread Luis A
hi pals


how can i make the server email me 
the results of this form __ 


   
  

  

  no 
  



any subjestion 



[PHP] Constant Arrays Possible?

2003-02-22 Thread Daniel R. Hansen
Is it possible to define a constant that is an array of other predefined
constants?  If so, what would the syntax be?  I'm trying something like the
following (all items prefixed with an uppercase "G" are constants) without
success:

define("GaNavButtons", array(
GnavSectionHome => array (
GsectionSelected => Gb_home,
GsectionUnSelected => Gb_home_uns),
GnavSectionLinks => array (
GsectionSelected => Gb_links,
GsectionUnSelected => Gb_links_uns),
GnavSectionAbout => array (
GsectionSelected => Gb_about,
GsectionUnSelected => Gb_about_uns),
GnavSectionContact => array (
GsectionSelected => Gb_contact,
GsectionUnSelected => Gb_contact_uns),
GnavSectionShopping => array (
GsectionSelected => Gb_shopping,
GsectionUnSelected => Gb_shopping_uns));



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



[PHP] fonts in dynamic images

2003-02-22 Thread julian haffegee
Hi all,

I have been creating some dynamic images, with text. Some fonts seem to work
fine, but some give the right number of characters, but each character is
just a square box.

What's causing this. I know the fonts are there (there is an entirely
different error message when the fonts are not there).

I would just give up on them , but theres one font I like, that definately
worked 6 months ag, but is 'doing the box thing' now

Anyone have any ideas. Thanks in advance

Jules


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



Re: [PHP] Sitewide Header & Footer Includes || Trouble with Relative Paths..........

2003-02-22 Thread CF High
Hey Tom.

Thanks for the idea; however, since we're not hosting the site on our own
server, we don't have permissions for altering the php.ini file..

--Noah


"Tom Rogers" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Sunday, February 23, 2003, 6:14:32 AM, you wrote:
> CH> Hey All.
>
> CH> Got a perhaps easy question here:
>
> CH> How can I create a global header and footer include to my site pages
where I
> CH> don't rely on absolute paths to include and image files?
>
> CH> I'm having trouble including my header and footer .inc's within a
> CH> multi-level directory structure -- the relative paths to images (and
to
> CH> includes within includes) are not currently accessed within the
current
> CH> directory structure.
>
> CH> I'm assuming I'll need to prepend all image and include files with a
path
> CH> variable that I set within each page, or something along those lines?
>
> CH> Any help much appreciated,
>
> CH> --Confused
>
> CH> --
>
> I do this at the top of my scripts
>
> ini_set ("include_path",'path/to/inc/dir:'.ini_get("include_path"));
>
> that way you just do include('file.inc') from anywhere and it will find
your
> files.
>
> --
> regards,
> Tom
>



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



Re: [PHP] sending results by email

2003-02-22 Thread Chris Hayes
my friend Google told me this is explained at 
http://www.thickbook.com/extra/php_email.phtml !


how can i make the server email me
the results of this form __

  
  

  

  no 
  

Don't forget to close the form.



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


Re: [PHP] Sitewide Header & Footer Includes || Trouble with Relative Paths..........

2003-02-22 Thread CF High
Hmm

Sounds like a good idea, but we've got quite a few includes in our site, not
to mention variable image paths (i.e. images/headers, images/groups, etc.)
Seems like a lot of work to create & maintain this config file + load the
references on each page.

Maybe I'm just lazy, but I wonder if there is isn't a more direct way to
modularize a site?

I'll check out your idea in any case as I haven't come up with a better
solution myself.

Thanks for the feedback,

--Noah


"Sebastian" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> What I did on my site is made a file called config.php, I then made a
> variable for all the files that need to be included, example, header,
> footer, leftnav, rightnav, etc..
>
> My config file looks like this:
>
>   $header  ="/home/public_html/includes/header.php";
>  $rightnav="/home/public_html/includes/rightnav.php";
>  $leftnav ="/home/public_html/includes/leftnav.php";
>  $footer  ="/home/public_html/includes/footer.php";
>  // and many other include variables here..
> ?>
>
> Then I simply call config.php into all my pages and when I want to include
a
> file I just do:
>
>  include("$header");
>
> // html and stuff
>
> include("$footer");
> ?>
>
> my config.php has all my site includes and it allows me to dynamically
> change anything throughout the site in a matter of seconds.
> hope this helps.
>
> Sebastian - [BBR] Gaming Clan
> http://www.BroadBandReports.com
>
> - Original Message -
> From: "CF High" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, February 22, 2003 3:14 PM
> Subject: [PHP] Sitewide Header & Footer Includes || Trouble with Relative
> Paths..
>
>
> > Hey All.
> >
> > Got a perhaps easy question here:
> >
> > How can I create a global header and footer include to my site pages
where
> I
> > don't rely on absolute paths to include and image files?
> >
> > I'm having trouble including my header and footer .inc's within a
> > multi-level directory structure -- the relative paths to images (and to
> > includes within includes) are not currently accessed within the current
> > directory structure.
> >
> > I'm assuming I'll need to prepend all image and include files with a
path
> > variable that I set within each page, or something along those lines?
> >
> > Any help much appreciated,
> >
> > --Confused
>
>



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



[PHP] to X

2003-02-22 Thread Luis A
 

that results an error

Method Not Allowed
The requested method POST is not allowed for the URL /1/x.php. 




Apache/1.3.26 Server at x.x.x.comPort 80


RE: [PHP] Sitewide Header & Footer Includes || Trouble with Relative Paths..........

2003-02-22 Thread Daniel R. Hansen
I do the following and it seems to work OK:

I put the following two lines at the top of each script:
$defsPath = "[my include path]defs/";
include_once($defsPath."globals.php3");

...and later a call to a function I wrote ( printNavLinks() ) that outputs
whatever I want in the header/footer.  The function is defined in another
include file included by globals.php3.



-Original Message-
From: CF High [mailto:[EMAIL PROTECTED]
Sent: Saturday, February 22, 2003 5:13 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Sitewide Header & Footer Includes || Trouble with
Relative Paths..


Hey Tom.

Thanks for the idea; however, since we're not hosting the site on our own
server, we don't have permissions for altering the php.ini file..

--Noah


"Tom Rogers" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Sunday, February 23, 2003, 6:14:32 AM, you wrote:
> CH> Hey All.
>
> CH> Got a perhaps easy question here:
>
> CH> How can I create a global header and footer include to my site pages
where I
> CH> don't rely on absolute paths to include and image files?
>
> CH> I'm having trouble including my header and footer .inc's within a
> CH> multi-level directory structure -- the relative paths to images (and
to
> CH> includes within includes) are not currently accessed within the
current
> CH> directory structure.
>
> CH> I'm assuming I'll need to prepend all image and include files with a
path
> CH> variable that I set within each page, or something along those lines?
>
> CH> Any help much appreciated,
>
> CH> --Confused
>
> CH> --
>
> I do this at the top of my scripts
>
> ini_set ("include_path",'path/to/inc/dir:'.ini_get("include_path"));
>
> that way you just do include('file.inc') from anywhere and it will find
your
> files.
>
> --
> regards,
> Tom
>



--
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] Question about str_replace()

2003-02-22 Thread Al
I have a simple str_replace function that obviously has a syntax 
problem.  The [p] in the $find array ignores the brackets.  Every "p" in 
my text is replaced by a .  Just for the heck of it, I've tried " 
instead of ', and preg_replace(), etc.

$find= array('& ','W&OD', '"&"', chr(146), '[p]');
$replace= array("& ","W&OD", '"&"', "'", '');
$words= str_replace ($find, $replace, $text);

Thanks.

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


[PHP] bcpowmod() and BigIntegers

2003-02-22 Thread Robert Kofler
is there a possibility to implement bcpowmod() in a 
version prior than PHP5?

bcpowmod() ist the only way to calculate a blind signature
as described by David CHAUM 1982 -> digicash
(openssl does not work here).

now I use the "shell_exec" command and an external java applet.
(btw. java has a great implemetation of the BigInteger.class)
-- 
/dev/robert

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



FW: [PHP] Sitewide Header & Footer Includes || Trouble with Relative Paths..........

2003-02-22 Thread Daniel R. Hansen
As long as your headers/footers are static, you could define them as
constants, include just the script that defines the constants, and do a
print(SOME_FOOTER_NAME); where you want them to appear.

-Original Message-
From: CF High [mailto:[EMAIL PROTECTED]
Sent: Saturday, February 22, 2003 5:19 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Sitewide Header & Footer Includes || Trouble with
Relative Paths..


Hmm

Sounds like a good idea, but we've got quite a few includes in our site, not
to mention variable image paths (i.e. images/headers, images/groups, etc.)
Seems like a lot of work to create & maintain this config file + load the
references on each page.

Maybe I'm just lazy, but I wonder if there is isn't a more direct way to
modularize a site?

I'll check out your idea in any case as I haven't come up with a better
solution myself.

Thanks for the feedback,

--Noah


"Sebastian" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> What I did on my site is made a file called config.php, I then made a
> variable for all the files that need to be included, example, header,
> footer, leftnav, rightnav, etc..
>
> My config file looks like this:
>
>   $header  ="/home/public_html/includes/header.php";
>  $rightnav="/home/public_html/includes/rightnav.php";
>  $leftnav ="/home/public_html/includes/leftnav.php";
>  $footer  ="/home/public_html/includes/footer.php";
>  // and many other include variables here..
> ?>
>
> Then I simply call config.php into all my pages and when I want to include
a
> file I just do:
>
>  include("$header");
>
> // html and stuff
>
> include("$footer");
> ?>
>
> my config.php has all my site includes and it allows me to dynamically
> change anything throughout the site in a matter of seconds.
> hope this helps.
>
> Sebastian - [BBR] Gaming Clan
> http://www.BroadBandReports.com
>
> - Original Message -
> From: "CF High" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, February 22, 2003 3:14 PM
> Subject: [PHP] Sitewide Header & Footer Includes || Trouble with Relative
> Paths..
>
>
> > Hey All.
> >
> > Got a perhaps easy question here:
> >
> > How can I create a global header and footer include to my site pages
where
> I
> > don't rely on absolute paths to include and image files?
> >
> > I'm having trouble including my header and footer .inc's within a
> > multi-level directory structure -- the relative paths to images (and to
> > includes within includes) are not currently accessed within the current
> > directory structure.
> >
> > I'm assuming I'll need to prepend all image and include files with a
path
> > variable that I set within each page, or something along those lines?
> >
> > Any help much appreciated,
> >
> > --Confused
>
>



--
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] Question about replacing \r\n with

2003-02-22 Thread Al
I can't find a way to replace \r\n codes with  in a text file.

I'm reading a text file that was prepared with windows notepad
The hex code shows OD OA for CR/LF as I expect.
I'd like to replace the OD/LF with s.

I spent hours trying every User Notes in the PHP Manual for this simple 
operation.  e.g.,

$txt= preg_replace("\r\n", "", $words);

and this version
 $txt = preg_replace("/(\015\012)|(\015)|(\012)/","", $txt);
I can substitute other characters and dec equivalents and the 
substations just won't work for \r\n [or just \r or just \n] or "\015" 
or "\15".

And, I've tried using "10" and "010" and "13" and "013".

And nl2br doesn't work either.

Can anyone help?

Thanks

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


Re: [PHP] Sitewide Header & Footer Includes || Trouble with Relative Paths..........

2003-02-22 Thread Robert Cummings
I don't know if it helps... but you should take a look at the ini_set()
function. Perhaps you can set the appropriate stuff using that.

Cheers,
Rob.


CF High wrote:
> 
> Hey Tom.
> 
> Thanks for the idea; however, since we're not hosting the site on our own
> server, we don't have permissions for altering the php.ini file..
> 

-- 
.-.
| Worlds of Carnage - http://www.wocmud.org   |
:-:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the  |
| stuff of nightmares grasp for your soul.|
`-'

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



[PHP] Printer Friendly page

2003-02-22 Thread Sebastian
Greetings all.

I am looking for a simple print page script. I tried just about all the print scripts 
at hotscripts.com and not one works (at least for me). 

Does anyone know of one that works under php v 4.2.3 with register globals off?

thanks in advance.


[PHP] rewrite rule help anyone?

2003-02-22 Thread Shawn McKenzie
Slightly off topic, but I have some PHP also ;-)

I am trying to make search engine friendly URLs for a site, but want this to
be fairly dynamic and work with any new script and vars.

If anyone would be willing, I need help on a mod_rewrite rule or rules?  I'm
thinking it should be fairly simple, but I know nothing about reg
expressions.  Maybe not the greatest, but here's the code that generates the
HTML with altered URLs.  This works great, but then I need Apache to rewrite
these.

---This:
index.php?file=test&cmd=display&what=all
---Becomes:
index-get-file-is-test+cmd-is-display+what-is-all.html

--Here's the code:

ob_start();
echo $htmlpage;
$newdisplay = ob_get_contents();
ob_clean_flush();
echo rewrite($newdisplay);

function rewrite($newdisplay)
{
$search = array(
".php?", ".php", "=", "&", "&");

$replace = array(
"-get-", "", "-is-", "+", "+");

$hrefs = find_hrefs($newdisplay);
$tmphrefs = str_replace($search, $replace, $hrefs);
foreach($tmphrefs as $key => $array) {
$newhrefs[$key] = $array.".html";
}
$newdisplay = str_replace($hrefs, $newhrefs, $newdisplay);

return $newdisplay;
}

//finds href=" in the string containing the html
function find_hrefs($tmpcontent)
{
while($start = strpos($tmpcontent, 'href="', $end)) {
$start = $start +6;
$end = strpos($tmpcontent, '"', $start);
$href[] = substr($tmpcontent, $start, $end - $start);
}
return $href;
}

TIA,
Shawn



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



Re: [PHP] Question about replacing \r\n with

2003-02-22 Thread Lowell Allen
> From: Al <[EMAIL PROTECTED]>
> 
> I can't find a way to replace \r\n codes with  in a text file.
> 
> I'm reading a text file that was prepared with windows notepad
> The hex code shows OD OA for CR/LF as I expect.
> 
> I'd like to replace the OD/LF with s.
> 
> I spent hours trying every User Notes in the PHP Manual for this simple
> operation.  e.g.,
> 
> $txt= preg_replace("\r\n", "", $words);
> 
> and this version
> $txt = preg_replace("/(\015\012)|(\015)|(\012)/","", $txt);
> 
> I can substitute other characters and dec equivalents and the
> substations just won't work for \r\n [or just \r or just \n] or "\015"
> or "\15".
> 
> And, I've tried using "10" and "010" and "13" and "013".
> 
> And nl2br doesn't work either.
> 
> Can anyone help?

Here's what I use to make two returns a paragraph return and one return a
baseline return:

$text = ereg_replace("\r", "", $text);
$text = ereg_replace("\n\n", "", $text);
$text = ereg_replace("\n", "\n", $text);
$text = ereg_replace("", "\n", $text);

HTH

--
Lowell Allen


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



Re: [PHP] Sitewide Header & Footer Includes || Trouble with Relative Paths..........

2003-02-22 Thread Noah
Don't have access to php.ini -- we're in a shared hosting
environment...

I can make it work with $my_include_path = $DOCUMENT_ROOT .
"includes/file.inc";

Then I just prepend include files with $my_include_path.  A little more
work, but better than chucking all my files in the root directory as I've
been doing..

The .htaccess idea is another option, but it looks like apache.org doesn't
view setting the include path in .htaccess as particularly efficient
(something about apache crawling from top to bottom through the directory
tree to find the default include directory) -- I don't know, the
$DOCUMENT_ROOT method does the trick for now

Feel free to chime in anyone who has a better solution,

--Noah



- Original Message -
From: "Robert Cummings" <[EMAIL PROTECTED]>
To: "CF High" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, February 22, 2003 1:22 PM
Subject: Re: [PHP] Sitewide Header & Footer Includes || Trouble with
Relative Paths..


> I don't know if it helps... but you should take a look at the ini_set()
> function. Perhaps you can set the appropriate stuff using that.
>
> Cheers,
> Rob.
>
>
> CF High wrote:
> >
> > Hey Tom.
> >
> > Thanks for the idea; however, since we're not hosting the site on our
own
> > server, we don't have permissions for altering the php.ini
file..
> >
>
> --
> .-.
> | Worlds of Carnage - http://www.wocmud.org   |
> :-:
> | Come visit a world of myth and legend where |
> | fantastical creatures come to life and the  |
> | stuff of nightmares grasp for your soul.|
> `-'
>


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



RE: [PHP] preg_match question: locating unmatched HTML tags

2003-02-22 Thread Andy Crain
John,
Thanks. I'm considering that, but the application I'm working on is for
a small intranet that will be for only a small group of supervised
users, so vulnerability isn't such a large concern.
Andy

> -Original Message-
> From: John W. Holmes [mailto:[EMAIL PROTECTED]
> Sent: Saturday, February 22, 2003 1:06 AM
> To: 'Andy Crain'; [EMAIL PROTECTED]
> Subject: RE: [PHP] preg_match question: locating unmatched HTML tags
> 
> > I'm trying to build a regexp that would parse user-supplied text and
> > identify cases where HTML tags are left open or are not properly
> > matched-e.g.,  tags without closing  tags. This is for a sort
> of
> > message board type of application, and I'd like to allow users to
use
> > some HTML, but just would like to check to ensure that no stray tags
> are
> > input that would screw up the rest of the page's display. I'm new to
> > regular expressions, and the one below is as far as I've gotten. If
> > anyone has any suggestions, they'd be very much appreciated.
> 
> Letting users enter HTML is a bad idea. Even if you only let them use
>  tags, they can still put ONCLICK and mouseover effects for the
bold
> text to screw with your other users.
> 
> Use a BB style code, such as [b] for bold, [i] for italics, etc. This
> way, you only match pairs and replace them with HTML and use
> htmlentities on anything else. This way an unmatched [b] tag won't be
> replaced with  and mess up your code.
> 
> ---John W. Holmes...
> 
> PHP Architect - A monthly magazine for PHP Professionals. Get your
copy
> today. http://www.phparch.com/
> 
> 
> 
> --
> 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] preg_match question: locating unmatched HTML tags

2003-02-22 Thread Andy Crain
Ernest,
Thanks very much. This is pretty close to what I'm looking for. The only
problem is that it doesn't catch nested tags. For example, "some text
some text some text" makes it through without error since, I
think, preg_match resumes matching at the  after spotting and then
checking its first match, at .
Andy

> -Original Message-
> From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]
> Sent: Saturday, February 22, 2003 5:48 AM
> To: Andy Crain
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] preg_match question: locating unmatched HTML tags
> 
> At 03:35 22.02.2003, Andy Crain said:
> [snip]
> >My apologies in advance if this too basic or there's a solution
easily
> >found out there, but after lots of searching, I'm still lost.
> >
> >I'm trying to build a regexp that would parse user-supplied text and
> >identify cases where HTML tags are left open or are not properly
> >matched-e.g.,  tags without closing  tags. This is for a sort
of
> >message board type of application, and I'd like to allow users to use
> >some HTML, but just would like to check to ensure that no stray tags
are
> >input that would screw up the rest of the page's display. I'm new to
> >regular expressions, and the one below is as far as I've gotten. If
> >anyone has any suggestions, they'd be very much appreciated.
> >
> >$suspect_tags = "b|i|u|strong|em|font|a|ol|ul|blockquote ";
> >$pattern = '/<(' . $suspect_tags . '[^>]*>)(.*)(?!<\/\1)/Ui';
> >if (preg_match($pattern,$_POST['entry'],$matches)) {
> >   //do something to report the unclosed tags
> >} else {
> >   echo 'Input looks fine. No unmatched tags.';
> >}
> [snip]
> 
> Hi,
> 
> I don't believe you can create a regular expression to look for
something
> that's NOT there.
> 
> I'd take this approach (tested with drawbacks, see below):
> 
> function check_tags($text) {
> $suspect_tags = "b|i|u|strong|em|font|a|ol|ul|blockquote";
> $re_find = '/<\s*(' . $suspect_tags . ').*?>(.*)/is';
> 
> while (preg_match($re_find,$text,$matches)) {
> // a suspect tag was found, check if closed
> $suspect = $matches[1];
> $text = $matches[2];
> $re_close = '/<\s*\/\s*' . $suspect . '\s*?>(.*)/is';
> if (preg_match($re_close, $text, $matches)) {
> // fine, found matching closer, continue loop
> $text = $matches[1];
> }
> else {
> // not closed - return to report it
> return $suspect;
> }
> }
> return null;
> }
> 
> $text = << This text contains < font
> size=+4 > an
> unclosed suspect tag.
> 
> EOT;
> 
> $tag = check_tags($text);
> if ($tag) echo "Unmatched: \"$tag\"\n";
> else echo "Perfect!\n";
> 
> The drawbacks: This approach is softly targeted at unintended typos,
such
> as in the example text. It won't catch deliberate attacks, such as
>Blindtext http://www.vogelsinger.at/
> 
> 
> 
> --
> 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] Sitewide Header & Footer Includes || Trouble with Relative Paths..........

2003-02-22 Thread John W. Holmes
> Hey John.
> 
> Do you ever sleep?  You've got a zillion posts in this news
> group..

Sleep is for the weak...
 
> To answer your question, it's not that I'm afraid of absolute paths,
it's
> that I don't properly understand how to implement them.
> 
> I understand why the path references are not working when I move
beyond
> the
> root level directory, but getting the file reference to work beyond
the
> root
> is the tricky part for me.
> 
> For example, with $_CONF['path'] = '/home/me/www/program';  set in my
> global_vars.inc how will I reference my image files? As
> $path.image_file_name?
> 
> Could you provide an image file reference code snippet?

For images, you'll need a "web path", that's where $_CONF['html'] comes
in.

Okay, say my program is installed in /home/user/john/www/subdir/ and I
call it from the web with http://www.mydomain.com/subdir. I define two
variables:

$_CONF['path'] = '/home/user/john/www/subdir'; //filesystem path
$_CONF['html'] = 'http://www.mydomain.com/subdir'; //web path

Now, to include a file, you'd use:

include($_CONF['path'].'/include.php');

to include from another subdirectory:

include($_CONF['path'].'/directory/functions.php');

Now, say I'm within functions.php and want to include a file that's
somewhere else. You're providing an absolute path, so it's not a big
deal.

Include($_CONF['path'].'/anotherdir/classes.php');

Now, to include an image tag in your HTML, you'd use:



Or, if all of your images are always in the same directory, you can
define a

$_CONF['images'] = 'http://www.mydomain.com/images';

and use



Hope that helps. The other suggestions are good, too, but I wouldn't use
those method. That's just me, though. 

---John Holmes...



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



[PHP] Why use persistent connections? || Data driven site

2003-02-22 Thread CF High
Hey all.

We've got a site makes several queries to our MySql db in every site page.
Should we be using persistent connections, or are we better off opening and
closing connections on each query?

Thanks for any leads,

--Noah

--




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



RE: [PHP] preg_match question: locating unmatched HTML tags

2003-02-22 Thread John W. Holmes
Well, like someone else said, it's hard to look for and match stuff that
isn't there. In addition to the security benefit, it's just easier to
code something that looks for [b](.*)[/b] and replaces those tags with
 and  (or  and  if you want to be technically
correct). 

Honestly, if you've got a small group of people like you say then just
teach them HTML so they don't make mistakes like this. Or provide a
"preview" mode so they can double check their work. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/

> -Original Message-
> From: Andy Crain [mailto:[EMAIL PROTECTED]
> Sent: Saturday, February 22, 2003 4:54 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP] preg_match question: locating unmatched HTML tags
> 
> John,
> Thanks. I'm considering that, but the application I'm working on is
for
> a small intranet that will be for only a small group of supervised
> users, so vulnerability isn't such a large concern.
> Andy
> 
> > -Original Message-
> > From: John W. Holmes [mailto:[EMAIL PROTECTED]
> > Sent: Saturday, February 22, 2003 1:06 AM
> > To: 'Andy Crain'; [EMAIL PROTECTED]
> > Subject: RE: [PHP] preg_match question: locating unmatched HTML tags
> >
> > > I'm trying to build a regexp that would parse user-supplied text
and
> > > identify cases where HTML tags are left open or are not properly
> > > matched-e.g.,  tags without closing  tags. This is for a
sort
> > of
> > > message board type of application, and I'd like to allow users to
> use
> > > some HTML, but just would like to check to ensure that no stray
tags
> > are
> > > input that would screw up the rest of the page's display. I'm new
to
> > > regular expressions, and the one below is as far as I've gotten.
If
> > > anyone has any suggestions, they'd be very much appreciated.
> >
> > Letting users enter HTML is a bad idea. Even if you only let them
use
> >  tags, they can still put ONCLICK and mouseover effects for the
> bold
> > text to screw with your other users.
> >
> > Use a BB style code, such as [b] for bold, [i] for italics, etc.
This
> > way, you only match pairs and replace them with HTML and use
> > htmlentities on anything else. This way an unmatched [b] tag won't
be
> > replaced with  and mess up your code.
> >
> > ---John W. Holmes...
> >
> > PHP Architect - A monthly magazine for PHP Professionals. Get your
> copy
> > today. http://www.phparch.com/
> >
> >
> >
> > --
> > 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



RE: [PHP] Why use persistent connections? || Data driven site

2003-02-22 Thread John W. Holmes
> We've got a site makes several queries to our MySql db in every site
page.
> Should we be using persistent connections, or are we better off
opening
> and
> closing connections on each query?

You should open a connection at the beginning of your page, run your
multiple queries, and then close it at the end. You shouldn't be opening
a connection for each query. 

As for persistent vs. normal, here's a good explanation of each option:

http://www.php.net/manual/en/features.persistent-connections.php

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



RE: [PHP] preg_match question: locating unmatched HTML tags

2003-02-22 Thread Andy Crain
Good point, and I might end up doing just that if I can't find a
solution. The problem is that I'm considering using for some forms a
 wysiwyg replacement (e.g.,
http://www.interactivetools.com/products/htmlarea/ or
http://www.siteworkspro.com) that results in HTML output. And I wanted
to check the output of that to make sure there aren't any extraneous
tags.
Andy

> -Original Message-
> From: John W. Holmes [mailto:[EMAIL PROTECTED]
> Sent: Saturday, February 22, 2003 5:04 PM
> To: 'Andy Crain'; [EMAIL PROTECTED]
> Subject: RE: [PHP] preg_match question: locating unmatched HTML tags
> 
> Well, like someone else said, it's hard to look for and match stuff
that
> isn't there. In addition to the security benefit, it's just easier to
> code something that looks for [b](.*)[/b] and replaces those tags with
>  and  (or  and  if you want to be technically
> correct).
> 
> Honestly, if you've got a small group of people like you say then just
> teach them HTML so they don't make mistakes like this. Or provide a
> "preview" mode so they can double check their work.
> 
> ---John W. Holmes...
> 
> PHP Architect - A monthly magazine for PHP Professionals. Get your
copy
> today. http://www.phparch.com/
> 
> > -Original Message-
> > From: Andy Crain [mailto:[EMAIL PROTECTED]
> > Sent: Saturday, February 22, 2003 4:54 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: [PHP] preg_match question: locating unmatched HTML tags
> >
> > John,
> > Thanks. I'm considering that, but the application I'm working on is
> for
> > a small intranet that will be for only a small group of supervised
> > users, so vulnerability isn't such a large concern.
> > Andy
> >
> > > -Original Message-
> > > From: John W. Holmes [mailto:[EMAIL PROTECTED]
> > > Sent: Saturday, February 22, 2003 1:06 AM
> > > To: 'Andy Crain'; [EMAIL PROTECTED]
> > > Subject: RE: [PHP] preg_match question: locating unmatched HTML
tags
> > >
> > > > I'm trying to build a regexp that would parse user-supplied text
> and
> > > > identify cases where HTML tags are left open or are not properly
> > > > matched-e.g.,  tags without closing  tags. This is for a
> sort
> > > of
> > > > message board type of application, and I'd like to allow users
to
> > use
> > > > some HTML, but just would like to check to ensure that no stray
> tags
> > > are
> > > > input that would screw up the rest of the page's display. I'm
new
> to
> > > > regular expressions, and the one below is as far as I've gotten.
> If
> > > > anyone has any suggestions, they'd be very much appreciated.
> > >
> > > Letting users enter HTML is a bad idea. Even if you only let them
> use
> > >  tags, they can still put ONCLICK and mouseover effects for the
> > bold
> > > text to screw with your other users.
> > >
> > > Use a BB style code, such as [b] for bold, [i] for italics, etc.
> This
> > > way, you only match pairs and replace them with HTML and use
> > > htmlentities on anything else. This way an unmatched [b] tag won't
> be
> > > replaced with  and mess up your code.
> > >
> > > ---John W. Holmes...
> > >
> > > PHP Architect - A monthly magazine for PHP Professionals. Get your
> > copy
> > > today. http://www.phparch.com/
> > >
> > >
> > >
> > > --
> > > 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] upgrade to 4.3.0 nearly doubled execution time

2003-02-22 Thread Rhett Livingston
I upgraded my development system from PHP 4.1.2 to PHP 4.3.0 last week and
the performance of my scripts took a dive.  Specifically, the average time
to parse my scripts (time from executing first line of code to executing
first line after includes) went from about 100ms to about 200ms, and, very
oddly, my times to connect to an Oracle database also went up by about the
same margin.

Switching back to 4.1.2 clears the problem back up.

What changed between 4.1.2 and 4.3.0 that could cause this?  File IO stuff
perhaps?  Any ideas to solve it?

Thanks,
Rhett Livingston

I'm running WinXP Pro, IIS, PHP as a CGI, and Oracle 9.2.



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



Re: [PHP] Sitewide Header & Footer Includes || Trouble with Relative Paths..........

2003-02-22 Thread Noah
Thanks again John for the informative reply.

Now I follow what you're doing.

Get some sleep ;--)

--Noah


- Original Message -
From: "John W. Holmes" <[EMAIL PROTECTED]>
To: "'Noah'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, February 22, 2003 1:56 PM
Subject: RE: [PHP] Sitewide Header & Footer Includes || Trouble with
Relative Paths..


> > Hey John.
> >
> > Do you ever sleep?  You've got a zillion posts in this news
> > group..
>
> Sleep is for the weak...
>
> > To answer your question, it's not that I'm afraid of absolute paths,
> it's
> > that I don't properly understand how to implement them.
> >
> > I understand why the path references are not working when I move
> beyond
> > the
> > root level directory, but getting the file reference to work beyond
> the
> > root
> > is the tricky part for me.
> >
> > For example, with $_CONF['path'] = '/home/me/www/program';  set in my
> > global_vars.inc how will I reference my image files? As
> > $path.image_file_name?
> >
> > Could you provide an image file reference code snippet?
>
> For images, you'll need a "web path", that's where $_CONF['html'] comes
> in.
>
> Okay, say my program is installed in /home/user/john/www/subdir/ and I
> call it from the web with http://www.mydomain.com/subdir. I define two
> variables:
>
> $_CONF['path'] = '/home/user/john/www/subdir'; file://filesystem path
> $_CONF['html'] = 'http://www.mydomain.com/subdir'; file://web path
>
> Now, to include a file, you'd use:
>
> include($_CONF['path'].'/include.php');
>
> to include from another subdirectory:
>
> include($_CONF['path'].'/directory/functions.php');
>
> Now, say I'm within functions.php and want to include a file that's
> somewhere else. You're providing an absolute path, so it's not a big
> deal.
>
> Include($_CONF['path'].'/anotherdir/classes.php');
>
> Now, to include an image tag in your HTML, you'd use:
>
> 
>
> Or, if all of your images are always in the same directory, you can
> define a
>
> $_CONF['images'] = 'http://www.mydomain.com/images';
>
> and use
>
> 
>
> Hope that helps. The other suggestions are good, too, but I wouldn't use
> those method. That's just me, though.
>
> ---John Holmes...
>
>


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



[PHP] Select Field Form Value

2003-02-22 Thread Mike Walth
Hello:

Here is my problem.  I am using the following two lines to get multiple
values from a form field select statement.

while (list($key,$val) = each($_POST[Restrictions])) {$Restrictions .=
"$val,";}

Restrictions$Restrictions

The problem is when it fills out the table, it adds "Array" prior to the
values.  Is there an easy way to strip that out?

Any help is appreciated.

Thank you,
Mike Walth
CinoFusion



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



[PHP] sending results by email

2003-02-22 Thread Luis A


how can i make the server email me 
the results of this form __ 


   
  

  

  no 
  



any subjestion 



[PHP] SMS messages and the From field...

2003-02-22 Thread Jeff Lewis
I have been using mail() to send SMS messages to my phone but the From
address never seems to work as I set it. When it arrives in my email client
it works fine but when it gets to my phone it does. I have set headers like
so:

"From: $from_email\r\nReply-To: $from_email\r\nReturn-path: $from_email"

I have also tried to set this before and then after the mail() call:

ini_set(sendmail_from, "$from_email");
ini_restore(sendmail_from);

Has anyone experienced this same thing? If so, did you manage to get it
fixed?

Jeff



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



RE: [PHP] sending results by email

2003-02-22 Thread Dennis Cole
A "subjestion" would be to use the mail() function to. You can find the mail
fuction at http://www.php.net/manual/en/function.mail.php.

-Original Message-
From: Luis A [mailto:[EMAIL PROTECTED]
Sent: Saturday, February 22, 2003 5:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP] sending results by email




how can i make the server email me
the results of this form __


  
  

  

  no 
  



any subjestion 



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



Re: [PHP] upgrade to 4.3.0 nearly doubled execution time

2003-02-22 Thread Jason k Larson
I'm betting this is related...

I upgraded to 4.3.0 on my production linux servers and began to have 
serious socket connection issues.  Rolling back to 4.2.3 cleared 
everything up.  I also saw an increase in script execution times with 
4.3.0, which became much better using 4.2.3.  I noticed some very 
strange behavior which leads me to believe 4.3.0 is not stable, and 
shouldn't be used in a production environment.

So, all I can suggest for now is to determine what it is you need, and 
if a newer version of PHP will suit, go for it.  But stay away from 
4.3.0 and 4.3.1 (which I've read up on and hasn't addressed any of these 
 issues).

Regards,
Jason k Larson
Rhett Livingston wrote:
I upgraded my development system from PHP 4.1.2 to PHP 4.3.0 last week and
the performance of my scripts took a dive.  Specifically, the average time
to parse my scripts (time from executing first line of code to executing
first line after includes) went from about 100ms to about 200ms, and, very
oddly, my times to connect to an Oracle database also went up by about the
same margin.
Switching back to 4.1.2 clears the problem back up.

What changed between 4.1.2 and 4.3.0 that could cause this?  File IO stuff
perhaps?  Any ideas to solve it?
Thanks,
Rhett Livingston
I'm running WinXP Pro, IIS, PHP as a CGI, and Oracle 9.2.





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


Re: [PHP] Printer Friendly page

2003-02-22 Thread olinux
make your own. what could be simpler?

If you have data that is generated with php, just
change the output to just send very basic html page. 

olinux


--- Sebastian <[EMAIL PROTECTED]> wrote:
> Greetings all.
> 
> I am looking for a simple print page script. I tried
> just about all the print scripts at hotscripts.com
> and not one works (at least for me). 
> 
> Does anyone know of one that works under php v 4.2.3
> with register globals off?
> 
> thanks in advance.
> 


__
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

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



RE: [PHP] Select Field Form Value

2003-02-22 Thread John W. Holmes
> Here is my problem.  I am using the following two lines to get
multiple
> values from a form field select statement.
> 
> while (list($key,$val) = each($_POST[Restrictions])) {$Restrictions .=
> "$val,";}
> 
> Restrictions$Restrictions
> 
> The problem is when it fills out the table, it adds "Array" prior to
the
> values.  Is there an easy way to strip that out?
> 
> Any help is appreciated.

Is register globals on? If so, if you tried to echo $Restrictions, it's
just print "Array". Since you're using .=, it's going to tack on the
values after the "Array". The solution, rather, the best solution, is to
turn off register globals. Another option is to use a different variable
name than $Restrictions or unset() it before you start adding text to
it. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



[PHP] Re: preg_match question: locating unmatched HTML tags

2003-02-22 Thread php
you could consider configuring a prebuild html editor (just WYSIWYG)
without any problems of users having to write code at all
check out: http://www.interactivetools.com/products/htmlarea/


"Andy Crain" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> My apologies in advance if this too basic or there's a solution easily
> found out there, but after lots of searching, I'm still lost.
>
>
>
> I'm trying to build a regexp that would parse user-supplied text and
> identify cases where HTML tags are left open or are not properly
> matched-e.g.,  tags without closing  tags. This is for a sort of
> message board type of application, and I'd like to allow users to use
> some HTML, but just would like to check to ensure that no stray tags are
> input that would screw up the rest of the page's display. I'm new to
> regular expressions, and the one below is as far as I've gotten. If
> anyone has any suggestions, they'd be very much appreciated.
>
> Thanks,
>
> Andy
>
>
>
>
>
> $suspect_tags = "b|i|u|strong|em|font|a|ol|ul|blockquote ";
>
> $pattern = '/<(' . $suspect_tags . '[^>]*>)(.*)(?!<\/\1)/Ui';
>
> if (preg_match($pattern,$_POST['entry'],$matches)) {
>
>//do something to report the unclosed tags
>
> } else {
>
>echo 'Input looks fine. No unmatched tags.';
>
> }
>
>



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



[PHP] flashing text possible on PDA?

2003-02-22 Thread Denis L. Menezes
Hello friends.

I am developing some light pages on the web basically for access by PDAs. I need to 
put and alert for some members so that as soon as they log in, the next page will show 
a flashing alert on the page.

Can anyone suggest how I can make text flash on a PDA considering that the PDA 
browsers do not support many Javascript commands?

Thanks
Denis

Re: [PHP] flashing text possible on PDA?

2003-02-22 Thread Leo Spalteholz
On February 22, 2003 04:38 pm, Denis L. Menezes wrote:
> Hello friends.
>
> I am developing some light pages on the web basically for access by
> PDAs. I need to put and alert for some members so that as soon as
> they log in, the next page will show a flashing alert on the page.
>
> Can anyone suggest how I can make text flash on a PDA considering
> that the PDA browsers do not support many Javascript commands?

No!  Just when I thought the  tag was finally dead and gone 
someone wants to bring it to PDAs... :)

Leo

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



[PHP] Writing to COM-Port with PHP 4.3.0 on OS/2 with Apache 2.0.44

2003-02-22 Thread Thorolf Godawa
Hi,

how can I write to a COM-Port on OS/2 using PHP 4.3.0 with Apache 2.0.44?

With

$fp = fopen ("COM1", "w+");
$string = chr($OutCmd) . chr($Platine) . chr($OutData) . chr($OutPruef);
fputs ($fp, $string );
fclose ($fp);
it seems not to work ($fp returns "Resource id #2"), and

$fp = fopen ("COM1:", "w+");
...
..
.
creates an error: "Warning: fopen(COM1:) [function.fopen]: failed to 
create stream: No such file or directory in x:\htdocs\test.php on line 
3" :-(

The same functionality with Rexx is working!

Thanks a lot,

Thorolf

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


[PHP] Re: Question about str_replace()

2003-02-22 Thread Hans Prins
Assuming that you do want to replace "[p]" with "", the code you posted
worked for me. The following printed: "leadingtexttrailingtext" to the
screen

');
$text = "leadingtext[p]trailingtext";
$words = str_replace ($find, $replace, $text);
print $words;
?>

"Al" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> I have a simple str_replace function that obviously has a syntax
> problem.  The [p] in the $find array ignores the brackets.  Every "p" in
> my text is replaced by a .  Just for the heck of it, I've tried "
> instead of ', and preg_replace(), etc.
>
> $find= array('& ','W&OD', '"&"', chr(146), '[p]');
> $replace= array("& ","W&OD", '"&"', "'", '');
>
> $words= str_replace ($find, $replace, $text);
>
> Thanks.
>



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



Re: [PHP] upgrade to 4.3.0 nearly doubled execution time

2003-02-22 Thread Rasmus Lerdorf
Yes, I have noticed some performance issues as well, but we need to nail
it down better before we can start really going after this.  Could we call
on the collective masses of php-general users to run some benchmark tests?

Just build yourselves a libphp4.so for both 4.2.x and 4.3.x and switch the
LoadModule line back and forth to benchmark the two versions.  Then use
something like http_load (http://www.acme.com/software/http_load/) to
check various simple scripts.  We need to figure out if this is an
across-the-board performance problem or if it is one particular aspect
which has slowed down.

-Rasmus

On Sat, 22 Feb 2003, Jason k Larson wrote:

> I'm betting this is related...
>
> I upgraded to 4.3.0 on my production linux servers and began to have
> serious socket connection issues.  Rolling back to 4.2.3 cleared
> everything up.  I also saw an increase in script execution times with
> 4.3.0, which became much better using 4.2.3.  I noticed some very
> strange behavior which leads me to believe 4.3.0 is not stable, and
> shouldn't be used in a production environment.
>
> So, all I can suggest for now is to determine what it is you need, and
> if a newer version of PHP will suit, go for it.  But stay away from
> 4.3.0 and 4.3.1 (which I've read up on and hasn't addressed any of these
>   issues).
>
> Regards,
> Jason k Larson
>
>
> Rhett Livingston wrote:
> > I upgraded my development system from PHP 4.1.2 to PHP 4.3.0 last week and
> > the performance of my scripts took a dive.  Specifically, the average time
> > to parse my scripts (time from executing first line of code to executing
> > first line after includes) went from about 100ms to about 200ms, and, very
> > oddly, my times to connect to an Oracle database also went up by about the
> > same margin.
> >
> > Switching back to 4.1.2 clears the problem back up.
> >
> > What changed between 4.1.2 and 4.3.0 that could cause this?  File IO stuff
> > perhaps?  Any ideas to solve it?
> >
> > Thanks,
> > Rhett Livingston
> >
> > I'm running WinXP Pro, IIS, PHP as a CGI, and Oracle 9.2.
> >
> >
> >
>
>
>
> --
> 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[2]: [PHP] Sitewide Header & Footer Includes || Trouble with Relative Paths..........

2003-02-22 Thread Tom Rogers
Hi,

Sunday, February 23, 2003, 9:13:16 AM, you wrote:
CH> Hey Tom.

CH> Thanks for the idea; however, since we're not hosting the site on our own
CH> server, we don't have permissions for altering the php.ini file..

CH> --Noah


It only sets the ini path for the current document, it does not alter the site
wide php.ini

-- 
regards,
Tom


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



[PHP] Permission Denied

2003-02-22 Thread Stephen Craton
Hello,

I'm having a few problems with deleting items. When I do the unlink()
function, it gives me a permission denied error. For example..here's the
code:

unlink($this->currentfolder().'/packs/'.$title.'/'.$intname);

Here's the error returned:

Warning: unlink() failed (Permission denied) in
/usr/local/plesk/apache/vhosts/piw.melchior.us/httpdocs/phpiw/classes/class.
delete.php on line 45

The problem with all this is, I dynamically create the directories and files
and dynamically CHMOD them all to 777 with no problems. I don't see why I'm
getting all this! Please help ASAP! Thanks in advance!

Thanks,
Stephen Craton
http://www.melchior.us



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



[PHP] Permission Denied

2003-02-22 Thread Stephen Craton
Hello,

I'm having a few problems with deleting items. When I do the unlink()
function, it gives me a permission denied error. For example..here's the
code:

unlink($this->currentfolder().'/packs/'.$title.'/'.$intname);

Here's the error returned:

Warning: unlink() failed (Permission denied) in
/usr/local/plesk/apache/vhosts/piw.melchior.us/httpdocs/phpiw/classes/class.
delete.php on line 45

The problem with all this is, I dynamically create the directories and files
and dynamically CHMOD them all to 777 with no problems. I don't see why I'm
getting all this! Please help ASAP! Thanks in advance!

Thanks,
Stephen Craton
http://www.melchior.us



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



RE: [PHP] flashing text possible on PDA?

2003-02-22 Thread John W. Holmes
> I am developing some light pages on the web basically for access by
PDAs.
> I need to put and alert for some members so that as soon as they log
in,
> the next page will show a flashing alert on the page.
> 
> Can anyone suggest how I can make text flash on a PDA considering that
the
> PDA browsers do not support many Javascript commands?

This has nothing to do with PHP. Search google, but I'll wager it's not
possible. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



Re: [PHP] preg_match question: locating unmatched HTML tags

2003-02-22 Thread Tom Rogers
Hi,

Saturday, February 22, 2003, 12:35:15 PM, you wrote:
AC> My apologies in advance if this too basic or there's a solution easily
AC> found out there, but after lots of searching, I'm still lost.

 

AC> I'm trying to build a regexp that would parse user-supplied text and
AC> identify cases where HTML tags are left open or are not properly
AC> matched-e.g.,  tags without closing  tags. This is for a sort of
AC> message board type of application, and I'd like to allow users to use
AC> some HTML, but just would like to check to ensure that no stray tags are
AC> input that would screw up the rest of the page's display. I'm new to
AC> regular expressions, and the one below is as far as I've gotten. If
AC> anyone has any suggestions, they'd be very much appreciated.

AC> Thanks,

AC> Andy

 

 

AC> $suspect_tags = "b|i|u|strong|em|font|a|ol|ul|blockquote ";

AC> $pattern = '/<(' . $suspect_tags . '[^>]*>)(.*)(?!<\/\1)/Ui';

AC> if (preg_match($pattern,$_POST['entry'],$matches)) {

AC>//do something to report the unclosed tags

AC> } else {

AC>echo 'Input looks fine. No unmatched tags.';

AC> }

The simplest is just to add  directly to 
the end of their
message, may not be technically correct but it won't do any harm either :)

-- 
regards,
Tom


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



Re: [PHP] Printer Friendly page

2003-02-22 Thread Justin French
if you're already building dynamic pages, just roll your own... set a GET
var to trigger a simple page view (simple layout, less HTML, very little
CSS, no tables, etc etc) which uses the same CONTENT but keeps it simple for
printing.


justin



on 23/02/03 8:28 AM, Sebastian ([EMAIL PROTECTED]) wrote:

> Greetings all.
> 
> I am looking for a simple print page script. I tried just about all the print
> scripts at hotscripts.com and not one works (at least for me).
> 
> Does anyone know of one that works under php v 4.2.3 with register globals
> off?
> 
> thanks in advance.
> 


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



Re: [PHP] preg_match question: locating unmatched HTML tags

2003-02-22 Thread Tom Rogers
Hi,

Saturday, February 22, 2003, 12:35:15 PM, you wrote:
AC> My apologies in advance if this too basic or there's a solution easily
AC> found out there, but after lots of searching, I'm still lost.

 

AC> I'm trying to build a regexp that would parse user-supplied text and
AC> identify cases where HTML tags are left open or are not properly
AC> matched-e.g.,  tags without closing  tags. This is for a sort of
AC> message board type of application, and I'd like to allow users to use
AC> some HTML, but just would like to check to ensure that no stray tags are
AC> input that would screw up the rest of the page's display. I'm new to
AC> regular expressions, and the one below is as far as I've gotten. If
AC> anyone has any suggestions, they'd be very much appreciated.

AC> Thanks,

AC> Andy

 

 

AC> $suspect_tags = "b|i|u|strong|em|font|a|ol|ul|blockquote ";

AC> $pattern = '/<(' . $suspect_tags . '[^>]*>)(.*)(?!<\/\1)/Ui';

AC> if (preg_match($pattern,$_POST['entry'],$matches)) {

AC>//do something to report the unclosed tags

AC> } else {

AC>echo 'Input looks fine. No unmatched tags.';

AC> }

Here is a function that will fixup simple tags like   ,it will add in the
missing /b tag at the next start/end tag or end of document.

function fix_mismatch($str){
$match = array();
$split = preg_split('!\<(.*?)\>!s', $str);
$c = count($split);
$r = ($c == 1)? $str : '';
if($c > 1){
$fix = '';
preg_match_all('!\<(.*?)\>!s', $str,$match);
for($x=0,$y=0;$x < $c;$x++){
$out = $split[$x].$fix; //add in text + any fixup end 
tag
$fix = '';
if(isset($match[0][$x])){
$list = explode(' ',$match[1][$x]); //split up 
compound tag like 
$t = trim(strtolower($list[0]));//get 
the tag name
switch ($t){
//add tags to check/fix here
case 'b':
case 'div':
case 'i':
case 'textarea':
$st = '/'.$t;   //make an end 
tag to search for
$rest = array_slice($match[1],$x+1); 
// get the remaining tags
$found = false;
while(!$found && list(,$v) = 
each($rest)){
$et = explode(' ',$v);
$found = ($st == 
trim(strtolower($et[0])))? True:False; //have we found it ?
}
if(!$found){
$fix = '<'.$st.'>'; //create 
an html end tag
}
break;
}
$out .= $match[0][$x]; //add in tag
}
$r .= $out; //build return string
}
}
return $r;
}

//usage
$test1 = 'This is a bold word  and another bold 
word end of test';
$test2 = 'frog';

echo fix_mismatch($test1);
echo '';
echo fix_mismatch($test2);

-- 
regards,
Tom


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