Re: [PHP] Web live radio

2004-06-30 Thread raditha dissanayake
ascll wrote:
Greetings,
Does anyone know how to develop a web live radio using php, which could
use any one of my PCs as the 'radio station' to broadcast whatever
voices/music?
 

PHP is probably not the sbest technology for streaming content. Take a 
look at shoutcast or icecast or some other product like that which are 
custom made for this purpose.

--
Raditha Dissanayake.
-
http://www.raditha.com/megaupload/upload.php
Sneak past the PHP file upload limits.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] checkbox

2004-06-30 Thread Aris Santillan
how can process  only items with checked check-box?

--- html ---



html
head
titleUntitled Document/title
/head

body
form name=form1 method=post action=
  p 
input type=checkbox name=checkbox value=checkbox
input type=text name=textfield[1]
  /p
  p 
input type=checkbox name=checkbox value=checkbox
input type=text name=textfield[2]
  /p
  p 
input type=checkbox name=checkbox value=checkbox 
input type=text name=textfield[3]
  /p
  p 
input type=checkbox name=checkbox value=checkbox
input type=text name=textfield[4]
  /p
  p
input type=checkbox name=checkbox value=checkbox
input type=text name=textfield[5]
  /p
/form
/body
/html



--- html ---









Re: [PHP] checkbox

2004-06-30 Thread Justin Patrin
Try foreach ($_POST['textfield'] as $num = $value);

On Wed, 30 Jun 2004 15:56:35 +0800, Aris  Santillan
[EMAIL PROTECTED] wrote:
 
 how can process  only items with checked check-box?
 
 --- html ---
 
 html
 head
 titleUntitled Document/title
 /head
 
 body
 form name=form1 method=post action=
   p
 input type=checkbox name=checkbox value=checkbox
 input type=text name=textfield[1]
   /p
   p
 input type=checkbox name=checkbox value=checkbox
 input type=text name=textfield[2]
   /p
   p
 input type=checkbox name=checkbox value=checkbox
 input type=text name=textfield[3]
   /p
   p
 input type=checkbox name=checkbox value=checkbox
 input type=text name=textfield[4]
   /p
   p
 input type=checkbox name=checkbox value=checkbox
 input type=text name=textfield[5]
   /p
 /form
 /body
 /html
 
 --- html ---
 
 !DSPAM:40e26f26296421596418740!
 


-- 
paperCrane --Justin Patrin--

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



[PHP] Re: Saving variables in a session in a destructor

2004-06-30 Thread Red Wingate
Maybe you check out the internals archives as an discussion about this topic
was held 1-2 days ago.

 Hi all
 
 Using PHP5, I am trying to save some properties of an object when it
 is destroyed in its destructor, __destruct().  However, I have found
 that the session variable is NOT stored unless I explicitly destroy
 the object using unset().  If I leave php to finish executing the
 script and automatically destroy the object, the destructor IS called,
 however, the session variables are NOT saved.  A quick code example
 for clarity:
 
 -
 class StateMachine {
   public $stateVariable;
   function __destruct() {
 $_SESSION['state'] = $this-stateVariable;
   }
 }
 
 $sm = new StateMachine();
 if (isset($_SESSION['state'])) {
   $sm-stateVariable = $_SESSION['state'];
 } else {
   $sm-stateVariable = 'foobar';
 }
 
 
 (please ignore the obvious bad coding standard of making that var
 public and accessing it, this is for simplicity of the example).
 
 Unless I do an unset($sm); at the end of a script like this, the
 $_SESSION array will never contain the state=foobar key/value.
 
 Can anyone offer some insight into this?
 
 Thanks!
 Dave

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



[PHP] Re: TAB Syntax

2004-06-30 Thread Harlequin
Cheers Lars.

So, for example, if I wanted to display some plain text tabbed I'd use:

echo prestring1\tstring2\tstring3/pre;

