Re: [PHP] Convert UTF-8 to PHP defines

2010-05-28 Thread Ashley Sheridan
On Fri, 2010-05-28 at 11:51 +0800, Guus Ellenkamp wrote:

 I would like if you stick to the original issue: can a PHP source file be in 
 utf-8. It's not about the output, that is properly supported.
 
 Think it would be a good idea anyhow that PHP would support utf-8 source 
 files as it seems utf-8 is going to be the de-facto standard for text files 
 anyhow.
 
 Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
 news:1274988834.2202.285.ca...@localhost...
  On Thu, 2010-05-27 at 15:28 -0400, Bob McConnell wrote:
 
  From: tedd
 
   The Unicode database uses the same lower
   character values (i.e., code points) as does
   ASCII, namely 0-127, and thus UFT-8 (8-bit
   variable width encoding) is really a super-set
   which includes the sub-set of ASCII.
  
   The Wingdings font that Ash refers to is the
   really the Dingbat char set in Unicode, as
   shown here:
  
   The use of UFT-8 encoding in everything (web and
   php) should present much less problems globally
   than it is trying to fight it.
 
  Thanks tedd,
 
  The real question is whether unicode is even relevant now that the UTF
  series is available. I see no reason to have to deal with two competing
  specifications, when one of them is more than adequate for the job and
  the other is not even finished yet. That's like the old days when a few
  users demanded we support both ASCII and EBCDIC. That didn't get very
  far either.
 
  Bob McConnell
 
 
 
  Bob, UTF is unicode (Unicode Transformation Format)
 
  Interesting enough to note, and not sure if Tedd knows this or not (he
  probably does!) but Chrome has a nice feature for those punycode URLs;
  it suggests the actual real URL instead once you type the domain in. Not
  sure about Safari right now, couldn't be bothered to fire up a VM just
  to check. I would assume Firefox handles these URLs well enough too.
 
  Tedd, does that URL actually go anywhere, as I got nothing when I tried
  visiting it, both the actual URL and the punycode version.
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 
  
 
 
 


Yes is the quick answer.

There's no better way than to try it yourself.

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




Re: [PHP] Convert UTF-8 to PHP defines

2010-05-28 Thread Richard Quadling
On 28 May 2010 04:47, Guus Ellenkamp ellenkamp_g...@hotmail.com wrote:
 And I need(ed) this stuff especially for non-ASCII characters like Chinese,
 Arabic and stuff :)

 Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
 news:1274976794.2202.274.ca...@localhost...
 On Thu, 2010-05-27 at 12:08 -0400, Adam Richardson wrote:

 On Thu, May 27, 2010 at 9:45 AM, Guus Ellenkamp
 ellenkamp_g...@hotmail.comwrote:

  Thanks, but are you sure of that? I did some research a while ago and
  found
  that officially PHP files should be ascii and not have any specific
  character encoding. I believe it will work anyhow (did not try this
  one),
  but would like to stick with the standards.
 
  Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
  news:1274883714.2202.228.ca...@localhost...
   On Wed, 2010-05-26 at 22:20 +0800, Guus Ellenkamp wrote:
  
   We use PHP defines for defining text in different languages. As far
   as I
   know PHP files are supposed to be ASCII, not UTF-8 or something like
   that.
   What I want to make is a conversion program that would convert a
   given
   UTF-8
   file with the format
  
   definetext1=this is a text in random UTF-8, probably arabic or
   similar
   text
   definetext2=this is another text in random UTF-8, probably arabic or
   similar
   text
  
   into a file with the following defines
  
  
  define('definetext1',chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value));
  
  define('definetext2,chr(t_value).chr(h_value).chr(i_value)...chr(x_value).chr(t_value));
  
   Not sure if I'm using the correct chr/ord function, but I hope the
   above
   is
   clear enough to make clear what I'm looking for. Basically the output
   file
   should be ascii and not contain any utf-8.
  
   Any advise? The html_special_chars did not seem to work for
   Vietnamese
   text
   I tried to convert, so something seems to get wrong with just reading
   an
   array of strings and converting the strings and putting them in
   defines.
  
  
  
  
  
   PHP files can contain utf-8, and in-fact is the preference of most
   developers I know of.
  
   Thanks,
   Ash
   http://www.ashleysheridan.co.uk
  
  
  
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 Because the lower range of UTF-8 matches the ascii character set
 (intentionally by design), you'll be able to use UTF-8 for PHP files
 without
 problem (i.e., ascii 7-bit chars have same encoding in UTF-8.)
 http://www.cl.cam.ac.uk/~mgk25/unicode.html

 However, if you were to use any of the multibyte characters of UTF-8 in a
 PHP file, you could run in to some trouble.  I use UTF-8 for most of my
 PHP
 files, but I've been sticking to the ASCII subset exclusively.

 Adam



 I don't use the higher range of characters often, but I do sometimes use
 them for things like the graphical glyphs (½??, etc) I know I could do
 those with regular text and the Wingdings font, but that's not available
 on every computer, and breaks the semantic meaning behind the glyphs.

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





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



Do you mean ...

?php
echo '早晨好';
?

If you cut and paste that into your editor, make sure that the font
you are using is a UTF-8 font. Otherwise you will see the font's
unknown symbol glyph rather than the correct ones.

If your font doesn't have the symbols, it doesn't affect the code. The
editor is only displaying the code. It doesn't alter the code.

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] Convert UTF-8 to PHP defines

2010-05-28 Thread tedd

Bob wrtote:


The real question is whether unicode is even relevant now that the UTF
series is available.


Ashley answered:


Bob, UTF is unicode (Unicode Transformation Format)


Yes, Ashley is correct. UTF-8 is Unicode, as is UTF-16 and UTF-32, 
which all use different a number of bytes for each code point. Both 
UTF-8 and UTF-16 are variable length whereas UTF-32 is a fixed length 
of four bytes per code point.


As is my understanding, UTF-8 will accommodate all the languages 
(glyphs) of the world and then some. It will be a while before we 
need UTF-16 or UTF-32 but those are just a larger super-sets.


In any event, I always use UTF-8 in all my encoding.

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] Convert UTF-8 to PHP defines

2010-05-28 Thread tedd

At 8:33 PM +0100 5/27/10, Ashley Sheridan wrote:
Tedd, does that URL actually go anywhere, as I got nothing when I 
tried visiting it, both the actual URL and the punycode version.


Ash:

Try it again (it worked for me).

In any event, the link was supposed to be redirected to this site:

http://xn--fci.com

If you run Safari, then the url will be shown as a check-mark.

My most popular IDNS site is square-root dot com (option v):

http://xn--19g.com

