Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Cannot redeclare rank_adv()
gegos
post
Post #1





Grupa: Zarejestrowani
Postów: 13
Pomógł: 0
Dołączył: 11.11.2012

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


Witam, mam następujący problem
Fatal error: Cannot redeclare rank_adv() in settings.php on line 38
Kod którego to dotyczy:
  1. function rank_adv() {
  2. $total_points = mysql_result(mysql_query("SELECT total FROM points WHERE id = '$id'") ,0);
  3. $rank = mysql_result(mysql_query("SELECT level FROM users WHERE login = '$nick'"), 0);
  4. if(isset($nick)) {
  5. if ($total_points >= 800 and $total_points < 2400 and $rank == "Bronze") {
  6. $rankup = '<li><a href="rank.php"><u><b>Click here to get Silver rank</b></u></a></li><br />';
  7. }
  8. if ($total_points >= 2400 and $total_points < 7200 and ($rank == "Silver" or $rank == "Bronze")) {
  9. $rankup = '<li><a href="rank.php"><u><b>Click here to get Gold rank</u></b></a></li><br />';
  10. }
  11. if ($total_points >= 7200 and $total_points < 21600 and ($rank == "Silver" or $rank == "Bronze" or $rank == "Gold")) {
  12. $rankup = '<li><a href="rank.php"><u><b>Click here to get Diamond rank</u></b></a></li><br />';
  13. }
  14. if ($total_points >= 21600 and $total_points < 43200 and ($rank == "Silver" or $rank == "Bronze" or $rank == "Gold" or $rank == "Diamond")) {
  15. $rankup = '<li><a href="rank.php"><u><b>Click here to get Emerald rank</u></b></a></li><br />';
  16. }
  17. if ($total_points >= 43200 and $total_points < 86400 and ($rank == "Silver" or $rank == "Bronze" or $rank == "Gold" or $rank == "Diamond" or $rank == "Emerald")) {
  18. $rankup = '<li><a href="rank.php"><u><b>Click here to get Platinum rank</u></b></a></li><br />';
  19. }
  20. if ($total_points >= 86400 and $total_points < 129600 and ($rank == "Silver" or $rank == "Bronze" or $rank == "Gold" or $rank == "Diamond" or $rank == "Emerald" or $rank == "Platinum")) {
  21. $rankup = '<li><a href="rank.php"><u><b>Click here to get Extra Diamond rank</u></b></a></li><br />';
  22. }
  23. if ($total_points >= 129600 and $total_points < 194400 and ($rank == "Silver" or $rank == "Bronze" or $rank == "Gold" or $rank == "Diamond" or $rank == "Emerald" or $rank == "Platinum" or $rank == "Extra Diamond")) {
  24. $rankup = '<li><a href="rank.php"><u><b>Click here to get Extra Emerald rank</u></b></a></li><br />';
  25. }
  26. if ($total_points >= 194400 and ($rank == "Silver" or $rank == "Bronze" or $rank == "Gold" or $rank == "Diamond" or $rank == "Emerald" or $rank == "Platinum" or $rank == "Extra Diamond" or $rank == "Extra Emerald")) {
  27. $rankup = '<li><a href="rank.php"><u><b>Click here to get Extra Platinum rank</u></b></a></li><br />';
  28. }
  29. }
  30. echo $rankup;
  31. }

Problem jest jeszcze dziwniejszy, ponieważ błąd ten wyskakuje losowo, tzn raz odświeżę stronę i działa a raz (rzadko) przy odświeżeniu wyskakuje błąd.
Można powiedzieć, że dopiero zaczynam swoją przygodę w PHP. Szukałem już odpowiedzi na moje pytanie jednakże nie includuję kilkukrotnie tej funkcji (gdy dam include_once błąd wyskakuje nadal).
Z góry dzięki za odpowiedzi.

odświeżam
bardzo potrzebuję pomocy (zależy mi na czasie)

Ten post edytował gegos 14.12.2012, 09:03:21
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
gegos
post
Post #2





Grupa: Zarejestrowani
Postów: 13
Pomógł: 0
Dołączył: 11.11.2012

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


