Reply to Re: Maths in HTML

Your name:

Reply:


Posted by cwdjrxyz on 01/04/07 17:21

Toby Inkster wrote:
> Geoff wrote:
>
> > Can this be done in HTML alone
>
> No -- you will need some form of scripting. There are basically two
> options:
>
> - Client side (using Javascript)
> - Server side (big choice of scripting languages)
>
> Client side is very easy, but not completely reliable, as not everyone
> uses Javascript-enabled browsers. Here's a quick example:
>
> <input name="string" id="stringid">
> <input type="button" id="buttonid">
> <script type="text/javascript">
> function checkit ()
> {
> var it = document.getElementById('stringid');
> window.alert(it.value.length()==15 ? 'You win!' : 'You lose!');
> }
> document.getElementById('buttonid').onclick = checkit;
> </script>
>
> With server-side scripting, you'll need to find out which languages your
> server supports. Many servers support PHP, so here's a PHP example:
>
> <form action="<?=$_SERVER['PHP_SELF']?>" method="get">
> <input name="string">
> <input type="submit">
> </form>
> <?= (strlen($_GET['string'])==15 ? 'You win!' : 'You lose!'); ?>
>
> > Secondly, I want the number that has been entered, to be added to a list
> > on a hidden page.
>
> This will certainly require server-side scripting. Client-side would not
> be capable of this.

I would just add that you must be very careful with server side
scripting, or you site can get hacked. People will enter just about
anything into forms including hacker scripts. Limiting the number of
characters the form will accept will help. Also not allowing certain
tags such as the script tag also will help. This often is done with
regular expressions. Don't even think of writing your own cgi script
unless you are very well experienced with this. Hackers have many
tricks to exploit such scripts that are not written exactly right. I
know of a case a few years ago when the"boys from Brazil" hacked the
server of a small host that catered to people with set top boxes.
Nearly all of the home pages of users were defaced. Then finally the
hack caused the server to crash and lose much data. The server had not
been kept properly backed up on another device, so many people lost all
of their pages. And the server was Unix - Apache, not Microsoft. The
"boys from Brazil" were experts at hacking this type of server.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация