php-general Digest 1 Jul 2010 12:38:34 -0000 Issue 6825

2010-07-01 Thread php-general-digest-help

php-general Digest 1 Jul 2010 12:38:34 - Issue 6825

Topics (messages 306582 through 306594):

Past discussion
306582 by: David McGlone

php processing name vs. id field
306583 by: David Mehler
306584 by: Adam Richardson
306594 by: Bob McConnell

Integers
306585 by: David McGlone
306586 by: Stephen
306592 by: Shreyas Agasthya

Re: Exec not functioning [SOLVED]
306587 by: kronos.aolohr.com

Exec not functioning
306588 by: kronos.aolohr.com

Re: Brandon Rampersad wants to chat
306589 by: George Langley

Re: Regular Expression to get the whole Comma Separated String in Array Key
306590 by: Gaurav Kumar
306593 by: Richard Quadling

Re: Character Encoding for em-dash
306591 by: Gaurav Kumar

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
Hi everyone,

I have been searching the archives for a past discussion where some software 
that some folks use to (I think) save code snippets from e-mails for future 
references or something of such.

Does anyone remember that discussion? I am trying to figure out a good way to 
create my own wiki type thing so I can use it to help me and be able to go 
back and review very helpful e-mails or code that was very helpful to my 
understanding of how it works.

Here lately I've been remembering things that were brought up on the list that 
had very helpful info, but remembering what thread they were in or what topic, 
so I can find it in the archives is harder than I thought it would be.

Anyone have any suggestions, techniques or remember that discussion so I can 
find it in the archives again?

-- 
Blessings,
David M.
---End Message---
---BeginMessage---
Hello,
I've got a php form processing question. I've got a text field like so:

div
label for=txtnameName*:/label
input type=text name=name id=name size=30 value=?php echo
htmlspecialchars($_POST['name']), ENT_QUOTES, UTF-8; ? / br /
/div

My question is what is the purpose of the id field? I know the name
field is what php references, but am not sure what id is for?
Thanks.
Dave.
---End Message---
---BeginMessage---
On Wed, Jun 30, 2010 at 9:16 PM, David Mehler dave.meh...@gmail.com wrote:

 Hello,
 I've got a php form processing question. I've got a text field like so:

 div
 label for=txtnameName*:/label
 input type=text name=name id=name size=30 value=?php echo
 htmlspecialchars($_POST['name']), ENT_QUOTES, UTF-8; ? / br /
 /div

 My question is what is the purpose of the id field? I know the name
 field is what php references, but am not sure what id is for?
 Thanks.
 Dave.

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


Hi Dave,

Sometimes it's helpful to target a specific element for stylistic or
functional purposes, and that's when you'll find an id attribute helpful.

In your example above, label elements use the id in the 'for' attribute
(and, speaking to your example, you should have for=name instead of
for=txtname):
http://www.w3schools.com/tags/tag_label.asp

In terms of CSS, you can specifically reference the element by it's id using
the notation tag_name#id_value, and id's have the highest order of
specificity (i.e., if you try and style an element by tag name, class,
and/or id, the id styles are what will take precedent, all other things
equal.)
http://webdesign.about.com/od/cssselectors/qt/cssselid.htm
http://www.stuffandnonsense.co.uk/archives/css_specificity_wars.html

In terms of javascript, you can reference the element by it's id by using
the function getElementById('id_value):
http://www.tizag.com/javascriptT/javascript-getelementbyid.php

Just remember that a particular id can only occur once on a page (another
difference between the name attributes in a form, as you could have multiple
forms on a page and each form could have an input with a zip name without
issue, but that same page could only have one id with the value zip.)

That all said, with the advent of javascript data attributes, you'll have
one more way to target elements for design and functionality:
http://ejohn.org/blog/html-5-data-attributes/

Hope this helps,

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com
---End Message---
---BeginMessage---
From: Adam Richardson

 On Wed, Jun 30, 2010 at 9:16 PM, David Mehler dave.meh...@gmail.com
wrote:
 
 Hello,
 I've got a php form processing question. I've got a text field like
so:

 div
 label for=txtnameName*:/label
 input type=text name=name id=name size=30 value=?php echo
 htmlspecialchars($_POST['name']), ENT_QUOTES, UTF-8; ? / br /
 /div

 My question is what is the purpose of the 

Re: [PHP] Integers

2010-07-01 Thread Shreyas Agasthya
It would also mean that 7 (8 digits which includes 0) is the highest numeric
representation that you can have or go up to in an octal representation.

So to take your example and represent an octal number :

00100010 (subscript 2) = 1057(subscript 8)

--Shreyas

On Thu, Jul 1, 2010 at 7:42 AM, Stephen stephe...@rogers.com wrote:

 On 10-06-30 10:02 PM, David McGlone wrote:

 Hi again

 I'm trying to learn about octal numbers and I don't understand this:

 Binary: 00100010
 breakdown: (001)= 1 (000)= 0 (101)=5 (111)=7

 I know it's similar to unix permissions, but I'm not understanding where
 for
 example: 111 = 7


 In base 10, which you use every day, we go
 0
 1
 2
 3
 4
 5
 6
 7
 8
 9
 10

 The number 10 is the number of distinct digits we use.

 In binary we only us two, 0 and 1, so 10 is 2 decimal

 So we go

 0 = 0 decimal
 1 = 1  important
 10 = 2  important
 11 = 3
 100 = 4  important
 101 = 5
 110 = 6
 111 = 7

 So binary 111 is 4 + 2 + 1 = 7

 Stephen


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




-- 
Regards,
Shreyas Agasthya


Re: [PHP] Re: Regular Expression to get the whole Comma Separated String in Array Key

2010-07-01 Thread Richard Quadling
On 1 July 2010 06:47, Gaurav Kumar kumargauravjuke...@gmail.com wrote:
 Hey Richard,

 Thanks!!! You have resolved my problem..

 GK


 On Wed, Jun 30, 2010 at 7:42 PM, Gaurav Kumar
 kumargauravjuke...@gmail.comwrote:

 Hi All,

 Need help in resolving the below problem-


 I would like to get the whole comma separated string into an array value-

 1. $postText = chapters 5, 6, 7, 8;
 OR
 2. $postText = chapters 5, 6;
 OR
 3. $postText = chapters 5, 6, 7;

 What i have done so far is-
 preg_match('/chapter[s]*[ ]*(\d+, \d+, \d+)/i', $postText, $matches);

 The above will exactly match the third value $postText = chapters 5, 6,
 7;

 By Above $matches will contain a value of : $matches[1] = '5, 6, 7';

 Now i need a SINGLE regular expression which can match first, second
 variable above or any number of comma separated string and IMPORTANTLY
 provide me that whole comma separated sting value (as above) in single array
 key element like below-

 $matches[1] = '5, 6, 7';
 OR
 $matches[1] = '5, 6';
 OR
 $matches[1] = '5, 6, 7, 8, 9';


 Also I have to use regular expression only as the flow of the code does not
 permit to use any other method to get comma separated string from the
 master/base string.

 Thanks,

 Gaurav Kumar






No problem.

If you are on Windows, then the RegexBuddy application from JGSoft is
pretty good. It allows you to build regex in a step by step way with a
full description of what the regex will do, along with testing and
code snippets. Also has a lot of examples to work from and a built in
support forum.

BTW. I'm not connected to JGSoft. Just a happy licensee.

Richard.
-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



RE: [PHP] php processing name vs. id field

2010-07-01 Thread Bob McConnell
From: Adam Richardson

 On Wed, Jun 30, 2010 at 9:16 PM, David Mehler dave.meh...@gmail.com
wrote:
 
 Hello,
 I've got a php form processing question. I've got a text field like
so:

 div
 label for=txtnameName*:/label
 input type=text name=name id=name size=30 value=?php echo
 htmlspecialchars($_POST['name']), ENT_QUOTES, UTF-8; ? / br /
 /div

 My question is what is the purpose of the id field? I know the name
 field is what php references, but am not sure what id is for?
 
 Sometimes it's helpful to target a specific element for stylistic or
 functional purposes, and that's when you'll find an id attribute
helpful.
 
 In your example above, label elements use the id in the 'for'
attribute
 (and, speaking to your example, you should have for=name instead of
 for=txtname):
 http://www.w3schools.com/tags/tag_label.asp
 
 In terms of CSS, you can specifically reference the element by it's id
using
 the notation tag_name#id_value, and id's have the highest order of
 specificity (i.e., if you try and style an element by tag name, class,
 and/or id, the id styles are what will take precedent, all other
things
 equal.)
 http://webdesign.about.com/od/cssselectors/qt/cssselid.htm
 http://www.stuffandnonsense.co.uk/archives/css_specificity_wars.html
 
 In terms of javascript, you can reference the element by it's id by
using
 the function getElementById('id_value):
 http://www.tizag.com/javascriptT/javascript-getelementbyid.php
 
 Just remember that a particular id can only occur once on a page
(another
 difference between the name attributes in a form, as you could have
multiple
 forms on a page and each form could have an input with a zip name
without
 issue, but that same page could only have one id with the value
zip.)
 
 That all said, with the advent of javascript data attributes, you'll
have
 one more way to target elements for design and functionality:
 http://ejohn.org/blog/html-5-data-attributes/

If you look at the current HTML 4.01 and XHTML 1.0 specification, you
will find 'name' is no longer listed as a standard attribute. It is all
but obsolete and has been replaced by 'id' almost everywhere. They
actually recommend you put both attributes into tags with identical
values until your applications can be updated to drop all uses of the
name attribute.

http://www.w3schools.com/tags/default.asp

Bob McConnell

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



Re: [PHP] php processing name vs. id field

2010-07-01 Thread Peter Lind
On 1 July 2010 14:38, Bob McConnell r...@cbord.com wrote:
 From: Adam Richardson

 On Wed, Jun 30, 2010 at 9:16 PM, David Mehler dave.meh...@gmail.com
 wrote:

 Hello,
 I've got a php form processing question. I've got a text field like
 so:

 div
 label for=txtnameName*:/label
 input type=text name=name id=name size=30 value=?php echo
 htmlspecialchars($_POST['name']), ENT_QUOTES, UTF-8; ? / br /
 /div

 My question is what is the purpose of the id field? I know the name
 field is what php references, but am not sure what id is for?

 Sometimes it's helpful to target a specific element for stylistic or
 functional purposes, and that's when you'll find an id attribute
 helpful.

 In your example above, label elements use the id in the 'for'
 attribute
 (and, speaking to your example, you should have for=name instead of
 for=txtname):
 http://www.w3schools.com/tags/tag_label.asp

 In terms of CSS, you can specifically reference the element by it's id
 using
 the notation tag_name#id_value, and id's have the highest order of
 specificity (i.e., if you try and style an element by tag name, class,
 and/or id, the id styles are what will take precedent, all other
 things
 equal.)
 http://webdesign.about.com/od/cssselectors/qt/cssselid.htm
 http://www.stuffandnonsense.co.uk/archives/css_specificity_wars.html

 In terms of javascript, you can reference the element by it's id by
 using
 the function getElementById('id_value):
 http://www.tizag.com/javascriptT/javascript-getelementbyid.php

 Just remember that a particular id can only occur once on a page
 (another
 difference between the name attributes in a form, as you could have
 multiple
 forms on a page and each form could have an input with a zip name
 without
 issue, but that same page could only have one id with the value
 zip.)

 That all said, with the advent of javascript data attributes, you'll
 have
 one more way to target elements for design and functionality:
 http://ejohn.org/blog/html-5-data-attributes/

 If you look at the current HTML 4.01 and XHTML 1.0 specification, you
 will find 'name' is no longer listed as a standard attribute. It is all
 but obsolete and has been replaced by 'id' almost everywhere. They
 actually recommend you put both attributes into tags with identical
 values until your applications can be updated to drop all uses of the
 name attribute.

 http://www.w3schools.com/tags/default.asp


Errr, what? Name is by no means obsolete for forms. Have a look at
http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#attr-fe-name
- it's still in the html5 spec and there's little to no chance of it
going away any time soon.

Relying on w3schools is not ... really advisable.

Regards
Peter


-- 
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
/hype

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



RE: [PHP] php processing name vs. id field

2010-07-01 Thread Bob McConnell
From: Peter Lind

 On 1 July 2010 14:38, Bob McConnell r...@cbord.com wrote:
 From: Adam Richardson

 On Wed, Jun 30, 2010 at 9:16 PM, David Mehler
dave.meh...@gmail.com
 wrote:

 Hello,
 I've got a php form processing question. I've got a text field like
 so:

 div
 label for=txtnameName*:/label
 input type=text name=name id=name size=30 value=?php
echo
 htmlspecialchars($_POST['name']), ENT_QUOTES, UTF-8; ? / br /
 /div

 My question is what is the purpose of the id field? I know the name
 field is what php references, but am not sure what id is for?

 Sometimes it's helpful to target a specific element for stylistic or
 functional purposes, and that's when you'll find an id attribute
 helpful.

 In your example above, label elements use the id in the 'for'
 attribute
 (and, speaking to your example, you should have for=name instead
of
 for=txtname):
 http://www.w3schools.com/tags/tag_label.asp

 In terms of CSS, you can specifically reference the element by it's
id
 using
 the notation tag_name#id_value, and id's have the highest order of
 specificity (i.e., if you try and style an element by tag name,
class,
 and/or id, the id styles are what will take precedent, all other
 things
 equal.)
 http://webdesign.about.com/od/cssselectors/qt/cssselid.htm
 http://www.stuffandnonsense.co.uk/archives/css_specificity_wars.html

 In terms of javascript, you can reference the element by it's id by
 using
 the function getElementById('id_value):
 http://www.tizag.com/javascriptT/javascript-getelementbyid.php

 Just remember that a particular id can only occur once on a page
 (another
 difference between the name attributes in a form, as you could have
 multiple
 forms on a page and each form could have an input with a zip name
 without
 issue, but that same page could only have one id with the value
 zip.)

 That all said, with the advent of javascript data attributes, you'll
 have
 one more way to target elements for design and functionality:
 http://ejohn.org/blog/html-5-data-attributes/

 If you look at the current HTML 4.01 and XHTML 1.0 specification, you
 will find 'name' is no longer listed as a standard attribute. It is
all
 but obsolete and has been replaced by 'id' almost everywhere. They
 actually recommend you put both attributes into tags with identical
 values until your applications can be updated to drop all uses of the
 name attribute.

 http://www.w3schools.com/tags/default.asp

 
 Errr, what? Name is by no means obsolete for forms. Have a look at

http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#attr
-fe-name
 - it's still in the html5 spec and there's little to no chance of it
 going away any time soon.

HTML5 is years away from completion and still changes far too often, so
we don't consider it nearly ready for prime time. XHTML is here now, has
several usable validation suites and has been stable for years. That's
more of a reasonable target for commercial products.

 Relying on w3schools is not ... really advisable.

Where else would you go? Even W3C doesn't publish decent reference
documents, and their specifications are inscrutable to normal human
beings.

Bob McConnell

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



[PHP] mail() + localhost

2010-07-01 Thread Shreyas Agasthya
PHP'ers,

I am sure this would have been asked a zillion times but I take this as my
turn to get some help. I hate to ask such rhetorical questions but quite
couldn't understand how to tweak this.

All I am trying to do is send a mail from my localhost to my Gmail ID. I
read stuff about how the SMTP port should be accessible; should be open et
al. My set-up is very simple:

1. Using Easy PHP.
2. Windows XP

Also, when the comment says that you need to 'configure' your php.ini, which
.ini should I modify? The reason being, I see that file in two locations,
apparently.
(i) C:\Program Files\EasyPHP 3.0\apache
(ii) C:\Program Files\EasyPHP 3.0\conf_files


*My php.ini (will remove the semi-colon)*
*
*
; For Win32 only.
;SMTP = localhost
;smtp_port = 25

; For Win32 only.
;sendmail_from = m...@example.com

*My  code: *
*
*
*
?php
*

$from= shreya...@gmail.com;
$to =shreya...@gmail.com;
$subject = PHP Testing;
$message = Test Me;
mail ($to,$subject,$message,'From:'.$from);
?
*
*
*
Regards,
*Shreyas Agasthya


Re: [PHP] mail() + localhost

2010-07-01 Thread Andrew Ballard
On Thu, Jul 1, 2010 at 9:09 AM, Shreyas Agasthya shreya...@gmail.com wrote:
 Also, when the comment says that you need to 'configure' your php.ini, which
 .ini should I modify? The reason being, I see that file in two locations,
 apparently.
 (i) C:\Program Files\EasyPHP 3.0\apache
 (ii) C:\Program Files\EasyPHP 3.0\conf_files

Call this in a script running under your web server:

http://www.php.net/phpinfo


Alternatively, you could also look at these:

http://www.php.net/php-ini-loaded-file
http://www.php.net/php-ini-scanned-files


Andrew

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



Re: [PHP] php processing name vs. id field

2010-07-01 Thread Peter Lind
On 1 July 2010 15:02, Bob McConnell r...@cbord.com wrote:
 From: Peter Lind

 On 1 July 2010 14:38, Bob McConnell r...@cbord.com wrote:
 From: Adam Richardson

 On Wed, Jun 30, 2010 at 9:16 PM, David Mehler
 dave.meh...@gmail.com
 wrote:

 Hello,
 I've got a php form processing question. I've got a text field like
 so:

 div
 label for=txtnameName*:/label
 input type=text name=name id=name size=30 value=?php
 echo
 htmlspecialchars($_POST['name']), ENT_QUOTES, UTF-8; ? / br /
 /div

 My question is what is the purpose of the id field? I know the name
 field is what php references, but am not sure what id is for?

 Sometimes it's helpful to target a specific element for stylistic or
 functional purposes, and that's when you'll find an id attribute
 helpful.

 In your example above, label elements use the id in the 'for'
 attribute
 (and, speaking to your example, you should have for=name instead
 of
 for=txtname):
 http://www.w3schools.com/tags/tag_label.asp

 In terms of CSS, you can specifically reference the element by it's
 id
 using
 the notation tag_name#id_value, and id's have the highest order of
 specificity (i.e., if you try and style an element by tag name,
 class,
 and/or id, the id styles are what will take precedent, all other
 things
 equal.)
 http://webdesign.about.com/od/cssselectors/qt/cssselid.htm
 http://www.stuffandnonsense.co.uk/archives/css_specificity_wars.html

 In terms of javascript, you can reference the element by it's id by
 using
 the function getElementById('id_value):
 http://www.tizag.com/javascriptT/javascript-getelementbyid.php

 Just remember that a particular id can only occur once on a page
 (another
 difference between the name attributes in a form, as you could have
 multiple
 forms on a page and each form could have an input with a zip name
 without
 issue, but that same page could only have one id with the value
 zip.)

 That all said, with the advent of javascript data attributes, you'll
 have
 one more way to target elements for design and functionality:
 http://ejohn.org/blog/html-5-data-attributes/

 If you look at the current HTML 4.01 and XHTML 1.0 specification, you
 will find 'name' is no longer listed as a standard attribute. It is
 all
 but obsolete and has been replaced by 'id' almost everywhere. They
 actually recommend you put both attributes into tags with identical
 values until your applications can be updated to drop all uses of the
 name attribute.

 http://www.w3schools.com/tags/default.asp


 Errr, what? Name is by no means obsolete for forms. Have a look at

 http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#attr
 -fe-name
 - it's still in the html5 spec and there's little to no chance of it
 going away any time soon.

 HTML5 is years away from completion and still changes far too often, so
 we don't consider it nearly ready for prime time. XHTML is here now, has
 several usable validation suites and has been stable for years. That's
 more of a reasonable target for commercial products.

 Relying on w3schools is not ... really advisable.

 Where else would you go? Even W3C doesn't publish decent reference
 documents, and their specifications are inscrutable to normal human
 beings.

 Bob McConnell




-- 
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
/hype

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



Re: [PHP] mail() + localhost

2010-07-01 Thread Daniel Brown
On Thu, Jul 1, 2010 at 09:09, Shreyas Agasthya shreya...@gmail.com wrote:

 All I am trying to do is send a mail from my localhost to my Gmail ID. I
 read stuff about how the SMTP port should be accessible; should be open et
 al. My set-up is very simple:

 1. Using Easy PHP.
 2. Windows XP

3.) An SMTP server, I hope...?

 Also, when the comment says that you need to 'configure' your php.ini, which
 .ini should I modify? The reason being, I see that file in two locations,
 apparently.
 (i) C:\Program Files\EasyPHP 3.0\apache
 (ii) C:\Program Files\EasyPHP 3.0\conf_files

In a browser, check the output of phpinfo() - specifically, the
value for Loaded Configuration File - and modify that, as the other
may be for the PHP CLI, another installed component using a local
override, or may not even be used at all.

 *My php.ini (will remove the semi-colon)*
 *
 *
 ; For Win32 only.
 ;SMTP = localhost
 ;smtp_port = 25

Uncomment the two lines above.

 ; For Win32 only.
 ;sendmail_from = m...@example.com

You don't *need* to uncomment and set the `sendmail_from` option,
as long as you set an explicit `From` header in your code.  More on
that after your snippet.

 *My  code: *
 *
 *
 *
 ?php
 *

 $from= shreya...@gmail.com;
 $to =shreya...@gmail.com;
 $subject = PHP Testing;
 $message = Test Me;
 mail ($to,$subject,$message,'From:'.$from);
 ?

Your code should be modified just a bit for better conformance and
portability, but I understand that you're just using it as a test.
After following the suggestions above (and remembering to restart
Apache, of course), try this:

?php

  $from = sherya...@gmail.com;

  // Gmail allows (\+[a-z0-9\.\-_]+) appended to your username to
filter emails in your Gmail box.
  $to = shreyasbr+phpt...@gmail.com;

  // This will append (at the moment, my local time) 1 Jul 2010, 09:27:23
  $subject = PHP Testing .date(j M Y, H:i:s);

  $message = Test Me.;

  // Create your headers, remembering to terminate each line with CRLF
(\r\n) to comply with RFC [2]821.
  $headers  = From: .$from.\r\n;
  $headers .= X-Mailer: PHP/.phpversion().\r\n;

  // Send it, or inform us of an error.  No need to use a -f flag here.
  if (!mail($to,$subject,$body,$headers)) {
echo Ah, crap.  Something's SNAFU'd here.;
exit(-1);
  }
?

-- 
/Daniel P. Brown
UNADVERTISED DEDICATED SERVER SPECIALS
SAME-DAY SETUP
Just ask me what we're offering today!
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/

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



[PHP] how to use HTML Symbol Entities with mail() ?

2010-07-01 Thread cr.vegelin
Hi List,

I am working on generated emails, using the mail() function.
Works fine, but when including characters like #8743 (= and;) or #8744; (= 
or;)
in the message, these characters are displayed as ? in the emails.

Snippet:
$headers  = 'MIME-Version: 1.0' . \r\n;
$headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n;
...
$bool = mail ($mailto, $subject, $body, $headers);

also tested with:
$headers .= 'Content-type: text/html; charset=UTF-8' . \r\n;
but without result.

Any ideas ?
TIA, Cor

Re: [PHP] php processing name vs. id field

2010-07-01 Thread Peter Lind
On 1 July 2010 15:28, Peter Lind peter.e.l...@gmail.com wrote:
 On 1 July 2010 15:02, Bob McConnell r...@cbord.com wrote:
 From: Peter Lind

 On 1 July 2010 14:38, Bob McConnell r...@cbord.com wrote:
 From: Adam Richardson

 On Wed, Jun 30, 2010 at 9:16 PM, David Mehler
 dave.meh...@gmail.com
 wrote:

 Hello,
 I've got a php form processing question. I've got a text field like
 so:

 div
 label for=txtnameName*:/label
 input type=text name=name id=name size=30 value=?php
 echo
 htmlspecialchars($_POST['name']), ENT_QUOTES, UTF-8; ? / br /
 /div

 My question is what is the purpose of the id field? I know the name
 field is what php references, but am not sure what id is for?

 Sometimes it's helpful to target a specific element for stylistic or
 functional purposes, and that's when you'll find an id attribute
 helpful.

 In your example above, label elements use the id in the 'for'
 attribute
 (and, speaking to your example, you should have for=name instead
 of
 for=txtname):
 http://www.w3schools.com/tags/tag_label.asp

 In terms of CSS, you can specifically reference the element by it's
 id
 using
 the notation tag_name#id_value, and id's have the highest order of
 specificity (i.e., if you try and style an element by tag name,
 class,
 and/or id, the id styles are what will take precedent, all other
 things
 equal.)
 http://webdesign.about.com/od/cssselectors/qt/cssselid.htm
 http://www.stuffandnonsense.co.uk/archives/css_specificity_wars.html

 In terms of javascript, you can reference the element by it's id by
 using
 the function getElementById('id_value):
 http://www.tizag.com/javascriptT/javascript-getelementbyid.php

 Just remember that a particular id can only occur once on a page
 (another
 difference between the name attributes in a form, as you could have
 multiple
 forms on a page and each form could have an input with a zip name
 without
 issue, but that same page could only have one id with the value
 zip.)

 That all said, with the advent of javascript data attributes, you'll
 have
 one more way to target elements for design and functionality:
 http://ejohn.org/blog/html-5-data-attributes/

 If you look at the current HTML 4.01 and XHTML 1.0 specification, you
 will find 'name' is no longer listed as a standard attribute. It is
 all
 but obsolete and has been replaced by 'id' almost everywhere. They
 actually recommend you put both attributes into tags with identical
 values until your applications can be updated to drop all uses of the
 name attribute.

 http://www.w3schools.com/tags/default.asp


 Errr, what? Name is by no means obsolete for forms. Have a look at

 http://dev.w3.org/html5/spec/association-of-controls-and-forms.html#attr
 -fe-name
 - it's still in the html5 spec and there's little to no chance of it
 going away any time soon.

 HTML5 is years away from completion and still changes far too often, so
 we don't consider it nearly ready for prime time. XHTML is here now, has
 several usable validation suites and has been stable for years. That's
 more of a reasonable target for commercial products.

 Relying on w3schools is not ... really advisable.

 Where else would you go? Even W3C doesn't publish decent reference
 documents, and their specifications are inscrutable to normal human
 beings.

 Bob McConnell


Sorry about the empty mail, a mistake.

Apart from that, html5 is not going to do away with the name
attribute. And name is in xhtml1 and html4.01 and there's no mention
of it being obsolete, deprecated or in any other fashion on the way
out.

As far as reference: the source.
http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_XHTML-1.0-Strict very
clearly specifies that name is still a very valid attribute.
http://www.w3.org/TR/html401/interact/forms.html#h-17.4 shows the same
in a slightly more readable format - the only mentions of anything
deprecated (there are no references to anything obsolete) are for the
isindex element and the align attribute of the legend element.

What is the case regarding the name attribute is that it's been
deprecated for a few elements (such as a, form, frame, img) in XHTML1
and will be removed in XHTML2 (which we'll likely never see used in
browsers). See http://www.w3.org/TR/xhtml1/#h-4.10

Regards
Peter

-- 
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
/hype

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



Re: [PHP] mail() + localhost

2010-07-01 Thread Shreyas Agasthya
Erm... understood.

I modified the changes to look like this in the php.ini file (the right
one based on the output of phpinfo()).

3)
*smtp = smtp.gmail.com*
*smtp_port = 587*
*
*
*I get : Failed to connect to mailserver at localhost port 587, verify
your SMTP and smtp_port setting in php.ini*
*
*
Regards,
Shreyas

On Thu, Jul 1, 2010 at 7:03 PM, Daniel Brown danbr...@php.net wrote:

 On Thu, Jul 1, 2010 at 09:09, Shreyas Agasthya shreya...@gmail.com
 wrote:
 
  All I am trying to do is send a mail from my localhost to my Gmail ID. I
  read stuff about how the SMTP port should be accessible; should be open
 et
  al. My set-up is very simple:
 
  1. Using Easy PHP.
  2. Windows XP

 3.) An SMTP server, I hope...?

  Also, when the comment says that you need to 'configure' your php.ini,
 which
  .ini should I modify? The reason being, I see that file in two locations,
  apparently.
  (i) C:\Program Files\EasyPHP 3.0\apache
  (ii) C:\Program Files\EasyPHP 3.0\conf_files

 In a browser, check the output of phpinfo() - specifically, the
 value for Loaded Configuration File - and modify that, as the other
 may be for the PHP CLI, another installed component using a local
 override, or may not even be used at all.

  *My php.ini (will remove the semi-colon)*
  *
  *
  ; For Win32 only.
  ;SMTP = localhost
  ;smtp_port = 25

 Uncomment the two lines above.

  ; For Win32 only.
  ;sendmail_from = m...@example.com

 You don't *need* to uncomment and set the `sendmail_from` option,
 as long as you set an explicit `From` header in your code.  More on
 that after your snippet.

  *My  code: *
  *
  *
  *
  ?php
  *
 
  $from= shreya...@gmail.com;
  $to =shreya...@gmail.com;
  $subject = PHP Testing;
  $message = Test Me;
  mail ($to,$subject,$message,'From:'.$from);
  ?

 Your code should be modified just a bit for better conformance and
 portability, but I understand that you're just using it as a test.
 After following the suggestions above (and remembering to restart
 Apache, of course), try this:

 ?php

  $from = sherya...@gmail.com;

  // Gmail allows (\+[a-z0-9\.\-_]+) appended to your username to
 filter emails in your Gmail box.
  $to = shreyasbr+phpt...@gmail.com shreyasbr%2bphpt...@gmail.com;

  // This will append (at the moment, my local time) 1 Jul 2010, 09:27:23
  $subject = PHP Testing .date(j M Y, H:i:s);

  $message = Test Me.;

  // Create your headers, remembering to terminate each line with CRLF
 (\r\n) to comply with RFC [2]821.
  $headers  = From: .$from.\r\n;
  $headers .= X-Mailer: PHP/.phpversion().\r\n;

  // Send it, or inform us of an error.  No need to use a -f flag here.
  if (!mail($to,$subject,$body,$headers)) {
echo Ah, crap.  Something's SNAFU'd here.;
exit(-1);
  }
 ?

 --
 /Daniel P. Brown
 UNADVERTISED DEDICATED SERVER SPECIALS
 SAME-DAY SETUP
 Just ask me what we're offering today!
 daniel.br...@parasane.net || danbr...@php.net
 http://www.parasane.net/ || http://www.pilotpig.net/




-- 
Regards,
Shreyas Agasthya


Re: [PHP] mail() + localhost

2010-07-01 Thread Shreyas Agasthya
Spoke too fast.

Fixed that (SMTP has to be uppercase)

Now it is : *SMTP server response: 530 5.7.0 Must issue a STARTTLS command
first. c15sm7128213rvi.11*

On Thu, Jul 1, 2010 at 7:25 PM, Shreyas Agasthya shreya...@gmail.comwrote:

 Erm... understood.

 I modified the changes to look like this in the php.ini file (the right
 one based on the output of phpinfo()).

 3)
 *smtp = smtp.gmail.com*
 *smtp_port = 587*
 *
 *
 *I get : Failed to connect to mailserver at localhost port 587, verify
 your SMTP and smtp_port setting in php.ini*
 *
 *
 Regards,
 Shreyas

 On Thu, Jul 1, 2010 at 7:03 PM, Daniel Brown danbr...@php.net wrote:

 On Thu, Jul 1, 2010 at 09:09, Shreyas Agasthya shreya...@gmail.com
 wrote:
 
  All I am trying to do is send a mail from my localhost to my Gmail ID. I
  read stuff about how the SMTP port should be accessible; should be open
 et
  al. My set-up is very simple:
 
  1. Using Easy PHP.
  2. Windows XP

 3.) An SMTP server, I hope...?

  Also, when the comment says that you need to 'configure' your php.ini,
 which
  .ini should I modify? The reason being, I see that file in two
 locations,
  apparently.
  (i) C:\Program Files\EasyPHP 3.0\apache
  (ii) C:\Program Files\EasyPHP 3.0\conf_files

 In a browser, check the output of phpinfo() - specifically, the
 value for Loaded Configuration File - and modify that, as the other
 may be for the PHP CLI, another installed component using a local
 override, or may not even be used at all.

  *My php.ini (will remove the semi-colon)*
  *
  *
  ; For Win32 only.
  ;SMTP = localhost
  ;smtp_port = 25

 Uncomment the two lines above.

  ; For Win32 only.
  ;sendmail_from = m...@example.com

 You don't *need* to uncomment and set the `sendmail_from` option,
 as long as you set an explicit `From` header in your code.  More on
 that after your snippet.

  *My  code: *
  *
  *
  *
  ?php
  *
 
  $from= shreya...@gmail.com;
  $to =shreya...@gmail.com;
  $subject = PHP Testing;
  $message = Test Me;
  mail ($to,$subject,$message,'From:'.$from);
  ?

 Your code should be modified just a bit for better conformance and
 portability, but I understand that you're just using it as a test.
 After following the suggestions above (and remembering to restart
 Apache, of course), try this:

 ?php

  $from = sherya...@gmail.com;

  // Gmail allows (\+[a-z0-9\.\-_]+) appended to your username to
 filter emails in your Gmail box.
  $to = shreyasbr+phpt...@gmail.com shreyasbr%2bphpt...@gmail.com;

  // This will append (at the moment, my local time) 1 Jul 2010, 09:27:23
  $subject = PHP Testing .date(j M Y, H:i:s);

  $message = Test Me.;

  // Create your headers, remembering to terminate each line with CRLF
 (\r\n) to comply with RFC [2]821.
  $headers  = From: .$from.\r\n;
  $headers .= X-Mailer: PHP/.phpversion().\r\n;

  // Send it, or inform us of an error.  No need to use a -f flag here.
  if (!mail($to,$subject,$body,$headers)) {
echo Ah, crap.  Something's SNAFU'd here.;
exit(-1);
  }
 ?

 --
 /Daniel P. Brown
 UNADVERTISED DEDICATED SERVER SPECIALS
 SAME-DAY SETUP
 Just ask me what we're offering today!
 daniel.br...@parasane.net || danbr...@php.net
 http://www.parasane.net/ || http://www.pilotpig.net/




 --
 Regards,
 Shreyas Agasthya




