php-general Digest 13 Jan 2006 02:25:04 -0000 Issue 3902

2006-01-12 Thread php-general-digest-help

php-general Digest 13 Jan 2006 02:25:04 - Issue 3902

Topics (messages 228524 through 228550):

Informix webdtablade and php functions
228524 by: HENCHOZ Daniel
228525 by: Jochem Maas
228535 by: HENCHOZ Daniel

Re: private, public, protected in 4.3.11
228526 by: Zareef Ahmed

preg_replace - I don't have a clue
228527 by: Frank Bax

input validation?
228528 by: William Stokes
228529 by: Jay Blanchard
228530 by: Silvio Porcellana
228531 by: Larry E. Ullman
228533 by: Austin Denyer
228536 by: tg-php.gryffyndevelopment.com
228538 by: Stut
228539 by: Stut
228540 by: John Meyer

Low-Cost TPMS And A Exciting Giant Market
228532 by: new_car_part

Re: text size
228534 by: tedd

Re: Sending mail with php-
228537 by: Dotan Cohen

Suggestions for the PHP team?
228541 by: tatsudoshi
228542 by: Jay Blanchard

Help for ISPs rolling out PHP
228543 by: Ben Rockwood
228544 by: Timothy Brier

question about compositing objects
228545 by: jonathan
228546 by: Tim Boring
228547 by: Mark
228549 by: comex
228550 by: Aaron Koning

XML-Request
228548 by: Ron Eggler (Paykiosks)

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:
php-general@lists.php.net


--
---BeginMessage---

Hello,

I've installed a SUN server under Solaris 9 with Apache 2.0.55, PHP 
5.1.1, Informix 9.40.UC6, Informix Client SDK 2.90.UC3, Informix 
Webdatablade 4.13.UC3. Now I try to get information from the Informix 
database via a PHP ifx_connect function and on the same apache server 
using the Informix webdatablade tool (old pages not yet migrated ...).


The php and informix modules are loaded in the apache httpd.conf :

#IBM Informix Web DataBlade DSO Module Added
LoadModuleinformix_module   
/d3/apache2/wwwdbdev/ifmx-bin/drvapch2.so


# Load the necessary PHP modules
LoadModule php5_modulemodules/libphp5.so

I'm not able to have php and webdatablade connections to informix work 
together ...



Case 1:
---

If I load the informix module first in the httpd.conf file the php ifx 
functions doesn't work and I get the following incomplete error message :


