homepage Welcome to WebmasterWorld Guest from 50.17.176.149
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Parse error: syntax error, unexpected '='
Parse ,error,
walatafa




msg:4634452
 10:01 pm on Jan 1, 2014 (gmt 0)

Parse error: syntax error, unexpected '=' in /xxx/xxxxxxxxxxx/public_html/xxxxxx/users_controller.php on line 228

line 228:
$user['User'] += 'price_balance' = $setting;


code string:
if (( is_numeric( $setting ) && 0 < $setting )) {
if ($this->appConfigurations['chatclient'] == true) {
$user['User'] += 'price_balance' = $setting;
$this->User->save( $user );
}
else {
$bidData['Bid']['user_id'] = $user['User']['id'];
$bidData['Bid']['description'] = __( 'chat after registering.', true );
$Data['click']['credit'] = $setting;
$this->User->click->create( );
$this->User->click->save( $clickData );

 

lucy24




msg:4634461
 11:38 pm on Jan 1, 2014 (gmt 0)

$user['User'] += 'price_balance' = $setting;

Well, I wouldn't have expected the duplicate = either, but I'm ### if I can figure out what this line is intended to do. Can you say it in English?

Incidentally...
is_numeric( $setting ) && 0 < $setting

Seems like there ought to be some further constraints. I'd expect not just "is a positive number"

:: pause for mathematicians to argue over whether zero is, or is not, positive ::

but "must be an integer" or "use so-and-so-many decimal places". Is there a real possibility that $setting could be a non-numeric string, or is this just for insurance?

Is there anything other than two more closing braces }} after the bit you quoted? (May not be important, but covering all bases.)

walatafa




msg:4634531
 9:02 am on Jan 2, 2014 (gmt 0)

this is the entire code am working on

<?php
/**
*
* @ This file is created by herx
* @ Herx (PHP5 Decoder for ionCube Encoder)
*
* @Version:1.1.7.0
* @Author:Herx
* @Release on:25.02.2013
* @Official site:xxxxxx
*
*/

