Professional Documents
Culture Documents
Лекция 7
Тема:
Валидация на Входни Данни
Пробив в сигурността (
security vulnerability)
Основни правила:
• Филтрирайте невалидни данни. Don't pass invalid data
onwards.
• Валидирайте данни при вход. Validate data at input time.
• Информирайте потребителя смислено. Always give the user
meaningful feedback
• Дайте указания какъв тип данни се очаква да постъпят като
вход. Tell the user what you expect to read as input
AlertBoxTest();
03/15/10 доц. д-р Стоян Бонев 84
A Confirm box
• A confirm box acts as alert box, except it displays both OK and
Cancel buttons to the user. The confirm box tells the program which
button the user chose, allowing two different outcomes. Example:
function ConfirmBoxTest()
{
if (confirm("Second message displayed in confirm box") == true)
{ document.write("OK pressed“) }
else
{ document.write( "Cancel pressed“) }
}
ConfirmBoxTest();
PromptBoxTest();