Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- class Lognout {
- function formularZobrazit() {
- echo' <form name="form1" method="post" action="">
- <td
- <td colspan="3">Login Game char </td> <br> <br>
- <tr>
- <td colspan="3">Lognout</td> <br>
- </tr>
- <tr>
- <td width="294"><input name="login" type="text" size="10" id="login"><br></td>
- </tr>
- <tr>
- <td>Password</td> <br>
- <td></td>
- <td><input name="heslo" type="password" size="10" id="heslo"></td>
- </tr>
- <tr>
- <td> </td>
- <td> </td> <br>
- <td><input type="submit" name="Submit" value="Lognout"></td>
- </tr>
- </td>
- </form>';
- }
- ///////////////function overeniHesla()////////////////////
- function overeniHesla() {
- $this->login = $_POST['login'];
- //$this->login;
- $this->heslo = $_POST['heslo'];
- //$this->heslo;
- if (!empty($this->login)){
- $passcode = base64_encode(pack('H*', sha1($this->heslo)));
- $radku= dibi::query('SELECT count(*) FROM `accounts` WHERE `login` = %s', $this->login, 'and `password` = %s', $passcode )->fetchSingle(); //POZOR NA fetchSingle
- // print "AAAAAAaaa";
- print "<br>hash heslo:";
- // print "$passcode";
- if ($radku == 0) {
- // print "spatne" ;
- $this->hesloFalse();
- }
- else {
- // print "dobre" ;
- $this->hesloTrue();
- }
- }}
- //////////////////////////////////////////////////
- ///////////////function test()////////////////////
- function test() {
- // print " $this->heslo ";
- // print "---dasdasdasdas";
- }
- //////////////////////////////////////////////////
- ///////////////function hesloTrue()////////////////////
- function hesloTrue() {
- $_SESSION["login"]=$_POST['login'] ;
- $this->vyberPostavy();
- }
- //////////////////////////////////////////////////
- ///////////////function vyberPostavy)////////////////////
- function vyberPostavy() {
- echo '<form method="POST" >';
- echo '<input type="hidden" name="sector" value="sector_list">';
- echo '<select name="sector_list" class="inputstandard">';
- $result = dibi::query('SELECT * FROM `characters` WHERE `account_name` = %s', $_SESSION["login"]);
- foreach ($result as $n => $row) {
- echo '<option value="'.$row['char_name'].'">'.$row['char_name'].'</option>';
- }
- echo '</select>';
- echo '<br>';
- echo '<br>';
- echo '<input type="submit" value="next"> ';
- echo '</form>';
- }
- //////////////////////////////////////////////////
- ///////////////function PostOnSession()////////////////////
- function PostOnSession() {
- if (empty($_POST['sector_list']) )
- {
- }
- else
- {
- //vklada postavu jako session
- $_SESSION["nick"]=$_POST['sector_list'] ;
- //k - vkladani
- $this->PresmerovaniScript();
- }
- //////////////////////////////////////////////////
- ///////////////function PresmerovaniScript()////////////////////
- function PresmerovaniScript() {
- echo ' lllllllll
- <script>
- window.location.href="index.php";
- </script> ';
- }
- //////////////////////////////////////////////////
- ///////////////function hesloFalse)////////////////////
- function hesloFalse() {
- print "Error heslo " ;
- }
- //////////////////////////////////////////////////
- function zobrazPolozku($hoj) {
- $this->hoja = $hoj;
- print $this->hoja;
- }
- }
- $login = new Lognout();
- $login->formularZobrazit();
- $login->overeniHesla();
- //$login->test();
- $login->PostOnSession();
- $login->zobrazPolozku('hojjghgfhfg');
Advertisement
Add Comment
Please, Sign In to add comment