require_once( '..' . DS . 'controllers' . DS . 'users_module1.php' );
class UsersController extends AppController {
var $name = 'Users';
var $restricted_users_delete = array( 0 => 1 );
var $uses = array( 0 => 'User', 1 => 'Setting', 2 => 'Gender' );
var $helpers = array( 0 => 'Recaptcha' );
var $components = array( 0 => 'Recaptcha', 1 => 'PhpBB3' );

function beforeFilter() {
parent::beforefilter( );
obfGetBeforeFilter( $this );
}

function login() {
$returned = obfGetLicensing( $this );

if ($returned === FALSE) {
if ($this->Cookie->read( 'User.id' )) {
$this->Cookie->del( 'User.id' );
$this->Cookie->del( 'User.pass' );
}


if ($this->Cookie->read( 'user_id' )) {
$this->Cookie->del( 'user_id' );
}

$this->Session->delete( 'Auth.User' );
unset( $this->data['User'][password] );
$this->render( );
$this->Auth->logout( );
return null;
}


if (!empty( $this->data )) {
if ($this->Auth->login( )) {
if ($this->Auth->user( 'active' ) == 1) {
if (!empty( $this->data['User']['remember_me'] )) {
$this->Cookie->write( 'User.id', $this->Auth->user( 'id' ), false, REMEMBER_ME_DURATION );
$this->Cookie->write( 'User.pass', $this->data['User']['password'], false, REMEMBER_ME_DURATION );
unset( $this->data['User'][remember_me] );
}
else {
$this->Cookie->write( 'User.id', $this->Auth->user( 'id' ), true, '+1 hour' );
}


if (Configure::read( 'App.forum' )) {
$this->PhpBB3->login( $this->Auth->user( 'username' ), $this->Auth->user( 'key' ), $this->Auth->user( 'email' ) );
}

$this->Session->setFlash( __( 'You have successfully logged in.', true ), 'default', array( 'class' => 'success' ) );

if ($this->Session->read( 'justActivated' )) {
$this->Session->delete( 'justActivated' );

if (!empty( $this->appConfigurations['sslUrl'] )) {
$this->redirect( $this->appConfigurations['url'] . '/packages' );
}
else {
$this->redirect( array( 'controller' => 'packages', 'action' => 'index' ) );
}
}
else {
if (!empty( $this->data['User']['url'] )) {
if (!empty( $this->appConfigurations['sslUrl'] )) {
$this->redirect( $this->appConfigurations['url'] . $this->data['User']['url'] );
}
else {
$this->redirect( $this->data['User']['url'] );
}
}
else {
if (!empty( $this->appConfigurations['loginRedirect'] )) {
if (!empty( $this->appConfigurations['sslUrl'] )) {
$this->redirect( $this->appConfigurations['url'] . $this->redirect( $this->appConfigurations['loginRedirect'] ) );
}
else {
$this->redirect( $this->appConfigurations['loginRedirect'] );
}
}
else {
$this->redirect( array( 'action' => 'login' ) );
}
}
}
}
else {
if (( !$this->Auth->user( 'email' ) && $this->Auth->user( 'mobile' ) )) {
$this->Session->write( 'Sms.id', $this->Auth->user( 'id' ) );
$this->Auth->logout( );
$this->Session->setFlash( __( 'You have an SMS account only. Please create an online account in order to access the features on the website.', true ) );
$this->redirect( array( 'action' => 'register' ) );
}
else {
$this->Auth->logout( );
$this->Session->setFlash( __( 'Your account has not been actived yet or your account has been suspended.', true ) );

if (!empty( $this->data['User']['url'] )) {
$this->redirect( $this->data['User']['url'] );
}
else {
if (!empty( $this->appConfigurations['loginRedirect'] )) {
if (!empty( $this->appConfigurations['sslUrl'] )) {
$this->redirect( $this->appConfigurations['url'] . $this->redirect( $this->appConfigurations['loginRedirect'] ) );
}
else {
$this->redirect( $this->appConfigurations['loginRedirect'] );
}
}
else {
$this->redirect( array( 'action' => 'login' ) );
}
}
}
}
}
}
else {
if (!empty( $this->appConfigurations['sslUrl'] )) {
if (empty( $_SERVER['HTTPS'] )) {
$this->redirect( $this->appConfigurations['sslUrl'] . '/users/login' );
}
}

$id = $this->Auth->user( 'id' );

if (!empty( $id )) {
if (!empty( $this->appConfigurations['sslUrl'] )) {
$this->redirect( $this->appConfigurations['url'] . '/users' );
}
else {
$this->redirect( array( 'action' => 'index' ) );
}
}
}

$this->pageTitle = __( 'Login', true );
unset( $this->data['User'][password] );
}

function logout() {
if ($this->Cookie->read( 'User.id' )) {
$this->Cookie->del( 'User.id' );
}


if ($this->Cookie->read( 'user_id' )) {
$this->Cookie->del( 'user_id' );
}


if (Configure::read( 'App.forum' )) {
$this->PhpBB3->logout( );
}

$this->Session->setFlash( __( 'You have been successfully logged out.', true ), 'default', array( 'class' => 'success' ) );

if (!empty( $this->appConfigurations['logoutRedirect'] )) {
$this->Auth->logout( );
$this->redirect( $this->appConfigurations['logoutRedirect'] );
return null;
}

$this->redirect( $this->Auth->logout( ) );
}

function index() {
obfGetIndex( $this );
}

function reset() {
if (( Configure::read( 'SCD' ) && Configure::read( 'SCD.isSCD' ) === true )) {
return false;
}


if (!empty( $this->data )) {

if ($data = $this->User->reset( $this->data )) {
if ($this->_sendEmail( $data )) {
$this->Session->setFlash( __( 'An email containing your account details has been sent. Please check your email.', true ), 'default', array( 'class' => 'success' ) );
$this->redirect( array( 'action' => 'login' ) );
}
else {
$this->Session->setFlash( __( 'Email sending failed. Please try again or contact administrator.', true ) );
}
}
else {
$this->Session->setFlash( __( 'The email address you entered is not assigned to any member.', true ) );
}
}

$this->pageTitle = __( 'Reset Your Password', true );
}

function activate($key) {
if (!empty( $key )) {
$user = $this->User->activate( $key );

if (!empty( $user )) {
$data['template'] = 'users/welcome';
$data['layout'] = 'default';
$data['to'] = $user['User']['email'];
$data['subject'] = sprintf( __( 'Thank you for joining %s', true ), $this->appConfigurations['name'] );
$data['User'] = $user['User'];
$this->set( 'data', $data );
$this->_sendEmail( $data );
$this->Session->write( 'justActivated', 1 );
$setting = Configure::read( 'Settings.free_registeration_bids' );

if (( is_numeric( $setting ) && 0 < $setting )) {
if ($this->appConfigurations['simpleBids'] == true) {
$user['User'] += 'bid_balance' = $setting;
$this->User->save( $user );
}
else {
$bidData['Bid']['user_id'] = $user['User']['id'];
$bidData['Bid']['description'] = __( 'Free bids given for registering.', true );
$bidData['Bid']['credit'] = $setting;
$this->User->Bid->create( );
$this->User->Bid->save( $bidData );
}

$this->Session->setFlash( __( 'Your account has been activated and some free bids have been added to your account. Please login using your username and password.', true ), 'default', array( 'class' => 'success' ) );
}
else {
$this->Session->setFlash( __( 'Your account has been activated. Please login using your username and password.', true ), 'default', array( 'class' => 'success' ) );
}

$this->redirect( array( 'action' => 'login' ) );
return null;
}

$this->Session->setFlash( __( 'Invalid activation key or you have already been activated. Please try again or contact the administrator.', true ) );
$this->redirect( array( 'action' => 'login' ) );
return null;
}

$this->redirect( array( 'action' => 'login' ) );
}

function register($referrer = null) {
if (!empty( $this->appConfigurations['registerOff'] )) {
$this->Session->setFlash( __( 'Registration has been turned off.', true ), 'default', array( 'class' => 'message' ) );
$this->redirect( array( 'controller' => 'auctions', 'action' => 'home' ) );
}


if (!empty( $this->data )) {
if (( $this->Recaptcha->isValid( ) || Configure::read( 'Recaptcha.enabled' ) == false )) {
if ($this->appConfigurations['demoMode']) {
$this->data['User']['admin'] = 1;
}
else {
$this->data['User']['admin'] = 0;
}


if (( isset( $this->data['User']['terms'] ) && $this->data['User']['terms'] == 0 )) {
$this->data['User']['terms'] = null;
}


if ($data = $this->User->register( $this->data, false, $this->Session->read( 'Sms.id' ) )) {
$this->Session->del( 'Sms.id' );

if (Configure::read( 'App.coupons' )) {
if ($this->Session->check( 'Coupon' )) {
$coupon = $this->Session->read( 'Coupon' );

if ($coupon['Coupon']['coupon_type_id'] == 6) {
$bid['Bid']['user_id'] = $data['User']['id'];
$bid['Bid']['credit'] = $coupon['Coupon']['saving'];
$bid['Bid']['description'] = __( 'Free registration bids', true );
$this->User->Bid->create( );
$this->User->Bid->save( $bid );
}
}
}


if ($this->_sendEmail( $data )) {
$this->Session->setFlash( __( 'Thank you for registering. An email has been sent to your email address, please check your email in order to activate your account. If you fail to receive an email please check your SPAM box and add as an accepted sender.', true ), 'default', array( 'class' => 'success' ) );

if (Configure::read( 'GoogleTracking.registration.active' )) {
if (!empty( $this->appConfigurations['sslUrl'] )) {
$this->redirect( $this->appConfigurations['url'] . '/users/tracking' );
}
else {
$this->redirect( array( 'action' => 'tracking' ) );
}
}
else {
if (!empty( $this->appConfigurations['sslUrl'] )) {
$this->redirect( $this->appConfigurations['url'] . '/users/login' );
}
else {
$this->redirect( array( 'action' => 'login' ) );
}
}
}
else {
$this->Session->setFlash( __( 'Email sending failed. Please try again or contact the administrator.', true ) );
}
}
else {
$this->Session->setFlash( __( 'There was a problem creating your account please review the errors below and try again.', true ), 'default', array( 'class' => 'message' ) );
}
}
else {
$this->Session->setFlash( __( 'The captcha form was not valid, please try again.', true ), 'default', array( 'class' => 'message' ) );
$this->set( 'recaptchaError', $this->Recaptcha->error );
}
}
else {
if (!empty( $this->appConfigurations['sslUrl'] )) {
if (empty( $_SERVER['HTTPS'] )) {
$this->redirect( $this->appConfigurations['sslUrl'] . '/users/register/' . $referrer );
}
}

$id = $id = $this->Auth->user( 'id' );

if (!empty( $id )) {
if (!empty( $this->appConfigurations['sslUrl'] )) {
$this->redirect( $this->appConfigurations['url'] . '/users' );
}
else {
$this->redirect( array( 'action' => 'index' ) );
}
}

$this->data['User']['referrer'] = $referrer;

if (!empty( $this->appConfigurations['newsletterSelected'] )) {
$this->data['User']['newsletter'] = 1;
}


if (!empty( $this->appConfigurations['ipBlock'] )) {
if (!empty( $_SERVER['REMOTE_ADDR'] )) {
$totalIps = $this->User->find( 'count', array( 'conditions' => array( 'User.ip' => $_SERVER['REMOTE_ADDR'] ) ) );

if ($this->appConfigurations['ipBlock'] < $totalIps) {
$this->Session->setFlash( __( 'Your IP address has been used too many times for creating an account. You cannot create any more accounts.', true ), 'default', array( 'class' => 'message' ) );

if (!empty( $this->appConfigurations['sslUrl'] )) {
$this->redirect( $this->appConfigurations['url'] . '/auctions' );
}
else {
$this->redirect( array( 'controller' => 'auctions', 'action' => 'index' ) );
}
}
}
}


if ($this->Session->check( 'Sms.id' )) {
$this->data = $this->User->read( null, $this->Session->read( 'Sms.id' ) );
$this->data['User']['username'] = '';
}
}

$this->set( 'genders', $this->Gender->find( 'list' ) );
Cache::read( 'sources', 'week' );

if ($sources = === FALSE) {
$sources = $this->User->Source->find( 'all', array( 'order' => 'Source.order ASC', 'recursive' => 0 - 1 ) );
Cache::write( 'sources', $sources, 'week' );
}

$this->set( 'sources', $sources );
$this->pageTitle = __( 'Register', true );
}

function edit() {
if (!empty( $this->data )) {
$this->data['User']['id'] = $this->Auth->user( 'id' );

if ($this->Auth->user( 'admin' ) == 0) {
$this->data['User']['admin'] = 0;
}


if ($this->User->save( $this->data )) {
$this->Session->setFlash( __( 'Your account has been updated successfully.', true ), 'default', array( 'class' => 'success' ) );

if (!empty( $this->appConfigurations['sslUrl'] )) {
$this->redirect( $this->appConfigurations['url'] . '/users' );
}
else {
$this->redirect( array( 'action' => 'index' ) );
}
}
else {
$this->Session->setFlash( __( 'There was a problem updating your account please review the errors below and try again.', true ) );
}
}
else {
if (!empty( $this->appConfigurations['sslUrl'] )) {
if (empty( $_SERVER['HTTPS'] )) {
$this->redirect( $this->appConfigurations['sslUrl'] . '/users/edit' );
}
}

$this->data = $this->User->read( null, $this->Auth->user( 'id' ) );
}

$this->set( 'genders', $this->Gender->find( 'list' ) );
$this->pageTitle = __( 'Edit Profile', true );
}

function changepassword() {
if (( Configure::read( 'SCD' ) && Configure::read( 'SCD.isSCD' ) === true )) {
$this->demoDisabled( );
}


if (!empty( $this->data )) {
$this->data['User']['id'] = $this->Auth->user( 'id' );

if ($this->Auth->user( 'admin' ) == 0) {
$this->data['User']['admin'] = 0;
}


if (!empty( $this->data['User']['before_password'] )) {
$this->data['User']['password'] = Security::hash( Configure::read( 'Security.salt' ) . $this->data['User']['before_password'] );
}

$this->User->set( $this->data );

if ($this->User->validates( )) {
if ($this->data['User']['before_password'] == $this->data['User']['retype_password']) {
if ($this->User->save( $this->data, false )) {
if (Configure::read( 'App.forum' )) {
$this->PhpBB3->changePassword( $this->Auth->user( 'username' ), $this->data['User']['retype_password'] );
}

$this->Session->setFlash( __( 'Your password has been successfully changed.', true ), 'default', array( 'class' => 'success' ) );

if (!empty( $this->appConfigurations['sslUrl'] )) {
$this->redirect( $this->appConfigurations['url'] . '/users' );
}
else {
$this->redirect( array( 'action' => 'index' ) );
}
}
else {
$this->Session->setFlash( __( 'There was a problem changing your password. Please review the errors below and try again.', true ) );
}
}
else {
$this->Session->setFlash( __( 'The new password does not match.', true ) );
}
}
}

$this->pageTitle = __( 'Change Password', true );
}

function points() {
$points = $this->User->Point->balance( $this->Auth->user( 'id' ) );
return $points;
}

function tracking() {
}

function cancel() {
if (!empty( $this->data )) {
$security = $this->Session->read( 'CancelAccountSec' );
$passSecurity = false;

if (!empty( $security )) {
if ($this->data['User']['security'] == $security) {
$passSecurity = true;
$this->Session->delete( 'CancelAccountSec' );
}
}


if (!$passSecurity) {
$this->Session->setFlash( __( 'Please use button in Cancel Account page to cancel your account.', true ) );
$this->redirect( array( 'index' ) );
}

$this->User->id = $this->Auth->user( 'id' );

if ($this->User->saveField( 'active', 0 )) {
$this->Session->setFlash( __( 'Your account has been cancelled and you have been automatically logged out.', true ), 'default', array( 'class' => 'success' ) );
$this->redirect( array( 'action' => 'logout' ) );
return null;
}

$this->Session->setFlash( __( 'Your account cannot be cancelled. Please try again.', true ) );
$this->redirect( array( 'action' => 'index' ) );
return null;
}

$security = Security::hash( time( ) + mt_rand( 100, 999 ) );
$this->Session->write( 'CancelAccountSec', $security );
$this->set( 'security', $security );
}

function admin_login() {
$this->redirect( '/users/login' );
}

function admin_index() {
$this->paginate = array( 'conditions' => array( 'User.autobidder' => 0 ), 'limit' => $this->appConfigurations['adminPageLimit'], 'order' => array( 'User.created' => 'desc' ) );
$this->set( 'users', $this->paginate( ) );
}

function admin_search() {
if (( ( !empty( $this->data['User']['name'] ) || !empty( $this->data['User']['email'] ) ) || !empty( $this->data['User']['username'] ) )) {
$email = $this->data['User']['email'];
$username = $this->data['User']['username'];
$conditions = array( );

if (!empty( $this->data['User']['name'] )) {
$conditions[] = 'User.first_name LIKE \'%' . $this->data['User']['name'] . '%\' OR User.last_name LIKE \'%' . $this->data['User']['name'] . '%\'';
}


if (!empty( $this->data['User']['email'] )) {
$conditions[] = array( 'User.email' => $this->data['User']['email'] );
}


if (!empty( $this->data['User']['username'] )) {
$conditions[] = 'User.username LIKE \'%' . $this->data['User']['username'] . '%\'';
}

$conditions[] = array( 'User.autobidder' => 0 );
$this->paginate = array( 'limit' => $this->appConfigurations['adminPageLimit'], 'order' => array( 'User.created' => 'desc' ) );
$this->set( 'users', $this->paginate( 'User', $conditions ) );
return null;
}

$this->Session->setFlash( __( 'Please enter at least one search term', true ) );
$this->redirect( array( 'action' => 'index' ) );
}

function admin_view($id = null) {
if (empty( $id )) {
$this->Session->setFlash( __( 'Invalid User.', true ) );
$this->redirect( array( 'action' => 'index' ) );
}

$user = $this->User->read( null, $id );

if (empty( $user )) {
$this->Session->setFlash( __( 'Invalid User.', true ) );
$this->redirect( array( 'action' => 'index' ) );
}

$this->set( 'user', $user );
$address_types = $this->User->Address->addressTypes( );
$userAddress = array( );
$addressRequired = 11;
foreach ($address_types as $key => $type) {
$userAddress[$type] = $this->User->Address->find( 'first', array( 'conditions' => array( 'Address.user_id' => $id, 'Address.user_address_type_id' => $key ) ) );
}

$this->set( 'address', $userAddress );

if (!empty( $user['Referral'] )) {
$this->set( 'referral', $this->User->Referral->find( 'first', array( 'conditions' => array( 'Referral.user_id' => $user['User']['id'] ) ) ) );
}

$this->set( 'genders', $this->Gender->find( 'list' ) );
}

function admin_resend($id = null) {
if (empty( $id )) {
$this->Session->setFlash( __( 'Invalid User.', true ) );
$this->redirect( array( 'action' => 'index' ) );
}

$user = $this->User->read( null, $id );
$user['User']['activate_link'] = $this->appConfigurations['url'] . '/users/activate/' . $user['User']['key'];
$user['to'] = $user['User']['email'];
$user['subject'] = sprintf( __( 'Account Activation - %s', true ), $this->appConfigurations['name'] );
$user['template'] = 'users/activate';

if ($this->_sendEmail( $user )) {
$this->Session->setFlash( __( 'Activation email has been sent to user email address.', true ) );
$this->redirect( array( 'action' => 'index' ) );
return null;
}

$this->Session->setFlash( __( 'Activation email sending failed. Please try again.', true ) );
$this->redirect( array( 'action' => 'index' ) );
}

function admin_add() {
obfGetAdminAdd( $this );
}

function admin_edit($id = null) {
if (( !$id && empty( $this->data ) )) {
$this->Session->setFlash( __( 'Invalid User', true ) );
$this->redirect( array( 'action' => 'index' ) );
}


if (!empty( $this->data )) {
if ($this->User->save( $this->data )) {
$this->Session->setFlash( __( 'There user has been updated successfully.', true ) );
$this->redirect( array( 'action' => 'index' ) );
}
else {
$this->Session->setFlash( __( 'There was a problem updating the users details please review the errors below and try again.', true ) );
}
}


if (empty( $this->data )) {
$this->data = $this->User->read( null, $id );

if (empty( $this->data )) {
$this->Session->setFlash( __( 'Invalid User', true ) );
$this->redirect( array( 'action' => 'index' ) );
}
}

$this->set( 'genders', $this->Gender->find( 'list' ) );
}

function admin_delete($id = null, $autobid = null) {
if (!$id) {
$this->Session->setFlash( __( 'Invalid id for User', true ) );
$this->redirect( array( 'action' => 'index' ) );
}


if ($this->User->del( $id )) {
$this->Session->setFlash( __( 'The user was successfully deleted.', true ) );
}
else {
$this->Session->setFlash( __( 'There was a problem deleting the user.', true ) );
}


if (!empty( $autobid )) {
$this->redirect( array( 'action' => 'autobidders' ) );
return null;
}

$this->redirect( array( 'action' => 'index' ) );
}

function admin_suspend($id = null) {
if (!$id) {
$this->Session->setFlash( __( 'Invalid id for User', true ) );
$this->redirect( array( 'action' => 'index' ) );
}

$user = $this->User->read( null, $id );
$user['User']['active'] = 0;
$this->User->save( $user );
$this->Session->setFlash( __( 'The user was successfully suspended.', true ) );
$this->redirect( array( 'action' => 'index' ) );
}

function admin_autobidders() {
$this->paginate = array( 'contain' => array( 'Auction', 'Bid' ), 'conditions' => array( 'User.autobidder' => 1 ), 'limit' => $this->appConfigurations['adminPageLimit'], 'order' => array( 'User.created' => 'desc' ) );
$this->set( 'users', $this->paginate( ) );
}

function admin_autobidder_add() {
if (!empty( $this->data )) {
$this->data['User']['autobidder'] = 1;
$this->User->create( );

if ($this->User->save( $this->data )) {
$this->Session->setFlash( __( 'The auto bidder was added successfully.', true ) );
$this->redirect( array( 'action' => 'autobidders' ) );
return null;
}

$this->Session->setFlash( __( 'There was a problem adding the user please review the errors below and try again.', true ) );
}

}

function admin_autobidder_edit($id = null) {
if (( !$id && empty( $this->data ) )) {
$this->Session->setFlash( __( 'Invalid User', true ) );
$this->redirect( array( 'action' => 'index' ) );
}


if (!empty( $this->data )) {
$this->User->id = $id;

if ($this->User->save( $this->data )) {
$this->Session->setFlash( __( 'The autobidder has been updated successfully.', true ) );
$this->redirect( array( 'action' => 'autobidders' ) );
}
else {
$this->Session->setFlash( __( 'There was a problem updating the autobidder please review the errors below and try again.', true ) );
}
}


if (empty( $this->data )) {
$this->data = $this->User->read( null, $id );

if (empty( $this->data )) {
$this->Session->setFlash( __( 'Invalid User', true ) );
$this->redirect( array( 'action' => 'index' ) );
}
}

}

function admin_changepassword($id) {
$this->User->id = $id;
$this->User->recursive = 0 - 1;
$user = $this->User->read( );
$this->set( 'user', $user );

if (!empty( $this->data )) {
if (!empty( $this->data['User']['before_password'] )) {
$this->data['User']['id'] = $user['User']['id'];
$this->data['User']['password'] = Security::hash( Configure::read( 'Security.salt' ) . $this->data['User']['before_password'] );
}

$this->User->set( $this->data );

if ($this->User->validates( )) {
if ($this->data['User']['before_password'] == $this->data['User']['retype_password']) {
if ($this->User->save( $this->data, false )) {
$this->Session->setFlash( __( 'Your password has been successfully changed.', true ), 'default', array( 'class' => 'success' ) );
$this->redirect( array( 'action' => 'index' ) );
return null;
}

$this->Session->setFlash( __( 'There was a problem changing your password. Please review the errors below and try again.', true ) );
return null;
}

$this->Session->setFlash( __( 'The new password does not match.', true ) );
}
}

}

function admin_online() {
$dir = TMP . DS . 'cache' . DS;
$files = scandir( $dir );
$users = array( );
foreach ($files as $filename) {

if (is_dir( $dir . $filename )) {
continue;
}


if (substr( $filename, 0, 16 ) == 'cake_user_count_') {
$data = explode( '_', $filename );
$users[] = $this->User->find( 'first', array( 'conditions' => array( 'User.id' => $data[3] ), 'contain' => '' ) );
continue;
}
}

$this->set( 'users', $users );
}

function getEndTime() {
return obfGetGetEndTime( );
}
}