There's just one problem though - it formats the text differently to the
rest of the page (I'm using CSS to control this).

Any thoughts...?

-- 
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-
Lars Torben Wilson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Harlequin wrote:

  I know I'm probably going to get flamed for this but it is only a
  development site but I am having some trouble getting the syntax right
for
  using the tab when echoing information. My current command is:
 
   print_r(Host: $hostbrUser: $userbrPassword: $password);
 
  I've tried:
 
   print_r(Host: \t$hostbrUser: $userbrPassword: $password);
 
  and god knows what else with the brackets etc.
 
  Any ideas...?

 It's expected behaviour, when outputting to a web browser. Browsers fold
 multiple whitespaces together. The two examples above should display
 identically. Try wrapping the above outputs in pre tags, though, to see
 the difference:

 ?php
$host = 'localhost';
$user = 'torben';
$password = 'none';

echo bThe next two examples should display identically/bbr;
echo Host: $hostbrUser: $userbrPassword: $passwordbr;
echo Host: \t$hostbrUser: $userbrPassword: $passwordbrbr;

echo Host:

 $hostbrUser: $userbrPassword: $passwordbr;
echo Host: \t$hostbrUser:\n\n\t\n$userbrPassword: $passwordbr;


echo hrbThe next two examples should display differently/bbr;
echo preHost: $hostbrUser: $userbrPassword:
$passwordbr/pre;
echo preHost: \t$hostbrUser: $userbrPassword:
$passwordbr/pre;

echo preHost:

 $hostbrUser: $userbrPassword: $passwordbr/pre;
echo preHost: \t$hostbrUser:\n\n\t\n$userbrPassword:
$passwordbr/pre;

 ?


 Hope this helps,

 Torben

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



[PHP] Re: TAB Syntax

2004-06-30 Thread Lars Torben Wilson
Harlequin wrote:
Cheers Lars.
So, for example, if I wanted to display some plain text tabbed I'd use:
echo prestring1\tstring2\tstring3/pre;
There's just one problem though - it formats the text differently to the
rest of the page (I'm using CSS to control this).
Any thoughts...?

Try adding 'white-space: pre;' to the CSS for that bit:
 div style=white-space: pre;
   ?php echo This\tis\n\ta test.; ?
 /div
See if adding that helps.
Cheers,
Torben
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Best external app from php

2004-06-30 Thread pete M
I had a similar scenario recently
the way I tackled the problem was to set a cron to trigger a cli 
script every minute

the script first checked a database to see if there was any jobs queued 
then processed in the background
works a treat
pete

C.F. Scheidecker Antunes wrote:
Hello all,
I need to have a web application to call an external app that needs to 
execute on the background. (It is an *NIX server)

The app that is being called will do a lenghty work but will be called 
by a php script through the web server.
An user will log in, request a computation, the script will call an 
external app which will run on the
background. Once the job is completed, a notification will be sent to 
the user which will log in again and check the results.
The external app performs a data mining computation on the SQL server to 
produce  results which will then be written to an SQL table.

My question is this:
Is it better to write the external app in PHP or Java?
If I write in PHP then I have to have a way to make the PHP not bound to 
time limitations as the operation might take a while.
If I write it in Java I won't have this concern. However, I am concerned 
with speed and overhead.
Which one would put a higher load to the processor, a PHP app or a Java 
one?
Which one will take longer?

Also, there might be more than 20 of these threads running on the server 
at the same time, hence my concern on which language the app should be 
writen.

Does anyone has experience with such a scenario?
The input is much apreciated.
Thanks in advance,
C.F.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Regular expression

2004-06-30 Thread Syed Ghouse
Hi All
(B
(Bwill anyone give me a solution to get the name and email address of sender from the 
(Bmail text below using regular expression.
(B
(BThe result shud get 
(Bname as syed ghouse 
(Band 
(Bemail as [EMAIL PROTECTED]
(B
(B--- Mail text start ---
(B
(BReturn-Path: [EMAIL PROTECTED]
(BDelivered-To: [EMAIL PROTECTED]
(BReceived: (qmail 25523 invoked by uid 508); 19 Jun 2004 06:23:25 -
(BReceived: from localhost (HELO 192.168.90.8) (127.0.0.1)
(B  by mail.jinis.com with SMTP; 19 Jun 2004 06:23:25 -
(BReceived: from 192.168.90.20 (proxying for 192.168.90.85)
(B(SquirrelMail authenticated user [EMAIL PROTECTED])
(Bby 192.168.90.8 with HTTP;
(BSat, 19 Jun 2004 11:53:25 +0530 (IST)
(BMessage-ID: [EMAIL PROTECTED]
(BDate: Sat, 19 Jun 2004 11:53:25 +0530 (IST)
(BSubject: test
(B
(BFrom : 'syed ghouse' [EMAIL PROTECTED]
(B
(BTo: [EMAIL PROTECTED]
(BCc: [EMAIL PROTECTED],[EMAIL PROTECTED]
(BUser-Agent: SquirrelMail/1.4.2
(BMIME-Version: 1.0
(BContent-Type: text/plain;charset=iso-8859-1
(BContent-Transfer-Encoding: 8bit
(BX-Priority: 3
(BImportance: Normal
(B
(Btest mail ignore
(B
(B--- Mail text end ---
(B
(B
(BRegards
(B
(BSyed

[PHP] Re: Regular expression

2004-06-30 Thread Aidan Lister
I suggest not using a regex.

There are better tools for parsing an email, for example formail.

$email = `formail -x Return-Path`;

See google.com for more information

Regards,
Aidan


Syed Ghouse [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi All

will anyone give me a solution to get the name and email address of sender
from the mail text below using regular expression.

The result shud get
name as syed ghouse
and
email as [EMAIL PROTECTED]

--- Mail text start ---

Return-Path: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
Received: (qmail 25523 invoked by uid 508); 19 Jun 2004 06:23:25 -
Received: from localhost (HELO 192.168.90.8) (127.0.0.1)
  by mail.jinis.com with SMTP; 19 Jun 2004 06:23:25 -
Received: from 192.168.90.20 (proxying for 192.168.90.85)
(SquirrelMail authenticated user [EMAIL PROTECTED])
by 192.168.90.8 with HTTP;
Sat, 19 Jun 2004 11:53:25 +0530 (IST)
Message-ID: [EMAIL PROTECTED]
Date: Sat, 19 Jun 2004 11:53:25 +0530 (IST)
Subject: test

From : 'syed ghouse' [EMAIL PROTECTED]

To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED],[EMAIL PROTECTED]
User-Agent: SquirrelMail/1.4.2
MIME-Version: 1.0
Content-Type: text/plain;charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Priority: 3
Importance: Normal

test mail ignore

--- Mail text end ---


Regards

Syed



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



[PHP] Re: Best external app from php

2004-06-30 Thread Aidan Lister
If you're asking which is faster, PHP or Java, it's a very difficult
question and I doubt anyone will give you a concrete answer.

I'd suggest writing the application in a much faster compiled language, c++
for example.


C.F. Scheidecker Antunes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello all,

 I need to have a web application to call an external app that needs to
 execute on the background. (It is an *NIX server)

 The app that is being called will do a lenghty work but will be called
 by a php script through the web server.
 An user will log in, request a computation, the script will call an
 external app which will run on the
 background. Once the job is completed, a notification will be sent to
 the user which will log in again and check the results.
 The external app performs a data mining computation on the SQL server to
 produce  results which will then be written to an SQL table.

 My question is this:

 Is it better to write the external app in PHP or Java?
 If I write in PHP then I have to have a way to make the PHP not bound to
 time limitations as the operation might take a while.
 If I write it in Java I won't have this concern. However, I am concerned
 with speed and overhead.
 Which one would put a higher load to the processor, a PHP app or a Java
 one?
 Which one will take longer?

 Also, there might be more than 20 of these threads running on the server
 at the same time, hence my concern on which language the app should be
 writen.

 Does anyone has experience with such a scenario?

 The input is much apreciated.

 Thanks in advance,

 C.F.


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



[PHP] Tab panels

2004-06-30 Thread Vincent DUPONT
Hi,

does anyone knowns of a good PEAR of other free TabPanels container?
I would like to be able to constumize the tabs and insert as many panels as needed.

PHP and/or Javascript is ok

Thank you,
Vincent

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



[PHP] Re: TAB Syntax

2004-06-30 Thread Harlequin
Lars



I got it working a treat. Thanks very much.



This is what I ended up with:



  echo preThis\tis\ta\ttest./pre;



and I simply added a PRE tag to the CSS file which has the same attributes
as the body tag.



Thanks very much for your patience Lars.


-- 
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-
Lars Torben Wilson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Harlequin wrote:

  Cheers Lars.
 
  So, for example, if I wanted to display some plain text tabbed I'd use:
 
  echo prestring1\tstring2\tstring3/pre;
 
  There's just one problem though - it formats the text differently to the
  rest of the page (I'm using CSS to control this).
 
  Any thoughts...?
 


 Try adding 'white-space: pre;' to the CSS for that bit:

   div style=white-space: pre;
 ?php echo This\tis\n\ta test.; ?
   /div

 See if adding that helps.


 Cheers,

 Torben

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



[PHP] Re: Regular expression

2004-06-30 Thread Red Wingate
If you still like to gather the information without using any tools:

$email = explode( \n , $mailText );

foreach ( $email AS $emailLine ) {
  $emailLine = trim( $emailLine );
   
  if ( strtoupper ( substr( $emailLine , 0 , 4 ) ) == 'FROM' ) {
preg_match( '#^from\s*:\s*([^]+)(([^]+))?#si' ,$emailLine ,$parts );
break ;
  }
}

$name  = $parts[1] ;
$email = $parts[3] ;

But you should consider the following:

FROM: Red Wingate [EMAIL PROTECTED]
FROM: Red Wingate
FROM: [EMAIL PROTECTED]
   .

Which makes working like this a pita.

   -- red

 I suggest not using a regex.
 
 There are better tools for parsing an email, for example formail.
 
 $email = `formail -x Return-Path`;
 
 See google.com for more information
 
 Regards,
 Aidan
 
 
 Syed Ghouse [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 Hi All
 
 will anyone give me a solution to get the name and email address of sender
 from the mail text below using regular expression.
 
 The result shud get
 name as syed ghouse
 and
 email as [EMAIL PROTECTED]
 
 --- Mail text start ---
 
 Return-Path: [EMAIL PROTECTED]
 Delivered-To: [EMAIL PROTECTED]
 Received: (qmail 25523 invoked by uid 508); 19 Jun 2004 06:23:25 -
 Received: from localhost (HELO 192.168.90.8) (127.0.0.1)
   by mail.jinis.com with SMTP; 19 Jun 2004 06:23:25 -
 Received: from 192.168.90.20 (proxying for 192.168.90.85)
 (SquirrelMail authenticated user [EMAIL PROTECTED])
 by 192.168.90.8 with HTTP;
 Sat, 19 Jun 2004 11:53:25 +0530 (IST)
 Message-ID: [EMAIL PROTECTED]
 Date: Sat, 19 Jun 2004 11:53:25 +0530 (IST)
 Subject: test
 
 From : 'syed ghouse' [EMAIL PROTECTED]
 
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED],[EMAIL PROTECTED]
 User-Agent: SquirrelMail/1.4.2
 MIME-Version: 1.0
 Content-Type: text/plain;charset=iso-8859-1
 Content-Transfer-Encoding: 8bit
 X-Priority: 3
 Importance: Normal
 
 test mail ignore
 
 --- Mail text end ---
 
 
 Regards
 
 Syed

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



[PHP] [Newbie Guide] For the benefit of new members

2004-06-30 Thread Ma Siva Kumar
===
Please feel free to add more points and send 
to the list.
===

1. If you have any queries/problems about PHP 
try http://www.php.net/manual/en first. You 
can download a copy and use it offline also. 

Please also try 
http://www.php.net/manual/faq.php 
for answers to frequently answered questions 
about PHP (added by Christophe Chisogne).

2. Try http://www.google.com next. Searching 
for php YOUR QUERY may fetch you relevant 
information within the first 10 results.

3. There is a searchable archive of the 
mailing list discussion at 
http://phparch.com/mailinglists. Many of the 
common topics are discussed repeatedly, and 
you may get answer to your query from the 
earlier discussions. 

For example: One of the repeatedly discussed 
question in the list is Best PHP editor. 
Everyone has his/her favourite editor. 
You can get all the opinions by going through 
the list archives. If you want a chosen list 
try this link : 
http://www.thelinuxconsultancy.co.uk/phpeditors/
(contributed by Christophe Chisogne).

4. Not sure if PHP is working or you want 
find out what extensions are available to 
you?

Just put the following code into a file with 
a .php extension and access it through your 
webserver:

?php
phpinfo();
? 

If PHP is installed you will see a page with 
a lot of information on it. If PHP is not 
installed (or not working correctly) your 
browser will try to download the file.

(contributed by Teren and reworded by Chris W 
Parker)

5. If you are stuck with a script and do not 
understand what is wrong, instead of posting 
the whole script, try doing some research 
yourself. One useful trick is to print 
the variable/sql query using print or echo 
command and check whether you get what you 
expected. 

After diagnosing the problem, send the 
details of your efforts (following steps 1, 
2  3) and ask for help.

6. PHP is a server side scripting language. 
Whatever processing PHP does takes place 
BEFORE the output reaches the client. 
Therefore, it is not possible to access 
users' computer related information (OS, 
screen size etc) using PHP. Nor can you 
modify any the user side settings. You need 
to go for JavaScript and ask the question in 
a JavaScript list.

On the other hand, you can access the 
information that is SENT by the user's 
browser when a client requests a page from 
your server. You can find details about 
browser, OS etc as reported by 
this request. - contributed by Wouter van 
Vliet and reworded by Chris W Parker.

7. Provide a clear descriptive subject line. 
Avoid general subjects like Help!!, A 
Question etc. Especially avoid blank 
subjects. 

8. When you want to start a new topic, open a 
new mail composer and enter the mailing list 
address [EMAIL PROTECTED] instead of 
replying to an existing thread and replacing 
the subject and body with your message.

9. It's always a good idea to post back to 
the list once you've solved your problem. 
People usually add [SOLVED] to the subject 
line of their email when posting solutions. 
By posting your solution you're helping the 
next person with the same question. 
[contribued by Chris W Parker]

10. Ask smart questions 
http://catb.org/~esr/faqs/smart-questions.html
[contributed by Jay Blanchard)

11. Do not send your email to the list with 
attachments. If you don't have a place to 
upload your code, try the many pastebin 
websites (such as www.pastebin.com).
[contributed by Burhan Khalid]

-- 
Integrated Management Tools for leather 
industry
--
http://www.leatherlink.net

Ma Siva Kumar,
BSG LeatherLink (P) Ltd,
Chennai - 600106

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



[PHP] Best table structure

2004-06-30 Thread Tom Chubb
Please can someone let me know their opinion on the following:

I have written some code for submitting a top 20 music chart online.
I use the following to insert into mysql:

INSERT INTO chart (name, chartpos, artist, title, label) VALUES

('$name', '1', '$artist', '$title', '$label'),
('$name', '2', '$artist2', '$title2', '$label2'),
('$name', '3', '$artist3', '$title3', '$label3'),

 -- repeat til -

('$name', '20', '$artist20', '$title20', '$label20'),


Another page queries the table and sorts by name (multiple people submit
charts) and latest date.

My question is this:
Would I be better keeping this format and inserting multiple rows on each
submit, or to have one row for all 81 variables ($name, 20 x Position, 20 x
Artists, 20 x Titles, 20 x Labels.)
I know that the latter will be easier to query.

Also, without maintenance, the size of the table for the current method will
get extremely large. Will that affect server performance?

I am still a newbie, so plain explanations would be most appreciated.

Thanks very much in advance.


Tom

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



Fw: [PHP] Re: Regular expression

2004-06-30 Thread Syed Ghouse

- Original Message -
From: Syed Ghouse [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, June 30, 2004 PM 04:43
Subject: Re: [PHP] Re: Regular expression


 Thanks Aiden for ur help

 i used ur code and i got

 name as Red Wingate[EMAIL PROTECTED]
 and no email.

 So pls correct the code and send me such that i get name and email
 separately.

 Regards
 syed

 - Original Message -
 From: Red Wingate [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, June 30, 2004 PM 04:27
 Subject: [PHP] Re: Regular expression


  If you still like to gather the information without using any tools:
 
  $email = explode( \n , $mailText );
 
  foreach ( $email AS $emailLine ) {
$emailLine = trim( $emailLine );
 
if ( strtoupper ( substr( $emailLine , 0 , 4 ) ) == 'FROM' ) {
  preg_match( '#^from\s*:\s*([^]+)(([^]+))?#si' ,$emailLine
 ,$parts );
  break ;
}
  }
 
  $name  = $parts[1] ;
  $email = $parts[3] ;
 
  But you should consider the following:
 
  FROM: Red Wingate [EMAIL PROTECTED]
  FROM: Red Wingate
  FROM: [EMAIL PROTECTED]
 .
 
  Which makes working like this a pita.
 
 -- red
 
   I suggest not using a regex.
  
   There are better tools for parsing an email, for example formail.
  
   $email = `formail -x Return-Path`;
  
   See google.com for more information
  
   Regards,
   Aidan
  
  
   Syed Ghouse [EMAIL PROTECTED] wrote in message
   news:[EMAIL PROTECTED]
   Hi All
  
   will anyone give me a solution to get the name and email address of
 sender
   from the mail text below using regular expression.
  
   The result shud get
   name as syed ghouse
   and
   email as [EMAIL PROTECTED]
  
   --- Mail text start ---
  
   Return-Path: [EMAIL PROTECTED]
   Delivered-To: [EMAIL PROTECTED]
   Received: (qmail 25523 invoked by uid 508); 19 Jun 2004 06:23:25 -
   Received: from localhost (HELO 192.168.90.8) (127.0.0.1)
 by mail.jinis.com with SMTP; 19 Jun 2004 06:23:25 -
   Received: from 192.168.90.20 (proxying for 192.168.90.85)
   (SquirrelMail authenticated user [EMAIL PROTECTED])
   by 192.168.90.8 with HTTP;
   Sat, 19 Jun 2004 11:53:25 +0530 (IST)
   Message-ID: [EMAIL PROTECTED]
   Date: Sat, 19 Jun 2004 11:53:25 +0530 (IST)
   Subject: test
  
   From : 'syed ghouse' [EMAIL PROTECTED]
  
   To: [EMAIL PROTECTED]
   Cc: [EMAIL PROTECTED],[EMAIL PROTECTED]
   User-Agent: SquirrelMail/1.4.2
   MIME-Version: 1.0
   Content-Type: text/plain;charset=iso-8859-1
   Content-Transfer-Encoding: 8bit
   X-Priority: 3
   Importance: Normal
  
   test mail ignore
  
   --- Mail text end ---
  
  
   Regards
  
   Syed
 
  --
  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: Fw: [PHP] Re: Regular expression

2004-06-30 Thread Red Wingate
First of all check who u credit :p
Secondly why don't you just try to fix it yourself?

There was just a typo in the regexp:
- #^from\s*:\s*([^]+)(([^]+))?#si
+ #^from\s*:\s*([^]+)(([^]+))?#si

Hopefully this will help you even more:

?php

/**
 * @param   string  $runlevel
 * @return  mixed
 */
function fetchSender ( $mailText ) {
  $mailText = explode( \n , $mailText ) ;

  foreach ( $mailText AS $mailLine ) {
$mailLine = trim ( $mailLine ) ;

if ( strtoupper ( substr ( $mailLine , 0 , 4 ) ) == 'FROM' ) {
  preg_match ( '#^\s*FROM\s*:\s*(([^]+)(\([^]+)\)?)#si' ,
$mailLine , $parts );

  break ;
}
  }

  if ( is_array ( $parts ) === FALSE ) {
return FALSE ;
  } else {
return array ( 'name' = isset ( $parts[2] ) ? $parts[2] : 'unknown' ,
 'from' = isset ( $parts[1] ) ? $parts[1] : 'unknown' ,
 'mail' = isset ( $parts[4] ) ? $parts[4] : 'unknown' ) ;
  }
}

/**
 * @param   array   $strings
 * @return  void
 */
function debug_FetchSender ( $strings ) {
  echo 'pre';

  foreach ( $strings AS $string ) {
$sender = fetchSender ( $string );
$sender = array_map ( 'htmlspecialchars' , $sender ) ;

print_r ( $sender );
  }

  echo '/pre';
}

debug_FetchSender ( array ( 'FROM: Red Wingate [EMAIL PROTECTED]' ,
  'FROM: Red Wingate' ,
  'FROM: [EMAIL PROTECTED]' ) ) ;

?

[...]
 Thanks Aiden for ur help

 i used ur code and i got

 name as Red Wingate[EMAIL PROTECTED]
 and no email.

 So pls correct the code and send me such that i get name and email
 separately.

 Regards
 syed
[...]

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



[PHP] MySQL QUERY Results Not Appearing

2004-06-30 Thread Harlequin
Hi all...

Despite being able to make a connection to the server and execute a query I
am unable to do this through PHP using the following commands:

 echo h3active members should appear here/h3;
 $query = SELECT * FROM RegisteredMembers;
 $result = mysql_query($query) or die (could not execute query);
 echo $result;

Any ideas...?

-- 
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-

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



RE: [PHP] MySQL QUERY Results Not Appearing[Scanned]

2004-06-30 Thread Michael Egan
Have a look at the mysql functions in the PHP manual - i.e. 
http://uk.php.net/mysql_query

I'm also certain this question has been raised fairly recently on the list. All 
mysql_query is going to do is either open up the resource or not. You'll need to use 
something else to display the data.

For example:

   $sql = select * from members;

   if(!$result = mysql_query($sql))
  echo mysql_error();

   while($row = mysql_fetch_array($result))
   {
  echo $row['column_name'];
   }


HTH,

Michael Egan

-Original Message-
From: Harlequin [mailto:[EMAIL PROTECTED]
Sent: 30 June 2004 12:42
To: [EMAIL PROTECTED]
Subject: [PHP] MySQL QUERY Results Not Appearing[Scanned]


Hi all...

Despite being able to make a connection to the server and execute a query I
am unable to do this through PHP using the following commands:

 echo h3active members should appear here/h3;
 $query = SELECT * FROM RegisteredMembers;
 $result = mysql_query($query) or die (could not execute query);
 echo $result;

Any ideas...?

-- 
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php 
The information contained in this email (and in any attachments sent with it) is 
confidential. It is intended for the addressee only. Access to this email by anyone 
else is unintended and unauthorized.  
If you are not the original addressee, 3tc asks you to please maintain 
confidentiality. If you have received this email in error please notify 3tc 
immediately by replying to it, then destroy any copies and delete it from your 
computer system. 
Any use, dissemination, forwarding, printing or copying of this email by anyone except 
the addressee in the normal course of his/her business, is strictly prohibited. 3tc 
owns the copyright in this email and any document created by us and assert the right 
to be identified as the author of it. Copyright has not been transferred to the 
addressee. 
We protect our systems with Sophos Anti-virus -  
www.sophos.com 
 

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



[PHP] Re: [PHP-DB] Best table structure

2004-06-30 Thread Ruprecht Helms
Tom Chubb wrote:
Please can someone let me know their opinion on the following:
I have written some code for submitting a top 20 music chart online.
I use the following to insert into mysql:
 

your posting is offtopic - you can get more help by asking in the 
mysql-mailinglist.

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


Re: [PHP] Re: Saving variables in a session in a destructor

2004-06-30 Thread David Goodlad
Ahh, guess I didn't look hard enough!  Thanks!

Dave

On Wed, 30 Jun 2004 10:10:29 +0200, Red Wingate [EMAIL PROTECTED] wrote:
 
 Maybe you check out the internals archives as an discussion about this topic
 was held 1-2 days ago.
 
 
  Hi all
 
  Using PHP5, I am trying to save some properties of an object when it
  is destroyed in its destructor, __destruct().  However, I have found
  that the session variable is NOT stored unless I explicitly destroy
  the object using unset().  If I leave php to finish executing the
  script and automatically destroy the object, the destructor IS called,
  however, the session variables are NOT saved.  A quick code example
  for clarity:
 
  -
  class StateMachine {
public $stateVariable;
function __destruct() {
  $_SESSION['state'] = $this-stateVariable;
}
  }
 
  $sm = new StateMachine();
  if (isset($_SESSION['state'])) {
$sm-stateVariable = $_SESSION['state'];
  } else {
$sm-stateVariable = 'foobar';
  }
  
 
  (please ignore the obvious bad coding standard of making that var
  public and accessing it, this is for simplicity of the example).
 
  Unless I do an unset($sm); at the end of a script like this, the
  $_SESSION array will never contain the state=foobar key/value.
 
  Can anyone offer some insight into this?
 
  Thanks!
  Dave
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



[PHP] Re: MySQL QUERY Results Not Appearing

2004-06-30 Thread Craig Donnelly
$result is an array that has to be fetched...try this

echo h3active members should appear here/h3;

$query = mysql_query(SELECT * FROM RegisteredMembers) or die(could not
execute query);
while($result = mysql_fetch_array($query)){
echo $result['YOUR_DB_FIELDNAME'];
}

change YOUR_DB_FIELDNAME' to whatever the fields are you are querying.
you could also:

pre
?php print_r($result); ?
/pre

HTH

Craig

Harlequin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi all...

 Despite being able to make a connection to the server and execute a query
I
 am unable to do this through PHP using the following commands:

  echo h3active members should appear here/h3;
  $query = SELECT * FROM RegisteredMembers;
  $result = mysql_query($query) or die (could not execute query);
  echo $result;

 Any ideas...?

 -- 
 -
  Michael Mason
  Arras People
  www.arraspeople.co.uk
 -

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



[PHP] install/config error - please help

2004-06-30 Thread Nguyen, Long P (Mission Systems)
any ideas with this install/config error?

[EMAIL PROTECTED] php-4.3.7]# ./configure --with-mysql=/usr/local/mysql
creating cache ./config.cache
checking host system type... i686-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... no
configure: error: installation or configuration problem: C compiler cannot create 
executables.

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



[PHP] suexec in php

2004-06-30 Thread Syed Ghouse
Hi All
(B
(BIs there any suexec function in php to create a unix user
(B
(Bor there is any function to create user dynamically from php code
(B
(BThanks in advance
(B
(BRegards
(Bsyed

Fw: [PHP] Re: Regular expression

2004-06-30 Thread Syed Ghouse
Yeah i used ur coding below and i got the solution for my problem.

Thanks Aidan

Syed
- Original Message -
From: Syed Ghouse [EMAIL PROTECTED]
To: php mailinglists [EMAIL PROTECTED]
Sent: Wednesday, June 30, 2004 PM 04:45
Subject: Fw: [PHP] Re: Regular expression



 - Original Message -
 From: Syed Ghouse [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, June 30, 2004 PM 04:43
 Subject: Re: [PHP] Re: Regular expression


  Thanks Aiden for ur help
 
  i used ur code and i got
 
  name as Red Wingate[EMAIL PROTECTED]
  and no email.
 
  So pls correct the code and send me such that i get name and email
  separately.
 
  Regards
  syed
 
  - Original Message -
  From: Red Wingate [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Wednesday, June 30, 2004 PM 04:27
  Subject: [PHP] Re: Regular expression
 
 
   If you still like to gather the information without using any tools:
  
   $email = explode( \n , $mailText );
  
   foreach ( $email AS $emailLine ) {
 $emailLine = trim( $emailLine );
  
 if ( strtoupper ( substr( $emailLine , 0 , 4 ) ) == 'FROM' ) {
   preg_match( '#^from\s*:\s*([^]+)(([^]+))?#si' ,$emailLine
  ,$parts );
   break ;
 }
   }
  
   $name  = $parts[1] ;
   $email = $parts[3] ;
  
   But you should consider the following:
  
   FROM: Red Wingate [EMAIL PROTECTED]
   FROM: Red Wingate
   FROM: [EMAIL PROTECTED]
  .
  
   Which makes working like this a pita.
  
  -- red
  
I suggest not using a regex.
   
There are better tools for parsing an email, for example formail.
   
$email = `formail -x Return-Path`;
   
See google.com for more information
   
Regards,
Aidan
   
   
Syed Ghouse [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi All
   
will anyone give me a solution to get the name and email address of
  sender
from the mail text below using regular expression.
   
The result shud get
name as syed ghouse
and
email as [EMAIL PROTECTED]
   
--- Mail text start ---
   
Return-Path: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
Received: (qmail 25523 invoked by uid 508); 19 Jun 2004
06:23:25 -
Received: from localhost (HELO 192.168.90.8) (127.0.0.1)
  by mail.jinis.com with SMTP; 19 Jun 2004 06:23:25 -
Received: from 192.168.90.20 (proxying for 192.168.90.85)
(SquirrelMail authenticated user [EMAIL PROTECTED])
by 192.168.90.8 with HTTP;
Sat, 19 Jun 2004 11:53:25 +0530 (IST)
Message-ID: [EMAIL PROTECTED]
Date: Sat, 19 Jun 2004 11:53:25 +0530 (IST)
Subject: test
   
From : 'syed ghouse' [EMAIL PROTECTED]
   
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED],[EMAIL PROTECTED]
User-Agent: SquirrelMail/1.4.2
MIME-Version: 1.0
Content-Type: text/plain;charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Priority: 3
Importance: Normal
   
test mail ignore
   
--- Mail text end ---
   
   
Regards
   
Syed
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 

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



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



Re: [PHP] install/config error - please help

2004-06-30 Thread Curt Zirzow
* Thus wrote Nguyen, Long P (Mission Systems):
 any ideas with this install/config error?
 
 [EMAIL PROTECTED] php-4.3.7]# ./configure --with-mysql=/usr/local/mysql
 creating cache ./config.cache
 checking host system type... i686-pc-linux-gnu
 checking for gcc... gcc
 checking whether the C compiler (gcc  ) works... no
 configure: error: installation or configuration problem: C compiler cannot create 
 executables.

This means that gcc/cc was unable to generate a simple executable,
could mean that your ldconfig is messed up or that you have some
improper environment settings. You can consult your config.log for
any hints.

You can test you're executable creating abilities yourself by
doing something like:

bash$ echo main(){return(0);}  test.c
bash$ gcc -o test $CFLAGS $CPPFLAGS $LDFLAGS test.c $LIBS

You'll probably get errors.

Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



Re: Fw: [PHP] Re: Regular expression

2004-06-30 Thread Curt Zirzow
* Thus wrote Red Wingate:
 First of all check who u credit :p
 Secondly why don't you just try to fix it yourself?
 
 There was just a typo in the regexp:
 - #^from\s*:\s*([^]+)(([^]+))?#si
 + #^from\s*:\s*([^]+)(([^]+))?#si
 
 Hopefully this will help you even more:
 

You're too nice..

Btw, I need some money. Send me money ASAP. It must be an amount
greater than $200, and be delivered to me directly, thank you.


 ...
 
 ?
 
 [...]
  Thanks Aiden for ur help
 
  i used ur code and i got
 
  name as Red Wingate[EMAIL PROTECTED]
  and no email.
 
  So pls correct the code and send me such that i get name and email
  separately.
 
  Regards
  syed
 [...]
 

Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



Re: [PHP] suexec in php

2004-06-30 Thread Curt Zirzow
* Thus wrote Syed Ghouse:
 Hi All
 
 Is there any suexec function in php to create a unix user
 
 or there is any function to create user dynamically from php code

You might want to start here:

  man unix


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



Re: Fw: [PHP] Re: Regular expression

2004-06-30 Thread Red Wingate
Oh ... you forgot to include your account-info so i won't be able to
send you the money :-/
[...]
You're too nice..
Btw, I need some money. Send me money ASAP. It must be an amount
greater than $200, and be delivered to me directly, thank you.
[...]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Protecting database passwords

2004-06-30 Thread Chris W. Parker
Bob Hockney mailto:[EMAIL PROTECTED]
on Tuesday, June 29, 2004 5:58 PM said:

 I wrote a php script that accesses a database, and I am wondering
 about securing the password to the database.  I could prompt the user
 for the password every session, but I don't necessarily want the user
 to have the password.

you don't want the user to have the password?? how else are they
supposed to login?

 Unless I'm missing something, any on-disk
 place I store the password needs to be readable by PHP, and therefore
 isn't very secure.

1. don't store the password in plain text. store it as a hash.
2. make the file readable only to root and the user that PHP/Apache runs
under.

that's about all i know.



chris.

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



Re: [PHP] checkbox

2004-06-30 Thread abrea
If you put square brackets after the name (e.g. var[]) your form should 
produce an array called $_POST[var] that comprises the checked boxes 
only.
e.g.
form method=post ...
input type=checkbox name=var[] value=value1
input type=checkbox name=var[] value=value2
input type=checkbox name=var[] value=value3
Regards
Alberto Brea
[EMAIL PROTECTED]



-Original Message-
From: Aris  Santillan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Date: Wed, 30 Jun 2004 15:56:35 +0800
Subject: [PHP] checkbox

 how can process  only items with checked check-box?
 
 --- html ---
 
 
 
 html
 head
 titleUntitled Document/title
 /head
 
 body
 form name=form1 method=post action=
   p 
 input type=checkbox name=checkbox value=checkbox
 input type=text name=textfield[1]
   /p
   p 
 input type=checkbox name=checkbox value=checkbox
   input type=text name=textfield[2]
   /p
   p 
 input type=checkbox name=checkbox value=checkbox 
 input type=text name=textfield[3]
   /p
   p 
 input type=checkbox name=checkbox value=checkbox
   input type=text name=textfield[4]
   /p
   p
 input type=checkbox name=checkbox value=checkbox
 input type=text name=textfield[5]
   /p
 /form
 /body
 /html
 
 
 
 --- html ---
 
 
 
 
 
 
 
 

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



Re: [PHP] Re: test if $int is integer

2004-06-30 Thread Chris Shiflett
--- Matthew Sims [EMAIL PROTECTED] wrote:
 I recently purchased George Schlossnagle's Advanced PHP Programming and
 on page 85 in the Error Handling chapter, he made a reference about the
 is_int function.
 
 In the above function example he had:
 if (!preg_match('/^\d+$/',$n) || $n  0) {
 
 In which he mentions:
 It might be strange to choose to evaluate whether $n is an integer by
 using a regular expression instead of the is_int function. The is_int
 function, however, does not do what you want. It only evaluates whether
 $n has been typed as a string or as an integer, not whether the value of
$n
 is an integer.
 
 Can anyone comment on this?

As he explains, is_int() only evaluates the variable type, not the value
(the actual data). This is not what most people want. In fact, this type
of question illustrates the benefit of mailing lists.

With PHP being a typeless language (well, it keeps up with types, but it
tries to insulate developers from such), it's easy to have an integer
stored in a variable typed as a string, and this would break an is_int()
check.

I'm not sure why he doesn't mention is_numeric(), since I think this would
pop into people's heads while reading that section. This function is more
helpful, in my opinion, because it evaluates the data and determines
whether it is numeric. This is more inline with what most people want.

So why the regular expression? Well, I'm no regular expression expert, but
I can make a good guess without even evaluating the expression. Is 4.5 an
integer? Nope, but it's numeric. His regular expression probably makes
this distinction.

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] Protecting database passwords

2004-06-30 Thread Craig Donnelly
MD5 - http://ie2.php.net/md5
One way in encryption.


Chris W. Parker [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Bob Hockney mailto:[EMAIL PROTECTED]
on Tuesday, June 29, 2004 5:58 PM said:

 I wrote a php script that accesses a database, and I am wondering
 about securing the password to the database.  I could prompt the user
 for the password every session, but I don't necessarily want the user
 to have the password.

you don't want the user to have the password?? how else are they
supposed to login?

 Unless I'm missing something, any on-disk
 place I store the password needs to be readable by PHP, and therefore
 isn't very secure.

1. don't store the password in plain text. store it as a hash.
2. make the file readable only to root and the user that PHP/Apache runs
under.

that's about all i know.



chris.

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



Re: [PHP] Protecting database passwords

2004-06-30 Thread Red Wingate
Hashing ... but i guess he wants to protected the password
needed to access the DB not a PW stored in the DB.
[...]
MD5 - http://ie2.php.net/md5
One way in encryption.
[...]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] install/config error - please help

2004-06-30 Thread Nguyen, Long P (Mission Systems)
I tried what you suggested and got the following:

[EMAIL PROTECTED] root]# main(){return(0);}  test.c
-bash: main(){return(0);}: command not found
[EMAIL PROTECTED] root]# gcc -o test $CFLAGS $CPPFLAGS $LDFLAGS test.c $LIBS
/usr/lib/crt1.o(.text+0x18): In function `_start':
: undefined reference to `main'
collect2: ld returned 1 exit status


-Original Message-
From: Curt Zirzow [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 30, 2004 10:07 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] install/config error - please help


* Thus wrote Nguyen, Long P (Mission Systems):
 any ideas with this install/config error?
 
 [EMAIL PROTECTED] php-4.3.7]# ./configure --with-mysql=/usr/local/mysql
 creating cache ./config.cache
 checking host system type... i686-pc-linux-gnu
 checking for gcc... gcc
 checking whether the C compiler (gcc  ) works... no
 configure: error: installation or configuration problem: C compiler cannot create 
 executables.

This means that gcc/cc was unable to generate a simple executable,
could mean that your ldconfig is messed up or that you have some
improper environment settings. You can consult your config.log for
any hints.

You can test you're executable creating abilities yourself by
doing something like:

bash$ echo main(){return(0);}  test.c
bash$ gcc -o test $CFLAGS $CPPFLAGS $LDFLAGS test.c $LIBS

You'll probably get errors.

Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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

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



[PHP] What do I need in order to do the following with php.

2004-06-30 Thread bclem


I want to make sure I'm correct in doing something. What do I need in order to
perform the following:

-
Send an XML message to something at a website, have it load a database with
the message, and return an acknowledgement.
---

Thanks,
Brent

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



Re: [PHP] Re: test if $int is integer

2004-06-30 Thread John W. Holmes
Matthew Sims wrote:
I recently purchased George Schlossnagle's Advanced PHP Programming and on
page 85 in the Error Handling chapter, he made a reference about the
is_int function.
In the above function example he had:
if (!preg_match('/^\d+$/',$n) || $n  0) {
In which he mentions:
It might be strange to choose to evaluate whether $n is an integer by
using a regular expression instead of the is_int function. The is_int
function, however, does not do what you want. It only evaluates whether $n
has been typed as a string or as an integer, not whether the value of $n
is an integer.
Can anyone comment on this?
The value 5.5 passed form a text input in a form, for example, will fail 
 is_int() (because it's actually a string) and pass is_numeric(), but 
you still don't know whether the value passed was (or can be) an integer.

If you want to just ensure the value IS an integer (without really 
caring what it's value is), then you can just cast it to an integer.

$n = (int)$n;
If it wasn't an integer to begin with, then it'll normally be zero 
(exceptions are strings that begin with numbers 5abc will have the 
value 5, but again, this is if you really don't care what the value is).

--
---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] XML Cdata problem

2004-06-30 Thread Mathieu Dumoulin
PHP 4.3.7 on Linux Red Hat 7.3 full patch and updates, Expat expat_1.95.2

Problem:

I am reading the XML file below and at path:

advantage/route/origin/status/

The CDATA inside the STATUS node cannot be read (Current value 1900), there
isnt much information on how to use the EXPAT library on PHP.Net apart from
the extensive definition of all functions so i'm not sure im using EXPAT the
correct way. Please tell me if im doing something wrong, here is my code and
the XML file is further below:


*  PHP CODE  *


//Load the XML like it was a XML reponse
$xml = implode('', file('xml.xml'));
echo 'PRE'.str_replace(array('', ''), array('lt;', 'gt;'),
$xml).'/PRE';

/*For now all objects are empty shells without data in them, the XML parser
will link everything together nicely
and will add the CDATA for objects if there is some. Later we will add the
standard options to each class
and create functions for output.*/

//Contains an advantage server response, very basic object with only one
thing below
class advantage_node {
   function advantage_response() {}
}

//Contains an advantage server data representing a route
class route_node {
   function route_node() {}
}

//Contains an advantage server data representing a parsed input data from
the server
class origin_node {
   function origin_node() {}
}

//Contains an advantage server data representing a status
class status_node {
   function status_node() {}
}

//Contains an advantage server data representing a location
class location_node {
   function location_node() {}
}

//Contains an advantage server data representing a number
class number_node {
   function number_node() {}
}

//In charge of making the object tree and handling first level objects
function xml_to_class_tag_start($parser, $element, $attributes){
 $element_class = $element.'_node';
 if(class_exists($element_class) 
isset($GLOBALS['element_levels'][$GLOBALS['element_level']-1])){
  $new_element = new $element_class;
  if(is_array($attributes)){ foreach($attributes as $attribute = $value){
   $new_element-$attribute = $value;
  }}
  if($GLOBALS['element_level']-1 = 0){
   $GLOBALS['element_levels'][$GLOBALS['element_level']-1]-$element =
$new_element;
  }
  $GLOBALS['element_levels'][$GLOBALS['element_level']] = $new_element;
 }
 ++$GLOBALS['element_level'];
}

//In charge of closing the current object and rolling back to the previous
one
function xml_to_class_tag_end($parser, $element){
 if($GLOBALS['element_level']  1){
  unset($GLOBALS['element_levels'][$GLOBALS['element_level']]);
 }
 $GLOBALS['element_level']--;
}

function xml_to_class_tag_data($parser, $data){
 if(trim($data) != ''){
  $GLOBALS['element_levels'][$GLOBALS['element_level']]-cdata = $data;
 }
}

//Setup the objects
$element_level = 0;
$element_levels = array(-1 = '');

//Start the XML parsing
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 1);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
xml_set_element_handler($parser, 'xml_to_class_tag_start',
'xml_to_class_tag_end');
xml_set_character_data_handler($parser, 'xml_to_class_tag_data');
xml_parse($parser, $xml);
xml_parser_free($parser);

//Output
echo 'pre'.print_r($element_levels[0], true).'/pre';
*  RESULT
*advantage_node Object
(
[ROUTE] = route_node Object
(
[STATUS] = 0
[ORIGIN] = origin_node Object
(
[COUNT] = 1
[STATUS] = status_node Object
(
)

[LOCATION] = location_node Object
(
[NUMBER] = number_node Object
(
)

)

)

)

)
*  XML DATA  *


advantage
-
 route status=0
-
 parameters
clientId[protected]/clientId
destcountryca/destcountry
destpostalcodeh1p 2w8/destpostalcode
origcountryca/origcountry
origpostalcodeh1z 2l2/origpostalcode
transactionroute/transaction
/parameters
-
 input
-
 origin count=1
-
 location
postalCodeh1z 2l2/postalCode
countryca/country
/location
/origin
-
 destination count=1
-
 location
postalCodeh1p 2w8/postalCode
countryca/country
/location
/destination
/input
-
 origin count=1
status1900/status
-
 location
number1/number
cityMONTREAL/city
stateProvinceQC/stateProvince
postalCodeH1Z 2L2/postalCode
countryCA/country
latitude45.569129/latitude
longitude-73.601440/longitude
geocodeQualityZIP/geocodeQuality
iconId9191/iconId
-
 map
height119/height
width198/width
type8/type
mapStyledefault/mapStyle
-
 request
[useless junk]
/request
/map
/location
/origin
-
 destination count=1
status1900/status
-
 location
number1/number
citySAINT-LEONARD/city
stateProvinceQC/stateProvince
postalCodeH1P 

[PHP] Re: XML Cdata problem

2004-06-30 Thread Mathieu Dumoulin
Forget myt post, its a stupid error from my part because of object
references and stuff like that. I'll fix it myself.

Mathieu Dumoulin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 PHP 4.3.7 on Linux Red Hat 7.3 full patch and updates, Expat expat_1.95.2

 Problem:

 I am reading the XML file below and at path:

 advantage/route/origin/status/

 The CDATA inside the STATUS node cannot be read (Current value 1900),
there
 isnt much information on how to use the EXPAT library on PHP.Net apart
from
 the extensive definition of all functions so i'm not sure im using EXPAT
the
 correct way. Please tell me if im doing something wrong, here is my code
and
 the XML file is further below:

 
 *  PHP CODE  *
 

 //Load the XML like it was a XML reponse
 $xml = implode('', file('xml.xml'));
 echo 'PRE'.str_replace(array('', ''), array('lt;', 'gt;'),
 $xml).'/PRE';

 /*For now all objects are empty shells without data in them, the XML
parser
 will link everything together nicely
 and will add the CDATA for objects if there is some. Later we will add the
 standard options to each class
 and create functions for output.*/

 //Contains an advantage server response, very basic object with only one
 thing below
 class advantage_node {
function advantage_response() {}
 }

 //Contains an advantage server data representing a route
 class route_node {
function route_node() {}
 }

 //Contains an advantage server data representing a parsed input data from
 the server
 class origin_node {
function origin_node() {}
 }

 //Contains an advantage server data representing a status
 class status_node {
function status_node() {}
 }

 //Contains an advantage server data representing a location
 class location_node {
function location_node() {}
 }

 //Contains an advantage server data representing a number
 class number_node {
function number_node() {}
 }

 //In charge of making the object tree and handling first level objects
 function xml_to_class_tag_start($parser, $element, $attributes){
  $element_class = $element.'_node';
  if(class_exists($element_class) 
 isset($GLOBALS['element_levels'][$GLOBALS['element_level']-1])){
   $new_element = new $element_class;
   if(is_array($attributes)){ foreach($attributes as $attribute = $value){
$new_element-$attribute = $value;
   }}
   if($GLOBALS['element_level']-1 = 0){
$GLOBALS['element_levels'][$GLOBALS['element_level']-1]-$element =
 $new_element;
   }
   $GLOBALS['element_levels'][$GLOBALS['element_level']] = $new_element;
  }
  ++$GLOBALS['element_level'];
 }

 //In charge of closing the current object and rolling back to the previous
 one
 function xml_to_class_tag_end($parser, $element){
  if($GLOBALS['element_level']  1){
   unset($GLOBALS['element_levels'][$GLOBALS['element_level']]);
  }
  $GLOBALS['element_level']--;
 }

 function xml_to_class_tag_data($parser, $data){
  if(trim($data) != ''){
   $GLOBALS['element_levels'][$GLOBALS['element_level']]-cdata = $data;
  }
 }

 //Setup the objects
 $element_level = 0;
 $element_levels = array(-1 = '');

 //Start the XML parsing
 $parser = xml_parser_create();
 xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 1);
 xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
 xml_set_element_handler($parser, 'xml_to_class_tag_start',
 'xml_to_class_tag_end');
 xml_set_character_data_handler($parser, 'xml_to_class_tag_data');
 xml_parse($parser, $xml);
 xml_parser_free($parser);

 //Output
 echo 'pre'.print_r($element_levels[0], true).'/pre';
 *  RESULT
 *advantage_node Object
 (
 [ROUTE] = route_node Object
 (
 [STATUS] = 0
 [ORIGIN] = origin_node Object
 (
 [COUNT] = 1
 [STATUS] = status_node Object
 (
 )

 [LOCATION] = location_node Object
 (
 [NUMBER] = number_node Object
 (
 )

 )

 )

 )

 )
 *  XML DATA  *
 

 advantage
 -
  route status=0
 -
  parameters
 clientId[protected]/clientId
 destcountryca/destcountry
 destpostalcodeh1p 2w8/destpostalcode
 origcountryca/origcountry
 origpostalcodeh1z 2l2/origpostalcode
 transactionroute/transaction
 /parameters
 -
  input
 -
  origin count=1
 -
  location
 postalCodeh1z 2l2/postalCode
 countryca/country
 /location
 /origin
 -
  destination count=1
 -
  location
 postalCodeh1p 2w8/postalCode
 countryca/country
 /location
 /destination
 /input
 -
  origin count=1
 status1900/status
 -
  location
 number1/number
 cityMONTREAL/city
 stateProvinceQC/stateProvince
 postalCodeH1Z 2L2/postalCode
 countryCA/country
 

[PHP] How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Scott Fletcher
I'm using data that goes from the HTML textbox to PHP to MYSQL to PHP to
HTML textbox.  The only trouble I have is to escape the apostrophe character
when it is put into the HTML textbox by PHP (from MySQL).

--snip--
  echo input type='textbox' value='.$value.';
--snip--

I can't use the HTML feature like quot or something because the quot
would show up in the database...  Any suggestion or advice?

Thanks,
 Scott F.

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



[PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Torsten Roehr
Scott Fletcher [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I'm using data that goes from the HTML textbox to PHP to MYSQL to PHP to
 HTML textbox.  The only trouble I have is to escape the apostrophe
character
 when it is put into the HTML textbox by PHP (from MySQL).

 --snip--
   echo input type='textbox' value='.$value.';
 --snip--

 I can't use the HTML feature like quot or something because the quot
 would show up in the database...  Any suggestion or advice?

You CAN use quot; - convert your data AFTER getting it from the DB. When
you submit the form the quot; will be automagically converted back to a 
in the POST data. I recommend writing a function you run on all data for
outputting as HTML with htlmentities().

1. get data from DB
2. convert for valid HTML output (stripslashes(), htmlentities())
3. output as HTML (into the form elements)
4. get POST data
5. escape POST data and insert into DB again

Hope this helps.

Regards, Torsten Roehr

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



RE: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Chris W. Parker
Torsten Roehr mailto:[EMAIL PROTECTED]
on Wednesday, June 30, 2004 10:03 AM said:

 1. get data from DB
 2. convert for valid HTML output (stripslashes(), htmlentities())
 3. output as HTML (into the form elements)
 4. get POST data
 5. escape POST data and insert into DB again

two comments:

first comment:

re: #2. why stripslashes()? if you've properly escaped your data before
the INSERT the slashes should be non-existant on the way out should they
not?

second comment:

you forgot #4.5 *validate* data to your specifications




chris.

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



RE: [PHP] Protecting database passwords

2004-06-30 Thread Chris W. Parker
Red Wingate mailto:[EMAIL PROTECTED]
on Wednesday, June 30, 2004 9:33 AM said:

 Hashing ... but i guess he wants to protected the password
 needed to access the DB not a PW stored in the DB.

you probably understand this already but for those who don't i would
like to say:

right, but the point with hashing is that even if the hashes are
retrieved/stolen it will take time (possibly too long) for the password
itself to be recovered/discovered.


chris.

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



Re: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Justin Patrin
On Wed, 30 Jun 2004 19:02:50 +0200, Torsten Roehr [EMAIL PROTECTED] wrote:
 
 Scott Fletcher [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  I'm using data that goes from the HTML textbox to PHP to MYSQL to PHP to
  HTML textbox.  The only trouble I have is to escape the apostrophe
 character
  when it is put into the HTML textbox by PHP (from MySQL).
 
  --snip--
echo input type='textbox' value='.$value.';
  --snip--
 
  I can't use the HTML feature like quot or something because the quot
  would show up in the database...  Any suggestion or advice?
 
 You CAN use quot; - convert your data AFTER getting it from the DB. When
 you submit the form the quot; will be automagically converted back to a 
 in the POST data. I recommend writing a function you run on all data for
 outputting as HTML with htlmentities().
 
 1. get data from DB
 2. convert for valid HTML output (stripslashes(), htmlentities())

You shouldn't need stripslashes when getting something out of the DB.
You also shouldn't need addslashes when putting it in. quoteSmart() in
PEAR::DB is a *much* better option.

 3. output as HTML (into the form elements)
 4. get POST data
 5. escape POST data and insert into DB again
 
 Hope this helps.
 
 Regards, Torsten Roehr
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 !DSPAM:40e2f031124651465110022!
 
 




-- 
paperCrane --Justin Patrin--

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



Re: [PHP] Protecting database passwords

2004-06-30 Thread Red Wingate
even for the guy who wrote the source. it's allmost impossible to
restore the data as the only option is a brute-force attempt.
Chris W. Parker wrote:
Red Wingate mailto:[EMAIL PROTECTED]
on Wednesday, June 30, 2004 9:33 AM said:

Hashing ... but i guess he wants to protected the password
needed to access the DB not a PW stored in the DB.

you probably understand this already but for those who don't i would
like to say:
right, but the point with hashing is that even if the hashes are
retrieved/stolen it will take time (possibly too long) for the password
itself to be recovered/discovered.
chris.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Red Wingate
use quot; to display the data in the input-text element and undo this
before inserting it into the database
function quoteToHtml ( $string ) {
  return str_replace( '' , 'quot;' , $string );
}
function htmlToQuote ( $string ) {
  return str_replace( 'quot;' , '' , $string );
}
Only way to go :-)
Scott Fletcher wrote:
I'm using data that goes from the HTML textbox to PHP to MYSQL to PHP to
HTML textbox.  The only trouble I have is to escape the apostrophe character
when it is put into the HTML textbox by PHP (from MySQL).
--snip--
  echo input type='textbox' value='.$value.';
--snip--
I can't use the HTML feature like quot or something because the quot
would show up in the database...  Any suggestion or advice?
Thanks,
 Scott F.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Earliest PHP/FI

2004-06-30 Thread Jeff Loiselle
Does anyone know where I would be able to find the earliest version of 
PHP/FI or PHP possible? I am looking for the earliest possible version 
for academic reasons.

Thanks in advace.
--
Jeff Loiselle - http://www.newnewmedia.com/~jeff
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Justin Patrin
On Wed, 30 Jun 2004 19:32:29 +0200, Red Wingate [EMAIL PROTECTED] wrote:
 
 use quot; to display the data in the input-text element and undo this
 before inserting it into the database
 
 function quoteToHtml ( $string ) {
return str_replace( '' , 'quot;' , $string );
 }

Much better to use htmlentities(), it will get all quotes and other
special chars (, , etc) which can cause problems.

 function htmlToQuote ( $string ) {
return str_replace( 'quot;' , '' , $string );
 }
 

You don't need to do this. When the browser submits the request, it
will come through $_REQUEST as a quote, not as an HTML entity.

 Only way to go :-)
 
 Scott Fletcher wrote:
 
  I'm using data that goes from the HTML textbox to PHP to MYSQL to PHP to
  HTML textbox.  The only trouble I have is to escape the apostrophe character
  when it is put into the HTML textbox by PHP (from MySQL).
 
  --snip--
echo input type='textbox' value='.$value.';
  --snip--
 
  I can't use the HTML feature like quot or something because the quot
  would show up in the database...  Any suggestion or advice?
  
  Thanks,
   Scott F.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 !DSPAM:40e2f52755689422721120!
 
 


-- 
paperCrane --Justin Patrin--

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



Re: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Torsten Roehr
Justin Patrin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Wed, 30 Jun 2004 19:02:50 +0200, Torsten Roehr [EMAIL PROTECTED]
wrote:
 
  Scott Fletcher [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
   I'm using data that goes from the HTML textbox to PHP to MYSQL to PHP
to
   HTML textbox.  The only trouble I have is to escape the apostrophe
  character
   when it is put into the HTML textbox by PHP (from MySQL).
  
   --snip--
 echo input type='textbox' value='.$value.';
   --snip--
  
   I can't use the HTML feature like quot or something because the
quot
   would show up in the database...  Any suggestion or advice?
 
  You CAN use quot; - convert your data AFTER getting it from the DB.
When
  you submit the form the quot; will be automagically converted back to a

  in the POST data. I recommend writing a function you run on all data for
  outputting as HTML with htlmentities().
 
  1. get data from DB
  2. convert for valid HTML output (stripslashes(), htmlentities())

 You shouldn't need stripslashes when getting something out of the DB.
 You also shouldn't need addslashes when putting it in. quoteSmart() in
 PEAR::DB is a *much* better option.

The last time I tried PEAR::DB 1.6.4 quoteSmart() didn't work for me. It
corrupted my statement. Maybe I should try again ;)

Torsten

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



Re: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Torsten Roehr
Chris W. Parker [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]01.ati.local...
Torsten Roehr mailto:[EMAIL PROTECTED]
on Wednesday, June 30, 2004 10:03 AM said:

 1. get data from DB
 2. convert for valid HTML output (stripslashes(), htmlentities())
 3. output as HTML (into the form elements)
 4. get POST data
 5. escape POST data and insert into DB again

two comments:

first comment:

re: #2. why stripslashes()? if you've properly escaped your data before
the INSERT the slashes should be non-existant on the way out should they
not?

Correct. My fault.


second comment:

you forgot #4.5 *validate* data to your specifications

Correct also. But I was focusing in the quote problem ;)

Torsten

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



Re: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread John W. Holmes
Red Wingate wrote:
use quot; to display the data in the input-text element and undo this
before inserting it into the database
function quoteToHtml ( $string ) {
  return str_replace( '' , 'quot;' , $string );
}
function htmlToQuote ( $string ) {
  return str_replace( 'quot;' , '' , $string );
}
Only way to go :-)
You don't need to undo anything in the data submitted from the form. 
This is done automatically. Try it. It's the same as how URL values are 
decoded automatically.

Also, instead of str_replace, you can use 
htmlentities($string,ENT_QUOTES), which will convert single and double 
quotes (among other characters) just in case you end up using either one 
in your HTML.

--
---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


Re: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Joel Kitching
What's wrong with addslashes() on the way in and stripslashes() on the
way out?  Why would you want to convert it to it's HTML entity?

-- 
Joel Kitching
http://midgardmanga.keenspace.com/

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



[PHP] Re: Earliest PHP/FI

2004-06-30 Thread Red Wingate
maybe take a look here : http://museum.php.net/
otherwise do some research using google.
Jeff Loiselle wrote:
Does anyone know where I would be able to find the earliest version of 
PHP/FI or PHP possible? I am looking for the earliest possible version 
for academic reasons.

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


RE: [PHP] Protecting database passwords

2004-06-30 Thread Chris W. Parker
Red Wingate mailto:[EMAIL PROTECTED]
on Wednesday, June 30, 2004 10:29 AM said:

 even for the guy who wrote the source. it's allmost impossible to
 restore the data as the only option is a brute-force attempt.

right so what is the point you're trying to make?



c.

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



Re: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread John W. Holmes
Joel Kitching wrote:
What's wrong with addslashes() on the way in and stripslashes() on the
way out?  Why would you want to convert it to it's HTML entity?
Please try to load the following HTML and tell me what's wrong with it:
input type=text name=whatever value=some \ value
And then load this:
input type=text name=whatever value=some quot; value
--
---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


RE: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Chris W. Parker
Joel Kitching mailto:[EMAIL PROTECTED]
on Wednesday, June 30, 2004 10:34 AM said:

 What's wrong with addslashes() on the way in and stripslashes() on the
 way out?  Why would you want to convert it to it's HTML entity?

1. addslashes() is not as robust as other solutions like
mysql_escape_string().
2. in either case the slashes will be non-existant when the data is
actually inserted into the database.

for example:

$mystring = hello here is my string. it has an ' (apostrophe) in it.;

$sql = 
INSERT INTO data
(thestring)
VALUES ('$mystring');

when then is parsed it will look like this:

INSERT INTO data
(thestring)
VALUES ('hello here is my string. is has an ' (apostrophe) in
it.')

as you can see the ' in the original string is going to cause a problem.
by escaping it with mysql_escape_string() (or another comparable
function) you'll get the following:

INSERT INTO data
(thestring)
VALUES ('hello here is my string. is has an \' (apostrophe) in
it.')

this string, although it now contains a slash that we originally did not
want, this slash not exist once the data is actually inserted into the
database. it's merely there to tell the database hey, please ignore the
' that comes directly after me.

s... when you pull the data *out* of the database the \ will not
exist and you therefore do not need to perform stripslashes().

and now to the second part... why use htmlentities()? that is for
displaying data within a form element OR (i hope i have this right)
preventing XSS (Cross Site Scripting attacks).


hope this helps!
chris.

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



Re: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Joel Kitching
 1. addslashes() is not as robust as other solutions like
 mysql_escape_string().

What exactly is the difference between the two?

 2. in either case the slashes will be non-existant when the data is
 actually inserted into the database.
 
 for example:
 
 $mystring = hello here is my string. it has an ' (apostrophe) in it.;
 
 $sql = 
 INSERT INTO data
 (thestring)
 VALUES ('$mystring');
 
 when then is parsed it will look like this:
 
 INSERT INTO data
 (thestring)
 VALUES ('hello here is my string. is has an ' (apostrophe) in
 it.')
 
 as you can see the ' in the original string is going to cause a problem.
 by escaping it with mysql_escape_string() (or another comparable
 function) you'll get the following:
 
 INSERT INTO data
 (thestring)
 VALUES ('hello here is my string. is has an \' (apostrophe) in
 it.')
 
 this string, although it now contains a slash that we originally did not
 want, this slash not exist once the data is actually inserted into the
 database. it's merely there to tell the database hey, please ignore the
 ' that comes directly after me.
 
 s... when you pull the data *out* of the database the \ will not
 exist and you therefore do not need to perform stripslashes().

I tried using addslashes() on the string in the query, and then
SELECTing it, and the slashes are included.  Does
mysql_escape_string() not do this?

 
 and now to the second part... why use htmlentities()? that is for
 displaying data within a form element OR (i hope i have this right)
 preventing XSS (Cross Site Scripting attacks).
 
 hope this helps!
 chris.
 
 


-- 
Joel Kitching
http://midgardmanga.keenspace.com/

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



[PHP] Converting strings to match multiple charsets

2004-06-30 Thread Red Wingate
Hey guys,
i ran into serious trouble when facing the problem to convert
data, which was retrieved from a single form in our CMS to match
the requirements of multiple charsets.
Our CMS uses UTF-8 which worked out quite fine to display the data
but caused weired symbols when displayed within a TEXTAREA or INPUT
field. So i tried to convert all characters beyound A-Z,0-9 to
HTML entities which worked out even better ( i used the following
functions to convert the data :
function func_ConvertToHTML ( $string ) {
  $strlen = strlen ( $string ) ;
  $return = '' ;
  for ( $str_pos = 0 ; $str_pos  $strlen ; $str_pos++ ) {
$char  = substr ( $string , $str_pos , 1 );
$ascii = ord ( $char );
if ( $ascii  5 == 6 ) {
  $char2  = substr ( $string , ++$str_pos , 1 );
  $ascii2 = ord ($char2);
  $ascii  = 31 ;
  $ascii2 = 63 ;
  $ascii2 |= ( ($ascii  3 )  6 ) ;
  $ascii =  2 ;
  $return .= '#x' . str_pad ( dechex( $ascii ) , 2 , '0' , 
STR_PAD_LEFT ) . str_pad ( dechex( $ascii2 ) , 2 , '0' , STR_PAD_LEFT ) 
. ';' ;
} else {
  $return .= $char;
}
  }

  return $return;
}
But at this point i faced even bigger problems when using this kind
of data on JavaScripts or sending the data in an text/plain E-Mail.
I tryed to convert the data back but failed as chr() only supports
a Charset of 255 Characters ( which most languages don't match eg
ru, pl, ch, jp ... )
So my question is if anyone on this list has an idea on how to retrieve
the data completely? Some kind of func_ConvertFromHTML() function.
 -- red
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] XML describing a form

2004-06-30 Thread Pierre
Hi all,
I have to create a form from a xml containing data about the form, but I
really don't know how to process?
I can ask the xml structure I want but I don't know what is better 
Please if you have any information about this?
My harder part is how handle a combo box ?(xml part and php parsing part)
Thanks for all
Pierre 

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



[PHP] Re: Converting strings to match multiple charsets

2004-06-30 Thread Torsten Roehr
Red Wingate [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hey guys,

 i ran into serious trouble when facing the problem to convert
 data, which was retrieved from a single form in our CMS to match
 the requirements of multiple charsets.

 Our CMS uses UTF-8 which worked out quite fine to display the data
 but caused weired symbols when displayed within a TEXTAREA or INPUT
 field.

Can't you use utf8_decode() to display the utf8 encoded data?

 So i tried to convert all characters beyound A-Z,0-9 to
 HTML entities which worked out even better ( i used the following
 functions to convert the data :

 function func_ConvertToHTML ( $string ) {
$strlen = strlen ( $string ) ;
$return = '' ;

for ( $str_pos = 0 ; $str_pos  $strlen ; $str_pos++ ) {
  $char  = substr ( $string , $str_pos , 1 );
  $ascii = ord ( $char );

  if ( $ascii  5 == 6 ) {
$char2  = substr ( $string , ++$str_pos , 1 );
$ascii2 = ord ($char2);

$ascii  = 31 ;
$ascii2 = 63 ;
$ascii2 |= ( ($ascii  3 )  6 ) ;
$ascii =  2 ;

$return .= '#x' . str_pad ( dechex( $ascii ) , 2 , '0' ,
 STR_PAD_LEFT ) . str_pad ( dechex( $ascii2 ) , 2 , '0' , STR_PAD_LEFT )
 . ';' ;
  } else {
$return .= $char;
  }
}

return $return;
 }

 But at this point i faced even bigger problems when using this kind
 of data on JavaScripts or sending the data in an text/plain E-Mail.
 I tryed to convert the data back but failed as chr() only supports
 a Charset of 255 Characters ( which most languages don't match eg
 ru, pl, ch, jp ... )

 So my question is if anyone on this list has an idea on how to retrieve
 the data completely? Some kind of func_ConvertFromHTML() function.

Is this what you're looking for?:
http://de2.php.net/manual/en/function.html-entity-decode.php

Regards,
Torsten Roehr

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



Re: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Justin Patrin
On Wed, 30 Jun 2004 11:00:19 -0700, Joel Kitching [EMAIL PROTECTED] wrote:
 
  1. addslashes() is not as robust as other solutions like
  mysql_escape_string().
 
 What exactly is the difference between the two?

mysql_escape_string() and mysql_real_escape_string() do the escaping
as mysql needs it. In addition, you can use PEAR::DB's quoteSmart to
quote and it will change depending on the DB backend you're using.

 
  2. in either case the slashes will be non-existant when the data is
  actually inserted into the database.
 
  for example:
 
  $mystring = hello here is my string. it has an ' (apostrophe) in it.;
 
  $sql = 
  INSERT INTO data
  (thestring)
  VALUES ('$mystring');
 
  when then is parsed it will look like this:
 
  INSERT INTO data
  (thestring)
  VALUES ('hello here is my string. is has an ' (apostrophe) in
  it.')
 
  as you can see the ' in the original string is going to cause a problem.
  by escaping it with mysql_escape_string() (or another comparable
  function) you'll get the following:
 
  INSERT INTO data
  (thestring)
  VALUES ('hello here is my string. is has an \' (apostrophe) in
  it.')
 
  this string, although it now contains a slash that we originally did not
  want, this slash not exist once the data is actually inserted into the
  database. it's merely there to tell the database hey, please ignore the
  ' that comes directly after me.
 
  s... when you pull the data *out* of the database the \ will not
  exist and you therefore do not need to perform stripslashes().
 
 I tried using addslashes() on the string in the query, and then
 SELECTing it, and the slashes are included.  Does
 mysql_escape_string() not do this?
 

Then you must be getting clashes added twice. Have you tried looking
at the string before running addslashes on it? After running
addslashes? You likely have magic_quotes_gpc turned on. The
overhwelming majority of seasoned PHP developers turn this off as it's
more of a nuisance. If you need more info, search the list archives.

 
  and now to the second part... why use htmlentities()? that is for
  displaying data within a form element OR (i hope i have this right)
  preventing XSS (Cross Site Scripting attacks).
 
  hope this helps!
  chris.
 
 
 
 -- 
 Joel Kitching
 http://midgardmanga.keenspace.com/
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 !DSPAM:40e2fde127427263623!
 
 


-- 
paperCrane --Justin Patrin--

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



RE: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Chris W. Parker
Justin Patrin mailto:[EMAIL PROTECTED]
on Wednesday, June 30, 2004 11:10 AM said:

 mysql_escape_string() and mysql_real_escape_string() do the escaping
 as mysql needs it. In addition, you can use PEAR::DB's quoteSmart to
 quote and it will change depending on the DB backend you're using.

nod /

 Then you must be getting clashes added twice. Have you tried looking
 at the string before running addslashes on it? After running
 addslashes? You likely have magic_quotes_gpc turned on. The
 overhwelming majority of seasoned PHP developers turn this off as it's
 more of a nuisance. If you need more info, search the list archives.

magic_quotes_gpc is likely the reason.



chris.

p.s. does everyone but me have a gmail account or what??

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



[PHP] Re: Converting strings to match multiple charsets

2004-06-30 Thread Red Wingate
[...]
Can't you use utf8_decode() to display the utf8 encoded data?
[...]
The displayed data worked out fine for some languages but others didn't
and even simple german chars like äöü won't show up correctly within
a textarea.
[...]
Is this what you're looking for?:
http://de2.php.net/manual/en/function.html-entity-decode.php
[...]
[quote](PHP 4 = 4.3.0, PHP 5)[/quote]
This won't work on most servers we're hosting our CMS on  :-/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Scott Fletcher
This one look and sound good.  I'll give this a shot.  Thanks a million

Scott F.

John W. Holmes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Red Wingate wrote:

  use quot; to display the data in the input-text element and undo this
  before inserting it into the database
 
  function quoteToHtml ( $string ) {
return str_replace( '' , 'quot;' , $string );
  }
  function htmlToQuote ( $string ) {
return str_replace( 'quot;' , '' , $string );
  }
 
  Only way to go :-)

 You don't need to undo anything in the data submitted from the form.
 This is done automatically. Try it. It's the same as how URL values are
 decoded automatically.

 Also, instead of str_replace, you can use
 htmlentities($string,ENT_QUOTES), which will convert single and double
 quotes (among other characters) just in case you end up using either one
 in your HTML.

 -- 
 ---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



Re: [PHP] XML describing a form

2004-06-30 Thread eoghan
 My harder part is how handle a combo box ?(xml part and php parsing part)
 Thanks for all
 Pierre
this may be of help to you
http://www.topxml.com/xsltStylesheets/xslt_html.asp
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] XML describing a form

2004-06-30 Thread Pierre
Yes I think so.thanks a lot 
And Please all,can you say here the most appreciated and usefull links of
php you have, cause I'm French and don't know English website about php I've
found some with google but there's more I guess so about php xml and mysql
thanks a lot.

Pierre 

-Message d'origine-
De : eoghan [mailto:[EMAIL PROTECTED] 
Envoyé : mercredi 30 juin 2004 19:22
À : Pierre
Cc : php-general
Objet : Re: [PHP] XML describing a form

  My harder part is how handle a combo box ?(xml part and php parsing part)
  Thanks for all
  Pierre

this may be of help to you
http://www.topxml.com/xsltStylesheets/xslt_html.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] XML describing a form

2004-06-30 Thread eoghan
Yes I think so.thanks a lot 
And Please all,can you say here the most appreciated and usefull links of
php you have, cause I'm French and don't know English website about php I've
found some with google but there's more I guess so about php xml and mysql
thanks a lot.
try this:
http://www.tribal-dolphin.net/index.php?op=edito
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Scott Fletcher
and now to the second part... why use htmlentities()? that is for
displaying data within a form element OR (i hope i have this right)
preventing XSS (Cross Site Scripting attacks).
Yep, for displaying the data in the HTML's textbox and to allow us to redo
the data before resubmitting it.

Scott F.

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



Re: [PHP] Re: Earliest PHP/FI

2004-06-30 Thread Marek Kilimajer
Red Wingate wrote --- napísal::
maybe take a look here : http://museum.php.net/
otherwise do some research using google.
Jeff Loiselle wrote:
Does anyone know where I would be able to find the earliest version of 
PHP/FI or PHP possible? I am looking for the earliest possible version 
for academic reasons.

Thanks in advace.

Would be good if the Last Modified showed the release time.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Chris Shiflett
--- Scott Fletcher [EMAIL PROTECTED] wrote:
 I'm using data that goes from the HTML textbox to PHP to MYSQL to
 PHP to HTML textbox.  The only trouble I have is to escape the
 apostrophe character when it is put into the HTML textbox by PHP
 (from MySQL).
 
 --snip--
   echo input type='textbox' value='.$value.';
 --snip--

You could quote your attributes like I do:

input type=text value=foo /

Then apostrophes won't be a problem. :-)

The better answer is to use HTML entities. There's a nice function called
htmlentities() that can help with this.

 I can't use the HTML feature like quot or something because the
 quot would show up in the database...  Any suggestion or advice?

As they say, timing is everything.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread John W. Holmes
Joel Kitching wrote:
s... when you pull the data *out* of the database the \ will not
exist and you therefore do not need to perform stripslashes().

I tried using addslashes() on the string in the query, and then
SELECTing it, and the slashes are included.  Does
mysql_escape_string() not do this?
No, it'll do the same thing because you're escaping the data twice. If 
you ever see slashes in the actual data while it's in the database, then 
you're escaping it twice. You more than likely have magic_quotes_gpc 
enabled which is escaping the data the first time.

Or, you could have magic_quotes_runtime enabled, which will add the 
slashes to data coming _from_ the database (but if you had that enabled, 
 you should recognize what's going on as it's not enabled by default).

--
---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


Re: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Chris Shiflett
--- Justin Patrin [EMAIL PROTECTED] wrote:
 You also shouldn't need addslashes when putting it in. quoteSmart() in
 PEAR::DB is a *much* better option.

That's great for those who use PEAR::DB, but it's not very safe to argue
against addslashes() based on what's in a specific PEAR module.

I would argue that something like mysql_escape_string() is better than
addslashes(), so I agree with you for the most part anyway. :-) It all
depends on what database is being used and how.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



[PHP] Is PEAR worth the effort?

2004-06-30 Thread Will Merrell
I don't mean to start a flame war here, but I have been working in PHP for a
while now and am about to start a more extensive aplication. Some of the
PEAR modules look good and I just wanted to hear what the collected wisdom
out here thinks about it.

When I try to read the installation instructions my eyes glaze over and roll
up into my head. Before I fight my way through this learning curve I want to
know if its worth it? Is this the wave of the future or just a flash in the
pan?

Thanks,
Will Merrell

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



Re: [PHP] Is PEAR worth the effort?

2004-06-30 Thread Justin Patrin
On Wed, 30 Jun 2004 15:21:36 -0400, Will Merrell [EMAIL PROTECTED] wrote:
 
 I don't mean to start a flame war here, but I have been working in PHP for a
 while now and am about to start a more extensive aplication. Some of the
 PEAR modules look good and I just wanted to hear what the collected wisdom
 out here thinks about it.
 
 When I try to read the installation instructions my eyes glaze over and roll
 up into my head. Before I fight my way through this learning curve I want to
 know if its worth it? Is this the wave of the future or just a flash in the
 pan?

PEAR is a repository of lots and lots of useful code. Not only that,
it's *quality* code. All packages have to pass the standards to get in
and package maintainers are expected to keep their packages up to the
standards. The newly appointed PEAR QA group also watches for problems
and imforms authors about them, or can even take action if an author
doesn't respond.

The basics of using PEAR are very simple. If you have PHP installed,
you should also have pear. Try typing pear upgrade-all at your
command-prompt. If it doesn't work, you either don't have it or your
paths need to be fixed.

If you don't have it, it's as easy as:
$ lynx -source http://go-pear.org/ | php

Then you can pear install any package on the site.

Some may argue that PEAR imposes too much restraint on coding
standards and requires use of the PEAR and PEAR_Error classes.

The coding standards are there to promote interoperability and easy
readability across all PEAR packages so that you don't have to
re-learn how to do look at all of the code.

PEAR and PEAR_Error are, according to everyone else, are going to be
pared ;-) down for PHP5, leaving a very minimal amount of extra code
for extra flexibility and such. For the moment, PEAR and PEAR_Error
remain, but IMHO they are very useful. For more discussion (read holy
wars) look at the PEAR and PHP list archives.

-- 
paperCrane --Justin Patrin--

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



RE: [PHP] Is PEAR worth the effort?

2004-06-30 Thread Vincent DUPONT
it does REALLY worth it!
Install is easy, download only thoses packages you need,
extendable, stable...
The doc is sometimes a bit poor, but the basic are always easy 

Vincent

-Original Message-
From: Will Merrell [mailto:[EMAIL PROTECTED]
Sent: mercredi 30 juin 2004 21:22
To: [EMAIL PROTECTED]
Subject: [PHP] Is PEAR worth the effort?


I don't mean to start a flame war here, but I have been working in PHP for a
while now and am about to start a more extensive aplication. Some of the
PEAR modules look good and I just wanted to hear what the collected wisdom
out here thinks about it.

When I try to read the installation instructions my eyes glaze over and roll
up into my head. Before I fight my way through this learning curve I want to
know if its worth it? Is this the wave of the future or just a flash in the
pan?

Thanks,
Will Merrell

-- 
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] Is PEAR worth the effort?

2004-06-30 Thread Dennis Seavers
It's hard to say whether it's worth the effort for you; it depends on what
your going to do, both for your current project and future ones.  However,
in general, I believe the effort you put into learning PEAR is negligible
compared to the yield.  I don't think PEAR is a flash in the pan.


 [Original Message]
 From: Will Merrell [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Date: 06/30/2004 12:22:23 PM
 Subject: [PHP] Is PEAR worth the effort?

 I don't mean to start a flame war here, but I have been working in PHP
for a
 while now and am about to start a more extensive aplication. Some of the
 PEAR modules look good and I just wanted to hear what the collected wisdom
 out here thinks about it.

 When I try to read the installation instructions my eyes glaze over and
roll
 up into my head. Before I fight my way through this learning curve I want
to
 know if its worth it? Is this the wave of the future or just a flash in
the
 pan?

 Thanks,
 Will Merrell

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

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



Re: [PHP] How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Scott Fletcher
In one of the reply to the original posting I made, someone say that
htmlentities() would work and upon submission, the PHP's $_REQUEST, $_POST,
$_GET would get the apostrophe somehow.  (The conversion somewhere would
change it back)

Chris Shiflett [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 --- Scott Fletcher [EMAIL PROTECTED] wrote:
  I'm using data that goes from the HTML textbox to PHP to MYSQL to
  PHP to HTML textbox.  The only trouble I have is to escape the
  apostrophe character when it is put into the HTML textbox by PHP
  (from MySQL).
 
  --snip--
echo input type='textbox' value='.$value.';
  --snip--

 You could quote your attributes like I do:

 input type=text value=foo /

 Then apostrophes won't be a problem. :-)

 The better answer is to use HTML entities. There's a nice function called
 htmlentities() that can help with this.

  I can't use the HTML feature like quot or something because the
  quot would show up in the database...  Any suggestion or advice?

 As they say, timing is everything.

 Chris

 =
 Chris Shiflett - http://shiflett.org/

 PHP Security - O'Reilly
  Coming Fall 2004
 HTTP Developer's Handbook - Sams
  http://httphandbook.org/
 PHP Community Site
  http://phpcommunity.org/

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



Re: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Scott Fletcher
Bummer, mysql_escape_string() is available only in PHP 5 and up.  I'm using
PHP 4.3.1


Chris Shiflett [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 --- Justin Patrin [EMAIL PROTECTED] wrote:
  You also shouldn't need addslashes when putting it in. quoteSmart() in
  PEAR::DB is a *much* better option.

 That's great for those who use PEAR::DB, but it's not very safe to argue
 against addslashes() based on what's in a specific PEAR module.

 I would argue that something like mysql_escape_string() is better than
 addslashes(), so I agree with you for the most part anyway. :-) It all
 depends on what database is being used and how.

 Chris

 =
 Chris Shiflett - http://shiflett.org/

 PHP Security - O'Reilly
  Coming Fall 2004
 HTTP Developer's Handbook - Sams
  http://httphandbook.org/
 PHP Community Site
  http://phpcommunity.org/

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



Re: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Red Wingate
[...]
Bummer, mysql_escape_string() is available only in PHP 5 and up.  I'm using
PHP 4.3.1
[...]
*mo* - wrong
[quote]
mysql_escape_string
(PHP 4 = 4.0.3, PHP 5)
[/quote]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Justin Patrin
On Wed, 30 Jun 2004 15:41:42 -0400, Scott Fletcher [EMAIL PROTECTED] wrote:
 
 Bummer, mysql_escape_string() is available only in PHP 5 and up.  I'm using
 PHP 4.3.1

I know that it's not. Where are you seeing that? According to the manual:
http://us3.php.net/manual/en/function.mysql-escape-string.php

mysql_escape_string
(PHP 4 = 4.0.3, PHP 5)

 
 Chris Shiflett [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 
 
  --- Justin Patrin [EMAIL PROTECTED] wrote:
   You also shouldn't need addslashes when putting it in. quoteSmart() in
   PEAR::DB is a *much* better option.
 
  That's great for those who use PEAR::DB, but it's not very safe to argue
  against addslashes() based on what's in a specific PEAR module.
 
  I would argue that something like mysql_escape_string() is better than
  addslashes(), so I agree with you for the most part anyway. :-) It all
  depends on what database is being used and how.
 
  Chris
 
  =
  Chris Shiflett - http://shiflett.org/
 
  PHP Security - O'Reilly
   Coming Fall 2004
  HTTP Developer's Handbook - Sams
   http://httphandbook.org/
  PHP Community Site
   http://phpcommunity.org/
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 !DSPAM:40e31590154591440146407!
 
 


-- 
paperCrane --Justin Patrin--

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



RE: [PHP] Re: How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Chris W. Parker
Scott Fletcher mailto:[EMAIL PROTECTED]
on Wednesday, June 30, 2004 12:42 PM said:

 Bummer, mysql_escape_string() is available only in PHP 5 and up.  I'm
 using PHP 4.3.1

read the page again bro. :)

http://us4.php.net/mysql_escape_string


chris.

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



[PHP] problem with embeded objects and reference

2004-06-30 Thread Vincent DUPONT
Hi,

could anyone help on this 'by reference' problem.
I have 2 classes. The main class as a child class.
The child class has properties (array)
I would like to be able to manipulate the child's properties even after the child has 
been inserted into the main class.

Does this make sense?

I can do it with by getting a reference of the child class, then setting the 
property,like :
$tmp =  $main-getChild(); //get a reference to the child object
$tmp-setProperty(forth);//ok
OR
$main-setChildProperty(third); //ok

but Whyt can't I do it directly by calling a reference to the child, like in :
$child1-setproperty(second); //The property is not set or not displayed
I know I need a reference to the child class that is within the maoin class, but HOW??


Here is a complete example 


?php

class class1{
var $child; //array

function class1(){
$this-properties = array();
}

//set the child object (class2)
function  setChild($child){
$this-child=$child;
}

//get the child object (class2), and call its setProperty method
function setChildProperty($prop){ 
$theChild =  $this-child;
$theChild-setProperty($prop);
}

//return a reference to the child object
function  getChild(){
return $this-child;
}

//print the child object properties
function display(){
$this-child-toString();
}

}


class class2{
var $properties; //array

function class2(){
$this-properties = array();
}

function  setProperty($new_property){
$this-properties[] = $new_property;
}

function  getProperty($index){
return $this-properties[$index];
}

function toString(){
print_r($this-properties);
}
}


$main =  new class1();

$child1 =  new class2();
$child1-setproperty(first);//displayed

$main-setChild($child1);

$child1-setproperty(second); //NOT DISPLAYED
$main-setChildProperty(third); //displayed
$tmp =  $main-getChild(); //get a reference to the child object
$tmp-setProperty(forth);//displayed

$main-display();
//output : Array ( [0] = first [1] = third [2] = forth ) 
?

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



[PHP] Re: problem with embeded objects and reference

2004-06-30 Thread Red Wingate
Not sure over here, but isn't it
$main-setChild($child1);
Vincent Dupont wrote:
Hi,
could anyone help on this 'by reference' problem.
I have 2 classes. The main class as a child class.
The child class has properties (array)
I would like to be able to manipulate the child's properties even after the child has 
been inserted into the main class.
Does this make sense?
I can do it with by getting a reference of the child class, then setting the 
property,like :
$tmp =  $main-getChild(); //get a reference to the child object
$tmp-setProperty(forth);//ok
OR
$main-setChildProperty(third); //ok
but Whyt can't I do it directly by calling a reference to the child, like in :
$child1-setproperty(second); //The property is not set or not displayed
I know I need a reference to the child class that is within the maoin class, but HOW??
Here is a complete example 

?php
class class1{
var $child; //array
	function class1(){
		$this-properties = array();
	}
	
	//set the child object (class2)
	function  setChild($child){
		$this-child=$child;
	}
	
	//get the child object (class2), and call its setProperty method
	function setChildProperty($prop){ 
		$theChild =  $this-child;
		$theChild-setProperty($prop);
	}
	
	//return a reference to the child object
	function  getChild(){
		return $this-child;
	}
	
	//print the child object properties
	function display(){
		$this-child-toString();
	}

}
class class2{
var $properties; //array

function class2(){
$this-properties = array();
}

function  setProperty($new_property){
$this-properties[] = $new_property;
}

function  getProperty($index){
return $this-properties[$index];
}

function toString(){
print_r($this-properties);
}
}
$main =  new class1();
$child1 =  new class2();
$child1-setproperty(first);//displayed
$main-setChild($child1);
$child1-setproperty(second); //NOT DISPLAYED
$main-setChildProperty(third); //displayed
$tmp =  $main-getChild(); //get a reference to the child object
$tmp-setProperty(forth);//displayed
$main-display();
//output : Array ( [0] = first [1] = third [2] = forth ) 
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] problem with embeded objects and reference

2004-06-30 Thread Chris W. Parker
Vincent DUPONT mailto:[EMAIL PROTECTED]
on Wednesday, June 30, 2004 1:05 PM said:

 Hi,

hi.

 could anyone help on this 'by reference' problem.

when starting a new thread please do not just reply to an ongoing thread
and change the subject. please start a new email.


your fellow list members thank you.

chris.

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



[PHP] Re: problem with embeded objects and reference

2004-06-30 Thread Red Wingate
Lill example:
[...]
$child1-setproperty(first);//displayed
$main-setChild($child1);
$child1-setproperty(second); //NOT DISPLAYED
[...]
$child1 is passed to $main with property 'first'. Later on
you update $child1, but not $main-child, as they are not
the same objects ( equal but not same ).
So i guess you need to
-$main-setChild($child1);
+$main-setChild($child1);
and
-$this-child =  $child;
+$this-child = $child; // MUST !!!
Now i see, $this-child = $child; copys the object instead
of creating a ref.
 -- red
Red Wingate wrote:
Not sure over here, but isn't it
$main-setChild($child1);
Vincent Dupont wrote:
Hi,
could anyone help on this 'by reference' problem.
I have 2 classes. The main class as a child class.
The child class has properties (array)
I would like to be able to manipulate the child's properties even 
after the child has been inserted into the main class.

Does this make sense?
I can do it with by getting a reference of the child class, then 
setting the property,like :
$tmp =  $main-getChild(); //get a reference to the child object
$tmp-setProperty(forth);//ok
OR
$main-setChildProperty(third); //ok

but Whyt can't I do it directly by calling a reference to the child, 
like in :
$child1-setproperty(second); //The property is not set or not 
displayed
I know I need a reference to the child class that is within the maoin 
class, but HOW??

Here is a complete example
?php
class class1{
var $child; //array
function class1(){
$this-properties = array();
}

//set the child object (class2)
function  setChild($child){
$this-child=$child;
}

//get the child object (class2), and call its setProperty method
function setChildProperty($prop){ $theChild =  $this-child;
$theChild-setProperty($prop);
}

//return a reference to the child object
function  getChild(){
return $this-child;
}

//print the child object properties
function display(){
$this-child-toString();
}

}
class class2{
var $properties; //array

function class2(){
$this-properties = array();
}

function  setProperty($new_property){
$this-properties[] = $new_property;
}

function  getProperty($index){
return $this-properties[$index];
}

function toString(){
print_r($this-properties);
}
}

$main =  new class1();
$child1 =  new class2();
$child1-setproperty(first);//displayed
$main-setChild($child1);
$child1-setproperty(second); //NOT DISPLAYED
$main-setChildProperty(third); //displayed
$tmp =  $main-getChild(); //get a reference to the child object
$tmp-setProperty(forth);//displayed
$main-display();
//output : Array ( [0] = first [1] = third [2] = forth ) ?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] problem with embeded objects and reference

2004-06-30 Thread Red Wingate
so, why don't you reply correctly? :p
Chris W. Parker wrote:
Vincent DUPONT mailto:[EMAIL PROTECTED]
on Wednesday, June 30, 2004 1:05 PM said:

Hi,

hi.

could anyone help on this 'by reference' problem.

when starting a new thread please do not just reply to an ongoing thread
and change the subject. please start a new email.
your fellow list members thank you.
chris.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] problem with embeded objects and reference

2004-06-30 Thread Red Wingate
better don't blame the other pal :-)
http://screens.erisx.de/reply.gif
  -- red
Red Wingate wrote:
so, why don't you reply correctly? :p
Chris W. Parker wrote:
Vincent DUPONT mailto:[EMAIL PROTECTED]
on Wednesday, June 30, 2004 1:05 PM said:

Hi,

hi.

could anyone help on this 'by reference' problem.

when starting a new thread please do not just reply to an ongoing thread
and change the subject. please start a new email.
your fellow list members thank you.
chris.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Problem with pspell module

2004-06-30 Thread Shannon Werb
Hi all, I filed a PHP bug related to others I found online, but thought I
would throw it by the list also...
You can find the bug at:
http://bugs.php.net/bug.php?id=28967


[30 Jun 5:40am CEST] shannon at swerb dot com
 
Description:

Hi there, sorry, but I am running out of ideas here...

I have tracked my problem to similar to the bugs 17402 or 8133 or 8464. 
I have tried php 4.3.4 through 4.3.7 including latest snapshot.  My
configure options are:
'./configure' '--with-mysql' '--with-apxs=/usr/local/apache/bin/apxs'
'--includedir=/usr/local/include' '--with-pspell' '--with-xml'
'--with-zlib' '--with-mcrypt=/usr/src/libmcrypt-2.5.7'
'--enable-memory-limit=yes' '--enable-shmop' 

I have also tried various other configurations, the common configure
option is always pspell.  If I remove it the issue goes away...

The issue is that the so module is installed and then I can start apache
standard and with ssl, but cannot do a restart or a graceful without
getting a seg fault and core dumped, can't figure out what is going on
here. i have updated my glib, gmake functions, I have used various
version of aspell, all with no luck.  No matter what I try I cannot get
the pspell module enabled and to allow apache to do a restart or
graceful without a core dump.

I am using apache 1.3.27.

Thanks for your help!

Best Regards,
Shannon

http://www.battcave.com/

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



[PHP] xslt_create

2004-06-30 Thread Pierre
Hi all
Please when i'm trying to use the xslt_create() function php says indefined
function but this is in my phpinfo()
XML Support  active  
XML Namespace Support  active  
EXPAT Version  1.95.6  
Any idea please ? 

Pierre 

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



Re: [PHP] xslt_create

2004-06-30 Thread Ray Hunter
On Wed, 2004-06-30 at 14:30, Pierre wrote:
 Hi all
 Please when i'm trying to use the xslt_create() function php says indefined
 function but this is in my phpinfo()
 XML Support  active  
 XML Namespace Support  active  
 EXPAT Version  1.95.6  
 Any idea please ? 

You need xslt support enabled and built into php.

--
BigDog

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



RE: [PHP] xslt_create

2004-06-30 Thread Pierre
Ok so I must recompile php with this option but I can't is there any php
class easy to use that can do this ?

Pierre 

-Message d'origine-
De : Ray Hunter [mailto:[EMAIL PROTECTED] 
Envoyé : mercredi 30 juin 2004 21:34
À : php-general
Objet : Re: [PHP] xslt_create

On Wed, 2004-06-30 at 14:30, Pierre wrote:
 Hi all
 Please when i'm trying to use the xslt_create() function php says
indefined
 function but this is in my phpinfo()
 XML Support  active  
 XML Namespace Support  active  
 EXPAT Version  1.95.6  
 Any idea please ? 

You need xslt support enabled and built into php.

--
BigDog

-- 
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] xslt_create

2004-06-30 Thread eoghan
on windows? linux?

Pierre wrote:
Ok so I must recompile php with this option but I can't is there any php
class easy to use that can do this ?
Pierre 

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


RE: [PHP] xslt_create

2004-06-30 Thread Ray Hunter
On Wed, 2004-06-30 at 14:36, Pierre wrote:
 Ok so I must recompile php with this option but I can't is there any php
 class easy to use that can do this ?

If you are on a linux box and have php installed via rpm you might be
able to get a php-xslt rpm that you can use. If on windows you can
download the zip file from php.net that contains all the dlls and in
there you will find the php xslt (sablotron) dll and you will have to
uncomment that dll in your php.ini file.

--
BigDog

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



RE: [PHP] xslt_create

2004-06-30 Thread Pierre
Yes it's ok thanks to all :)
But now I have a little problem : my page is all white 
This is my code : 
$xml='frm2004.xml';
$xsl='style1.xsl';
$xslt=xslt_create();
$resultat=xslt_process($xslt,$xml,$xsl);
xslt_free($xslt);
echo $resultat;

what's wrong ? please 

Pierre 

-Message d'origine-
De : Ray Hunter [mailto:[EMAIL PROTECTED] 
Envoyé : mercredi 30 juin 2004 21:45
À : Pierre
Cc : php-general
Objet : RE: [PHP] xslt_create

On Wed, 2004-06-30 at 14:36, Pierre wrote:
 Ok so I must recompile php with this option but I can't is there any php
 class easy to use that can do this ?

If you are on a linux box and have php installed via rpm you might be
able to get a php-xslt rpm that you can use. If on windows you can
download the zip file from php.net that contains all the dlls and in
there you will find the php xslt (sablotron) dll and you will have to
uncomment that dll in your php.ini file.

--
BigDog

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

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



Re: [PHP] How to escape apostrophe in HTML textbox exactly???

2004-06-30 Thread Marek Kilimajer
Scott Fletcher wrote --- napsal::
In one of the reply to the original posting I made, someone say that
htmlentities() would work and upon submission, the PHP's $_REQUEST, $_POST,
$_GET would get the apostrophe somehow.  (The conversion somewhere would
change it back)
the somewhere is in the browser
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] xslt_create

2004-06-30 Thread eoghan
thats really difficult to say without seeing the xsl and xml. theres a 
very good xsl list over at mulberrytech.com too if you need specific xsl 
help
http://www.mulberrytech.com/xsl/xsl-list/index.html

Pierre wrote:
Yes it's ok thanks to all :)
But now I have a little problem : my page is all white 
This is my code : 
$xml='frm2004.xml';
$xsl='style1.xsl';
$xslt=xslt_create();
$resultat=xslt_process($xslt,$xml,$xsl);
xslt_free($xslt);
echo $resultat;

what's wrong ? please 

Pierre 

-Message d'origine-
De : Ray Hunter [mailto:[EMAIL PROTECTED] 
Envoyé : mercredi 30 juin 2004 21:45
À : Pierre
Cc : php-general
Objet : RE: [PHP] xslt_create

On Wed, 2004-06-30 at 14:36, Pierre wrote:
Ok so I must recompile php with this option but I can't is there any php
class easy to use that can do this ?

If you are on a linux box and have php installed via rpm you might be
able to get a php-xslt rpm that you can use. If on windows you can
download the zip file from php.net that contains all the dlls and in
there you will find the php xslt (sablotron) dll and you will have to
uncomment that dll in your php.ini file.
--
BigDog
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] xslt_create

2004-06-30 Thread Pierre
Thanks for the link :)
In case of this is my .xml
?xml version=1.0 encoding=utf-8 ?
?xml:stylesheet type=text/xsl href=style1.xsl? 
formulaire
FRMFAT04001
c001 type=input desc=Societe size=32John
Smith/c001 
c002 type=input desc=Adresse size=3225/c002 
c003 type=input desc=Complement
size=32Internet/c003 
c004 type=input desc=Code postal
size=15English/c004 
c005 type=input desc=Ville size=32Visual
Basic/c005
c006 type=input desc=Comte/Cedex size=32/c006 
/FRMFAT04001
/formulaire

And my .xsl
?xml version=1.0 encoding=utf-8 ?
xsl:stylesheet version=1.0
xmlns:xsl=http://www.w3.org/1999/XSL/Transform;
xsl:output method=html /
xsl:template match=/
xsl:for-each select=/formulaire/FRMFAT04001
!--
 The following for-each loop will iterate through all of the child elements
 of employee 
  -- 
xsl:for-each select=*
xsl:value-of select=@desc /
!--  Note: Curly braces are a shorthand for the value of an attribute
  -- 
xsl:element name=[EMAIL PROTECTED]
!--  Set the Size of the textbox 
  --
xsl:attribute name=size
xsl:value-of select=@size /
/xsl:attribute
!--  Set the Size of the textbox
  -- 
xsl:attribute name=maxlength
xsl:value-of select=@size /
/xsl:attribute
!--  Set the value of the text box
  -- 
xsl:attribute name=value
xsl:value-of select=text() /
/xsl:attribute
br /
/xsl:element
/xsl:for-each
/xsl:for-each
/xsl:template
 /xsl:stylesheet

Pierre

-Message d'origine-
De : eoghan [mailto:[EMAIL PROTECTED] 
Envoyé : mercredi 30 juin 2004 21:52
À : Pierre
Cc : php-general
Objet : Re: [PHP] xslt_create

thats really difficult to say without seeing the xsl and xml. theres a 
very good xsl list over at mulberrytech.com too if you need specific xsl 
help
http://www.mulberrytech.com/xsl/xsl-list/index.html


Pierre wrote:

 Yes it's ok thanks to all :)
 But now I have a little problem : my page is all white 
 This is my code : 
 $xml='frm2004.xml';
 $xsl='style1.xsl';
 $xslt=xslt_create();
 $resultat=xslt_process($xslt,$xml,$xsl);
 xslt_free($xslt);
 echo $resultat;
 
 what's wrong ? please 
 
 Pierre 
 
 -Message d'origine-
 De : Ray Hunter [mailto:[EMAIL PROTECTED] 
 Envoyé : mercredi 30 juin 2004 21:45
 À : Pierre
 Cc : php-general
 Objet : RE: [PHP] xslt_create
 
 On Wed, 2004-06-30 at 14:36, Pierre wrote:
 
Ok so I must recompile php with this option but I can't is there any php
class easy to use that can do this ?
 
 
 If you are on a linux box and have php installed via rpm you might be
 able to get a php-xslt rpm that you can use. If on windows you can
 download the zip file from php.net that contains all the dlls and in
 there you will find the php xslt (sablotron) dll and you will have to
 uncomment that dll in your php.ini file.
 
 --
 BigDog
 

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

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



[PHP] Regular Expression Help

2004-06-30 Thread Pablo Gosse
Hi folks.  I'm having a little bit of a stupid moment with a regular
expression which I'm hoping someone can lend a hand with.

The regular expression I have right now matches strings between 2 and
1000 characters in length that start with one of the following
characters:

a-z
A-Z
0-9
(
)

and where the rest of the string may be made up of the following
characters:

a-z
A-Z
0-9
(
)
_
,
.
-
'


Here's the working regular expresssion:

/^[a-zA-Z0-9\(\)]{1}[ a-zA-Z0-9\(\)_\,\.\-\'\]{1,999}$/

Now, I'm trying to add \ to the valid characters but when I add a slash
after \ I get the following error:

Warning: Compilation failed: missing terminating ] for character class
at offset 54 in
/u0/vservers/*/html/classes/forms/forms_validation_functions.class.p
hp on line 184

So I escape the \ with another \, and I still get the error.

Three or four  \ results in the \ character being stripped from the
string that is being tested with the regular expression.

Five \ results in the orignal error which I get with just one \.

Can anyone give any advice as to why this is happening?

Cheers and TIA.

Pablo




/^[a-zA-Z0-9\(\)]{1}[ a-zA-Z0-9\(\)_\,\.\-\'\]{1,999}$/

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



[PHP] Re: Converting strings to match multiple charsets

2004-06-30 Thread Torsten Roehr
Red Wingate [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 [...]
  Can't you use utf8_decode() to display the utf8 encoded data?
 [...]

 The displayed data worked out fine for some languages but others didn't
 and even simple german chars like äöü won't show up correctly within
 a textarea.

Hi Red,

I'm actually working on a project as well at the moment that uses utf8 data
in MySQL. All chars should be OK when output with utf8_decode(). Do the
chars only look wrong within textarea or also outside of form elements?


 [...]
  Is this what you're looking for?:
  http://de2.php.net/manual/en/function.html-entity-decode.php
 [...]

 [quote](PHP 4 = 4.3.0, PHP 5)[/quote]

 This won't work on most servers we're hosting our CMS on  :-/

Too bad.

Torsten

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



Re: [PHP] Is PEAR worth the effort?

2004-06-30 Thread Torsten Roehr
Justin Patrin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Wed, 30 Jun 2004 15:21:36 -0400, Will Merrell [EMAIL PROTECTED]
wrote:
 
  I don't mean to start a flame war here, but I have been working in PHP
for a
  while now and am about to start a more extensive aplication. Some of the
  PEAR modules look good and I just wanted to hear what the collected
wisdom
  out here thinks about it.
 
  When I try to read the installation instructions my eyes glaze over and
roll
  up into my head. Before I fight my way through this learning curve I
want to
  know if its worth it? Is this the wave of the future or just a flash in
the
  pan?

 PEAR is a repository of lots and lots of useful code. Not only that,
 it's *quality* code. All packages have to pass the standards to get in
 and package maintainers are expected to keep their packages up to the
 standards. The newly appointed PEAR QA group also watches for problems
 and imforms authors about them, or can even take action if an author
 doesn't respond.

 The basics of using PEAR are very simple. If you have PHP installed,
 you should also have pear. Try typing pear upgrade-all at your
 command-prompt. If it doesn't work, you either don't have it or your
 paths need to be fixed.

 If you don't have it, it's as easy as:
 $ lynx -source http://go-pear.org/ | php

 Then you can pear install any package on the site.

 Some may argue that PEAR imposes too much restraint on coding
 standards and requires use of the PEAR and PEAR_Error classes.

 The coding standards are there to promote interoperability and easy
 readability across all PEAR packages so that you don't have to
 re-learn how to do look at all of the code.

 PEAR and PEAR_Error are, according to everyone else, are going to be
 pared ;-) down for PHP5, leaving a very minimal amount of extra code
 for extra flexibility and such. For the moment, PEAR and PEAR_Error
 remain, but IMHO they are very useful. For more discussion (read holy
 wars) look at the PEAR and PHP list archives.

Justin said it all. Just want to put my vote in for PEAR. Give it a try, you
will not regret it.

Regards,
Torsten Roehr

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



  1   2   >