The story about that site is on the web page -- you may read if interested.

The site receives over 150 unique Mac visitors per day and that 
number keeps climbing -- I don't know why. For example, one day I had 
over 800 visitors from Spain -- why???


Obviously, I'm trying to sell the domain (for 6 figures), but have 
had no takers.


I can always get back into Macintosh software development and use the 
site to sell my own apps -- that's an option I ponder whenever my 
clients don't call me for a week.


Who knows what may happen.

Cheers,

tedd

PS: I have over a dozen IDNS domains including the Pharmaceutical 
Icon, Yin-Yang Symbol, Sigma, Delta, and DOT dot com (option 8).


--
---
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] Select Values Didn't Get Passed in From Two Different Forms

2010-05-28 Thread tedd

At 9:19 PM -0400 5/27/10, Alice Wei wrote:


I am not sure how to add to the page you have set up, but here is 
the code with ther portion you have set up:



?php
  $start = isset($_POST['start']) ? $_POST['start'] : null;
?
form action= method=post
  p
Select the type of your starting point of interest:br
input type=text name=start value=?php 
echo($start);? size=20 br /

Which Semster is this: select name=semester
option value=FallFall/option
option value=SpringSpring/option
option value=SummerSummer/option
/selectbr/
input type=submit name=submit value=Submit 
  /p
/form

 Note, what I provided here does not include anything on the ajax.

Hope this answers your question.


Alice :

I didn't have a question, but here's my revision of your code:

http://www.webbytedd.com//alice1/

Please review the code and see how: 1) I captured the select value; 
2) and how I used that value to focus the selected option.


You say:


 Note, what I provided here does not include anything on the ajax.


I've never put anything on the ajax -- that doesn't make sense.

Ajax is simply a way to communicate from the browser to the server 
and back again without requiring a browser refresh. As the user 
triggers a client-side event (i.e., click, select, enter text, move a 
mouse, whatever), a javascript routine then sends data to the server 
to activate a server-side script, which may, or may not, return data.


For example -- with javascript turned ON please review:

http://www.webbytedd.com/a/ajax-site/

This is simply a one page template that uses an ajax routine to 
retrieve data from the server to populate the page based upon what 
the user triggers (i.e., the visitor clicks a navigational link).


If you will review the HTML source code, you will find a very basic 
HTML template that will remain static for all three apparent pages. 
If you use the FireFox browser you can review the generated HTML.


Now where did the generated HTML come from, you might ask? It came 
from the server after a request was made from the client to the 
server and the server responded with the correct data -- all without 
requiring a browser refresh. That's an example of how ajax works.


Keep in mind that using best practices requires you to *first* 
design forms to collect data WITHOUT requiring javascript and then 
you can enhance the form to provide additional functionality to those 
who have javascript turned on. Also keep in mind that you may not 
need ajax to alter the form. You only need ajax if there is data on 
the server that needs to be retrieved.


Now, please turn javascript OFF in your browser and review my page again:

http://www.webbytedd.com/a/ajax-site/

That's an example of NOT following best practices. The visitor is 
provided nothing if they have javascript turned OFF.


Now considering such, what additional functionality do you want your 
form to do that can't be done already?


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] Convert UTF-8 to PHP defines

2010-05-28 Thread Nisse Engström
On Fri, 28 May 2010 11:13:35 -0400, tedd wrote:

 Bob wrtote:
 
The real question is whether unicode is even relevant now that the UTF
series is available.
 
 Ashley answered:
 
Bob, UTF is unicode (Unicode Transformation Format)

Or more precisely, UTF-{8,16,32} are different ways to
serialize Unicode code points into sequences of octets
that makes it possible to store and transmit Unicode
data.

 Yes, Ashley is correct. UTF-8 is Unicode, as is UTF-16 and UTF-32, 
 which all use different a number of bytes for each code point. Both 
 UTF-8 and UTF-16 are variable length whereas UTF-32 is a fixed length 
 of four bytes per code point.
 
 As is my understanding, UTF-8 will accommodate all the languages 
 (glyphs) of the world and then some. It will be a while before we 
 need UTF-16 or UTF-32 but those are just a larger super-sets.

*blink*

They are all capable of representing the full Unicode
range, which is restricted to U+ - U+10.

The theoretical limits are:

  UTF-8   [0 - 7fff]
  UTF-16  [0 -   10]
  UTF-32  [0 - ]

Also, there are many, many, *many* more glyphs than
characters (code point) in the world. As an example,
www.fonts.com lists 165,125 fonts. Every one has a
*different* glyph for the characer A...


/Nisse

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



RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-28 Thread Alice Wei


 Date: Fri, 28 May 2010 12:34:55 -0400
 To: aj...@alumni.iu.edu; php-general@lists.php.net
 From: tedd.sperl...@gmail.com
 Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different 
 Forms
 
 At 9:19 PM -0400 5/27/10, Alice Wei wrote:
 
 I am not sure how to add to the page you have set up, but here is 
 the code with ther portion you have set up:
 
 
 ?php
$start = isset($_POST['start']) ? $_POST['start'] : null;
 ?
  form action= method=post
p
  Select the type of your starting point of interest:br
  input type=text name=start value=?php 
 echo($start);? size=20 br /
  Which Semster is this: select name=semester
  option value=FallFall/option
  option value=SpringSpring/option
  option value=SummerSummer/option
  /selectbr/
  input type=submit name=submit value=Submit 
/p
  /form
 
   Note, what I provided here does not include anything on the ajax.
 
 Hope this answers your question.
 
 Alice :
 
 I didn't have a question, but here's my revision of your code:
 
 http://www.webbytedd.com//alice1/
 
 Please review the code and see how: 1) I captured the select value; 
 2) and how I used that value to focus the selected option.
 
 You say:
 
   Note, what I provided here does not include anything on the ajax.
 
 I've never put anything on the ajax -- that doesn't make sense.
 
 Ajax is simply a way to communicate from the browser to the server 
 and back again without requiring a browser refresh. As the user 
 triggers a client-side event (i.e., click, select, enter text, move a 
 mouse, whatever), a javascript routine then sends data to the server 
 to activate a server-side script, which may, or may not, return data.
 
 For example -- with javascript turned ON please review:
 
 http://www.webbytedd.com/a/ajax-site/
 
 This is simply a one page template that uses an ajax routine to 
 retrieve data from the server to populate the page based upon what 
 the user triggers (i.e., the visitor clicks a navigational link).
 
 If you will review the HTML source code, you will find a very basic 
 HTML template that will remain static for all three apparent pages. 
 If you use the FireFox browser you can review the generated HTML.
 
 Now where did the generated HTML come from, you might ask? It came 
 from the server after a request was made from the client to the 
 server and the server responded with the correct data -- all without 
 requiring a browser refresh. That's an example of how ajax works.
 
 Keep in mind that using best practices requires you to *first* 
 design forms to collect data WITHOUT requiring javascript and then 
 you can enhance the form to provide additional functionality to those 
 who have javascript turned on. Also keep in mind that you may not 
 need ajax to alter the form. You only need ajax if there is data on 
 the server that needs to be retrieved.
 
 Now, please turn javascript OFF in your browser and review my page again:
 
 http://www.webbytedd.com/a/ajax-site/
 
 That's an example of NOT following best practices. The visitor is 
 provided nothing if they have javascript turned OFF.
 
 Now considering such, what additional functionality do you want your 
 form to do that can't be done already?
 
 Cheers,
 
 tedd
 
 -- 