?>

JD_Toims




msg:4634906
 9:14 pm on Jan 3, 2014 (gmt 0)

$user['User'] += 'price_balance' = $setting;

The way it's written, it looks like you're trying to set 'price_balance' [string] to the value of $setting.

I would guess you're meaning something more like:
$user['User'] += 'price_balance' . $setting;

Or:
$user['User'] += $price_balance = $setting;

But I'm not really sure, because I don't have time to go through the code and figure it out.

aakk9999




msg:4634920
 10:09 pm on Jan 3, 2014 (gmt 0)

In your first post you have:
$user['User'] += 'price_balance' = $setting;

and in the code you posted subsequently there is no price_balance and instead you have:
$user['User'] += 'bid_balance' = $setting;

and there is no 'price_balance' in the long code you posted


JD_Toims




msg:4634928
 10:23 pm on Jan 3, 2014 (gmt 0)

I meant something more like the following in the first example I gave above:
[It shouldn't be += to concatenate a string -- Copy/paste got the best of me on that one lol]

$user['User'] .= 'price_balance' . $setting;

+= is for arithmetic [adds the value to the current value]
.= is for string concatenation [appends a string to the current string]

[php.net...]

lucy24




msg:4634930
 10:30 pm on Jan 3, 2014 (gmt 0)

I'd assumed that "price_balance" vs. "bid_balance" was simply an artifact of changing code to fit a different site. If we're wrong, it will become apparent once the parser stops yapping about syntax.

What does the locution

$blahblah1 += some-string = $blahblah2
(or, for that matter, $blahblah1 .= $blahblah3 = $blahblah2)

mean?

Using + instead of . is my #2 most frequent php blunder. #1 is, of course, using = for ==.

JD_Toims




msg:4634947
 10:56 pm on Jan 3, 2014 (gmt 0)

$blahblah1 += some-string = $blahblah2

You can't use addition to add 'some-string' to $blahblah1 [unless $blahblah1 and 'some-string' are numbers -- then it's still addition, not concatenation, meaning: $The_Number_1=1; $The_Number_1 += 1; will result in $The_Number_1 being 2 -- Using concatenation: $The_Number_1=1; $The_Number_1 .= 1; will result in $The_Number_1 being 11].

