Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> potrzeba szybkiej pomocy
vladyslavus
post
Post #1





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

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


mam następujący błąd przy próbie rejestracji :
Notice: undefined variable: registerForm in var.../UserController.php in line 63
Fatalerror: Call to a member function is valid() on a non-object in..../UserController.php in line 63

a linia 63 to :

if ($registerForm->isValid($postVars))

jak to naprawić ?
Go to the top of the page
+Quote Post
phpion
post
Post #2





Grupa: Moderatorzy
Postów: 6 072
Pomógł: 861
Dołączył: 10.12.2003
Skąd: Dąbrowa Górnicza




Pokaż więcej kodu, gdzie i jak inicjujesz $registerForm. Oba błędy dotyczą tego samego - zmienna $registerForm nie istnieje.
Go to the top of the page
+Quote Post
vladyslavus
post
Post #3





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

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



  1. class UserController extends Zend_Controller_Action
  2. {
  3.  
  4. public function checkLogged()
  5. {
  6. if (!Application_Model_LoggedUser::isLogged())
  7. {
  8. Application_Message::getInstance()->addError('Użytkownik nie zalogowany');
  9. $this->_redirect($this->_helper->url('index', 'index', null, array(), true));
  10. }
  11. }
  12.  
  13. public function getServerName()
  14. {
  15. return '78.46.51.139';
  16. }
  17.  
  18. public function init()
  19. {
  20. /* Initialize action controller here */
  21. }
  22.  
  23. public function indexAction()
  24. {
  25. // action body
  26. }
  27.  
  28. public function activateAction()
  29. {
  30. $userId = $this->_getParam('id', null);
  31. $token = $this->_getParam('token', null);
  32.  
  33. if (is_null($userId) || is_null($token))
  34. {
  35. Application_Message::getInstance()->addError('Nie poprawne parametry aktywacyjne');
  36. $this->_redirect($this->_helper->url('index', 'index'));
  37. }
  38.  
  39. $userModel = new Application_Model_User();
  40.  
  41. $result = $userModel->activate($userId, $token);
  42.  
  43. if ($result == true)
  44. {
  45. Application_Message::getInstance()->addSuccess('Twoje konto zostało aktywowane. Zaloguj się by korzystać z serwisu.');
  46. $this->_redirect($this->_helper->url('index', 'index'));
  47. } else
  48.  
  49. {
  50. Application_Message::getInstance()->addError($result);
  51. $this->_redirect($this->_helper->url('index', 'index'));
  52. }
  53. }
  54.  
  55. public function registerAction()
  56. {
  57. if ($this->getRequest()->isPost())
  58. {
  59. $postVars = $this->getRequest()->getPost();
  60. if (isset($postVars['registersubmit']))
  61. {
  62. if empty($registerForm->isValid($postVars))
  63. {
  64. die('t');
  65. }
  66. }
  67.  
  68. $this->view->rolldownRegister = true;
  69.  
  70. $this->_forward('index', 'index');
  71.  
  72. return;
  73. $staticPageModel = new Application_Model_StaticPage();
  74. $registerForm = new Application_Form_UserRegister();
  75. $loginForm = new Application_Form_UserLogin();
  76. $forgotPasswordForm = new Application_Form_UserForgotPassword();
  77.  
  78.  
  79. if ($this->getRequest()->isPost())
  80. {
  81. $postVars = $this->getRequest()->getPost();
  82. if (isset($postVars['registersubmit']))
  83. {
  84. if ($registerForm->isValid($postVars))
  85. {
  86. $userModel = new Application_Model_User();
  87. if (( $result = $userModel->register($postVars) ) === true)
  88. {
  89. Application_Message::getInstance()->addSuccess('Konto zostało utworzone. Aby je aktywować postępuj według instrukcji z listu, który wysłaliśmy. Jeśli nie otrzymałeś listu sprawdź proszę folder SPAM');}
  90. $this->_redirect($this->_helper->url('index', 'index'));
  91. } else
  92. {
  93. Application_Message::getInstance()->addError($result);
  94. }
  95. } else {
  96.  
  97. print_r($registerForm);
  98. die;
  99. }
  100. }
  101. if (isset($postVars['loginsubmit']))
  102. {
  103. if ($loginForm->isValid($postVars))
  104. {
  105. $userModel = new Application_Model_User();
  106. if (( $result = $userModel->login($postVars['userName'], $postVars['password']) ) === true)
  107. {
  108. Application_Message::getInstance()->addSuccess('Zostałeś zalogowany');
  109. $this->_redirect($this->_helper->url('index', 'index'));
  110. } else
  111. {
  112. Application_Message::getInstance()->addError($result);
  113. }
  114. }
  115. }
  116. if (isset($postVars['forgotpasswordsubmit']))
  117. if ($forgotPasswordForm->isValid($postVars))
  118. {
  119. $userModel = new Application_Model_User();
  120. if (( $result = $userModel->recoverPassword($postVars['email']) ) === true)
  121. {
  122. Application_Message::getInstance()->addSuccess('Instrukcje dotyczące odzyskania hasła zostały wysłane na podany adres e-mail');
  123. $this->_redirect($this->_helper->url('index', 'index'));
  124. } else
  125. {
  126. Application_Message::getInstance()->addError($result);
  127. }
  128. }
  129. }
  130. }
  131.  
  132. $fragment = $staticPageModel->getStaticFragmentByFragmentName('rejestracja_kolumna');
  133. $this->view->staticpagetitle = $fragment->title;
  134. $this->view->staticpagecontent = $fragment->content;
  135. $this->view->regform = $registerForm;
  136. $this->view->loginform = $loginForm;
  137. $this->view->forgotpasswordform = $forgotPasswordForm;
  138. }
  139.  
  140. public function logoutAction()
  141. {
  142. $userModel = new Application_Model_User();
  143. if ($userModel->logout())
  144. {
  145. Application_Message::getInstance()->addSuccess('Pomyślnie wylogowano');
  146. } else
  147. {
  148. Application_Message::getInstance()->addError('Błąd podczas wylogowywania');
  149. }
  150. $this->_redirect($this->_helper->url('index', 'index'));
  151. }
  152.  
  153. public function loginAction()
  154. {
  155. if ($this->getRequest()->isPost())
  156. {
  157. $postVars = $this->getRequest()->getPost();
  158. $userModel = new Application_Model_User();
  159. if (isset($postVars['remember']))
  160. {
  161. $rememberUser = true;
  162. } else
  163. {
  164. $rememberUser = false;
  165. }
  166. if (( $result = $userModel->login($postVars['username'], $postVars['password'], $rememberUser) ) === true)
  167. {
  168. Application_Message::getInstance()->addSuccess('Zostałeś zalogowany');
  169. $this->_redirect($this->_helper->url('index', 'index'));
  170. } else
  171. {
  172. Application_Message::getInstance()->addError($result);
  173. }
  174. }
  175. $this->_redirect($this->_helper->url('index', 'index'));
  176. }
  177.  
  178. public function profileAction()
  179. {
  180. $this->checkLogged();
  181.  
  182. $this->view->rolldownProfile = true;
  183.  
  184. $this->_forward('index', 'index');
  185.  
  186. return;
  187.  
  188. $creditModel = new Application_Model_Credit();
  189. $staticPageModel = new Application_Model_StaticPage();
  190. $userChangePasswordForm = new Application_Form_UserChangePassword();
  191.  
  192. if ($this->getRequest()->isPost())
  193. {
  194. $formVars = $this->getRequest()->getPost();
  195. if (isset($formVars['changepasswordnsubmit']))
  196. {
  197. if ($userChangePasswordForm->isValid($formVars))
  198. {
  199. $user = new Application_Model_User();
  200. if (( $result = $user->changePassword($formVars) ) === true)
  201. {
  202. Application_Message::getInstance()->addSuccess('Hasło zostało zmienione');
  203. $this->_redirect($this->_helper->url('profile', 'user'));
  204. } else
  205. {
  206. Application_Message::getInstance()->addError($result);
  207. }
  208. }
  209. }
  210.  
  211. $creditsFragment = $staticPageModel->getStaticFragmentByFragmentName('profil_kredyty');
  212. $partnerFragment = $staticPageModel->getStaticFragmentByFragmentName('profil_partner');
  213.  
  214. $this->view->credits = $creditModel->getCreditsOptions();
  215. $this->view->smscredits = $creditModel->getSmsCreditsOptions();
  216. $this->view->changepasswordform = $userChangePasswordForm;
  217. $this->view->staticcredits = $creditsFragment->content;
  218. $this->view->staticpartnership = $partnerFragment->content;
  219. // action body
  220. }
  221.  
  222. public function creditsAction()
  223. {
  224. $this->checkLogged();
  225.  
  226. $creditModel = new Application_Model_Credit();
  227.  
  228. $this->view->credits = $creditModel->getCreditsOptions();
  229. $this->view->yeticredits = $creditModel->getYetiCreditsOptions();
  230. $this->view->smscredits = $creditModel->getSmsCreditsOptions();
  231. }
  232.  
  233. public function templateremoveAction()
  234. {
  235. $this->checkLogged();
  236.  
  237. $entryId = $this->_getParam('entryId');
  238.  
  239. if (is_null($entryId))
  240. {
  241. Application_Message::getInstance()->addError('Niepoprawne wywołanie');
  242. $this->_redirect($this->_helper->url('template', 'user', null, array(), true));
  243. }
  244.  
  245. $user = new Application_Model_User();
  246.  
  247. $result = $user->removeShowTemplateEntry($entryId);
  248.  
  249. if ($result !== true)
  250. {
  251. Application_Message::getInstance()->addError($result);
  252. } else
  253. {
  254. Application_Message::getInstance()->addSuccess('Pozycja została usunięta');
  255. }
  256.  
  257. $this->_redirect($this->_helper->url('template', 'user', null, array(), true));
  258. }
  259.  
  260. public function templateupAction()
  261. {
  262. $this->checkLogged();
  263.  
  264. $entryId = $this->_getParam('entryId');
  265.  
  266. if (is_null($entryId))

( dalej jest kod ale się nie zmieścił

Ten post edytował vladyslavus 3.03.2016, 15:40:30
Go to the top of the page
+Quote Post
Rysh
post
Post #4





Grupa: Zarejestrowani
Postów: 821
Pomógł: 111
Dołączył: 11.09.2006
Skąd: Biała Podlaska

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


1. Tytuł tematu do poprawy.
2. Kod umieszczamy w [php_] [/_php] bez _
Go to the top of the page
+Quote Post
com
post
Post #5





Grupa: Zarejestrowani
Postów: 3 034
Pomógł: 366
Dołączył: 24.05.2012

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


użyj bb tagi
Go to the top of the page
+Quote Post
vladyslavus
post
Post #6





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

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


oki to następnym arzem bee wiedział. To gdzie to mam wzrucić ? generalnie mogę udostępnic ftp jeśłi zajdzie potrzeba

czyli ? czego mam użyć ? w kodzie czy tu ?
Go to the top of the page
+Quote Post
viking
post
Post #7





Grupa: Zarejestrowani
Postów: 6 381
Pomógł: 1116
Dołączył: 30.08.2006

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


W registerAction() nigdzie nie tworzysz $registerForm. Powinno być przed isPost.
Go to the top of the page
+Quote Post
Rysh
post
Post #8





Grupa: Zarejestrowani
Postów: 821
Pomógł: 111
Dołączył: 11.09.2006
Skąd: Biała Podlaska

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


Cytat(vladyslavus @ 3.03.2016, 15:28:11 ) *
oki to następnym arzem bee wiedział. To gdzie to mam wzrucić ? generalnie mogę udostępnic ftp jeśłi zajdzie potrzeba

czyli ? czego mam użyć ? w kodzie czy tu ?

Edytuj swój poprzedni post i umieść kod w odpowiednim tagu. Szybciej znajdziesz kogoś komu będzie się chciało przejrzeć ten kod.
Go to the top of the page
+Quote Post
com
post
Post #9





Grupa: Zarejestrowani
Postów: 3 034
Pomógł: 366
Dołączył: 24.05.2012

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


  1. $registerForm = new Application_Form_UserRegister();

Tworzysz to w złym miejscu (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
vladyslavus
post
Post #10





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

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


czyli ? jaką dokładnie linię mam umieścić ? zamiast register action dać register form czy jak ?
Go to the top of the page
+Quote Post
phpion
post
Post #11





Grupa: Moderatorzy
Postów: 6 072
Pomógł: 861
Dołączył: 10.12.2003
Skąd: Dąbrowa Górnicza




Na samym początku registerAction daj $registerForm = new Application_Form_UserRegister() czyli przenieś go z linii 74 do 56.
Go to the top of the page
+Quote Post
com
post
Post #12





Grupa: Zarejestrowani
Postów: 3 034
Pomógł: 366
Dołączył: 24.05.2012

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


tam masz sporo kodu który się nie wykona, zgłoś się może do autora, żeby to poprawił (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
Rysh
post
Post #13





Grupa: Zarejestrowani
Postów: 821
Pomógł: 111
Dołączył: 11.09.2006
Skąd: Biała Podlaska

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


Cytat(vladyslavus @ 3.03.2016, 15:39:20 ) *
czyli ? jaką dokładnie linię mam umieścić ? zamiast register action dać register form czy jak ?


Cytat(com @ 3.03.2016, 15:49:23 ) *
tam masz sporo kodu który się nie wykona, zgłoś się może do autora, żeby to poprawił (IMG:style_emoticons/default/smile.gif)


Tak jak pisze com, masz tam kod który się nie wykona - ponieważ dajesz return w pewnym momencie, co oznacza w tym wypadku zakończ działanie metody.

Ten post edytował Rysh 3.03.2016, 15:56:32
Go to the top of the page
+Quote Post
vladyslavus
post
Post #14





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

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


a w którym mam dac ?

a da się to jakoś poprawić czy muszę się zgłosić do autora kodu?

skasowac return ?
Go to the top of the page
+Quote Post
Kshyhoo
post
Post #15





Grupa: Opiekunowie
Postów: 3 855
Pomógł: 317
Dołączył: 4.01.2005
Skąd: że




Cytat(Rysh @ 3.03.2016, 15:20:51 ) *
1. Tytuł tematu do poprawy.
2. Kod umieszczamy w [php_] [/_php] bez _

Nie bawimy się w moderatorów.

Do autora: proszę poprawić tytuł wątku na zgodny z zasadami działu.
Go to the top of the page
+Quote Post
com
post
Post #16





Grupa: Zarejestrowani
Postów: 3 034
Pomógł: 366
Dołączył: 24.05.2012

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


Kshyhoo ok, ale dobrze, że ktoś czuwa jak Ciebie nie było, bo ten kod był tak długi ze nie dało sie go czytać bez bbcode, zresztą moderator nie miał zastrzeżen (IMG:style_emoticons/default/tongue.gif)

vladyslavus da sie ale nikt nie wie jaki był jego zamysł jak to tworzył, bo tam jest w jeden metodzie kilka akcji które robią niby to samo i nie wiadomo czemu i poco (IMG:style_emoticons/default/wink.gif)
Go to the top of the page
+Quote Post
Kshyhoo
post
Post #17





Grupa: Opiekunowie
Postów: 3 855
Pomógł: 317
Dołączył: 4.01.2005
Skąd: że




Cytat(com @ 3.03.2016, 18:16:37 ) *
Kshyhoo ok, ale dobrze, że ktoś czuwa jak Ciebie nie było, bo ten kod był tak długi ze nie dało sie go czytać bez bbcode, zresztą moderator nie miał zastrzeżen (IMG:style_emoticons/default/tongue.gif)

Po to jest opcja raportowania. Po za tym, mógł mu udzielić porady w poście i nikt by się nie czepił...
Go to the top of the page
+Quote Post
vladyslavus
post
Post #18





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

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



i wyskakuje błąd 9 cały czas:
Parse error: syntax error, unexpected 'if' (T_IF) in /var/www/peep-show.tv/application/controllers/UserController.php on line 59

ktos chętny : mogę udzielić dostępu do serweru żeby naprawić ten bład rejestracji - chętnie zapłacę nawet w tej chwili
Go to the top of the page
+Quote Post
Kshyhoo
post
Post #19





Grupa: Opiekunowie
Postów: 3 855
Pomógł: 317
Dołączył: 4.01.2005
Skąd: że




Ostatnia prośba o zmianę tytułu na zgodny z zasadami...
Go to the top of the page
+Quote Post
vladyslavus
post
Post #20





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

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


a jak się tu to robi ?
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: 7.10.2025 - 04:03