php-general Digest 19 May 2001 23:59:03 -0000 Issue 696

Topics (messages 53515 through 53569):

Unix problem
        53515 by: Urb LeJeune
        53530 by: B. van Ouwerkerk
        53534 by: Urb LeJeune

more on problem
        53516 by: Urb LeJeune

Re: Netscape 6, What a piece of s$#@ , anyone else had problems with php and Netscape 
6?
        53517 by: Jakob Kruse
        53568 by: Miles Thompson

hosting "closed" web application for multiple users
        53518 by: Steven Haryanto
        53520 by: Craig Vincent
        53522 by: Steven Haryanto
        53529 by: Mr. Adam ALLEN.
        53531 by: Matthias Winkelmann
        53532 by: Steven Haryanto

mail() problem
        53519 by: Mark Wouters
        53521 by: Craig Vincent
        53523 by: Urb LeJeune

Color of Pixel
        53524 by: Martin Thoma
        53528 by: Rasmus Lerdorf

Urgent! Need help on semaphores
        53525 by: fidodido.post1.com

The performance of sleep() and usleep()
        53526 by: BlackLord

count() multidimensional array
        53527 by: Dean Martin
        53543 by: Chris Lee

Re: Life of environment variable set put putenv()
        53533 by: Arcady Genkin

attachements in mail()
        53535 by: Mark Wouters

Command output into any array?
        53536 by: Ken Jansons
        53540 by: Chris Lee

Getting email out of a database
        53537 by: Richard Kurth
        53538 by: Christian Dechery

vpopmail functions
        53539 by: Freedom

Lookin For Programmer
        53541 by: nicholas

PHP & Domino?? (Lotus Notes)
        53542 by: Mike Kelley

Mailserver?!
        53544 by: FredrikAT

Expense
        53545 by: Clayton Dukes
        53547 by: Navid Yar
        53548 by: Clayton Dukes
        53549 by: Kurth Bemis
        53551 by: Clayton Dukes

Re: globalize all variables not coming from a certain form...
        53546 by: Chris Lee

converting int to char
        53550 by: Christian Dechery
        53552 by: Kees Hoekzema

mail function. not working
        53553 by: Richard Kurth
        53554 by: CC Zona

Include Paths
        53555 by: Dylan Finney

Reports in web browser
        53556 by: Mihailo Dzigurski

Reversing htmlspecialchars()
        53557 by: Jeroen Geusebroek
        53558 by: Rasmus Lerdorf
        53559 by: Jeroen Geusebroek
        53565 by: jeroen.php.net
        53566 by: Rudi Benkovič

sending attachements with mail
        53560 by: Mark Wouters

Global variables? (unset/set or what?)
        53561 by: Richard
        53563 by: Michael Stearne
        53567 by: Richard
        53569 by: CC Zona

get all defined constants?
        53562 by: Alex Black

Re: sending attachments with mail
        53564 by: David Price

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]


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


        I'm using the follow snippet while traversing a directory.