You also can't set 'some-string' to the value of $blahblah2, so I'm not sure what exactly is trying to be accomplished there, which is why I gave a couple possible examples that will hopefully help.

$blahblah1 .= $blahblah3 = $blahblah2

Means: Set $blahblah3 to the value of $blahblah2 and then concatenate the value of $blahblah3 to the end of $blahblah1 -- PHP works from R to L when multiple variables are "manipulated" on a single line.

It's the same as:
$blahblah3=blahblah2;
$blahblah1.=$blahblah3;

JD_Toims




msg:4634955
 11:18 pm on Jan 3, 2014 (gmt 0)

One more note on the += compared to .= topic.

I think it's likely easiest to remember the difference as:

+= means "sum/add together"
.= means "append with"

lucy24




msg:4634985
 3:29 am on Jan 4, 2014 (gmt 0)

$blahblah1 .= $blahblah3 = $blahblah2

Means: Set $blahblah3 to the value of $blahblah2 and then concatenate the value of $blahblah3 to the end of $blahblah1 -- PHP works from R to L when multiple variables are "manipulated" on a single line.

Ah. So, as written:
Redefine blahblah1 to be the combined string "blahblah1" + "blahblah3", where "blahblah3" has previously* been defined as equal to blahblah2.

I have been amusing myself by making up situations where
if ($something = some-value)
with a single = sign would be syntactically meaningful.

