Re: [PHP] Structured PHP studying

2010-04-24 Thread David McGlone
On Friday 23 April 2010 07:45:16 Michiel Sikma wrote:
 On 23 April 2010 13:15, David McGlone da...@dmcentral.net wrote:
  Is there a good strategy to studying PHP?
 
  For instance, is there a way to break everything down into small
  managable topics?
 
  --
  Blessings,
  David M.

 Just build what you want to build and look things up when necessary. The
 biggest part of learning any language is becoming able to creatively solve
 problems within its realm of possibilities, and that's something you can't
 really learn just by reading and solving textbook problems. Hands-on
 experience is a very important key to understanding.

 Keep an open mind, ask people for answers if things get difficult, always
 assume that there's a better way to do something, and in a while you'll be
 able to write perfectly decent programs.

This is the route I have been following for the past couple years and I have 
always assumed there is a better way to do something and that is, in a way 
what makes me lose confidence.

I always feel like my code is crap and sometimes even ashamed to even show any 
of it.

-- 
Blessings,
David M.

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



Re: [PHP] Structured PHP studying

2010-04-24 Thread David McGlone
On Friday 23 April 2010 10:15:46 Paul M Foster wrote:
 On Fri, Apr 23, 2010 at 07:15:11AM -0400, David McGlone wrote:
  Is there a good strategy to studying PHP?
 
  For instance, is there a way to break everything down into small
  managable topics?

 Obviously, a good book will help. I'd recommend O'Reilly's Programming
 PHP. Some of this also depends on whether you have a background in
 programming. It's easier if you already know how to code in a different
 language; then you really mostly need to know the differences between
 the languages.

 If you want to learn without the benefit of a book, then I'd suggest
 looking over existing beginning programming books for various languages.
 My observation is that they generally follow a pattern. They deal with
 variable naming and types, then legal operations on those types, then
 control structures, then functions, etc. (That may not be accurate; as I
 said, look over the books themselves.) Most/all of this information can
 be obtained from the php.net site.

 Ashley's suggestion of coding a project is an outstanding idea. Coding
 is a practical art, and requires practical application to be worth
 anything.

I have coded a couple sites. One for my brother-in-law, but I hate that site 
so bad, I'm ashamed to even say I did it.

He chose the layout and colors and told me exactly where he wanted everything, 
and it's IMHO absolutely horrible. 

There is some code that I wrote for that site that did make me feel good for 
coming up with and although it works, most of the code for that site gets on 
my nerves. It gives me the feeling that it's very unorganized, and poorly 
written.

-- 
Blessings,
David M.

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



[PHP] Question: Farsi characters showing as jibberish

2010-04-24 Thread Parham Doustdar
Hi,

I have created a PHP file, and wrote a string of Farsi letters in it. In the 
head section of the HTML, I put:

META HTTP-EQUIV=Content-Type CONTENT=text/html; charset=UTF-8

There appears to be something wrong with Apache, or something, because no 
matter whether I put that string in an echo statement or just in an HTML 
with a php extention, the page loads as jibberish and I have to set the 
character encoding to UTF-8 manually in Firefox.

Renaming that same file to .htm (when not using the echo statement), and 
loading it in the browser shows me the correct Farsi characters.

Should I change something in Apache's settings for this to work?

Thanks! 



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



Re: [PHP] Question: Farsi characters showing as jibberish

2010-04-24 Thread Michiel Sikma
On 24 April 2010 14:45, Parham Doustdar parha...@gmail.com wrote:

 Hi,

 I have created a PHP file, and wrote a string of Farsi letters in it. In
 the
 head section of the HTML, I put:

 META HTTP-EQUIV=Content-Type CONTENT=text/html; charset=UTF-8

 There appears to be something wrong with Apache, or something, because no
 matter whether I put that string in an echo statement or just in an HTML
 with a php extention, the page loads as jibberish and I have to set the
 character encoding to UTF-8 manually in Firefox.

 Renaming that same file to .htm (when not using the echo statement), and
 loading it in the browser shows me the correct Farsi characters.

 Should I change something in Apache's settings for this to work?

 Thanks!


 No, that should work perfectly fine. Are you sure that the PHP file itself
is utf-8?
Could it be that you manually set the text encoding to something else in
your browser, causing it to remember that setting?

Perhaps you could link us to the page itself so we can have a look. Note
that the best place to put that meta tag is right after the opening head
tag, before any other header information.

Michiel


Re: [PHP] Re: replying to list (I give up)

2010-04-24 Thread Michiel Sikma
On 23 April 2010 16:16, Kevin Kinsey k...@daleco.biz wrote:


 I've still got a Win98 box in service somewhere around here; I use
 it for audio recording.  Someone (possibly even me) renamed most
 of the desktop icons ... OE's shortcut is Outluck Depress.  :-)

 Kevin D. Kinsey


Say what you will about Windows 9x systems, but they (and especially Windows
95) ran rather well on just 60 MHz.
Sure, computers are constantly getting faster, but fortunately software
developers keep coming up with new ways to make us wait. :)

Michiel


Re: [PHP] Re: replying to list (I give up)

2010-04-24 Thread Ashley Sheridan
On Sat, 2010-04-24 at 15:44 +0200, Michiel Sikma wrote:

 On 23 April 2010 16:16, Kevin Kinsey k...@daleco.biz wrote:
 
 
  I've still got a Win98 box in service somewhere around here; I use
  it for audio recording.  Someone (possibly even me) renamed most
  of the desktop icons ... OE's shortcut is Outluck Depress.  :-)
 
  Kevin D. Kinsey
 
 
 Say what you will about Windows 9x systems, but they (and especially Windows
 95) ran rather well on just 60 MHz.
 Sure, computers are constantly getting faster, but fortunately software
 developers keep coming up with new ways to make us wait. :)
 
 Michiel


Sounds like a decent reason to try Linux then. Linux performs pretty
admirably on older kit.

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




Re: [PHP] Question: Farsi characters showing as jibberish

2010-04-24 Thread Ashley Sheridan
On Sat, 2010-04-24 at 15:38 +0200, Michiel Sikma wrote:

 On 24 April 2010 14:45, Parham Doustdar parha...@gmail.com wrote:
 
  Hi,
 
  I have created a PHP file, and wrote a string of Farsi letters in it. In
  the
  head section of the HTML, I put:
 
  META HTTP-EQUIV=Content-Type CONTENT=text/html; charset=UTF-8
 
  There appears to be something wrong with Apache, or something, because no
  matter whether I put that string in an echo statement or just in an HTML
  with a php extention, the page loads as jibberish and I have to set the
  character encoding to UTF-8 manually in Firefox.
 
  Renaming that same file to .htm (when not using the echo statement), and
  loading it in the browser shows me the correct Farsi characters.
 
  Should I change something in Apache's settings for this to work?
 
  Thanks!
 
 
  No, that should work perfectly fine. Are you sure that the PHP file itself
 is utf-8?
 Could it be that you manually set the text encoding to something else in
 your browser, causing it to remember that setting?
 
 Perhaps you could link us to the page itself so we can have a look. Note
 that the best place to put that meta tag is right after the opening head
 tag, before any other header information.
 
 Michiel


