Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Różnice pomiędzy xamppem a internetowymi serwerami
Forum PHP.pl > Forum > Przedszkole
matii578
Witam. Mam pewien problem. Otóż pisałem stronę na XAMPPie i wszystko działało. Następnie chciałem ją umieścić na serwerze internetowym takim jak hostinger czy prv i w każdym przypadku było to samo. po zalogowaniu się nie ładowało mi plików.

Oto kod pliku index.php
  1. <!DOCTYPE html>
  2. <html lang="pl">
  3. <head>
  4. <title>Fiszki</title>
  5.  
  6. <meta http-equiv="content-type" content="text/html; charset=utf-8">
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8. <!-- Bootstrap -->
  9. <link href="res/css/bootstrap.css" rel="stylesheet">
  10. <link href="res/css/bootstrap-theme.css" rel="stylesheet">
  11. <link href="res/css/style.css" rel="stylesheet">
  12. <script type="text/javascript" src="res/js/bootstrap.min.js"></script>
  13. </head>
  14. <body>
  15. <a name="up"></a>
  16.  
  17.  
  18. <!-- *************************************************************************** -->
  19. <?php
  20.  
  21. include("init.php");
  22.  
  23.  
  24. if(isset($_GET['view'])){
  25. $view = $_GET['view'];
  26. if($_GET['view'] != 'v_index'){
  27. if(!checkLoginStatus()){
  28. header("Location: index.php");
  29. }
  30. }
  31. } else if(isset($_SESSION['id'])){
  32. $view = 'v_login';
  33. } else {
  34. $view = 'v_index';
  35. }
  36.  
  37. $action = isset($_GET['act'])?$_GET['act']:'index';
  38.  
  39. switch($action){
  40. case 'index':
  41. break;
  42.  
  43.  
  44. // -------------------------Podstawowe akcje------------------------------
  45.  
  46.  
  47. case 'register':
  48. if(checkUsername($_POST['login'], $_POST['email'])){
  49. if(checkRegisterData($_POST['login'], $_POST['email'], $_POST['password'], $_POST['password2'])){
  50. register($_POST['login'], $_POST['email'], $_POST['password']);
  51. }
  52. }
  53. break;
  54.  
  55. case 'login':
  56. if(login($_POST['login'], $_POST['password'])){
  57. header("Location: index.php?view=v_login");
  58. }
  59. break;
  60.  
  61. case 'logout':
  62. logout();
  63. break;
  64.  
  65. // -------------------------Zarządzanie fiszkami------------------------------
  66.  
  67. case 'addgroup':
  68. if(checkLoginStatus() && isSubmit()){
  69. addgroup($_POST['name'], $_POST['lang'], $_POST['share']);
  70. }
  71. break;
  72.  
  73. case 'delgroup':
  74. if(checkLoginStatus()){
  75. delgroup($_GET['id_gr']);
  76. }
  77. break;
  78.  
  79. case 'add':
  80. if(checkLoginStatus() && checkOwnership($_GET['id_gr'], $_SESSION['id']) && isSubmit()){
  81. add($_GET['id_gr'], $_POST['pl'], $_POST['lg'], $_POST['sub']);
  82. }
  83. break;
  84.  
  85. case 'del':
  86. if(checkLoginStatus() && checkOwnership($_GET['id_gr'], $_SESSION['id'])){
  87. del($_GET['id_fi']);
  88. }
  89. break;
  90.  
  91. case 'startgroup':
  92. if($log = checkLoginStatus() && !startedGroup($_GET['id_gr'])){
  93. startGroups($_GET['id_gr']);
  94. } else if($log) {
  95. $_SESSION['alert'][] = 'Już rozpocząłeś ten kurs';
  96. }
  97. break;
  98.  
  99. case 'learn':
  100.  
  101. break;
  102.  
  103. case 'share':
  104. if(checkLoginStatus() && checkOwnership($_GET['id_gr'], $_SESSION['id'])){
  105. share($_GET['id_gr']);
  106. }
  107. break;
  108.  
  109. case 'nshare':
  110. if(checkLoginStatus() && checkOwnership($_GET['id_gr'], $_SESSION['id'])){
  111. nshare($_GET['id_gr']);
  112. }
  113. break;
  114.  
  115. case 'sendmail':
  116. if($_POST['antyspam'] == 'iksleigna' && isSubmit()){
  117. $subject = $_POST['name'] . ' - ' . $_POST['email'];
  118. if(mail('matii578@o2.pl', $subject, $_POST['text'])) {
  119. $_SESSION['alert'][] = "Pomyślnie wysłano wiadomość.";
  120. } else {
  121. $_SESSION['alert'][] = "Niestety nie udało się wysłać wiadomości.";
  122. }
  123. } else {
  124. $_SESSION['alert'][] = "Błąd: Źle przepisany tekst antyspamowy";
  125. }
  126. break;
  127.  
  128. }
  129.  
  130.  
  131.  
  132. !isset($_SESSION['id'])?include("templates/t_h_index.php"):include("templates/t_h_login.php");
  133.  
  134. if (isset($_SESSION['alert'])) {
  135.  
  136. ?>
  137. <div class="container">
  138. <div class="row">
  139.  
  140. <div class="col-md-12">
  141. <div class="well">
  142. <fieldset>
  143.  
  144. <p style="text-align: center; font-weight: bold; color: #ff9900;">
  145. <?php showAlert($_SESSION['alert']); ?>
  146. </p>
  147.  
  148. </fieldset>
  149. </div>
  150. </div>
  151. </div>
  152. </div>
  153. <?php
  154.  
  155. unset($_SESSION['alert']);
  156.  
  157. }
  158.  
  159. include('views/' . $view . '.php');
  160.  
  161. ?>
  162. <!-- *************************************************************************** -->
  163.  
  164. </body>
  165. </html>