while ($Directory=readdir($DirHandle)) {

  $IsFile = is_file($Directory);
  $IsDir = is_dir($Directory);
  echo " is file=$IsFile - is dir=$IsDir\n";

        Works fine on Windows box, on a Unix box (RedHat) both
is_file() and is_dir() return null no matter what the contents of
$Directory is.

        Any suggestions of what could be wrong with the Unix
version?

Urb






>while ($Directory=readdir($DirHandle)) {
>
>  $IsFile = is_file($Directory);
>  $IsDir = is_dir($Directory);
>  echo " is file=$IsFile - is dir=$IsDir\n";
>
>         Works fine on Windows box, on a Unix box (RedHat) both
>is_file() and is_dir() return null no matter what the contents of
>$Directory is.

This is a wild guess..
UPPER and lowercase used instead of only upper of only lowercase..
Spaces in file or directory names..

Bye,


B.







>>while ($Directory=readdir($DirHandle)) {
>>
>>  $IsFile = is_file($Directory);
>>  $IsDir = is_dir($Directory);
>>  echo " is file=$IsFile - is dir=$IsDir\n";
>>
>>         Works fine on Windows box, on a Unix box (RedHat) both
>>is_file() and is_dir() return null no matter what the contents of
>>$Directory is.
>
>This is a wild guess..
>UPPER and lowercase used instead of only upper of only lowercase..
>Spaces in file or directory names..

         Thanks for the suggestion but if I have:

while ($Directory=readdir($DirHandle)) {
$IsFile = is_file($Directory);
$IsDir = is_dir($Directory);
echo " is file=$IsFile - is dir=$IsDir\n";
echo "name=$Directory\n";

It displays the name of the file or directory correctly.

Urb


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





        As a follow up on my last post, the following works
on my Windows system but not on my Unix system:

  $Type = filetype($Directory);

On Unix it always returns a null value.

Urb





Brandon, might I suggest that you start using the HTML Validator at
www.w3.org if you intend to write HTML that is viewable in Netscape 6.x. As
pointed out by many others, Netscape 6 is a browser which does things
according to W3C specs (mostly... a lot better than most other browsers
anyway) and you are quite clearly not aware of what those specs are.

I tried validating your HTML shown below. It is not even close to being
valid HTML 4.01 Transitional, which is the loosest standard anyone should
aim for at the moment (for the general progression of the WWW as a unity).

Try the validator. It really is quite nice, and it *will* teach you how to
write compliant HTML.

Regards,
Jakob Kruse

"Brandon Orther" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> This is the HTML that is returned by PHP.  Does anyone know why Netscape
> Would have problems viewing it?
>
>
> <html>
> <head>
> <title>Control Maestro Menu System</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> <link rel="stylesheet" href="menu.css" type="text/css">
> </head>
> <body bgcolor="#FFFFFF" text="#000000" MARGINWIDTH=0 LEFTMARGIN=0
> MARGINHEIGHT=0 TOPMARGIN=0 background="../html/gray-background.gif"><table
> width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
> <tr>
>     <td valign="top">
>       <table width="100%" border="0" cellspacing="0" cellpadding="0">
>         <tr>
>           <td width="1%" height="15" valign="middle"><font class="text">
<a
> href="menu.php?open=Web%20Mail"><img src="closed.gif" border="0">
>             </a> </font></td>
>           <td width="99%" height="15" valign="middle"><font class="text">
<a
> href="menu.php?open=Web%20Mail">Web
>             Mail</a></font></td>
>         <tr>
>           <td background="divide.gif"><img src="divide.gif"></td>
>           <td background="divide.gif"><img src="divide.gif"></td>
>         </tr>
>         <tr>
>           <td width="1%" height="15" valign="middle"><font class="text">
<a
> href="menu.php?open=Account%20Managment"><img src="closed.gif" border="0">
>             </a> </font></td>
>           <td width="99%" height="15" valign="middle"><font class="text">
<a
> href="menu.php?open=Account%20Managment">Account
>             Managment</a></font></td>
>         <tr>
>           <td background="divide.gif"><img src="divide.gif"></td>
>           <td background="divide.gif"><img src="divide.gif"></td>
>         </tr>
>         <tr>
>           <td width="1%" height="15" valign="middle"><font class="text">
<a
> href="menu.php?open=Support"><img src="closed.gif" border="0">
>             </a> </font></td>
>           <td width="99%" height="15" valign="middle"><font class="text">
<a
> href="menu.php?open=Support">Support</a></font></td>
>         <tr>
>           <td background="divide.gif"><img src="divide.gif"></td>
>           <td background="divide.gif"><img src="divide.gif"></td>
>         </tr>
>         <tr>
>           <td width="1%" height="15" valign="middle"><font class="text">
<a
> href="menu.php?open=Billing"><img src="closed.gif" border="0">
>             </a> </font></td>
>           <td width="99%" height="15" valign="middle"><font class="text">
<a
> href="menu.php?open=Billing">Billing</a></font></td>
>         <tr>
>           <td background="divide.gif"><img src="divide.gif"></td>
>           <td background="divide.gif"><img src="divide.gif"></td>
>         </tr>
>         <tr>
>           <td width="1%" height="15" valign="middle"><font class="text">
<a
> href="menu.php?open=Domain%20Managment"><img src="closed.gif" border="0">
>             </a> </font></td>
>           <td width="99%" height="15" valign="middle"><font class="text">
<a
> href="menu.php?open=Domain%20Managment">Domain
>             Managment</a></font></td>
>         <tr>
>           <td background="divide.gif"><img src="divide.gif"></td>
>           <td background="divide.gif"><img src="divide.gif"></td>
>         </tr>
>         <tr>
>           <td width="1%" height="15" valign="middle"><font class="text">
<a
> href="menu.php?open=Business%20Center"><img src="closed.gif" border="0">
>             </a> </font></td>
>           <td width="99%" height="15" valign="middle"><font class="text">
<a
> href="menu.php?open=Business%20Center">Business
>             Center</a></font></td>
>         <tr>
>           <td background="divide.gif"><img src="divide.gif"></td>
>           <td background="divide.gif"><img src="divide.gif"></td>
>         </tr>
>       </table>
>     </td>
>     <td background="menu_edge.gif" width="8"><img
> src="menu_edge.gif"></td></tr></table>
> </body>
> </html>







Jakob,

You mean tidy?

I use it to post-process a 'Today's News" page that is created, by script, 
from a set of other pages.
It works very well.

Miles Thompson

At 03:54 PM 5/19/01 +0200, Jakob Kruse wrote:
>Brandon, might I suggest that you start using the HTML Validator at
>www.w3.org if you intend to write HTML that is viewable in Netscape 6.x. As
>pointed out by many others, Netscape 6 is a browser which does things
>according to W3C specs (mostly... a lot better than most other browsers
>anyway) and you are quite clearly not aware of what those specs are.
>
>I tried validating your HTML shown below. It is not even close to being
>valid HTML 4.01 Transitional, which is the loosest standard anyone should
>aim for at the moment (for the general progression of the WWW as a unity).
>
>Try the validator. It really is quite nice, and it *will* teach you how to
>write compliant HTML.
>
>Regards,
>Jakob Kruse
>
>"Brandon Orther" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > This is the HTML that is returned by PHP.  Does anyone know why Netscape
> > Would have problems viewing it?
> >
> >
> > <html>
> > <head>
> > <title>Control Maestro Menu System</title>
> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> > <link rel="stylesheet" href="menu.css" type="text/css">
> > </head>
> > <body bgcolor="#FFFFFF" text="#000000" MARGINWIDTH=0 LEFTMARGIN=0
> > MARGINHEIGHT=0 TOPMARGIN=0 background="../html/gray-background.gif"><table
> > width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
> > <tr>
> >     <td valign="top">
> >       <table width="100%" border="0" cellspacing="0" cellpadding="0">
> >         <tr>
> >           <td width="1%" height="15" valign="middle"><font class="text">
><a
> > href="menu.php?open=Web%20Mail"><img src="closed.gif" border="0">
> >             </a> </font></td>
> >           <td width="99%" height="15" valign="middle"><font class="text">
><a
> > href="menu.php?open=Web%20Mail">Web
> >             Mail</a></font></td>
> >         <tr>
> >           <td background="divide.gif"><img src="divide.gif"></td>
> >           <td background="divide.gif"><img src="divide.gif"></td>
> >         </tr>
> >         <tr>
> >           <td width="1%" height="15" valign="middle"><font class="text">
><a
> > href="menu.php?open=Account%20Managment"><img src="closed.gif" border="0">
> >             </a> </font></td>
> >           <td width="99%" height="15" valign="middle"><font class="text">
><a
> > href="menu.php?open=Account%20Managment">Account
> >             Managment</a></font></td>
> >         <tr>
> >           <td background="divide.gif"><img src="divide.gif"></td>
> >           <td background="divide.gif"><img src="divide.gif"></td>
> >         </tr>
> >         <tr>
> >           <td width="1%" height="15" valign="middle"><font class="text">
><a
> > href="menu.php?open=Support"><img src="closed.gif" border="0">
> >             </a> </font></td>
> >           <td width="99%" height="15" valign="middle"><font class="text">
><a
> > href="menu.php?open=Support">Support</a></font></td>
> >         <tr>
> >           <td background="divide.gif"><img src="divide.gif"></td>
> >           <td background="divide.gif"><img src="divide.gif"></td>
> >         </tr>
> >         <tr>
> >           <td width="1%" height="15" valign="middle"><font class="text">
><a
> > href="menu.php?open=Billing"><img src="closed.gif" border="0">
> >             </a> </font></td>
> >           <td width="99%" height="15" valign="middle"><font class="text">
><a
> > href="menu.php?open=Billing">Billing</a></font></td>
> >         <tr>
> >           <td background="divide.gif"><img src="divide.gif"></td>
> >           <td background="divide.gif"><img src="divide.gif"></td>
> >         </tr>
> >         <tr>
> >           <td width="1%" height="15" valign="middle"><font class="text">
><a
> > href="menu.php?open=Domain%20Managment"><img src="closed.gif" border="0">
> >             </a> </font></td>
> >           <td width="99%" height="15" valign="middle"><font class="text">
><a
> > href="menu.php?open=Domain%20Managment">Domain
> >             Managment</a></font></td>
> >         <tr>
> >           <td background="divide.gif"><img src="divide.gif"></td>
> >           <td background="divide.gif"><img src="divide.gif"></td>
> >         </tr>
> >         <tr>
> >           <td width="1%" height="15" valign="middle"><font class="text">
><a
> > href="menu.php?open=Business%20Center"><img src="closed.gif" border="0">
> >             </a> </font></td>
> >           <td width="99%" height="15" valign="middle"><font class="text">
><a
> > href="menu.php?open=Business%20Center">Business
> >             Center</a></font></td>
> >         <tr>
> >           <td background="divide.gif"><img src="divide.gif"></td>
> >           <td background="divide.gif"><img src="divide.gif"></td>
> >         </tr>
> >       </table>
> >     </td>
> >     <td background="menu_edge.gif" width="8"><img
> > src="menu_edge.gif"></td></tr></table>
> > </body>
> > </html>
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]





I have a requirement like this:

- the php script should be runnable by httpd user only.
- the php script will include other files.
- the php script should run as the user.
- the user must not be able to access the source code
   of the scripts.

What I can think of so far:

Put the script in a directory only accessible by the
httpd user (www), e.g.:

  # mkdir -p /home/app
  # cp script.php /home/app
  # chown root.www /home/app
  # chmod 550 /home/app
  # chown root.root /home/app/script.php
  # chmod 555 /home/app/script.php

So script.php is safe from the user (except when somehow
the user manages to get its current directory changed to
/home/app, where then she can take script.php easily).

To prevent the user getting her hands to the script.php
via www user, I set the Apache configuration:

  Options SymLinksIfOwnerMatch

to prevent the user linking to /home/app or
/home/app/script.php (unless the user can trick www or
some other privileged user to create the link for her).

and makes sure that Apache only runs wrapped CGI scripts,
and php runs as a cgi binary and not server module.

Now I just need to make sure that:

1) user cannot trick script.php to read and display itself
out to the browser, or copy itself to some public
directory.

2) user cannot trick other root processes to read
script.php for her.

Is there a better alternative?

Regards,
Steve 





<snip>
2) user cannot trick other root processes to read
script.php for her.