If renaming the file as .htm shows the characters correctly, then
the .php file is most likely saved as utf8.

Maybe Apache has been instructed to send all HTML with another encoding,
as it should send it out with the same encoding as the requested PHP
script.

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




Re: [PHP] Structured PHP studying

2010-04-24 Thread Jason Pruim


On Apr 24, 2010, at 7:14 AM, David McGlone wrote:


On Friday 23 April 2010 07:45:16 Michiel Sikma wrote:

On 23 April 2010 13:15, David McGlone da...@dmcentral.net wrote:

Is there a good strategy to studying PHP?

For instance, is there a way to break everything down into small
managable topics?

--
Blessings,
David M.


Just build what you want to build and look things up when  
necessary. The
biggest part of learning any language is becoming able to  
creatively solve
problems within its realm of possibilities, and that's something  
you can't

really learn just by reading and solving textbook problems. Hands-on
experience is a very important key to understanding.

Keep an open mind, ask people for answers if things get difficult,  
always
assume that there's a better way to do something, and in a while  
you'll be

able to write perfectly decent programs.


This is the route I have been following for the past couple years  
and I have
always assumed there is a better way to do something and that is, in  
a way

what makes me lose confidence.

I always feel like my code is crap and sometimes even ashamed to  
even show any

of it.


I feel the some way sometimes... when I look back on some of the stuff  
that I wrote when I first started compared to today it's amazing  
the difference in such a short period of time... But I take comfort in  
knowing that I have stuff looking nicer then it was when I started...  
I'm making progress :)





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



Re: [PHP] Structured PHP studying

2010-04-24 Thread Ashley Sheridan
On Sat, 2010-04-24 at 07:14 -0400, David McGlone wrote:

 On Friday 23 April 2010 07:45:16 Michiel Sikma wrote:
  On 23 April 2010 13:15, David McGlone da...@dmcentral.net wrote:
   Is there a good strategy to studying PHP?
  
   For instance, is there a way to break everything down into small
   managable topics?
  
   --
   Blessings,
   David M.
 
  Just build what you want to build and look things up when necessary. The
  biggest part of learning any language is becoming able to creatively solve
  problems within its realm of possibilities, and that's something you can't
  really learn just by reading and solving textbook problems. Hands-on
  experience is a very important key to understanding.
 
  Keep an open mind, ask people for answers if things get difficult, always
  assume that there's a better way to do something, and in a while you'll be
  able to write perfectly decent programs.
 
 This is the route I have been following for the past couple years and I have 
 always assumed there is a better way to do something and that is, in a way 
 what makes me lose confidence.
 
 I always feel like my code is crap and sometimes even ashamed to even show 
 any 
 of it.
 
 -- 
 Blessings,
 David M.
 


For personal sites, I think as long as the code works, and doesn't have
any glaringly obvious security holes in, then it should be fine.
Personal sites tend not to have a huge amount of traffic, so speed
doesn't really become an issue unless you're doing something totally
crazy (like generating all of your header images on the fly with PHP for
example without any caching)

For commercial sites, more time should be spent on security and testing,
and working over things in your head about how the site is going to get
used. If an area of the site that you feel is going to be very popular
will be busy, then is creating a lot of large objects and making many DB
calls such a great idea?

I look at some code I did a while back and shudder. It started off well
enough, but then feature creep set in and now it looks like a creation
of Frankenstein! I think it happens to all of us at some point, it just
depends how well we deal with it. I'd rather have less then stellar code
than have to tell a client it's going to take more time to add a feature
and then have them go elsewhere.

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




Re: [PHP] Question: Farsi characters showing as jibberish

2010-04-24 Thread Parham Doustdar
Hi Ashley and Michiel,

It appears it is something in Apache or my server program on Windows (I am
using Uniform Server; a portable webserver from
http://www.uniformserver.com). The reason I got to such a conclusion is
this:

1. I uploaded the pHP file to a free hosting website. Here is the URL:
http://blindmoviebuff.uphero.com/test2.php

2. I put the same page in my www folder in Windows. Here's the address to
that:
http://parham-d.dyndns.org/test2.php

As you can see, the page on uphero.com displays without any encoding changes
required by you, whereas the second has to be manual (for some reason). I
thought seeing the UTF-8 made the browser use that encoding automatically
regardless of whether or not it was sent in UTF-8?

Sorry, I have no information at all about how transmiting is handled. Just
saying guesses aloud. :-)
- Original Message - 
From: Ashley Sheridan a...@ashleysheridan.co.uk
Newsgroups: php.general
To: Michiel Sikma mich...@thingmajig.org
Cc: Parham Doustdar parha...@gmail.com; php-general@lists.php.net
Sent: Saturday, April 24, 2010 6:16 PM
Subject: Re: [PHP] Question: Farsi characters showing as jibberish


 On Sat, 2010-04-24 at 15:38 +0200, Michiel Sikma wrote:

 On 24 April 2010 14:45, Parham Doustdar parha...@gmail.com wrote:

  Hi,
 
  I have created a PHP file, and wrote a string of Farsi letters in it.
  In
  the
  head section of the HTML, I put:
 
  META HTTP-EQUIV=Content-Type CONTENT=text/html; charset=UTF-8
 
  There appears to be something wrong with Apache, or something, because
  no
  matter whether I put that string in an echo statement or just in an
  HTML
  with a php extention, the page loads as jibberish and I have to set the
  character encoding to UTF-8 manually in Firefox.
 
  Renaming that same file to .htm (when not using the echo statement),
  and
  loading it in the browser shows me the correct Farsi characters.
 
  Should I change something in Apache's settings for this to work?
 
  Thanks!
 
 
  No, that should work perfectly fine. Are you sure that the PHP file
  itself
 is utf-8?
 Could it be that you manually set the text encoding to something else in
 your browser, causing it to remember that setting?

 Perhaps you could link us to the page itself so we can have a look. Note
 that the best place to put that meta tag is right after the opening
 head
 tag, before any other header information.

 Michiel


 If renaming the file as .htm shows the characters correctly, then
 the .php file is most likely saved as utf8.

 Maybe Apache has been instructed to send all HTML with another encoding,
 as it should send it out with the same encoding as the requested PHP
 script.

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






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



