Kody:
Strona główna
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <title>Main Panel</title> <link type="text/css" href="css/admin.css" rel="stylesheet" /> <link type="text/css" href="css/menu.css" rel="stylesheet" /> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/menu.js"></script> <script type="text/javascript"> $(function(){ $('ul.menu li a').click(function(){ $('li.current').removeClass(); $(this).parent().addClass('current'); $('#Content').load($(this).attr('hreflang')); }); $('ul.menu li div ul li a').click(function(){ $('li.current').removeClass(); $(this).parent().parent().parent().parent().addClass('current'); $('#Content').load($(this).attr('hreflang')); }); }); </script> </head> <body> <div id="menu"> <? if($_SESSION['priv'][0] == true){ echo' <li><a href="java script:;" hreflang="news.php?view=view" class="parent"><span>News</span></a> <div><ul> <li><a href="java script:;" hreflang="news.php?view=view"><span>Przeglądaj newsy</span></a></li> <li><a href="java script:;" hreflang="news.php?view=add"><span>Dodaj news</span></a></li> </ul></div> </li> '; } if($_SESSION['priv'][1] == true){ echo '<li><a href="java script:;" hreflang="count_privs.php"><span>Oblicz kod uprawnień</span></a></li>'; } echo '<li class="last"><a href="logout.php"><span><strong style="color: #FF0000">Wyloguj</strong></span></a></li>'; ?> </div> <div id="Content"> <span style="font-size: 50px">Content</span> </div> </body> </html>
Podstrona formularza
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Encrypter</title> </head> <body> <form name="encrypt" method="post" action="count_privs" enctype="multipart/form-data"> <fieldset> <p><label>To encrypt:</label><input type="text" class="text-long" name="txt"></p> <p><label>To decode:</label><input type="text" class="text-long" name="priv"></p> <p><label>Permissions:</label><br/> <input type="checkbox" name="w_sumie_nie_wiem_po_co_to" value="wartość" checked="checked" />Zaznacz<br/> <input type="checkbox" name="chkbx1" value="wartość" checked="checked" />Pierwszy<br/> <input type="checkbox" name="chkbx2" value="wartość" checked="checked" />Drugi<br/> <input type="checkbox" name="chkbx3" value="wartość" checked="checked" />Trzeci<br/> <input type="checkbox" name="chkbx4" value="wartość" checked="checked" />Czwarty<br/> <input type="checkbox" name="chkbx5" value="wartość" checked="checked" />Piąty<br/> <input type="checkbox" name="chkbx6" value="wartość" checked="checked" />Szósty<br/> <input type="checkbox" name="chkbx7" value="wartość" checked="checked" />Siódmy<br/> <input type="checkbox" name="chkbx8" value="wartość" checked="checked" />Ósmy<br/> <input type="checkbox" name="chkbx9" value="wartość" checked="checked" />Dziewiąty<br/> <input type="checkbox" name="chkbx10" value="wartość" checked="checked" />Dziesiąty<br/> <input type="checkbox" name="chkbx11" value="wartość" checked="checked" />Jedenasty<br/> <input type="checkbox" name="chkbx12" value="wartość" checked="checked" />Dwunasty<br/> <input type="checkbox" name="chkbx13" value="wartość" checked="checked" />Trzynasty<br/> <input type="checkbox" name="chkbx14" value="wartość" checked="checked" />Czternasty<br/> <input type="checkbox" name="chkbx15" value="wartość" checked="checked" />Piętnasty<br/> </p> <input type="submit" style="background:#b9bcbe;padding:2px 4px;color:#000;border:none" value="Encrypt"> </fieldset> </form> <? $sha = sha1($_POST['txt']); } $privs = 0; $i = 0; if($_POST['chkbx1'] == true) $privs += pow(2,$i); $i++; if($_POST['chkbx2'] == true) $privs += pow(2,$i); $i++; if($_POST['chkbx3'] == true) $privs += pow(2,$i); $i++; if($_POST['chkbx4'] == true) $privs += pow(2,$i); $i++; if($_POST['chkbx5'] == true) $privs += pow(2,$i); $i++; if($_POST['chkbx6'] == true) $privs += pow(2,$i); $i++; if($_POST['chkbx7'] == true) $privs += pow(2,$i); $i++; if($_POST['chkbx8'] == true) $privs += pow(2,$i); $i++; if($_POST['chkbx9'] == true) $privs += pow(2,$i); $i++; if($_POST['chkbx10'] == true) $privs += pow(2,$i); $i++; if($_POST['chkbx11'] == true) $privs += pow(2,$i); $i++; if($_POST['chkbx12'] == true) $privs += pow(2,$i); $i++; if($_POST['chkbx13'] == true) $privs += pow(2,$i); $i++; if($_POST['chkbx14'] == true) $privs += pow(2,$i); $i++; if($_POST['chkbx15'] == true) $privs += pow(2,$i); } ?> </body></html>