Is there a better alternative?
</snip>

Depending on your budget yes there is.  Zend has a PHP encoding utility
which performs two functions, first off since it needs to run through their
optimizer your PHP scripts will tend to run faster (at the expense of a bit
more memory consumption) and also you don't need to worry about preventing
the source code from being read as the php scripts are converted into a
binary executable.  License to use these programs are I believe around $600
per year but offer a wide range of additional features but I would consider
it well worth it to a company rather than spending countless tech hours and
security testing to prevent the source from being viewed.

http://www.zend.com

Sincerely,

Craig Vincent





Actually, We _are_ considering of buying Zend Encoder, but in the
middle of thinking for alternatives... :-)

However, sometimes vendors do not want user to have access to
the _binary also_ (and then run it somewhere else), so that needs
some extra protection other than the Encoder too.

Regards,
Steve

At 19/05/2001 21:47, Craig Vincent wrote:
><snip>
>2) user cannot trick other root processes to read
>script.php for her.
>
>Is there a better alternative?
></snip>
>
>Depending on your budget yes there is.  Zend has a PHP encoding utility
>which performs two functions, first off since it needs to run through their
>optimizer your PHP scripts will tend to run faster (at the expense of a bit
>more memory consumption) and also you don't need to worry about preventing
>the source code from being read as the php scripts are converted into a
>binary executable.  License to use these programs are I believe around $600
>per year but offer a wide range of additional features but I would consider
>it well worth it to a company rather than spending countless tech hours and
>security testing to prevent the source from being viewed.
>
>http://www.zend.com
>
>Sincerely,
>
>Craig Vincent





The only idea i have is not perfect, but would stop people without time on
their hands from getting your code. (But it could be time consuming for you
(but free))

1) make the source code a string
2) encrypt it, (but try use bizzare, unheard of functions so that it takes
longer to work out how to decrypt it)
3) when running the code decrypt it, (use some hash to check the code has
been decrypted ok)
4) eval() the code

If some code was encrypted as above so people didn't have too much of a clue
what was happening.
1) make the code include("httP://www.yoursite.com/code-custid=43824";);
2) maybe cache it on the server for a period of time (otherwise every
execution would hit your server, and performance would certainly drop).

Assuming the code works, doesn't bring in gaping security holes, and
performance doesn't suffer too much then this could be used in a situation,
that if someone doesn't pay renewal of license fess (or you fall out with
them), you can revoke their access to your code.

This would probably work much better if it is a binary from Zend, as people
would have the binary, but without getting the ok from your server then the
binary stops working.

I've used the principle in Visual Basic (where code is compiled so quite
safe), and been able to stop people using my software for ever.

Not tried it in PHP though... If this is a stupid idea, don't shoot me, I've
slept for the 30 hours, and instead of working to get projects finsihed, I'm
answering newsgroups ;-)
I'd be interested to hear what others think anyway

Yours
Mr. Adam ALLEN.
[EMAIL PROTECTED]
http://www.dynamicinteraction.co.uk


> -----Original Message-----
> From: Steven Haryanto [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, May 19, 2001 3:56 PM
> To: Craig Vincent
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: [PHP] hosting "closed" web application for multiple users
>
>
> Actually, We _are_ considering of buying Zend Encoder, but in the
> middle of thinking for alternatives... :-)
>
> However, sometimes vendors do not want user to have access to
> the _binary also_ (and then run it somewhere else), so that needs
> some extra protection other than the Encoder too.
>
> Regards,
> Steve
>
> At 19/05/2001 21:47, Craig Vincent wrote:
> ><snip>
> >2) user cannot trick other root processes to read
> >script.php for her.
> >
> >Is there a better alternative?
> ></snip>
> >
> >Depending on your budget yes there is.  Zend has a PHP encoding utility
> >which performs two functions, first off since it needs to run
> through their
> >optimizer your PHP scripts will tend to run faster (at the
> expense of a bit
> >more memory consumption) and also you don't need to worry about
> preventing
> >the source code from being read as the php scripts are converted into a
> >binary executable.  License to use these programs are I believe
> around $600
> >per year but offer a wide range of additional features but I
> would consider
> >it well worth it to a company rather than spending countless
> tech hours and
> >security testing to prevent the source from being viewed.
> >
> >http://www.zend.com
> >
> >Sincerely,
> >
> >Craig Vincent
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>







> -----Original Message-----
> From: Steven Haryanto [mailto:[EMAIL PROTECTED]]
>
>
> I have a requirement like this:
>
> - the php script should be runnable by httpd user only.
> - the php script will include other files.
> - the php script should run as the user.
> - the user must not be able to access the source code
>    of the scripts.
>

Take a look at apc (apc.communityconnect.com), it is primarily a cache,
which will boost your performace, but also allows you to take the cached
compiled files from the file system and distribute them.





btw, have people tried apc 1.0.9 with php-4.0.5? apc runs fine
for some of my scripts (though performance improvement is not
great at all, or am i doing something wrong). but for some of
my more complex scripts, it crashes the httpd binary with
segfaults.

btw, can you just take the compiled cache file and distribute
it? does the file need to be run with apc also? or can the
plain zend engine handle it?

steve

At 19/05/2001 22:45, Matthias Winkelmann wrote:


> > -----Original Message-----
> > From: Steven Haryanto [mailto:[EMAIL PROTECTED]]
> >
> >
> > I have a requirement like this:
> >
> > - the php script should be runnable by httpd user only.
> > - the php script will include other files.
> > - the php script should run as the user.
> > - the user must not be able to access the source code
> >    of the scripts.
> >
>
>Take a look at apc (apc.communityconnect.com), it is primarily a cache,
>which will boost your performace, but also allows you to take the cached
>compiled files from the file system and distribute them.





Hi,

Below the code i use. Everything works, the $mailto variable is buils up
from a database and contains more then one email adresses. Now my
question: how can i make the receivers of my message NOT to see the
email addresses of all the receivers, so then can't reply to all?

$mail ="$mailto";
$title ="$subject";
$mess = "$message";
mail($mail, $title, $mess, "From: [EMAIL PROTECTED]\nReply-To:
[EMAIL PROTECTED]\nContent-Type: text/html; charset=iso-8859-1");

Thanks!

--
Mark Wouters
eXpanded Media
Web Designer






<snip>
Below the code i use. Everything works, the $mailto variable is buils up
from a database and contains more then one email adresses. Now my
question: how can i make the receivers of my message NOT to see the
email addresses of all the receivers, so then can't reply to all?
</snip>

The simpliest thing to do would be to break up the $mailto into an array
with a separate field for each email address you need then use a foreach
loop on the array to send out individual mailings.  Or to better improve
efficiency don't even put the addresses into an array but rather send out
the mail in the routine that grabs the email addresses out of your database.
Depending on the number of emails you need to send out this is actually a
much better solution than just sending out a mail with 50 or 100 email
address in the To/CC/BCC adresses.  With the majority of my systems I can
pump out around 1000 - 1500 individual emails per minute with minimal
resources consumed on the system so a solution of this nature more than
likely will work out in your favor.

Sincerely,

Craig Vincent






>Below the code i use. Everything works, the $mailto variable is buils up
>from a database and contains more then one email adresses. Now my
>question: how can i make the receivers of my message NOT to see the
>email addresses of all the receivers, so then can't reply to all?

         Send the message to yourself and put the string into a BCC field
which can be configured in the fourth argument.

Urb



>$mail ="$mailto";
>$title ="$subject";
>$mess = "$message";
>mail($mail, $title, $mess, "From: [EMAIL PROTECTED]\nReply-To:
>[EMAIL PROTECTED]\nContent-Type: text/html; charset=iso-8859-1");
>
>Thanks!
>
>--
>Mark Wouters
>eXpanded Media
>Web Designer
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]





Hello !

I got a jpg-picture on my disk. Is there any way to find out the color
of a pixel (let's say, I want to know, which color the pixel 1,12 on
image img.jpg is.)

Ideas ?

Martin






> I got a jpg-picture on my disk. Is there any way to find out the color
> of a pixel (let's say, I want to know, which color the pixel 1,12 on
> image img.jpg is.)
>
> Ideas ?

http://php.net/imagecolorat

-Rasmus





Hi!
I am writing a chat program with php and mysql using semaphores,
shared memory and sessions.
Chatters A and B will both be using a common file where semaphores are
acquired in a while loop.
To my grief, the chatting was found to hang at around 50 mins mostly,
though other instances of 9 or 20 mins have occurred too.
I tracked it down and found that semaphore id gotten using sem_get(2000, 1)
will be around 40989 (the max so far).
Then the program cannot proceeds because it stucks at sem_get.
It just cannot get past that and that causes my connection to mysql
processes to sleep when I do a show processlist.
Then it hangs the web server because any new connection to mysql will go to
sleep mode.
The httpd processes can go up to 100 and mysql processes are still quite
small like 8.
shm_attach(2000, 524288) was used.

Didn't sem_release or sem_remove causes the semaphore id gotten using
sem_get to be reusable?
Why the number keeps jumping and finally dies @ around 40989?
Is there a way to increase the semaphore id gotten using sem_get to prolong
the lifespan of the program?
Or should I copy the php file so that each chatter has its own php file to
run?

Please advice.

Thankyou.

Regards





If i use these functions in my script, what will be the system resource
usage? I know, thread will be open while the script is running but, i
believe that they will not use extra system resource, won't they?

For example, i want to send 10 emails every 30 seconds. Assume that there
are 1,000,000 emails.
So;

for(from 1 to 1,000,000 count)
{
send 1 email
increase couner
if counter = 10 emails then sleep(30) else continue
}

And assume that this for loop will take 10 hours to finish. Will it use the
same or higher system resource while it has entered to sleep mode?

Thanks for your help






I have a multidimensional array being created by a form.  Most fields are
pre-populated with a few that people can add to the list.  There is a box
beside each row that they can check whether that item is in or not.

My code to list only the rows that were checked is this..

for ($j=1 ; $j=5; $j++)
        {
        for ($i=0 ; $i<count($check[$j]) ; $i++)
                {
                if ($check[$j][$i] == "1")//was boxed checked?
                        {
                        $message .= "$pre[$j][$i]. .$post[$j][$i]. .$name[$j][$i].
.$city[$j][$i]. .$state[$j][$i]\n";
                                }
                        }
                }

This code is creating an endless loop and times out the server with memory
overruns.

What am I missing?





can't say for sure, but a good guess is some problems with undefined vars.
try using fforeach insted, its alot simpler.

<?php
    foreach($check as $j_pos => $j_val)
        foreach($check[$j_pos] as $i_pos => $i_val)
            $message .= "{$pre[$j_pos][$i_pos]} {$post[$j_pos][$i_pos]}
{$name[$j_pos][$i_pos]} {$city[$j_pos][$i_pos]} {$state[$j_pos][$i_pos]}
\n";
?>

<input type='checkbox' name='check[0][0]' value='1' checked>
<input type='checkbox' name='check[0][1]' value='1'>
<input type='checkbox' name='check[1][0]' value='1' checked>
<input type='checkbox' name='check[1][1]' value='1' checked>
<input type='checkbox' name='check[2][0]' value='1'>
<input type='checkbox' name='check[2][1]' value='1'>
<input type='checkbox' name='check[3][0]' value='1'>
<input type='checkbox' name='check[3][1]' value='1' checked>
ok, now we have an example,

$check[0][0]
$check[1][0]
$check[1][1]
$check[3][1]

are set, the others are not. you can see why 'for($c = 0; $c <
count($check); $c++)' will not work. foreach simplifies things alot. you
also do not need to check
'if ($check[$j][$i] == 1)' becase if it is set at all, then it 'had' to be
checked.

