php-general Digest 5 Jul 2003 06:54:22 -0000 Issue 2157

Topics (messages 154011 through 154035):

Re: Snarl, hiss, growl (frustration)
        154011 by: Robert Cummings
        154012 by: Rasmus Lerdorf
        154020 by: Robert Cummings
        154021 by: Rasmus Lerdorf
        154022 by: Kyle Babich
        154023 by: Rasmus Lerdorf

how to :: multi select
        154013 by: Thomas Hochstetter
        154015 by: Matthew Vos
        154026 by: Philip Olson

Re: Red Hat 9, Apache 2, and PHP
        154014 by: Diana
        154016 by: Adam i Agnieszka Gasiorowski FNORD
        154017 by: Jeff Schwartz
        154024 by: Rasmus Lerdorf

mail()
        154018 by: Phil Dowson

Failed to Receive in E:\...\mailscript.php on line 25
        154019 by: Håkon Strandenes

proc_open() and SSH [still unresolved]
        154025 by: php

Re: More on file upload
        154027 by: Jason Wong

Re: Using TTF within an image
        154028 by: Jason Wong

Probs with a form
        154029 by: LPA
        154035 by: therm

Builing PHP with Courier-IMAP
        154030 by: Fisayo Adeleke

A php-mysql checkbox question
        154031 by: John T. Beresford

OCI_ASSOC returns key with upper case string
        154032 by: Reuben D. Budiardja
        154033 by: Manuel Lemos

security question
        154034 by: Paul Chvostek

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 ---
On Fri, 2003-07-04 at 12:44, Rasmus Lerdorf wrote:
> The difference is that you are getting a string from the file and not
> casting it to an integer.  You could also have fixed it by doing:
> 
>   $counter = (int) fread(...);

The cast isn't necessary, PHP happily transforms it for him when he
applies the ++ operator.

Cheers,
Rob.
-- 
.---------------------------------------------.
| 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.    |
`---------------------------------------------'

--- End Message ---
--- Begin Message ---
On Fri, 4 Jul 2003, Robert Cummings wrote:

> On Fri, 2003-07-04 at 12:44, Rasmus Lerdorf wrote:
> > The difference is that you are getting a string from the file and not
> > casting it to an integer.  You could also have fixed it by doing:
> >
> >   $counter = (int) fread(...);
>
> The cast isn't necessary, PHP happily transforms it for him when he
> applies the ++ operator.

;)  You are sure about that right?  Or else you wouldn't have posted this
to 1000's of people.

So what do you think this will output?

    $a = "123\n";
    $a++;
    echo $a;

Try it.

-Rasmus

--- End Message ---
--- Begin Message ---
On Fri, 2003-07-04 at 13:13, Rasmus Lerdorf wrote:
> On Fri, 4 Jul 2003, Robert Cummings wrote:
> 
> > On Fri, 2003-07-04 at 12:44, Rasmus Lerdorf wrote:
> > > The difference is that you are getting a string from the file and not
> > > casting it to an integer.  You could also have fixed it by doing:
> > >
> > >   $counter = (int) fread(...);
> >
> > The cast isn't necessary, PHP happily transforms it for him when he
> > applies the ++ operator.
> 
> ;)  You are sure about that right?  Or else you wouldn't have posted this
> to 1000's of people.

I am absolutely sure of thus since I cut and pasted the original problem
code to a shell script to test. This was before I noticed the answer
mentioning the closing if block had already been posted. 

> 
> So what do you think this will output?
> 
>     $a = "123\n";
>     $a++;
>     echo $a;
> 
> Try it.

Undoubtedly the above will work as we both know, the output will be
"123"; however, if you look at the original code in question, there is
no "\n" tailing the output written to the counter file and thus the
increment works fine (unless of course when he created the file to begin
he had a newline - something I did not do in my test :)

Cheers,
Rob.
-- 
.---------------------------------------------.
| 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.    |
`---------------------------------------------'

--- End Message ---
--- Begin Message ---
On Fri, 4 Jul 2003, Robert Cummings wrote:
> Undoubtedly the above will work as we both know, the output will be
> "123"; however, if you look at the original code in question, there is
> no "\n" tailing the output written to the counter file and thus the
> increment works fine (unless of course when he created the file to begin
> he had a newline - something I did not do in my test :)

which is exactly what it looked like he did since he said that switching
to $counter+=1; fixed it for him which would force it to be an integer.

