Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \\\\\\\\\\\\\\\\\Formularz/////////////////////
- <!DOCTYPE html>
- <head lang="pl">
- <meta charset="windows-1250">
- </head>
- <body>
- <form action="cezar_kod.php" method="POST">
- Tekst: <input type=text name="tekst">
- <br><br>
- Podaj klucz: <input type=text name="klucz">
- <br><br>
- <input type=submit value="Szyfruj">
- </form>
- </body>
- </html>
- //////////////////KOD PHP\\\\\\\\\\\\
- <?php
- if (isset($_POST['tekst']))
- {
- $txt= $_POST['tekst'];
- }
- $alfabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- $kl=$_POST['klucz'];
- print_r($_POST);
- for ($i=0;$i<strlen($txt);$i++) {
- $szyfr .= $alfabet[(strpos($alfabet, $txt[$i])+$kl) % strlen($alfabet)];
- }
- echo $txt.'<br>';
- echo $kl.'<br>';
- echo $szyfr.'<br>';
- // wynik: DODPDNRWD
- ?>
Advertisement
Add Comment
Please, Sign In to add comment