*Warning*: ifx_connect() [function.ifx-connect 
https://furio.unil.ch/php-dhz/function.ifx-connect]: E [SQLSTATE= in 
*/d3/apache2/wwwdbdev/php-dhz/testifmx.php* on line *3*


*Warning*: ifx_query(): supplied argument is not a valid Informix link 
resource in */d3/apache2/wwwdbdev/php-dhz/testifmx.php* on line *4*


*Warning*: printf() [function.printf 
https://furio.unil.ch/php-dhz/function.printf]: Too few arguments in 
*/d3/apache2/wwwdbdev/php-dhz/testifmx.php* on line *7*


The php script is below :

?php

$ConnId = ifx_connect ([EMAIL PROTECTED],xx,xx);
$ResId = ifx_query (SELECT * FROM dhtable, $ConnId);

if (! $ResId) {
   printf(Can't select names : %s\nbr /%sbr /\n, ifx_error());
   ifx_errormsg();
   die;
}
ifx_htmltbl_result($ResId, border=\1\);
ifx_free_result($ResId);

ifx_close($ConnId);
?

On the other hand the webdatablade connection works normally ...


Case 2:
---

If I load the php module before the informix module in the httpd.conf 
file, the php ifx_connect function works correctly, but now the 
wedatablade connection fails (never answer) 




I need the two ways to connect to the database, since we actually still 
use both  I've asked IBM for a solution, but they propose me to 
submit this problem to PHP people since IBM didn't develop the ifx 
functions to connect to the informix database via PHP.



Any help would be appreciated !

Best regards

Daniel

--

###
Daniel HENCHOZ ///  WEB   : http://www.danielhenchoz.ch
Computer center   ///   EMAIL : [EMAIL PROTECTED]
University of Lausanne   ///MOBILE/SMS: ++41 79 206.51.81
Amphimax/// FAX   : ++41 21 692.22.49
1015 LAUSANNE  ///  PHONE : ++41 21 692.22.20
SWITZERLAND   ///
###


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

is it possible that you are only allowing a single connection (or a number of
them) and that when apache comes up it's child processes eat up all the
[persistent?] connections so that there are none left for any other process?

HENCHOZ Daniel wrote:

Hello,

I've installed a SUN server under Solaris 9 with Apache 2.0.55, PHP 
5.1.1, Informix 9.40.UC6, Informix Client SDK 2.90.UC3, Informix 
Webdatablade 4.13.UC3. Now I try to get information from the Informix 
database via a PHP ifx_connect function and on the same apache server 
using the 

Re: [PHP] Re: Sending mail with php-

2006-01-12 Thread Sameer N Ingole

James Benson wrote:


alter the sendmail configuration file: /etc/mail/local-host-names

If that dont work you need to setup DNS for your machine.

James Benson wrote:

You need a domain name pointing to your IP address for a start, then 
you either need to configure php.ini to use the correct email or you 
should pass the additional param to sendmail, as shown below.



Taken from  php.net:

The additional_parameters parameter can be used to pass an additional 
parameter to the program configured to use when sending mail using 
the sendmail_path  configuration setting. For example, this can be 
used to set the envelope sender address when using sendmail with the 
-f sendmail option.


The user that the webserver runs as should be added as a trusted 
user to the sendmail configuration to prevent a 'X-Warning' header 
from being added to the message when the envelope sender (-f) is set 
using this method. For sendmail users, this file is 
/etc/mail/trusted-users.




 The additional_parameters parameter can be used to pass an 
additional parameter to the program configured to use when sending 
mail using the sendmail_path.

?php
mail('[EMAIL PROTECTED]', 'the subject', 'the message', null,
   '[EMAIL PROTECTED]');
?



James


Dotan Cohen wrote:


On my home Fedora Core 4 box I run Apache 2.0. Sometimes when sending
mail with php no mail is delivered, and I find this in the logs:

 550-Verification failed for [EMAIL PROTECTED]
 550-unrouteable mail domain localhost.localdomain
 550 Sender verify failed

So I changed the only email address in httpd.conf to:
ServerAdmin [EMAIL PROTECTED]

But I still get the error! I did restart apache and even went so far 
as to

reboot the machine. If I cannot modify the parameter within apache,
then where should I modify it? Within php? Within sendmail?


Do you get this message for all the domains you send the mail to? or you 
get this message from some specific domains?

Did mails went to thses domains without problems earlier?
When you send mail to gmail.com address check if it is in buld or spam 
folder.


Regards,

--
Sameer N. Ingole
Blog: http://weblogic.noroot.org/

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



[PHP] More newsgroup problems

2006-01-12 Thread Lester Caine
This is more a test, I have been trying to look at the lists on the 
newserver, but I am getting an error - you are on a blocking list, 
connection refused


So if this gets through via eMail where do I go next to get php.db and 
php.pecl.dev working again on news?


--
Lester Caine
-
L.S.Caine Electronic Services
Treasurer - Firebird Foundation Inc.

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



[PHP] Re: array of checkbox values

2006-01-12 Thread Sjef
Interesting way to solve the problem. I thought about checking whether the 
keys are present (if not the checkbox is set to N.)
I wil definitily try this option as well.
Thxs all!
Sjef

Al [EMAIL PROTECTED] schreef in bericht 
news:[EMAIL PROTECTED]
 Sjef Janssen wrote:
 Hallo,
 I have a form with a number of checkboxes grouped together. The value of
 these boxes is stored in an array: $used[]. Now I found that the value of
 checked boxes (value = 'Y') are stored in the array while non checked 
 boxes
 are not stored at all. This makes the array incomplete as I want to have 
 all
 checkbox values in the array.
 For example: for 4 checkboxes the values are
 checkbox 1: array index  = 0 value = Y
 checkbox 2: array index = 1 value = Y
 checkbox 3: value = N : it does not occur in the array
 checkbox 4: array index = 2 value = Y

 Is there a way to, as it were, complete the array and have all values
 stored, even the N values? So that array index 2 has a value of N, 
 and
 array index 3 is Y.

 Thxs

 Sjef

 Seems like I recall solving this problem.  It's been a long time, so 
 you'll need to try it.

 For each checkbox set these two
 input type=hidden name=foo value=noinput type=checkbox 
 name=foo value=yes

 You'll get $_POST[foo] as no or yes 

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



Re: [PHP] private, public, protected in 4.3.11

2006-01-12 Thread Aaron Koning
exception, final, php_user_filter, interface, implements, extends, public,
private, protected, abstract, clone, try, catch, throw where not introduced
until PHP 5 (http://ca3.php.net/reserved).

Therefore, var is the only way to define member variables prior to PHP 5.

Aaron



On 1/11/06, Peter Lauri [EMAIL PROTECTED] wrote:

 Hi,



 Example code that I try to run in version 4.3.11:



 Class Page {

 private $myID;



 function Page() {

 $this-myID=1;

 }



 function getID() {

 return $this-myID;

 }



 }



 But I get error message:



 Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or
 `T_VAR' or `'}'' in C:\Documents and Settings\Peter Lauri\My Documents\DWS
 Asia\webserver\ework\classes\page.class.php on line 8



 If I change to

 var $myID;

 it works.



 What is wrong?



 /Peter











Re: [PHP] Sending mail with php-

2006-01-12 Thread Jochem Maas

Richard Heyes wrote:
and phpmailer - thats also be known to help me from myself (when it 
comes to
make a pig's ear of using the mail() function) - 3 cheers for Richard 
Heyes
(you just know a class rocks when you can actually name the author by 
heart! :-).



Actually it's HTMLMimeMail - phpmailer is someone elses. :-)


P(*#%)(*#% RE%) call me an ass.

ps - love the pointless refactoring for the php5 version. bravo! :-)



http://www.phpguru.org/mime.mail.html



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



Re: [PHP] javascript in php page to use window.open()

2006-01-12 Thread Rodolfo Andrade
Hi Olga,

Your Javascript window.open() is missing one argument, the name of the
pop-up window:

window.open(\add.html\,\MyWindowName\,\resizable=no,width=400,height=20
0\);

Best Regards,
Rodolfo Andrade

- Original Message - 
From: Olga Urban
To: php-general@lists.php.net
Sent: Thursday, January 12, 2006 2:51 AM
Subject: [PHP] javascript in php page to use window.open()


Hi everyone,

I am trying to open a new window after a successful function call (I
don't want to use a href. and onclick). Here's what I have, but for
some reason, in IE the new window does not open (I have popup blockers
disabled). It opens in Mozilla, but with the wrong size. What am I doing
wrong here?

if (insert($lname, $fname, $course, $date, $media1,
$media2))
{
echo script type=\text/javascript\\n;
echo 
window.open(\add.html\,\resizable=no,width=400,height=200\);;
echo /script\n\n;
}
else
echo Error adding a record.;



Thanks.

Olga

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



[PHP] transferring db info

2006-01-12 Thread Ross
I am thinking about buying a vps for a year of so until a client of mine 
updates their dodgy server.


Can you just export the mysql? Will the pdfs be exported as binary data? 
Will I have to re-upload them? (there are hundereds).


R. 

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



Re: [PHP] transferring db info

2006-01-12 Thread David Grant
Ross,

Ross wrote:
 Can you just export the mysql? Will the pdfs be exported as binary data? 
 Will I have to re-upload them? (there are hundereds).

Try using mysqldump to pull the data into a flat file full of SQL
statements.  You can then use the mysql command to reinsert the data.

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] php + mysql - timstamp - calculate hours remaining

2006-01-12 Thread Gregory Machin
Many Thanks for the help.

OP 2 worked a treat.. now i need to run it at midnight,  I was  going to
write a  php script  and call  it vai  crontab,  but  how could  I iplament
this a  triger and stored procedure ?



On 1/10/06, M. Sokolewicz [EMAIL PROTECTED] wrote:

 David Grant wrote:
  Gregory,
 
  David Grant wrote:
 
 Gregory Machin wrote:
 
 I have a table with a timestamp column and would like to use his to
 calculate the age of the record . how would i go about this...
 I would also like to exicute a mysql stament that pasess the tables and
 removes fields older than say 72 hours. how would i go about this . ?
 
 A timestamp is the time in seconds (since Jan 1 1970), so you can
 ascertain the age in seconds by subtracting the stored timestamp from
 the current timestamp.
 
 You can find the current timestamp in MySQL using the
 CURRENT_TIMESTAMP() function.
 
 Once you have the age of the record, finding 72 hours is fairly trivial
 - 72 hours is 259200 seconds (72hrs * 60mins * 60secs).
 
 Therefore your query will be:
 
 DELETE FROM TABLE WHERE CURRENT_TIMESTAMP() - FIELD  259200
 
 
  Following Albert's reply, the query ought to read:
 
  DELETE FROM TABLE WHERE CURRENT_TIMESTAMP() - UNIX_TIMESTAMP(FIELD 
  259200
 
  David
 David, your solution is correct (though you made a typo; it should read:
 DELETE FROM TABLE WHERE CURRENT_TIMESTAMP() - UNIX_TIMESTAMP(FIELD)
  259200), though slow because mysql needs to calculate a timestamp,
 based on all the times/dates stored. Now, all these methods depend on
 how the OP stored the dates in his database. In general, there are 2
 ways which are used most often:
 1 - As a UNIX timestamp (as per Albert's example), or
 2 - As a MySQL-timestamp (as per ISO 8601; -MM-DD)

 If the OP uses #1 to store the date, the easiest way is to do a
 modification of David's solution, and do:
 DELETE FROM TABLE WHERE field  UNIX_TIMESTAMP(NOW())-259200, this
 is a quick solution, because all MySQL now needs to do is compare an
 integer to an integer for each row (which is pretty fast).
 If the OP uses #2, then it's easier to use MySQL's built-in functions
 for date-comparison. It's actually faster than converting the dates to
 UNIX timestamps and comparing them as per #1, so let's do that. To
 achieve this, you can use mysql's own date functions:
 DELETE FROM TABLE WHERE field  NOW()- INTERVAL 72 HOUR

 hope this short discussion helped,
 - tul




--
Gregory Machin
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.linuxpro.co.za
www.exponent.co.za
Web Hosting Solutions
Scalable Linux Solutions
www.iberry.info (support and admin)

+27 72 524 8096


RE: [PHP] transferring db info

2006-01-12 Thread Albert
David Grant wrote:
 Ross wrote:
  Can you just export the mysql? Will the pdfs be exported as binary data?

  Will I have to re-upload them? (there are hundereds).

 Try using mysqldump to pull the data into a flat file full of SQL
 statements.  You can then use the mysql command to reinsert the data.

An alternate method, which I found to be more reliable, would be to put the
database files in a tarball, transfer it to the new server and then extract
the tarball into the database directory.

I am running MySQL on a Linux server. The databases are in /var/lib/mysql.

If your database is called db then there will be a db directory in
/var/lib/mysql.

Before making the backup you either need to stop MySQL (preferred) or flush
all data to tables and make sure nothing is writing/reading to/from the
database.

To put it in a tarball:
origin# cd /var/lib/mysql
origin# tar cvf db_backup_20060112.tar db

You then copy that db_backup_20060112.tar file to the MySQL data directory
of your destination server and once it's there extract it again:
origin# scp db_backup_20060112.tar [EMAIL PROTECTED]
destination# cd /var/lib/mysql
destination# tar xvf db_backup_20060112.tar

You then might need to set permissions if the UID of your origin server
MySQL user and destination server MySQL user is not the same.

After starting MySQL server on your destination server you should have the
database exactly like it was on the original.

BTW you can transfer MySQL data files from a Windows machine to a Linux
machine and vice versa without any issues. There is a note in the MySQL
documentation of the formatting your Windows server should use (to do with
case sensitivity)

HTH

Albert

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.17/227 - Release Date: 2006/01/11
 

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



[PHP] Informix webdtablade and php functions

2006-01-12 Thread HENCHOZ Daniel

Hello,

I've installed a SUN server under Solaris 9 with Apache 2.0.55, PHP 
5.1.1, Informix 9.40.UC6, Informix Client SDK 2.90.UC3, Informix 
Webdatablade 4.13.UC3. Now I try to get information from the Informix 
database via a PHP ifx_connect function and on the same apache server 
using the Informix webdatablade tool (old pages not yet migrated ...).


The php and informix modules are loaded in the apache httpd.conf :

#IBM Informix Web DataBlade DSO Module Added
LoadModuleinformix_module   
/d3/apache2/wwwdbdev/ifmx-bin/drvapch2.so


# Load the necessary PHP modules
LoadModule php5_modulemodules/libphp5.so

I'm not able to have php and webdatablade connections to informix work 
together ...



Case 1:
---

If I load the informix module first in the httpd.conf file the php ifx 
functions doesn't work and I get the following incomplete error message :


*Warning*: ifx_connect() [function.ifx-connect 
https://furio.unil.ch/php-dhz/function.ifx-connect]: E [SQLSTATE= in 
*/d3/apache2/wwwdbdev/php-dhz/testifmx.php* on line *3*


*Warning*: ifx_query(): supplied argument is not a valid Informix link 
resource in */d3/apache2/wwwdbdev/php-dhz/testifmx.php* on line *4*


*Warning*: printf() [function.printf 
https://furio.unil.ch/php-dhz/function.printf]: Too few arguments in 
*/d3/apache2/wwwdbdev/php-dhz/testifmx.php* on line *7*


The php script is below :

?php

$ConnId = ifx_connect ([EMAIL PROTECTED],xx,xx);
$ResId = ifx_query (SELECT * FROM dhtable, $ConnId);

if (! $ResId) {
   printf(Can't select names : %s\nbr /%sbr /\n, ifx_error());
   ifx_errormsg();
   die;
}
ifx_htmltbl_result($ResId, border=\1\);
ifx_free_result($ResId);

ifx_close($ConnId);
?

On the other hand the webdatablade connection works normally ...


Case 2:
---

If I load the php module before the informix module in the httpd.conf 
file, the php ifx_connect function works correctly, but now the 
wedatablade connection fails (never answer) 




I need the two ways to connect to the database, since we actually still 
use both  I've asked IBM for a solution, but they propose me to 
submit this problem to PHP people since IBM didn't develop the ifx 
functions to connect to the informix database via PHP.



Any help would be appreciated !

Best regards

Daniel

--

###
Daniel HENCHOZ ///  WEB   : http://www.danielhenchoz.ch
Computer center   ///   EMAIL : [EMAIL PROTECTED]
University of Lausanne   ///MOBILE/SMS: ++41 79 206.51.81
Amphimax/// FAX   : ++41 21 692.22.49
1015 LAUSANNE  ///  PHONE : ++41 21 692.22.20
SWITZERLAND   ///
###




Re: [PHP] Informix webdtablade and php functions

2006-01-12 Thread Jochem Maas

is it possible that you are only allowing a single connection (or a number of
them) and that when apache comes up it's child processes eat up all the
[persistent?] connections so that there are none left for any other process?

HENCHOZ Daniel wrote:

Hello,

I've installed a SUN server under Solaris 9 with Apache 2.0.55, PHP 
5.1.1, Informix 9.40.UC6, Informix Client SDK 2.90.UC3, Informix 
Webdatablade 4.13.UC3. Now I try to get information from the Informix 
database via a PHP ifx_connect function and on the same apache server 
using the Informix webdatablade tool (old pages not yet migrated ...).


The php and informix modules are loaded in the apache httpd.conf :

#IBM Informix Web DataBlade DSO Module Added
LoadModuleinformix_module   
/d3/apache2/wwwdbdev/ifmx-bin/drvapch2.so


# Load the necessary PHP modules
LoadModule php5_modulemodules/libphp5.so

I'm not able to have php and webdatablade connections to informix work 
together ...



Case 1:
---

If I load the informix module first in the httpd.conf file the php ifx 
functions doesn't work and I get the following incomplete error message :


*Warning*: ifx_connect() [function.ifx-connect 
https://furio.unil.ch/php-dhz/function.ifx-connect]: E [SQLSTATE= in 
*/d3/apache2/wwwdbdev/php-dhz/testifmx.php* on line *3*


*Warning*: ifx_query(): supplied argument is not a valid Informix link 
resource in */d3/apache2/wwwdbdev/php-dhz/testifmx.php* on line *4*


*Warning*: printf() [function.printf 
https://furio.unil.ch/php-dhz/function.printf]: Too few arguments in 
*/d3/apache2/wwwdbdev/php-dhz/testifmx.php* on line *7*


The php script is below :

?php

$ConnId = ifx_connect ([EMAIL PROTECTED],xx,xx);
$ResId = ifx_query (SELECT * FROM dhtable, $ConnId);

if (! $ResId) {
   printf(Can't select names : %s\nbr /%sbr /\n, ifx_error());
   ifx_errormsg();
   die;
}
ifx_htmltbl_result($ResId, border=\1\);
ifx_free_result($ResId);

ifx_close($ConnId);
?

On the other hand the webdatablade connection works normally ...


Case 2:
---

If I load the php module before the informix module in the httpd.conf 
file, the php ifx_connect function works correctly, but now the 
wedatablade connection fails (never answer) 




I need the two ways to connect to the database, since we actually still 
use both  I've asked IBM for a solution, but they propose me to 
submit this problem to PHP people since IBM didn't develop the ifx 
functions to connect to the informix database via PHP.



Any help would be appreciated !

Best regards

Daniel



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



Re: [PHP] private, public, protected in 4.3.11

2006-01-12 Thread Zareef Ahmed
Hi Peter,

   Code you are using is for php version 5. That is one in only reason.
You need to install PHP version 5 to run this code or just do it as simple
$var type declaration.

Zareef Ahmed

- Original Message - 
From: Peter Lauri [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Thursday, January 12, 2006 1:28 AM
Subject: [PHP] private, public, protected in 4.3.11


 Hi,



 Example code that I try to run in version 4.3.11:



 Class Page {

 private $myID;



 function Page() {

 $this-myID=1;

 }



 function getID() {

 return $this-myID;

 }



 }



 But I get error message:



 Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or
 `T_VAR' or `'}'' in C:\Documents and Settings\Peter Lauri\My Documents\DWS
 Asia\webserver\ework\classes\page.class.php on line 8



 If I change to

 var $myID;

 it works.



 What is wrong?



 /Peter









PHP Expert Consultancy in Development  http://www.indiaphp.com
Yahoo! : consultant_php MSN : [EMAIL PROTECTED]





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



[PHP] preg_replace - I don't have a clue

2006-01-12 Thread Frank Bax
As I understand the docs for preg_replace(), I can enclose an PCRE 
expression in parenthesis and use a backreference in the replace string; 
but it's not working!


Data coming from another system contains a lot of data in one text record 
which I must parse.  Individual elements in the record are separated by 
$.  I want to fix elements that contain

dollar-alpha-space-space-digits-dollar
and replace the second space (between word and number) with a plus 
character to end up with

dollar-alpha-space-plus-digits-dollar

An example of input string:
$prop = '$Fencing  11$Lumber  17$Weight: 317 Stones$Energy Resist 
2%$';

Notice that Fencing and Lumber have two spaces.  I want to end up with:
$prop = '$Fencing +11$Lumber +17$Weight: 317 Stones$Energy Resist 
2%$';

Notice that original and final strings are the same length.

reg_replace( '  (\d+\$)', '+$1', $prop );   /* results in 
dollar-alpha-space-space-plus, why have digits-dollar have disappeared? */

$Fencing  +Lumber  +Weight: 317 Stones$Energy Resist 2%$


Although the docs say that $0 should backreference the whole pattern, 
instead it seems to match   the pattern in parenthesis, but this code :
reg_replace( '  (\d+\$)', '+$0', $prop );   /* results in 
dollar-alpha-space-space-plus-digits-dollar */

$Fencing  +11$Lumber  +17$Weight: 317 Stones$Energy Resist 2%$

Still contains the two blanks!!

In neither of my test cases is the result string the same length as original.

I'm running PHP 4.4.0 on OpenBSD 3.7 


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



[PHP] input validation?

2006-01-12 Thread William Stokes
Hello,

I need to check that user input text is less than 300 characters long. How?

Thanks
-Will 

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



RE: [PHP] input validation?

2006-01-12 Thread Jay Blanchard
[snip]
I need to check that user input text is less than 300 characters long. How?
[/snip]

string length, it's in the manual.

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



Re: [PHP] input validation?

2006-01-12 Thread Silvio Porcellana
William Stokes wrote:
 Hello,
 
 I need to check that user input text is less than 300 characters long. How?
 
 Thanks
 -Will 
 

Try with strlen:
http://php.net/strlen

Silvio

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



Re: [PHP] input validation?

2006-01-12 Thread Larry E. Ullman
I need to check that user input text is less than 300 characters  
long. How?


if (strlen($_POST['input'])  300) { ...

You may want to also apply trim() to the input text to get rid of  
extraneous white space at the beginning and end of the input.


Larry

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



Re: [PHP] input validation?

2006-01-12 Thread Austin Denyer

On Thu, 12 Jan 2006 16:56:43 +0200
William Stokes [EMAIL PROTECTED] wrote:

 Hello,
 
 I need to check that user input text is less than 300 characters
 long. How?

if(strlen($UserInputText)  300){
echo(Too long);
}

See http://www.php.net/manual/en/print/function.strlen.php

Regards,
Ozz.


pgpeKLczT0L1F.pgp
Description: PGP signature


Re: [PHP] text size

2006-01-12 Thread tedd

Hi,

I have a variable called $text_size which can be small, medium or
large.

The value is submitted by a text link

 a href=? $_SERVER['PHP_SELF'];  ??text_size=small class=size1A/a
a href=? $_SERVER['PHP_SELF']; ??text_size=medium class=size2A/a
a href=? $_SERVER['PHP_SELF']; ??text_size=large class=size3A


At the start of the page I initialise it to small if it hasn't been set

$text_size = isset($_GET['text_size'] ) ? $_GET['text_size'] : 'small'

What I want to do is store the most current value for $text_size in a
session $_SESSION['text_size'] and then if I move to the next page start a
session and use the strored value so the value is not reset on every page.

R.


R:

Use php to change your css.

I explain and provide an example here:

http://www.sperling.com/examples/styleswitch/

tedd

--

http://sperling.com/

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



Re: [PHP] Informix webdtablade and php functions

2006-01-12 Thread HENCHOZ Daniel
No, actually there is no limitation for the number of connection to the 
database ...


Thanks

Daniel

Jochem Maas wrote:

is it possible that you are only allowing a single connection (or a 
number of

them) and that when apache comes up it's child processes eat up all the
[persistent?] connections so that there are none left for any other 
process?


HENCHOZ Daniel wrote:


Hello,

I've installed a SUN server under Solaris 9 with Apache 2.0.55, PHP 
5.1.1, Informix 9.40.UC6, Informix Client SDK 2.90.UC3, Informix 
Webdatablade 4.13.UC3. Now I try to get information from the Informix 
database via a PHP ifx_connect function and on the same apache server 
using the Informix webdatablade tool (old pages not yet migrated ...).


The php and informix modules are loaded in the apache httpd.conf :

#IBM Informix Web DataBlade DSO Module Added
LoadModuleinformix_module   
/d3/apache2/wwwdbdev/ifmx-bin/drvapch2.so


# Load the necessary PHP modules
LoadModule php5_modulemodules/libphp5.so

I'm not able to have php and webdatablade connections to informix 
work together ...



Case 1:
---

If I load the informix module first in the httpd.conf file the php 
ifx functions doesn't work and I get the following incomplete error 
message :


*Warning*: ifx_connect() [function.ifx-connect 
https://furio.unil.ch/php-dhz/function.ifx-connect]: E [SQLSTATE= 
in */d3/apache2/wwwdbdev/php-dhz/testifmx.php* on line *3*


*Warning*: ifx_query(): supplied argument is not a valid Informix 
link resource in */d3/apache2/wwwdbdev/php-dhz/testifmx.php* on line *4*


*Warning*: printf() [function.printf 
https://furio.unil.ch/php-dhz/function.printf]: Too few arguments 
in */d3/apache2/wwwdbdev/php-dhz/testifmx.php* on line *7*


The php script is below :

?php

$ConnId = ifx_connect ([EMAIL PROTECTED],xx,xx);
$ResId = ifx_query (SELECT * FROM dhtable, $ConnId);

if (! $ResId) {
   printf(Can't select names : %s\nbr /%sbr /\n, ifx_error());
   ifx_errormsg();
   die;
}
ifx_htmltbl_result($ResId, border=\1\);
ifx_free_result($ResId);

ifx_close($ConnId);
?

On the other hand the webdatablade connection works normally ...


Case 2:
---

If I load the php module before the informix module in the httpd.conf 
file, the php ifx_connect function works correctly, but now the 
wedatablade connection fails (never answer) 




I need the two ways to connect to the database, since we actually 
still use both  I've asked IBM for a solution, but they propose 
me to submit this problem to PHP people since IBM didn't develop the 
ifx functions to connect to the informix database via PHP.



Any help would be appreciated !

Best regards

Daniel







--

###
Daniel HENCHOZ ///  WEB   : http://www.danielhenchoz.ch
Computer center   ///   EMAIL : [EMAIL PROTECTED]
University of Lausanne   ///MOBILE/SMS: ++41 79 206.51.81
Amphimax/// FAX   : ++41 21 692.22.49
1015 LAUSANNE  ///  PHONE : ++41 21 692.22.20
SWITZERLAND   ///
###

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



Re: [PHP] input validation?

2006-01-12 Thread tg-php
Hmm.. I didn't see anyone ask before or after the user clicks SUBMIT?

If it's before, then you should use javascript to check the form element prior 
to submitting (you can check realtime with the onkeydown, onkeyup events...  
check after a user moves off of the form element with onchange or even 
onfocus/onblur... or when the user clicks 'submit' with the onsubmit event).

Whenever you check it... it's going to be something like 
forms[formnameornumber].formelementname.length   or something like that in JS.


If it's after the user submits the form, then yeah, what everyone else said..  
strlen($data) (where $data contains the information submitted).

-TG

= = = Original message = = =

Hello,

I need to check that user input text is less than 300 characters long. How?

Thanks
-Will 


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



Re: [PHP] Re: Sending mail with php-

2006-01-12 Thread Dotan Cohen
On 1/12/06, Sameer N Ingole [EMAIL PROTECTED] wrote:
 James Benson wrote:
 Do you get this message for all the domains you send the mail to? or you
 get this message from some specific domains?
 Did mails went to thses domains without problems earlier?
 When you send mail to gmail.com address check if it is in buld or spam
 folder.

 Regards,

 Sameer N. Ingole
 Blog: http://weblogic.noroot.org/

Not all- Yahoo for instance gives me no problems. Gmail _sometimes_
accepts and sometimes doesn't. But I guess that inconsistent behaviour
is to be expected from a beta service. Both of them deliver to the
Inbox.

I think that I now have a solution in James Benson's advice. I just
haven't had the time to implement it (university). I'll get on it this
evening.

Thans, all!

Dotan Cohen
http://technology-sleuth.com/question/what_are_the_advantages_of_lcd_monitors.html
183


Re: [PHP] input validation?

2006-01-12 Thread Stut

[EMAIL PROTECTED] wrote:


Hmm.. I didn't see anyone ask before or after the user clicks SUBMIT?
 



Probably because this is a PHP list and nothing that happens on the 
client side is a) controllable by PHP or b) guaranteed. Whatever you do 
on the client side you should always validate anything coming from the 
client on the serverside.


-Stut

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



Re: [PHP] input validation?

2006-01-12 Thread Stut

[EMAIL PROTECTED] wrote:


I disagree...  PHP frequently involves interacting with or outright using 
alternative technologies to accomplish your goal.  This includes HTML, XML, 
databases, etc.  To effectively use PHP you need to understand your options and 
the pros/cons in using the other technologies.

PHP isn't a total solution for most situations.  Suggesting that all problems 
be solved with PHP just because it's a PHP mailing list is shortsighted and I 
believe *that* can do more harm for novice developers than not suggesting 
alteratives.

Ok, you're clearly missing my point and while I don't want this to 
degrade into the usual pissing contest I do feel I need to clarify what 
I was saying.


I completely agree that in this case Javascript should be used to 
provide the user with feedback as to how close to the limit they are. 
However, in your post you described the solution as either Javascript 
*or* PHP when the best solution is both. What I was pointing out is that 
while Javascript is a better solution from a usability point of view, 
not doing the validation with PHP is dangerous regardless of whether the 
length is validated using Javascript or not.


I certainly don't believe that PHP is the total solution for most 
situations, but when it comes to input validation you *need* to do 
validation on the server-side regardless of what validation you do with 
Javascript since you have no control over whether the Javascript gets 
executed.


Off to get more coffee ;)

-Stut

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



Re: [PHP] input validation?

2006-01-12 Thread John Meyer

Stut wrote:
Ok, you're clearly missing my point and while I don't want this to 
degrade into the usual pissing contest I do feel I need to clarify 
what I was saying.


I completely agree that in this case Javascript should be used to 
provide the user with feedback as to how close to the limit they are. 
However, in your post you described the solution as either Javascript 
*or* PHP when the best solution is both. What I was pointing out is 
that while Javascript is a better solution from a usability point of 
view, not doing the validation with PHP is dangerous regardless of 
whether the length is validated using Javascript or not.


I certainly don't believe that PHP is the total solution for most 
situations, but when it comes to input validation you *need* to do 
validation on the server-side regardless of what validation you do 
with Javascript since you have no control over whether the Javascript 
gets executed.


This sounds almost like the old DB vs. Application logic debate I see on 
several mailing lists; whether you should store more logic in the DB 
Server through triggers or through application logic.  My point on this 
is that it boils down to how important that data is.  If it's somebody's 
comments on their blog or on a post, I'd just leave it on the 
application _or_ trim it down to the 300 characters and input it in.  
bank transactions, I'd have so many triggers going it would be unreal.


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



[PHP] Suggestions for the PHP team?

2006-01-12 Thread tatsudoshi
Hello newsgroup.

I was just woundering where do a php coder send his suggestions regarding 
PHP?

tatsudoshi 

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



RE: [PHP] Suggestions for the PHP team?

2006-01-12 Thread Jay Blanchard
[snip]
I was just woundering where do a php coder send his suggestions regarding 
PHP?
[/snip]

There is a PHP-DEV mailing list which would probably be the best place. See
http://www.php.net/mailinglists

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



[PHP] Help for ISPs rolling out PHP

2006-01-12 Thread Ben Rockwood
I'm working with a medium sized ISP to start rolling out PHP and MySQL
services to customers.  I've been looking around for best practices or help
with such a roll out but not found anything.  I'm confident I can roll out
the services but with so many other ISPs currently running PHP it seems like
I could save my self a lot of mistakes and grief if I could learn from
admins that have already done it.

Is anyone aware of a resource specifically about rolling out PHP to a large
number of users in an ISP setting?  Specifically dealing with security
issues like a user doing an unlink(../otheruser/index.html); ?

Any pointers and experience are appreciated.  Thank You.

technikolor


Re: [PHP] Help for ISPs rolling out PHP

2006-01-12 Thread Timothy Brier

Ben Rockwood wrote:

I'm working with a medium sized ISP to start rolling out PHP and MySQL
services to customers.  I've been looking around for best practices or help
with such a roll out but not found anything.  I'm confident I can roll out
the services but with so many other ISPs currently running PHP it seems like
I could save my self a lot of mistakes and grief if I could learn from
admins that have already done it.

Is anyone aware of a resource specifically about rolling out PHP to a large
number of users in an ISP setting?  Specifically dealing with security
issues like a user doing an unlink(../otheruser/index.html); ?

Any pointers and experience are appreciated.  Thank You.

technikolor

  

This link may be of some use:

http://www.webhostgear.com/166.html

Tim.

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



Re: [PHP] question about compositing objects

2006-01-12 Thread Tim Boring
Hi, Jonathan!

On Thu, 2006-01-12 at 14:13 -0800, jonathan wrote:
 I have a class which creates another class within it such as:
 
 class Loc{
 
 public function outputInfo()
 {
   
 
   $map=new Map();
   
   $map-setKey();
   
 
 }
 
 }
 
 In my main page can I access the $map object like this:
 
 $loc=new Loc();
 
 $loc-map-publicMapFunction();

Depending on what you're trying to accomplish, it looks like you're
running into a scope issue.  According to the code sample you provided,
the $map object is local to the Loc::outputInfo() method.  So, inside
this method, you can access the $map object like
$map-publicMapFunction() provided your Map class defines the
publicMapFunction() method.

If you want to access the $map object outside the outputInfo() method
defined in the Loc class, then you'll need to return the $map object or
provide some other interface to it within the Loc class.  

One way to do this would be something like this in the class definition:

class Loc{

public function outputInfo()
{
$map = new Map();
$map-setKey();
return $map;
}

}

Next, in your main page you might do this:
$loc = new Loc();
$myMap = $loc-outputInfo();

Now, if you have the method publicMapFunction() defined in your Map
class, you should be able to access it like this:

$myMap-publicMapFunction();

I'm not sure the my example above is the best way to go about this...but
without knowing exactly what it is you're trying to accomplish I think
it at least should point you in the right direction.  

You'll also need to be aware of the difference between how PHP4 and PHP5
handle objects to know whether you're operating on a copy of an object
or a reference to the actual object itself.  

Hope that helps!

Tim 

-- 
Tim Boring
IT Manager
Automotive Distributors Warehouse
2981 Morse Road
Columbus, OH 43230
direct: 614-532-4240
toll free: 800-421-5556 x 4240
e-mail: [EMAIL PROTECTED]

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



[PHP] Re: question about compositing objects

2006-01-12 Thread Mark
jonathan wrote:

 I have a class which creates another class within it such as:
 
 class Loc{
 
 public function outputInfo()
 {
 
 
 $map=new Map();
 
 $map-setKey();
 
 
 }
 
 }
 
 In my main page can I access the $map object like this:
 
 $loc=new Loc();
 
 $loc-map-publicMapFunction();
 
 I thought I would be able to but it doesn't seem like it.
 
 thanks in advance.
 
 -jonathan


Try this:
class Loc
{
public var  $map;
function oputputInfo()
{
$this-map = new Map();
}
};

$loc = new Loc();
$lock-outputInfo();

$loc-map-publicMapFunction();

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



[PHP] XML-Request

2006-01-12 Thread Ron Eggler (Paykiosks)
Hi, I gotta send an XML request to a server. In the doc it's defined as
follows:
[request]
xs:request xmlns:xs='urn:pinXpressSchema' version='1.5' langCode='en'

DEALERinfo aspName=‘XXX’

dealerName=''

posName='1234'

posPassword='1234'

userName=''

userPassword='1234' /

purchasePINs transID='1234567890' ticket='true' ticketWidth='32' /

/xs:request
[/request]
and I tried to realize it that way:
[Code]
?php
 $n = \n\n;
$aspName=XXX;
$dealerName=paykiosks;
$posName=998745;
$posPasswords=998745;
$userName=;
$userPassword=;

 $inputdata = 'xs:request xmlns:xs=\'urn:pinXpressSchema\' version=\'1.5\' 
langCode=\'en\''.$n.'
 DEALERinfo aspName='.$aspName.'
 dealerName='.$dealerName.'
 posName='.$posName.'
 posPassword='.$posPassword.'
 userName='.$userName.'
 userPassword='.$userPassword.'/
   purchasePINs transID=1234567890 ticket=true ticketWidth=32 /
/xs:request';
$x = curl_init(https://xml.pinsprepaid.com/xml/xmlPinXpress.asp;);
curl_setopt($x, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($x, CURLOPT_HEADER, 0);
curl_setopt($x, CURLOPT_POST, 1);
curl_setopt($x, CURLOPT_POSTFIELDS, $inputdata);
curl_setopt($x, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($x, CURLOPT_REFERER, http://localhost/test.php;);
curl_setopt($x, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($x);
curl_close($x);
echo $data;
? 
[Code]
but I only got the Answer:
invalid xml

Why, what's going wrong? Thank you for your help!

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



Re: [PHP] question about compositing objects

2006-01-12 Thread comex
 $map=new Map();
$this-map = new Map();

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



Re: [PHP] question about compositing objects

2006-01-12 Thread Aaron Koning
$map is not a member variable of the Loc class in your code...
Instead do this:

class Loc {
  // Defines a member variable
  var $map;
  // Constructor
  function Loc() {
$this-map = new Map(); // Create map object and save to Loc object
$this-map-setKey();
  }
}

$loc = new Loc();
$loc-map-publicMapFunction();


Aaron
--



On 1/12/06, jonathan [EMAIL PROTECTED] wrote:

 I have a class which creates another class within it such as:

 class Loc{

 public function outputInfo()
 {


 $map=new Map();

 $map-setKey();


 }

 }

 In my main page can I access the $map object like this:

 $loc=new Loc();

 $loc-map-publicMapFunction();

 I thought I would be able to but it doesn't seem like it.

 thanks in advance.

 -jonathan

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




[PHP] PHP for Mac

2006-01-12 Thread Richard Correia
Hi,

I want to install PHP5 on Mac powerbook G4. Can someone please let me know
where I can find it and it's related module?

I am mainly looking for GD and mingswf module on Mac.

Thanks
Richard


[PHP] Greetings

2006-01-12 Thread Pop Mihai Sergiu



Greetings,

The scope of this document is to file a complain 
related to privacy of our offices e-mail address published all over the 
internet.
If you would care to query google for the e-mail 
: [EMAIL PROTECTED] you would 
easily see what im talking about !
A while ago i`we send one or two emails to 
PHP.NET, requesting some info related to capturing the CPU / Storage ID using 
php, 
info which would have helped me in finishing a 
php web application at that time. Since then 
my e-mail address and comments were 
posted through the internet, making my e-mail 
public to all sorts of SPAMMERS.

I understand that maybe this action was to keep 
the Question/Answerfor others to see, but i do intend to kindly ask you 
[if possible]
to hide my e-mail address from all the web 
posts.

Since my e-mail appeared online, my Inbox is 
constantly flooded with unneccessary documents that stall 
mytimeline.
Maybe it is to already too late to change 
anything, but if anything can be done, please support me in any way you can to 
get rid of this issue.

Sincerely,
Pop 
Mihai SergiuSOFTWARE POP SERVICE ELECTRONICResearch  Developement 
departmentA 
: Str. Calea Severilului, Bl 317 a.b.   200233, DOLJ, 
Craiova, RomaniaE : [EMAIL PROTECTED]W : Http://www.popservice.ro P : +(40) - 251 
483 627F : +(40) - 251 418 773M : +(40) - 744 507 700Y : res3archThis 
mail is scanned and proven not to contain any 
virus.

CONFIDENTIALITY 
NOTICE: This communication and any accompanying document(s) contains 
information from the offices of SOFTWARE POP SERVICE ELECTRONIC and may be 
confidential or privileged. The information is intended for the personal and 
confidential sole use of the individual or entity named above. If you 
receive this transmission in error, you are advised that any review, 
disclosure, copying, distribution, or the taking of any action in reliance upon 
the communication is strictly prohibited. If you have received this 
communication in error, please contact us immediately by e-mail at [EMAIL PROTECTED] or by 
telephone at (+40) 744507700. 


smime.p7s
Description: S/MIME cryptographic signature