I jeszcze funkcja login
  1.  
  2. function login($login, $pass){
  3.  
  4. $db = db();
  5.  
  6. $query= $db->stmt_init(); //Musi to być aby zwróciło wynik biggrin.gif
  7. if($query = $db->prepare("SELECT id FROM uzytkownicy WHERE login = ? and haslo = ?")) {
  8. $password = sha1($pass);
  9. $query->bind_param("ss", $login, $password);
  10. $query->execute();
  11. $result = $query->get_result();
  12. $row = $result->fetch_assoc();
  13. if($row['id'])
  14. {
  15. $_SESSION['id'] = $row['id'];
  16. $_SESSION['login'] = $login;
  17. $query->close();
  18. return TRUE;
  19. } else {
  20. $_SESSION['alert'][] = 'Błędny login lub hasło';
  21. return FALSE;
  22. }
  23.  
  24.  
  25. } else {
  26. $_SESSION['alert'][] = 'Wystąpił błąd. Przepraszamy.';
  27. return FALSE;
  28. }
  29.  
  30.  
  31.  
  32. $db -> close();
  33.  
  34. }


Strona jest obecnie pod adresem fiszki.opx.pl
Login i hasło do użytkownika testowego to L: testowy3, H: 123456


Na XAMPPie wszystko działa jak należy.
peter13135
na początek, włącz raprotowanie błędów.
matii578
a jak to zrobić?
Turson
Temat: Jak poprawnie zadac pytanie
matii578
Ok. już jest raportowanie włączone.
Neproify
Masz jakiś błąd? facepalmxd.gif
matii578
tak.. wyskoczyło mi: Fatal error: Call to undefined method mysqli_stmt::get_result() in /home/hosting/prv-hosting/opx.pl/i/k/fiszki/functions/f_auth.php on line 96
Turson
Spróbuję pomoc https://www.google.pl/search?client=ubuntu&...BGcKg8weZz4CYAw
matii578
Tylko problem jest w tym że nie wiem jak to naprawić..
Turson
Chociaż poczytałeś w linku co podesłałem?
Tu jest odpowiedź http://stackoverflow.com/a/8343970
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.