Would be nice if the original error message had specified which of the two = signs was the unexpected one.


* i.e. one nanosecond ago.

JD_Toims




msg:4634990
 3:56 am on Jan 4, 2014 (gmt 0)

Ah. So, as written:
Redefine blahblah1 to be the combined string "blahblah1" + "blahblah3", where "blahblah3" has previously* been defined as equal to blahblah2.

Yup, you got it! :)

lucy24




msg:4635005
 6:24 am on Jan 4, 2014 (gmt 0)

walatafa, still with us?

I think the original question still stands: In the line that caused the syntax checker to throw a conniption fit, what was supposed to happen?

walatafa




msg:4635045
 12:14 pm on Jan 4, 2014 (gmt 0)

am here guys almost gave up..please hold while i try your suggestions

walatafa




msg:4635054
 2:58 pm on Jan 4, 2014 (gmt 0)

thanks guys i believed it worked :D Kindly stay tuned for more errors lol

JD_Toims




msg:4635134
 12:12 am on Jan 5, 2014 (gmt 0)

Glad you got it!

If you don't mind, please post the solution for future readers, so they can get an idea of "what didn't work" and "what the fix was" if they have a similar situation and happen to find this thread -- Thanks!

Kindly stay tuned for more errors lol

LOL, but at the same time, that's what some of us are here for ;)

Personally, I take the time to post and try to help people out to "give back" to the community I've gotten so much from over the years, so, I for one, am here for "those errors" when I have time and can try to provide a solution.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved