Jump to content

Recommended Posts

Hi all,

 

I am trying to print value in a PHP statement for debug purpose but it gives the following error.

 

 

Parse error: syntax error, unexpected T_VAR in C:\xampp\htdocs\onushondhan\core\SMSEventProcessHelper.php on line 49

 

Here is the PHP code. Thanks in advance for your help.

 

-- Shehab

 

<?php

include_once('types/SMSEventOutput.php');

include_once('types/SMSEventInput.php');

include_once('types/SMSEventVO.php');

include_once('core/ActionHelper.php');

include_once('datamodel/DataModel0001.php');

 

 

 

class SMSEventProcessHelper extends ActionHelper{

private $smsEventInput;

private $smsEventOutput;

private $smsEventVO;

 

/* Incoming message id */

private $incomingMessageId;

/* Mobile number */

private $mobileNumber;

/* Original message */

private $message;

/* Security code */

private $securityCode;

 

function __construct(SMSEventInput $smsEventInput){

$this->smsEventInput = $smsEventInput;

} // End of constructor

 

 

function init(){

// Setting the instance variables

$this->smsEventVO = $this->smsEventInput->smsEventVO;

$this->incomingMessageId = $this->smsEventVO->$incomingMessageId;

$this->mobileNumber = $this->smsEventVO->$mobileNumber;

$this->message = $this->smsEventVO->$message;

$this->securityCode = $this->smsEventVO->$securityCode;

} // End of init()

 

function preValidate(){

echo "\nSMSEventProcessHelper.preValidate() starts";

// Checking if the incoming message id is in valid format

// Yet to get the pre-validation scheme from MuthoFun

 

// Checking if the mobile number is in valid format

// Checking if the number is 11 digits long

echo "\nSMSEventProcessHelper.preValidate() '$this->mobileNumber'";

if(strlen($this->mobileNumber) != 13){

$smsEventOutput->returnCode = SMSEventOutput::$RETURN_CODE_PHONE_NUMBER_LENGTH_ERROR;

echo "\nSMSEventProcessHelper.preValidate() RETURN_CODE_PHONE_NUMBER_LENGTH_ERROR";

var $length = strlen($this->mobileNumber);

echo "\nThe length".$length;

return false;

}

 

// Checking if the number starts with 880

if(strcmp(substr($this->mobileNumber, 0, 3), "880") != 0){

$smsEventOutput->returnCode = SMSEventOutput::$RETURN_CODE_PHONE_NUMBER_COUNTRY_CODE_ERROR;

echo "\nSMSEventProcessHelper.preValidate() RETURN_CODE_PHONE_NUMBER_COUNTRY_CODE_ERROR";

return false;

}

// Checking if the message is in correct format

if(strlen($this->message) < 7){

$smsEventOutput->returnCode = SMSEventOutput::$RETURN_CODE_ZERO_MESSAGE_LENGTH_ERROR;

echo "\nSMSEventProcessHelper.preValidate() RETURN_CODE_ZERO_MESSAGE_LENGTH_ERROR";

return false;

}

 

// Checking if the security code is in valid format

if($this->securityCode != SMSEventVO::$securityCode){

$smsEventOutput->returnCode = SMSEventOutput::$RETURN_CODE_WRONG_SECURITY_CODE_ERROR;

echo "\nSMSEventProcessHelper.preValidate() RETURN_CODE_WRONG_SECURITY_CODE_ERROR";

return false;

}

 

echo "\nSMSEventProcessHelper.preValidate() success";

} // End of preValidate()

 

 

function validate(){

// Check if it is a meaningful sms

$tempString = substr($this->mobileNumber, 0, 7);

 

// Define headers

$tempUserRegSMSHeader = "BLD REG";

$tempUserReqSMSHeaderAPositive = "BLD A+ ";

$tempUserReqSMSHeaderANegative = "BLD A- ";

$tempUserReqSMSHeaderBPositive = "BLD B+ ";

$tempUserReqSMSHeaderBNegative = "BLD B- ";

$tempUserReqSMSHeaderABPositive = "BLD AB+";

$tempUserReqSMSHeaderABNegative = "BLD AB-";

$tempUserReqSMSHeaderOPositive = "BLD O+";

$tempUserReqSMSHeaderONegative = "BLD O-";

 

if(strcmp($tempString, $tempUserRegSMSHeader) != 0 && strcmp($tempString, $tempUserReqSMSHeaderAPositive) != 0 && strcmp($tempString, $tempUserReqSMSHeaderANegative) != 0 && strcmp($tempString, $tempUserReqSMSHeaderBPositive) != 0 && strcmp($tempString, $tempUserReqSMSHeaderBNegative) != 0 && strcmp($tempString, $tempUserReqSMSHeaderABPositive) != 0 && strcmp($tempString, $tempUserReqSMSHeaderABNegative) != 0 && strcmp($tempString, $tempUserReqSMSHeaderOPositive) != 0 && strcmp($tempString, $tempUserReqSMSHeaderONegative) != 0){

$smsEventOutput->returnCode = SMSEventOutput::$RETURN_CODE_INVALID_KEYWORDS_ERROR;

return false;

}

} // End of validate()

 

function loadInternalObjects(){

 

} // End of loadInternalObjects

 

function executeHelper(){

echo "\nSMSEventProcessHelper.executeHelper() starts";

$returnMessage = "";

 

$returnMessagePrefix = "";

$returnMessageSuffix = "Powered by Onushondhan.";

$errorMessage = "This service is not available. Thanks!";

$newLine = "\n";

$whiteSpace = " ";

$colon = ":";

 

$this->init();

if($this->preValidate() == false){

if($smsEventOutput->returnCode == SMSEventOutput::$RETURN_CODE_PHONE_NUMBER_LENGTH_ERROR){

$returnMessage = $returnMessage . "Phone number length should be 11.";

} else if($smsEventOutput->returnCode == SMSEventOutput::$RETURN_CODE_PHONE_NUMBER_COUNTRY_CODE_ERROR){

$returnMessage = $returnMessage . "Sorry! Now we are not accepting SMS from overseas network.";

} else if($smsEventOutput->returnCode == SMSEventOutput::$RETURN_CODE_ZERO_MESSAGE_LENGTH_ERROR){

$returnMessage = $returnMessage . "Sorry! Now we are not accepting SMS from overseas network.";

} else if($smsEventOutput->returnCode == SMSEventOutput::$RETURN_CODE_WRONG_SECURITY_CODE_ERROR){

$returnMessage = $returnMessage . "Oops security code doesn't match!";

}

} else  if(validate() == false){

if($smsEventOutput->returnCode == SMSEventOutput::$RETURN_CODE_INVALID_KEYWORDS_ERROR){

$returnMessage = $returnMessage . "Type help to know the correct keywords.";

}

} else {

$smsEventOutput->returnCode = SMSEventOutput::$RETURN_CODE_SMS_EVENT_SUCCESSFUL;

loadInternalObjects();

// Seperate the message header

$subMessage = substr($message, 0, 7);

// Make it lower case

$subMessage = strtolower($subMessage);

 

 

 

switch ($subMessage) {

case "bld adm":

$dataModel = new DataModel001();

$dataModel->execute();

    $returnMessage = $returnMessage . "You are an admin I see.";

    break;

case "bld reg":

    $returnMessage = $returnMessage . "Thanks for your interest. Check back later to register.";

    break;

case "bld edt":

    $returnMessage = $returnMessage . "We are yet to allow you to edit.";

break;

case "bld a+ ":

    $returnMessage = $returnMessage . "Dear A+ Owner, please have some more patience.";

break;

case "bld a- ":

    $returnMessage = $returnMessage . "Dear A- Owner, please have some more patience.";

break;

case "bld b+ ":

    $returnMessage = $returnMessage . "Dear B+ Owner, please have some more patience.";

break;

case "bld b- ":

    $returnMessage = $returnMessage . "Dear B- Owner, please have some more patience.";

break;

case "bld ab+":

    $returnMessage = $returnMessage . "Dear AB+ Owner, please have some more patience.";

break;

case "bld ab-":

    $returnMessage = $returnMessage . "Dear AB- Owner, please have some more patience.";

break;

case "bld o+":

    $returnMessage = $returnMessage . "Dear O+ Owner, please have some more patience.";

break;

case "bld o-":

    $returnMessage = $returnMessage . "Dear O- Owner, please have some more patience.";

break;

   

} // Switch ends

 

}// Else clause completes

 

$returnMessage = $returnMessagePrefix . $whiteSpace . $returnMessage . $whiteSpace . $colon . $colon . $returnMessageSuffix;

$smsEventOutput->message = $returnMessage;

$smsEventOutput->outMessageId = 1;

$smsEventOutput->outMessageId = 1;

$smsEventOutput->targetMobileNumber = $this->mobileNumber;

$smsEventOutput->incomingMessageId = $this->incomingMessageId;

$smsEventOutput->messageType = 4;

$smsEventOutput->securityCode = $this->securityCode;

 

return $smsEventOutput;

}// End of execute helper

 

 

 

 

function addTransaction(){

 

}

 

 

 

function processAdminSMS(SMSEventVO $smsEventVO){

 

}

} // SMSEventProcessHelper

 

?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.