Tedd,  

  What I am trying to find out is, when I have my form with a dependent select 
menu, how can I pass the value of the select menu to another page? I have 
mentioned in the initial email that if I just allow users to type stuff, it 
passes the form back to itself and works. However, what I want
 to do is to allow users click one radio button/checkbox, and use that value to 
determine which select menu to bring up. However, the information I am only 
interested in storing, is the value of the select menu and not the radio  
button/checkbox. 

Am I making sense here? 

Alice
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com
  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendarocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-28 Thread Ashley Sheridan
On Fri, 2010-05-28 at 15:00 -0400, Alice Wei wrote:

 
  Date: Fri, 28 May 2010 12:34:55 -0400
  To: aj...@alumni.iu.edu; php-general@lists.php.net
  From: tedd.sperl...@gmail.com
  Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different
   Forms
  
  At 9:19 PM -0400 5/27/10, Alice Wei wrote:
  
  I am not sure how to add to the page you have set up, but here is 
  the code with ther portion you have set up:
  
  
  ?php
 $start = isset($_POST['start']) ? $_POST['start'] : null;
  ?
   form action= method=post
 p
   Select the type of your starting point of interest:br
   input type=text name=start value=?php 
  echo($start);? size=20 br /
   Which Semster is this: select name=semester
   option value=FallFall/option
   option value=SpringSpring/option
   option value=SummerSummer/option
   /selectbr/
   input type=submit name=submit value=Submit 
 /p
   /form
  
Note, what I provided here does not include anything on the ajax.
  
  Hope this answers your question.
  
  Alice :
  
  I didn't have a question, but here's my revision of your code:
  
  http://www.webbytedd.com//alice1/
  
  Please review the code and see how: 1) I captured the select value; 
  2) and how I used that value to focus the selected option.
  
  You say:
  
Note, what I provided here does not include anything on the ajax.
  
  I've never put anything on the ajax -- that doesn't make sense.
  
  Ajax is simply a way to communicate from the browser to the server 
  and back again without requiring a browser refresh. As the user 
  triggers a client-side event (i.e., click, select, enter text, move a 
  mouse, whatever), a javascript routine then sends data to the server 
  to activate a server-side script, which may, or may not, return data.
  
  For example -- with javascript turned ON please review:
  
  http://www.webbytedd.com/a/ajax-site/
  
  This is simply a one page template that uses an ajax routine to 
  retrieve data from the server to populate the page based upon what 
  the user triggers (i.e., the visitor clicks a navigational link).
  
  If you will review the HTML source code, you will find a very basic 
  HTML template that will remain static for all three apparent pages. 
  If you use the FireFox browser you can review the generated HTML.
  
  Now where did the generated HTML come from, you might ask? It came 
  from the server after a request was made from the client to the 
  server and the server responded with the correct data -- all without 
  requiring a browser refresh. That's an example of how ajax works.
  
  Keep in mind that using best practices requires you to *first* 
  design forms to collect data WITHOUT requiring javascript and then 
  you can enhance the form to provide additional functionality to those 
  who have javascript turned on. Also keep in mind that you may not 
  need ajax to alter the form. You only need ajax if there is data on 
  the server that needs to be retrieved.
  
  Now, please turn javascript OFF in your browser and review my page again:
  
  http://www.webbytedd.com/a/ajax-site/
  
  That's an example of NOT following best practices. The visitor is 
  provided nothing if they have javascript turned OFF.
  
  Now considering such, what additional functionality do you want your 
  form to do that can't be done already?
  
  Cheers,
  
  tedd
  
  -- 
 
 Tedd,  
 
   What I am trying to find out is, when I have my form with a dependent 
 select menu, how can I pass the value of the select menu to another page? I 
 have mentioned in the initial email that if I just allow users to type stuff, 
 it passes the form back to itself and works. However, what I want
  to do is to allow users click one radio button/checkbox, and use that value 
 to determine which select menu to bring up. However, the information I am 
 only interested in storing, is the value of the select menu and not the radio 
  button/checkbox. 
 
 Am I making sense here? 
 
 Alice
  ---
  http://sperling.com  http://ancientstones.com  http://earthstones.com
 
 _
 The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
 Hotmail. 
 http://www.windowslive.com/campaign/thenewbusy?tile=multicalendarocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5


You could do this a couple of ways:

1) Have all the possible form elements you need and show the one the
user needs with Javascript
2) Use ajax to grab the select list you need based on the users
selection and add it in to the current form.

It doesn't matter if you submit more form elements than you need, just
don't use them when the form is submitted to the php script.

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




RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-28 Thread Alice Wei

Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms
From: a...@ashleysheridan.co.uk
To: aj...@alumni.iu.edu
CC: tedd.sperl...@gmail.com; php-general@lists.php.net
Date: Fri, 28 May 2010 20:05:29 +0100






  
  


On Fri, 2010-05-28 at 15:00 -0400, Alice Wei wrote:


 Date: Fri, 28 May 2010 12:34:55 -0400
 To: aj...@alumni.iu.edu; php-general@lists.php.net
 From: tedd.sperl...@gmail.com
 Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different 
 Forms
 
 At 9:19 PM -0400 5/27/10, Alice Wei wrote:
 
 I am not sure how to add to the page you have set up, but here is 
 the code with ther portion you have set up:
 
 
 ?php
$start = isset($_POST['start']) ? $_POST['start'] : null;
 ?
  form action= method=post
p
  Select the type of your starting point of interest:br
  input type=text name=start value=?php 
 echo($start);? size=20 br /
  Which Semster is this: select name=semester
  option value=FallFall/option
  option value=SpringSpring/option
  option value=SummerSummer/option
  /selectbr/
  input type=submit name=submit value=Submit 
/p
  /form
 
   Note, what I provided here does not include anything on the ajax.
 
 Hope this answers your question.
 
 Alice :
 
 I didn't have a question, but here's my revision of your code:
 
 http://www.webbytedd.com//alice1/
 
 Please review the code and see how: 1) I captured the select value; 
 2) and how I used that value to focus the selected option.
 
 You say:
 
   Note, what I provided here does not include anything on the ajax.
 
 I've never put anything on the ajax -- that doesn't make sense.
 
 Ajax is simply a way to communicate from the browser to the server 
 and back again without requiring a browser refresh. As the user 
 triggers a client-side event (i.e., click, select, enter text, move a 
 mouse, whatever), a javascript routine then sends data to the server 
 to activate a server-side script, which may, or may not, return data.
 
 For example -- with javascript turned ON please review:
 
 http://www.webbytedd.com/a/ajax-site/
 
 This is simply a one page template that uses an ajax routine to 
 retrieve data from the server to populate the page based upon what 
 the user triggers (i.e., the visitor clicks a navigational link).
 
 If you will review the HTML source code, you will find a very basic 
 HTML template that will remain static for all three apparent pages. 
 If you use the FireFox browser you can review the generated HTML.
 
 Now where did the generated HTML come from, you might ask? It came 
 from the server after a request was made from the client to the 
 server and the server responded with the correct data -- all without 
 requiring a browser refresh. That's an example of how ajax works.
 
 Keep in mind that using best practices requires you to *first* 
 design forms to collect data WITHOUT requiring javascript and then 
 you can enhance the form to provide additional functionality to those 
 who have javascript turned on. Also keep in mind that you may not 
 need ajax to alter the form. You only need ajax if there is data on 
 the server that needs to be retrieved.
 
 Now, please turn javascript OFF in your browser and review my page again:
 
 http://www.webbytedd.com/a/ajax-site/
 
 That's an example of NOT following best practices. The visitor is 
 provided nothing if they have javascript turned OFF.
 
 Now considering such, what additional functionality do you want your 
 form to do that can't be done already?
 
 Cheers,
 
 tedd
 
 -- 

Tedd,  

  What I am trying to find out is, when I have my form with a dependent select 
menu, how can I pass the value of the select menu to another page? I have 
mentioned in the initial email that if I just allow users to type stuff, it 
passes the form back to itself and works. However, what I want
 to do is to allow users click one radio button/checkbox, and use that value to 
determine which select menu to bring up. However, the information I am only 
interested in storing, is the value of the select menu and not the radio  
button/checkbox. 

Am I making sense here? 

Alice
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com
  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendarocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5




You could do this a couple of ways:



1) Have all the possible form elements you need and show the one the user needs 
with Javascript

2) Use ajax to grab the select list you need based on the users selection and 
add it in to the current form.



It doesn't matter if you submit more form elements than you need, just don't 
use them 

RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-28 Thread Ashley Sheridan
On Fri, 2010-05-28 at 15:12 -0400, Alice Wei wrote:

 Subject: RE: [PHP] Select Values Didn't Get Passed in From Two
 Different Forms
 From: a...@ashleysheridan.co.uk
 To: aj...@alumni.iu.edu
 CC: tedd.sperl...@gmail.com; php-general@lists.php.net
 Date: Fri, 28 May 2010 20:05:29 +0100
 
 On Fri, 2010-05-28 at 15:00 -0400, Alice Wei wrote: 
 
 
  Date: Fri, 28 May 2010 12:34:55 -0400
  To: aj...@alumni.iu.edu; php-general@lists.php.net
  From: tedd.sperl...@gmail.com
  Subject: RE: [PHP] Select Values Didn't Get Passed in From Two 
 Different Forms
  
  At 9:19 PM -0400 5/27/10, Alice Wei wrote:
  
  I am not sure how to add to the page you have set up, but here is 
  the code with ther portion you have set up:
  
  
  ?php
 $start = isset($_POST['start']) ? $_POST['start'] : null;
  ?
   form action= method=post
 p
   Select the type of your starting point of interest:br
   input type=text name=start value=?php 
  echo($start);? size=20 br /
   Which Semster is this: select name=semester
   option value=FallFall/option
   option value=SpringSpring/option
   option value=SummerSummer/option
   /selectbr/
   input type=submit name=submit value=Submit 
 /p
   /form
  
Note, what I provided here does not include anything on the ajax.
  
  Hope this answers your question.
  
  Alice :
  
  I didn't have a question, but here's my revision of your code:
  
  http://www.webbytedd.com//alice1/
  
  Please review the code and see how: 1) I captured the select value; 
  2) and how I used that value to focus the selected option.
  
  You say:
  
Note, what I provided here does not include anything on the ajax.
  
  I've never put anything on the ajax -- that doesn't make sense.
  
  Ajax is simply a way to communicate from the browser to the server 
  and back again without requiring a browser refresh. As the user 
  triggers a client-side event (i.e., click, select, enter text, move 
 a 
  mouse, whatever), a javascript routine then sends data to the 
 server 
  to activate a server-side script, which may, or may not, return 
 data.
  
  For example -- with javascript turned ON please review:
  
  http://www.webbytedd.com/a/ajax-site/
  
  This is simply a one page template that uses an ajax routine to 
  retrieve data from the server to populate the page based upon what 
  the user triggers (i.e., the visitor clicks a navigational link).
  
  If you will review the HTML source code, you will find a very basic 
  HTML template that will remain static for all three apparent 
 pages. 
  If you use the FireFox browser you can review the generated HTML.
  
  Now where did the generated HTML come from, you might ask? It came 
  from the server after a request was made from the client to the 
  server and the server responded with the correct data -- all 
 without 
  requiring a browser refresh. That's an example of how ajax works.
  
  Keep in mind that using best practices requires you to *first* 
  design forms to collect data WITHOUT requiring javascript and then 
  you can enhance the form to provide additional functionality to 
 those 
  who have javascript turned on. Also keep in mind that you may not 
  need ajax to alter the form. You only need ajax if there is data on 
  the server that needs to be retrieved.
  
  Now, please turn javascript OFF in your browser and review my page 
 again:
  
  http://www.webbytedd.com/a/ajax-site/
  
  That's an example of NOT following best practices. The visitor is 
  provided nothing if they have javascript turned OFF.
  
  Now considering such, what additional functionality do you want 
 your 
  form to do that can't be done already?
  
  Cheers,
  
  tedd
  
  -- 
 
 Tedd,  
 
   What I am trying to find out is, when I have my form with a 
 dependent select menu, how can I pass the value of the select menu to another 
 page? I have mentioned in the initial email that if I just allow users to 
 type stuff, it passes the form back to itself and works. However, what I want
  to do is to allow users click one radio button/checkbox, and use 
 

RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-28 Thread Alice Wei


Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different Forms
From: a...@ashleysheridan.co.uk
To: aj...@alumni.iu.edu
CC: tedd.sperl...@gmail.com; php-general@lists.php.net
Date: Fri, 28 May 2010 20:14:06 +0100






  
  


On Fri, 2010-05-28 at 15:12 -0400, Alice Wei wrote:


Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different 
Forms

From: a...@ashleysheridan.co.uk

To: aj...@alumni.iu.edu

CC: tedd.sperl...@gmail.com; php-general@lists.php.net

Date: Fri, 28 May 2010 20:05:29 +0100



On Fri, 2010-05-28 at 15:00 -0400, Alice Wei wrote: 


 Date: Fri, 28 May 2010 12:34:55 -0400
 To: aj...@alumni.iu.edu; php-general@lists.php.net
 From: tedd.sperl...@gmail.com
 Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different 
 Forms
 
 At 9:19 PM -0400 5/27/10, Alice Wei wrote:
 
 I am not sure how to add to the page you have set up, but here is 
 the code with ther portion you have set up:
 
 
 ?php
$start = isset($_POST['start']) ? $_POST['start'] : null;
 ?
  form action= method=post
p
  Select the type of your starting point of interest:br
  input type=text name=start value=?php 
 echo($start);? size=20 br /
  Which Semster is this: select name=semester
  option value=FallFall/option
  option value=SpringSpring/option
  option value=SummerSummer/option
  /selectbr/
  input type=submit name=submit value=Submit 
/p
  /form
 
   Note, what I provided here does not include anything on the ajax.
 
 Hope this answers your question.
 
 Alice :
 
 I didn't have a question, but here's my revision of your code:
 
 http://www.webbytedd.com//alice1/
 
 Please review the code and see how: 1) I captured the select value; 
 2) and how I used that value to focus the selected option.
 
 You say:
 
   Note, what I provided here does not include anything on the ajax.
 
 I've never put anything on the ajax -- that doesn't make sense.
 
 Ajax is simply a way to communicate from the browser to the server 
 and back again without requiring a browser refresh. As the user 
 triggers a client-side event (i.e., click, select, enter text, move a 
 mouse, whatever), a javascript routine then sends data to the server 
 to activate a server-side script, which may, or may not, return data.
 
 For example -- with javascript turned ON please review:
 
 http://www.webbytedd.com/a/ajax-site/
 
 This is simply a one page template that uses an ajax routine to 
 retrieve data from the server to populate the page based upon what 
 the user triggers (i.e., the visitor clicks a navigational link).
 
 If you will review the HTML source code, you will find a very basic 
 HTML template that will remain static for all three apparent pages. 
 If you use the FireFox browser you can review the generated HTML.
 
 Now where did the generated HTML come from, you might ask? It came 
 from the server after a request was made from the client to the 
 server and the server responded with the correct data -- all without 
 requiring a browser refresh. That's an example of how ajax works.
 
 Keep in mind that using best practices requires you to *first* 
 design forms to collect data WITHOUT requiring javascript and then 
 you can enhance the form to provide additional functionality to those 
 who have javascript turned on. Also keep in mind that you may not 
 need ajax to alter the form. You only need ajax if there is data on 
 the server that needs to be retrieved.
 
 Now, please turn javascript OFF in your browser and review my page again:
 
 http://www.webbytedd.com/a/ajax-site/
 
 That's an example of NOT following best practices. The visitor is 
 provided nothing if they have javascript turned OFF.
 
 Now considering such, what additional functionality do you want your 
 form to do that can't be done already?
 
 Cheers,
 
 tedd
 
 -- 

Tedd,  

  What I am trying to find out is, when I have my form with a dependent select 
menu, how can I pass the value of the select menu to another page? I have 
mentioned in the initial email that if I just allow users to type stuff, it 
passes the form back to itself and works. However, what I want
 to do is to allow users click one radio button/checkbox, and use that value to 
determine which select menu to bring up. However, the information I am only 
interested in storing, is the value of the select menu and not the radio  
button/checkbox. 

Am I making sense here? 

Alice
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com
  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendarocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5




You 

Re: [PHP] Convert UTF-8 to PHP defines

2010-05-28 Thread tedd

At 8:52 PM +0200 5/28/10, Nisse =?utf-8?Q?Engstr=C3=B6m?= wrote:

On Fri, 28 May 2010 11:13:35 -0400, tedd wrote:

  As is my understanding, UTF-8 will accommodate all the languages

 (glyphs) of the world and then some. It will be a while before we
 need UTF-16 or UTF-32 but those are just a larger super-sets.


*blink*

They are all capable of representing the full Unicode
range, which is restricted to U+ - U+10.

The theoretical limits are:

  UTF-8   [0 - 7fff]
  UTF-16  [0 -   10]
  UTF-32  [0 - ]

Also, there are many, many, *many* more glyphs than
characters (code point) in the world. As an example,
www.fonts.com lists 165,125 fonts. Every one has a
*different* glyph for the characer A...

/Nisse


*blink* *blink*

As you say, UTF-8 has a range of 0 to 7FFF

Forgive me, but isn't that 2,147,483,647 (DEC) code points?

Please note that 165,125 * 48 (upper/lower case) is only 7,925,952 
code points -- IF -- each letter of each font was to have it's own 
code point, which is not the case for Unicode.


Code points are assigned to specific char sets that belong to 
specific language sets, such as English being assigned to the code 
point range that is common with ASCII. From that, we can have as many 
fonts as your software can handle. However, ASCII 65 DEC (41 HEX) or 
code point 65 (41 HEX) is still tied to the letter A regardless of 
if it is Helvetical or Times. So, don't confuse code points with 
fonts.


If you spend some time looking at the numerous char sets that Unicode 
offers you will see that just about every symbol known to man has 
been cataloged -- even Klingon was considered. From Dingbats to 
Architectural symbols, from simplified Chinese to traditional 
Chinese, from Greek to Cherokee, from skull/cross-bones to yin/yang 
symbol, every language in the world and glyph known to man has been 
included -- a truly massive project.


IMO, it will be a while before we use up all the range Unicode code 
points provides.


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] File Downloads

2010-05-28 Thread Marc Guay
 How can I go about restricting the number of downloads of a file on my
 server?

Something like this could be triggered every time and then you can do
whatever you want once it hits 150... maybe have it send you an email
notification or something...

http://www.stevedawson.com/article0007.php

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



Re: [PHP] File Downloads

2010-05-28 Thread Karl DeSaulniers

