Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Problem z gwiazdkowym systemem oceniania., Jak sobie z tym poradzić
kamiluspl
post
Post #1





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 30.05.2012

Ostrzeżenie: (0%)
-----


Pobrałem stąd skrypt http://www.egrafik.pl/download/skrypty-php...ars-rating.html
Wgrałem wszystko jak należy.

W instrukcji napisane jest ,że po wgraniu mam umieścić to:<? require_once("rate.php"); ?> <? echo rate("5starsdemo");?>
w miescu które chcę ceniać.

Wszystko ok tylko mam mały problem, mam stronę z grami online i nie wiem w którym miejscu to dać aby każda gra miała swoją indywidualną ocenę a nie wszystkie takie samą. Jakoś trzeba to powiązać adresem ur lub id.

tak wygląda strona z grą;
  1. <?php
  2. require_once 'config.php';
  3. ?>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  8. <title><?php echo $title; ?></title>
  9. <link href="style.css" rel="stylesheet" type="text/css" />
  10. <meta name="keywords" content="<?php echo $keywords; ?>" />
  11. <meta name="description" content="<?php echo $description; ?>" />
  12. </head>
  13.  
  14. <body>
  15.  
  16. <?php
  17.  
  18. require_once 'class/gamesClass.php';
  19. $class = new games;
  20. $gamesList = $class -> getGames();
  21.  
  22. ?>
  23.  
  24. <?php
  25. require_once 'top.php';
  26. ?>
  27. <div id="body_area">
  28. <div class="left">
  29. <div class="morelinks_top"></div>
  30. <div class="morelinks_area">
  31. <div class="morelinks_head">Kategorie </div>
  32. <div class="links_morearea">
  33.  
  34. <?php
  35. $categories = $class -> getCategories();
  36.  
  37. foreach ($categories as $res) {
  38. echo "<a href=\"gamesList.php?id={$res['id']}\" class=\"morelink\">{$res['name']}</a>";
  39. }
  40. ?>
  41.  
  42. </div>
  43. </div>
  44. <div class="morelinks_bottom"></div>
  45. </div>
  46. <div class="body_area1">
  47. <div class="banner_bottom"></div>
  48. <div class="mid">
  49.  
  50. <div style="width:740px; height:auto; float:left; margin-bottom:10px;">
  51. <?php
  52. require_once 'reklamy/reklama3.php';
  53. ?>
  54. </div>
  55.  
  56. <?php
  57. (int) $id = intval($_GET['id']);
  58.  
  59. $game = $class -> getGame($id);
  60. foreach ($game as $res) {
  61.  
  62. $id = $res['id'];
  63. $name = $res['name'];
  64. $ime_url = $res['img_url'];
  65. $game_url = $res['game_url'];
  66. $ile_odwiedzin = $res['ile_odwiedzin'];
  67. $kategoria_id = $res['kategoria_id'];
  68. $xx = $res['xx'];
  69. $yy = $res['yy'];
  70. $description = $res['description'];
  71. }
  72.  
  73. $ile_odwiedzin++;
  74.  
  75. $class -> addOdwiedziny($id, $ile_odwiedzin);
  76. ?>
  77.  
  78. <iframe src="<?php echo $game_url ?>" frameborder="0" style="border:none;" width="<?php echo $xx; ?>" height="<?php echo $yy; ?>" scrolling="no"></iframe>
  79.  
  80. <br /><br />
  81. <?php echo $description; ?>
  82.  
  83. </div>
  84.  
  85. </div>
  86. </div>
  87. <?php
  88. require_once 'bottom.php';
  89. ?>
  90.  
  91. </body>
  92. </html>



W którym miejscu, jak to zrobić, aby działało tak jak wspomniałem. Osobna gra, osobna ocena a nie dam 4 gwiazdki pod jedną i potem pod każdą wyświetlają sie już 4.
Z góry dziękuję za pomoc.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 12)
IProSoft
post
Post #2





Grupa: Zarejestrowani
Postów: 479
Pomógł: 97
Dołączył: 6.09.2011
Skąd: php.net :)

Ostrzeżenie: (0%)
-----


Przed:
  1. <?php echo $description; ?>

daj
  1. <? require_once("rate.php"); ?> <? echo rate($id);?>


Ten post edytował IProSoft 30.05.2012, 11:29:01
Go to the top of the page
+Quote Post
kamiluspl
post
Post #3





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 30.05.2012

Ostrzeżenie: (0%)
-----


Tak zrobiłem i po ocenieniu gry jest przekierowanie i wyskakuje mi w explorerze nie dopuszczalny błąd .
www.pysznegry.pl
Go to the top of the page
+Quote Post
IProSoft
post
Post #4





Grupa: Zarejestrowani
Postów: 479
Pomógł: 97
Dołączył: 6.09.2011
Skąd: php.net :)

Ostrzeżenie: (0%)
-----


Skrypt nie działa na zasadzie ajax więc przekierowanie jest normalne.
http://www.pysznegry.pl/takerate.php?name=135
Nie ma pliku takerate.php
Go to the top of the page
+Quote Post
kamiluspl
post
Post #5





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 30.05.2012

Ostrzeżenie: (0%)
-----


Rozumiem, lecz niezwykle irytującą rzeczą jest to że plik takerate.php jest na serwerze.



Not Acceptable

An appropriate representation of the requested resource /takerate.php could not be found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Apache Server at pysznegry.pl Port 80

Ten post edytował kamiluspl 30.05.2012, 21:36:46
Go to the top of the page
+Quote Post
IProSoft
post
Post #6





Grupa: Zarejestrowani
Postów: 479
Pomógł: 97
Dołączył: 6.09.2011
Skąd: php.net :)

Ostrzeżenie: (0%)
-----


Zamień:

  1. if (isset($_SERVER['HTTP_REFERER']))
  2. header("Location: ".$_SERVER['HTTP_REFERER']);
  3. else header("Location: index.php");

na
  1. header("Location: index.php");

w pliku takerate.php bo może to powoduje błąd, choć mało prawdopodobne.
Go to the top of the page
+Quote Post
kamiluspl
post
Post #7





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 30.05.2012

Ostrzeżenie: (0%)
-----


nic to nie dało, pojęcia nie mam czemu nie wyszukuje takerate.php
W łaściwie wydaje mi się że po ocenieniu w pasku adresowym wracało do game.php
a teraz wyskakuje błąd a w pasku jest takeratephp i id gry




Dodam, że dzięki twojej pomocy, zrobiłem jak napisałeś i działało. Kiedy jednak zacząłem tłumaczyć wszystkie oceny, coś poszło nie tak. Od nowa przekkopiowałem wszystkie pliki i foldery z godnie instrukcją 5starrating jeszcze razk zmieniłem game.php a tu błąd.

Ten post edytował kamiluspl 30.05.2012, 22:33:01
Go to the top of the page
+Quote Post
IProSoft
post
Post #8





Grupa: Zarejestrowani
Postów: 479
Pomógł: 97
Dołączył: 6.09.2011
Skąd: php.net :)

Ostrzeżenie: (0%)
-----


Sprawdź czy nie zmieniłeś kodowania plików.
Go to the top of the page
+Quote Post
kamiluspl
post
Post #9





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 30.05.2012

Ostrzeżenie: (0%)
-----


takerate.php 644
tylko folderek mam votes w nim wegług instrukcji miałem zmienić kodowanie na 777
pozostałych plików miałem nie tykać więc nie tykam


Kurcze, było ok i nie wiem co się stało, spolszczania mi się zachciało. Jakoś źle przekierowuje bo w folderze votes zapisuję ocenę tutułuję $id ale jak wejdę spowrotem do game to wyniku nie wyświetli będzie no votes yet



PS na serwerze ma się znajdować plik error.log? Bo mam wrażenie, żę wcześniej go nie było ale nie jestem pewien

Ten post edytował kamiluspl 30.05.2012, 23:33:45
Go to the top of the page
+Quote Post
IProSoft
post
Post #10





Grupa: Zarejestrowani
Postów: 479
Pomógł: 97
Dołączył: 6.09.2011
Skąd: php.net :)

Ostrzeżenie: (0%)
-----