Re: [PHP] htmlentitites ENT_QUOTES in HTML attributes?

2010-04-24 Thread Michiel Sikma
On 23 April 2010 14:21, Jan G.B. ro0ot.w...@googlemail.com wrote:

 Hi List,

 I just figured, that the Browsers on my system do interpret #039;
 inside href or onclick attribute as a plain '.

 Imagine the user input is the following line:

 param2 foo';);alert(document.cookie);alert('

 Which is being written by the script like that:

 a href=javascript:void(0); onclick=test(1,
 'USER_INPUT_GOES_HERE');test/a

 USER_INPUT is sent through htmlentities($str, ENT_QUOTES, 'UTF-8');

 The result is the following then:

 htmlbody
 script type=text/javascript
 function example(a, b) {
  alert('valid alert; params: '+ a+', '+b);
 }
 /script

 a href=javascript:void(0); onclick=example(1, 'param2quot;
 foo#039;);alert(document.cookie);alert(#039;');test/a
 /body/html


 My browsers will alert the document.cookie.
 Please confirm this (and keep in mind that document.cookie is just
 empty when tested locally).


 Regards

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



Yes, #039; is the same as a single quote. But let's say you set up your
page like this:

http://pastie.org/932923

Submitting the form will change the $input variable that's also added to the
Javascript below. So in theory, you should be able to submit, say,
#039;+window.very_important_variable+#039; in order to get an alert with
the secret number 255 in it. But when submitting that text in the form, the
 actually gets converted to amp;, causing the alert() to literally print
the string #039;. When submitting a real single quote, it gets converted to
\#039;, printing a literal '.

The only way to get to the window.very_important_variable is by removing the
htmlentities() function in the PHP code. The test case you added is
incorrect, since properly sanitized input would never have an actual,
non-escaped #039; in it.

Michiel


Re: [PHP] Question: Farsi characters showing as jibberish

2010-04-24 Thread Ashley Sheridan
On Sat, 2010-04-24 at 18:37 +0430, Parham Doustdar wrote:

 Hi Ashley and Michiel,
 
 It appears it is something in Apache or my server program on Windows (I am
 using Uniform Server; a portable webserver from
 http://www.uniformserver.com). The reason I got to such a conclusion is
 this:
 
 1. I uploaded the pHP file to a free hosting website. Here is the URL:
 http://blindmoviebuff.uphero.com/test2.php
 
 2. I put the same page in my www folder in Windows. Here's the address to
 that:
 http://parham-d.dyndns.org/test2.php
 
 As you can see, the page on uphero.com displays without any encoding changes
 required by you, whereas the second has to be manual (for some reason). I
 thought seeing the UTF-8 made the browser use that encoding automatically
 regardless of whether or not it was sent in UTF-8?
 
 Sorry, I have no information at all about how transmiting is handled. Just
 saying guesses aloud. :-)
 - Original Message - 
 From: Ashley Sheridan a...@ashleysheridan.co.uk
 Newsgroups: php.general
 To: Michiel Sikma mich...@thingmajig.org
 Cc: Parham Doustdar parha...@gmail.com; php-general@lists.php.net
 Sent: Saturday, April 24, 2010 6:16 PM
 Subject: Re: [PHP] Question: Farsi characters showing as jibberish
 
 
  On Sat, 2010-04-24 at 15:38 +0200, Michiel Sikma wrote:
 
  On 24 April 2010 14:45, Parham Doustdar parha...@gmail.com wrote:
 
   Hi,
  
   I have created a PHP file, and wrote a string of Farsi letters in it.
   In
   the
   head section of the HTML, I put:
  
   META HTTP-EQUIV=Content-Type CONTENT=text/html; charset=UTF-8
  
   There appears to be something wrong with Apache, or something, because
   no
   matter whether I put that string in an echo statement or just in an
   HTML
   with a php extention, the page loads as jibberish and I have to set the
   character encoding to UTF-8 manually in Firefox.
  
   Renaming that same file to .htm (when not using the echo statement),
   and
   loading it in the browser shows me the correct Farsi characters.
  
   Should I change something in Apache's settings for this to work?
  
   Thanks!
  
  
   No, that should work perfectly fine. Are you sure that the PHP file
   itself
  is utf-8?
  Could it be that you manually set the text encoding to something else in
  your browser, causing it to remember that setting?
 
  Perhaps you could link us to the page itself so we can have a look. Note
  that the best place to put that meta tag is right after the opening
  head
  tag, before any other header information.
 
  Michiel
 
 
  If renaming the file as .htm shows the characters correctly, then
  the .php file is most likely saved as utf8.
 
  Maybe Apache has been instructed to send all HTML with another encoding,
  as it should send it out with the same encoding as the requested PHP
  script.
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 
 
 
 
 

Try adding this before any output to the browser:

header('Content-Type: text/html; charset=utf-8');

Which should force the server to send the output in this specific
format.

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




RE: [PHP] Re: replying to list (I give up)

2010-04-24 Thread Per Jessen
Ashley Sheridan wrote:

 
 Is there an actual WoW client for Linux or you run in Wine like
 environment?
 
 Thanks,
 Tommy
 
 
 I run it under Wine. Wine has come a long way since my first
 encounters with it a few years back and run a surprising amount of
 Windows-based software. 

Doesn't WoW need DirectX and all that?  I have some old Windows games
(Diablo, Alpha Centauri, Railroad Tycoon, Wolfenstein) I'd love to play
under Wine, but so far I've not managed to make them work. 


-- 
Per Jessen, Zürich (19.7°C)


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



RE: [PHP] Re: replying to list (I give up)

2010-04-24 Thread Ashley Sheridan
On Sat, 2010-04-24 at 16:14 +0200, Per Jessen wrote:

 Ashley Sheridan wrote:
 
  
  Is there an actual WoW client for Linux or you run in Wine like
  environment?
  
  Thanks,
  Tommy
  
  
  I run it under Wine. Wine has come a long way since my first
  encounters with it a few years back and run a surprising amount of
  Windows-based software. 
 
 Doesn't WoW need DirectX and all that?  I have some old Windows games
 (Diablo, Alpha Centauri, Railroad Tycoon, Wolfenstein) I'd love to play
 under Wine, but so far I've not managed to make them work. 
 
 
 -- 
 Per Jessen, Zürich (19.7°C)
 
 


It can use OpenGL too. Just call it like this:

wine Wow.exe -opengl

and it will run in OpenGL mode. The only issue I've noticed is that Wine
doesn't play well when it comes to sound, so I have to turn off things
like Amarok when I want to play WoW.

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




Re: [PHP] Re: replying to list (I give up)

2010-04-24 Thread Michiel Sikma
On 24 April 2010 16:14, Per Jessen p...@computer.org wrote:

 Ashley Sheridan wrote:

 
  Is there an actual WoW client for Linux or you run in Wine like
  environment?
 
  Thanks,
  Tommy
 
 
  I run it under Wine. Wine has come a long way since my first
  encounters with it a few years back and run a surprising amount of
  Windows-based software.

 Doesn't WoW need DirectX and all that?  I have some old Windows games
 (Diablo, Alpha Centauri, Railroad Tycoon, Wolfenstein) I'd love to play
 under Wine, but so far I've not managed to make them work.


The best way to run old games is via DOSBox. http://www.dosbox.com/ If you
have an Intel machine it should run pretty well (at least the latest version
will; some repos still have the old 0.65 version which is significantly
slower).

Michiel


Re: [PHP] Question: Farsi characters showing as jibberish

2010-04-24 Thread Parham Doustdar
Hi again,
That did work, indeed. Now, I guess that means that Apache is outputting the 
PHP as something other than UTF-8. In fact, googling, I came up with this 
line of .htaccess:

AddDefaultCharset UTF-8

which works perfectly!

Thank you, everyone, for yet again helping me out.
Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
news:1272117941.20937.164.ca...@localhost...
 On Sat, 2010-04-24 at 18:37 +0430, Parham Doustdar wrote:

 Hi Ashley and Michiel,

 It appears it is something in Apache or my server program on Windows (I 
 am
 using Uniform Server; a portable webserver from
 http://www.uniformserver.com). The reason I got to such a conclusion is
 this:

 1. I uploaded the pHP file to a free hosting website. Here is the URL:
 http://blindmoviebuff.uphero.com/test2.php

 2. I put the same page in my www folder in Windows. Here's the address to
 that:
 http://parham-d.dyndns.org/test2.php

 As you can see, the page on uphero.com displays without any encoding 
 changes
 required by you, whereas the second has to be manual (for some reason). I
 thought seeing the UTF-8 made the browser use that encoding automatically
 regardless of whether or not it was sent in UTF-8?

 Sorry, I have no information at all about how transmiting is handled. 
 Just
 saying guesses aloud. :-)
 - Original Message - 
 From: Ashley Sheridan a...@ashleysheridan.co.uk
 Newsgroups: php.general
 To: Michiel Sikma mich...@thingmajig.org
 Cc: Parham Doustdar parha...@gmail.com; php-general@lists.php.net
 Sent: Saturday, April 24, 2010 6:16 PM
 Subject: Re: [PHP] Question: Farsi characters showing as jibberish


  On Sat, 2010-04-24 at 15:38 +0200, Michiel Sikma wrote:
 
  On 24 April 2010 14:45, Parham Doustdar parha...@gmail.com wrote:
 
   Hi,
  
   I have created a PHP file, and wrote a string of Farsi letters in 
   it.
   In
   the
   head section of the HTML, I put:
  
   META HTTP-EQUIV=Content-Type CONTENT=text/html; charset=UTF-8
  
   There appears to be something wrong with Apache, or something, 
   because
   no
   matter whether I put that string in an echo statement or just in an
   HTML
   with a php extention, the page loads as jibberish and I have to set 
   the
   character encoding to UTF-8 manually in Firefox.
  
   Renaming that same file to .htm (when not using the echo statement),
   and
   loading it in the browser shows me the correct Farsi characters.
  
   Should I change something in Apache's settings for this to work?
  
   Thanks!
  
  
   No, that should work perfectly fine. Are you sure that the PHP file
   itself
  is utf-8?
  Could it be that you manually set the text encoding to something else 
  in
  your browser, causing it to remember that setting?
 
  Perhaps you could link us to the page itself so we can have a look. 
  Note
  that the best place to put that meta tag is right after the opening
  head
  tag, before any other header information.
 
  Michiel
 
 
  If renaming the file as .htm shows the characters correctly, then
  the .php file is most likely saved as utf8.
 
  Maybe Apache has been instructed to send all HTML with another 
  encoding,
  as it should send it out with the same encoding as the requested PHP
  script.
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 
 




 Try adding this before any output to the browser:

 header('Content-Type: text/html; charset=utf-8');

 Which should force the server to send the output in this specific
 format.

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


 



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



Re: [PHP] Question: Farsi characters showing as jibberish

2010-04-24 Thread Michiel Sikma
On 24 April 2010 16:07, Parham Doustdar parha...@gmail.com wrote:

 Hi Ashley and Michiel,

 It appears it is something in Apache or my server program on Windows (I am
 using Uniform Server; a portable webserver from
 http://www.uniformserver.com). The reason I got to such a conclusion is
 this:

 1. I uploaded the pHP file to a free hosting website. Here is the URL:
 http://blindmoviebuff.uphero.com/test2.php

 2. I put the same page in my www folder in Windows. Here's the address to
 that:
 http://parham-d.dyndns.org/test2.php

 As you can see, the page on uphero.com displays without any encoding
 changes
 required by you, whereas the second has to be manual (for some reason).

-snip-



Actually, both of these work fine for me. I don't have to manually set the
encoding to get the Farsi characters to show up in either of these links.
I don't know why it wouldn't work for you. Maybe you should try a different
browser to make sure it isn't a cached setting. Adding the header() call
that Ashley suggested also seems like a good idea.

Michiel


Re: [PHP] Question: Farsi characters showing as jibberish

2010-04-24 Thread Parham Doustdar
Hi,
It probably did because I added the line,

AddDefaultCharset UTF-8

to my .htaccess a few moments ago. :-)
Michiel Sikma mich...@thingmajig.org wrote in message 
news:o2p6cda1ded1004240726l272f04fbmdd2fb996e2580...@mail.gmail.com...
 On 24 April 2010 16:07, Parham Doustdar parha...@gmail.com wrote:

 Hi Ashley and Michiel,

 It appears it is something in Apache or my server program on Windows (I 
 am
 using Uniform Server; a portable webserver from
 http://www.uniformserver.com). The reason I got to such a conclusion is
 this:

 1. I uploaded the pHP file to a free hosting website. Here is the URL:
 http://blindmoviebuff.uphero.com/test2.php

 2. I put the same page in my www folder in Windows. Here's the address to
 that:
 http://parham-d.dyndns.org/test2.php

 As you can see, the page on uphero.com displays without any encoding
 changes
 required by you, whereas the second has to be manual (for some reason).

 -snip-



 Actually, both of these work fine for me. I don't have to manually set the
 encoding to get the Farsi characters to show up in either of these links.
 I don't know why it wouldn't work for you. Maybe you should try a 
 different
 browser to make sure it isn't a cached setting. Adding the header() call
 that Ashley suggested also seems like a good idea.

 Michiel
 



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



Re: [PHP] Structured PHP studying

2010-04-24 Thread Nathan Rixham
David McGlone wrote:
 On Friday 23 April 2010 07:45:16 Michiel Sikma wrote:
 On 23 April 2010 13:15, David McGlone da...@dmcentral.net wrote:
 Is there a good strategy to studying PHP?

 For instance, is there a way to break everything down into small
 managable topics?

 --
 Blessings,
 David M.
 Just build what you want to build and look things up when necessary. The
 biggest part of learning any language is becoming able to creatively solve
 problems within its realm of possibilities, and that's something you can't
 really learn just by reading and solving textbook problems. Hands-on
 experience is a very important key to understanding.

 Keep an open mind, ask people for answers if things get difficult, always
 assume that there's a better way to do something, and in a while you'll be
 able to write perfectly decent programs.
 
 This is the route I have been following for the past couple years and I have 
 always assumed there is a better way to do something and that is, in a way 
 what makes me lose confidence.
 
 I always feel like my code is crap and sometimes even ashamed to even show 
 any 
 of it.
 

Hi David,

Really good to see somebody asking for honest advice on a v important
matter :)

First, if I may, I'd like to suggest that being ashamed to show your
code is never going to be a productive way to work, rather the more code
you show, the more feedback you will get on your code, and often with
examples of alternative ways to do it - posting snippets and
opensourcing are great ways of crowd sourcing solid feedback.

Next, saying your code is crap, we all feel like that sometimes, but
it's critical to note that if your code does the job it's supposed to,
then it's a success! A few months ago I was questioning myself again and
wrote this: http://webr3.org/blog/general/the-wall/ - the point is it's
a good thing to question yourself, it's a good thing to take everything
in to consideration, and often I (used to) find myself looking at very
short procedural ways of doing things and think.. why am i making all
these classes; it's our job as programmers to know when to implement
something in 10 quick lines that are easy to maintain, and when to
create an all singing and dancing framework type affair, pros and cons
to each, and there is no One True Way TM of doing things - each bit of
code is very much dependent on context, scenario and maintenance costs.

Okay, on to your specific questions!

We can break this down in to small(~ish) common junks, and which you
study, take further and in what order is entirely up to you:

General Coding
This is the stuff that translates to almost every language, for loops,
echo'ing, simple code optimisation and basically just how to script and
program - I'll assume that after two years you've got this nailed better
than any book can teach you, from here it's just experience and picking
up tricks on the way, so generally no need to worry!

PHP
As you know php is a specific language, and the best way to learn
everything php specific, is literally to read the manual, from start to
finish, a few times, and keep referring back to it, if you see something
you haven't actually used before then give it a quick go in a short 5-10
line script and have a play, the 2 minutes it takes will be more than
worth it (by doing it, it'll get engrained in you).

Aside: in every project i do, and at all times i have a test.php where I
literally just try out ways of doing things and snippets of code, once
I'm done i stick an exit; before it then do the next snippet above it,
this way i always have one nice file of snippets in every project to
refer back to - they often come in handy for helping on this list
actually, and in fact sometimes are from peoples code on this list!

Coding Standards
One of the biggest factors of feeling your code isn't good enough, is by
not using any coding standards, this is pretty simple stuff but makes
your life a lot easier, and code a lot cleaner - even crap broken code
comes across a lot better when it's nicely formatted lol. A good IDE can
help you here, as for which coding standards that's up to you, but you
can check you are adhering to them by using php code sniffer -
personally I opt for a slightly modified version of zend coding
standards with the odd bit of extra spacing around params etc.

Paradigms  Design Patterns
A bit of familiarity with programming paradigms is always a good thing
http://en.wikipedia.org/wiki/Programming_paradigm
In PHP we use Procedural and Object Orientated (Class Based)
If you do OO then it's also very very useful to read up on all the
Object Orientated subjects though especially Separation of Concerns,
familiarity of Martin Fowler's enterprise patterns
http://martinfowler.com/ is also a good thing, there is also a Java
pattern guide that's most useful
http://java.sun.com/blueprints/patterns/ and many transfer over to OO PHP.

Other Languages
Yes :) one of the best ways to get good with your primary language (php)
is to try 

Re: [PHP] Structured PHP studying

2010-04-24 Thread Ashley Sheridan
On Sat, 2010-04-24 at 15:46 +0100, Nathan Rixham wrote:

 David McGlone wrote:
  On Friday 23 April 2010 07:45:16 Michiel Sikma wrote:
  On 23 April 2010 13:15, David McGlone da...@dmcentral.net wrote:
  Is there a good strategy to studying PHP?
 
  For instance, is there a way to break everything down into small
  managable topics?
 
  --
  Blessings,
  David M.
  Just build what you want to build and look things up when necessary. The
  biggest part of learning any language is becoming able to creatively solve
  problems within its realm of possibilities, and that's something you can't
  really learn just by reading and solving textbook problems. Hands-on
  experience is a very important key to understanding.
 
  Keep an open mind, ask people for answers if things get difficult, always
  assume that there's a better way to do something, and in a while you'll be
  able to write perfectly decent programs.
  
  This is the route I have been following for the past couple years and I 
  have 
  always assumed there is a better way to do something and that is, in a way 
  what makes me lose confidence.
  
  I always feel like my code is crap and sometimes even ashamed to even show 
  any 
  of it.
  
 
 Hi David,
 
 Really good to see somebody asking for honest advice on a v important
 matter :)
 
 First, if I may, I'd like to suggest that being ashamed to show your
 code is never going to be a productive way to work, rather the more code
 you show, the more feedback you will get on your code, and often with
 examples of alternative ways to do it - posting snippets and
 opensourcing are great ways of crowd sourcing solid feedback.
 
 Next, saying your code is crap, we all feel like that sometimes, but
 it's critical to note that if your code does the job it's supposed to,
 then it's a success! A few months ago I was questioning myself again and
 wrote this: http://webr3.org/blog/general/the-wall/ - the point is it's
 a good thing to question yourself, it's a good thing to take everything
 in to consideration, and often I (used to) find myself looking at very
 short procedural ways of doing things and think.. why am i making all
 these classes; it's our job as programmers to know when to implement
 something in 10 quick lines that are easy to maintain, and when to
 create an all singing and dancing framework type affair, pros and cons
 to each, and there is no One True Way TM of doing things - each bit of
 code is very much dependent on context, scenario and maintenance costs.
 
 Okay, on to your specific questions!
 
 We can break this down in to small(~ish) common junks, and which you
 study, take further and in what order is entirely up to you:
 
 General Coding
 This is the stuff that translates to almost every language, for loops,
 echo'ing, simple code optimisation and basically just how to script and
 program - I'll assume that after two years you've got this nailed better
 than any book can teach you, from here it's just experience and picking
 up tricks on the way, so generally no need to worry!
 
 PHP
 As you know php is a specific language, and the best way to learn
 everything php specific, is literally to read the manual, from start to
 finish, a few times, and keep referring back to it, if you see something
 you haven't actually used before then give it a quick go in a short 5-10
 line script and have a play, the 2 minutes it takes will be more than
 worth it (by doing it, it'll get engrained in you).
 
 Aside: in every project i do, and at all times i have a test.php where I
 literally just try out ways of doing things and snippets of code, once
 I'm done i stick an exit; before it then do the next snippet above it,
 this way i always have one nice file of snippets in every project to
 refer back to - they often come in handy for helping on this list
 actually, and in fact sometimes are from peoples code on this list!
 
 Coding Standards
 One of the biggest factors of feeling your code isn't good enough, is by
 not using any coding standards, this is pretty simple stuff but makes
 your life a lot easier, and code a lot cleaner - even crap broken code
 comes across a lot better when it's nicely formatted lol. A good IDE can
 help you here, as for which coding standards that's up to you, but you
 can check you are adhering to them by using php code sniffer -
 personally I opt for a slightly modified version of zend coding
 standards with the odd bit of extra spacing around params etc.
 
 Paradigms  Design Patterns
 A bit of familiarity with programming paradigms is always a good thing
 http://en.wikipedia.org/wiki/Programming_paradigm
 In PHP we use Procedural and Object Orientated (Class Based)
 If you do OO then it's also very very useful to read up on all the
 Object Orientated subjects though especially Separation of Concerns,
 familiarity of Martin Fowler's enterprise patterns
 http://martinfowler.com/ is also a good thing, there is also a Java
 pattern guide that's most useful
 

[PHP] PHP not being read?

2010-04-24 Thread Gary

What would cause a machine not to read/process php?

I have a laptop that I have been ever increasing using for php scripting.  I 
decided to do a simple experiment, it started out something like:


$seconds=1;
$minutes=$seconds*60;
$hours=$minutes*60;
$days=$hours*24;

echo $seconds;
echo $minutes;
echo $hours;
echo $days;

Nothing showed in the browser on my local server. I then tried various 
changes, adding single quotes, double quotes, parenthsis, changing echo to 
printnothing.


Finally, after looking online and through a couples of books, I was able to 
get this in the browser:


$minutes; echo $hours; echo $days; ?

I also got this in a browser (code not included in this post but you can see 
how far back to the basics I went to get this to work).


Hello World'; echo 

$minutes
; echo $hours; echo $days; ?

When I sent the file over to my other computer...I got what I thought I was 
going to get, numbers and calculations.


What would cause a browser to display the closing tags of php?

I dont know where to begin to look, could this be a setting in my editor 
(Dreamweaver CS3), the testing server config file, the browsers?


Thanks for your help.

Gary 



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5057 (20100424) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




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



Re: [PHP] PHP not being read?

2010-04-24 Thread Michiel Sikma
On 25 April 2010 00:45, Gary g...@paulgdesigns.com wrote:

 What would cause a machine not to read/process php?

 I have a laptop that I have been ever increasing using for php scripting.
  I decided to do a simple experiment, it started out something like:

 $seconds=1;
 $minutes=$seconds*60;
 $hours=$minutes*60;
 $days=$hours*24;

 echo $seconds;
 echo $minutes;
 echo $hours;
 echo $days;

-snip-



A text editor with syntax highlighting would certainly help. There's a
double quote  right in front of the $hours variable on the fourth line.
That's an unterminated string literal, a syntax error, which would cause PHP
to abort entirely. Your php's error log probably has a message in it to this
extent.

The reason why you got a number of different results is probably because you
added another double quote further down in later versions.

But if that's somehow not it, post the entire source code of your file on a
site like http://pastie.org/ so we can have a closer look.

Michiel


Re: [PHP] PHP not being read?

2010-04-24 Thread Gary
Michiel

Thank you for your reply, but that is not it.

I took it down to
?php
$seconds=1;
echo $seconds;
?

Total code, and got nothing, blank screen.  (this is just a silly exercise 
where I was going to input a date of birth and produce age in seconds) When 
I put the exact same code on my other machine, it showed numbers and 
calculations, most important, it showed something at all.

This is an issue with configuration or settings somewhere, or perhaps my 
XAMPP is corrupt.

Thank you for your reply.

Gary


Michiel Sikma mich...@thingmajig.org wrote in message 
news:y2s6cda1ded1004241703w90e8790ay46bb77c4e1162...@mail.gmail.com...
 On 25 April 2010 00:45, Gary g...@paulgdesigns.com wrote:

 What would cause a machine not to read/process php?

 I have a laptop that I have been ever increasing using for php scripting.
  I decided to do a simple experiment, it started out something like:

 $seconds=1;
 $minutes=$seconds*60;
 $hours=$minutes*60;
 $days=$hours*24;

 echo $seconds;
 echo $minutes;
 echo $hours;
 echo $days;

 -snip-



 A text editor with syntax highlighting would certainly help. There's a
 double quote  right in front of the $hours variable on the fourth line.
 That's an unterminated string literal, a syntax error, which would cause 
 PHP
 to abort entirely. Your php's error log probably has a message in it to 
 this
 extent.

 The reason why you got a number of different results is probably because 
 you
 added another double quote further down in later versions.

 But if that's somehow not it, post the entire source code of your file on 
 a
 site like http://pastie.org/ so we can have a closer look.

 Michiel



 __ Information from ESET Smart Security, version of virus 
 signature database 5057 (20100424) __

 The message was checked by ESET Smart Security.

 http://www.eset.com

 



__ Information from ESET Smart Security, version of virus signature 
database 5057 (20100424) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] PHP not being read?

2010-04-24 Thread Karl DeSaulniers

Hi Gary,
It is probably because you have the file named .html and not .php.

I took your code:

?php
$seconds=1;
echo $seconds;
?

and put it an a .html and .php file and put it on my server.
With the.php file, I got a result of 1
for the .html file I got a blank screen.

HTH,

Karl


On Apr 24, 2010, at 7:24 PM, Gary wrote:


Michiel

Thank you for your reply, but that is not it.

I took it down to
?php
$seconds=1;
echo $seconds;
?

Total code, and got nothing, blank screen.  (this is just a silly  
exercise
where I was going to input a date of birth and produce age in  
seconds) When

I put the exact same code on my other machine, it showed numbers and
calculations, most important, it showed something at all.

This is an issue with configuration or settings somewhere, or  
perhaps my

XAMPP is corrupt.

Thank you for your reply.

Gary


Michiel Sikma mich...@thingmajig.org wrote in message
news:y2s6cda1ded1004241703w90e8790ay46bb77c4e1162...@mail.gmail.com...

On 25 April 2010 00:45, Gary g...@paulgdesigns.com wrote:


What would cause a machine not to read/process php?

I have a laptop that I have been ever increasing using for php  
scripting.

 I decided to do a simple experiment, it started out something like:

$seconds=1;
$minutes=$seconds*60;
$hours=$minutes*60;
$days=$hours*24;

echo $seconds;
echo $minutes;
echo $hours;
echo $days;


-snip-





A text editor with syntax highlighting would certainly help.  
There's a
double quote  right in front of the $hours variable on the fourth  
line.
That's an unterminated string literal, a syntax error, which would  
cause

PHP
to abort entirely. Your php's error log probably has a message in  
it to

this
extent.

The reason why you got a number of different results is probably  
because

you
added another double quote further down in later versions.

But if that's somehow not it, post the entire source code of your  
file on

a
site like http://pastie.org/ so we can have a closer look.

Michiel



__ Information from ESET Smart Security, version of virus
signature database 5057 (20100424) __

The message was checked by ESET Smart Security.

http://www.eset.com






__ Information from ESET Smart Security, version of virus  
signature database 5057 (20100424) __


The message was checked by ESET Smart Security.

http://www.eset.com





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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] PHP not being read?

2010-04-24 Thread Gary
Karl

Thanks for your replythat wasnt it.  File was originated as a php file.

So I have been playing with the experiment, and this is now the total code:

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
head
style type=text/css


body {
 font-size:20px;
 }
/style
meta http-equiv=Content-Type content=text/html; charset=utf-8 /
titleTime Experiment/title
/head
form action=?php echo $_SERVER['PHP_SELF'];? method=post
I am input name=age type=text / years old.br /br /
input name=submit type=submit value=submit /br /br /
/form
body