On May 28, 2010, at 3:54 PM, Marc Guay wrote:

How can I go about restricting the number of downloads of a file  
on my

server?


Something like this could be triggered every time and then you can do
whatever you want once it hits 150... maybe have it send you an email
notification or something...

http://www.stevedawson.com/article0007.php

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




Very interesting link.
Thank you for sharing.
Not sure how this could be tied into what I'm trying for.
Would I add this to the function that did the downloading of the file?

Best,


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] Select Values Didn't Get Passed in From Two Different Forms

2010-05-28 Thread tedd

On Fri, 2010-05-28 at 15:12 -0400, Alice Wei wrote:
  What I am trying to find out is, when I have my form with a 
dependent select menu, how can I pass the value of the select menu 
to another page? I have mentioned in the initial email that if I 
just allow users to type stuff, it passes the form back to itself 
and works. However, what I want
 to do is to allow users click one radio button/checkbox, and use 
that value to determine which select menu to bring up. However, 
the information I am only interested in storing, is the value of the 
select menu and not the radio  button/checkbox.


Am I making sense here?


and

Maybe that is why I cannot pass the information on in the hidden 
value, but what have I missed here? Ajax? PHP? I am getting 
confused.


Alice


Alice:

That's the reason why I am taking this in steps instead of hitting 
you with all the buzz-words you were throwing around when we started.


If you don't know how to pass variables from one page to another, 
then why require ajax? That only complicates the process. There are 
several methods to pass variables from one page to another. You could 
have everything contained in a single page, but let's just solve your 
problem.


To pass things from one page to another has been demonstrated to you 
in the examples I provided, namely:


http://webbytedd.com//alice

and

http://webbytedd.com//alice1

Those forms are passing data as the user clicks submit.

Now, you want the user to pick a value and then pass that value to a 
different page to bring up a different select control, right?


Please review this:

http://www.webbytedd.com//alice2/index.php

That does everything you ask and it does it simply without ajax. From 
these examples you should be able to create just about anything you 
want.


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] File Downloads

2010-05-28 Thread tedd

At 3:39 PM -0500 5/28/10, Karl DeSaulniers wrote:

Hello,
How can I go about restricting the number of downloads of a file on my server?
For Eg: if I want a music track to only be able to be downloaded by 
150 people and thats it.. ever,

how can I go about doing this?

Much obliged,

Karl DeSaulniers


Karl:

Just have the download pass through a script that counts, such as found here:

http://sperling.com/freeware.php

When someone click the link, it activates a script that provides the 
download and saves a count. It would be trivial to stop the download 
at a specific number.


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] File Downloads

2010-05-28 Thread Karl DeSaulniers


On May 28, 2010, at 4:25 PM, tedd wrote:


At 3:39 PM -0500 5/28/10, Karl DeSaulniers wrote:

Hello,
How can I go about restricting the number of downloads of a file  
on my server?
For Eg: if I want a music track to only be able to be downloaded  
by 150 people and thats it.. ever,

how can I go about doing this?

Much obliged,

Karl DeSaulniers


Karl:

Just have the download pass through a script that counts, such as  
found here:


http://sperling.com/freeware.php

When someone click the link, it activates a script that provides  
the download and saves a count. It would be trivial to stop the  
download at a specific number.


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



Hey thanks Tedd.
Quick question. Were you referring me to this link to download one of  
their demos or just to show that they count their downloads?

EG:  Binary-Tree v1.1 Downloads:  2806

THX

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] Select Values Didn't Get Passed in From Two Different Forms

2010-05-28 Thread Alice Wei


 Date: Fri, 28 May 2010 17:18:21 -0400
 To: aj...@alumni.iu.edu
 From: tedd.sperl...@gmail.com
 Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different  
 Forms
 CC: php-general@lists.php.net
 
 On Fri, 2010-05-28 at 15:12 -0400, Alice Wei wrote:
What I am trying to find out is, when I have my form with a 
 dependent select menu, how can I pass the value of the select menu 
 to another page? I have mentioned in the initial email that if I 
 just allow users to type stuff, it passes the form back to itself 
 and works. However, what I want
   to do is to allow users click one radio button/checkbox, and use 
 that value to determine which select menu to bring up. However, 
 the information I am only interested in storing, is the value of the 
 select menu and not the radio  button/checkbox.
 
 Am I making sense here?
 
 and
 
 Maybe that is why I cannot pass the information on in the hidden 
 value, but what have I missed here? Ajax? PHP? I am getting 
 confused.
 
 Alice
 
 Alice:
 
 That's the reason why I am taking this in steps instead of hitting 
 you with all the buzz-words you were throwing around when we started.
 
 If you don't know how to pass variables from one page to another, 
 then why require ajax? That only complicates the process. There are 
 several methods to pass variables from one page to another. You could 
 have everything contained in a single page, but let's just solve your 
 problem.
 
 To pass things from one page to another has been demonstrated to you 
 in the examples I provided, namely:
 
 http://webbytedd.com//alice
 
 and
 
 http://webbytedd.com//alice1/ 
 
 Those forms are passing data as the user clicks submit.
 
 Now, you want the user to pick a value and then pass that value to a 
 different page to bring up a different select control, right?
 
 Please review this:
 
 http://www.webbytedd.com//alice2/index.php
 
 That does everything you ask and it does it simply without ajax. From 
 these examples you should be able to create just about anything you 
 want.
 
 Cheers,
 
 tedd
 
Anything I want? 

Seriously, I do know how to pass a non-dynamic element from one page to 
another page, but when I started researching on how to utilize dynamic menus 
based on user input, I found Ajax, until this problem that I am running into 
hits me. 

Is there some way that I could generate dynamic select menus without 
using Ajax? Or, is that asking too much?

Thanks for your help.

Alice


 -- 
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com
  
_
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3

Re: [PHP] File Downloads

2010-05-28 Thread Karl DeSaulniers
The users will have gone through a registration and login to get to  
the downloads.

The files will be served from MySQL and output to HTML of Flash.
This is for a small project of limited edition audio or pictures or  
scripts, etc.
Hens, I'd like to limit each user in the allotted 150 to be able to  
download (whatever it is) only once.

But up to 150 users can get in on it kind of thing.

Karl


On May 28, 2010, at 4:41 PM, Karl DeSaulniers wrote:



On May 28, 2010, at 4:25 PM, tedd wrote:


At 3:39 PM -0500 5/28/10, Karl DeSaulniers wrote:

Hello,
How can I go about restricting the number of downloads of a file  
on my server?
For Eg: if I want a music track to only be able to be downloaded  
by 150 people and thats it.. ever,

how can I go about doing this?

Much obliged,

Karl DeSaulniers


Karl:

Just have the download pass through a script that counts, such as  
found here:


http://sperling.com/freeware.php

When someone click the link, it activates a script that provides  
the download and saves a count. It would be trivial to stop the  
download at a specific number.


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



Hey thanks Tedd.
Quick question. Were you referring me to this link to download one  
of their demos or just to show that they count their downloads?

EG:  Binary-Tree v1.1 Downloads:  2806

THX

Karl DeSaulniers
Design Drumm
http://designdrumm.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] Select Values Didn't Get Passed in From Two Different Forms

2010-05-28 Thread Alice Wei


From: aj...@alumni.iu.edu
To: tedd.sperl...@gmail.com
CC: php-general@lists.php.net
Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different  Forms
Date: Fri, 28 May 2010 19:31:10 -0400









 Date: Fri, 28 May 2010 17:18:21 -0400
 To: aj...@alumni.iu.edu
 From: tedd.sperl...@gmail.com
 Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different  
 Forms
 CC: php-general@lists.php.net
 
 On Fri, 2010-05-28 at 15:12 -0400, Alice Wei wrote:
What I am trying to find out is, when I have my form with a 
 dependent select menu, how can I pass the value of the select menu 
 to another page? I have mentioned in the initial email that if I 
 just allow users to type stuff, it passes the form back to itself 
 and works. However, what I want
   to do is to allow users click one radio button/checkbox, and use 
 that value to determine which select menu to bring up. However, 
 the information I am only interested in storing, is the value of the 
 select menu and not the radio  button/checkbox.
 
 Am I making sense here?
 
 and
 
 Maybe that is why I cannot pass the information on in the hidden 
 value, but what have I missed here? Ajax? PHP? I am getting 
 confused.
 
 Alice
 
 Alice:
 
 That's the reason why I am taking this in steps instead of hitting 
 you with all the buzz-words you were throwing around when we started.
 
 If you don't know how to pass variables from one page to another, 
 then why require ajax? That only complicates the process. There are 
 several methods to pass variables from one page to another. You could 
 have everything contained in a single page, but let's just solve your 
 problem.
 
 To pass things from one page to another has been demonstrated to you 
 in the examples I provided, namely:
 
 http://webbytedd.com//alice
 
 and
 
 http://webbytedd.com//alice1/ 
 
 Those forms are passing data as the user clicks submit.
 
 Now, you want the user to pick a value and then pass that value to a 
 different page to bring up a different select control, right?
 
 Please review this:
 
 http://www.webbytedd.com//alice2/index.php
 
 That does everything you ask and it does it simply without ajax. From 
 these examples you should be able to create just about anything you 
 want.
 
 Cheers,
 
 tedd
 
Anything I want? 

On a second note, after looking at your example again, is it possible to 
generate what is on form 4 without having to push submit button on form 3? Or, 
is that another topic in Javascript or something else?

Alice


 -- 
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com
  
The New Busy is not the old busy. Search, chat and e-mail from your inbox. Get 
started.   
_
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

[PHP] authentication issue...

2010-05-28 Thread Jason Pruim

Hey Everyone,

So I'm sitting here on a friday night trying to figure out how in the  
world I'm going to fix an issue that should probably be simple to me  
but is escaping me at the moment


Take this authentication function:

?PHP

 function authentication($authUser, $authPass, $cfgtableAuth){

// Keep in mind, PASSWORD has meaning in MySQL
// Do your string sanitizing here
// (e.g. - $user = mysql_real_escape_string($_POST['user']);)
$authUser = mysql_real_escape_string($_POST['txtUser']);
$authPass = mysql_real_escape_string($_POST['txtPass']);
$md5pass = md5($authPass);

$loginQuery = SELECT * FROM {$cfgtableAuth} WHERE  
userLogin='.$authUser.' AND userPass='.$md5pass.' LIMIT 0,1;;


$loginResult = mysql_query($loginQuery) or die(Wrong  
data supplied or database error  .mysql_error());

$row1 = mysql_fetch_assoc($loginResult);
if($row1['access'] == 500){
foreach (array_keys($_SESSION) as $key)
unset($_SESSION[$key]);

die('account disabled');
}

if(is_array($row1)){

$_SESSION['userInfo'] = array( userLogin =  
$row1['userName'], loggedin = TRUE, userName =  
$row1['userName'], userPermission = $row1['userPermission']);


error_log(User has logged in: .  
$row1['userLogin']);


}else{
//$_SESSION['userInfo'] =array(loggedin = FALSE);
die('authentication failed');

}
return TRUE;

}

?

Here is how I am displaying the login form:

?PHP
session_start();

$link = dbconnect($server, $username, $password, $database);

$page = $_GET['page'];

echo CSS
body
div class=contentwrapper

CSS;
include(nav.php);

if ($_SESSION['userInfo']['loggedin'] == TRUE) {

MAIN PAGE DISPLAY HERE

}else{

//Display login info
echo FORM
div class=dark
form method=post
p
You must login to proceed!BR /
User Name: input type=text size=20 name=txtUserBR 
/
Password: input type=password size=20 
name=txtPassBR /
input type=submit value=LoginBR /
/p
/form
/div
FORM;

if(isset($_POST['txtUser'])) {
$authUser = $_POST['txtUser'];
$authPass = $_POST['txtPass'];
$auth = authentication($authUser, $authPass, $cfgtableAuth);

}

}

?

Now... the authentication actually works, and it logs me in properly,  
but I have to click the login button twice Ideally I should just  
do it once, so I'm wondering if anyone can spot my grievous misstep  
here?


Thanks in advance for the help and pointers I am bound to receive from  
this list! :)






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



Re: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-28 Thread Adam Richardson
On Fri, May 28, 2010 at 8:01 PM, Alice Wei aj...@alumni.iu.edu wrote:



 From: aj...@alumni.iu.edu
 To: tedd.sperl...@gmail.com
 CC: php-general@lists.php.net
 Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different
  Forms
 Date: Fri, 28 May 2010 19:31:10 -0400









  Date: Fri, 28 May 2010 17:18:21 -0400
  To: aj...@alumni.iu.edu
  From: tedd.sperl...@gmail.com
  Subject: RE: [PHP] Select Values Didn't Get Passed in From Two Different
  Forms
  CC: php-general@lists.php.net
 
  On Fri, 2010-05-28 at 15:12 -0400, Alice Wei wrote:
 What I am trying to find out is, when I have my form with a
  dependent select menu, how can I pass the value of the select menu
  to another page? I have mentioned in the initial email that if I
  just allow users to type stuff, it passes the form back to itself
  and works. However, what I want