tak wiem, ale na tej podstronie również występuje błąd
settings.php
  1. <?php
  2.  
  3. // settings
  4. $facebookprofile = "linkdoprofilu";
  5. $refbonus = 10; // refferal rate in percent
  6. $jackpoton = 1; // 1-on 0-off
  7. $priceloss = 10; // price for each jackpot loss
  8. $fee = 10; // fee will be deducted from the prize of jackpot
  9. $websitetitle = "test";
  10. $websitefoot = "test";
  11. $site = 'test.com'; // site address
  12. $bonus = 0; // bonus points for new user
  13. $adminemail = 'admin@yourdomain.com'; // admin email (contact form)
  14.  
  15. // captcha
  16. $privatekey = "xxx "; // recaptcha private key
  17. $publickey = "xxx "; // recaptcha public key
  18.  
  19. //
  20. $nick = $_SESSION['login'];
  21. global $nick;
  22. $date = date("H:i");
  23. global $date;
  24. $points = mysql_result(mysql_query("SELECT all_points FROM users WHERE login = '".$nick."'"), 0);
  25. global $points;
  26. $id = mysql_result(mysql_query("SELECT id FROM users WHERE login = '".$nick."'"), 0);
  27. global $id;
  28.  
  29. function rank_adv() {
  30. $total_points = mysql_result(mysql_query("SELECT total FROM points WHERE id = '$id'") ,0);
  31. $rank = mysql_result(mysql_query("SELECT level FROM users WHERE login = '$nick'"), 0);
  32. if(isset($nick)) {
  33. if ($total_points >= 800 and $total_points < 2400 and $rank == "Bronze") {
  34. $rankup = '<li><a href="rank.php"><u><b>Click here to get Silver rank</b></u></a></li><br />';
  35. }
  36. if ($total_points >= 2400 and $total_points < 7200 and ($rank == "Silver" or $rank == "Bronze")) {
  37. $rankup = '<li><a href="rank.php"><u><b>Click here to get Gold rank</u></b></a></li><br />';
  38. }
  39. if ($total_points >= 7200 and $total_points < 21600 and ($rank == "Silver" or $rank == "Bronze" or $rank == "Gold")) {
  40. $rankup = '<li><a href="rank.php"><u><b>Click here to get Diamond rank</u></b></a></li><br />';
  41. }
  42. if ($total_points >= 21600 and $total_points < 43200 and ($rank == "Silver" or $rank == "Bronze" or $rank == "Gold" or $rank == "Diamond")) {
  43. $rankup = '<li><a href="rank.php"><u><b>Click here to get Emerald rank</u></b></a></li><br />';
  44. }
  45. if ($total_points >= 43200 and $total_points < 86400 and ($rank == "Silver" or $rank == "Bronze" or $rank == "Gold" or $rank == "Diamond" or $rank == "Emerald")) {
  46. $rankup = '<li><a href="rank.php"><u><b>Click here to get Platinum rank</u></b></a></li><br />';
  47. }
  48. if ($total_points >= 86400 and $total_points < 129600 and ($rank == "Silver" or $rank == "Bronze" or $rank == "Gold" or $rank == "Diamond" or $rank == "Emerald" or $rank == "Platinum")) {
  49. $rankup = '<li><a href="rank.php"><u><b>Click here to get Extra Diamond rank</u></b></a></li><br />';
  50. }
  51. if ($total_points >= 129600 and $total_points < 194400 and ($rank == "Silver" or $rank == "Bronze" or $rank == "Gold" or $rank == "Diamond" or $rank == "Emerald" or $rank == "Platinum" or $rank == "Extra Diamond")) {
  52. $rankup = '<li><a href="rank.php"><u><b>Click here to get Extra Emerald rank</u></b></a></li><br />';
  53. }
  54. if ($total_points >= 194400 and ($rank == "Silver" or $rank == "Bronze" or $rank == "Gold" or $rank == "Diamond" or $rank == "Emerald" or $rank == "Platinum" or $rank == "Extra Diamond" or $rank == "Extra Emerald")) {
  55. $rankup = '<li><a href="rank.php"><u><b>Click here to get Extra Platinum rank</u></b></a></li><br />';
  56. }
  57. }
  58. echo $rankup;
  59. }
  60. ?>


odświeżam

odświeżam

serio nikt nie potrafi pomóc?

Odświeżam już czwarty dzień (IMG:style_emoticons/default/smile.gif)

Ten post edytował gegos 15.12.2012, 22:08:52
Go to the top of the page
+Quote Post

Posty w temacie


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: 16.10.2025 - 04:26