?php
$age=$_POST['age'];

$seconds=1;
$minutes=($seconds*60);//60
$hours=$minutes*60;//3600
$days=$hours*24;//86,400
//$days=$days;
$months=$days*30;//2,592,000

$years=$months*12;
$seconds_old=$years*$age;
$seconds_old=number_format($seconds_old,0,'.',',');
$years=number_format($years,0,'.',',');
$days=number_format($days,0,'.',',');
$months=number_format($months,0,'.',',');

/*Interesting, when I had the number_format of days before the months, the 
math was wrong, it returned 2,592
 turns out you must reverse the order of the second var for number_format*/
echo There is $seconds in a second;
echo pThere are $minutes seconds in a minute./p;
echo pThere are $hours seconds in an hour./p;
echo pThere are $days seconds in a day./p;
echo pThere are $months seconds in a month./p;
echo pThere are $years seconds in a year./p;
echo pYou have lived about $seconds_old Seconds in your life/p;

?
/body
/html

And this code produces, on the good machine, the tower, this:

I am  years old.




There is 1 in a second
There are 60 seconds in a minute.

There are 3600 seconds in an hour.

There are 86,400 seconds in a day.

There are 2,592,000 seconds in a month.

There are 31,104,000 seconds in a year.

You have lived about 0 Seconds in your life



