bład logowania /rejestracji

PHP to skryptowy język wykonywany po stronie serwera. Forum przeznaczone na pytania dot. programowania obiektowego, wzorców projektowych itp.
Awatar użytkownika
vladyslavus
Posty: 1
Rejestracja: 04 mar 2016, 0:10

bład logowania /rejestracji

Post autor: vladyslavus » 04 mar 2016, 0:16

Mam taki kod ( to tylko część) w pliku UserController.php.
[
<?php

class UserController extends Zend_Controller_Action
{

public function checkLogged()
{
if (!Application_Model_LoggedUser::isLogged())
{
Application_Message::getInstance()->addError('Użytkownik nie zalogowany');
$this->_redirect($this->_helper->url('index', 'index', null, array(), true));
}
}
[/php]
i wyskakuje mi bład
Parse error: syntax error, unexpected 'if' (T_IF) in /var/www/peep-show.tv/application/controllers/UserController.php on line 59

przy logowaniu i rejesttarcji. moge udzielić dostępu do plików i zapłacić nawet w tej chwili
public function getServerName()
{
'78.46.51.139';
}

public function init()
{
/* Initialize action controller here */
}

public function indexAction()
{
// action body
}

public function activateAction()
{
$userId = $this->_getParam('id', null);
$token = $this->_getParam('token', null);

if (is_null($userId) || is_null($token))
{
Application_Message::getInstance()->addError('Nie poprawne parametry aktywacyjne');
$this->_redirect($this->_helper->url('index', 'index'));
}

$userModel = new Application_Model_User();

$result = $userModel->activate($userId, $token);

if ($result == true)
{
Application_Message::getInstance()->addSuccess('Twoje konto zostało aktywowane. Zaloguj się by korzystać z serwisu.');
$this->_redirect($this->_helper->url('index', 'index'));
} else
{
Application_Message::getInstance()->addError($result);
$this->_redirect($this->_helper->url('index', 'index'));
}
}
public function registerAction()
{
$registerForm = new Application_Form_UserRegister();
{
if ($this->getRequest()->isPost())
{
$postVars = $this->getRequest()->getPost();
if (isset($postVars['registersubmit']))
{
if empty($registerForm->isValid($postVars))
{
die('t');
}
}
}


$this->view->rolldownRegister = true;

$this->_forward('index', 'index');


$staticPageModel = new Application_Model_StaticPage();
$registerForm = new Application_Form_UserRegister();
$loginForm = new Application_Form_UserLogin();
$forgotPasswordForm = new Application_Form_UserForgotPassword();


if ($this->getRequest()->isPost())
{
$postVars = $this->getRequest()->getPost();
if (isset($postVars['registersubmit']))
{
if ($registerForm->isValid($postVars))
{
$userModel = new Application_Model_User();
if (( $result = $userModel->register($postVars) ) === true)
{
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');
$this->_redirect($this->_helper->url('index', 'index'));
} else
{
Application_Message::getInstance()->addError($result);
}
} else {

print_r($registerForm);
die;
}
}
if (isset($postVars['loginsubmit']))
{
if ($loginForm->isValid($postVars))
{
$userModel = new Application_Model_User();
if (( $result = $userModel->login($postVars['userName'], $postVars['password']) ) === true)
{
Application_Message::getInstance()->addSuccess('Zostałeś zalogowany');
$this->_redirect($this->_helper->url('index', 'index'));
} else
{
Application_Message::getInstance()->addError($result);
}
}
}
if (isset($postVars['forgotpasswordsubmit']))
{
if ($forgotPasswordForm->isValid($postVars))
{
$userModel = new Application_Model_User();
if (( $result = $userModel->recoverPassword($postVars['email']) ) === true)
{
Application_Message::getInstance()->addSuccess('Instrukcje dotyczące odzyskania hasła zostały wysłane na podany adres e-mail');
$this->_redirect($this->_helper->url('index', 'index'));
} else
{
Application_Message::getInstance()->addError($result);
}
}
}
}

$fragment = $staticPageModel->getStaticFragmentByFragmentName('rejestracja_kolumna');
$this->view->staticpagetitle = $fragment->title;
$this->view->staticpagecontent = $fragment->content;
$this->view->regform = $registerForm;
$this->view->loginform = $loginForm;
$this->view->forgotpasswordform = $forgotPasswordForm;
}

public function logoutAction()
{
$userModel = new Application_Model_User();
if ($userModel->logout())
{
Application_Message::getInstance()->addSuccess('Pomyślnie wylogowano');
} else
{
Application_Message::getInstance()->addError('Błąd podczas wylogowywania');
}
$this->_redirect($this->_helper->url('index', 'index'));
}

public function loginAction()
{
if ($this->getRequest()->isPost())
{
$postVars = $this->getRequest()->getPost();
$userModel = new Application_Model_User();
if (isset($postVars['remember']))
{
$rememberUser = true;
} else
{
$rememberUser = false;
}
if (( $result = $userModel->login($postVars['username'], $postVars['password'], $rememberUser) ) === true)
{
Application_Message::getInstance()->addSuccess('Zostałeś zalogowany');
$this->_redirect($this->_helper->url('index', 'index'));
} else
{
Application_Message::getInstance()->addError($result);
}
}
$this->_redirect($this->_helper->url('index', 'index'));
}

public function profileAction()
{
$this->checkLogged();

$this->view->rolldownProfile = true;

$this->_forward('index', 'index');



$creditModel = new Application_Model_Credit();
$staticPageModel = new Application_Model_StaticPage();
$userChangePasswordForm = new Application_Form_UserChangePassword();

if ($this->getRequest()->isPost())
{
$formVars = $this->getRequest()->getPost();
if (isset($formVars['changepasswordnsubmit']))
{
if ($userChangePasswordForm->isValid($formVars))
{
$user = new Application_Model_User();
if (( $result = $user->changePassword($formVars) ) === true)
{
Application_Message::getInstance()->addSuccess('Hasło zostało zmienione');
$this->_redirect($this->_helper->url('profile', 'user'));
} else
{
Application_Message::getInstance()->addError($result);
}
}
}
}

$creditsFragment = $staticPageModel->getStaticFragmentByFragmentName('profil_kredyty');
$partnerFragment = $staticPageModel->getStaticFragmentByFragmentName('profil_partner');

$this->view->credits = $creditModel->getCreditsOptions();
$this->view->smscredits = $creditModel->getSmsCreditsOptions();
$this->view->changepasswordform = $userChangePasswordForm;
$this->view->staticcredits = $creditsFragment->content;
$this->view->staticpartnership = $partnerFragment->content;
// action body
}

public function creditsAction()
{
$this->checkLogged();

$creditModel = new Application_Model_Credit();

$this->view->credits = $creditModel->getCreditsOptions();
$this->view->yeticredits = $creditModel->getYetiCreditsOptions();
$this->view->smscredits = $creditModel->getSmsCreditsOptions();
}

public function templateremoveAction()
{
$this->checkLogged();

$entryId = $this->_getParam('entryId');

if (is_null($entryId))
{
Application_Message::getInstance()->addError('Niepoprawne wywołanie');
$this->_redirect($this->_helper->url('template', 'user', null, array(), true));
}

$user = new Application_Model_User();

$result = $user->removeShowTemplateEntry($entryId);

if ($result !== true)
{
Application_Message::getInstance()->addError($result);
} else
{
Application_Message::getInstance()->addSuccess('Pozycja została usunięta');
}

$this->_redirect($this->_helper->url('template', 'user', null, array(), true));
}

public function templateupAction()
{
$this->checkLogged();

$entryId = $this->_getParam('entryId');

if (is_null($entryId))
{
Application_Message::getInstance()->addError('Niepoprawne wywołanie');
$this->_redirect($this->_helper->url('template', 'user', null, array(), true));
}

$user = new Application_Model_User();

$result = $user->moveShowTemplateEntryUp($entryId);

if ($result !== true)
{
Application_Message::getInstance()->addError($result);
} else
{
Application_Message::getInstance()->addSuccess('Pozycja została przesunięta');
}

$this->_redirect($this->_helper->url('template', 'user', null, array(), true));
}

public function templatedownAction()
{
$this->checkLogged();

$entryId = $this->_getParam('entryId');

if (is_null($entryId))
{
Application_Message::getInstance()->addError('Niepoprawne wywołanie');
$this->_redirect($this->_helper->url('template', 'user', null, array(), true));
}

$user = new Application_Model_User();

$result = $user->moveShowTemplateEntryDown($entryId);

if ($result !== true)
{
Application_Message::getInstance()->addError($result);
} else
{
Application_Message::getInstance()->addSuccess('Pozycja została przesunięta');
}

$this->_redirect($this->_helper->url('template', 'user', null, array(), true));
}

public function templateactivateAction()
{
$this->checkLogged();

$entryId = $this->_getParam('entryId');

if (is_null($entryId))
{
Application_Message::getInstance()->addError('Niepoprawne wywołanie');
$this->_redirect($this->_helper->url('template', 'user', null, array(), true));
}

$user = new Application_Model_User();

$result = $user->activateShowTemplateEntry($entryId);

if ($result !== true)
{
Application_Message::getInstance()->addError($result);
} else
{
Application_Message::getInstance()->addSuccess('Pozycja została aktywowana');
}

$this->_redirect($this->_helper->url('template', 'user', null, array(), true));
}

public function templatedeactivateAction()
{
$this->checkLogged();

$entryId = $this->_getParam('entryId');

if (is_null($entryId))
{
Application_Message::getInstance()->addError('Niepoprawne wywołanie');
$this->_redirect($this->_helper->url('template', 'user', null, array(), true));
}

$user = new Application_Model_User();

$result = $user->deactivateShowTemplateEntry($entryId);

if ($result !== true)
{
Application_Message::getInstance()->addError($result);
} else
{
Application_Message::getInstance()->addSuccess('Pozycja została zdezaktywowana');
}

$this->_redirect($this->_helper->url('template', 'user', null, array(), true));
}

public function templateAction()
{
$this->checkLogged();

$formVars = array(
'description' => '',
'minutes' => '3',
'seconds' => '00',
'credits' => '100',
'camtocam' => 0
);

$entryId = $this->_getParam('entryId');
$user = new Application_Model_User();

if (is_null($entryId))
{
$entryParameters = array();
$isEdit = false;
} else
{
$entry = $user->getShowTemplateEntry($entryId);
if (is_array($entry))
{
$formVars = array(
'description' => $entry['name'],
'minutes' => ceil($entry['duration'] / 60),
'seconds' => $entry['duration'] % 60,
'credits' => $entry['value'],
'camtocam' => $entry['camToCam']
);
$isEdit = true;
}
}

if ($this->getRequest()->isPost())
{
$postVars = $this->getRequest()->getPost();
if ($isEdit && isset($postVars['resign']))
{
$this->_redirect($this->_helper->url('template', 'user', null, array(), true));
}
$ok = true;
if ($ok && (!isset($postVars['description']) || strlen(trim($postVars['description'])) < 5 ))
{
Application_Message::getInstance()->addError('Opis czynności nie może być krótszy niż pięć znaków');
$ok = false;
} elseif ($ok)
{
$entryParameters['description'] = trim($postVars['description']);
}

if ($ok && (!isset($postVars['minutes']) || !isset($postVars['seconds']) || !is_numeric($postVars['minutes']) || !is_numeric($postVars['seconds']) || (int) $postVars['seconds'] < 0 || (int) $postVars['seconds'] > 59 || (int) $postVars['minutes'] < 0
))
{
Application_Message::getInstance()->addError('Proszę podać poprawny czas trwania');
$ok = false;
} elseif ($ok)
{
$entryParameters['time'] = (int) $postVars['minutes'] * 60 + (int) $postVars['seconds'];
if ($entryParameters['time'] < 60)
{
Application_Message::getInstance()->addError('Pokaz nie może być krótszy niż jedna minuta');
$ok = false;
}
}

if ($ok && (!isset($postVars['credits']) || !is_numeric($postVars['credits']) || $postVars['credits'] < 1 ))
{
Application_Message::getInstance()->addError('Proszę podać poprawną liczbą kredytów');
$ok = false;
} elseif ($ok)
{
$entryParameters['credits'] = $postVars['credits'];
}

if (isset($postVars['camtocam']))
{
$entryParameters['camToCam'] = 1;
$postVars['camtocam'] = 1;
} else
{
$entryParameters['camToCam'] = 0;
}

if ($ok)
{
if ($isEdit)
{
$result = $user->updateShowTemplateEntry($entryId, $entryParameters['description'], $entryParameters['time'], $entryParameters['credits'], $entryParameters['camToCam']);
} else
{
$result = $user->addShowTemplateEntry($entryParameters['description'], $entryParameters['time'], $entryParameters['credits'], $entryParameters['camToCam']);
}

if ($result !== true)
{
Application_Message::getInstance()->addError($result);
$ok = false;
} else
{
if ($isEdit)
{
Application_Message::getInstance()->addSuccess('Pozycja została zapisana');
} else
{
Application_Message::getInstance()->addSuccess('Pozycja została dodana');
}
$this->_redirect($this->_helper->url('template', 'user', null, array(), true));
}
}

if (!$ok)
{
$formVars = $postVars;
}
}

$this->view->isedit = $isEdit;
$this->view->entries = $user->getShowTemplateEntries();
$this->view->formvars = $formVars;
}

public function resignAction()
{
$this->checkLogged();

$userId = Application_Model_LoggedUser::getUserId();

$userModel = new Application_Model_User();

$userModel->removeAccount($userId);

Application_Message::getInstance()->addSuccess('Twoje konto zostało usunięte');

$userModel->logout();

$this->_redirect($this->_helper->url('index', 'index'));
}

public function buyyetiAction()
{
$this->checkLogged();

$creditId = $this->_getParam('credit');

if (is_null($creditId))
{
Application_Message::getInstance()->addError('Niepoprawny parametr wywołania');
$this->_redirect($this->_helper->url('profile', 'user'));
}

$user = new Application_Model_User();

if (!is_null($creditId))
{
$creditData = $user->getYetipayCredit($creditId);
if (is_null($creditData) || $creditData === false)
{
Application_Message::getInstance()->addError('Dana pozycja płatności jest niedostępna');
$this->_redirect($this->_helper->url('profile', 'user'));
}

$this->view->creditData = $creditData;
}

}

public function buyAction()
{
$this->checkLogged();

$creditId = $this->_getParam('credit');
$smsCreditId = $this->_getParam('smscredit');

if (is_null($creditId) && is_null($smsCreditId))
{
Application_Message::getInstance()->addError('Niepoprawny parametr wywołania');
$this->_redirect($this->_helper->url('profile', 'user'));
}

$user = new Application_Model_User();

if (!is_null($creditId))
{
$creditData = $user->getDotpayCredit($creditId);
if (is_null($creditData) || $creditData === false)
{
Application_Message::getInstance()->addError('Dana pozycja płatności jest niedostępna');
$this->_redirect($this->_helper->url('profile', 'user'));
}
$params = array(
'id' => Application_Model_Settings::getDotPayId(),
'kwota' => str_replace(',', '.', $creditData['value']),
'waluta' => 'PLN',
'jezyk' => 'pl',
'opis' => 'Płatność ' . $creditData['value'] . 'zł za ' . $creditData['credits'] . ' kredytów',
'url' => 'http://www.peep-show.tv' . $this->_helper->url('profile', 'user'),
'urlc' => 'http://www.peep-show.tv' . $this->_helper->url('dotpay', 'user'),
'control' => 'C#' . $creditId . '#' . $user->getLoggedUserUserId(),
'isSms' => false,
'descValue' => $creditData['value'],
'descCredits' => $creditData['credits']
);
}

if (!is_null($smsCreditId))
{
$smsCreditData = $user->getDotpaySmsCredit($smsCreditId);

if (is_null($smsCreditData) || $smsCreditData === false)
{
Application_Message::getInstance()->addError('Dana pozycja płatności jest niedostępna');
$this->_redirect($this->_helper->url('profile', 'user'));
}

switch ($smsCreditData['value'])
{
case ( '11.07' ):
$smsNumber = '79955';
break;

case ( '23.37' ):
$smsNumber = '91995';
break;

case ( '30.75' ):
$smsNumber = '92595';
break;

default:
Application_Message::getInstance()->addError('Dana pozycja płatności jest niedostępna');
$this->_redirect($this->_helper->url('profile', 'user'));
}

if ($this->getRequest()->isPost())
{
$user = new Application_Model_User();

$postVals = $this->getRequest()->getPost();

if (( $result = $user->processSms($smsNumber, $postVals['smscode'], $smsCreditData['value'], $smsCreditData['credits']) ) === true)
{
Application_Message::getInstance()->addSuccess('Kredyty zostały dopisane');
} else
{
Application_Message::getInstance()->addError($result);
}

$this->_redirect($this->_helper->url('buy', 'user', null, ['smscredit' => $smsCreditId]));
}

$params = array(
'optionId' => $smsCreditId,
'number' => $smsNumber,
'value' => $smsCreditData['value'],
'credits' => $smsCreditData['credits'],
'isSms' => true
);
}

foreach ($params as $key => $value)
{
$this->view->{$key} = $value;
}
}

public function payoutAction()
{
$this->checkLogged();

if ($this->getRequest()->isPost())
{
$formVars = $this->getRequest()->getPost();
$ok = true;
if (strlen($formVars['accountname']) < 4)
{
Application_Message::getInstance()->addError('Niepoprawna nazwa konta');
$ok = false;
}
if (!is_numeric($formVars['accountpart1']) || !is_numeric($formVars['accountpart2']) || !is_numeric($formVars['accountpart3']) || !is_numeric($formVars['accountpart4']) || !is_numeric($formVars['accountpart5']) || !is_numeric($formVars['accountpart6']) || !is_numeric($formVars['accountpart7']) || strlen($formVars['accountpart1']) != 2 || strlen($formVars['accountpart2']) != 4 || strlen($formVars['accountpart3']) != 4 || strlen($formVars['accountpart4']) != 4 || strlen($formVars['accountpart5']) != 4 || strlen($formVars['accountpart6']) != 4 || strlen($formVars['accountpart7']) != 4)
{
Application_Message::getInstance()->addError('Niepoprawny numer konta');
$ok = false;
}

if ($ok)
{
$user = new Application_Model_User();

$settingMapper = new Admin_Model_SettingMapper();
$settings = $settingMapper->getSettings();

$user->reportPayout($formVars['accountname'], $formVars['accountpart1'] . $formVars['accountpart2'] . $formVars['accountpart3'] . $formVars['accountpart4'] .
$formVars['accountpart5'] . $formVars['accountpart6'] . $formVars['accountpart7'], $settings['exchange_rate']);
if (isset($formVars['remember']) && $formVars['remember'] == '1')
{
$user->setupAccountData($formVars['accountname'], $formVars['accountpart1'] . $formVars['accountpart2'] . $formVars['accountpart3'] . $formVars['accountpart4'] .
$formVars['accountpart5'] . $formVars['accountpart6'] . $formVars['accountpart7']);
}
Application_Message::getInstance()->addSuccess('Żądanie wypłaty zostało zapisane');
} else
{
Application_Message::getInstance()->addError('Żądanie wypłaty NIE zostało zapisane');
}

$this->_redirect($this->_helper->url('profile', 'user'));
} else
{
$this->_redirect($this->_helper->url('profile', 'user'));
}
}

public function dotpayAction()
{

if (in_array($_POST['t_status'], array('0', '1', '2')))
{
$errors = array();
if ($_POST['id'] != Application_Model_Settings::getDotPayId())
{
$errors[] = 1;
}
if (strlen($_POST['t_id']) < 5)
{
$errors[] = 3;
}
$m5 = Application_Model_Settings::getDotPayPin() . ':' . Application_Model_Settings::getDotPayId() . ':' . $_POST['control'] . ':' . $_POST['t_id'] .
':' . $_POST['amount'] . ':' . $_POST['email'] . ':' . ( isset($_POST['service']) ? $_POST['service'] : '' ) . ':' . ( isset($_POST['code']) ? $_POST['code'] : '' ) .
':' . ( isset($_POST['username']) ? $_POST['username'] : '' ) .
':' . ( isset($_POST['password']) ? $_POST['password'] : '' ) . ':' . $_POST['t_status'];
if (md5($m5) != $_POST['md5'])
{
$errors[] = 5;
}
@ob_end_flush();
if (count($errors) != 0)
{
echo( 'ERROR: [' . implode(',', $errors) . ']' );
die;
} else
{
$user = new Application_Model_User();

if (( $result = $user->processDotpay($_POST['t_id'], $_POST['control'], $_POST['amount'], $_POST['t_status']) ) === true)
{
echo( 'OK' );
} else
{
echo( $result );
}
die;
}
} else
{
echo( 'OK' );
die;
}
}

public function yetipayAction()
{
$transactionId = $this->_getParam('transactionId');

$merchantId = Application_Model_Settings::getYetiPayId();
$time = time();

$hash = md5($merchantId . $transactionId . $time . Application_Model_Settings::getYetiPayAuth1());

$url = 'https://www.yetipay.pl/YetiPay/my/status';
$fields = array(
'merchant_id' => $merchantId,
'transaction_id' => $transactionId,
'time' => $time,
'hash' => $hash
);

$fields_string = '';
foreach ($fields as $key => $value)
{
$fields_string .= $key . '=' . $value . '&';
}
rtrim($fields_string, '&');

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);

$result = array();

foreach (explode("\n", curl_exec($ch)) as $line)
{
if (trim($line) == '')
{
continue;
}
$parts = explode('=', $line);
$result[$parts[0]] = $parts[1];
}

curl_close($ch);

$user = new Application_Model_User();

$user->processYetipay($result['transaction_id'], $result['user_id'], $result['product_id'], $result['amount']);

$this->_redirect($this->_helper->url('profile', 'user'));
}

public function privtransmissionAction()
{
$privateName = $this->_getParam('userName', '');

$showMapper = new Application_Model_Show();
$privateShow = $showMapper->getPrivateShow($privateName);

$showMapper = new Application_Model_Show();
$privateShow = $showMapper->getPrivateShow($privateName);

if (is_null($privateShow))
{
Application_Message::getInstance()->addError('Nie odnaleziono pokazu');
$this->_redirect($this->_helper->url('index', 'index', null, array(), true));
}

if (!$privateShow['isBroadcaster'])
{
Application_Message::getInstance()->addError('Nie możesz wejść jako nadający');
$this->_redirect($this->_helper->url('index', 'index', null, array(), true));
}

$this->view->sessionToken = $privateName;
$this->view->serverName = $this->getServerName();
$this->view->transmissionName = $privateName;
$this->view->isCamToCam = $privateShow['isCamToCam'] == 1;
}

public function transmissionAction()
{
if (!Application_Model_LoggedUser::isLogged())
{
$this->_redirect($this->_helper->url('register', 'user'));
}

$user = new Application_Model_User();

$userName = $this->_getParam('userName', '');

if (strlen($userName) == 32)
{
$this->_forward('privtransmission');
;
}


$showMapper = new Application_Model_Show();
$showKeys = $showMapper->startShow();
$this->view->sessionToken = $showKeys['sessionKey'];

$currentTicket = $showMapper->getCurrentTicketForShow($showKeys['showId']);

$this->view->serverName = $this->getServerName();
$this->view->settings = $showMapper->getShowSettings($showKeys['showId']);
if ($this->view->settings['privSetting'] == 1)
{
$this->view->privateOptions = $showMapper->getPrivateOptions($showKeys['showId']);
;
} elseif ($this->view->settings['privSetting'] == 2)
{
$this->view->privateOptions = array();

foreach ($user->getShowTemplateEntries() as $item)
{
if ($item['status'] != 0)
{
continue;
}
$this->view->privateOptions[] = array('title' => $item['name'], 'duration' => $item['duration'], 'credits' => $item['value'], 'camtocam' => $item['camToCam']);
}
} else
{
$this->view->privateOptions = array();
}
$this->view->tips = $showMapper->getTipsHistory($showKeys['showId']);
$this->view->chatTicket = $currentTicket;
$this->view->transmissionName = Application_Model_LoggedUser::getUserName();
$this->view->blockedUsers = $showMapper->getBlockedUsers($showKeys['showId']);
//
// echo( '<pre>' );
// print_r( $this->view->settings );
// die;
// Application_Message::getInstance()->addSuccess( 'Media Server connection error' );
// Application_Message::getInstance()->addInfo( 'Media Server connection error' );
// Application_Message::getInstance()->addWarning( 'Media Server connection error' );
// Application_Message::getInstance()->addError( 'Flash applet load error' );
}

public function privwatchAction()
{
$privateName = $this->_getParam('userName', '');

$showMapper = new Application_Model_Show();
$privateShow = $showMapper->getPrivateShow($privateName);

if (!Application_Model_LoggedUser::isLogged())
{
Application_Message::getInstance()->addError('Musisz być zalogowany');
$this->_redirect($this->_helper->url('index', 'index', null, array(), true));
}

if (is_null($privateShow))
{
Application_Message::getInstance()->addError('Nie odnaleziono pokazu');
$this->_redirect($this->_helper->url('index', 'index', null, array(), true));
}

if ($privateShow['isBroadcaster'])
{
Application_Message::getInstance()->addError('Nie możesz wejść jako oglądający');
$this->_redirect($this->_helper->url('index', 'index', null, array(), true));
}

if (!$privateShow['isWatcher'] && !$privateShow['isModerator'])
{
Application_Message::getInstance()->addError('Nie możesz wejść na ten pokaz');
$this->_redirect($this->_helper->url('index', 'index', null, array(), true));
}

$this->view->sessionToken = $privateName;
$this->view->serverName = $this->getServerName();
$this->view->transmissionName = $privateName;
$this->view->isCamToCam = $privateShow['isCamToCam'] == 1;
$this->view->isModerator = $privateShow['isModerator'];
}

public function watchAction()
{
$userName = $this->_getParam('userName');

if (strlen($userName) == 32)
{
$this->_forward('privwatch');
;
}

if (is_null($userName))
{
Application_Message::getInstance()->addError('Niepoprawny użytkownik');
$this->_redirect($this->_helper->url('index', 'index', null, array(), true));
}

//$user->getLoggedUserUserId();
$userMapper = new Application_Model_User();
$user = $userMapper->getUserByLogin($userName);

if (is_null($user))
{
Application_Message::getInstance()->addError('Niepoprawny użytkownik');
$this->_redirect($this->_helper->url('index', 'index', null, array(), true));
}

if (Application_Model_User::staticIsLogged())
{
if (Application_Model_User::staticGetLoggedUserId() == $user['userId'])
{
Application_Message::getInstance()->addError('Nie możesz oglądać własnej transmisji');
$this->_redirect($this->_helper->url('index', 'index', null, array(), true));
}
}

$showMapper = new Application_Model_Show();
$show = $showMapper->getShowByUserName($userName);

if (is_null($show))
{
Application_Message::getInstance()->addError('Użytkownik nie prowadzi w tym momencie transmisji');
$this->_redirect('/index');
}
$showStatus = $showMapper->getStatusForShow($show['showId']);

if (( $showStatus['setting'] & 0x01 ) != 0 && !Application_Model_LoggedUser::isLogged())
{
Application_Message::getInstance()->addError('Transmisja tylko dla zalogowanych użytkowników');
$this->_redirect('/index');
}

$currentTicket = $showMapper->getCurrentTicketForShow($show['showId']);

$staticPage = new Application_Model_StaticPage();

$this->view->privateOptions = $showMapper->getPrivateOptions($show['showId']);
;

$this->view->show = $show;
$this->view->tips = $showMapper->getTipsHistory($show['showId']);
$this->view->descriptionFragment = $staticPage->getStaticFragmentByFragmentName('transmisja_pod_opisem');
$this->view->rulesFragment = $staticPage->getStaticFragmentByFragmentName('chat_regulamin');
$this->view->status = $showStatus;
$this->view->chatTicket = $currentTicket;
$this->view->broadcasterName = $user['userName'];
$this->view->isAdministrator = $user['role'] == 'A';
$this->view->serverName = $this->getServerName();
$this->view->transmissionName = $userName;

// action body
}

public function creditshistoryAction()
{
if (!Application_Model_LoggedUser::isLogged())
{
$this->_redirect($this->_helper->url('register', 'user'));
}

$page = $this->_getParam('page', 1);
$userModel = new Application_Model_User();

$creditsHistory = $userModel->getCreditsHistoryFor(Application_Model_LoggedUser::getUserId(), $page);

$this->view->history = $creditsHistory;
}

public function payoutshistoryAction()
{
if (!Application_Model_LoggedUser::isLogged())
{
$this->_redirect($this->_helper->url('register', 'user'));
}
$page = $this->_getParam('page', 1);
$userModel = new Application_Model_User();

$payoutsHistory = $userModel->getPayoutsHistoryFor(Application_Model_LoggedUser::getUserId(), $page);

$this->view->history = $payoutsHistory;
}

}
]

Awatar użytkownika
BoomBeachDiamond's
Posty: 1
Rejestracja: 26 kwie 2016, 22:21

Re: bład logowania /rejestracji

Post autor: BoomBeachDiamond's » 26 kwie 2016, 22:30

An astounding source of information by this gizmo, grapple here amazing and latest version of boom beach resources generator through how to hack boom beach for boundless activity by upgrading your troops, base, defense for stronger defense and attack by achieving unlimited resources for upgradation and lot more fun to do.

Awatar użytkownika
selenapendergast
Posty: 1
Rejestracja: 05 maja 2016, 13:37

Re: bład logowania /rejestracji

Post autor: selenapendergast » 05 maja 2016, 13:40

It is nice to read your post and you give wonderful information. Please keep posting such kind of informative stuff. Interesting code share and this post is impresses more people to reading that forum post. If you are looking for any writing related help go through with cheap custom writings, you can get better help from the professionals.

ODPOWIEDZ