Re: [PHP] Scripts not running on OS X 10.3

2003-11-02 Thread Kim Kohen
G'day Ken

 I tried your suggestion but the system won't let me modify it even with
 su permissions. I'm too tired and frustrated to continue tonight.
 Clearly, the installer must have messed something important up so I'm
 just going to reinstall Panther tomorrow (have to partition my drive
 anyway so what the heck)

If you're re-installing anyway, give the Complete MySQL, Complete Apache and
Complete PHP installers from serverlogistics.com a try. I have never had a
problem with them and they come with a couple of nice preference panes for
controlling things - including httpd.cong and log files.

I used to use the Entropy builds but am sold on the serverlogistics ones
now.

cheers

kim

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



Re: [PHP] mail() another example - error

2003-11-02 Thread Boyan Nedkov
This time your script is ok, the connection to the SMTP server is 
established, but because the host name of the machine that executes your 
php script is not a valid host name in the SMTP server's local network, 
the server refuses to accept your request for security reasons (smtp 
relaying blocked for external hosts).

To avoid this you have (at least) 2 options:

- to use the SMTP server of your provider, i.e. SMTP server for which 
you are a valid local network host. Keep in mind that the SMTP server 
does not care about the host name you provide in your code ('$senderFrom 
= [EMAIL PROTECTED];'), but just takes the real host name of machine 
executing the script.

- to find and use an open relay SMTP server, that smells very much to a 
spamming activity, so I strongly suggest you to don't do that.

Boyan
--


[EMAIL PROTECTED] wrote:
I use this script:

?

/**
in php.ini - localhost
[mail function]

SMTP = mail.serbis.com; only win32
sendmail_from = [EMAIL PROTECTED];
*/
$msg = this is a test;
$senderFrom = [EMAIL PROTECTED];
$receiverTo = [EMAIL PROTECTED];
$subject = test of the mail function;
$mailHeaders = From: $senderFrom\n;
$mailHeaders .= Reply-to: $senderFrom\n;
$mailHeaders .= Message-Id: 16295644\n;
mail($receiverTo, $subject, $msg, $mailHeaders);
?
I got this error:

Warning: mail(): SMTP server response: 550 not local host ojpp.myftp.org,
not a gateway in D:\htdocs\ojpp\functions\mail\2.php on line 19
thanks, for any help.



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


php-general Digest 2 Nov 2003 11:00:46 -0000 Issue 2391

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

php-general Digest 2 Nov 2003 11:00:46 - Issue 2391

Topics (messages 168291 through 168325):

mail function error - win32
168291 by: orlandopozo.icnet.com.ve
168292 by: orlandopozo.icnet.com.ve
168293 by: Julien Wadin
168296 by: Manuel Lemos

Re: recursive acronym - PHP
168294 by: Nathan Taylor
168295 by: Nathan Taylor
168308 by: Becoming Digital
168310 by: John Nichel

eliminating dupes from MySQL query results
168297 by: Robb Kerr
168301 by: Joachim Krebs
168307 by: Chris Wanstrath

mail() another example - error
168298 by: orlandopozo.icnet.com.ve
168299 by: orlandopozo.icnet.com.ve
168300 by: orlandopozo.icnet.com.ve
168325 by: Boyan Nedkov

Re: PHP 5
168302 by: Chris Shiflett
168303 by: Pedro Pais
168304 by: Marek Kilimajer
168306 by: Leonel Nunez

php selecting problem
168305 by: Ryan A
168317 by: David Otton

Re: Web Applications and C++?
168309 by: Becoming Digital
168319 by: David Otton

Scripts not running on OS X 10.3
168311 by: Ken Tozier
168312 by: John Nichel
168313 by: Ken Tozier
168318 by: John Nichel
168321 by: Ken Tozier
168322 by: John Nichel
168323 by: Ken Tozier
168324 by: Kim Kohen

Re: deleting characters from strings
168314 by: Tom Rogers
168320 by: David Otton

Object Aggregation Usage - OK for production use?
168315 by: MFriedman.symcor.com

Test, Please Ignore.
168316 by: MFriedman.symcor.com

Administrivia:

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

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

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


--
---BeginMessage---
I try to send from my pc a mail with the function mail(), but if doesn't work, I have 
tried several time, but nothing, I don't know what could be, because the same script 
work well in a remote host.

in my php.ini, I put:

[mail function]
; For Win32 only.
SMTP = mail.serbis.com

I also put

[mail function]
; For Win32 only.
SMTP = mail.webdevfm.com

I also put (the local mail server that I have):
 
[mail function]
; For Win32 only.
SMTP = ojpp.myftp.org



the errors are the follow:

** First error - When the mailserver (ojpp.myftp.org - localhost) is deactivated

Warning: mail(): Failed to connect to mailserver at ojpp.myftp.org port 25, verify 
your SMTP and smtp_port setting in php.ini or use ini_set() in 
d:\htdocs\ojpp\ojppresume\contact.php on line 118

Warning: mail(): Failed to connect to mailserver at ojpp.myftp.org port 25, verify 
your SMTP and smtp_port setting in php.ini or use ini_set() in 
d:\htdocs\ojpp\ojppresume\contact.php on line 138

** Code in line 118

$validar = mail('', $materia, $cuerpo,
To: $para\n .
From: test $email\n .
MIME-Version: 1.0\n .
Content-type: text/html; charset=iso-8859-1);

** Code in line 138

$validar = mail('', $materia, $cuerpo,
To: $para\n .
From: Webdevfm $email\n .
MIME-Version: 1.0\n .
Content-type: text/html; charset=iso-8859-1);

** Second error - When the mailserver (mail.webdevfm.com) is actived

Warning: mail(): SMTP server response: 503 valid RCPT command must precede DATA in 
d:\htdocs\ojpp\ojppresume\contact.php on line 118

** Third error - When the mailserver (mail.serbis.com) is actived

Warning: mail(): SMTP server response: 503 must have sender and recipient first in 
d:\htdocs\ojpp\ojppresume\contact.php on line 118

Error enviando correo electrónico a [EMAIL PROTECTED]

** fourth error - When the mailserver (ojpp.myftp.org - localhost) is actived

Warning: mail(): SMTP server response: 503 Bad sequence of commands in 
d:\htdocs\ojpp\ojppresume\contact.php on line 118

---

thanks, for the help.





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


I try to send from my pc a mail with the function mail(), but if doesn't
work, I have tried several time, but nothing, I don't know what could be,
because the same script work well in a remote host.

in my php.ini, I put:

[mail function]
; For Win32 only.
SMTP = mail.serbis.com

I also put

[mail function]
; For Win32 only.
SMTP = mail.webdevfm.com

I also put (the local mail server that I have):

[mail function]
; For Win32 only.
SMTP = ojpp.myftp.org



the errors are the follow:

** First error - When the mailserver (ojpp.myftp.org - localhost) is
deactivated

Warning: mail(): Failed to connect to mailserver at ojpp.myftp.org port
25, verify your SMTP and smtp_port setting in php.ini or use ini_set()
in d:\htdocs\ojpp\ojppresume\contact.php on line 118

Warning: mail(): Failed to connect to mailserver at ojpp.myftp.org port
25, 

[PHP] passing variables to subsequent pages

2003-11-02 Thread Robb Kerr
I have a two page search. The first page queries a database and creates a 
list of MANUFACTURERS from which the visitor can select all, one or 
multiple entries. The page is submitted via GET to the second page of the 
search. The second page uses the array of selected MANUFACTURERS to create 
a selectable list of MODELS from which the visitor can select all, one or 
multiple entries. This page is then submitted to the results page via GET.

The problem is that to correctly query the database for results, I need to get the 
array of selected MANUFACTURERS  to 
the results page. I'm using a SUBMIT button and don't know how to include
this information in the URL being passed. Any 
suggestions?

Thanx,
-- 
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
http://www.digitaliguana.com
http://www.cancerreallysucks.org

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



Re: [PHP] passing variables to subsequent pages

2003-11-02 Thread Justin French
On Monday, November 3, 2003, at 12:44  AM, Robb Kerr wrote:

I have a two page search. The first page queries a database and 
creates a
list of MANUFACTURERS from which the visitor can select all, one or
multiple entries. The page is submitted via GET to the second page of 
the
search. The second page uses the array of selected MANUFACTURERS to 
create
a selectable list of MODELS from which the visitor can select all, one 
or
multiple entries. This page is then submitted to the results page via 
GET.

The problem is that to correctly query the database for results, I 
need to get the array of selected MANUFACTURERS	to
the results page. I'm using a SUBMIT button and don't know how to 
include
this information in the URL being passed. Any
suggestions?
If you're using a submit button, then you can have a hidden form field:
form ...
input type='hidden' name='manufacturer' 
value='?=$_GET['manufacturer']?' /
input type='submit' ...
/form

of just add it to the URL of the form action:

form action='nextpage.php' method='get'
...
/form
becomes:

form action='nextpage.php?manifacturer=?=$_GET['manufacturer']?' 
method='get'
...
/form

Make sense?

You could also consider sessions, cookies, etc etc.

Justin French

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


Re: [PHP] passing variables to subsequent pages

2003-11-02 Thread David Otton
On Sun, 2 Nov 2003 07:44:29 -0600, you wrote:

I have a two page search. The first page queries a database and creates a 
list of MANUFACTURERS from which the visitor can select all, one or 
multiple entries. The page is submitted via GET to the second page of the 
search. The second page uses the array of selected MANUFACTURERS to create 
a selectable list of MODELS from which the visitor can select all, one or 
multiple entries. This page is then submitted to the results page via GET.

The problem is that to correctly query the database for results, I need to get the 
array of selected MANUFACTURERS to 
the results page. I'm using a SUBMIT button and don't know how to include
this information in the URL being passed. Any 
suggestions?

Flip to POST instead of GET, for the sake of neatness.

The key to passing multiple values is the [] at the end of the checkbox
name in the form:

?
if (isset ($fruit))
{
print_r ($fruit);
}
?
form method=post action=? echo($PHP_SELF); ?
pinput type=checkbox name=fruit[] value=apple Apple/p
pinput type=checkbox name=fruit[] value=orange Orange/p
pinput type=checkbox name=fruit[] value=pear Pear/p
pinput type=checkbox name=fruit[] value=banana Banana/p
pinput type=checkbox name=fruit[] value=tangerine
Tangerine/p
pinput type=submit name=Go value=Go/p
/form

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



[PHP] Dissecting an email address

2003-11-02 Thread Dave Carrera
Hi All,

How do you split an email address sent via form post text field.

I.e.: split [EMAIL PROTECTED] into me@ hotmail .com

Its the domain bit I am interested in, not the username or tld.

Any help is appreciated.

Thank you in advance 

Yours
Dave C

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.530 / Virus Database: 325 - Release Date: 22/10/2003
 

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



Re: [PHP] PHP 5

2003-11-02 Thread Andi Gutmans
Hi,

We tried to keep PHP 5 as much backwards compatible as possible.
However, due to the object model change and major improvements in the XML
extensions there might be some issues which you'll need to address.
IIRC, mysqladmin runs out of the box with PHP 5 and so do many other
applications.
In any case, porting apps over to PHP 5 will most probably not be a lot of
work.

Andi

On Sat, 1 Nov 2003, Leonel Nunez wrote:

 On Sat, 01 Nov 2003 23:42:06 +0100, Marek Kilimajer wrote:
 
  There will certainly be security updates, but it will not be futher 
  enhanced.
  
  Leonel Nunez wrote:
  hello :
  
  When php 5 is released  will there be support for  php 4.3.x ?
  
  thanks
  
  leonel
 
 
 this is what I needed to now
 
 Security updates  
 
 thanks  I hope so
 
 Leonel
 
 

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



Re: [PHP] Dissecting an email address

2003-11-02 Thread Filip de Waard
RTFM

http://www.php.net/explode

-Filip

On Sun, 2003-11-02 at 15:04, Dave Carrera wrote:
 Hi All,
 
 How do you split an email address sent via form post text field.
 
 I.e.: split [EMAIL PROTECTED] into me@ hotmail .com
 
 Its the domain bit I am interested in, not the username or tld.
 
 Any help is appreciated.
 
 Thank you in advance 
 
 Yours
 Dave C
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.530 / Virus Database: 325 - Release Date: 22/10/2003
  
-- 
Met vriendelijke groet,

Filip de Waard
Net Collective

www.netcollective.nl
Tel. 06 - 48 01 22 40
Fax. 013 - 455 87 53

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



[PHP] Re: passing variables to subsequent pages

2003-11-02 Thread Robb Kerr
Both suggestions were very helpful. But, I've still got a problem. The
$MANUFACTURERS variable contains an array. I'm trying to pass this array
with either the GET or POST method. I've tried the following to no avail...

input name=manufacturer[] type=hidden multiple id=manufacturer[]
value=?php $manufacturer ?

input name=manufacturer[] type=hidden multiple id=manufacturer[]
value=?php echo $manufacturer ?

input name=manufacturer[] type=hidden multiple id=manufacturer[]
value=?php $manufacturer ?

input name=manufacturer[] type=hidden multiple id=manufacturer[]
value='?=$_GET['manufacturer']?'  //as per Justin's suggestion

input name=manufacturer[] type=hidden multiple id=manufacturer[]
value=$manufacturer

input name=manufacturer[] type=hidden multiple id=manufacturer[]
value=$manufacturer


Except for the last two entries, the others all passed
...manufacturer%5B%5D=Array...

Any more suggestions?

Thanx,
-- 
Robb Kerr
Digital IGUANA

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



[PHP] Re: Dissecting an email address

2003-11-02 Thread Joachim Krebs
Hi there,

First, we have to realize that in an email there can be more than one 
period, but we only want to remove the top level domain. The solution? 
Remove the top level domain to begin with - You may be able to do that 
using explode() and the limit argument, but this was easier, in my opinion.

?php
$email = '[EMAIL PROTECTED]'; //for example
$email = substr($email, 0, strrpos($email, '.')); //remove the .com
$email = explode('@', $email); //turn it into an array
$email = $email[1]; //grab what's after the @
echo $email; //outputs 'hotmail'
?
Joachim

Dave Carrera wrote:
Hi All,

How do you split an email address sent via form post text field.

I.e.: split [EMAIL PROTECTED] into me@ hotmail .com

Its the domain bit I am interested in, not the username or tld.

Any help is appreciated.

Thank you in advance 

Yours
Dave C
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.530 / Virus Database: 325 - Release Date: 22/10/2003
 
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] How to remove new line character?

