[PHP] Re: Stepping through an array more than once (offlist)

2002-08-29 Thread Petre Agenbag

Hi Justin
OK, a quick feedback on your previous suggestion:

I tried to unset the $myrow_it, but it still didn't produce any output.
The only way I could get it to work was with the same method you
suggested in this e-mail.
I had to create 2 new vars ( which basically boils down to 2 more
SQL's).

I think I'm not 100% understanding what the $result variable contains
$sql = 'select * from table';
$result = mysql_query($sql);

As I would think, $result contains the entire table in some sort of
structure or matrix right?
And doing a
 while ($myrow = mysql_fetch_assoc($result))

creates a one dimensional array of each row in the table with each pass.
I was just looking for a way to step through $result again and again,
without having to query the DB again...
But the only way I can get it to work is to do:
$result2 = mysql_query($sql);
$result3 = mysql_query($sql);

and then I can

while ($myrow = mysql_fetch_assoc($result2))


and later 

while ($myrow = mysql_fetch_assoc($result3))

It's like the contents of $result can only be used once...Is that the
case?

I tried to do 
$test = $result; immediately after doing the query and then using $test
in the while , but that doesn't work either...

Anyway, not a train smash, will carry on with the trusty old ways.


 


On Wed, 2002-08-28 at 18:30, Justin French wrote:
 Hi,
 
 I haven't got a heap of time tonight, but you should really look at arrays.
 What I noticed with your code was that you basically did the same thing
 (same layout and presentation three times -- and it might be 50 times
 later!!).
 
 This sort of thing cries out for an array or function -- or both!!
 
 Let's start by recognising your 3 loops: OPEN, CURRENT, OLD.  Arrays come in
 many shapes, but generally a one-dimensional array is in the form of 'key'
 = 'value'.  In this case, I've chosen to use the three types of status as
 the key, and the natural language or heading as the value.
 
 ?
 $ticketTypes = array(
 'OPEN' = 'New Tickets',
 'CURRENT = 'Current Tickets',
 'OLD' = 'Old Tickets'
 );
 ?
 
 Then you can loop through this array with a foreach, and do the same thing
 to all three elements.
 
 Now, we have to take the $type (key) and $heading (value) of each array
 element (the three options) and use them within the loop to produce the
 different results.
 
 ?
 
 // array of ticket types
 $ticketTypes = array(
 'OPEN' = 'New Tickets',
 'CURRENT = 'Current Tickets',
 'OLD' = 'Old Tickets'
 );
 
 
 foreach($ticketTypes as $type = $heading)
 {
 // print heading
 echo B{$heading}/BBR;
 
 $sql = SELECT * FROM tickets WHERE status='{$type}';
 $result = mysql_query($sql);
 if(!$result) 
 {
 echo There was a database error:  . mysql_error() . BR;
 }
 else
 {
 // no need to to do an $i++ count... just use this:
 $total = mysql_num_rows($result);
 while ($myrow = mysql_fetch_array($result))
 {
 // a little trick i have to make each column
 // name (eg status) into it's own var (eg $status)
 foreach($myrow as $k = $v) { $$k = $v; }
 echo {$company} :: {$title} :: {$content}br;
 }
 echo Total New: {$total}br;
 }
 }
 ?
 
 
 Now, I haven't tested the above, so gimmie a yell if it breaks...
 
 When I strip all the bullshit and comments out, and condense the script down
 to it rawest form, it's like 19 lines of code -- that's including error
 handling and all sorts of stuff!!  And it will work for 2 ticket types
 (still less lines of code than your 40+) and for 50 ticket types -- just
 make the array bigger.
 
 The other point is, if this script was called for many different pages, then
 you could include it all in a function... but that's for another day!
 
 
 Sure, you're doing three sql queries, but each one of them is returning a
 more focused result set... I'd have to do some tests, but I reckon there's
 very little difference between ONE QUERY + MASSIVE AMOUNTS OF PHP CODING
 if() sections etc etc, versus THREE QUERIES + SOME CODING.  The nature of
 what you want to achieve with this script is conducive to using three
 separate queries.
 
 I know less queries == faster, but it's not always the case, and not always
 worth worrying about, unless you've got a HUGE site with millions of hits a
 day... you just won't notice the benefit, in comparison to the advantage.
 
 
 Some pages on a site I'm working on right now, hinge.net.au, have 5-10
 queries on them, for sessions, users, content, data, counters, logging,
 message boards, etc etc.  And I've NEVER noticed a performance problem, or
 got any complaints.
 
 
 When you've got maybe 500 rows in there (or 5,000, or 50,000), it'd be nice
 to run an a/b test with a script timer, and get some averages to find out
 definitively.
 
 
 Enjoy,
 
 Justin
 
 
 
 on 28/08/02 11:16 PM, Petre Agenbag ([EMAIL PROTECTED]) wrote:
 
  Justin, 
  Thanks for the 

[PHP] gettext

2002-08-29 Thread Marco Muratori

Hi
I'm using gettext to add i18n to a web site, and it seems to work fine,
but the translation is done randomly. I mean that if you reload many times
the page, sometimes it gives back the translated message and sometimes the
untranslated one.
These are the steps I followed to use gettext with php:

putenv(LANG=it);
setlocale(LC_ALL, it);
bindtextdomain(test, .);
textdomain(test);
print(gettext(This is a test message));

xgettext -d test test.php

in the test.po file i have
msgid 
This is a test message
msgstr 
Questo e un messaggio di prova

msgfmt - -o test.mo test.po
mkdir -p it/LC_MESSAGES
mv test.mo it/LC_MESSAGES

The OS is FreeBSD 4.6 with apache 1.3.26 and php 4.2.1

Does anybody had the same problem?
Thanks, Marco


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




Re: [PHP] Re: Stepping through an array more than once (offlist)

2002-08-29 Thread Jason Wong

On Thursday 29 August 2002 14:16, Petre Agenbag wrote:
 Hi Justin
 OK, a quick feedback on your previous suggestion:

 I tried to unset the $myrow_it, but it still didn't produce any output.
 The only way I could get it to work was with the same method you
 suggested in this e-mail.
 I had to create 2 new vars ( which basically boils down to 2 more
 SQL's).

[snip]

I've said it once already:

  mysql_data_seek()

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

/*
Heller's Law:
The first myth of management is that it exists.

Johnson's Corollary:
Nobody really knows what is going on anywhere within the
organization.
*/


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




[PHP] Re: Stepping through an array more than once (offlist)

2002-08-29 Thread Justin French

1. did my code work?





2. It appears that you have to reset the mysql_fetch_*(), not reset the
$myrow. Try calling:

mysql_data_seek($result_it, 0)

before

while ($myrow = mysql_fetch_assoc($result))

It would appear that it resets the $result_it for a call to
mysql_fetch_row().  I would assume that it would also work for
mysql_fetch_array() and mysql_fetch_assoc()

Worth a try.


Justin



on 29/08/02 4:16 PM, Petre Agenbag ([EMAIL PROTECTED]) wrote:

 Hi Justin
 OK, a quick feedback on your previous suggestion:
 
 I tried to unset the $myrow_it, but it still didn't produce any output.
 The only way I could get it to work was with the same method you
 suggested in this e-mail.
 I had to create 2 new vars ( which basically boils down to 2 more
 SQL's).
 
 I think I'm not 100% understanding what the $result variable contains
 $sql = 'select * from table';
 $result = mysql_query($sql);
 
 As I would think, $result contains the entire table in some sort of
 structure or matrix right?
 And doing a
 while ($myrow = mysql_fetch_assoc($result))
 
 creates a one dimensional array of each row in the table with each pass.
 I was just looking for a way to step through $result again and again,
 without having to query the DB again...
 But the only way I can get it to work is to do:
 $result2 = mysql_query($sql);
 $result3 = mysql_query($sql);
 
 and then I can
 
 while ($myrow = mysql_fetch_assoc($result2))
 
 
 and later 
 
 while ($myrow = mysql_fetch_assoc($result3))
 
 It's like the contents of $result can only be used once...Is that the
 case?
 
 I tried to do 
 $test = $result; immediately after doing the query and then using $test
 in the while , but that doesn't work either...
 
 Anyway, not a train smash, will carry on with the trusty old ways.
 
 
 
 
 
 On Wed, 2002-08-28 at 18:30, Justin French wrote:
 Hi,
 
 I haven't got a heap of time tonight, but you should really look at arrays.
 What I noticed with your code was that you basically did the same thing
 (same layout and presentation three times -- and it might be 50 times
 later!!).
 
 This sort of thing cries out for an array or function -- or both!!
 
 Let's start by recognising your 3 loops: OPEN, CURRENT, OLD.  Arrays come in
 many shapes, but generally a one-dimensional array is in the form of 'key'
 = 'value'.  In this case, I've chosen to use the three types of status as
 the key, and the natural language or heading as the value.
 
 ?
 $ticketTypes = array(
 'OPEN' = 'New Tickets',
 'CURRENT = 'Current Tickets',
 'OLD' = 'Old Tickets'
 );
 ?
 
 Then you can loop through this array with a foreach, and do the same thing
 to all three elements.
 
 Now, we have to take the $type (key) and $heading (value) of each array
 element (the three options) and use them within the loop to produce the
 different results.
 
 ?
 
 // array of ticket types
 $ticketTypes = array(
 'OPEN' = 'New Tickets',
 'CURRENT = 'Current Tickets',
 'OLD' = 'Old Tickets'
 );
 
 
 foreach($ticketTypes as $type = $heading)
 {
 // print heading
 echo B{$heading}/BBR;
 
 $sql = SELECT * FROM tickets WHERE status='{$type}';
 $result = mysql_query($sql);
 if(!$result) 
 {
 echo There was a database error:  . mysql_error() . BR;
 }
 else
 {
 // no need to to do an $i++ count... just use this:
 $total = mysql_num_rows($result);
 while ($myrow = mysql_fetch_array($result))
 {
 // a little trick i have to make each column
 // name (eg status) into it's own var (eg $status)
 foreach($myrow as $k = $v) { $$k = $v; }
 echo {$company} :: {$title} :: {$content}br;
 }
 echo Total New: {$total}br;
 }
 }
 ?
 
 
 Now, I haven't tested the above, so gimmie a yell if it breaks...
 
 When I strip all the bullshit and comments out, and condense the script down
 to it rawest form, it's like 19 lines of code -- that's including error
 handling and all sorts of stuff!!  And it will work for 2 ticket types
 (still less lines of code than your 40+) and for 50 ticket types -- just
 make the array bigger.
 
 The other point is, if this script was called for many different pages, then
 you could include it all in a function... but that's for another day!
 
 
 Sure, you're doing three sql queries, but each one of them is returning a
 more focused result set... I'd have to do some tests, but I reckon there's
 very little difference between ONE QUERY + MASSIVE AMOUNTS OF PHP CODING
 if() sections etc etc, versus THREE QUERIES + SOME CODING.  The nature of
 what you want to achieve with this script is conducive to using three
 separate queries.
 
 I know less queries == faster, but it's not always the case, and not always
 worth worrying about, unless you've got a HUGE site with millions of hits a
 day... you just won't notice the benefit, in comparison to the advantage.
 
 
 Some pages on a site I'm working on right now, hinge.net.au, have 5-10
 queries on them, for sessions, users, content, data, counters, logging,
 message boards, etc etc.  And I've NEVER noticed a performance problem, or
 got 

Re: [PHP] Re: Stepping through an array more than once (offlist)

2002-08-29 Thread Petre Agenbag

Jason
Sorry, I completely forgot to comment on your suggestion:

I did try mysql_data_seek(), but it didn't work for me ( guess I don't
know how exactly it works), BUT, it did look like it was meant for
stepping through a one dimensional array, and $result is not a one
dimensional array, right?
Maybe I'm just not thinking correctly, 
Justin has also just commented on your suggestion and he seems to give
some sort of an implementation of using mysql_data_seek(), maybe it
will explain it a better for me, I'll quickly see if I can get it to
work.

Thanks for the input!

On Thu, 2002-08-29 at 08:46, Jason Wong wrote:
 On Thursday 29 August 2002 14:16, Petre Agenbag wrote:
  Hi Justin
  OK, a quick feedback on your previous suggestion:
 
  I tried to unset the $myrow_it, but it still didn't produce any output.
  The only way I could get it to work was with the same method you
  suggested in this e-mail.
  I had to create 2 new vars ( which basically boils down to 2 more
  SQL's).
 
 [snip]
 
 I've said it once already:
 
   mysql_data_seek()
 
 -- 
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 
 /*
 Heller's Law:
   The first myth of management is that it exists.
 
 Johnson's Corollary:
   Nobody really knows what is going on anywhere within the
   organization.
 */
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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




Re: [PHP] Re: Stepping through an array more than once (offlist)

2002-08-29 Thread Petre Agenbag

Jason
Thanks
the mysql_data_seek() works.
With Justin's help, I used the mysql_data_seek() to reset the $result
matrix to 0, and re-issued the same while statement.
It now produces the desired output.
Thanks.

On Thu, 2002-08-29 at 08:46, Jason Wong wrote:
 On Thursday 29 August 2002 14:16, Petre Agenbag wrote:
  Hi Justin
  OK, a quick feedback on your previous suggestion:
 
  I tried to unset the $myrow_it, but it still didn't produce any output.
  The only way I could get it to work was with the same method you
  suggested in this e-mail.
  I had to create 2 new vars ( which basically boils down to 2 more
  SQL's).
 
 [snip]
 
 I've said it once already:
 
   mysql_data_seek()
 
 -- 
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 
 /*
 Heller's Law:
   The first myth of management is that it exists.
 
 Johnson's Corollary:
   Nobody really knows what is going on anywhere within the
   organization.
 */
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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




Re: [PHP] Re: Stepping through an array more than once (offlist)

2002-08-29 Thread Justin French

on 29/08/02 5:06 PM, Petre Agenbag ([EMAIL PROTECTED]) wrote:

 Jason
 Thanks
 the mysql_data_seek() works.
 With Justin's help, I used the mysql_data_seek() to reset the $result
 matrix to 0, and re-issued the same while statement.
 It now produces the desired output.
 Thanks.

Of course I only figured out what you needed by seeing Jason's post, going
to the manual, reading the documentation, and guessing what needed to be
done... something you could have done yourself :)


Justin


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




[PHP] Change user agent when using file() or fopen()

2002-08-29 Thread David Yee

How do I change the browser name and version presented to the target web
server when I use file() or fopen()?  E.g.

?php
$content = file('http://foo.bar/foo.html');
?

The access_log for the web server will show something like:

127.0.0.1 - - [29/Aug/2002:00:08:59 -0700] GET /foo.html HTTP/1.0 404 45
- PHP/4.2.2

I want to change PHP/4.2.2 to something like Mozilla/4.0 (compatible;
MSIE 5.01; Windows NT).

I looked in php.ini but couldn't find a setting for this.  Anyone know where
to set this?  Thanks.

David


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




[PHP] wish list for my host's new compile

2002-08-29 Thread Justin French

Hi all,

My host is putting together a new linux box at the moment for hosting, and I
want to make sure that they include a few things that I've needed, but
weren't available on the current server.  I've got about 15 domains with
them, so it's not particularly easy to change hosts.

A few things I've wanted so far:
- enable_trans_sid
- mcrypt (encypting credit cards, etc)
- GD library w/JPEG  PNG
- PDFlib
- XML 

All of these (except PDFlib) seem to be included in the server they're in
BETA testing on (see http://indent.com.au/temp/newserver_phpinfo.html for an
output of phpinfo() on the new server).

Although, I'm not up to speed on what I REALLY need to look for.

1. are the mcrypt Supported ciphers the usual suspects?
2. are the XML components installed the usual suspects?

If not, what should I be looking to have added?

3. Is there anything else that I should be looking for on the server?
They're not in a habbit of adding stuff once the server is in production,
so I'm keen to get as much on there as possible before they roll it out.



Thanks in advance,

(see http://indent.com.au/temp/newserver_phpinfo.html for a php_info output
from the new server, as sent to me by the host)

Justin French


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




[PHP] Where is my REMOTE_USER?

2002-08-29 Thread Frank


Hi,

when logging in with username and password with the good old Require user 
mechanism in Apache I could earlier see the name of the user logging in as 
$REMOTE_USER.

But it seems now to have disappeared. It seems to be nowhere, neither as

$GLOBALS['REMOTE_USER']
$_SERVER['REMOTE_USER']
$_ENV['REMOTE_USER']

or in the older

$HTTP_SERVER_VARS['REMOTE_USER']

or in any of the other superglobals.

Did it possibly fall out of the PHP implementation? Or should it be there 
and I am overlooking something?

Thanks!

Frank
U5.com


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




[PHP] Re: CHM 8th sample is out

2002-08-29 Thread Ulf Haueisen


Hi Goba,

I'm able to confirm again that the sample 8 is working and looking great on
Windows XP SP1 beta (includes IE6 SP1 beta) whether the show friendly error
messages setting is enabled or not.

Ulf.




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




[PHP] Re: PHP: XML/XSL

2002-08-29 Thread Alexandru COSTIN

Hello
For painless XML/XSL transformation on PHP, you should check Krysalis, the 
XML/XSL development framework. We have a lot of nice features packed in, 
like dynamic XML, multiple XSL transformations in a pipeline, etc.

http://www.interakt.ro/products/Krysalis/

Alexandru


Alia Mikati wrote:

 Hi everybody,
 I'm using Sablotron to transform XML with XSL and this is the PHP file:
 
 Thx a lot


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




[PHP] Can I show input data whrn back to the Input Form?

2002-08-29 Thread Hakkan Lui

Dear all,

In my php program, when user click submit on a form, it comes to a
confirmation page, showing what the user entered in the form.

If the user find want to re-enter the information, he press Back on the
browser. Then it comes back to the form, with empty input.

I want to ask:
Can the form show the previously input data, when the user goes back from
the confirmation page?
If no, any other method to do that?

Thanks for your help.


Regards,
Hakkan Lui



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




Re: [PHP] Can I show input data whrn back to the Input Form?

2002-08-29 Thread Justin French

Relying on the back button isn't good... the data may or may not be there
when they return.

However, you CAN provide them with a button change, and POST the data to a
form... where they modify their data, the form needs to echo the POST data
back into the form, eg:

FORM action=validate.php action=POST
INPUT type=text name=username value=?=$_POST['username']?
/FORM

selects, checkboxes and some other things are a little more tricky, but
you'll figure them out... search the archives too... it's been asked 1000's
of times :)


Justin French


on 29/08/02 7:02 PM, Hakkan Lui ([EMAIL PROTECTED]) wrote:

 Dear all,
 
 In my php program, when user click submit on a form, it comes to a
 confirmation page, showing what the user entered in the form.
 
 If the user find want to re-enter the information, he press Back on the
 browser. Then it comes back to the form, with empty input.
 
 I want to ask:
 Can the form show the previously input data, when the user goes back from
 the confirmation page?
 If no, any other method to do that?
 
 Thanks for your help.
 
 
 Regards,
 Hakkan Lui
 
 


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




Re: [PHP] wish list for my host's new compile

2002-08-29 Thread Liam MacKenzie

I just happen to be re-compiling my hosting servers right now...
I'll compile those things into PHP.

If your sites are:
non-profit
personal
development

I'll host them free for you.
Read up a few messages to one with the subject Hosts and look for one from
me for more details.

Cheers,
Liam

- Original Message -
From: Justin French [EMAIL PROTECTED]
To: php [EMAIL PROTECTED]
Sent: Thursday, August 29, 2002 6:03 PM
Subject: [PHP] wish list for my host's new compile


Hi all,

My host is putting together a new linux box at the moment for hosting, and I
want to make sure that they include a few things that I've needed, but
weren't available on the current server.  I've got about 15 domains with
them, so it's not particularly easy to change hosts.

A few things I've wanted so far:
- enable_trans_sid
- mcrypt (encypting credit cards, etc)
- GD library w/JPEG  PNG
- PDFlib
- XML

All of these (except PDFlib) seem to be included in the server they're in
BETA testing on (see http://indent.com.au/temp/newserver_phpinfo.html for an
output of phpinfo() on the new server).

Although, I'm not up to speed on what I REALLY need to look for.

1. are the mcrypt Supported ciphers the usual suspects?
2. are the XML components installed the usual suspects?

If not, what should I be looking to have added?

3. Is there anything else that I should be looking for on the server?
They're not in a habbit of adding stuff once the server is in production,
so I'm keen to get as much on there as possible before they roll it out.



Thanks in advance,

(see http://indent.com.au/temp/newserver_phpinfo.html for a php_info output
from the new server, as sent to me by the host)

Justin French


--
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] how to have a form keep values when user hits back button?

2002-08-29 Thread Jean-Christian Imbeault

I have php page that creates an html form. When the user hits the submit 
button another php script is called to parse the form and display some 
output.

However I find that if I hit the back button the form values get reset. 
How can I make it so that if I hit the back button the values I entered 
in the form will still be displayed?

Jc


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




Re: [PHP] wish list for my host's new compile

2002-08-29 Thread Justin French

on 29/08/02 6:59 PM, Liam MacKenzie ([EMAIL PROTECTED]) wrote:

 I just happen to be re-compiling my hosting servers right now...
 I'll compile those things into PHP.
 
 If your sites are:
 non-profit
 personal
 development

No, maybe 13 out of the 15 are commercial.  And the other two aren't exactly
personal :)