Same exact code that I just now sent over to the original bad machine, 
produces this:




I am  years old.




There are $minutes seconds in a minute.; echo 

There are $hours seconds in an hour.

; echo 

There are $days seconds in a day.

; echo 

There are $months seconds in a month.

; echo 

There are $years seconds in a year.

; echo 

You have lived about $seconds_old Seconds in your life

; ?



Same code, different machines, different results.  Notice the closing ? php 
tag is printed.

Like I said, I dont know where to start to look.

Thanks for your reply.



Gary



Karl DeSaulniers k...@designdrumm.com wrote in message 
news:5aedfbf6-577b-44d8-9771-3ca1f7971...@designdrumm.com...
 Hi Gary,
 It is probably because you have the file named .html and not .php.

 I took your code:

 ?php
 $seconds=1;
 echo $seconds;
 ?

 and put it an a .html and .php file and put it on my server.
 With the.php file, I got a result of 1
 for the .html file I got a blank screen.

 HTH,

 Karl


 On Apr 24, 2010, at 7:24 PM, Gary wrote:

 Michiel

 Thank you for your reply, but that is not it.

 I took it down to
 ?php
 $seconds=1;
 echo $seconds;
 ?

 Total code, and got nothing, blank screen.  (this is just a silly 
 exercise
 where I was going to input a date of birth and produce age in  seconds) 
 When
 I put the exact same code on my other machine, it showed numbers and
 calculations, most important, it showed something at all.

 This is an issue with configuration or settings somewhere, or  perhaps my
 XAMPP is corrupt.

 Thank you for your reply.

 Gary


 Michiel Sikma mich...@thingmajig.org wrote in message
 news:y2s6cda1ded1004241703w90e8790ay46bb77c4e1162...@mail.gmail.com...
 On 25 April 2010 00:45, Gary g...@paulgdesigns.com wrote:

 What would cause a machine not to read/process php?

 I have a laptop that I have been ever increasing using for php 
 scripting.
  I decided to do a simple experiment, it started out something like:

 $seconds=1;
 $minutes=$seconds*60;
 $hours=$minutes*60;
 $days=$hours*24;

 echo $seconds;
 echo $minutes;
 echo $hours;
 echo $days;

 -snip-



 A text editor with syntax highlighting would certainly help.  There's a
 double quote  right in front of the $hours variable on the fourth 
 line.
 That's an unterminated string literal, a syntax error, which would 
 cause
 PHP
 to abort entirely. Your php's error log probably has a message in  it to
 this
 extent.

 The reason why you got a number of different results is probably 
 because
 you
 added another double quote further down in later versions.

 But if that's somehow not it, post the entire source code of your  file 
 on
 a
 site like http://pastie.org/ so we can have a closer look.

 Michiel



 __ Information from ESET Smart Security, version of virus
 signature database 5057 (20100424) __

 The message was checked by ESET Smart Security.

 http://www.eset.com





 __ Information from ESET Smart Security, version of virus 
 signature database 5057 (20100424) __

 The message was checked by ESET Smart Security.

 http

Re: [PHP] PHP not being read?

2010-04-24 Thread Karl DeSaulniers

What is the browser and browser version your using on the bad computer?
What OS?

Are you previewing the file on the computer or from a server?

Karl


On Apr 24, 2010, at 8:30 PM, Gary wrote:


Karl

Thanks for your replythat wasnt it.  File was originated as a  
php file.


So I have been playing with the experiment, and this is now the  
total code:


!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
head
style type=text/css


body {
 font-size:20px;
 }
/style
meta http-equiv=Content-Type content=text/html; charset=utf-8 /
titleTime Experiment/title
/head
form action=?php echo $_SERVER['PHP_SELF'];? method=post
I am input name=age type=text / years old.br /br /
input name=submit type=submit value=submit /br /br /
/form
body

?php
$age=$_POST['age'];

$seconds=1;
$minutes=($seconds*60);//60
$hours=$minutes*60;//3600
$days=$hours*24;//86,400
//$days=$days;
$months=$days*30;//2,592,000

$years=$months*12;
$seconds_old=$years*$age;
$seconds_old=number_format($seconds_old,0,'.',',');
$years=number_format($years,0,'.',',');
$days=number_format($days,0,'.',',');
$months=number_format($months,0,'.',',');

/*Interesting, when I had the number_format of days before the  
months, the

math was wrong, it returned 2,592
 turns out you must reverse the order of the second var for  
number_format*/

echo There is $seconds in a second;
echo pThere are $minutes seconds in a minute./p;
echo pThere are $hours seconds in an hour./p;
echo pThere are $days seconds in a day./p;
echo pThere are $months seconds in a month./p;
echo pThere are $years seconds in a year./p;
echo pYou have lived about $seconds_old Seconds in your life/p;

?
/body
/html

And this code produces, on the good machine, the tower, this:

I am  years old.




There is 1 in a second
There are 60 seconds in a minute.

There are 3600 seconds in an hour.

There are 86,400 seconds in a day.

There are 2,592,000 seconds in a month.

There are 31,104,000 seconds in a year.

You have lived about 0 Seconds in your life



Same exact code that I just now sent over to the original bad  
machine,

produces this:




I am  years old.




There are $minutes seconds in a minute.; echo 

There are $hours seconds in an hour.

; echo 

There are $days seconds in a day.

; echo 

There are $months seconds in a month.

; echo 

There are $years seconds in a year.

; echo 

You have lived about $seconds_old Seconds in your life

; ?



Same code, different machines, different results.  Notice the  
closing ? php

tag is printed.

Like I said, I dont know where to start to look.

Thanks for your reply.



Gary



Karl DeSaulniers k...@designdrumm.com wrote in message
news:5aedfbf6-577b-44d8-9771-3ca1f7971...@designdrumm.com...

Hi Gary,
It is probably because you have the file named .html and not .php.

I took your code:

?php
$seconds=1;
echo $seconds;
?

and put it an a .html and .php file and put it on my server.
With the.php file, I got a result of 1
for the .html file I got a blank screen.

HTH,

Karl


On Apr 24, 2010, at 7:24 PM, Gary wrote:


Michiel

Thank you for your reply, but that is not it.

I took it down to
?php
$seconds=1;
echo $seconds;
?

Total code, and got nothing, blank screen.  (this is just a silly
exercise
where I was going to input a date of birth and produce age in   
seconds)

When
I put the exact same code on my other machine, it showed numbers and
calculations, most important, it showed something at all.

This is an issue with configuration or settings somewhere, or   
perhaps my

XAMPP is corrupt.

Thank you for your reply.

Gary


Michiel Sikma mich...@thingmajig.org wrote in message
news:y2s6cda1ded1004241703w90e8790ay46bb77c4e1162...@mail.gmail.com. 
..

On 25 April 2010 00:45, Gary g...@paulgdesigns.com wrote:


What would cause a machine not to read/process php?

I have a laptop that I have been ever increasing using for php
scripting.
 I decided to do a simple experiment, it started out something  
like:


$seconds=1;
$minutes=$seconds*60;
$hours=$minutes*60;
$days=$hours*24;

echo $seconds;
echo $minutes;
echo $hours;
echo $days;


-snip-





A text editor with syntax highlighting would certainly help.   
There's a

double quote  right in front of the $hours variable on the fourth
line.
That's an unterminated string literal, a syntax error, which would
cause
PHP
to abort entirely. Your php's error log probably has a message  
in  it to

this
extent.

The reason why you got a number of different results is probably
because
you
added another double quote further down in later versions.

But if that's somehow not it, post the entire source code of  
your  file

on
a
site like http://pastie.org/ so we can have a closer look.

Michiel



__ Information from ESET Smart Security, version of virus
signature database 5057 (20100424) __

The message was checked by ESET Smart Security.

http://www.eset.com

Re: [PHP] PHP not being read?

2010-04-24 Thread Gary
.

But if that's somehow not it, post the entire source code of  your 
file

on
a
site like http://pastie.org/ so we can have a closer look.

Michiel



__ Information from ESET Smart Security, version of virus
signature database 5057 (20100424) __

The message was checked by ESET Smart Security.

http://www.eset.com






__ Information from ESET Smart Security, version of virus
signature database 5057 (20100424) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


__ Information from ESET Smart Security, version of virus
signature database 5057 (20100424) __

The message was checked by ESET Smart Security.

http://www.eset.com







__ Information from ESET Smart Security, version of virus 
signature database 5057 (20100424) __


The message was checked by ESET Smart Security.

http://www.eset.com





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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


__ Information from ESET NOD32 Antivirus, version of virus 
signature database 5057 (20100424) __


The message was checked by ESET NOD32 Antivirus.

http://www.eset.com






__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5057 (20100424) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




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



Re: [PHP] PHP not being read?

2010-04-24 Thread Karl DeSaulniers

cause
PHP
to abort entirely. Your php's error log probably has a message   
in  it to

this
extent.

The reason why you got a number of different results is probably
because
you
added another double quote further down in later versions.

But if that's somehow not it, post the entire source code of   
your file

on
a
site like http://pastie.org/ so we can have a closer look.

Michiel



__ Information from ESET Smart Security, version of virus
signature database 5057 (20100424) __

The message was checked by ESET Smart Security.

http://www.eset.com






__ Information from ESET Smart Security, version of virus
signature database 5057 (20100424) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


__ Information from ESET Smart Security, version of virus
signature database 5057 (20100424) __

The message was checked by ESET Smart Security.

http://www.eset.com







__ Information from ESET Smart Security, version of virus  
signature database 5057 (20100424) __


The message was checked by ESET Smart Security.

http://www.eset.com





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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


__ Information from ESET NOD32 Antivirus, version of virus  
signature database 5057 (20100424) __


The message was checked by ESET NOD32 Antivirus.

http://www.eset.com





__ Information from ESET NOD32 Antivirus, version of virus  
signature database 5057 (20100424) __


The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




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



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