Is this what you were looking for ?

--

  Chris Lee
  [EMAIL PROTECTED]



""Dean Martin"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have a multidimensional array being created by a form.  Most fields are
> pre-populated with a few that people can add to the list.  There is a box
> beside each row that they can check whether that item is in or not.
>
> My code to list only the rows that were checked is this..
>
> for ($j=1 ; $j=5; $j++)
> {
> for ($i=0 ; $i<count($check[$j]) ; $i++)
> {
> if ($check[$j][$i] == "1")//was boxed checked?
> {
> $message .= "$pre[$j][$i]. .$post[$j][$i]. .$name[$j][$i].
> .$city[$j][$i]. .$state[$j][$i]\n";
> }
> }
> }
>
> This code is creating an endless loop and times out the server with memory
> overruns.
>
> What am I missing?
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






[EMAIL PROTECTED] ("elias") writes:

> "Arcady Genkin" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I could not find this in the docs, but maybe I've been looking in the
> > wrong place.  Could someone give me an authorative answer or point me
> > to it someplace else, to the question:
> >
> > When you set an environment variable with putenv(), is there a chance
> > that it would be visible to any other PHP script served by the same
> > apache child?
>
> never tried it though...but through my experience i would say:
> The Environment values that are set within a script can be seen only within
> child scripts (ie when script1.php spwans scrip2.php)

In case anyone was following, the issue has been resolved.  Have a
look at http://www.php.net/bugs.php?id=10970

Awesome bug resolution turnaround!
-- 
Arcady Genkin




Hi,

I've another question.. is it possible to send attachements with mail()
??

Thanks,

--
Mark Wouters
eXpanded Media
Web Designer
Parijsstraat 74, B-3000 Leuven - Louvain
Tel: +32 (16) 31.10.12
Fax: +32 (16) 31.10.19
E-mail: [EMAIL PROTECTED]
URL: http://www.expandedmedia.be






Hello,

Is it possible to have the contents of a shell_exec command go into an array?

I have the following in my PHP script:

<?
$user="$PHP_AUTH_USER";
$command="command.sh";
$output=shell_exec("$command $user");
?>

Which calls a shell script "dirlist.sh", which returns results similar to the 
following:
www
www/docs
www/test

Is it possible to have each line put into an array? so that it would look like:
$results = array("www", "www/docs", "www/test");

The shell script has dynamic output, so the number of lines, and line content wouldn't 
be the same on every execution.

I would like to use a foreach loop to put the output from the script into a form, so I 
am just wondering if the command/array scenerio is possible.

Thank you for any help,

Ken Jansons
E-Mail: [EMAIL PROTECTED]




accually php allready has this command and you are so close to it :)

<?php
    $user = $PHP_AUTH_USER;
    $command = 'command.sh';
    exec("$command $user", $result);
?>

--

  Chris Lee
  [EMAIL PROTECTED]


""Ken Jansons"" <[EMAIL PROTECTED]> wrote in message
001d01c0e08c$54601480$[EMAIL PROTECTED]">news:001d01c0e08c$54601480$[EMAIL PROTECTED]...
Hello,

Is it possible to have the contents of a shell_exec command go into an
array?

I have the following in my PHP script:

<?
$user="$PHP_AUTH_USER";
$command="command.sh";
$output=shell_exec("$command $user");
?>

Which calls a shell script "dirlist.sh", which returns results similar to
the following:
www
www/docs
www/test

Is it possible to have each line put into an array? so that it would look
like:
$results = array("www", "www/docs", "www/test");

The shell script has dynamic output, so the number of lines, and line
content wouldn't be the same on every execution.

I would like to use a foreach loop to put the output from the script into a
form, so I am just wondering if the command/array scenerio is possible.

Thank you for any help,

Ken Jansons
E-Mail: [EMAIL PROTECTED]








  I am trying to pull all the e-mail address out of a database to be
  able to do a mass send.
  This gets me all the e-mail address and puts a , between them which is what
  I want.

$sql = "SELECT CONCAT(email) AS str_email FROM customers";
                $result = mysql_query($sql);
                 $recip = array();
        while ($myrow = mysql_fetch_array($result)) 
                $recip[] = $myrow["str_email"];
        $recipient_list = implode(", ",$recip);

  I t gives me this list which is what I wanted
[EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED]

     But now I would like to get the first address in the list into a
     variable and the rest in the list to a second variable Like
     this
    $v1=  [EMAIL PROTECTED]
    $v2=  [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED]

    How would I go about this



Best regards,
 Richard  
mailto:[EMAIL PROTECTED]





how about grabbing the first result out of the 'while'??? something like:

list($var1) = mysql_fetch_row($result);
while( list($email) = mysql_fetch_row($result) )
         $var2[] = $email;

hope this helps...

At 11:04 19/5/2001 -0700, Richard Kurth wrote:

>   I am trying to pull all the e-mail address out of a database to be
>   able to do a mass send.
>   This gets me all the e-mail address and puts a , between them which is what
>   I want.
>
>$sql = "SELECT CONCAT(email) AS str_email FROM customers";
>                 $result = mysql_query($sql);
>                  $recip = array();
>         while ($myrow = mysql_fetch_array($result))
>                 $recip[] = $myrow["str_email"];
>         $recipient_list = implode(", ",$recip);
>
>   I t gives me this list which is what I wanted
>[EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED]
>
>      But now I would like to get the first address in the list into a
>      variable and the rest in the list to a second variable Like
>      this
>     $v1=  [EMAIL PROTECTED]
>     $v2=  [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED]
>
>     How would I go about this
>
>
>
>Best regards,
>  Richard
>mailto:[EMAIL PROTECTED]
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

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





its great to see vpopmail support in 4.0.5. but i can't find any
documentation on functions. what are the functions and their parameters.
does anybody know?

thanks






Hmmm anyone looking to join me in making a bb called BestBoard? email me at 
[EMAIL PROTECTED] not thru the list! (note if these are not supposed to go on 
this list 1 flame 
will be suffiecent thanks!) 





Anyone do anything in this arena yet? I searched the archives for 2001 
but have yet to go farther back. I know I can use the COM ability to get 
info from Domino but I'm looking for any success stories with Lotus Domino.





Hi!

I want to have a mailapp on my server (win32) wich writes all incoming mails
to a MySQL db.

Is this possible?

---------------------------------
Fredrik A. Takle
[EMAIL PROTECTED]







Does anyone know where I can find some type of Expense Report/Tracking system written in PHP?
 
I'm tired of tracking all my stuff in Excel and sending it in so I thought I'd take a crack at making an online tracking system for multiple employees that could possibly export to Excel if needed.
 
Thanks for any help :-)
 
 
Clayton Dukes
CCNA, CCDA, CCDP, CCNP
Download Free Essays, Term Papers and Cisco Training from http://www.gdd.net
 
 




Clayton, you might want to try hotscripts.com. They have a load of scripts
you can choose from, and it's all categorized as well. Good luck

Navid Yar
  -----Original Message-----
  From: Clayton Dukes [mailto:[EMAIL PROTECTED]]
  Sent: Saturday, May 19, 2001 2:22 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Expense


  Does anyone know where I can find some type of Expense Report/Tracking
system written in PHP?

  I'm tired of tracking all my stuff in Excel and sending it in so I thought
I'd take a crack at making an online tracking system for multiple employees
that could possibly export to Excel if needed.

  Thanks for any help :-)


  Clayton Dukes
  CCNA, CCDA, CCDP, CCNP
  Download Free Essays, Term Papers and Cisco Training from
http://www.gdd.net






I did actually look there first. Nothing listed....

Thanks anyways :-)


Clayton Dukes
CCNA, CCDA, CCDP, CCNP
Download Free Essays, Term Papers and Cisco Training from http://www.gdd.net


----- Original Message -----
From: "Navid Yar" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, May 19, 2001 3:35 PM
Subject: [PHP] Expense


> Clayton, you might want to try hotscripts.com. They have a load of scripts
> you can choose from, and it's all categorized as well. Good luck
>
> Navid Yar
>   -----Original Message-----
>   From: Clayton Dukes [mailto:[EMAIL PROTECTED]]
>   Sent: Saturday, May 19, 2001 2:22 PM
>   To: [EMAIL PROTECTED]
>   Subject: [PHP] Expense
>
>
>   Does anyone know where I can find some type of Expense Report/Tracking
> system written in PHP?
>
>   I'm tired of tracking all my stuff in Excel and sending it in so I
thought
> I'd take a crack at making an online tracking system for multiple
employees
> that could possibly export to Excel if needed.
>
>   Thanks for any help :-)
>
>
>   Clayton Dukes
>   CCNA, CCDA, CCDP, CCNP
>   Download Free Essays, Term Papers and Cisco Training from
> http://www.gdd.net
>
>
>






Clayton - I'm working on a similar time tracking tool myself...then it
exports the data in CSV format.  I'm looking at having it complete next
week.  I'll notify you when it done if your intrested.

~kurth

On Sat, 19 May 2001, Clayton Dukes wrote:

> I did actually look there first. Nothing listed....
>
> Thanks anyways :-)
>
>
> Clayton Dukes
> CCNA, CCDA, CCDP, CCNP
> Download Free Essays, Term Papers and Cisco Training from http://www.gdd.net
>
>
> ----- Original Message -----
> From: "Navid Yar" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, May 19, 2001 3:35 PM
> Subject: [PHP] Expense
>
>
> > Clayton, you might want to try hotscripts.com. They have a load of scripts
> > you can choose from, and it's all categorized as well. Good luck
> >
> > Navid Yar
> >   -----Original Message-----
> >   From: Clayton Dukes [mailto:[EMAIL PROTECTED]]
> >   Sent: Saturday, May 19, 2001 2:22 PM
> >   To: [EMAIL PROTECTED]
> >   Subject: [PHP] Expense
> >
> >
> >   Does anyone know where I can find some type of Expense Report/Tracking
> > system written in PHP?
> >
> >   I'm tired of tracking all my stuff in Excel and sending it in so I
> thought
> > I'd take a crack at making an online tracking system for multiple
> employees
> > that could possibly export to Excel if needed.
> >
> >   Thanks for any help :-)
> >
> >
> >   Clayton Dukes
> >   CCNA, CCDA, CCDP, CCNP
> >   Download Free Essays, Term Papers and Cisco Training from
> > http://www.gdd.net
> >
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>





Definately, thanks!