Thanks for the offer though :)

I might have a personal site on the cards soon...

Justin






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




Re: [PHP] how to have a form keep values when user hits back button?

2002-08-29 Thread Jason Wong

On Thursday 29 August 2002 17:22, Jean-Christian Imbeault wrote:
 I have php page that creates an html form. When the user hits the submit
 button another php script is called to parse the form and display some
 output.

 However I find that if I hit the back button the form values get reset.
 How can I make it so that if I hit the back button the values I entered
 in the form will still be displayed?

Have a look at the archives, it has just been answered:

  marc.theaimsgroup.com/?l-php-general

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

/*
'Tis the dream of each programmer,
Before his life is done,
To write three lines of APL,
And make the damn things run.
*/


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




Re: [PHP] how to have a form keep values when user hits back button?

2002-08-29 Thread Jean-Christian Imbeault

Jason Wong wrote:
 
 Have a look at the archives, it has just been answered:

Thanks. Strange that two people ask the same question at almost the same 
time.

However I did search the archives and read the answer to the recently 
posted question and the answers are less than ideal.

All answers seem to be of the type re-populate the form with the data. 
And of course the POST data as to be put into sessions variables. Seems 
like a lot of work for a simple thing.

Do you agree that the only way is for the form data to be put into 
session vars and then re-populate the form?

Also can you explain to me the technical reasons why the data is not 
kept when I hit the back button?

Thanks for the info!

Jc


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




Re: [PHP] how to have a form keep values when user hits backbutton?

2002-08-29 Thread Justin French

I just answered a similar question in another current thread a few mins
ago...

So I'll just copy and paste:

---
Relying on the back button isn't good... the data may or may not be there
when they return.

However, you CAN provide them with a button change, and POST the data to a
form... where they modify their data, the form needs to echo the POST data
back into the form, eg:

FORM action=validate.php action=POST
INPUT type=text name=username value=?=$_POST['username']?
/FORM

selects, checkboxes and some other things are a little more tricky, but
you'll figure them out... search the archives too... it's been asked 1000's
of times :)
---

Other comments in line below:

on 29/08/02 7:37 PM, Jean-Christian Imbeault ([EMAIL PROTECTED])
wrote:

 All answers seem to be of the type re-populate the form with the data.
 And of course the POST data as to be put into sessions variables. Seems
 like a lot of work for a simple thing.

As I said above, SOME browsers will keep the data when the click back,
others won't.  You can't rely on it either way, but for starters, ensure
that you aren't forcing a no-cache with meta tags or headers.

But I gather you want to ENSURE that they can do this... so you need to do
as I said above... POST the values to a copy of the form, and echo the
values.

Yes, it's a bit of work.


 Do you agree that the only way is for the form data to be put into
 session vars and then re-populate the form?

Nope.  The values don't have to be in SESSIONs at all.  Could be passed to
the form with POST, GET, or even COOKIES.  I'd prefer POST.


 Also can you explain to me the technical reasons why the data is not
 kept when I hit the back button?

Each browser is different.

In my old NN4.7 mac, the values are all there.  But in IE5 mac, the values
are all there, EXCEPT for those in password fields.  In one of my other
browsers, the fields are all blank when I click back.  It may be a security
option/leave setting for each browser.

What you should aim to do is provide a forward link to the form, show what
they had, and allow them to change it...


Justin


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




Re: [PHP] Where is my REMOTE_USER?

2002-08-29 Thread David T-G

Frank, et al --

...and then Frank said...
% 
% Hi,
% 
% when logging in with username and password with the good old Require user 
% mechanism in Apache I could earlier see the name of the user logging in as 
% $REMOTE_USER.

This sort of thing has come up on the list frequently.

You should set

  register_globals = on

in your php.ini file and kick your web server.


HTH  HAND

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg77050/pgp0.pgp
Description: PGP signature


[PHP] tmpnam filename

2002-08-29 Thread Rus Foster

Hi All,
 I'm fairly new to this list/PHP and I've already hit a bit of a brick
wall. I'm trying to write some data out to a temporary file then make a
passthru call so that another program can take the file as input on the
command line

I first tried

 print pDo stuff/p;
   $temp = tmpfile();
   fwrite($temp, $text);
   passthru(/path/to/program $temp);
   fclose($temp); // this removes the file

However I realised that $temp was a file handle rather than a filename. Is
there anyway I can get the filename? A google and search on php.net
doesn't show anything obvious

Rgds

Rus

--
http://www.fsck.me.uk - Rant wibble wave
http://shells.fsck.me.uk - Hosting and stuff


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




[PHP] Debugging with the Viim editor?

2002-08-29 Thread Geoff Caplan

Hi folks

Has anyone got a PHP symbolic debugger working with the Vim editor?

I would appreciate any tips about how this might be set up.

-- 

Geoff Caplan
Advantae Ltd

mailto:[EMAIL PROTECTED]
http://www.advantae.com


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




[PHP] Getting local domain name in CLI

2002-08-29 Thread Geranium

I need to get the domain name of the local machine.
I'm running a CLI script in PHP 4.3-cvs (on OpenBSD) so I have no HTTP
or other global vars to look at. The posix_uname command doesn't
include the domain on non-GNU OSs. I can get the hostname, but not the
domain. Can I get it through some other PHP command? I'd really prefer
not to resort to rummaging in /etc and parsing files or doing something
silly like a DNS lookup...

Any ideas?

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




[PHP] sysvshm examples?

2002-08-29 Thread Geranium

Can anyone point me at some examples of using sysv shared memory,
particularly for passing values between a mod_php script and a PHP CLI
process?

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




Re: [PHP] Where is my REMOTE_USER?

2002-08-29 Thread Frank

At 06:03 29/8/2002 -0400, David T-G wrote:

  Frank, et al --
  ..and then Frank said...
  %
  % Hi,
  %
  % when logging in with username and password with the good old Require 
user
  % mechanism in Apache I could earlier see the name of the user logging 
in as
  % $REMOTE_USER.
  This sort of thing has come up on the list frequently.
  You should set
  register_globals = on
  in your php.ini file and kick your web server.
 
  HTH  HAND

But! Two things:

1. register_globals were already turned on
2. Surely the PHP designers would not force users to have such a major 
security advantage turned off for getting a variable that is a true apache-var?

So problems remains: Where did the REMOTE_USER go?

I am BTW running Apache 2.0 with PHP 4.2.2 as a CGI-module. When it worked 
last time I was only running Apache 1.3.26. Maybe the Apache-guys changed 
something?! Could be a RTFM-case...

Well, probably I should drop using Apache's old auth-sceme and run all in 
PHP anyway.

Thank you for the input.

Best

Frank
U5com





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




[PHP] why does my querry work in the mysql client but not in php?

2002-08-29 Thread Michael Knauf

I'm in OS X 10.2 (Jaguar) Apache/PHP/MySQL are all playing happily 
together, so it's time to get some work done. From the MySQL client, 
this query does what I expect it to:

update endpage set productname='Berenice lamp', bgcolor='eec472', 
imgsrc='bereniceep.jpg', img_orientation='horizontal', cartlink='I 
don\'t know yet', categorylink='lighting.html', catlinkimg='sex', 
copy=' Since it was designed in 1985, the Berenice lamp has become a 
classic, acquired by museums everywhere. Paolo Rizzatto and Alberto 
Meda gave it a fully articulated and adjustable arm on a weighted 
base either wall-mounted, clip-on or free standing. Finish colors may 
be matte black or silver with green, blue, black, or silver diffuser 
shade. Its 35-watt halogen bulb provides excellent task lighting in a 
355-degree arc. The transformer is separated from the base, making 
Berenice perfect for tight spaces. ', price='320', 
titleimg='berenicetitle.gif' where id='5'

Now, I got that query by doing an ? echo $query ? into an html page 
and copying and pasting into the MySQL client, where the query 
returns the expected result...

from the php page however, it does not work, even though it appears 
to be generating a perfectly good querry... Here's the PHP

