-
MY PROJECTS
-
Recent Posts
- SpringBoot.Making our first starter and autoconfiguration
- Spring. Creating main annotation to start business logic
- Spring.Reading from properties file
- Spring.How to define spring version inside springBoot ?
- SpringBoot App inside Docker
- Kafka.FirstExperience
- Docker.MySql and Lost connection to MySQL server at ‘reading initial communication packet’, system error: 0
- Gradle.Tips
- Spring.AppConfig
- Leetcode.Best-time-to-buy-and-sell-stock
- LeetCode.ClimbStairs.Fibbonacci
- Leetcode.Roman-to-integer
- LeetCode.Palindrome-number
- Java.DesignPatterns.Lightweight
- Java.DesignPatterns.Proxy
- Java.DesignPatterns.Facade
- Java.DesignPatterns.Composite
- Java.DesignPatterns.Bridge
- Java. Strange OOP thing
- Java.Classpath
Categories
- Aptana
- Azure
- C#
- DataSnap
- DBExpress
- Delphi
- Delphi и сети
- Delphi. Язык программирования
- ExtJS
- FastReport
- FireDAC
- FireMonkey
- GIT
- ICS
- IDE
- IIS
- Indy
- InnoSetup
- javascript
- jQuery
- JSON
- LiveBindings
- MSHTML
- MySQL
- PHP
- REST
- Ribbons
- SMS
- SQL инструкции
- SVN
- TRichView
- UniGui
- WebBroker
- WinAPI
- Windows
- Алгоритмы
- Без рубрики
- Деревья
- Ищу ответ
- Компонентостроение
- Мои компоненты
- Начальный уровень
- Обработка исключений
- Парсинг
- Потоки(Threads)
- Регулярные выражения
- Тестирование приложений
Daily Archives: 20.10.2016
PHP. Самый простой способ поставить пароль на страницу
И понадобилось мне запаролить php страницу, причем сделать это за 5 мин… В сети полно способов запаролить страницу, вот один из них. Не самый надежный, без капчи, но всё же !!!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
<?php // Вывод заголовка с данными о кодировке страницы header('Content-Type: text/html; charset=windows-1251'); session_start(); if(!empty($_POST['paswd'])){ $pass = "somePasswordHere"; // password here if($_POST['paswd']==$pass){ $_SESSION['access']=true; header("Location: index2.php") ;// Redirecting if correct password } else { header("Location: error.php") ;//Redirecting if not correct password } } else if( empty($_POST['paswd']) ) { ?> <!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> <meta http-equiv="Content-Language" content="en-us; charset=windows-1251" /> <meta http-equiv="Content-Type" content="text/html;"> <title>Enter Password</title> <style type="text/css"> a { color: #FFFF00; } </style> </head> <body style="color: #FF0000; background-image: url('http://www..../.../....jpg')"> <br><br><br><br><br><br><br><br> <h3 align="center">Please Enter Password</h3> <h2 align="center">(Some hint here...)</h2> <table width="100%"> <tr> <td> <!-- В action ничего не пишем, форма должна передавать данные на эту же страницу --> <form action="" method="POST" align="center"> <input type="text" name="paswd"> <input type="submit" value="Отправить"> </form> <?php } ?> |
Конечно, такая конструкция не устоит перед брут-форсом, но … Continue reading
Posted in PHP
Comments Off on PHP. Самый простой способ поставить пароль на страницу