2003-11-02 Thread Shu Hung Yeung
Hello,

I am a beginner of PHP.

I know a little about Perl.
In Perl, there is a chomp() function to remove newline (return) character in 
a long string.
How about PHP? Can I do the same in PHP

Thankyou

_
Linguaphone :  Learning English? Get Japanese lessons for FREE 
http://go.msnserver.com/HK/30476.asp

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


RE: [PHP] How to remove new line character?

2003-11-02 Thread Simon Stiefel
Hi,

try it with the 'chop()'-function.
Note, that this also removes any other whitespace-characters like tabulators
and spaces.

HTH,

Simon



 -Original Message-
 From: Shu Hung Yeung [mailto:[EMAIL PROTECTED] 
 Sent: Sunday, November 02, 2003 5:14 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] How to remove new line character?
 
 
 Hello,
 
 I am a beginner of PHP.
 
 I know a little about Perl.
 In Perl, there is a chomp() function to remove newline 
 (return) character in 
 a long string.
 How about PHP? Can I do the same in PHP
 
 Thankyou

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



[PHP] passing an array via GET and a hidden form element

2003-11-02 Thread Robb Kerr
I'm trying to pass a variable from a search page to the results page via
GET. The $MANUFACTURERS variable contains an array and is obtained from the
URL. I've tried the following to no avail...

input name=manufacturer[] type=hidden multiple id=manufacturer[]
value=?php $manufacturer ?

input name=manufacturer[] type=hidden multiple id=manufacturer[]
value=?php echo $manufacturer ?

input name=manufacturer[] type=hidden multiple id=manufacturer[]
value=?php $manufacturer ?

input name=manufacturer[] type=hidden multiple id=manufacturer[]
value=$manufacturer

input name=manufacturer[] type=hidden multiple id=manufacturer[]
value=$manufacturer


Except for the last two entries, in the URL, the others all passed
...manufacturer%5B%5D=Array...

When analyzing the variable on the results page, I wind up with
$manufacturer equaling an array with one element equaling Array...

Array ( [0] = Array )


Any suggestions?

Thanx,

-- 
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
http://www.digitaliguana.com
http://www.cancerreallysucks.org

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



RE: [PHP] How to remove new line character?

2003-11-02 Thread Koala Yeung
Thanks a lot

I'd like to remove newline only.
Is there any simple way?
Koala


From: Simon Stiefel [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: RE: [PHP] How to remove new line character?
Date: Sun, 2 Nov 2003 17:25:53 +0100
Hi,

try it with the 'chop()'-function.
Note, that this also removes any other whitespace-characters like 
tabulators
and spaces.

HTH,

Simon



 -Original Message-
 From: Shu Hung Yeung [mailto:[EMAIL PROTECTED]
 Sent: Sunday, November 02, 2003 5:14 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] How to remove new line character?


 Hello,

 I am a beginner of PHP.

 I know a little about Perl.
 In Perl, there is a chomp() function to remove newline
 (return) character in
 a long string.
 How about PHP? Can I do the same in PHP

 Thankyou
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_
No masks required! Use MSN Messenger to chat with friends and family. 
http://go.msnserver.com/HK/25382.asp

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


RE: [PHP] How to remove new line character?

2003-11-02 Thread Simon Stiefel
Sorry, one correction:
the 'chop()'-function only removes the whitespaces an the END of the string.

But if you want to remove the newline (and only this) at the end of the
string try this:

$new_string = preg_replace(/\n$/, , $old_string);



HTH,

Simon



 -Original Message-
 From: Koala Yeung [mailto:[EMAIL PROTECTED] 
 Sent: Sunday, November 02, 2003 5:43 PM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] How to remove new line character?
 
 
 Thanks a lot
 
 I'd like to remove newline only.
 Is there any simple way?
 
 Koala
 
 
 From: Simon Stiefel [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] How to remove new line character?
 Date: Sun, 2 Nov 2003 17:25:53 +0100
 
 Hi,
 
 try it with the 'chop()'-function.
 Note, that this also removes any other whitespace-characters like
 tabulators
 and spaces.
 
 HTH,
 
 Simon
 
 
 
   -Original Message-
   From: Shu Hung Yeung [mailto:[EMAIL PROTECTED]
   Sent: Sunday, November 02, 2003 5:14 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP] How to remove new line character?
  
  
   Hello,
  
   I am a beginner of PHP.
  
   I know a little about Perl.
   In Perl, there is a chomp() function to remove newline
   (return) character in
   a long string.
   How about PHP? Can I do the same in PHP
  
   Thankyou
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 _
 No masks required! Use MSN Messenger to chat with friends and family. 
 http://go.msnserver.com/HK/25382.asp
 
 -- 
 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] passing an array via GET and a hidden form element

2003-11-02 Thread John W. Holmes
Robb Kerr wrote:
I'm trying to pass a variable from a search page to the results page via
GET. The $MANUFACTURERS variable contains an array and is obtained from the
URL. I've tried the following to no avail...
input name=manufacturer[] type=hidden multiple id=manufacturer[]
value=?php $manufacturer ?
[snip]

input name=manufacturer type=hidden multiple id=manufacturer
value=?php echo htmlentities(serialize($manufacturer)); ?
Then to get the array back on the receiving page:

$manufacturer = unserialize($_GET['manufacturer);

Or just stick the array in the session...

$_SESSION['manu'] = $manufacturer;

and on receiving page:

$manufacturer = $_SESSION['manu'];

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


[PHP] A question about file creation

2003-11-02 Thread Yeung Koala
Hi,

Silly question of beginner:
Is is possible to write a script to create and write a text file on server?
How?
P.S. Thanks Simon Stiefel for the chomp stuff

_
Hotmail Extra Storage10MB  http://join.msn.com/?pgmarket=zh-hk 

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


Re: [PHP] A question about file creation

2003-11-02 Thread Ian Firla

http://it.php.net/manual/en/function.fwrite.php

On Sun, 2003-11-02 at 19:25, Yeung Koala wrote:
 Hi,
 
 Silly question of beginner:
 Is is possible to write a script to create and write a text file on server?
 How?
 
 
 P.S. Thanks Simon Stiefel for the chomp stuff
 
 _
 Hotmail Extra Storage10MB  
 http://join.msn.com/?pgmarket=zh-hk

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



Re: [PHP] How to remove new line character?

2003-11-02 Thread Gerard Samuel
On Sunday 02 November 2003 11:50 am, Simon Stiefel wrote:
 Sorry, one correction:
 the 'chop()'-function only removes the whitespaces an the END of the
 string.

 But if you want to remove the newline (and only this) at the end of the
 string try this:

 $new_string = preg_replace(/\n$/, , $old_string);

To expand on the idea, make it capable of Windows and MAC new lines also
$new_string = preg_replace(/\n|\r\n|\r$/, , $old_string);

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



[PHP] JavaScript question

2003-11-02 Thread Robin Kopetzky
Good morning.

I know this may be off-topic but I don't know where to turn.

I'm building a dynamic web page system with PHP and need to figure out in
JavaScript how to do something. I have the timer figured out in JavaScript
but what I need is a way to automatically submit a request back to the web
server after the timer runs out. What I'm trying to do is display slides in
sequence. When the timer expires, it sends back to the web server the
parameters of slide group and the last slide displayed. The PHP on the
server end builds a new page and sends it to the browser with the next slide
in the sequence.

Any help would be greatly appreciated and my PHP skills are vastly above my
JavaScript skills (very basic beginner).

Robin 'Sparky' Kopetzky
Black Mesa Computers/Internet Service
Grants, NM 87020

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



Re: [PHP] JavaScript question

2003-11-02 Thread Marek Kilimajer
Would Refresh header work for you?

header('Refresh: 15; url=slides.php?page=2');

If you send this header the browser will navigate to slides.php?page=2 
after 15 seconds without user intervension.

Robin Kopetzky wrote:
Good morning.

I know this may be off-topic but I don't know where to turn.

I'm building a dynamic web page system with PHP and need to figure out in
JavaScript how to do something. I have the timer figured out in JavaScript
but what I need is a way to automatically submit a request back to the web
server after the timer runs out. What I'm trying to do is display slides in
sequence. When the timer expires, it sends back to the web server the
parameters of slide group and the last slide displayed. The PHP on the
server end builds a new page and sends it to the browser with the next slide
in the sequence.
Any help would be greatly appreciated and my PHP skills are vastly above my
JavaScript skills (very basic beginner).
Robin 'Sparky' Kopetzky
Black Mesa Computers/Internet Service
Grants, NM 87020
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Problem with apache and php on OpenBSD 3.4

2003-11-02 Thread Teren
Hi, I just loaded up all of the packages using the packages from Openbsd since i was 
having issues with ports, and then I activated them all and that worked fine. However, 
when I put the line to load the php4 module in to httpd.conf, apache won't start. It 
finds the module fine, but that's it. When i run apachectl start, it says it can't be 
started, when I do apachectl configtest, it says the Syntax is OK. Anyone have any 
ideas? Thanks

Teren

[PHP] How to remove a variable from an array

2003-11-02 Thread Jake McHenry
I have an array variable that is set, then put into a session
variable. All is good so far, but how can I remove a specific variable
from the array?

I have tried basically copying and pasting this, and adding a foreach
loop. Inside this foreach loop, the array is split apart and I tried
using unnset, but I couldn't get it to work, so I deleted the code.

Here is how I built the array:

  if ($_POST['4_Add'] != )
  {
if (($_POST['Frequent_Guest_Program'] != ) 
($_POST['Frequent_Guest_Number'] != ))
{
  $array = array();
  $new =
{$_POST['Frequent_Guest_Program']},{$_POST['Frequent_Guest_Number']}
;
  $old = $_SESSION['Frequent_Guest'];
  $array = array_merge($old, $new);
  $_SESSION['Frequent_Guest'] = $array;
}
header(Location: profile4.php);
  }


Thanks,

Jake McHenry
Nittany Travel MIS Coordinator
http://www.nittanytravel.com

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



RE: [PHP] JavaScript question

2003-11-02 Thread Jake McHenry
 -Original Message-
 From: Marek Kilimajer [mailto:[EMAIL PROTECTED] 
 Sent: Sunday, November 02, 2003 2:03 PM
 To: Robin Kopetzky
 Cc: PHP General
 Subject: Re: [PHP] JavaScript question
 
 
 Would Refresh header work for you?
 
 header('Refresh: 15; url=slides.php?page=2');
 
 If you send this header the browser will navigate to 
 slides.php?page=2 
 after 15 seconds without user intervension.
 
 Robin Kopetzky wrote:
  Good morning.
  
  I know this may be off-topic but I don't know where to turn.
  
  I'm building a dynamic web page system with PHP and need to 
 figure out 
  in JavaScript how to do something. I have the timer figured out in

  JavaScript but what I need is a way to automatically submit 
 a request 
  back to the web server after the timer runs out. What I'm 
 trying to do 
  is display slides in sequence. When the timer expires, it 
 sends back 
  to the web server the parameters of slide group and the last slide

  displayed. The PHP on the server end builds a new page and 
 sends it to 
  the browser with the next slide in the sequence.
  
  Any help would be greatly appreciated and my PHP skills are vastly

  above my JavaScript skills (very basic beginner).
  
  Robin 'Sparky' Kopetzky
  Black Mesa Computers/Internet Service
  Grants, NM 87020
  
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

Refresh wouldn't work in this example, he needs the form to auto
submit after the timer expires. What you would need to do is add this
to your javascript at the position when the timer expires:

document.formname.submit();

Of course replace formname with the name of your form.

I believe this is correct. I didn't test it.



Thanks,

Jake McHenry
Nittany Travel MIS Coordinator
http://www.nittanytravel.com

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



[PHP] more proplems with passing arrays

2003-11-02 Thread Robb Kerr
I'm trying to pass an array variable from a search page to the results page
via GET. The $NAMES variable contains an array which is obtained from the
URL. Per a previous suggestion I've been trying SERIALIZE/UNSERIALIZE but
can't get the variable to pass correctly. To take a look at my test files
follow this URL...

http://www.cancerreallysucks.org/SerializeTest/Search01.htm

Attached are the HTM  PHP files. Please take a look and tell me what's
wrong. I appreciate any help. I just can't seem to get the seemingly simple
thing to work.

Thanx,
-- 
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
http://www.digitaliguana.com
http://www.cancerreallysucks.org

WebDocs.zip
Description: Attached file: WebDocs.zip
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] more proplems with passing arrays

2003-11-02 Thread Jake McHenry
 -Original Message-
 From: Robb Kerr [mailto:[EMAIL PROTECTED] 
 Sent: Sunday, November 02, 2003 2:20 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] more proplems with passing arrays
 
 
 I'm trying to pass an array variable from a search page to 
 the results page via GET. The $NAMES variable contains an 
 array which is obtained from the URL. Per a previous 
 suggestion I've been trying SERIALIZE/UNSERIALIZE but can't 
 get the variable to pass correctly. To take a look at my test 
 files follow this URL...
 
http://www.cancerreallysucks.org/SerializeTest/Search01.htm

Attached are the HTM  PHP files. Please take a look and tell me
what's wrong. I appreciate any help. I just can't seem to get the
seemingly simple thing to work.

Thanx,
-- 
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
http://www.digitaliguana.com http://www.cancerreallysucks.org





Watch names and surnames. In your select, you have surnames, and in
your input field, you have names. And since you put the surnames[]
values into a hidden input element, it's going to be retrieve via
$_POST now, not $_GET.



Thanks,

Jake McHenry
Nittany Travel MIS Coordinator
http://www.nittanytravel.com

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



[PHP] PHP and Apace setup

2003-11-02 Thread Teren
Hi, I just loaded up all of the packages using the packages from Openbsd 
since i was having issues with ports, and then I activated them all and 
that worked fine. However, when I put the line to load the php4 module 
in to httpd.conf, apache won't start. It finds the module fine, but 
that's it. When i run apachectl start, it says it can't be started, when 
I do apachectl configtest, it says the Syntax is OK. Anyone have any 
ideas? Thanks

Teren

RE: [PHP] PHP and Apace setup

2003-11-02 Thread Simon Stiefel
Hi,

can you give us some lines from your error_log-file?
Usually found in /var/log/apache[2]/.

Thanks,

Simon


 -Original Message-
 From: Teren [mailto:[EMAIL PROTECTED] 
 Sent: Sunday, November 02, 2003 8:43 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] PHP and Apace setup
 
 
 Hi, I just loaded up all of the packages using the packages 
 from Openbsd 
 since i was having issues with ports, and then I activated 
 them all and 
 that worked fine. However, when I put the line to load the 
 php4 module 
 in to httpd.conf, apache won't start. It finds the module fine, but 
 that's it. When i run apachectl start, it says it can't be 
 started, when 
 I do apachectl configtest, it says the Syntax is OK. Anyone have any 
 ideas? Thanks
 
 Teren
 

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



Re: [PHP] more proplems with passing arrays

2003-11-02 Thread Lowell Allen
 I'm trying to pass an array variable from a search page to the results page
 via GET. The $NAMES variable contains an array which is obtained from the
 URL. Per a previous suggestion I've been trying SERIALIZE/UNSERIALIZE but
 can't get the variable to pass correctly. To take a look at my test files
 follow this URL...

I have success using base64_encode before serializing an array to be passed.
Like so:

$serial_array = base64_encode(serialize($original_array));

Then in the code that gets the serialized array:

$original_array = unserialize(base64_decode($_GET[whatever]));

HTH

--
Lowell Allen

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



Re: [PHP] more proplems with passing arrays

2003-11-02 Thread Robb Kerr
On Sun, 02 Nov 2003 16:33:03 -0500, Lowell Allen wrote:

 I'm trying to pass an array variable from a search page to the results page
 via GET. The $NAMES variable contains an array which is obtained from the
 URL. Per a previous suggestion I've been trying SERIALIZE/UNSERIALIZE but
 can't get the variable to pass correctly. To take a look at my test files
 follow this URL...
 
 I have success using base64_encode before serializing an array to be passed.
 Like so:
 
 $serial_array = base64_encode(serialize($original_array));
 
 Then in the code that gets the serialized array:
 
 $original_array = unserialize(base64_decode($_GET[whatever]));
 
 HTH

Lowell,

Thank you VERY MUCH for your response. I've been messing with this problem
all day and your response was the first one that actually worked.

Thanx again,
-- 
Robb Kerr
Digital IGUANA

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



Re: [PHP] recursive acronym - PHP

2003-11-02 Thread Evan Nemerson
How can you forget the Hurd???

http://www.gnu.org/software/hurd/hurd.html#name:

According to Thomas Bushnell, BSG, the primary architect of the Hurd:

`Hurd' stands for `Hird of Unix-Replacing Daemons'. And, then, `Hird' stands 
for `Hurd of Interfaces Representing Depth'. We have here, to my knowledge, 
the first software to be named by a pair of mutually recursive acronyms.


On Saturday 01 November 2003 11:23 am, [EMAIL PROTECTED] wrote:
 Why PHP is a recursive acronym?, I know that before was called Personal
 Home Page, I now is Hypertext PreProcessor, but why is recursive?, I person
 told me that it could be wroten as Pre Hypertxt Processor, thanks.

-- 
Evan Nemerson
[EMAIL PROTECTED]

--
Businesses may come and go, but religion will last forever, for in no other 
endeavor does the consumer blame himself for product failure.

-Harvard Lamphoon

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



Re: [PHP] recursive acronym - PHP

2003-11-02 Thread Joachim Krebs
Perhaps it is time to break the record.

Evan Nemerson wrote:
How can you forget the Hurd???

http://www.gnu.org/software/hurd/hurd.html#name:

According to Thomas Bushnell, BSG, the primary architect of the Hurd:

`Hurd' stands for `Hird of Unix-Replacing Daemons'. And, then, `Hird' stands 
for `Hurd of Interfaces Representing Depth'. We have here, to my knowledge, 
the first software to be named by a pair of mutually recursive acronyms.

On Saturday 01 November 2003 11:23 am, [EMAIL PROTECTED] wrote:

Why PHP is a recursive acronym?, I know that before was called Personal
Home Page, I now is Hypertext PreProcessor, but why is recursive?, I person
told me that it could be wroten as Pre Hypertxt Processor, thanks.


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


[PHP] scalar value as array problem

2003-11-02 Thread Steve Turner
I have a frustrating problem. I have a shopping cart class that creates
session variable arrays to store the product_id and quantity. My development
machine is running windows 2000 with PHP 4.3.3 and my script is working
perfectly on my machine. When I upload to the remote host running FreeBSD
and PHP 4.3.2 I am getting errors. I believe I am having problems with
assigning the array values, and this is causing other problems. I am using
this statment to assign $_SESSION['cart']['product_id'] with the quantity
using a class with the add_item property.

 $cart-add_item($_GET['product_id'], $_GET['quantity']);

I am getting this error.

Warning: Cannot use a scalar value as an array in
/home/designor/public_html/class.php on line 14
Warning: Cannot use a scalar value as an array in
/home/designor/public_html/class.php on line 16

I have no idea what a scalar value even is. I did verify that my form was
passing the values by using
echo $_GET['product_id'] . $_GET['quantity'];

Your help is much appreciated, as I am still a beginner.

Steve Turner

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



[PHP] time() daylight savings

2003-11-02 Thread philip lehmann
hi !
i'm working in a calendar software, web based with php and a windows client.
i can write appointments to my mysql database with the windows client
independent
from daylight savings. it always shows the appointments at the right time.
if i
create appointments with my php web frontend e.g.

1st  @ 01.05.2003  8:00 am
2nd @ 01.11.2003  8:00 am

it shows the appointments correct. when i access them with my windows
client,
only the 2nd appointment is at 8 am the 1st is shown at 09:00 am. when i set
my windows date to may then the 1st appt is correct at 8 am but the 2nd not
!!!

does anybody know how php handles daylight saving issues ? again: the
windows
client does work under all conditions, except it accesses php created
appointments.


thanks
philip

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



php-general Digest 2 Nov 2003 23:04:04 -0000 Issue 2392

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

php-general Digest 2 Nov 2003 23:04:04 - Issue 2392

Topics (messages 168326 through 168357):

passing variables to subsequent pages
168326 by: Robb Kerr
168327 by: Justin French
168328 by: David Otton
168332 by: Robb Kerr

Dissecting an email address
168329 by: Dave Carrera
168331 by: Filip de Waard
168333 by: Joachim Krebs

Re: PHP 5
168330 by: Andi Gutmans

How to remove new line character?
168334 by: Shu Hung Yeung
168335 by: Simon Stiefel
168337 by: Shu Hung Yeung
168338 by: Simon Stiefel
168342 by: Gerard Samuel

passing an array via GET and a hidden form element
168336 by: Robb Kerr
168339 by: John W. Holmes

A question about file creation
168340 by: Shu Hung Yeung
168341 by: Ian Firla

JavaScript question
168343 by: Robin Kopetzky
168344 by: Marek Kilimajer
168347 by: Jake McHenry

Problem with apache and php on OpenBSD 3.4
168345 by: Teren

How to remove a variable from an array
168346 by: Jake McHenry

more proplems with passing arrays
168348 by: Robb Kerr
168349 by: Jake McHenry
168352 by: Lowell Allen
168353 by: Robb Kerr

PHP and Apace setup
168350 by: Teren
168351 by: Simon Stiefel

Re: recursive acronym - PHP
168354 by: Evan Nemerson
168355 by: Joachim Krebs

scalar value as array problem
168356 by: Steve Turner

time()  daylight savings
168357 by: philip lehmann

Administrivia:

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

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

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


--
---BeginMessage---
I have a two page search. The first page queries a database and creates a 
list of MANUFACTURERS from which the visitor can select all, one or 
multiple entries. The page is submitted via GET to the second page of the 
search. The second page uses the array of selected MANUFACTURERS to create 
a selectable list of MODELS from which the visitor can select all, one or 
multiple entries. This page is then submitted to the results page via GET.

The problem is that to correctly query the database for results, I need to get the 
array of selected MANUFACTURERS  to 
the results page. I'm using a SUBMIT button and don't know how to include
this information in the URL being passed. Any 
suggestions?

Thanx,
-- 
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
http://www.digitaliguana.com
http://www.cancerreallysucks.org
---End Message---
---BeginMessage---
On Monday, November 3, 2003, at 12:44  AM, Robb Kerr wrote:

I have a two page search. The first page queries a database and 
creates a
list of MANUFACTURERS from which the visitor can select all, one or
multiple entries. The page is submitted via GET to the second page of 
the
search. The second page uses the array of selected MANUFACTURERS to 
create
a selectable list of MODELS from which the visitor can select all, one 
or
multiple entries. This page is then submitted to the results page via 
GET.

The problem is that to correctly query the database for results, I 
need to get the array of selected MANUFACTURERS	to
the results page. I'm using a SUBMIT button and don't know how to 
include
this information in the URL being passed. Any
suggestions?
If you're using a submit button, then you can have a hidden form field:
form ...
input type='hidden' name='manufacturer' 
value='?=$_GET['manufacturer']?' /
input type='submit' ...
/form

of just add it to the URL of the form action:

form action='nextpage.php' method='get'
...
/form
becomes:

form action='nextpage.php?manifacturer=?=$_GET['manufacturer']?' 
method='get'
...
/form

Make sense?

You could also consider sessions, cookies, etc etc.

Justin French
---End Message---
---BeginMessage---
On Sun, 2 Nov 2003 07:44:29 -0600, you wrote:

I have a two page search. The first page queries a database and creates a 
list of MANUFACTURERS from which the visitor can select all, one or 
multiple entries. The page is submitted via GET to the second page of the 
search. The second page uses the array of selected MANUFACTURERS to create 
a selectable list of MODELS from which the visitor can select all, one or 
multiple entries. This page is then submitted to the results page via GET.

The problem is that to correctly query the database for results, I need to get the 
array of selected MANUFACTURERS to 
the results page. I'm using a SUBMIT button and don't know how to include
this information in the URL being passed. Any 
suggestions?

Flip to POST instead of GET, for the sake of neatness.

The key to passing multiple values is the [] at the end of the checkbox
name in the form:

?
if (isset ($fruit))
{
print_r ($fruit);
}
?
form 

Re: [PHP] passing variables to subsequent pages

2003-11-02 Thread Chris Shiflett
--- Justin French [EMAIL PROTECTED] wrote:
 form action='nextpage.php?manifacturer=?=$_GET['manufacturer']?'
 method='get'

Unless I'm mistaken (which is possible), this won't work. When the
form method is GET, the query string is constructed using the form
fields. Therefore, the manufacturer will be lost.

Hope that helps.

Chris

=
My Blog
 http://shiflett.org/
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



Re: [PHP] scalar value as array problem

2003-11-02 Thread John W. Holmes
Steve Turner wrote:

I have a frustrating problem. I have a shopping cart class that creates
session variable arrays to store the product_id and quantity. My development
machine is running windows 2000 with PHP 4.3.3 and my script is working
perfectly on my machine. When I upload to the remote host running FreeBSD
and PHP 4.3.2 I am getting errors. I believe I am having problems with
assigning the array values, and this is causing other problems. I am using
this statment to assign $_SESSION['cart']['product_id'] with the quantity
using a class with the add_item property.
 $cart-add_item($_GET['product_id'], $_GET['quantity']);

I am getting this error.

Warning: Cannot use a scalar value as an array in
/home/designor/public_html/class.php on line 14
Warning: Cannot use a scalar value as an array in
/home/designor/public_html/class.php on line 16
I have no idea what a scalar value even is. I did verify that my form was
passing the values by using
echo $_GET['product_id'] . $_GET['quantity'];
A string or integer would be a scalar value.

What you have is something like this:

$a = 4;
$a[] = 5;
Where you initially make $a an integer, then you try to make it into an 
array and add an element to it. PHP is giving you a warning (not an 
error) about this. You may be using any of the array functions on 
something that's not an array to begin with.

You can either fix the problem, or just adjust your error_reporting() 
level to not see warnings.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


[PHP] How to run PHP4 and PHP5 side-by-side

2003-11-02 Thread Adam Plocher
Hello, I'm using Apache 2.0 on a Linux box and I'm trying to figure out how to run 
PHP5 (beta2) and PHP4 co-existantly.  I have compiled both of them with 
--enable-versioning, but I can't figure out what I need to put in my httpd.conf to 
make it differentiate the two versions.
 
Ideally I would like php5 to be enabled for certain virtualhosts, and php4 for others. 
 But using .php5 file extensions would be acceptable too.
 
I have compiled PHP4 and PHP5 with the following configure options:
'./configure' '--with-apxs2=/home/httpd/bin/apxs' '--with-mysql=/home/mysql' 
'--enable-track-vars'  '--enable-versioning'
 
Thanks in advance
 
-Adam


Re: [PHP] recursive acronym - PHP

2003-11-02 Thread Lee Doolan
 Joachim == Joachim Krebs [EMAIL PROTECTED] writes:

Joachim Perhaps it is time to break the record.
Joachim Evan Nemerson wrote:
 How can you forget the Hurd???

Xinu Is Not Unix

also

MT XINU is UNIX TM backwards

-- 
no toll on the internet; there are paths of many kinds;
whoever passes this portal will travel freely in the world

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



[PHP] Re: How to run PHP4 and PHP5 side-by-side

2003-11-02 Thread Comex
[EMAIL PROTECTED]
Adam Plocher:
 Hello, I'm using Apache 2.0 on a Linux box and I'm trying to figure
 out how to run PHP5 (beta2) and PHP4 co-existantly.  I have compiled
 both of them with --enable-versioning, but I can't figure out what I
 need to put in my httpd.conf to make it differentiate the two
 versions.

 Ideally I would like php5 to be enabled for certain virtualhosts, and
 php4 for others.  But using .php5 file extensions would be acceptable
 too.

 I have compiled PHP4 and PHP5 with the following configure options:
 './configure' '--with-apxs2=/home/httpd/bin/apxs'
 '--with-mysql=/home/mysql' '--enable-track-vars'
 '--enable-versioning'

 Thanks in advance

 -Adam

I have this set up...

LoadModule php5_module C:/php5/sapi/php4apache2.dll
ScriptAlias /php/ C:/php/
AddType application/x-httpd-php .php5
AddType application/x-httpd-php4 .php
Action application/x-httpd-php4 /php/php.exe

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



[PHP] Test.

2003-11-02 Thread S. Cole
Disregard. having newsgroup trouble

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



Re: [PHP] How to remove a variable from an array

2003-11-02 Thread David Otton
On Sun, 2 Nov 2003 14:06:31 -0500, you wrote:

I have an array variable that is set, then put into a session
variable. All is good so far, but how can I remove a specific variable
from the array?

unset()

I have tried basically copying and pasting this, and adding a foreach
loop. Inside this foreach loop, the array is split apart and I tried
using unnset, but I couldn't get it to work, so I deleted the code.

unset ($array[$index])

http://uk.php.net/unset

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



[PHP] Image resize with background.

2003-11-02 Thread Chris
Hey guys. I have read a lot of different option to resize images.
 
What about a script that will resize an image, constrain proportions,
and add a background color to whatever is left.
 
For example, I have a picture that is 600 (width) by 300 (height) and I
want to constrain proportions, and resize this to 300 by 400 (width by
height). There would be an extra 250 pixels left in the height, so now
that gets filled in with some background color.
 
This way, the people that have to make any image fit in a certain
location can keep the same aspect ratio, and not have to have an 'out of
place' image.
 
Just a though. What do you guys think?
 
-Chris 
[EMAIL PROTECTED]


[PHP] applying one function to all array elements

2003-11-02 Thread Justin French
Hi,

Can someone show me a simple, clean way to apply one function (eg 
stripslashes()) to every element in an array (eg $_POST)?

I've been doing it with a foreach() loop, but there has to be a better 
way.  I've also seen http://www.php.net/array_walk, but couldn't 
determine how/if it suited my needs.

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


Re: [PHP] How to remove a variable from an array

2003-11-02 Thread David Otton

I have tried basically copying and pasting this, and adding a foreach
loop. Inside this foreach loop, the array is split apart and I tried
using unnset, but I couldn't get it to work, so I deleted the code.

unset ($array[$index])

http://uk.php.net/unset

There are examples in the manual, but as you've already tried unset, I guess
I should be explicit:

?
$a = array ('a', 'b', 'c', 'd', 'e');

print_r ($a);

unset ($a[2]);

print_r ($a);
?

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



RE: [PHP] Image resize with background.

2003-11-02 Thread Martin Towell
try the resize copy function (can't remember the exact name ATM)

Set the destination's first colour to the desired background colour, then
copy/resize the image to it.

Martin

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED]
Sent: Monday, 3 November 2003 12:36 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Image resize with background.


Hey guys. I have read a lot of different option to resize images.
 
What about a script that will resize an image, constrain proportions,
and add a background color to whatever is left.
 
For example, I have a picture that is 600 (width) by 300 (height) and I
want to constrain proportions, and resize this to 300 by 400 (width by
height). There would be an extra 250 pixels left in the height, so now
that gets filled in with some background color.
 
This way, the people that have to make any image fit in a certain
location can keep the same aspect ratio, and not have to have an 'out of
place' image.
 
Just a though. What do you guys think?
 
-Chris 
[EMAIL PROTECTED]

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



[PHP] Extracting random rows

2003-11-02 Thread Scott
Hello,

Below is a boiled-down example of the problem I'm having.  I'm trying to
extract rows randomly from MySql, but I keep getting the same one. It
works if I query MySql directly from the command line, so it seems like
a php problem.

Thanks,
Scott

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0//EN
html
head
  title/title
  meta http-equiv=Content-Type content=text/html;
charset=iso-8859-1
  meta name=GENERATOR content=Quanta Plus
/head
body

?

include (connectlpi.php);

$sql = 
select id
from $table_name
order by rand()
limit 1
;

$result = @mysql_query($sql,$connection) or die(Couldn't execute
query.);

while ($row = mysql_fetch_array($result)) {

$id = $row['id'];

}

echo $id;

?



/body
/html

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



Re: [PHP] applying one function to all array elements

2003-11-02 Thread Mike Migurski
Can someone show me a simple, clean way to apply one function (eg
stripslashes()) to every element in an array (eg $_POST)?

I've been doing it with a foreach() loop, but there has to be a better
way.  I've also seen http://www.php.net/array_walk, but couldn't
determine how/if it suited my needs.

What part of Apply a user function to every member of an array makes it
difficult to assess array_walk's usefulness? If it helps, array_map
(Applies the callback to the elements of the given arrays) does
something similar.

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



RE: [PHP] Endless 'while' loops?

2003-11-02 Thread Dave G

Thank you Lief, Hanuska and Jay for your comments and advice.

 (it automagically knows which result it's on)

This was the piece of information that I was missing. I did not
know PHP had any automagic in it's handling of arrays.
However, now that I think I know what's going on, my code still
does not seem to be working. When I execute the following, I get a parse
error on the line where my first square brackets (...for  .member[1];)
appears. If I take the square brackets out, the code parses, but does
not do anything.
Here is the problematic code:
db_connect();
$query = select * from tablename where active = 1;
$result = mysql_query($query);
while ($member = mysql_fetch_row($result));
{
$subject = EigoImprov Newsletter for  .member[1];
$mailcontent = Dear  .$member[0] .,\n.$message .\nThis message was
sent to [2] .$member;
mail($member[2], $subject, $mailcontent, $fromaddress);
}
Why is this not parsing?

-- 
Cheers!
Dave G
[EMAIL PROTECTED]

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



Re: [PHP] Endless 'while' loops?

2003-11-02 Thread David Otton
On Mon, 3 Nov 2003 12:29:10 +0900, you wrote:

Without running the code, I can see two immediate problems.

$subject = EigoImprov Newsletter for  .member[1];

should be

$subject = EigoImprov Newsletter for  . $member[1];

Also rewrite

$mailcontent = Dear  .$member[0] .,\n.$message .\nThis message was
sent to [2] .$member;

as something closer to

$mailcontent = Dear {$member[0]},\n$message\nThis message was
sent to {$member[2]};

There are a couple of other good-practice changes you could make:

List the columns explicitly - that way your code will still work if the
database structure gets changed:

$query = select * from tablename where active = 1;

$query = SELECT col1, col2, col3 FROM tablename WHERE active = 1;

$result = mysql_query($query);

Check for failure after doing the query.

$result = mysql_query ($query);
if ($result == FALSE)
{
die (Query error);
}

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



Re: [PHP] applying one function to all array elements

2003-11-02 Thread Chris Shiflett
--- Justin French [EMAIL PROTECTED] wrote:
 Can someone show me a simple, clean way to apply one function (eg 
 stripslashes()) to every element in an array (eg $_POST)?
[snip]
 I've also seen http://www.php.net/array_walk, but couldn't 
 determine how/if it suited my needs.

Maybe you can explain how your need is not met with array_walk()?
That would be my suggestion, since it seems to do exactly what you
want, but then you mention that you have already looked at it.

It does require that the function take two parameters, which isn't
the case with stripslashes(). So, you can make a very tiny wrapper
function that discards the second parameter (since you don't need
it):

?
function array_stripslashes($var, $key)
{
 $var = stripslashes($var);
}
 
 

array_walk($_POST, 'array_stripslashes');
?

Hope that helps.

Chris

=
My Blog
 http://shiflett.org/
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



[PHP] Mailing List

2003-11-02 Thread PHPLover
Dear All,

I would like to setup a mailing list for my company.
I have a database containing email address of my clients along with other
details.
How can I send them mails ?
If i write a script containing the mail function and loop the address, I
think that might generate a script timeout error. I feel increasing the
script timeout is not a good solution. I would like to know how you manage
such situations. I feel this is a common problem but i didnt find any
solution on the net. Do I need to use any sw or are there any already
available scripts.

Thanks a Lot !!
Long Live PHP !!

Thanks  Regards, 
___ 
PHPLover
Göd döësn't pläy dícë. 
- Älbërt Ëínstëín



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

RE: [PHP] Mailing List

2003-11-02 Thread Warren Vail
Allowing scripts to run without some kind of time limit may not be prudent,
but settling for the timelimit imposed on online web pages is not reasonable
either.  I would recommend you reset the time limit to something reasonable
to perform your email tasks on the computer you have available.

http://www.php.net/manual/en/function.set-time-limit.php

As long as you don't have a run away program, I can't think of any reason
not to allow it to have the time it needs to get the job done.

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: PHPLover [mailto:[EMAIL PROTECTED]
Sent: Sunday, November 02, 2003 10:18 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Mailing List


Dear All,

I would like to setup a mailing list for my company.
I have a database containing email address of my clients along with other
details.
How can I send them mails ?
If i write a script containing the mail function and loop the address, I
think that might generate a script timeout error. I feel increasing the
script timeout is not a good solution. I would like to know how you manage
such situations. I feel this is a common problem but i didnt find any
solution on the net. Do I need to use any sw or are there any already
available scripts.

Thanks a Lot !!
Long Live PHP !!

Thanks  Regards,
___
PHPLover
Göd döësn't pläy dícë.
- Älbërt Ëínstëín

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



[PHP] Sleep Function

2003-11-02 Thread Glenn Gasner
The php.net documentation for the sleep and usleep functions has me
confused.  I'm using shared hosting and I need to email my whole mailing
list while not clogging the shared mail server.  What I'm trying to do is
put a pause between each email sent (like 10 seconds) so I can set it up to
send a thousand (or whatever) messages without manually putting time between
batches.  My guess is that I should put a line with sleep(10); inside the
mail sending loop so that it pauses between notes.  However, the Jan-17 note
on the usleep function mentions that these kinds of loops can consume 100%
of CPU while running.  The Jan-29 note on the time() function says that
sleep uses way less CPU than wait(). I don't know how to test CPU usage of
any PHP function.  Is sleep() really so CPU intensive that I should avoid
it, is there a better function to use, or is it exactly what I need and
it'll be no problem even on a shared server?

Thanks!
Glenn Gasner
glenn at perex dot com

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