Clayton Dukes
CCNA, CCDA, CCDP, CCNP
Download Free Essays, Term Papers and Cisco Training from http://www.gdd.net


----- Original Message -----
From: "Kurth Bemis" <[EMAIL PROTECTED]>
To: "Clayton Dukes" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, May 19, 2001 3:37 PM
Subject: Re: [PHP] Expense


>
> Clayton - I'm working on a similar time tracking tool myself...then it
> exports the data in CSV format.  I'm looking at having it complete next
> week.  I'll notify you when it done if your intrested.
>
> ~kurth
>
> On Sat, 19 May 2001, Clayton Dukes wrote:
>
> > I did actually look there first. Nothing listed....
> >
> > Thanks anyways :-)
> >
> >
> > Clayton Dukes
> > CCNA, CCDA, CCDP, CCNP
> > Download Free Essays, Term Papers and Cisco Training from
http://www.gdd.net
> >
> >
> > ----- Original Message -----
> > From: "Navid Yar" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Saturday, May 19, 2001 3:35 PM
> > Subject: [PHP] Expense
> >
> >
> > > Clayton, you might want to try hotscripts.com. They have a load of
scripts
> > > you can choose from, and it's all categorized as well. Good luck
> > >
> > > Navid Yar
> > >   -----Original Message-----
> > >   From: Clayton Dukes [mailto:[EMAIL PROTECTED]]
> > >   Sent: Saturday, May 19, 2001 2:22 PM
> > >   To: [EMAIL PROTECTED]
> > >   Subject: [PHP] Expense
> > >
> > >
> > >   Does anyone know where I can find some type of Expense
Report/Tracking
> > > system written in PHP?
> > >
> > >   I'm tired of tracking all my stuff in Excel and sending it in so I
> > thought
> > > I'd take a crack at making an online tracking system for multiple
> > employees
> > > that could possibly export to Excel if needed.
> > >
> > >   Thanks for any help :-)
> > >
> > >
> > >   Clayton Dukes
> > >   CCNA, CCDA, CCDP, CCNP
> > >   Download Free Essays, Term Papers and Cisco Training from
> > > http://www.gdd.net
> > >
> > >
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >





I hate using global variables this way in functions, but it can be done.

<?php
    function test()
    {
        global $HTTP_POST_VARS;
        if ($HTTP_POST_VARS['form'] == 'func')
            foreach($HTTP_POST_VARS as $pos => $val)
                global $pos;
        // reset of your code.
    }
?>

there are good reasons for global variables, but use them wisely, globals
are offten missused and create illegible code. most variables should be
passed as arguments to the function.

--

  Chris Lee
  [EMAIL PROTECTED]


"Siim Einfeldt aka Itpunk" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> Hi everybody,
>
> Is it possible (and if it is, how) to globalize all the variables, that
> come from some form, automatically?
> For example:
>
> function do_something(){
> global $form;
> if($form != "func"){
> /* globalize all the variables that come from a form
> called $form . How to do it? */
> }
> }
>
> Yes, I could it manually - global $firstname,$lastname,$addres, etc
> etc...but the function is being used by different scripts and I need to
> globalize only these variables that come from that particular form ... and
> all that 'automatically'.
>
> Any ideas?
>
> Thanks,
> Siim Einfeldt
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






how do I convert and integer value to its ASCII correspondent?

in C I would go something like:

int i = 90;
char c;

c = i + '0'; // now c would be 'Z'

in PHP I'm simply clueless since there's no (char) type...
____________________________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer





Hey,

take a look at:
http://www.php.net/manual/en/function.chr.php :)

Kees

> -----Original Message-----
> From: Christian Dechery [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, May 19, 2001 9:47 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] converting int to char
> 
> 
> how do I convert and integer value to its ASCII correspondent?
> 
> in C I would go something like:
> 
> int i = 90;
> char c;
> 
> c = i + '0'; // now c would be 'Z'
> 
> in PHP I'm simply clueless since there's no (char) type...
> ____________________________
> . Christian Dechery (lemming)
> . http://www.tanamesa.com.br
> . Gaita-L Owner / Web Developer
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 




  Way does this not work it sends to the recipient but it will not
  send to the bcc this is right out of the manual.
$recipient .= "[EMAIL PROTECTED]";
$subject = "Hello";
$message .= "The is the message\n";
$message .= "--\r\n"; //Signature delimiter
$message .= "http://northwesthost.com";;
$headers .= "From: Richard Kurth <[EMAIL PROTECTED]>\n";
$headers .= "X-Sender: <[EMAIL PROTECTED]>\n"; 
$headers .= "X-Mailer: NorthWestHost\n";
$headers .= "X-Priority: 1\n";
$headers .= "Return-Path: <[EMAIL PROTECTED]>\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime type
$headers .= "bcc:[EMAIL PROTECTED], [EMAIL PROTECTED]\n"; // BCCs to

mail($recipient, $subject, $message, $headers);
      











Best regards,
 Richard  
mailto:[EMAIL PROTECTED]





In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Richard Kurth) wrote:

>   Way does this not work it sends to the recipient but it will not
>   send to the bcc this is right out of the manual.
> $recipient .= "[EMAIL PROTECTED]";
> $subject = "Hello";
> $message .= "The is the message\n";
> $message .= "--\r\n"; //Signature delimiter
> $message .= "http://northwesthost.com";;
> $headers .= "From: Richard Kurth <[EMAIL PROTECTED]>\n";
> $headers .= "X-Sender: <[EMAIL PROTECTED]>\n"; 
> $headers .= "X-Mailer: NorthWestHost\n";
> $headers .= "X-Priority: 1\n";
> $headers .= "Return-Path: <[EMAIL PROTECTED]>\n";
> $headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime type
> $headers .= "bcc:[EMAIL PROTECTED], [EMAIL PROTECTED]\n"; // 
> BCCs to
> 
> mail($recipient, $subject, $message, $headers);

Try changing all "\n"s to "\r\n" (the RFC calls for a CRLF as the line 
break), the signature delimiter to "-- \r\n" (a space after the two 
dashes), and "bcc:" to "Bcc: " (capitalize the B and add a space after the 
colon).  If it's still not working, try getting rid of all the extra 
headers or putting the bcc before them.

-- 
CC




Hello,

I am fairly new to PHP and so far I love it.  One question I have is how to
call include files outside of their directory without hard coding the real
path to the file itself.  Is there map path or a similar function in PHP?
Also when i use readfile() or fpassthru() when I echo the result what I
assume is the file size is added to the end of the line.  i.e.( blah blah
blah will produce a 14 at the end of the line ) I was curious as to if there
is a flag i'm missing that is causing them to do that.  Thank you for the
help!

Dylan Finney
www.healthcoast.com








Hello,

I have written some accounting application using PHP, and now I need to
create some reports. Those reports need to be printed from web browser.

What can I do?

Thanks
Mihailo.


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com





Hi There,

How can i reverse the htmlspecialchars() functions?
I can't seem to find a function for that.

Thanks,

Jeroen Geusebroek




> How can i reverse the htmlspecialchars() functions?
> I can't seem to find a function for that.

There is no function to do that.

-Rasmus





Hi Rasmus,

> > How can i reverse the htmlspecialchars() functions?
> > I can't seem to find a function for that.
> 
> There is no function to do that.

Maybe it would be a nice feature to add in PHP?
For the moment i'll just have to make my own version then :)

Thanks,

Jeroen




> > How can i reverse the htmlspecialchars() functions?
> > I can't seem to find a function for that.
>
> There is no function to do that.

Can't you use the translation array, reverse it, and apply it?
It's mentioned in the manual somewhere...

Would be heavy hack, but IMO it should work...

Jeroen






        function un_htmlentities($str) {
                $trans = get_html_translation_table (HTML_ENTITIES);
                $trans = array_flip ($trans);

                $str = strtr ($str, $trans);    
                
                return ($str);
        }

> -----Original Message-----
> From: Jeroen Geusebroek [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, May 19, 2001 11:46 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Reversing htmlspecialchars()
> 
> 
> Hi There,
> 
> How can i reverse the htmlspecialchars() functions?
> I can't seem to find a function for that.
> 
> Thanks,
> 
> Jeroen Geusebroek
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 




Nobody knows if it's possible to send attachements with mail()??

Thanks,

--
Mark Wouters
eXpanded Media
Web Designer
Parijsstraat 74, B-3000 Leuven - Louvain
Tel: +32 (16) 31.10.12
Fax: +32 (16) 31.10.19
E-mail: [EMAIL PROTECTED]
URL: http://www.expandedmedia.be






Greetings.

    I have about two include files which are included in every php page that
I have, and I wish to store global variables, such as passwords, usernames
and other details information.
    After going through the PHP manual, all I could find was UNSET/SET
global variables, but I don't know if that is the one to use or not... they
looked like if they were to be doing something else.

    Any help or ideas?

- Richard






Try the define function.  That will define a constant that you will always have
access to (within functions, through various included files,etc.)  Or you can
write values to the $GLOBALS array of global variables.

$GLOBALS["userPassword"]="u8943fd";

Will define a variable that is accessible as $userPassword. outside of
functions and within functions available after the global $userPassword;
command is within the function.

HTH,
Michael


Richard wrote:

> Greetings.
>
>     I have about two include files which are included in every php page that
> I have, and I wish to store global variables, such as passwords, usernames
> and other details information.
>     After going through the PHP manual, all I could find was UNSET/SET
> global variables, but I don't know if that is the one to use or not... they
> looked like if they were to be doing something else.
>
>     Any help or ideas?
>
> - Richard
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





So i should start the header (or wherever in the header) with :

    $GLOBALS["userPassword"] = "whatever";

    function cp() {
        global $userPassword;

        // $userPassword is 'whatever' //
    }


Did I get it or am I just too tired?

- Richard

"Michael Stearne" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Try the define function.  That will define a constant that you will always
have
> access to (within functions, through various included files,etc.)  Or you
can
> write values to the $GLOBALS array of global variables.
>
> $GLOBALS["userPassword"]="u8943fd";
>
> Will define a variable that is accessible as $userPassword. outside of
> functions and within functions available after the global $userPassword;
> command is within the function.
>
> HTH,
> Michael
>
>
> Richard wrote:
>
> > Greetings.
> >
> >     I have about two include files which are included in every php page
that
> > I have, and I wish to store global variables, such as passwords,
usernames
> > and other details information.
> >     After going through the PHP manual, all I could find was UNSET/SET
> > global variables, but I don't know if that is the one to use or not...
they
> > looked like if they were to be doing something else.
> >
> >     Any help or ideas?
> >
> > - Richard
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






In article <9e6s21$2rk$[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] ("Richard") wrote:

> So i should start the header (or wherever in the header) with :
> 
>     $GLOBALS["userPassword"] = "whatever";
> 
>     function cp() {
>         global $userPassword;
> 
>         // $userPassword is 'whatever' //
>     }

You're making an extra step.  The variables stored in the $GLOBALS array 
don't have to be declared as global within a function.  They're already 
available within the function.  To make a global variable available within 
a function's local namespace, you _either_:

* pass it by reference: function cp(&$userPassword)
* declare it as a global: global $userPassword
* make it an element of the $GLOBALS array: $GLOBALS['userPassword']

(You could also pass by value, but then you're dealing with a copy of the 
variable instead of the variable itself.)

-- 
CC




hi all,

can't find a function for getting a complete list of defined constants.
this exists for classes, I think it must for constants even if it is
undocumented.

I'm writing a bit of debug code, and I'd rather not build a bunch of
implicit knowledge about my set of constants into the code - I'd like to
just dump everything in my environment onto the page.

please respond to me @ [EMAIL PROTECTED]

tia all,

_alex






There are a few scripts listed at
http://www.hotscripts.com/PHP/Scripts_and_Programs/Email_Systems/Email_Utili
ties/ that might do what you want.

David Price

-----Original Message-----
From: Mark Wouters [mailto:[EMAIL PROTECTED]]
Sent: Saturday, May 19, 2001 3:10 PM
To: [EMAIL PROTECTED]
Subject: [PHP] sending attachements with mail


Nobody knows if it's possible to send attachements with mail()??

Thanks,

--
Mark Wouters
eXpanded Media
Web Designer
Parijsstraat 74, B-3000 Leuven - Louvain
Tel: +32 (16) 31.10.12
Fax: +32 (16) 31.10.19
E-mail: [EMAIL PROTECTED]
URL: http://www.expandedmedia.be



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



Reply via email to