-Rasmus

--- End Message ---
--- Begin Message ---
FYI there were no newlines involved in my program.  (go back to the
message and read the code)

On Fri, 4 Jul 2003 12:06:46 -0700 (PDT), "Rasmus Lerdorf"
<[EMAIL PROTECTED]> said:
> On Fri, 4 Jul 2003, Robert Cummings wrote:
> > Undoubtedly the above will work as we both know, the output will be
> > "123"; however, if you look at the original code in question, there is
> > no "\n" tailing the output written to the counter file and thus the
> > increment works fine (unless of course when he created the file to begin
> > he had a newline - something I did not do in my test :)
> 
> which is exactly what it looked like he did since he said that switching
> to $counter+=1; fixed it for him which would force it to be an integer.
> 
> -Rasmus
> 
--
Kyle

--- End Message ---
--- Begin Message ---
On Fri, 4 Jul 2003, Kyle Babich wrote:
> FYI there were no newlines involved in my program.  (go back to the
> message and read the code)

How did you create the file in the first place?  Most editors will
automatically add a carriage return.  Even if you had your code create it,
if afterwards you ever edited and saved the file with an editor, you would
have gotten one in there.

The proof of this is that your code didn't work.  If the file really only
had a number in it, then $counter++ would have worked.

-Rasmus

--- End Message ---
--- Begin Message ---
Hi guys,
 
This might just be off the topic, but here it goes anyway:
 
How can one multi select check boxes and pass them through in php,
without getting mixed up with variables (email multi select style).
 
Thomas

--- End Message ---
--- Begin Message ---
Hi Thomas.
You need to name each checkbox a different name.
alternatively, you can name them with array naming convention.

i.e.
<input type=checkbox name='array1[value1]' value='Y'> 1-1
<input type=checkbox name='array1[value2]' value='Y'> 1-2
<input type=checkbox name='array2[value1]' value='Y'> 2-1
<input type=checkbox name='array2[value2]' value='Y'> 2-2

Checking off 1-1 and 2-2 would create the following variables (assuming
register_globals is on) in the target php script for the form:

$array1=array("value1"=>"Y","value2"=>"");
$array2=array("value1"=>"","value2"=>"Y");

Hope this helps
Matt
On Fri, 2003-07-04 at 17:20, Thomas Hochstetter wrote:
> Hi guys,
>  
> This might just be off the topic, but here it goes anyway:
>  
> How can one multi select check boxes and pass them through in php,
> without getting mixed up with variables (email multi select style).
>  
> Thomas


--- End Message ---
--- Begin Message ---
On Fri, 4 Jul 2003, Thomas Hochstetter wrote:

> Hi guys,
>  
> This might just be off the topic, but here it goes anyway:
>  
> How can one multi select check boxes and pass them through in php,
> without getting mixed up with variables (email multi select style).

Read these faqs:
http://www.php.net/manual/en/faq.html.php#faq.html.arrays
http://www.php.net/manual/en/faq.html.php#faq.html.select-multiple

Regards,
Philip


--- End Message ---
--- Begin Message ---
Hi,
that sounds really impressive. I'm using Redhat 9 with
the stuff from their Edition, that means Apache 2 and
php together. Never had any issues (so far.....keep my
fingers crossed). The server is not under heavy load,
but it is indeed a "production server". I know it is
not recommended, but for this use (mysql & apache &
php on that server in a company intranet, used for
keeping a picture library & administration issues) is
it necessary to change it? Please advise. To my
defence I have to say that the data on the server is
backed up regularly, though not the OS itself, since
if something ever happens it is less hassle to do a
complete new install & get the database back on. Any
hints?
Thanks 
Diana

 --- Rasmus Lerdorf <[EMAIL PROTECTED]> schrieb: >
Apache2 has a number of different modes it can work
> in.  These modes are
> called MPM's.  The default MPM is called Worker
> which is a multithreaded
> model.  PHP, mod_perl, mod_python, and any other
> similar technology which
> links directly into the httpd processes will need to
> be perfectly
> threadsafe and reentrant to work effectively with a
> threaded Apache2 mpm.
> This is doable for the core of PHP, but there are
> literally hundreds of
> 3rd party libraries that can be linked into PHP and
> nobody whether or not
> these libraries are threadsafe.  And figuring out if
> a specific library is
> threadsafe or not is non-trivial and it can very
> from one platform to
> another.  And just to make it even harder, this
> stuff will appear to work
> fine until you put it under load or hit very
> specific race conditions
> which makes it nearly impossible to debug.
> 
> So, since we can't tell you for sure that a threaded
> Apache2 mpm + PHP
> will work we do not suggest you use it for a
> production server.  And since
> we can't know for sure, none of the main PHP
> developers use this
> combination for our own servers which compounds the
> problem because it is
> not receiving anywhere near the amount of realworld
> testing required to
> work out all the little issues above and beyond this
> threading unknown.
> 
> There is an Apache2 mpm, called "prefork", which
> isn't threaded and
> basically makes Apache2 look like Apache1.  But hey,
> we have a very good
> server already that looks like Apache1.
> 
> In the end I don't see Apache2+PHP ever becoming a
> production platform
> with the current architecture.  The only way I see
> it ever working is to
> pull PHP out of Apache and use a fastcgi approach. 
> Or, with time, perhaps
> we will learn how to make sure a library is
> perfectly threadsafe and safe
> to use in a multithreaded Apache2.
> 
> For now, I really see no reason not to simply use
> Apache1 if you want a
> robust, fast and stable web server.
> 
> -Rasmus
> 

=====
WHEN ALL ELSE FAILS, HUG YOUR SNOOPY
------------------------------------------------------------
Those who bring sunshine to the lives of others cannot keep it from themselves.
J.M. Barrie (1860-1937)
------------------------------------------------------------

__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Logos und Klingeltöne fürs Handy bei http://sms.yahoo.de

--- End Message ---
--- Begin Message ---
Diana wrote:
 
> Hi,
> that sounds really impressive. I'm using Redhat 9 with
> the stuff from their Edition, that means Apache 2 and
> php together. Never had any issues (so far.....keep my
> fingers crossed). The server is not under heavy load,
> but it is indeed a "production server". I know it is
> not recommended, but for this use (mysql & apache &
> php on that server in a company intranet, used for
> keeping a picture library & administration issues) is
> it necessary to change it? Please advise. To my
> defence I have to say that the data on the server is
> backed up regularly, though not the OS itself, since
> if something ever happens it is less hassle to do a
> complete new install & get the database back on. Any
> hints?

        We (at hyperreal.info) used PHP+Apache 2 for
 a while, but it created so many problems (stability,
 non working SSL, others) that we have returned to
 the 1.3.x version...and now everything works like
 it should :8].

