Guest User

Untitled

a guest
Jul 4th, 2012
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?
  2. class Lognout {
  3.  
  4. function formularZobrazit() {
  5. echo' <form name="form1" method="post" action="">
  6. <td
  7. <td colspan="3">Login Game char </td> <br> <br>
  8. <tr>
  9. <td colspan="3">Lognout</td> <br>
  10. </tr>
  11. <tr>
  12. <td width="294"><input name="login" type="text" size="10" id="login"><br></td>
  13. </tr>
  14. <tr>
  15. <td>Password</td> <br>
  16. <td></td>
  17. <td><input name="heslo" type="password" size="10" id="heslo"></td>
  18. </tr>
  19. <tr>
  20. <td>&nbsp;</td>
  21. <td>&nbsp;</td> <br>
  22. <td><input type="submit" name="Submit" value="Lognout"></td>
  23. </tr>
  24. </td>
  25. </form>';
  26. }
  27.  
  28.  
  29.  
  30.  
  31. ///////////////function overeniHesla()////////////////////
  32. function overeniHesla() {
  33. $this->login = $_POST['login'];
  34. //$this->login;
  35. $this->heslo = $_POST['heslo'];
  36. //$this->heslo;
  37. if (!empty($this->login)){
  38. $passcode = base64_encode(pack('H*', sha1($this->heslo)));
  39. $radku= dibi::query('SELECT count(*) FROM `accounts` WHERE `login` = %s', $this->login, 'and `password` = %s', $passcode )->fetchSingle(); //POZOR NA fetchSingle
  40.  
  41. // print "AAAAAAaaa";
  42. print "<br>hash heslo:";
  43. // print "$passcode";
  44.  
  45. if ($radku == 0) {
  46. // print "spatne" ;
  47. $this->hesloFalse();
  48. }
  49. else {
  50. // print "dobre" ;
  51. $this->hesloTrue();
  52.  
  53. }
  54. }}
  55. //////////////////////////////////////////////////
  56.  
  57.  
  58. ///////////////function test()////////////////////
  59. function test() {
  60.  
  61. // print " $this->heslo ";
  62. // print "---dasdasdasdas";
  63. }
  64. //////////////////////////////////////////////////
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ///////////////function hesloTrue()////////////////////
  71. function hesloTrue() {
  72. $_SESSION["login"]=$_POST['login'] ;
  73. $this->vyberPostavy();
  74. }
  75.  
  76. //////////////////////////////////////////////////
  77.  
  78. ///////////////function vyberPostavy)////////////////////
  79. function vyberPostavy() {
  80. echo '<form method="POST" >';
  81. echo '<input type="hidden" name="sector" value="sector_list">';
  82. echo '<select name="sector_list" class="inputstandard">';
  83. $result = dibi::query('SELECT * FROM `characters` WHERE `account_name` = %s', $_SESSION["login"]);
  84. foreach ($result as $n => $row) {
  85. echo '<option value="'.$row['char_name'].'">'.$row['char_name'].'</option>';
  86. }
  87. echo '</select>';
  88. echo '<br>';
  89. echo '<br>';
  90. echo '<input type="submit" value="next"> ';
  91. echo '</form>';
  92.  
  93. }
  94. //////////////////////////////////////////////////
  95.  
  96.  
  97.  
  98.  
  99. ///////////////function PostOnSession()////////////////////
  100. function PostOnSession() {
  101. if (empty($_POST['sector_list']) )
  102. {
  103. }
  104. else
  105. {
  106. //vklada postavu jako session
  107. $_SESSION["nick"]=$_POST['sector_list'] ;
  108. //k - vkladani
  109.  
  110. $this->PresmerovaniScript();
  111. }
  112. //////////////////////////////////////////////////
  113.  
  114. ///////////////function PresmerovaniScript()////////////////////
  115. function PresmerovaniScript() {
  116. echo ' lllllllll
  117. <script>
  118. window.location.href="index.php";
  119. </script> ';
  120. }
  121. //////////////////////////////////////////////////
  122.  
  123.  
  124.  
  125. ///////////////function hesloFalse)////////////////////
  126. function hesloFalse() {
  127. print "Error heslo " ;
  128. }
  129. //////////////////////////////////////////////////
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138. function zobrazPolozku($hoj) {
  139. $this->hoja = $hoj;
  140. print $this->hoja;
  141.  
  142. }
  143.  
  144. }
  145.  
  146. $login = new Lognout();
  147. $login->formularZobrazit();
  148. $login->overeniHesla();
  149. //$login->test();
  150. $login->PostOnSession();
  151. $login->zobrazPolozku('hojjghgfhfg');
Advertisement
Add Comment
Please, Sign In to add comment