-- 
Regards,
Shreyas Agasthya


Re: [PHP] mail() + localhost

2010-07-01 Thread Daniel Brown
On Thu, Jul 1, 2010 at 10:02, Shreyas Agasthya shreya...@gmail.com wrote:
 Spoke too fast.

 Fixed that (SMTP has to be uppercase)

 Now it is : *SMTP server response: 530 5.7.0 Must issue a STARTTLS command
 first. c15sm7128213rvi.11*

(Quick note: per the list guidelines, please don't top-post in threads.)

That error message is because you're trying to connect to an SMTPS
(secure, SSL-encrypted SMTP) server using plain text, which won't
work.  If you have a plain SMTP server running, try that to get one
thing resolved at a time.  Change the port to 25 in your php.ini (and,
again, restart Apache) if plain SMTP is available on the default port.

-- 
/Daniel P. Brown
UNADVERTISED DEDICATED SERVER SPECIALS
SAME-DAY SETUP
Just ask me what we're offering today!
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/

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



Re: [PHP] php processing name vs. id field

2010-07-01 Thread Paul M Foster
On Thu, Jul 01, 2010 at 03:40:56PM +0200, Peter Lind wrote:

snip
 
 Apart from that, html5 is not going to do away with the name
 attribute. And name is in xhtml1 and html4.01 and there's no mention
 of it being obsolete, deprecated or in any other fashion on the way
 out.
 
 As far as reference: the source.
 http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_XHTML-1.0-Strict very
 clearly specifies that name is still a very valid attribute.
 http://www.w3.org/TR/html401/interact/forms.html#h-17.4 shows the same
 in a slightly more readable format - the only mentions of anything
 deprecated (there are no references to anything obsolete) are for the
 isindex element and the align attribute of the legend element.
 
 What is the case regarding the name attribute is that it's been
 deprecated for a few elements (such as a, form, frame, img) in XHTML1
 and will be removed in XHTML2 (which we'll likely never see used in
 browsers). See http://www.w3.org/TR/xhtml1/#h-4.10

All this is fortunate, since I don't think PHP is even aware of the ID
attribute. Imagine trying to process form fields without the name
attribute being present.

Paul

-- 
Paul M. Foster

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



Re: [PHP] mail() + localhost

2010-07-01 Thread Shreyas Agasthya
Not sure where I am top-posting. I posted to my own mail so that one gets to
know the latest. Nevertheless, I wouldn't go against the guidelines as I
completely understand the havoc that it can create.

The port is 587 as per Google; SMTP that I am using
is Google's (anything wrong here?). If there is a rudimentary mistake that I
am doing, please guide me.

Regards,
Shreyas

On Thu, Jul 1, 2010 at 7:46 PM, Daniel Brown danbr...@php.net wrote:

 On Thu, Jul 1, 2010 at 10:02, Shreyas Agasthya shreya...@gmail.com
 wrote:
  Spoke too fast.
 
  Fixed that (SMTP has to be uppercase)
 
  Now it is : *SMTP server response: 530 5.7.0 Must issue a STARTTLS
 command
  first. c15sm7128213rvi.11*

(Quick note: per the list guidelines, please don't top-post in threads.)

That error message is because you're trying to connect to an SMTPS
 (secure, SSL-encrypted SMTP) server using plain text, which won't
 work.  If you have a plain SMTP server running, try that to get one
 thing resolved at a time.  Change the port to 25 in your php.ini (and,
 again, restart Apache) if plain SMTP is available on the default port.

 --
 /Daniel P. Brown
 UNADVERTISED DEDICATED SERVER SPECIALS
 SAME-DAY SETUP
 Just ask me what we're offering today!
 daniel.br...@parasane.net || danbr...@php.net
 http://www.parasane.net/ || http://www.pilotpig.net/




-- 
Regards,
Shreyas Agasthya


Re: [PHP] Integers

2010-07-01 Thread tedd

At 10:02 PM -0400 6/30/10, David McGlone wrote:

Hi again

I'm trying to learn about octal numbers and I don't understand this:

Binary: 00100010
breakdown: (001)= 1 (000)= 0 (101)=5 (111)=7

I know it's similar to unix permissions, but I'm not understanding where for
example: 111 = 7

wikipedia has got me all confused.

--
Blessings,
David M.


David:

You're mixing things (Octal/Permissions)-- let's deal with Octal first.

All number systems have a defined base for the power of their 
placeholder. Our Decimal system is based upon tens. More explicitly 
-- each placeholder in the Decimal system is dependant on a power of 
ten. For example, the number 559 (DEC) is simply:


(5 x 10^2) + (5 x 10^1) + (9 x 10^0)

That's 5 times 10 to the power of two, plus 5 times 10 to the power 
of 1, plus 9 times ten to the power of zero (which is always 1). The 
sum of the products is 559.


I won't go into the reasons why we want to convert numbers between 
bases, but there are reasons.


The beauty of Octal (base 8) is it is much easier to convert from 
Binary than it is to convert Binary to Decimal. Additionally, it's 
simpler to convert Octal to Decimal than it is to convert Binary to 
Decimal, Lastly, it is much easier to take the conversion from Binary 
to Octal and then convert from Octal to Decimal in a two step process 
than it is to it all at once by converting Binary to Decimal. That's 
the main reason why we use Octal.


For example:

If you take the Binary number:

00100010 (BIN)

and translate that to Octal, you have:

1057 (OCT)

How did I do that? That is (as you said above) a very easy process -- 
you just break it up into groups of three.


(100) = 1, (000) = 0, (101) = 5, (111) = 7

But what you are actually doing is:

1 x 10^3 (OCT) + 0 x 10^2 (OCT) + 5 x 10^1 (OCT) + 7 x 1 x 10^0( OCT)

-- side note --
Why is 111 = 7? It's because:

1 x 10^2 = 4
1 x 10^1 = 2
1 x 10^0 = 1

Total 7 -- Interestingly enough it's 7 in both Octal and Decimal (and 
anything greater than base 8).

-- end of side note ---

But realize the number 10 in Octal is 8 in Decimal. As such, I can 
convert Octal to Decimal pretty easily by:


1 x 8^3 = 512
0 x 8^2 = 0
5 x 8^1 = 40
7 x 8^0 = 7

559 (DEC)

Please note 4 computations.

Whereas, if I tried to convert Binary (base 2) directly to Decimal 
(based 10) it would go like this:


0010 0010  (BIN)

1 x 10^9 = 512
0 x 10^8 = 0
0 x 10^7 = 0
0 x 10^6 = 0
1 x 10^5 = 32
0 x 10^4 = 0
1 x 10^3 = 8
1 x 10^2 = 4
1 x 10^1 = 2
1 x 10^0 = 1

Total: 559

Please note 10 computations!

As you can see above, it is *much* easier to take a Binary number and 
break it into Octal portions by simply looking at the pairs of three, 
namely:


(100) = 1, (000) = 0, (101) = 5, (111) = 7

And from that run the Octal to Decimal conversion.

=== Now permissions ===

Permissions are set to the power of 8 (Octal). Why? Because we don't 
need a higher base number system to cover the needs of setting 
permissions. It is defined as:


read (r) = 4
write (w) = 2
execute (x) = 1

So, the numbers mean:
 7 = rwx (read write execute)
 6 = rw- (read and write)
 5 = r-x (read and execute)
 4 = r-- (read)
 3 = -wx (write and execute)
 2 = -w- (write)
 1 = --x (execute
 0 = --- (no access)

The permission system for files/directories is divided into 
divisions, namely Owner, Group, and ALL. Each division can have 
their own permission settings. The standard is to list them in order 
of  Owner, Group, and ALL such as:


777 means that all three divisions have their permission set to read, 
write, and execute.
755 means that the Owner has permission set to read, write, and 
execute whereas the Group, and ALL have their permissions set to 
only read and execute.


You often see this displayed as:

Owner   Group   All  example   ---   chmod 777
rwx  rwx  rwx  rwx rwx rwx

Owner   Group   All  example  ---   chmod 755
rwx  r-x  r-x  rwx r-x -r-x

Owner   Group   All  example   ---   chmod 766
rwx  rw-  rw-  rwx rw- rw-

Owner   Group   All  example   ---   chmod 644
rw-  r--  r--  rw- r-- -r--

Owner   Group   All  example   ---   chmod 600
rw-  ---  ---  rw- --- ---

There is no magical rule why we use Octal for this. In fact, we could 
have used any system greater than base 8 -- even base 16 (HEX), but 
there was no need for more (there is, but I don't want to explain 
that).


I hope this lifts some of the confusion.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Integers (correction)

2010-07-01 Thread tedd



Correction

I said:


1 x 10^9 = 512
0 x 10^8 = 0
0 x 10^7 = 0
0 x 10^6 = 0
1 x 10^5 = 32
0 x 10^4 = 0
1 x 10^3 = 8
1 x 10^2 = 4
1 x 10^1 = 2
1 x 10^0 = 1


It should have been:

1 x 2^9 = 512
0 x 2^8 = 0
0 x 2^7 = 0
0 x 2^6 = 0
1 x 2^5 = 32
0 x 2^4 = 0
1 x 2^3 = 8
1 x 2^2 = 4
1 x 2^1 = 2

Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] PHP 5 Configuration

2010-07-01 Thread Gustavo Carrasco

I've been trying to install PHP5 with windows XP, but i had received the next 
errors:
- Error trying to access the local web services Get Object failed. You will 
need manual configure the web 

server. 
- Error trying to access mime type file. You will need manual configure the web 
server.
Somebody can help me???
Regards

 
  
_
Agudiza los sentidos que viene un nuevo Messenger ¿estás listo?
http://explore.live.com/windows-live-messenger

Re: [PHP] PHP 5 Configuration

2010-07-01 Thread Ashley Sheridan
On Thu, 2010-07-01 at 19:24 +0100, Gustavo Carrasco wrote:

 I've been trying to install PHP5 with windows XP, but i had received the next 
 errors:
 - Error trying to access the local web services Get Object failed. You will 
 need manual configure the web 
 
 server. 
 - Error trying to access mime type file. You will need manual configure the 
 web server.
 Somebody can help me???
 Regards
 
  
 
 _
 Agudiza los sentidos que viene un nuevo Messenger ¿estás listo?
 http://explore.live.com/windows-live-messenger


It seems to suggest that you've not installed a web server, such as
Apache or IIS. Of the two I'd choose Apache as it's by far the most
configurable and secure.

Thanks,
Ash
http://www.ashleysheridan.co.uk




RE: [PHP] PHP 5 Configuration

2010-07-01 Thread Ashley Sheridan
On Thu, 2010-07-01 at 19:38 +0100, Gustavo Carrasco wrote:

 Hi, nice to meet you.
 I had installed Apache, and his service is running good.
 There's any sequence about how to install this products? or maybe i
 need to modify some lines in httpd file or php.ini file?
  
 
 __
 Subject: Re: [PHP] PHP 5 Configuration
 From: a...@ashleysheridan.co.uk
 To: carrascojg...@hotmail.com
 CC: php-general@lists.php.net
 Date: Thu, 1 Jul 2010 19:28:30 +0100
 
 On Thu, 2010-07-01 at 19:24 +0100, Gustavo Carrasco wrote: 
 
 I've been trying to install PHP5 with windows XP, but i had received 
 the next errors:
 - Error trying to access the local web services Get Object failed. 
 You will need manual configure the web 
 
 server. 
 - Error trying to access mime type file. You will need manual 
 configure the web server.
 Somebody can help me???
 Regards
 
  
 
 _
 Agudiza los sentidos que viene un nuevo Messenger ¿estás listo?
 http://explore.live.com/windows-live-messenger
 
 
 It seems to suggest that you've not installed a web server, such as
 Apache or IIS. Of the two I'd choose Apache as it's by far the most
 configurable and secure.
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
 
 
 
 
 
 __
 Hotmail prepara novedades y sorpresas en breve, ¡estate atento!


The php.net download area should have both the .exe install files and
instructions about how to get it configured with a web server.

Thanks,
Ash
http://www.ashleysheridan.co.uk




RE: [PHP] PHP 5 Configuration

2010-07-01 Thread Gustavo Carrasco

Hi, nice to meet you.

I had installed Apache, and his service is running good.

There's any sequence about how to install this products? or maybe i need to 
modify some lines in httpd file or php.ini file?

 


Subject: Re: [PHP] PHP 5 Configuration
From: a...@ashleysheridan.co.uk
To: carrascojg...@hotmail.com
CC: php-general@lists.php.net
Date: Thu, 1 Jul 2010 19:28:30 +0100

On Thu, 2010-07-01 at 19:24 +0100, Gustavo Carrasco wrote: 
I've been trying to install PHP5 with windows XP, but i had received the next 
errors:
- Error trying to access the local web services Get Object failed. You will 
need manual configure the web 

server. 
- Error trying to access mime type file. You will need manual configure the web 
server.
Somebody can help me???
Regards

 
  
_
Agudiza los sentidos que viene un nuevo Messenger ¿estás listo?
http://explore.live.com/windows-live-messenger

It seems to suggest that you've not installed a web server, such as Apache or 
IIS. Of the two I'd choose Apache as it's by far the most configurable and 
secure.





Thanks,
Ash
http://www.ashleysheridan.co.uk


  
_
No has visto nada como el nuevo Messenger, ¡te sorprenderá!
http://explore.live.com/windows-live-messenger

[PHP] The script tried to execute a method or access a property of an incomplete object.

2010-07-01 Thread Rene Veerman
Hi, i got this error that i can't figure out.. Maybe you can help;

Notice: mbConfig(): The script tried to execute a method or access a
property of an incomplete object. Please ensure that the class
definition classCoreDBtable of the object you are trying to operate
on was loaded _before_ unserialize() gets called or provide a
__autoload() function to load the class definition in
/media/500gb/data2/www/htdocs/work_myown/mediaBeez/php/lib_mediaBeez.php
on line 540



lib_mediaBeez.php:540+;
function mbConfig ($name) {

$value = null;

540:if (class_exists('classCoreDBtable') 
isset($_SESSION[mb_site_preferences]) 
is_array($_SESSION[mb_site_preferences]-rec)) {

$sp = $_SESSION[mb_site_preferences];

if (array_key_exists($name, $sp-rec)) $value = $sp-rec[$name];

}



//defaults required?

if (is_null($value)) {

switch ($name) {

case sp_theme: $value=mediaBeez_default; break;

case sp_thumb_width : $value=95; break;

case sp_thumb_height : $value = 95; break;

case sp_midres_width : $value=800; break;

case sp_midres_height : $value = 600; break;



case sp_buttonTheme : $value=orangeGreenBlue; break;

case sp_menu_theme : $value=whiteBlue; break;



lib_mediaBeez.php:0;
?php

require_once (defines_mediaBeez.php);
require_once ('core_db_table.php');




So i do include the class, yet i get this error.
Any clues will be much appreciated..


-- 
-
Greetings from Rene7705,

My free open source webcomponents:
  http://code.google.com/u/rene7705/
  http://mediabeez.ws/downloads (and demos)

My music (i'm DJ firesnake)
  http://mediabeez.ws/music

http://www.facebook.com/rene7705
-

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



[PHP] Re: The script tried to execute a method or access a property of an incomplete object.

2010-07-01 Thread Rene Veerman
On Thu, Jul 1, 2010 at 9:49 PM, Rene Veerman rene7...@gmail.com wrote:
 Hi, i got this error that i can't figure out.. Maybe you can help;

 Notice: mbConfig(): The script tried to execute a method or access a
 property of an incomplete object. Please ensure that the class
 definition classCoreDBtable of the object you are trying to operate
 on was loaded _before_ unserialize() gets called or provide a
 __autoload() function to load the class definition in
 /media/500gb/data2/www/htdocs/work_myown/mediaBeez/php/lib_mediaBeez.php
 on line 540


I have a partial fix, thanks to
http://stackoverflow.com/questions/965611/forcing-access-to-php-incomplete-class-object-properties

function fixObject ($object)
{
  if (!is_object ($object)  gettype ($object) == 'object')
return ($object = unserialize (serialize ($object)));
  return $object;
}

I believe this to be a hack, to call this function to fix my objects.
But it gets me going again.
I'm still holding out for more tips though ;)




 lib_mediaBeez.php:540+;
 function mbConfig ($name) {

        $value = null;

 540:    if (class_exists('classCoreDBtable') 
 isset($_SESSION[mb_site_preferences]) 
 is_array($_SESSION[mb_site_preferences]-rec)) {

                $sp = $_SESSION[mb_site_preferences];

                if (array_key_exists($name, $sp-rec)) $value = 
 $sp-rec[$name];

        }



        //defaults required?

        if (is_null($value)) {

                switch ($name) {

                case sp_theme: $value=mediaBeez_default; break;

                case sp_thumb_width : $value=95; break;

                case sp_thumb_height : $value = 95; break;

                case sp_midres_width : $value=800; break;

                case sp_midres_height : $value = 600; break;



                case sp_buttonTheme : $value=orangeGreenBlue; break;

                case sp_menu_theme : $value=whiteBlue; break;

 

 lib_mediaBeez.php:0;
 ?php

 require_once (defines_mediaBeez.php);
 require_once ('core_db_table.php');


 

 So i do include the class, yet i get this error.
 Any clues will be much appreciated..


 --
 -
 Greetings from Rene7705,

 My free open source webcomponents:
  http://code.google.com/u/rene7705/
  http://mediabeez.ws/downloads (and demos)

 My music (i'm DJ firesnake)
  http://mediabeez.ws/music

 http://www.facebook.com/rene7705
 -




-- 
-
Greetings from Rene7705,

My free open source webcomponents:
  http://code.google.com/u/rene7705/
  http://mediabeez.ws/downloads (and demos)

My music (i'm DJ firesnake)
  http://mediabeez.ws/music

http://www.facebook.com/rene7705
-

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



[PHP] NULL Date Entries...

2010-07-01 Thread Don Wieland
In one of my forms, I am building a variable that I can use as an  
INSERT string.


On my form, I have several DATE fields which exist of 3 fields MM - DD  
- 


when I build my string it looks like this:

array('dbf'='applicant_dob',  
'f'=array('applicant_dob_1','applicant_dob_2','applicant_dob_3'),  
'req'=0, 's'='/'),


This enters in the DB fine when there is a DATE, but when these fields  
are left empty, it inserts into the the DB as 2069-12-31.


How does one deal with this?

Don Wieland

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



Re: [PHP] NULL Date Entries...

2010-07-01 Thread Ashley Sheridan
On Thu, 2010-07-01 at 14:26 -0700, Don Wieland wrote:

 In one of my forms, I am building a variable that I can use as an  
 INSERT string.
 
 On my form, I have several DATE fields which exist of 3 fields MM - DD  
 - 
 
 when I build my string it looks like this:
 
 array('dbf'='applicant_dob',  
 'f'=array('applicant_dob_1','applicant_dob_2','applicant_dob_3'),  
 'req'=0, 's'='/'),
 
 This enters in the DB fine when there is a DATE, but when these fields  
 are left empty, it inserts into the the DB as 2069-12-31.
 
 How does one deal with this?
 
 Don Wieland
 


How are you allowing the user to select a date? If it is three form
fields, it might be logical to use select lists with the allowed range
of values in.

If that's not possible, use lines like this to set default values:

$month = (isset($_POST['month'])  preg_match('/^\d{2}$/',
$_POST['month']))?$_POST['month']:'01'; 

which would set a default month value of '01' if there was either no
month value sent or it wasn't a 2-digit value.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] NULL Date Entries...

2010-07-01 Thread Peter Lind
On 1 July 2010 23:40, Ashley Sheridan a...@ashleysheridan.co.uk wrote:
 On Thu, 2010-07-01 at 14:26 -0700, Don Wieland wrote:

 In one of my forms, I am building a variable that I can use as an
 INSERT string.

 On my form, I have several DATE fields which exist of 3 fields MM - DD
 - 

 when I build my string it looks like this:

 array('dbf'='applicant_dob',
 'f'=array('applicant_dob_1','applicant_dob_2','applicant_dob_3'),
 'req'=0, 's'='/'),

 This enters in the DB fine when there is a DATE, but when these fields
 are left empty, it inserts into the the DB as 2069-12-31.

 How does one deal with this?

 Don Wieland



 How are you allowing the user to select a date? If it is three form
 fields, it might be logical to use select lists with the allowed range
 of values in.

 If that's not possible, use lines like this to set default values:

 $month = (isset($_POST['month'])  preg_match('/^\d{2}$/',
 $_POST['month']))?$_POST['month']:'01';

 which would set a default month value of '01' if there was either no
 month value sent or it wasn't a 2-digit value.


Not sure I'd bother with a preg there, intval should do it nicely.
Keep in mind you probably want to check the date at the end of this
with http://dk2.php.net/manual/en/function.checkdate.php or something
similar.

Regards
Peter

-- 
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
/hype

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



Re: [PHP] NULL Date Entries...

2010-07-01 Thread Ashley Sheridan
On Thu, 2010-07-01 at 23:48 +0200, Peter Lind wrote:

 On 1 July 2010 23:40, Ashley Sheridan a...@ashleysheridan.co.uk wrote:
  On Thu, 2010-07-01 at 14:26 -0700, Don Wieland wrote:
 
  In one of my forms, I am building a variable that I can use as an
  INSERT string.
 
  On my form, I have several DATE fields which exist of 3 fields MM - DD
  - 
 
  when I build my string it looks like this:
 
  array('dbf'='applicant_dob',
  'f'=array('applicant_dob_1','applicant_dob_2','applicant_dob_3'),
  'req'=0, 's'='/'),
 
  This enters in the DB fine when there is a DATE, but when these fields
  are left empty, it inserts into the the DB as 2069-12-31.
 
  How does one deal with this?
 
  Don Wieland
 
 
 
  How are you allowing the user to select a date? If it is three form
  fields, it might be logical to use select lists with the allowed range
  of values in.
 
  If that's not possible, use lines like this to set default values:
 
  $month = (isset($_POST['month'])  preg_match('/^\d{2}$/',
  $_POST['month']))?$_POST['month']:'01';
 
  which would set a default month value of '01' if there was either no
  month value sent or it wasn't a 2-digit value.
 
 
 Not sure I'd bother with a preg there, intval should do it nicely.
 Keep in mind you probably want to check the date at the end of this
 with http://dk2.php.net/manual/en/function.checkdate.php or something
 similar.
 
 Regards
 Peter
 


I thought of using intval(). but it would convert the string '01' into
the number 1, which wouldn't work in a MySQL date string without the
extra padding of a 0. You can do that with sprintf, but then it comes
down to what you prefer, intval and sprintf, or a single preg_match
call? Not sure there's any cause for concern over speed on this, as any
difference would be extremely slight.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] NULL Date Entries...

2010-07-01 Thread Ashley Sheridan
On Thu, 2010-07-01 at 23:56 +0200, Peter Lind wrote:

 On 1 July 2010 23:50, Ashley Sheridan a...@ashleysheridan.co.uk wrote:
 
  On Thu, 2010-07-01 at 23:48 +0200, Peter Lind wrote:
 
  On 1 July 2010 23:40, Ashley Sheridan a...@ashleysheridan.co.uk wrote:
   On Thu, 2010-07-01 at 14:26 -0700, Don Wieland wrote:
  
   In one of my forms, I am building a variable that I can use as an
   INSERT string.
  
   On my form, I have several DATE fields which exist of 3 fields MM - DD
   - 
  
   when I build my string it looks like this:
  
   array('dbf'='applicant_dob',
   'f'=array('applicant_dob_1','applicant_dob_2','applicant_dob_3'),
   'req'=0, 's'='/'),
  
   This enters in the DB fine when there is a DATE, but when these fields
   are left empty, it inserts into the the DB as 2069-12-31.
  
   How does one deal with this?
  
   Don Wieland
  
  
  
   How are you allowing the user to select a date? If it is three form
   fields, it might be logical to use select lists with the allowed range
   of values in.
  
   If that's not possible, use lines like this to set default values:
  
   $month = (isset($_POST['month'])  preg_match('/^\d{2}$/',
   $_POST['month']))?$_POST['month']:'01';
  
   which would set a default month value of '01' if there was either no
   month value sent or it wasn't a 2-digit value.
  
 
  Not sure I'd bother with a preg there, intval should do it nicely.
  Keep in mind you probably want to check the date at the end of this
  with http://dk2.php.net/manual/en/function.checkdate.php or something
  similar.
 
  Regards
  Peter
 
 
  I thought of using intval(). but it would convert the string '01' into the 
  number 1, which wouldn't work in a MySQL date string without the extra 
  padding of a 0. You can do that with sprintf, but then it comes down to 
  what you prefer, intval and sprintf, or a single preg_match call? Not sure 
  there's any cause for concern over speed on this, as any difference would 
  be extremely slight.
 
 
 The single preg_match will check the format (though not the contents,
 so you're stuck with more function calls anyway) but I'd much rather
 make sure the data is valid and format the date as I see fit with a
 date() call - you never know what users throw at you, and instead of
 failing (silently in this case) because you received 1 instead 01 I'd
 rather format the data myself.
 
 Regards
 Peter
 
 --
 hype
 WWW: http://plphp.dk / http://plind.dk
 LinkedIn: http://www.linkedin.com/in/plind
 BeWelcome/Couchsurfing: Fake51
 Twitter: http://twitter.com/kafe15
 /hype


I suppose, I only ever check for valid content, not logical content. I
let the DB handle the date (I believe if the range goes beyond a proper
date it falls into the next date like PHP does), but I tend to use a
Javascript picker for the date. The only time I've ever worked with date
fields that allow a user entry has been on CMS systems, so I knew in
advance what specs the users had (so I could get away with relying on a
Javascript input method and hope nothing went wrong!)

However, checking to ensure the date is indeed valid and not something
like 31st February is a good idea I agree! :)

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] NULL Date Entries...

2010-07-01 Thread Peter Lind
On 1 July 2010 23:50, Ashley Sheridan a...@ashleysheridan.co.uk wrote:

 On Thu, 2010-07-01 at 23:48 +0200, Peter Lind wrote:

 On 1 July 2010 23:40, Ashley Sheridan a...@ashleysheridan.co.uk wrote:
  On Thu, 2010-07-01 at 14:26 -0700, Don Wieland wrote:
 
  In one of my forms, I am building a variable that I can use as an
  INSERT string.
 
  On my form, I have several DATE fields which exist of 3 fields MM - DD
  - 
 
  when I build my string it looks like this:
 
  array('dbf'='applicant_dob',
  'f'=array('applicant_dob_1','applicant_dob_2','applicant_dob_3'),
  'req'=0, 's'='/'),
 
  This enters in the DB fine when there is a DATE, but when these fields
  are left empty, it inserts into the the DB as 2069-12-31.
 
  How does one deal with this?
 
  Don Wieland
 
 
 
  How are you allowing the user to select a date? If it is three form
  fields, it might be logical to use select lists with the allowed range
  of values in.
 
  If that's not possible, use lines like this to set default values:
 
  $month = (isset($_POST['month'])  preg_match('/^\d{2}$/',
  $_POST['month']))?$_POST['month']:'01';
 
  which would set a default month value of '01' if there was either no
  month value sent or it wasn't a 2-digit value.
 

 Not sure I'd bother with a preg there, intval should do it nicely.
 Keep in mind you probably want to check the date at the end of this
 with http://dk2.php.net/manual/en/function.checkdate.php or something
 similar.

 Regards
 Peter


 I thought of using intval(). but it would convert the string '01' into the 
 number 1, which wouldn't work in a MySQL date string without the extra 
 padding of a 0. You can do that with sprintf, but then it comes down to what 
 you prefer, intval and sprintf, or a single preg_match call? Not sure there's 
 any cause for concern over speed on this, as any difference would be 
 extremely slight.


The single preg_match will check the format (though not the contents,
so you're stuck with more function calls anyway) but I'd much rather
make sure the data is valid and format the date as I see fit with a
date() call - you never know what users throw at you, and instead of
failing (silently in this case) because you received 1 instead 01 I'd
rather format the data myself.

Regards
Peter

--
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
/hype

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



Re: [PHP] mail() + localhost

2010-07-01 Thread Shreyas Agasthya
Trying again; most likely I cannot do this without SSL.

--Shreyas

On Thu, Jul 1, 2010 at 8:42 PM, Shreyas Agasthya shreya...@gmail.comwrote:

 Not sure where I am top-posting. I posted to my own mail so that one gets
 to know the latest. Nevertheless, I wouldn't go against the guidelines as I
 completely understand the havoc that it can create.

 The port is 587 as per Google; SMTP that I am using
 is Google's (anything wrong here?). If there is a rudimentary mistake that I
 am doing, please guide me.

 Regards,
 Shreyas

 On Thu, Jul 1, 2010 at 7:46 PM, Daniel Brown danbr...@php.net wrote:

 On Thu, Jul 1, 2010 at 10:02, Shreyas Agasthya shreya...@gmail.com
 wrote:
  Spoke too fast.
 
  Fixed that (SMTP has to be uppercase)
 
  Now it is : *SMTP server response: 530 5.7.0 Must issue a STARTTLS
 command
  first. c15sm7128213rvi.11*

(Quick note: per the list guidelines, please don't top-post in
 threads.)

That error message is because you're trying to connect to an SMTPS
 (secure, SSL-encrypted SMTP) server using plain text, which won't
 work.  If you have a plain SMTP server running, try that to get one
 thing resolved at a time.  Change the port to 25 in your php.ini (and,
 again, restart Apache) if plain SMTP is available on the default port.

 --
 /Daniel P. Brown
 UNADVERTISED DEDICATED SERVER SPECIALS
 SAME-DAY SETUP
 Just ask me what we're offering today!
 daniel.br...@parasane.net || danbr...@php.net
 http://www.parasane.net/ || http://www.pilotpig.net/




 --
 Regards,
 Shreyas Agasthya




-- 
Regards,
Shreyas Agasthya


Re: [PHP] php processing name vs. id field

2010-07-01 Thread Ashley Sheridan
On Thu, 2010-07-01 at 10:19 -0400, Paul M Foster wrote:

 On Thu, Jul 01, 2010 at 03:40:56PM +0200, Peter Lind wrote:
 
 snip
  
  Apart from that, html5 is not going to do away with the name
  attribute. And name is in xhtml1 and html4.01 and there's no mention
  of it being obsolete, deprecated or in any other fashion on the way
  out.
  
  As far as reference: the source.
  http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_XHTML-1.0-Strict very
  clearly specifies that name is still a very valid attribute.
  http://www.w3.org/TR/html401/interact/forms.html#h-17.4 shows the same
  in a slightly more readable format - the only mentions of anything
  deprecated (there are no references to anything obsolete) are for the
  isindex element and the align attribute of the legend element.
  
  What is the case regarding the name attribute is that it's been
  deprecated for a few elements (such as a, form, frame, img) in XHTML1
  and will be removed in XHTML2 (which we'll likely never see used in
  browsers). See http://www.w3.org/TR/xhtml1/#h-4.10
 
 All this is fortunate, since I don't think PHP is even aware of the ID
 attribute. Imagine trying to process form fields without the name
 attribute being present.
 
 Paul
 
 -- 
 Paul M. Foster
 


Not sure if my other email got through earlier. Replacing the name
attribute on form fields with the id one is not feasible at all. They
don't even behave the same. What would happen if you had two forms on a
page that both had an element with the same name? Using the name
attribute, everything is fine, but not so if you were using the id
instead.

Going further, what about form elements sent as an array? I don't think
the id attribute is set up to follow any sort of array format (bearing
in mind also that it's only PHP that uses the [] suffix to denote a form
element be sent as an array). Doing so would break the functionality of
many pages today (no longer would DOM functions such as getElementByID()
work anymore because you'd be retrieving potentially more than one
element, so code like document.getElementById('element').style.something
wouldn't work.

Either way, the id attribute is not, and dare I say doesn't ever look to
be, a substitute for the name attribute on form elements.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] NULL Date Entries...

2010-07-01 Thread Paul M Foster

snip

 
 However, checking to ensure the date is indeed valid and not something
 like 31st February is a good idea I agree! :)

Wait-- there's not a 31st of February? When did they change that? ;-}

Paul

-- 
Paul M. Foster

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