-- 
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info / ALinkA / bOrk! *  WiNoNa )   (
http://szatanowskie-ladacznice.0-700.pl  foReVeR(  *  )
Poznaj jej zwiewne kształty... http://www.opera.com 007


--- End Message ---
--- Begin Message ---
OK, so Apache 2 is out. Is there any reason not to go with RH 9.0? Any known problems?
 
Jeff


---------------------------------
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

--- End Message ---
--- Begin Message ---
On Fri, 4 Jul 2003, Jeff Schwartz wrote:
> OK, so Apache 2 is out. Is there any reason not to go with RH 9.0? Any known 
> problems?

It should be fine.  Linux is pretty much Linux.  The biggest differences
between distros and distro versions are at the GUI level and in the set of
applications they provide.  If you are going to use it as a web server and
you install known good versions of Apache and PHP, then you have taken RH9
out of the loop for your critical components and it should be fine.

-Rasmus

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

Could someone let me know if it is possible to pass a resultset of a query
to a single variable so it can be included as the message part of the mail
function?

Thanks!

Phil Dowson


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

I am making a small PHP script for managing a simple mailing list. The
PHP script is added in the bottom of this message.

This PHP script works great on IIS 5.1 with PHP 4.3.0, witch I have
installed locally on my system to test my scripts. But when I transfer
the script over to my host server (With IIS and PHP 4.2.1), I get an
error message when I'm trying to use it. The error message is like this:

Warning: Failed to Receive in
E:\inetpub\wwwroot\grimstad.seilforening\Mailinglister\mailscript.php on
line 25
Kommandoen er nå sendt. Merk at det kan ta opp til 5 minutter før den
trer i kraft.PHP Warning: Failed to Receive in
E:\inetpub\wwwroot\grimstad.seilforening\Mailinglister\mailscript.php on
line 25

Is there any compatibility problems between 4.2.1 and 4.3.0 for the
codes I have used in my script?

Regards,
Håkon Strandenes


Here is the script (It get its inputs from this form:
http://grimstad.seilforening.no/Mailinglister/Styreskjema.html):

<?php

@extract($_POST);

$Liste = stripslashes($Liste);
$Navn = stripslashes($Navn);
$Email = stripslashes($Email);
$Kommando = stripslashes($Kommando);

if (!$Email)
{
echo ("Du må fylle inn din e-mail adresse.");
}
else
{
if (!$Navn)
{
echo ("Du må fylle inn navnet ditt.");
}
else
{

$Message = "Automatisk generert styringsmail";
$Headers = "From: $Navn <$Email>";
mail( $Liste, $Kommando, $Message, $Headers );

echo ("Kommandoen er nå sendt. Merk at det kan ta opp til 5 minutter før
den trer i kraft.");

}
}
?>



--- End Message ---
--- Begin Message ---
Hey folks,

Iam trying to call the ssh program and have it connect to a remote host and
authenticate, however I havent been able to do it. I used this script but all 
i get when I run it on port 80 is: 

command returned 255 

At the error log i specified i get: 

Permission denied, please try again. 
Permission denied, please try again. 
Permission denied (publickey,password,keyboard-interactive). 

Note that it doesnt even ask for a password.. just says denied immediately. 

<?php 
$descriptorspec = array( 
   0 => array("pipe", "r"),  // stdin is a pipe that the child will readfrom 
   1 => array("pipe", "w"),  // stdout is a pipe that the child will writeto 
   2 => array("file", "tmp/error", "a") // stderr is a file to write to ); 
$process = proc_open("ssh -T -l user server.com", $descriptorspec, $pipes); 

if (is_resource($process)) { 
    // $pipes now looks like this: 
    // 0 => writeable handle connected to child stdin 
    // 1 => readable handle connected to child stdout 
    // Any error output will be appended to /tmp/error-output.txt 

    //fwrite($pipes[0], "password"); //I have tried with and without writing 
anything however its the same. 

    while(!feof($pipes[1])) { 
        echo fgets($pipes[1], 1024); 
    } 
    fclose($pipes[1]); 

    //fclose($pipes[0]); 

    $return_value = proc_close($process); 

    echo "command returned $return_value\n"; 
} 
?>

--- End Message ---
--- Begin Message ---
On Saturday 05 July 2003 00:12, Webmaster wrote:

> Have not yet been able to figure out how to get a more descriptive error. I
> know there has to be a better way to get exact message, but just haven't
> figured it out yet.

Look in php,ini (and crank up error reporting to full) and/or read the 
relevant chapter in the manual.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Today is the first day of the rest of your life.
*/


--- End Message ---
--- Begin Message ---
On Friday 04 July 2003 14:35, CDitty wrote:
> Can someone please show me how to change the display font to a TTF in this
> code?  I looked at the online manual under imageloadfont(), but I did not
> understand it enough.  I have the MS TTFs installed on my server and they
> are working correctly.

imagefttext() ?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
"The one charm of marriage is that it makes a life of deception a neccessity."
- Oscar Wilde
*/


--- End Message ---
--- Begin Message ---
Hey,

I must send datas threw a form, but I dont want to have a submit button.. Is
there a way to 'simulate' the click of a submit button?

Thnx for your help

Laurent



--- End Message ---
--- Begin Message --- Lpa wrote:
Hey,

I must send datas threw a form, but I dont want to have a submit button.. Is
there a way to 'simulate' the click of a submit button?

Thnx for your help

Laurent


You could use Javascript, i.e. when cursor leaves the last form element use the relevant function (sorry can't remember which) to submit the date to your script.

hth
therm


--- End Message ---
--- Begin Message ---
Hello,

I run courier-imap, but I have problems when trying to build php with
imap support. It gives the error message 

configure: error: Cannot find imap library (libc-client.a). Please check
your IMAP installation.

Anyone with ideas?

                -Fisayo


--- End Message ---
--- Begin Message --- Hello,

I have a problem trying to show a checkbox list and have some of the boxes checked and not others. Here are the details:

table: features
rec_id  |  fName
-----------------
1       |  Window
-----------------
2       |  pool
-----------------
3       | fence
-----------------
4       | Drive


table: com_features


rec_id  |  com_features_id  |  feature_id
------------------------------------------
1       |  2                |  1
------------------------------------------
2       |  1                |  4
------------------------------------------
3       |  1                |  3
------------------------------------------
4       |  2                |  3
------------------------------------------
5       |  4                |  4
------------------------------------------
6       |  7                |  4
------------------------------------------
7       |  8                |  4
------------------------------------------
8       |  2                |  4



what I want is to display a checkbox list that would show all the values from 'features' and have the appropriate boxes checked when 'com_features.com_features.id = 2'

ie

X  Window
   pool
X  fence
X  drive

The query I am using now is:

$sql ="SELECT
features.rec_id AS rec_id,
features.fName AS fName,
com_features.feature_id AS feature_id,
com_features.com_rec_id AS com_rec_id
FROM features, com_features
WHERE com_features.com_rec_id = \"2\" AND features.TheTest=\"1\"";

What I get in the return is:

X  Window
   pool
   fence
   drive

   Window
   pool
X  fence
   drive

   Window
   pool
   fence
X  drive

TIA for any help,
John
--
===========================
John T. Beresford, Owner
Digital Studio Design
Edmond, OK
http://www.digitalstudiodesign.com/
405.760.0794

--- End Message ---
--- Begin Message ---
Hello,
First let me say that I am not sure if this is PHP problem or Oracle. 

I have a class that contains API for using postgresql, mysql, or oracle 
database so switching database should be "in theory" just changing an 
argument for me. 
To make this sort, let just say that the return of a SELECT statement is 
always in associative array, using either :
"pg_fetch_assoc" for pgsql
"mysql_fetch_assoc" for mysql
"ocifetchinto" with OCI_ASSOC flag for Oracle 9

Now, pg_fetch_assoc and mysql_fetch_assoc return the associate array with the 
key in lower case. But ocifetchinto returns the key in UPPER case. So this 
discrepancy makes my code not as portable as I would like it. 
Furthermore, the example here:
http://us2.php.net/manual/en/function.ocifetchinto.php

doesn't even work, because it uses lower case as the associative array key.

Why is this the case? Is this PHP problem or Oracle config problem? Either 
way, can anyone suggest a solutions? Of course I can do all kind of array 
manipulation in my API to make the key lower case, but that wouldn't be very 
elegant and efficient

Thanks in advance for any help.
RDB
-- 
-------------------------------------------------
/"\  ASCII Ribbon Campaign against HTML
\ /  email and proprietary format
 X   attachments.
/ \
-------------------------------------------------
Have you been used by Microsoft today?
Choose your life. Choose freedom.
Choose LINUX.
-------------------------------------------------


--- End Message ---
--- Begin Message --- Hello,

On 07/04/2003 08:38 PM, Reuben D. Budiardja wrote:
First let me say that I am not sure if this is PHP problem or Oracle. I posted this earlier in php-general, but after looking at the available mailing lists again, I thought this forum would be more appropriate. Sorry if someone get double post.

I have a class that contains API for using postgresql, mysql, or oracle database so switching database should be "in theory" just changing an argument for me. To make this sort, let just say that the return of a SELECT statement is always in associative array, using either :
"pg_fetch_assoc" for pgsql
"mysql_fetch_assoc" for mysql
"ocifetchinto" with OCI_ASSOC flag for Oracle 9


Now, pg_fetch_assoc and mysql_fetch_assoc return the associate array with the key in lower case. But ocifetchinto returns the key in UPPER case. So this discrepancy makes my code not as portable as I would like it. Furthermore, the example here:
http://us2.php.net/manual/en/function.ocifetchinto.php


doesn't even work, because it uses lower case as the associative array key.

Why is this the case? Is this PHP problem or Oracle config problem? Either way, can anyone suggest a solutions? Of course I can do all kind of array manipulation in my API to make the key lower case, but that wouldn't be very elegant and efficient

No, that is just the way Oracle returns column names. It is not possible to provide a portable solution to return row in associative arrays because not only the column names case may be mapped, removed the table names or even have the column names truncated.


That is the reason why Metabase never provided a function to return rows as associative arrays, as Metabase is focused on real database application portability.

http://www.phpclasses.org/metabase

--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/


--- End Message ---
--- Begin Message ---
Can anyone think of any security caveats with regard to turning
output_buffering on?

I can't, but it's too hot to think straight these days....

Tnx.

-- 
  Paul Chvostek                                             <[EMAIL PROTECTED]>
  it.canada                                            http://www.it.ca/
  Free PHP web hosting!                            http://www.it.ca/web/


--- End Message ---

Reply via email to