Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP] Modyfikacja skryptu
smrodek11
post
Post #1





Grupa: Zarejestrowani
Postów: 42
Pomógł: 0
Dołączył: 27.12.2010

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


Próbuje zmodyfikować skrypt autosurfu tak żeby działał, po wklejeniu jego kodu, w każdej podstronie. Wychodzi mi to dziwnie i już mi brakuje pomysłów co i jak robić dalej
Oryginalny skrypt:

  1. <?php
  2.  
  3.  
  4. class page_surf implements proCMS_page
  5. {
  6. public function Render()
  7. {
  8. global $cms, $config;
  9. $surf_boxes = array();
  10. $error = '';
  11. $points = 0;
  12.  
  13. $cms -> lang -> load('earning');
  14.  
  15. if(($cms -> userData['user_last_surf'] + 4) < time())
  16. {
  17. $cms -> db -> query("SELECT * FROM pro_surf_campaigns WHERE scamp_enabled = 1 AND scamp_views < scamp_bought_views ORDER BY Rand() LIMIT 4");
  18. if($cms -> db -> num_rows() < 1)
  19. {
  20. $error = 'Nie ma żadnych kampani do wyświetlenia.';
  21. }
  22. while($row = $cms -> db -> fetch())
  23. {
  24. $surf_boxes[] = $row;
  25. }
  26. $cms -> tpl -> add_loop('earning/surf', 'boxes', $surf_boxes);
  27.  
  28. $this -> content = $cms -> tpl -> render('earning/surf', array('pkt' => '',
  29. 'error' => $error));
  30.  
  31. foreach($surf_boxes as $box)
  32. {
  33. $cms -> db -> query("UPDATE `pro_surf_campaigns` SET `scamp_views` = `scamp_views` + 1 WHERE `scamp_id` = {$box['scamp_id']}");
  34. $points++;
  35. }
  36. if($points > 0) $points = 1;
  37. $cms -> db -> query("UPDATE `pro_users` SET `user_last_surf` = '".time()."', `user_points` = `user_points` + {$points} WHERE `user_id` = {$cms -> userData['user_id']}");
  38. }
  39. else
  40. {
  41. $cms -> tpl -> add_loop('earning/surf', 'boxes', $surf_boxes);
  42.  
  43. $error = 'Nie upłynął wystarczający czas od ostatniego surfa.';
  44.  
  45. $this -> content = $cms -> tpl -> render('earning/surf', array('pkt' => '',
  46. 'error' => $error));
  47. }
  48.  
  49. return $this -> content;
  50. }
  51. }
  52.  
  53. ?>


Skrypt po moich "modach":

  1. <?php
  2.  
  3. include("config.php");
  4.  
  5. $surf_boxes = array();
  6. $error = '';
  7. $points = 0;
  8. $sprawdzenie = mysql_query("SELECT * FROM pro_surf_campaigns WHERE scamp_enabled = 1 AND scamp_views < scamp_bought_views ORDER BY Rand() LIMIT 4");
  9. $sprawdzenie_num = mysql_num_rows($sprawdzenie);
  10. $aktualizacja = mysql_query("UPDATE `pro_surf_campaigns` SET `scamp_views` = `scamp_views` + 1 WHERE `scamp_id` = {$box['scamp_id']}");
  11. $userLastSurf = mysql_query("SELECT user_last_surf FROM pro_users WHERE user_login = '$nick'");
  12. $dodajpkt = query("UPDATE `pro_users` SET `user_last_surf` = '".time()."', `user_points` = `user_points` + {$points} WHERE `user_login` = '$nick'");
  13.  
  14.  
  15.  
  16. if(($userLastSurf + 4) < time());
  17. {
  18.  
  19. if($sprawdzenie_num < 1)
  20. {
  21. $error = 'Nie ma żadnych kampani do wyświetlenia.';
  22. }
  23. while($row = fetch())
  24. {
  25. $surf_boxes[] = $row;
  26. }
  27. add_loop('templates/default/earning/surf', 'boxes', $surf_boxes);
  28.  
  29. $this -> content = render('templates/default/earning/surf', array('pkt' => '',
  30. 'error' => $error));
  31.  
  32. foreach($surf_boxes as $box)
  33. {
  34. $aktualizacja;
  35. $points++;
  36. }
  37. if($points > 0) $points = 1;
  38. $dodajpkt;
  39. }
  40. else
  41. {
  42.  
  43. $error = 'Nie upłynął wystarczający czas od ostatniego surfa.';
  44.  
  45. }
  46.  
  47. return $this -> content;
  48.  
  49.  
  50. ?>


Po moich modach wyskakuje błąd: Parse error: syntax error, unexpected T_ELSE in /home/wooops/domains/wooops.eu/public_html/gp/modules/earning/surf.page2.php on line 39. Jeśli ktoś mógłby coś poradzić, byłbym wdzięczny

Ten post edytował smrodek11 20.06.2011, 17:06:45
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 3)
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




NIe:
if(($userLastSurf + 4) < time());
a:
if(($userLastSurf + 4) < time())
Warto by doczytać co robią średniki.
Go to the top of the page
+Quote Post
smrodek11
post
Post #3





Grupa: Zarejestrowani
Postów: 42
Pomógł: 0
Dołączył: 27.12.2010

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


oki dzięki. Teraz jest:
Parse error: syntax error, unexpected T_VARIABLE in /home/wooops/domains/wooops.eu/public_html/gp/modules/earning/surf.page2.php on line 38
Go to the top of the page
+Quote Post
nospor
post
Post #4





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




Forum nie parser. Zajrzyj sobie do linii 38 i się zastanow czy ma jakikolwiek sens.
Go to the top of the page
+Quote Post

Closed TopicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.09.2025 - 12:43