$connection = mysql_connect(server, user, pass) or 
die(Couldn't connect.);
$db = mysql_select_db($db_name, $connection) or die(Couldn't select 
database.);
$query = update endpage set productname='$productname', 
bgcolor='$bgcolor', imgsrc='$imgsrc', 
img_orientation='$img_orientation', cartlink='$cartlink', 
categorylink='$categorylink', catlinkimg='$catlinkimg', copy='$copy', 
price='$price', titleimg='$titleimg' where id='$id';
$result = mysql_query($query);

Can anybody explain that?

Michael

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




[PHP] date from mysql

2002-08-29 Thread Hendråwan Rinäldi

i want Y (year format) printed on my php script (looping), i already tried
it but i got same Year format (ex 1978) in all row in my table

my loop script  is:


$query  = (select * from table);
$result = mysql_query($query);
while ($row = mysql_fetch_row($result))
$number =  mysql_numrows($result);


$i = 0;
while ($i  $number):
$date  = mysql_result($result, $i,$date);

if ($i%2 == 0){

echo b$date/b;
if ($i%2 == 0){
echo $date;
  }
$i++;
ENDWHILE;






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




[PHP] Re: why does my querry work in the mysql client but not in php?

2002-08-29 Thread Jean-Christian Imbeault

Have you looked at what the value of what $result is? It might be 
informational.

Jc


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




Re: [PHP] foreach fails on unitialized array?

2002-08-29 Thread Eric Pignot

I would expect foreach to treat an unitialized variable as an empty
array and hence do nothing. Is this the expected behaviour?

if(is_array($myvar)) foreach($myvar as $key = $value ) {
  ...
}

other possibility, so that the foreach is run each time (and it doesn't
affect the source code, you can put it wherever you want) :
if(!is_array($myvar)) {
$myvar = array();
}

regards !

Eric




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




[PHP] Re: tmpnam filename

2002-08-29 Thread Eric Pignot

Why do you use tmpfile and not tempnam, as you write it in the header of
your message ? it returns the name of the file, as you expect...
string tempnam ( string dir, string prefix)

Then, you'll just need to open the file returned by tempnam and write all
data inside...

regards

Eric



Rus Foster [EMAIL PROTECTED] a écrit dans le message de news:
[EMAIL PROTECTED]
 Hi All,
  I'm fairly new to this list/PHP and I've already hit a bit of a brick
 wall. I'm trying to write some data out to a temporary file then make a
 passthru call so that another program can take the file as input on the
 command line

 I first tried

  print pDo stuff/p;
$temp = tmpfile();
fwrite($temp, $text);
passthru(/path/to/program $temp);
fclose($temp); // this removes the file

 However I realised that $temp was a file handle rather than a filename. Is
 there anyway I can get the filename? A google and search on php.net
 doesn't show anything obvious

 Rgds

 Rus

 --
 http://www.fsck.me.uk - Rant wibble wave
 http://shells.fsck.me.uk - Hosting and stuff




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




[PHP] Re: Cannot get data from form.

2002-08-29 Thread Eric Pignot

This is really a FAQ, I would suggest that you read a bit more documentation
before posting.

Eric


Le Van Thanh [EMAIL PROTECTED] a écrit dans le message de news:
[EMAIL PROTECTED]
- I have installed PHP4.2.2 with Apache 1.3.26 on Solaris7.
And now I have problems with getting data from form.
I have 2 pages test.html and welcome.php as following:

test.html---
-
form userDetails method=post action=welcome.php
Enter your Name: br
input type=text  value= name=name
input type=submit value=Enter name=welcome
/form
--welcome.html-

?php
print  $name ;
?

===

Then I cannot get the value of input name.
But if I write  print $_POST['name']; or  print
$HTTP_POST_VARS['name'];, it's ok.

Is there something wrong when I install PHP?
Thanks a lot.






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




RE: [PHP] why does my querry work in the mysql client but not in php?

2002-08-29 Thread Jay Blanchard

[snip]
from the php page however, it does not work, even though it appears
to be generating a perfectly good querry... Here's the PHP

$connection = mysql_connect(server, user, pass) or
die(Couldn't connect.);
$db = mysql_select_db($db_name, $connection) or die(Couldn't select
database.);
$query = update endpage set productname='$productname',
bgcolor='$bgcolor', imgsrc='$imgsrc',
img_orientation='$img_orientation', cartlink='$cartlink',
categorylink='$categorylink', catlinkimg='$catlinkimg', copy='$copy',
price='$price', titleimg='$titleimg' where id='$id';
$result = mysql_query($query);
[/snip]

1. Do a print($query); so that you can look at the query and make sure that
it is right.
2. Trap MySQL errors for the query by doing something like this;

if(!($result = mysql_query($query, ))){
   print(MySQL reports:  . mysql_error . \n);
   exit();
}

WHERE IS YOUR DB CONNECTION VARIABLE?
I believe that your error is that the following line
$result = mysql_query($query);

should be
$result = mysql_query($query, $connection);

HTH!

Jay

*
* Texas PHP Developers Conf  Spring 2003*
* T Bar M Resort  Conference Center*
* New Braunfels, Texas  *
* Contact [EMAIL PROTECTED]   *
*   *
* Want to present a paper or workshop? Contact now! *
*



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




[PHP] setcookie IE6 problem

2002-08-29 Thread Javier Montserat

I'm setting a session cookie with the following code -

function setSessionCookie(){
   $expires = time()+$this-session_expires;
   $issetCookie = setcookie($this-cookiename,
$this-sess_id,
$expires,
/,

   );
}

Occasionally setcookie seems to fail in IE6, or perhaps when I subsequently 
retrieve the cookie as a part of the authentication code on each page IE6 
fails to pick up the cookie - either way I get logged out.

Other browsers (NS4, IE5, IE5.5) seem okay.

Any Ideas?

Javier


_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




Re: [PHP] setcookie IE6 problem

2002-08-29 Thread Gregory Barker

MS has introduced p3p policy in IE6 which has impacted on cookies etc. If
the site or host does not have a machine generated xml privacy statement,
then stability with regards
to cookies is not guaranteed. Do a search and read up about it. Check out
w3c's site.

- Original Message -
From: Javier Montserat [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, August 29, 2002 1:39 PM
Subject: [PHP] setcookie IE6 problem


 I'm setting a session cookie with the following code -

 function setSessionCookie(){
$expires = time()+$this-session_expires;
$issetCookie = setcookie($this-cookiename,
 $this-sess_id,
 $expires,
 /,
 
);
 }

 Occasionally setcookie seems to fail in IE6, or perhaps when I
subsequently
 retrieve the cookie as a part of the authentication code on each page IE6
 fails to pick up the cookie - either way I get logged out.

 Other browsers (NS4, IE5, IE5.5) seem okay.

 Any Ideas?

 Javier


 _
 Send and receive Hotmail on your mobile device: http://mobile.msn.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] why does my querry work in the mysql client but not in php?

2002-08-29 Thread Jay Blanchard

[snip]
2. Trap MySQL errors for the query by doing something like this;

if(!($result = mysql_query($query, ))){
   print(MySQL reports:  . mysql_error . \n);
   exit();
}
[/snip]

TYPO!!! :^] Should be mysql_error() (note the parentheses)

HTH!

Jay

*
* Texas PHP Developers Conf  Spring 2003*
* T Bar M Resort  Conference Center*
* New Braunfels, Texas  *
* Contact [EMAIL PROTECTED]   *
*   *
* Want to present a paper or workshop? Contact now! *
*




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




[PHP] Re: Change user agent when using file() or fopen()

2002-08-29 Thread Bogdan Stancescu

You'll have to do it the hard way if you need that functionality - i.e. 
open a port on the remote machine (port 80), build a http query, send it 
and read from the port. That way you can control the whole process and 
send whatever browser identification, require certain languages, manage 
the transfer etc.

Bogdan

David Yee wrote:
 How do I change the browser name and version presented to the target web
 server when I use file() or fopen()?  E.g.
 
 ?php
 $content = file('http://foo.bar/foo.html');
 ?
 
 The access_log for the web server will show something like:
 
 127.0.0.1 - - [29/Aug/2002:00:08:59 -0700] GET /foo.html HTTP/1.0 404 45
 - PHP/4.2.2
 
 I want to change PHP/4.2.2 to something like Mozilla/4.0 (compatible;
 MSIE 5.01; Windows NT).
 
 I looked in php.ini but couldn't find a setting for this.  Anyone know where
 to set this?  Thanks.
 
 David
 



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




[PHP] working with ssl

2002-08-29 Thread Andy

Hi there,

I would like to serve some php pages crypted with ssl. Now I am wondering
what ssl sw to install. I found openssl but this seams to be in alpha
stadium. How do I install ssl with php anyway. Can somebody give me a hint
on that?

Thanx in advance,

Andy




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




[PHP] resizing an image

2002-08-29 Thread ROBERT MCPEAK

Could someone show me some php that proportionally resizes an image? 
I'm collecting user sumbitted images and need them all to be within
certain size constraints.  What's the simplest, best way to do this?

Sample code would be a huge help, as I'm a newbie and have not done
anything with PHP image processing functions.

Thanks!!

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




RE: [PHP] working with ssl

2002-08-29 Thread Scott Houseman

Hi Andy.

I would recommend running PHP as an Apache module as well as mod_ssl - which
will require openssl as well.
Have a look at http://www.modssl.org

Regards

-Scott


 -Original Message-
 From: Andy [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 29, 2002 3:36 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] working with ssl


 Hi there,

 I would like to serve some php pages crypted with ssl. Now I am wondering
 what ssl sw to install. I found openssl but this seams to be in alpha
 stadium. How do I install ssl with php anyway. Can somebody give me a hint
 on that?

 Thanx in advance,

 Andy




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




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




[PHP] Re: working with ssl

2002-08-29 Thread Jean-Christian Imbeault

Use mod_ssl if you are doing apache.

Have a look at:

http://www.modssl.org/source/exp/mod_ssl/pkg.mod_ssl/INSTALL

Jc


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




Re: [PHP] resizing an image

2002-08-29 Thread Robert Cummings

ROBERT MCPEAK wrote:
 
 Could someone show me some php that proportionally resizes an image?
 I'm collecting user sumbitted images and need them all to be within
 certain size constraints.  What's the simplest, best way to do this?
 
 Sample code would be a huge help, as I'm a newbie and have not done
 anything with PHP image processing functions.

*sheesh* read the first comment at:

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

-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

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




RE: [PHP] resizing an image

2002-08-29 Thread Liam . Gibbs

 Could someone show me some php that proportionally resizes an image?
 I'm collecting user sumbitted images and need them all to be within
 certain size constraints.  What's the simplest, best way to do this?

Try out www.php.net/imagecopyresized or
http://www.php.net/manual/en/ref.image.php if that doesn't do your job for
you.

Although these are valid functions, you'll need the GD extension or you'll
get error messages. Make sure you have this installed first.

 Sample code would be a huge help, as I'm a newbie and have not done
 anything with PHP image processing functions.

Fraid I can't help you here. Haven't developed any, although I'm sure it's
not hard, but I'm sure someone else can provide some.

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




Re: [PHP] resizing an image

2002-08-29 Thread ROBERT MCPEAK

Sheesh, I will.  Thanks.

 Robert Cummings [EMAIL PROTECTED] 08/29/02 09:47AM

ROBERT MCPEAK wrote:
 
 Could someone show me some php that proportionally resizes an image?
 I'm collecting user sumbitted images and need them all to be within
 certain size constraints.  What's the simplest, best way to do this?
 
 Sample code would be a huge help, as I'm a newbie and have not done
 anything with PHP image processing functions.

*sheesh* read the first comment at:

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

-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
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] setcookie IE6 problem

2002-08-29 Thread Javier Montserat

Thanks for the reply, a little more info below...

Speaking of cookies, any general thoughts on the relative merits of using 
php's setcookie function vs. setting a cookie with a header() call?  Are 
both methods equal?

Will do more research later and post anything interesting on the IE6 
issue...

. . . . .
php manual - setcookie notes
[EMAIL PROTECTED] wrote -
MSIE 6 has a inaccurate definition of third party cookies. If your domain is 
hosted on one server and your PHP stuff is on another, the IE6 p3p 
implementation considers any cookies sent from the second machine third 
party.
Third party cookies will be blocked automatically in most privacy settings 
if not accompanied by what MS considers an appropriate Compact Policy. In 
order to make this new piece of tweakable garbage happy I'd suggest you'd 
par exemple send
header('P3P: CP=NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM');
before sending your cookie from your second machine.
This header enables your cookie to survive any privacysetting.

MS has introduced p3p policy in IE6 which has impacted on cookies etc. If
the site or host does not have a machine generated xml privacy statement,
then stability with regards
to cookies is not guaranteed. Do a search and read up about it. Check out
w3c's site.

- Original Message -
From: Javier Montserat [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, August 29, 2002 1:39 PM
Subject: [PHP] setcookie IE6 problem


  I'm setting a session cookie with the following code -
 
  function setSessionCookie(){
 $expires = time()+$this-session_expires;
 $issetCookie = setcookie($this-cookiename,
  $this-sess_id,
  $expires,
  /,
  
 );
  }
 
  Occasionally setcookie seems to fail in IE6, or perhaps when I
subsequently
  retrieve the cookie as a part of the authentication code on each page 
IE6
  fails to pick up the cookie - either way I get logged out.
 
  Other browsers (NS4, IE5, IE5.5) seem okay.
 
  Any Ideas?
 
  Javier
 
 
  _
  Send and receive Hotmail on your mobile device: http://mobile.msn.com
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 




_
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


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




[PHP] PHP and Transactions with InnoDB

2002-08-29 Thread Geranium

I could use some practical tips on doing transactions with InnoDB
tables in MySQL.

I want to grab and lock a record and do a whole load of related stuff,
then make sure everything is updated in a consistent way, something
like this skeleton:

BEGIN

SELECT * from blah WHERE something=n FOR UPDATE //Grab and lock a record

SELECT * from t1, t2 where a=1 ...

INSERT blah...

UPDATE something else...

if ($allok)
   COMMIT
else
   ROLLBACK

I don't quite get what I need to do to make sure these are all regarded
as part of the same transaction. Does the transation apply to all
queries made between the begin and commit (I assume so)? What happens
when I have another process doing the same thing at the same time?
Do I need to keep the result value I get from the begin query and
somehow use it for the commit at the end so MySQL knows they are two
ends of the same transaction? Or does MySQL somehow track that for me -
i.e. can there only be one transaction in progress per connection?

I'm finding the MySQL docs are extremely dry and somewhat short on
examples...

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




[PHP] Re: Cannot get data from form.

2002-08-29 Thread Brian Windsor

That's the way it works in the newer PHP for security reasons.  I had to rewrite all my
code about a week ago because my client was using php 4.2 and I had 4.0.  It has to do
with the Globals are set to being turned off in the php.ini file.  You should be able 
to
change the php.ini file to globals on, but people will argue that it's a security 
problem
and you should just change all your global varieables to the new way.  It's your call.
Hope this helps.

Brian


Le Van Thanh wrote:

 - I have installed PHP4.2.2 with Apache 1.3.26 on Solaris7.
 And now I have problems with getting data from form.
 I have 2 pages test.html and welcome.php as following:

 test.html
 form userDetails method=post action=welcome.php
 Enter your Name: br
 input type=text  value= name=name
 input type=submit value=Enter name=welcome
 /form
 --welcome.html-

 ?php
 print  $name ;
 ?

 ===

 Then I cannot get the value of input name.
 But if I write  print $_POST['name']; or  print $HTTP_POST_VARS['name'];, it's 
ok.

 Is there something wrong when I install PHP?
 Thanks a lot.

--
Brian Windsor
Giant Studios
Senior Technical Director of Motion Capture
[EMAIL PROTECTED]
(404)367-1999





Re: [PHP] PHP and Transactions with InnoDB

2002-08-29 Thread Miles Thompson

I've not worked with InnoDb, but given that the web is a stateless space 
and all kinds of things can happen, I'd be very reluctant to lock a record 
until the very moment I'm updating it. In other words, when I have my batch 
of updates and inserts ready to go, then I'd begin by transaction, execute 
them, and do a commit or a rollback.

Cdn$ .02   - Miles Thompson

At 04:59 PM 8/29/2002 +0200, Geranium wrote:
I could use some practical tips on doing transactions with InnoDB
tables in MySQL.

I want to grab and lock a record and do a whole load of related stuff,
then make sure everything is updated in a consistent way, something
like this skeleton:

BEGIN

SELECT * from blah WHERE something=n FOR UPDATE //Grab and lock a record

SELECT * from t1, t2 where a=1 ...

INSERT blah...

UPDATE something else...

if ($allok)
COMMIT
else
ROLLBACK

I don't quite get what I need to do to make sure these are all regarded
as part of the same transaction. Does the transation apply to all
queries made between the begin and commit (I assume so)? What happens
when I have another process doing the same thing at the same time?
Do I need to keep the result value I get from the begin query and
somehow use it for the commit at the end so MySQL knows they are two
ends of the same transaction? Or does MySQL somehow track that for me -
i.e. can there only be one transaction in progress per connection?

I'm finding the MySQL docs are extremely dry and somewhat short on
examples...

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



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




[PHP] Re: Cannot get data from form.

2002-08-29 Thread Javier Montserat

Turning off register globals and referencing variables through the new array 
syntax certainly gives a greater degree of control over the origin of data; 
ie: a variable referenced $_POST['foo'] has (most likely) been received as a 
result of http post and it's reasonably safe to assume $_COOKIE['foo'] is a 
value from a cookie etc.  In this example with globals=on $foo could have 
come from anywhere...

The only thing i've found a bit annoying is when a value can be passed 
variously by a form (method=post) or as a query string value appended to a 
link uri.

Writing...

if (isset($_GET['foo'])) {
  $foo = $_GET['foo']
} elseif (isset($_POST['foo'])) {
  $foo = $_POST['foo']
}

when I want to use $foo is a bit annoying, but i haven't figured out a more 
elegant way of saying this yet.


Javier



That's the way it works in the newer PHP for security reasons.  I had to 
rewrite all my
code about a week ago because my client was using php 4.2 and I had 4.0.  It 
has to do
with the Globals are set to being turned off in the php.ini file.  You 
should be able to
change the php.ini file to globals on, but people will argue that it's a 
security problem
and you should just change all your global varieables to the new way.  It's 
your call.
Hope this helps.

Brian


Le Van Thanh wrote:

- I have installed PHP4.2.2 with Apache 1.3.26 on Solaris7.
And now I have problems with getting data from form.
I have 2 pages test.html and welcome.php as following:

test.html
form userDetails method=post action=welcome.php
 Enter your Name: br
 input type=text  value= name=name
 input type=submit value=Enter name=welcome
/form
--welcome.html-

?php
 print  $name ;
?

===

Then I cannot get the value of input name.
But if I write  print $_POST['name']; or  print 
$HTTP_POST_VARS['name'];, it's ok.

Is there something wrong when I install PHP?
Thanks a lot.

--
Brian Windsor
Giant Studios
Senior Technical Director of Motion Capture
[EMAIL PROTECTED]
(404)367-1999





_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




[PHP] sprintf() question

2002-08-29 Thread SpamSucks86

I read the manual page on sprintf, but I still don't understand exactly
how the format string works. 

 

$money1 = 68.75;
$money2 = 54.35;
$money = $money1 + $money2;
// echo $money will output 123.1;
$formatted = sprintf(%01.2f, $money);
// echo $formatted will output 123.10

 

How does that work? What part of the string corresponds to what? Thanks
for any and all help!




Re: [PHP] PHP and Transactions with InnoDB

2002-08-29 Thread Geranium

In article [EMAIL PROTECTED],
Miles Thompson [EMAIL PROTECTED] wrote:

 I've not worked with InnoDb, but given that the web is a stateless space 
 and all kinds of things can happen, I'd be very reluctant to lock a record 
 until the very moment I'm updating it. In other words, when I have my batch 
 of updates and inserts ready to go, then I'd begin by transaction, execute 
 them, and do a commit or a rollback.

I should have mentioned: it's not actually running behind a web process
but as a stand-alone CLI process in PHP 4.3-cvs, so it's not quite as
subject to the vagaries of web accesses. At the moment there's really
only one process involved, but I'm intending to expand it later, hence
this query.

I see what you're saying, but the problem I have is that the results of
the intermediate queries are dependent on me having control of the
master record, i.e. If I make them without the master record being
locked, by the time it comes to posting them back to the database, they
may be meaningless, so I need to make sure that the state of the
database is consistent throughout all the queries, as if I was the only
client. Isn't this the whole point of transactions?

Is ther any particular problem with having transactions that take a
while, say 10-20 seconds overall?

I suspect I'm just not quite clear on exactly the relationship between
record locking and transactions.

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




[PHP] Print page

2002-08-29 Thread Rosen

Hi,
I'm using PHP to generate some report for printing.
But when I print report from IE 5.0 browser, in the bottom of page
IE prints URL of page.
Can I remove it ?


Thanks,
Rosen



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




RE: [PHP] Print page

2002-08-29 Thread Jay Blanchard

[snip]
I'm using PHP to generate some report for printing.
But when I print report from IE 5.0 browser, in the bottom of page
IE prints URL of page.
Can I remove it ?
[/snip]

Only in individual browser settings (like IE, File-Page Setup-Clear the
Header and Footer boxes). There is no way to control this with PHP. Each
browser is different on how this is handled.

HTH!

Jay

***
* Central Texas PHP Developers Group  *
* San Antonio, Austin, San Marcos, New Braunfels, *
* Seguin, Boerne, Blanco, the Hill Country*
* Interested? *
* Contact [EMAIL PROTECTED] *
***



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




RE: [PHP] Print page

2002-08-29 Thread Collins, Robert

yes, but that is a browser function not php 
goto file - page setup - then remove the header and footer data

Robert W. Collins II
Webmaster
New Orleans Regional Transit Authority
Phone : (504) 248-3826
Fax: (504) 248-3866
Email : [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 



-Original Message-
From: Rosen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 29, 2002 11:29 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Print page


Hi,
I'm using PHP to generate some report for printing.
But when I print report from IE 5.0 browser, in the bottom of page
IE prints URL of page.
Can I remove it ?


Thanks,
Rosen



-- 
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] sprintf() question

2002-08-29 Thread @ Edwin
Experiment a bit and I'm sure you'll find it easy. One example, change this 
portion

  $formatted = sprintf("%01.2f", $money);

to

  $formatted = sprintf("%01.3f", $money);

then see how it works...

?php

$money1 = 68.75;
$money2 = 54.35;
$money = $money1 + $money2;
echo "This is money: $money";
$formatted = sprintf("%01.3f", $money);
echo "This is formatted: $formatted";

?

HTH,

- E


I read the manual page on sprintf, but I still don't understand exactly
how the format string works.



$money1 = 68.75;
$money2 = 54.35;
$money = $money1 + $money2;
// echo $money will output "123.1";
$formatted = sprintf("%01.2f", $money);
// echo $formatted will output "123.10"



How does that work? What part of the string corresponds to what? Thanks
for any and all help!





_
$B%-%c%j%"%"%C%W$rL\;X$9$"$J$?$N%J%S%2!<%?!<(B MSN $B="?&!>?&(B 
http://career.msn.co.jp/


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


Re: [PHP] Print page

2002-08-29 Thread @ Edwin


Hi,
I'm using PHP to generate some report for printing.
But when I print report from IE 5.0 browser, in the bottom of page
IE prints URL of page.
Can I remove it ?

Yes. Click on "File" - "Page settings..." then find "Footer" and you'll 
see something like this:

  ubd

Take away the "u", print again (or preview) and see what happens. Check 
help F1 for more info...

- E




Thanks,
Rosen



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





_
$B%&%#%k%9%a!<%k!"LBOG%a!<%kBP:v$J$i(B MSN Hotmail http://www.hotmail.com/JA


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


[PHP] Re: wish list for my host's new compile

2002-08-29 Thread Philip Hallstrom


On Thu, 29 Aug 2002, Justin French wrote:

 Hi all,

 My host is putting together a new linux box at the moment for hosting, and I
 want to make sure that they include a few things that I've needed, but
 weren't available on the current server.  I've got about 15 domains with
 them, so it's not particularly easy to change hosts.

 A few things I've wanted so far:
 - enable_trans_sid
 - mcrypt (encypting credit cards, etc)
 - GD library w/JPEG  PNG
 - PDFlib
 - XML

I'd try and get GD 2 instead of 1.8.x, freetype2 could be useful, ftp,
imap (for webmail), database support (mysql, postgres)...

-philip


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




[PHP] Re: Getting local domain name in CLI

2002-08-29 Thread Philip Hallstrom

What about...

$hostname = `/bin/hostname`;

or something along those lines...

On Thu, 29 Aug 2002, Geranium wrote:

 I need to get the domain name of the local machine.
 I'm running a CLI script in PHP 4.3-cvs (on OpenBSD) so I have no HTTP
 or other global vars to look at. The posix_uname command doesn't
 include the domain on non-GNU OSs. I can get the hostname, but not the
 domain. Can I get it through some other PHP command? I'd really prefer
 not to resort to rummaging in /etc and parsing files or doing something
 silly like a DNS lookup...

 Any ideas?

 --
 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] Building a query on multiple variables, how to test for which variable

2002-08-29 Thread @ Edwin
Does this fit your idea of a "more elegant solution"?

This is just an enhanced and tested version of the one I posted earlier 
(somehow I had time and was curious about it).

?php
  
if (isset($_POST['var'])){ // if POSTed

  // initial query
  // make sure "WHERE" not included when none is selected
  $qpon = "SELECT BillDate, StateInd, BAN, Type, PON, Phrase,";
  $qpon .= " PhraseLine1, USOC, Description, RateZone, Rate";
  $qpon .= " FROM tblUSOCChargesDetail";

  $its_set = 1; // my super "switch"

  foreach ($_POST['var'] as $key = $value){ // walk
if ($value != 0){ // make sure the "--- Select ---" is not included
  if ($its_set == 1){
$qpon .= " WHERE USOC = '" . $value . "'";
$its_set = 2; // just to make sure "WHERE" is only added once
  } else {
$qpon .= " AND USOC = '" . $value . "'";
  }
}
  } // end of foreach

}

  $qpon .= " ORDER BY BillDate";
  echo "$qpon"; // Check the generated query

?

And this is what I used for testing:

// html headers here

form action="testpulldown.php" method="post"
First option
select name="var[]"
  option value="0"--- Select ---/option
  option value="1a"1a/option
  option value="1b"1b/option
  option value="1c"1c/option
/select
br /
Second option
select name="var[]"
  option value="0"--- Select ---/option
  option value="2a"2a/option
  option value="2b"2b/option
  option value="2c"2c/option
/select
br /
Third option
select name="var[]"
  option value="0"--- Select ---/option
  option value="3a"3a/option
  option value="3b"3b/option
  option value="3c"3c/option
/select
br /
Fourth option
select name="var[]"
  option value="0"--- Select ---/option
  option value="4a"4a/option
  option value="4b"4b/option
  option value="4c"4c/option
/select
br /
input type="submit" name="submit" value="Submit" /
/form

// end of html

Put them in the same file and name the file "testpulldown.php". (Of course, 
you know...)

The "beauty", I thought is, the query would still work even though none of 
the "pull-downs" were selected--of course, I don't how much data will be 
shown...

NOTE: You can even have MORE pull-downs with this kind of approach. (...and 
less code...)

BTW, who is "Todd"? I didn't see his post... Just curious...

- E



Todd came in with a good suggestion which I had started towards, so this 
is
what I have arrived at for the moment. I will be looking to make this more
elegant soon, but since they are screaming for the report now this is what 
I
did;

?php
   if($usoc1  "--- Select ---"){
   $usoc[] = $usoc1;
   }
   if($usoc2  "--- Select ---"){
   $usoc[] = $usoc2;
   }
   if($usoc3  "--- Select ---"){
   $usoc[] = $usoc3;
   }
   if($usoc4  "--- Select ---"){
   $usoc[] = $usoc4;
   }
   $usoc_count = count($usoc);

   // query details
   $qpon = "SELECT BillDate, StateInd, BAN, Type, PON, Phrase, PhraseLine1,
USOC, Description, RateZone, Rate ";
   $qpon .= "FROM tblUSOCChargesDetail WHERE ";
   $first = 0;
   for($i = 0; $i  $usoc_count; $i++){
   if($first == 0){
   $qpon .= "USOC = '" . $usoc[$i] . "' ";
   $first = 1;
   } else {
   $qpon .= "AND USOC = '" . $usoc[$i] . "' ";
   }
   }
   $qpon .= "ORDER BY BillDate ";
   if(!($dbpon = mysql_query($qpon, $dbconnect))){
   print("MySQL reports: " . mysql_error() . "\n");
   exit();
   }
?

I am sure that there is a more elegant solution, if I find it I will let 
you
know.

Thanks!

Jay



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





_
$B$+$o$$$/$FL{2w$J%$%i%9%HK~:\(B MSN $B%-%c%i%/%?!<(B http://character.msn.co.jp/


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


[PHP] file creation question

2002-08-29 Thread John Hegele

I'm currently building a site for a band and one of the features I'd like to
offer is vCalendar files that the user can download.  I'd like to be able to
pull values from a database to use in the file, but, rather than having the
actual file on the server, I was hoping that I could create the file
dynamically when the user clicks on a link.  I think this is possible from
some information I've come across.

My question here is not regarding anything having to do with the database,
I'm very familiar with how to pull data from a database with PHP.  I just
can't figure out how I can generate a file, fill it with values from the
database and allow the user to download it without the file ever really
existing on the server.

Thanks in advance for any help you can give.

John



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




Re: [PHP] file creation question

2002-08-29 Thread Adam Williams

Search the archives, this was explained 2-3 days ago how to dynamically
generate a while without creating one on the server.

Adam

On Thu, 29 Aug 2002, John Hegele wrote:

 I'm currently building a site for a band and one of the features I'd like to
 offer is vCalendar files that the user can download.  I'd like to be able to
 pull values from a database to use in the file, but, rather than having the
 actual file on the server, I was hoping that I could create the file
 dynamically when the user clicks on a link.  I think this is possible from
 some information I've come across.

 My question here is not regarding anything having to do with the database,
 I'm very familiar with how to pull data from a database with PHP.  I just
 can't figure out how I can generate a file, fill it with values from the
 database and allow the user to download it without the file ever really
 existing on the server.

 Thanks in advance for any help you can give.

 John






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




[PHP] Re: Getting local domain name in CLI

2002-08-29 Thread Geranium

In article [EMAIL PROTECTED],
Philip Hallstrom [EMAIL PROTECTED] wrote:

 What about...
 
 $hostname = `/bin/hostname`;
 
 or something along those lines...

Well that's rather the kind of thing I was wanting to avoid - it's much
akin to rummaging in /etc.

the hostname command gives me my hostname ONLY (like www), much as
the posix_uname function does, but on my system (OpenBSD 3.1) the
corresponding domainname utility returns nothing (as I'm not using YP),
so I still can't seem to find this out from PHP. This seems very silly!

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




[PHP] Set Variable to Multiple Lines

2002-08-29 Thread Mike richardson


I've been searching for this old php feature (perhaps it was
deprecated), and can't get the right keywords to look it up.

There was a way, similar to the perl method shown below, to set multiple
lines of data equal to a variable.

(in perl)
$variable = __SOME_HEADER_HERE__

Put whatever is desired here, including $variables.

Just end it with this:

__SOME_HEADER_HERE__;


Anyone know what this is for PHP?

Best wishes

Michael Richardson
Web Developer
(520) 529-2000
[EMAIL PROTECTED]


//   http://www.mdausa.org   //


..very few phenomena can pull someone out 
of Deep Hack Mode, with two noted exceptions: 
being struck by lightning, or worse, your *computer*
being struck by lightning.
-- Matt Welsh




[PHP] Reading header information

2002-08-29 Thread jimmy

What I'd like to do is get some of the information found when you do a 
telent on port 80 like this below..

telnet www.hostname.com 80
Trying www.hostname.com...
Connected to.www.hostname.com
Escape character is '^]'.
HEAD / HTTP/1.0

HTTP/1.1 200 OK
Date: Thu, 29 Aug 2002 17:00:09 GMT
Server: Apache/1.3.26 (Darwin) PHP/4.2.2
Connection: close
Content-Type: text/html

Really what I'm trying to find is the server message (404, 200, etc.) on 
a remote server from this line... 

HTTP/1.1 200 OK

Is there anyway to access this through php?

thanks,
jimmy

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




[PHP] Odd URL problem

2002-08-29 Thread Steve Lane

Hello all:

I'm seeing an odd problem after I moved a large PHP application from one
server to another.

Part of the system sends an email to users, containing a clickable http://
link. The link includes a parameter called goto, which bundles up a set of
name-value pairs, which indicate the user's final destination. If the user
isn't logged in yet, the application holds onto the goto parameter, and once
the login is complete, forwards the user on to the specified location.

When we send the url, it is encoded, and looks like this:

http://foo.bar.org/goto.php?goto=area%3Dpersonnel%26sub%3Dpersonnel%26person
nel%3D1002566%26option%3Dedit

Once I moved the application, from a PowerMac G4 running LinuxPPC, Apache
1.3.20 and PHP 4.0.5, to a Dell PowerEdge running RedHat 7.3, Apache 1.3.26
and PHP 4.0.6, these URLs seem to not get translated any more. On our
development server, Dell server running RedHat 7.1, Apache 1.3.23, PHP
4.1.1, they seem to work fine.

When it works, I click an encoded link in my mailer, and my browser tries to
access the URL with a correct, decoded query string. When it fails, I get a
message from the browser (IE 5+ only for this app) that says Attempt to
access 
http://foo.bar.org/goto.php?goto=area%3Dpersonnel%26sub%3Dpersonnel%26person
nel%3D1002566%26option%3Dedit failed.

So it seems that the browser in the failing case is trying to deal with the
URL in its encoded form.

Anyone have any ideas about what I'm missing?

-- Steve


===
Steve Lane

Vice President
The Moyer Group
833 West Chicago Ave Suite 203

Voice: (312) 433-2421   Email: [EMAIL PROTECTED]
Fax:   (312) 850-3930   Web:   http://www.moyergroup.com
===


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




RE: [PHP] Odd URL problem

2002-08-29 Thread Jay Blanchard

[snip]
So it seems that the browser in the failing case is trying to deal with the
URL in its encoded form.

Anyone have any ideas about what I'm missing?
[/snip]

A quick thought, run ?php php_info(); ? and see what register_globals is
set to in the php.ini

HTH!

Jay



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




Re: [PHP] Set Variable to Multiple Lines

2002-08-29 Thread Michael Sweeney

What you're looking for seems to be called the 'here document' syntax.
I've always seen it used with print and there's a reference to it in the
print function (okay, construct) PHP documentation, but a quick test
shows that you can also use it to assign to variables. As follows:

$var = END
Several lines
of text would
go here.
END;

Perl only uses two brackets (IIRC) for the same functionality.

..michael..

On Thu, 2002-08-29 at 10:42, Mike richardson wrote:
 
 I've been searching for this old php feature (perhaps it was
 deprecated), and can't get the right keywords to look it up.
 
 There was a way, similar to the perl method shown below, to set multiple
 lines of data equal to a variable.
 
 (in perl)
 $variable = __SOME_HEADER_HERE__
 
 Put whatever is desired here, including $variables.
 
 Just end it with this:
 
 __SOME_HEADER_HERE__;
 
 
 Anyone know what this is for PHP?
 
 Best wishes
 
 Michael Richardson
 Web Developer
 (520) 529-2000
 [EMAIL PROTECTED]
 
 
 //   http://www.mdausa.org   //
 
 
 ..very few phenomena can pull someone out 
 of Deep Hack Mode, with two noted exceptions: 
 being struck by lightning, or worse, your *computer*
 being struck by lightning.
 -- Matt Welsh
 



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




[PHP] CURL without --with-curl

2002-08-29 Thread Henry

How can I use CURL if I cannot recompile PHP with --with-curl.

I am using PHP4.2.2 on a shared server with an ISP so I do not get the
ability to recompile.


Hope someone can make a suggestion.

I want to be able to do GET and POST requests of pages easily to Google.

TIA

Henry



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




RE: [PHP] CURL without --with-curl

2002-08-29 Thread Jay Blanchard

[snip]
How can I use CURL if I cannot recompile PHP with --with-curl.

I am using PHP4.2.2 on a shared server with an ISP so I do not get the
ability to recompile.

[/snip]

Use cURL from the command line with an exec() in your PHP script.

HTH!

Jay

*
* Texas PHP Developers Conf  Spring 2003*
* T Bar M Resort  Conference Center*
* New Braunfels, Texas  *
* Contact [EMAIL PROTECTED]   *
*   *
* Want to present a paper or workshop? Contact now! *
*


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




[PHP] FW: php question

2002-08-29 Thread Andrew Fry

hi, sorry to trouble you, but i am a beginner php programmer and i have a
quick question.  i got your email from a php newsgroup.

i'm using a statement like:

if ( preg_match(/\\$word/i,$keywordHash[$keyID][0]  0)
{
...
}

which works fine if word is a word like reference or even p4dp8, but
when the word is 4xAGP i get this message:

Warning: back reference: to non-existant pattern at offset 6

or $word=4x: 
Warning: back reference: to non-existant pattern at offset 3


do you have any idea what would cause this?  
any help you can provide would be very appreciated.

thanks,
Andrew


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




Re: [PHP] Print page

2002-08-29 Thread Rosen

Thanks very much 
Rosen

Jay Blanchard [EMAIL PROTECTED] wrote in message
003601c24f79$7ed376a0$8102a8c0@000347D72515">news:003601c24f79$7ed376a0$8102a8c0@000347D72515...
 [snip]
 I'm using PHP to generate some report for printing.
 But when I print report from IE 5.0 browser, in the bottom of page
 IE prints URL of page.
 Can I remove it ?
 [/snip]

 Only in individual browser settings (like IE, File-Page Setup-Clear the
 Header and Footer boxes). There is no way to control this with PHP. Each
 browser is different on how this is handled.

 HTH!

 Jay

 ***
 * Central Texas PHP Developers Group  *
 * San Antonio, Austin, San Marcos, New Braunfels, *
 * Seguin, Boerne, Blanco, the Hill Country*
 * Interested? *
 * Contact [EMAIL PROTECTED] *
 ***





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




Re: [PHP] Print page

2002-08-29 Thread Rosen

Thanks very much 
Rosen


Robert Collins [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 yes, but that is a browser function not php
 goto file - page setup - then remove the header and footer data

 Robert W. Collins II
 Webmaster
 New Orleans Regional Transit Authority
 Phone : (504) 248-3826
 Fax: (504) 248-3866
 Email : [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]



 -Original Message-
 From: Rosen [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 29, 2002 11:29 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Print page


 Hi,
 I'm using PHP to generate some report for printing.
 But when I print report from IE 5.0 browser, in the bottom of page
 IE prints URL of page.
 Can I remove it ?


 Thanks,
 Rosen



 --
 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] Problems with PHP and Apache..

2002-08-29 Thread kawaii

Ok, I tried some different ways of compiling, but it still doesn't seem to
find the following:

symbol not found: top_module
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_user_name
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_max_requests_per_child
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_server_root
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_user_id
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_group_id
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_block_alarms
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_unblock_alarms
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_rwrite
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_rflush
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_signal
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_hard_timeout
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_get_client_block
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_reset_timeout
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_table_get
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_pstrdup
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_table_add
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_table_set
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_send_http_header
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_log_error
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_block_alarms
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_register_cleanup
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_unblock_alarms
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_getword
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_uudecode
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_getword_nulls_nc
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_setup_client_block
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_add_common_vars
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_add_cgi_vars
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_kill_timeout
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_update_mtime
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_set_last_modified
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_set_etag
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_add_version_component
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_child_terminate
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_sub_req_lookup_uri
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_destroy_sub_req
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_run_sub_req
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_pstrndup
(/usr/apache/libexec/libphp4.so)
symbol not found: ap_table_setn
(/usr/apache/libexec/libphp4.so)
symbol not found: __cmpdi2
(/usr/apache/libexec/libphp4.so)
symbol not found: __floatdidf
(/usr/apache/libexec/libphp4.so)

So, it looks like it may just be a problem with my libphp4.so, and I'm not
familiar enough to find the files that hold those libraries that the PHP
compile doesn't seem to work.

So, my question is twofold:

1) Anyone know where those libraries are? Or know the appropriate libtool
compile command to try to compile it with the right -R/path/to/lib for Sol
9?

2) Anyone have a compiled libphp4.so for php4.2.2, with mysql and apache
1.3.26 on Solaris 9? (or 8? It should be compatible either way...)

Thanks!

Ever lovable and always scrappy,
kawaii

Raise the Dour Roger! - Rob
- Original Message -
From: kawaii ryuko [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, August 28, 2002 08:11
Subject: [PHP] Problems with PHP and Apache..


 Hi!

 I have been struggling with getting PHP 4.2.2 to load with Apache 1.3.26
for
 a few days now, and after searching through the archives to find that
others
 have had this problem (yet I couldn't find any replies in the archives), I
 thought I might ask myself. :) I'm hoping for better luck.

 I have Apache 1.3.26, running on Solaris 9. I compiled and installed PHP
 with no problems.

 When I start Apache, it gives the following error:

 Syntax error on line 249 of /etc/apache/httpd.conf:
 Cannot load /usr/apache/libexec/libphp4.so into server: ld.so.1:
 /usr/apache/bin/httpd: fatal: relocation error: file
 /usr/apache/libexec/libphp4.so: symbol __cmpdi2: referenced symbol not
found

 Help?

 I've attached some additional information at the end of the email. If
anyone
 needs anymore information, please let me know. Thanks!

 Ever lovable and always scrappy,
 kawaii

 Raise the Dour Roger! - Rob

 [/home/kawaii] (8:31)ldd -r /usr/apache/libexec/libphp4.so
 libdl.so.1 =

[PHP] variable reference parameters

2002-08-29 Thread Timo Ewalds

I've created (with help from some code from the site) a function to make
strings or arrays mysql safe. It works just fine, assuming you pass your
variables by reference ( sqlSafe($var) ), but I get this error every time
it is used:

[error] PHP Warning:  Call-time pass-by-reference has been deprecated -
argument passed by value;  If you would like to pass it by reference, modify
the declaration of [runtime function name]().  If you would like to enable
call-time pass-by-reference, you can set allow_call_time_pass_reference to
true in your INI file.  However, future versions may not support this any
longer.  in file.php on line X

I want the function to be able to accept as many variables as needed to make
them sqlsafe (10 is enough for now), and to remove that annoying error, I'd
also like to not need to pass them by reference. Is this possible?? and if
so, how?? I know it is possible to add the  before each function parameter,
but then I can't pass more or less variables than I put in the function
definition, cause you can't have default values for a reference parameter
(go figure), and it'll also complain if you give it too few variables.

function sqlSafe( $a0,
 $a1=NULL,
 $a2=NULL,
 $a3=NULL,
 $a4=NULL,
 $a5=NULL,
 $a6=NULL,
 $a7=NULL,
 $a8=NULL,
 $a9=NULL){
 if(func_num_args()10)
  echo h1Too Many Args in sqlSafe/h1;
 for($i=0;$ifunc_num_args();$i++){
  $name=a . $i;
  if(!isset($$name)) continue;
  if(is_array($$name)){
   foreach($$name as $n = $v){
if(is_array($v))
 sqlSafe(${$name}[$n]);
elseif(isset($v))
 ${$name}[$n] = mysql_escape_string ($v);
   }
  }else
   $$name = mysql_escape_string ($$name);
 }
}



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




[PHP] count errors

2002-08-29 Thread WANDA HANSEN

I have a function that resets the count of fields with certain values when
called. 99.9 percent of the time it works fine. However occaisionally it
wont update the database. Even after breaking the selects up it still fails
sometimes. If anyone has an idea of why I would really appreciate hearing
it. The code is below.

Thanks,
Julian

?
//the selects had to be broken up to get it to work consistently
function resetCounter()
{
include(../config.php);

$query = select categories from categories;
$result = mysql_db_query($db, $query);
while($r = mysql_fetch_array($result))
{

$cats = $r[categories];
   // $active = $r[active];
   // echo$catsBR;

$query1 = select count(*) from recipes where category1 = '$cats' and
active = 'yes';
   //  echo mysql_errno().: .mysql_error().  1BR; // uncomment to
troubleshoot db problems
$result2 = mysql_db_query($db, $query1);
$rows1 = mysql_fetch_row($result2);
$query2 = select count(*) from recipes where category2 = '$cats' and
active = 'yes';
   // echo mysql_errno().: .mysql_error().  1BR; // uncomment to
troubleshoot db problems
$result3 = mysql_db_query($db, $query2);
//echo mysql_errno().: .mysql_error().  2BR; // uncomment to
troubleshoot db problems
$rows2 = mysql_fetch_row($result3);
$query3 = select count(*) from recipes where category3 = '$cats' and
active = 'yes';
   // echo mysql_errno().: .mysql_error().  1BR; // uncomment to
troubleshoot db problems
$result4 = mysql_db_query($db, $query3);
   // echo mysql_errno().: .mysql_error().  2BR; // uncomment to
troubleshoot db problems
$rows3 = mysql_fetch_row($result4);

  // echo mysql_errno().: .mysql_error().  3BR; // uncomment to
troubleshoot db problems
   $therows = $rows1[0] + $rows2[0] + $rows3[0];
   $query4 = UPDATE categories SET count = '$therows' where(categories =
'$cats');
   $result5 = mysql_db_query($db, $query4);
  // echo$therows --tr $rows1[0] --r1 $rows2[0] --r2 $rows3[0] --r3
$cats -- catsbr;

}
}

?






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




[PHP] GD Graphics Library

2002-08-29 Thread René Fournier

There are several functions in the GD library that I really, really 
want to be able to use on several sites that I develop/manage. 
Unfortunately, the ISP I use, FatCow, doesn't have GD, nor seems 
interested in adding it.

Can anyone recommend a good, cheap ISP (like FatCow) that DOES have GD 
for PHP4? (Or better yet, do you have any suggestions as to how I might 
persuade FatCow to add it??

...Rene

---
René Fournier,
[EMAIL PROTECTED]

Toll-free +1.888.886.2754
Tel +1.403.291.3601
Fax +1.403.250.5228
www.smartslitters.com

SmartSlitters International
#33, 1339 - 40th Ave NE
Calgary AB  T2E 8N6
Canada


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




Re: [PHP] variable reference parameters

2002-08-29 Thread DL Neil

Timo,

If you use func_num_args() to ascertain the number of arguments passed to
the function and func_get_arg() to retrieve each argument in turn (from a
list of unstated length), will that do the trick?

Regards,
=dn



 I've created (with help from some code from the site) a function to make
 strings or arrays mysql safe. It works just fine, assuming you pass your
 variables by reference ( sqlSafe($var) ), but I get this error every time
 it is used:

 [error] PHP Warning:  Call-time pass-by-reference has been deprecated -
 argument passed by value;  If you would like to pass it by reference,
modify
 the declaration of [runtime function name]().  If you would like to enable
 call-time pass-by-reference, you can set allow_call_time_pass_reference to
 true in your INI file.  However, future versions may not support this any
 longer.  in file.php on line X

 I want the function to be able to accept as many variables as needed to
make
 them sqlsafe (10 is enough for now), and to remove that annoying error,
I'd
 also like to not need to pass them by reference. Is this possible?? and if
 so, how?? I know it is possible to add the  before each function
parameter,
 but then I can't pass more or less variables than I put in the function
 definition, cause you can't have default values for a reference parameter
 (go figure), and it'll also complain if you give it too few variables.

 function sqlSafe( $a0,
  $a1=NULL,
  $a2=NULL,
  $a3=NULL,
  $a4=NULL,
  $a5=NULL,
  $a6=NULL,
  $a7=NULL,
  $a8=NULL,
  $a9=NULL){
  if(func_num_args()10)
   echo h1Too Many Args in sqlSafe/h1;
  for($i=0;$ifunc_num_args();$i++){
   $name=a . $i;
   if(!isset($$name)) continue;
   if(is_array($$name)){
foreach($$name as $n = $v){
 if(is_array($v))
  sqlSafe(${$name}[$n]);
 elseif(isset($v))
  ${$name}[$n] = mysql_escape_string ($v);
}
   }else
$$name = mysql_escape_string ($$name);
  }
 }



 --
 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] PASSWORD()

2002-08-29 Thread Victor

Is PASSWORD() still usable? I used it in my scripts a while ago to
encrypt and decript password strings that I stored into databases, but
from some time all my scripts don't work (the login part) because I
cannot do a mysql query like so: 

$sql = SELECT * FROM users WHERE username = '$PHP_AUTH_USER' AND
password = PASSWORD('$PHP_AUTH_PW');

or:

$sql = SELECT * FROM users WHERE username = '$username AND password =
PASSWORD('$password');

is this wrong?

Or am I just hallucinating? 

- vic

__ 
Post your free ad now! http://personals.yahoo.ca

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




[PHP] Output php code

2002-08-29 Thread apollo

Is there any function in php to show source code like this:
http://www.php.net/source.php?url=/index.php

How do they do this ? I mean all these colors.



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




[PHP] Re: Output php code

2002-08-29 Thread Philip Hallstrom

http://www.php.net/manual/en/function.show-source.php



On Thu, 29 Aug 2002, apollo wrote:

 Is there any function in php to show source code like this:
 http://www.php.net/source.php?url=/index.php

 How do they do this ? I mean all these colors.



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



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




[PHP] Re: Output php code

2002-08-29 Thread apollo

 http://www.php.net/manual/en/function.show-source.php

thanks, i'm so lazy :-)



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




[PHP] Re: file creation question

2002-08-29 Thread MikeTsapenko

Hello, John.

Just use such code:

  header(Content-type: application/octet-stream);
  header(Content-Disposition: attachment; filename=\$item[file_name]\);
  header(Content-length: .strlen($item[file_content]));
  echo $item[file_content]

This should work...

--

Mike Tsapenko
Chief of Web-development Dept.
AlarIT
http://www.AlarIT.com


John Hegele [EMAIL PROTECTED] ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ
ÓÌÅÄÕÀÝÅÅ: [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I'm currently building a site for a band and one of the features I'd like
to
 offer is vCalendar files that the user can download.  I'd like to be able
to
 pull values from a database to use in the file, but, rather than having
the
 actual file on the server, I was hoping that I could create the file
 dynamically when the user clicks on a link.  I think this is possible from
 some information I've come across.

 My question here is not regarding anything having to do with the database,
 I'm very familiar with how to pull data from a database with PHP.  I just
 can't figure out how I can generate a file, fill it with values from the
 database and allow the user to download it without the file ever really
 existing on the server.

 Thanks in advance for any help you can give.

 John





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




[PHP] How to handle multiple value checkboxes

2002-08-29 Thread Lon Lentz



  If I have a form with multiple checkboxes with different values but the
same name, and someone selects a couple of them, how do I reference all of
the values? Right now I am only getting the last one selected.



__
Lon Lentz
Applications Developer
EXImpact.com



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




[PHP] Session 4.2.2

2002-08-29 Thread Breno Cardoso Perucchi

I would like to know if there are any changes on session of PHP between the
version 4.1.0 and 4.2.2?

Thanks.

Breno Cardoso Perucchi
[EMAIL PROTECTED]
Consultor - Omega Tecnologia
http://www.omegatec.net/




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




[PHP] Re: How to handle multiple value checkboxes

2002-08-29 Thread Matthias Stürmer

hi lon

thats because for the same variable can be submitted only one value. make an
array (like variable[]) out of your variable and then parse it with
foreach() for working with the values selected by the user.

hope you understand what i'd like to say. my english is not too good.

bye,
matt



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




Re: [PHP] How to handle multiple value checkboxes

2002-08-29 Thread Kevin Stone

form method=post action=formhandler.php
input type=checkbox name=colors[] value=red
input type=checkbox name=colors[] value=green
input type=checkbox name=colors[] value=blue
/form

This creates the indexed array $_POST['colors'].  The array will only have
as many values as were checked.  In otherwords if Red and Blue are checked
the values will be reutnred at $_POST['colors'][0] and $_POST['colors'][1]..
not at index [0] and [2] as you might expect.

Hope this helps,
Kevin

- Original Message -
From: Lon Lentz [EMAIL PROTECTED]
To: Php-General@Lists. Php. Net [EMAIL PROTECTED]
Sent: Thursday, August 29, 2002 3:07 PM
Subject: [PHP] How to handle multiple value checkboxes




   If I have a form with multiple checkboxes with different values but the
 same name, and someone selects a couple of them, how do I reference all of
 the values? Right now I am only getting the last one selected.



 __
 Lon Lentz
 Applications Developer
 EXImpact.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] Reading from a file using fgets()

2002-08-29 Thread David Christensen

When PHP reads from a file using fgets(), does it do it in order? 
Meaning, when reading STDIN from a file, does it read line1, then line2,
line3, and so on until EOF?

My purpose is to read each line of file and push it into an array.

Thanks for your help,

Dave





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




[PHP] Re: Session 4.2.2

2002-08-29 Thread Dallas Thunder

If you encounter any problem with session variables, it may not caused by
session.  An important change between 4.2.0 or above and versions below is
that the 'register_globals' directive will be set Off by default in
'php.ini' file.  So you can't access session variables (e.g. $var) directly,
instead of $_SESSION[var].  Also for HTTP get, post, cookie variables.
Hope it helps.

Breno Cardoso Perucchi [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I would like to know if there are any changes on session of PHP between
the
 version 4.1.0 and 4.2.2?

 Thanks.

 Breno Cardoso Perucchi
 [EMAIL PROTECTED]
 Consultor - Omega Tecnologia
 http://www.omegatec.net/






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




RE: [PHP] How to handle multiple value checkboxes

2002-08-29 Thread Short, Chad

Use the [] along with the type of input you are using. 

Example:
Select NAME=THING[] MULTIPLE

This will send php an array of $thing with whatever is selected.

Hope this helps.

Chad.

-Original Message-
From: Lon Lentz [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, August 29, 2002 4:07 PM
To: Php-General@Lists. Php. Net
Subject: [PHP] How to handle multiple value checkboxes




  If I have a form with multiple checkboxes with different values but the
same name, and someone selects a couple of them, how do I reference all of
the values? Right now I am only getting the last one selected.



__
Lon Lentz
Applications Developer
EXImpact.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] How to handle multiple value checkboxes

2002-08-29 Thread Lon Lentz


  That did the trick. Thanks!

-Original Message-
From: Short, Chad [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 29, 2002 5:38 PM
To: Php-General@Lists. Php. Net
Subject: RE: [PHP] How to handle multiple value checkboxes


Use the [] along with the type of input you are using. 

Example:
Select NAME=THING[] MULTIPLE

This will send php an array of $thing with whatever is selected.

Hope this helps.

Chad.

-Original Message-
From: Lon Lentz [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, August 29, 2002 4:07 PM
To: Php-General@Lists. Php. Net
Subject: [PHP] How to handle multiple value checkboxes




  If I have a form with multiple checkboxes with different values but the
same name, and someone selects a couple of them, how do I reference all of
the values? Right now I am only getting the last one selected.





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




Fw: [PHP] variable reference parameters

2002-08-29 Thread Kevin Stone

Timo,

 This is just an idea.  How about using the get_defined_vars() function,
 extracting the desired user defined variables, storing them in one array,
 and then sending that array as the single parameter to your sqlSafe()
 function?

 http://www.php.net/manual/en/function.get-defined-vars.php

 Good luck,
 Kevin


 - Original Message -
 From: Timo Ewalds [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, August 27, 2002 11:21 PM
 Subject: [PHP] variable reference parameters


  I've created (with help from some code from the site) a function to make
  strings or arrays mysql safe. It works just fine, assuming you pass your
  variables by reference ( sqlSafe($var) ), but I get this error every
time
  it is used:
 
  [error] PHP Warning:  Call-time pass-by-reference has been deprecated -
  argument passed by value;  If you would like to pass it by reference,
 modify
  the declaration of [runtime function name]().  If you would like to
enable
  call-time pass-by-reference, you can set allow_call_time_pass_reference
to
  true in your INI file.  However, future versions may not support this
any
  longer.  in file.php on line X
 
  I want the function to be able to accept as many variables as needed to
 make
  them sqlsafe (10 is enough for now), and to remove that annoying error,
 I'd
  also like to not need to pass them by reference. Is this possible?? and
if
  so, how?? I know it is possible to add the  before each function
 parameter,
  but then I can't pass more or less variables than I put in the function
  definition, cause you can't have default values for a reference
parameter
  (go figure), and it'll also complain if you give it too few variables.
 
  function sqlSafe( $a0,
   $a1=NULL,
   $a2=NULL,
   $a3=NULL,
   $a4=NULL,
   $a5=NULL,
   $a6=NULL,
   $a7=NULL,
   $a8=NULL,
   $a9=NULL){
   if(func_num_args()10)
echo h1Too Many Args in sqlSafe/h1;
   for($i=0;$ifunc_num_args();$i++){
$name=a . $i;
if(!isset($$name)) continue;
if(is_array($$name)){
 foreach($$name as $n = $v){
  if(is_array($v))
   sqlSafe(${$name}[$n]);
  elseif(isset($v))
   ${$name}[$n] = mysql_escape_string ($v);
 }
}else
 $$name = mysql_escape_string ($$name);
   }
  }
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 



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




[PHP] Re: Session 4.2.2

2002-08-29 Thread Breno Cardoso Perucchi

Hi,
Do you have an example?

Thanks.

Breno Cardoso Perucchi [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I would like to know if there are any changes on session of PHP between
the
 version 4.1.0 and 4.2.2?

 Thanks.

 Breno Cardoso Perucchi
 [EMAIL PROTECTED]
 Consultor - Omega Tecnologia
 http://www.omegatec.net/






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




[PHP] Re: Reading from a file using fgets()

2002-08-29 Thread Dallas Thunder

Well, this is exactly what function file() does.

David Christensen [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 When PHP reads from a file using fgets(), does it do it in order?
 Meaning, when reading STDIN from a file, does it read line1, then line2,
 line3, and so on until EOF?

 My purpose is to read each line of file and push it into an array.

 Thanks for your help,

 Dave







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




[PHP] Re: PASSWORD()

2002-08-29 Thread Mike Tsapenko

Hello, Victor.

Your queries seem to be OK. The second one has typo: after should be single
quot.
Anyway this is a problem with MySQL but not with PHP.

--

Mike Tsapenko
Chief of Web-development Dept.
AlarIT
http://www.AlarIT.com


Victor [EMAIL PROTECTED] ???/ ?  ?:
000101c24f92$e7e80fc0$a3a96518@jumpy">news:000101c24f92$e7e80fc0$a3a96518@jumpy...
 Is PASSWORD() still usable? I used it in my scripts a while ago to
 encrypt and decript password strings that I stored into databases, but
 from some time all my scripts don't work (the login part) because I
 cannot do a mysql query like so:

 $sql = SELECT * FROM users WHERE username = '$PHP_AUTH_USER' AND
 password = PASSWORD('$PHP_AUTH_PW');

 or:

 $sql = SELECT * FROM users WHERE username = '$username AND password =
 PASSWORD('$password');

 is this wrong?

 Or am I just hallucinating?

 - vic

 __
 Post your free ad now! http://personals.yahoo.ca



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




[PHP] credit card auth using curl function

2002-08-29 Thread phplist

Hi, I am using the CURL command to post credit card info to a gateway .exe
program on a secure server. The code below works fine to produce the comma
delimitted credit card authorization information to the browser page
(for example: declined,Invalid form data
posted,8/29/2002,18:07,0,0 ), but I need to capture the
credit card gateway authorization string so that I can take action within my
PHP code, versus the user receiving the auth code returned on the browser
page.

Here is the code I am using:
htmlbody

?php
//
// A very simple PHP example that sends a HTTP POST to a remote site
//

$ch = curl_init();

curl_setopt($ch,
CURLOPT_URL,http://secure.ibill.com/cgi-win/ccard/tpcard15.exe;);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
reqtype=authorizeaccount=107036password=amount=12);

curl_exec ($ch);
curl_close ($ch);
?

/body/html

It produces:
declined,Invalid form data
posted,8/29/2002,18:07,0,0  at the browser... It is a
valid decline on the credit card, which I am no concerned with, but I don't
have this return to the user, want to parse the string and produce my own
php output based on accepted or declined status.

Any ideas?

Stan


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




RE: [PHP] How to handle multiple value checkboxes

2002-08-29 Thread Lon Lentz


  Yes it does. It's unfortunate that PHP treats it this way. It makes using
dynamic checkbox inputs a lot more difficult than it should be. ColdFusion
and, I believe, ASP make a comma delimited list. But I did find a little
snippet which allows me to cheat the need for a key in the input tag. If
just add [] to the name, I can use this to create my delimited list.

foreach($whynot as $key = $value)
{$whynotlist .= $value.,;}



-Original Message-
From: listman@evol [mailto:listman@evol]On Behalf Of Keith Vance
Sent: Thursday, August 29, 2002 6:01 PM
To: Lon Lentz
Cc: Php-General@Lists. Php. Net
Subject: Re: [PHP] How to handle multiple value checkboxes


You have to name them different.
input type=checkbox name=frisbee value=toss
and
input type=checkbox name=frisbee value=dropped
There will be now way to tell if the user checked both. You could
do this:
input type=checkbox name=frisbee[toss] value=Y
input type=checkbox name=frisbee[dropped] value=Y
This will allow you to group everything in a hash so you could get the
values like this: $_POST['frisbee']['toss'] or
$_POST['frisbee']['dropped']

That makes sense, right?






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




[PHP] Re: Session 4.2.2

2002-08-29 Thread Dallas Thunder

Just edit your 'php.ini' file, if 'register_globals = Off', then set it to
On.  It will solve a lot of problems if you are learning PHP from examples.

Breno Cardoso Perucchi [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,
 Do you have an example?

 Thanks.

 Breno Cardoso Perucchi [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  I would like to know if there are any changes on session of PHP between
 the
  version 4.1.0 and 4.2.2?
 
  Thanks.
 
  Breno Cardoso Perucchi
  [EMAIL PROTECTED]
  Consultor - Omega Tecnologia
  http://www.omegatec.net/
 
 
 





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




[PHP] eregi_replace() problems

2002-08-29 Thread Tony Harrison

Can anyone tell me why my emoticons arent appearing? Please?

Note: $message is a variable set by a web form. The field `pattern` is the
string to search for, like :-), and `url` is the relative url to the
emoticon. I just get the plain emoticon. Note: this bit is above the INSERT
statement in the script.
?php

$emotes = mysql_query(SELECT `pattern`,`url` FROM `emoticons`);
for ($t = 0; $t  mysql_num_rows($emotes); $t ++) {
$emotes_array = mysql_fetch_row($emotes);
eregi_replace($emotes_array[0], img src=\emoticons/$emotes_array[1]\
alt=\$emotes_array[0]\, $message);
}

?

-
[EMAIL PROTECTED]
http://www.cool-palace.com



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




[PHP] Re: PASSWORD()

2002-08-29 Thread Tony Harrison

I asked a similar question the other day, I was told to use the password
function on the field name, not the value, i havent tested this and its a
weird way to do things, and why cant both work? (if any)

Mike Tsapenko [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hello, Victor.

 Your queries seem to be OK. The second one has typo: after should be
single
 quot.
 Anyway this is a problem with MySQL but not with PHP.

 --
 
 Mike Tsapenko
 Chief of Web-development Dept.
 AlarIT
 http://www.AlarIT.com


 Victor [EMAIL PROTECTED] ???/ ?  ?:
 000101c24f92$e7e80fc0$a3a96518@jumpy">news:000101c24f92$e7e80fc0$a3a96518@jumpy...
  Is PASSWORD() still usable? I used it in my scripts a while ago to
  encrypt and decript password strings that I stored into databases, but
  from some time all my scripts don't work (the login part) because I
  cannot do a mysql query like so:
 
  $sql = SELECT * FROM users WHERE username = '$PHP_AUTH_USER' AND
  password = PASSWORD('$PHP_AUTH_PW');
 
  or:
 
  $sql = SELECT * FROM users WHERE username = '$username AND password =
  PASSWORD('$password');
 
  is this wrong?
 
  Or am I just hallucinating?
 
  - vic
 
  __
  Post your free ad now! http://personals.yahoo.ca





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




[PHP] Re: credit card auth using curl function

2002-08-29 Thread Mike Mannakee

Absolutely.  Your best bet, leaving the most visible way of tracing the
steps on any authorization, would be to save the returned string to a file.
Open the file and pass the handle to CURL_SETOPT like

curl_setopt($ch, CURLOPT_FILE, $return_data_fp);

Then have your script parse the data and output to the user appropriately.

Alternately, you can set RETURNTRANSFER and put the string in a variable,
like

curl_setopt($ch, RETURNTRANSFER, 1);
$return_data = curl_exec($ch);

but then the variable is transient and you have no record of the
transaction.  By using the first option you can retrace the steps of any
transaction if you ever need to.

HTH, Mike


Phplist [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi, I am using the CURL command to post credit card info to a gateway .exe
 program on a secure server. The code below works fine to produce the comma
 delimitted credit card authorization information to the browser page
 (for example: declined,Invalid form data
 posted,8/29/2002,18:07,0,0 ), but I need to capture
the
 credit card gateway authorization string so that I can take action within
my
 PHP code, versus the user receiving the auth code returned on the browser
 page.

 Here is the code I am using:
 htmlbody

 ?php
 //
 // A very simple PHP example that sends a HTTP POST to a remote site
 //

 $ch = curl_init();

 curl_setopt($ch,
 CURLOPT_URL,http://secure.ibill.com/cgi-win/ccard/tpcard15.exe;);
 curl_setopt($ch, CURLOPT_POST, 1);
 curl_setopt($ch, CURLOPT_POSTFIELDS,
 reqtype=authorizeaccount=107036password=amount=12);

 curl_exec ($ch);
 curl_close ($ch);
 ?

 /body/html

 It produces:
 declined,Invalid form data
 posted,8/29/2002,18:07,0,0  at the browser... It is a
 valid decline on the credit card, which I am no concerned with, but I
don't
 have this return to the user, want to parse the string and produce my own
 php output based on accepted or declined status.

 Any ideas?

 Stan




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




  1   2   >