to do is to allow users click one radio button/checkbox, and use
  that value to determine which select menu to bring up. However,
  the information I am only interested in storing, is the value of the
  select menu and not the radio  button/checkbox.
  
  Am I making sense here?
 
  and
 
  Maybe that is why I cannot pass the information on in the hidden
  value, but what have I missed here? Ajax? PHP? I am getting
  confused.
  
  Alice
 
  Alice:
 
  That's the reason why I am taking this in steps instead of hitting
  you with all the buzz-words you were throwing around when we started.
 
  If you don't know how to pass variables from one page to another,
  then why require ajax? That only complicates the process. There are
  several methods to pass variables from one page to another. You could
  have everything contained in a single page, but let's just solve your
  problem.
 
  To pass things from one page to another has been demonstrated to you
  in the examples I provided, namely:
 
  http://webbytedd.com//alice
 
  and
 
  http://webbytedd.com//alice1/
 
  Those forms are passing data as the user clicks submit.
 
  Now, you want the user to pick a value and then pass that value to a
  different page to bring up a different select control, right?
 
  Please review this:
 
  http://www.webbytedd.com//alice2/index.php
 
  That does everything you ask and it does it simply without ajax. From
  these examples you should be able to create just about anything you
  want.
 
  Cheers,
 
  tedd
 
 Anything I want?

 On a second note, after looking at your example again, is it possible to
 generate what is on form 4 without having to push submit button on form 3?
 Or, is that another topic in Javascript or something else?

 Alice


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

 The New Busy is not the old busy. Search, chat and e-mail from your inbox.
 Get started.
 _
 Hotmail is redefining busy with tools for the New Busy. Get more from your
 inbox.

 http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2


Alice,

I'm not really sure what you're looking for, but this page has examples of
forms that are dynamically generated using AJAX.  Perhaps sifting through
the code (and using tools like the Web Developer plugin) will give you some
ideas:
http://nephtaliproject.com/nedit/

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] authentication issue...

2010-05-28 Thread Nathan Nobbe
On Fri, May 28, 2010 at 7:43 PM, Jason Pruim li...@pruimphotography.comwrote:

 Hey Everyone,

 So I'm sitting here on a friday night trying to figure out how in the world
 I'm going to fix an issue that should probably be simple to me but is
 escaping me at the moment

 Take this authentication function:

 ?PHP

  function authentication($authUser, $authPass, $cfgtableAuth){

// Keep in mind, PASSWORD has meaning in MySQL
// Do your string sanitizing here
// (e.g. - $user = mysql_real_escape_string($_POST['user']);)
$authUser = mysql_real_escape_string($_POST['txtUser']);
$authPass = mysql_real_escape_string($_POST['txtPass']);
$md5pass = md5($authPass);

$loginQuery = SELECT * FROM {$cfgtableAuth} WHERE
 userLogin='.$authUser.' AND userPass='.$md5pass.' LIMIT 0,1;;

$loginResult = mysql_query($loginQuery) or die(Wrong data
 supplied or database error  .mysql_error());
$row1 = mysql_fetch_assoc($loginResult);
if($row1['access'] == 500){
foreach (array_keys($_SESSION) as $key)
unset($_SESSION[$key]);

die('account disabled');
}

if(is_array($row1)){

$_SESSION['userInfo'] = array( userLogin =
 $row1['userName'], loggedin = TRUE, userName = $row1['userName'],
 userPermission = $row1['userPermission']);

error_log(User has logged in: . $row1['userLogin']);

}else{
//$_SESSION['userInfo'] =array(loggedin = FALSE);
die('authentication failed');

}
return TRUE;

}

 ?

 Here is how I am displaying the login form:

 ?PHP
 session_start();

 $link = dbconnect($server, $username, $password, $database);

 $page = $_GET['page'];

 echo CSS
body
div class=contentwrapper

 CSS;
 include(nav.php);

 if ($_SESSION['userInfo']['loggedin'] == TRUE) {

 MAIN PAGE DISPLAY HERE

 }else{

//Display login info
 echo FORM
div class=dark
form method=post
p
You must login to proceed!BR /
User Name: input type=text size=20
 name=txtUserBR /
Password: input type=password size=20
 name=txtPassBR /
input type=submit value=LoginBR /
/p
/form
 /div
 FORM;

 if(isset($_POST['txtUser'])) {
 $authUser = $_POST['txtUser'];
 $authPass = $_POST['txtPass'];
 $auth = authentication($authUser, $authPass, $cfgtableAuth);

 }

 }

 ?

 Now... the authentication actually works, and it logs me in properly, but I
 have to click the login button twice Ideally I should just do it once,
 so I'm wondering if anyone can spot my grievous misstep here?


it looks to me like you need to move the authentication() call

if(isset($_POST['txtUser'])) {
$authUser = $_POST['txtUser'];
$authPass = $_POST['txtPass'];
$auth = authentication($authUser, $authPass, $cfgtableAuth);
}

above the check to see if the user has logged in, right after the

include(nav.php);

line.  right now, when the user submits the form, your code is first finding
that the user isnt logged in, spitting out the 'please log in' portion of
the html then logging them in, so youre actually already logged in when the
form shows itself the second time!

-nathan


Re: [PHP] Convert UTF-8 to PHP defines

2010-05-28 Thread Nisse Engström
On Fri, 28 May 2010 16:52:09 -0400, tedd wrote:

 At 8:52 PM +0200 5/28/10, Nisse =?utf-8?Q?Engstr=C3=B6m?= wrote:
On Fri, 28 May 2010 11:13:35 -0400, tedd wrote:

   As is my understanding, UTF-8 will accommodate all the languages
  (glyphs) of the world and then some. It will be a while before we
  need UTF-16 or UTF-32 but those are just a larger super-sets.

Again:

The theoretical limits are:

   UTF-8   [0 - 7fff]
   UTF-16  [0 -   10]
   UTF-32  [0 - ]

In what way are UTF-16 and -32 super-sets of UTF-8?

Also, there are many, many, *many* more glyphs than
characters (code point) in the world. As an example,
www.fonts.com lists 165,125 fonts. Every one has a
*different* glyph for the characer A...

 As you say, UTF-8 has a range of 0 to 7FFF

No, I said that's the theoretical range. It is restricted
to [0-10] according to current specifications.

 If you spend some time looking at the numerous char sets that Unicode 
 offers you will see that just about every symbol known to man has 
 been cataloged

Yes. (Except those that are missing).

 every language in the world and glyph known to man has been 
 included -- a truly massive project.

No. There are no glyphs in Unicode. This is spelled out for
you in chapter 2, figure 2-2. Characters versus Glyphs.


/Nisse

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