Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP]Biala strona lub 500 w moim skrypcie
portals
post
Post #1





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 4.01.2012

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


Witam
Posiadam na swoim forum skrypt do obsługi pobierania plików. Skrypt na starym serwerze działał bez problemów.
Na nowym serwerze wyrzuca błąd 500 lub pustą stroną, niezależnie od ustawienia raportowanie błędów.Skrypt korzysta z IPBWI oraz smarty. Przypuszczam że błąd jest w tym pliku:
  1. <?php
  2. class user
  3. {
  4.  
  5.  
  6. public function __construct($id = -1)
  7. {
  8. global $member;
  9.  
  10. if ($id == "-1")
  11. {
  12. $this->browser = $_SERVER['HTTP_USER_AGENT'];
  13. $this->ip = $_SERVER['REMOTE_ADDR'];
  14. $this->name = $member["name"];
  15. $this->name = "portals"; //w celach testowych
  16. if (!isset($this->name)) $this->logged = false;
  17. else
  18. {
  19. $this->logged = true;
  20.  
  21. if ($member['avatar_type'] == "upload") $this->avatar = "http://www.stalkerteam.pl/uploads/{$member["avatar_location"]}";
  22. else $this->avatar = $member["avatar_location"];
  23. }
  24. }
  25. }
  26.  
  27. public function getUser($name)
  28. {
  29. global $db;
  30. if ($name == -1) $name = $this->name;
  31. if ($this->logged == true)
  32. {
  33. $result = $db->query("SELECT * FROM st_users WHERE name = '{$this->name}'");
  34. if ($result->num_rows == 0)
  35. {
  36. //Gdy brak takiego użytkownika
  37. $result = $db->query("INSERT INTO st_users (name, downloaded_current_month,`limit`) VALUES ('{$this->name}','0', '6000')");
  38. $result = $db->query("SELECT * FROM st_users WHERE name = '{$this->name}'");
  39.  
  40. }
  41.  
  42. $user = $result->fetch_array();
  43. }
  44.  
  45. $this->downloaded_current_month = $user['downloaded_current_month'];
  46. $this->download_limit = $user['limit'];
  47. $this->id = $user['id'];
  48. $this->user_type = $user['user_type'];
  49. $this->remaining_current_month = $this->download_limit - $this->downloaded_current_month;
  50.  
  51. if ($this->downloaded_current_month != 0) $this->remaining_percentage = ($this->download_limit / $this->downloaded_current_month) * 10;
  52. else $this->remaining_percentage = 100;
  53.  
  54. if ($this->user_type == 1) $this->admin = true;
  55. else $this->admin = false;
  56.  
  57. return true;
  58.  
  59. }
  60.  
  61.  
  62. public function can_download_this_file($size)
  63. {
  64. $size = (int) $size;
  65. if ($this->downloaded_current_month + $size <= $this->download_limit) return True;
  66. else return False;
  67. }
  68.  
  69. public function subtract_transfer($mb)
  70. {
  71. global $db,$error;
  72. $mb = (int) $mb;
  73. $out = $this->downloaded_current_month + $mb;
  74.  
  75. if ($out > $this->download_limit)
  76. {
  77. //To raczej nie powinno mieć miejsca bo sprawdzenie jest przy wywołaniu.
  78. $error->script_error = 'Error in subtract_transfer($mb) out is negative';
  79. $error->end();
  80. }
  81. $result=$db->query("UPDATE st_users SET downloaded_current_month = '$out' WHERE id = '{$this->id}'");
  82.  
  83. }
  84.  
  85. public function is_downloaded_this_file($file_id)
  86. {
  87. global $db;
  88. $result=$db->query("SELECT * FROM st_downloads WHERE user_id = '{$this->id}' AND file_id = '{$file_id}'");
  89. if ($result->num_rows == 0) return false;
  90. else return true;
  91.  
  92.  
  93. }
  94.  
  95. }
  96.  
  97. ?>
  98.  


Ten post edytował portals 5.01.2012, 19:43:51
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 22.08.2025 - 07:35