Kodowanie to co innego niż uprawnienia.
W czym edytujesz pliki?
Jeśli w notatniku to zmień na notepad++ i tam masz kodowanie, ustaw na UTF-8 bez BOM

error_log powstaje jeśli PHP zwraca jekieś błędy, wklej zawartość.
Go to the top of the page
+Quote Post
kamiluspl
post
Post #11





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 30.05.2012

Ostrzeżenie: (0%)
-----


  1. [19-Apr-2012 17:20:56] PHP Parse error: syntax error, unexpected T_STRING in /home/la157964/public_html/config.php on line 10
  2. [19-Apr-2012 17:21:03] PHP Parse error: syntax error, unexpected T_STRING in /home/la157964/public_html/config.php on line 10
  3. [19-Apr-2012 17:25:41] PHP Warning: Division by zero in /home/la157964/public_html/config.php on line 10
  4. [19-Apr-2012 17:25:45] PHP Warning: Division by zero in /home/la157964/public_html/config.php on line 10
  5. [19-Apr-2012 17:26:45] PHP Warning: Division by zero in /home/la157964/public_html/config.php on line 10
  6. [23-Apr-2012 19:15:42] PHP Warning: sqlite_query() [<a href='function.sqlite-query'>function.sqlite-query</a>]: near "0": syntax error in /home/la157964/public_html/class/gamesClass.php on line 22
  7. [06-May-2012 18:06:40] PHP Parse error: syntax error, unexpected '<' in /home/la157964/public_html/game.php on line 72
  8. [06-May-2012 18:06:47] PHP Parse error: syntax error, unexpected '<' in /home/la157964/public_html/game.php on line 72
  9. [16-May-2012 10:59:37] PHP Warning: sqlite_query() [<a href='function.sqlite-query'>function.sqlite-query</a>]: near "s": syntax error in /home/la157964/public_html/class/gamesClass.php on line 22
  10. [29-May-2012 18:29:04] PHP Parse error: syntax error, unexpected '=' in /home/la157964/public_html/game.php on line 62
  11. [29-May-2012 18:32:22] PHP Parse error: syntax error, unexpected '=' in /home/la157964/public_html/game.php on line 62
  12. [29-May-2012 22:58:51] PHP Warning: sqlite_array_query() [<a href='function.sqlite-array-query'>function.sqlite-array-query</a>]: near " ": syntax error in /home/la157964/public_html/class/gamesClass.php on line 66
  13. [29-May-2012 22:58:51] PHP Warning: Invalid argument supplied for foreach() in /home/la157964/public_html/gamesList.php on line 55
  14. [30-May-2012 23:33:28] PHP Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/la157964/public_html/game.php on line 84
  15. [30-May-2012 23:33:34] PHP Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/la157964/public_html/game.php on line 84
  16. [31-May-2012 07:44:09] PHP Parse error: syntax error, unexpected T_STRING in /home/la157964/public_html/takerate.php on line 10



Zadziwiające dal mnie jest to że nawet jak wywalam wszystko i sadzam jesze raz i to w dodadtku błędnie tak jak kiedyś i ni nadal błąd po próbie wystawienia oceny.

Ten post edytował kamiluspl 31.05.2012, 10:12:36
Go to the top of the page
+Quote Post
IProSoft
post
Post #12





Grupa: Zarejestrowani
Postów: 479
Pomógł: 97
Dołączył: 6.09.2011
Skąd: php.net :)

Ostrzeżenie: (0%)
-----


Pokaż linie:
game.php - 84
takerate.php - 10
Go to the top of the page
+Quote Post
kamiluspl
post
Post #13





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 30.05.2012

Ostrzeżenie: (0%)
-----


  1. <? require_once("rate.php"); ?> <? echo rate($id);?>
84
  1. else header("Location: index.php");
10


Zwróć uwagę na jakim przekierowaniu się zatrzymuję a wcześniej jestem pewien odświerzało się i wracało spowrotem do game.php

Na dodatek oszaleć można, teraz ten sam błąd wyskakuje mi gdy chcę wejść na konto administratora adres/login.php wpisuje hasło i login i błąd. Cały skrypt się posypał ?!

Ten post edytował kamiluspl 31.05.2012, 16:11:41
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 20:40