Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. You'll need 64-bit because 32-bit only supports integers up to 2.1B (10 digits). If you need integers up to 15 digits then you must use 64-bit. Try that and see if it fixes your problem. I'm not sure it will.
  3. no i don't think that is a SOAP problem, yeah actually i have a really hard time figuring out what's wrong, the value is: define('M2M_MSISDN', 447817814149); it should give a filter exception when it's something like -447817814149 i am not sure about the 64-bit i am using XAMPP which i think is using 32-bit
  4. Okay, so this isn't actually a SOAP problem then? It seems all the code you need to see is there. Are you having a problem finding out what's wrong? What's the value of M2M_MSISDN? You're definitely running 64-bit PHP?
  5. i did that but is seems i get these errors when i try and put some random data in: Fail: C:\xampp\htdocs\gotmad\test\application/controllers/helpers\TestDatabaseWrapper.php -> TestDatabaseWrapper -> testQueryBoardStatus -> Identical expectation [String: ON] fails with [String: OFF] at character 1 with [ON] and [OFF] at [C:\xampp\htdocs\gotmad\test\application\controllers\helpers\TestDatabaseWrapper.php line 40]Fail: C:\xampp\htdocs\gotmad\test\application/controllers/helpers\TestDatabaseWrapper.php -> TestDatabaseWrapper -> testQueryBoardStatus -> Identical expectation [String: ON] fails with [String: OFF] at character 1 with [ON] and [OFF] at [C:\xampp\htdocs\gotmad\test\application\controllers\helpers\TestDatabaseWrapper.php line 41]Fail: C:\xampp\htdocs\gotmad\test\application/controllers/helpers\TestDatabaseWrapper.php -> TestDatabaseWrapper -> testQueryBoardStatus -> Identical expectation [String: ON] fails with [String: OFF] at character 1 with [ON] and [OFF] at [C:\xampp\htdocs\gotmad\test\application\controllers\helpers\TestDatabaseWrapper.php line 43]Fail: C:\xampp\htdocs\gotmad\test\application/controllers/helpers\TestDatabaseWrapper.php -> TestDatabaseWrapper -> testQueryBoardStatus -> Identical expectation [String: FORWARD] fails with [String: REVERSE] at character 0 with [FORWARD] and [REVERSE] at [C:\xampp\htdocs\gotmad\test\application\controllers\helpers\TestDatabaseWrapper.php line 44]Fail: C:\xampp\htdocs\gotmad\test\application/controllers/helpers\TestDatabaseWrapper.php -> TestDatabaseWrapper -> testQueryBoardStatus -> Identical expectation [Integer: 12] fails with [Integer: 37] because [Integer: 12] differs from [Integer: 37] by 25 at [C:\xampp\htdocs\gotmad\test\application\controllers\helpers\TestDatabaseWrapper.php line 45]Exception: C:\xampp\htdocs\gotmad\test\application/controllers/helpers\TestSMSValidator.php -> TestSMSValidator -> testValidMSISDN -> Unexpected exception of type [FilterException] with message [SOURCEMSISDN Filter failed.] in [C:\xampp\htdocs\gotmad\includes\application\controllers\helpers\SMSValidator.php line 52]
  6. First step to debugging anything SOAP: dump out the request or response XML and compare it with what you know it's supposed to be.
  7. Today
  8. i am trying to pull some XML data (SMS messages) from a web service, the SOAP server connects successfully but for some reason data are not coming in, i am using XAMPP to test the application, connections to the database are ok, i thing something must be going wrong on the primary key validation. This is my database wrapper: <?php require_once __DIR__ . '/../../models/helpers/CircuitBoardInformation.php'; require_once __DIR__ . '/../../models/helpers/CircuitBoardStatus.php'; require_once __DIR__ . '/../../models/helpers/UserAccount.php'; /** * Holds a database instance and provides utility methods for the database. */ final class DatabaseWrapper { private $database; /** * Attempts to connect to the RDBMS. * @param $database string The database to use. */ public function connect($database) { $dsn = RDBMS . ':host=' . DB_HOST . ';port=' . DB_PORT . ';dbname=' . $database; $options = array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, // throw exceptions when encountering an error, these will be chained upwards to the error handler in Router PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC ); $this->database = new PDO($dsn, DB_USERNAME, DB_PASSWORD, $options); } /** * Queries the database for board information. * @return CircuitBoardInformation[] A collection of circuit board information * @throws ExecuteStatementException If the statement fails to execute. * @throws FetchStatementException If the statement fails to fetch a result. * @throws PrepareStatementException If the statement fails to prepare. */ public function queryAllBoardInformation() { $statement = $this->database->prepare('SELECT * FROM board_info' ); if ($statement === false) { throw new PrepareStatementException(__FUNCTION__); } if ($statement->execute() == false) { throw new ExecuteStatementException(__FUNCTION__); } $boards = array(); foreach ($statement as $boardInformation) { $msisdn = $boardInformation['msisdn']; $name = $boardInformation['name']; $information = new CircuitBoardInformation($msisdn, $name); array_push($boards, $information); } return $boards; } /** * Queries the database for a specific board's information. * @param $msisdn int The board's msisdn. * @return CircuitBoardInformation The board information. * @throws ExecuteStatementException If the statement fails to execute. * @throws FetchStatementException If the statement fails to fetch a result. * @throws PrepareStatementException If the statement fails to prepare. */ public function queryBoardInformation($msisdn) { $statement = $this->database->prepare('SELECT * FROM board_info WHERE msisdn = :msisdn'); if ($statement === false) { throw new PrepareStatementException(__FUNCTION__); } $statement->bindParam(':msisdn', $msisdn, PDO::PARAM_INT); if ($statement->execute() == false) { throw new ExecuteStatementException(__FUNCTION__); } $result = $statement->fetch(PDO::FETCH_ASSOC); if ($result === false) { throw new FetchStatementException(__FUNCTION__); } $msisdn = (int)$result['msisdn']; $name = $result['name']; $information = new CircuitBoardInformation($msisdn, $name); return $information; } /** * Queries the database for a specific board's status. * @param $msisdn int The board's msisdn. * @return CircuitBoardStatus The board status. * @throws ExecuteStatementException If the statement fails to execute. * @throws FetchStatementException If the statement fails to fetch a result. * @throws PrepareStatementException If the statement fails to prepare. */ public function queryBoardStatus($msisdn) { $statement = $this->database->prepare('SELECT * FROM board_status WHERE msisdn = :msisdn'); if ($statement === false) { throw new PrepareStatementException(__FUNCTION__); } $statement->bindParam(':msisdn', $msisdn, PDO::PARAM_INT); if ($statement->execute() == false) { throw new ExecuteStatementException(__FUNCTION__); } $result = $statement->fetch(PDO::FETCH_ASSOC); if ($result === false) { throw new FetchStatementException(__FUNCTION__); } $date = DateTime::createFromFormat(DB_DATE_FORMAT, $result['date']); $switchOne = $result['switchOne']; $switchTwo = $result['switchTwo']; $switchThree = $result['switchThree']; $switchFour = $result['switchFour']; $fan = $result['fan']; $temperature = (int)$result['temperature']; $keypad = (int)$result['keypad']; $status = new CircuitBoardStatus($date, $switchOne, $switchTwo, $switchThree, $switchFour, $fan, $temperature, $keypad); return $status; } /** * Queries the {@var $database} for a user account. * @param $username string The account's username. * @return UserAccount The user account. * @throws ExecuteStatementException If the statement fails to execute. * @throws FetchStatementException If the statement fails to fetch a result. * @throws PrepareStatementException If the statement fails to prepare. */ public function queryUser($username) { $statement = $this->database->prepare('SELECT * FROM users WHERE username = :username'); if ($statement === false) { throw new PrepareStatementException(__FUNCTION__); } $statement->bindParam(':username', $username, PDO::PARAM_STR); if ($statement->execute() == false) { throw new ExecuteStatementException(__FUNCTION__); } $result = $statement->fetch(PDO::FETCH_ASSOC); if ($result === false) { throw new FetchStatementException(__FUNCTION__); } $username = $result['username']; $passwordHash = $result['passwordHash']; $rank = $result['rank']; return new UserAccount($username, $passwordHash, $rank); } /** * Updates the {@var database} with the status of a circuit board. * @param $msisdn int The msisdn of the circuit board. * @param $status CircuitBoardStatus The circuit board's status. * @throws ExecuteStatementException If the statement fails to execute. * @throws PrepareStatementException If the statement fails to prepare. */ public function updateBoardStatus($msisdn, $status) { $date = $status->getDate()->format(DB_DATE_FORMAT); $switchOne = $status->getSwitchOne(); $switchTwo = $status->getSwitchTwo(); $switchThree = $status->getSwitchThree(); $switchFour = $status->getSwitchFour(); $fan = $status->getFan(); $temperature = $status->getTemperature(); $keypad = $status->getKeypad(); /* * 'REPLACE INTO' will create the row if it does not exist * or update the values in it if it does */ $statement = $this->database->prepare( 'REPLACE INTO board_status SET msisdn = :msisdn, date = :date, switchOne = :switchOne, switchTwo = :switchTwo, switchThree = :switchThree, switchFour = :switchFour, fan = :fan, temperature = :temperature, keypad = :keypad'); if ($statement === false) { throw new PrepareStatementException(__FUNCTION__); } $statement->bindParam(':msisdn', $msisdn, PDO::PARAM_STR); $statement->bindParam(':date', $date, PDO::PARAM_STR); $statement->bindParam(':switchOne', $switchOne, PDO::PARAM_STR); $statement->bindParam(':switchTwo', $switchTwo, PDO::PARAM_STR); $statement->bindParam(':switchThree', $switchThree, PDO::PARAM_STR); $statement->bindParam(':switchFour', $switchFour, PDO::PARAM_STR); $statement->bindParam(':fan', $fan, PDO::PARAM_STR); $statement->bindParam(':temperature', $temperature, PDO::PARAM_INT); $statement->bindParam(':keypad', $keypad, PDO::PARAM_INT); if ($statement->execute() === false) { throw new ExecuteStatementException(__FUNCTION__); } } public function addAccount($account) { $statement = $this->database->prepare( 'INSERT INTO users SET username = :username, passwordHash = :passwordHash, rank = :rank'); if ($statement === false) { throw new PrepareStatementException(__FUNCTION__); } $username = $account->getUsername(); $passwordHash = $account->getPasswordHash(); $rank = $account->getRank(); $statement->bindParam(':username', $username, PDO::PARAM_STR); $statement->bindParam(':passwordHash', $passwordHash, PDO::PARAM_STR); $statement->bindParam(':rank', $rank, PDO::PARAM_STR); if ($statement->execute() === false) { throw new ExecuteStatementException(__FUNCTION__); } } /** * Deletes a user account from the the {@var database}. * @param $username string The username. * @throws ExecuteStatementException If the statement fails to execute. * @throws PrepareStatementException If the statement fails to prepare. */ public function deleteUser($username) { $statement = $this->database->prepare( 'DELETE FROM users WHERE username = :username'); if ($statement === false) { throw new PrepareStatementException(__FUNCTION__); } $statement->bindParam(':username', $username, PDO::PARAM_STR); if ($statement->execute() === false) { throw new ExecuteStatementException(__FUNCTION__); } } } class DatabaseException extends Exception { /** * Creates a new database exception. * @param $action string The database action being performed. * @param $function string The function name. */ public function __construct($action, $function) { parent::__construct("[$function] Failed to $action statement."); } } final class PrepareStatementException extends DatabaseException { /** * Creates a new prepare statement exception. * @param $function string The function name. */ public function __construct($function) { parent::__construct('prepare', $function); } } final class ExecuteStatementException extends DatabaseException { /** * Creates a new execute statement exception. * @param $function string The function name. */ public function __construct($function) { parent::__construct('execute', $function); } } final class FetchStatementException extends DatabaseException { /** * Creates a new fetch statement exception. * @param $function string The function name. */ public function __construct($function) { parent::__construct('fetch', $function); } } This is my SMSvalidator: <?php /** * Validates raw XML formatted SMS messages. */ final class SMSValidator { /** * The message to validate. * @var array */ private $message; /** * Creates a new {@link SMSValidator} * @param $message array The message to validate */ public function __construct($message) { $this->message = $message; } /** * Gets the value of a field in this message. * @param $key string The field's key. * @return mixed The value * @throws Exception If the key is missing. */ private function getValue($key) { if (!isset($this->message[$key])) { throw new MissingSMSKeyException($key); } return $this->message[$key]; } /** * Validates the 'SOURCEMSISDN' field. * @return string The validated field. * @throws Exception If an error occurs during sanitisation/validation. */ public function validateMSISDN() { $key = 'SOURCEMSISDN'; $msisdn = $this->getValue($key); $msisdn = filter_var($msisdn, FILTER_SANITIZE_NUMBER_INT); $msisdn = filter_var($msisdn, FILTER_VALIDATE_INT, array('options' => array('min_range' => 0, 'max_range' => 999999999999999))); // at minimum 1 digit, at maximum 15 digits if ($msisdn === false) { throw new FilterException($key); } return (int)$msisdn; } /** * Validates the received date value. * @return DateTime The validated date object. * @throws Exception If an error occurs during sanitisation/validation. */ public function validateDate() { $key = 'RECEIVEDTIME'; $receivedTime = $this->getValue($key); $receivedTime = filter_var($receivedTime, FILTER_SANITIZE_STRING); if ($receivedTime === false) { throw new FilterException($key); } $date = DateTime::createFromFormat(DATE_FORMAT, $receivedTime); if ($date === false) { throw new InvalidDateException($key); } return $date; } /** * Validates the bearer field. * @return string The bearer field. * @throws Exception If an error occurs during sanitisation/validation. */ public function validateBearer() { $key = 'BEARER'; $bearer = $this->getValue($key); $bearer = filter_var($bearer, FILTER_SANITIZE_STRING); if ($bearer === false) { throw new FilterException($key); } if ($bearer !== 'SMS') { throw new BearerMismatchException($key); } return $bearer; } /** * Validates the SMS identifier. * @return string The SMS identifier. * @throws Exception If an error occurs during sanitisation/validation. */ public function validateSMSIdentifier() { $key = 'ID'; $smsIdentifier = $this->getValue($key); $smsIdentifier = filter_var($smsIdentifier, FILTER_SANITIZE_STRING); if ($smsIdentifier === false) { throw new FilterException($key); } if ($smsIdentifier !== SMS_IDENTIFIER) { throw new IDMismatchException($key); } return $smsIdentifier; } /** * Sanitizes and validates a switch status. * @param $switchNumber int The switch number to validate. * @return string The switch status. * @throws Exception If an error occurs during sanitisation/validation. */ public function validateSwitch($switchNumber) { $key = 'S' . $switchNumber; if ($switchNumber < 1 || $switchNumber > 4) { throw new InvalidSwitchException($key); } $switch = $this->getValue($key); $switch = filter_var($switch, FILTER_SANITIZE_NUMBER_INT); $switch = filter_var($switch, FILTER_VALIDATE_INT, array('options' => array('min_range' => 0, 'max_range' => 1))); if ($switch === false) { throw new FilterException($key); } if ($switch === 0) { return 'OFF'; } else if ($switch === 1) { return 'ON'; } throw new SwitchStateMismatchException($key); } /** * Sanitizes and validates the fan status. * @return string The fan status. * @throws Exception If an error occurs during sanitisation/validation. */ public function validateFan() { $key = 'F'; $fan = $this->getValue($key); $fan = filter_var($fan, FILTER_SANITIZE_NUMBER_INT); $fan = filter_var($fan, FILTER_VALIDATE_INT, array('options' => array('min_range' => 0, 'max_range' => 1))); if ($fan === false) { throw new FilterException($key); } if ($fan === 0) { return 'FORWARD'; } else if ($fan === 1) { return 'REVERSE'; } throw new FanStateMismatchException($key); } /** * Sanitizes and validates a temperature amount. * @return string The validated temperature. * @throws Exception If an error occurs during sanitisation/validation. */ public function validateTemperature() { $key = 'T'; $temperature = $this->getValue($key); $temperature = filter_var($temperature, FILTER_SANITIZE_NUMBER_INT); $temperature = filter_var($temperature, FILTER_VALIDATE_INT, array('options' => array('min_range' => -99, 'max_range' => 999))); // 3 max digits at all times if ($temperature === false) { throw new FilterException($key); } return (int)$temperature; } /** * Sanitizes and validates the keypad input. * @return string The validated keypad input. * @throws Exception If an error occurs during sanitisation/validation. */ public function validateKeypad() { $key = 'K'; $keypad = $this->getValue($key); $keypad = filter_var($keypad, FILTER_SANITIZE_NUMBER_INT); $keypad = filter_var($keypad, FILTER_VALIDATE_INT, array('options' => array('min_range' => 0, 'max_range' => 9))); // must be 1 digit if ($keypad === false) { throw new FilterException($key); } return (int)$keypad; } /** * Sanitizes and validates the {@var $message} into a {@link CircuitBoardStatus}. * @return CircuitBoardStatus The validated circuit board status or {@code null} if the message did not contain a valid circuit board status.. */ public function validateStatus() { $date = $this->validateDate(); $this->validateBearer(); $switchOne = $this->validateSwitch(1); $switchTwo = $this->validateSwitch(2); $switchThree = $this->validateSwitch(3); $switchFour = $this->validateSwitch(4); $fan = $this->validateFan(); $temperature = $this->validateTemperature(); $keypad = $this->validateKeypad(); $status = new CircuitBoardStatus($date, $switchOne, $switchTwo, $switchThree, $switchFour, $fan, $temperature, $keypad); return $status; } } final class MissingSMSKeyException extends Exception { public function __construct($key) { parent::__construct("Missing value for $key."); } } final class FilterException extends Exception { public function __construct($key) { parent::__construct("$key Filter failed."); } } final class InvalidDateException extends Exception { public function __construct($key) { parent::__construct("$key Must be in format of " . DATE_FORMAT . "."); } } final class BearerMismatchException extends Exception { public function __construct($key) { parent::__construct("$key Must be SMS."); } } final class IDMismatchException extends Exception { public function __construct($key) { parent::__construct("$key Must match " . SMS_IDENTIFIER . "."); } } final class InvalidSwitchException extends Exception { public function __construct($key) { parent::__construct("$key Switch number must be 1-4 inclusive."); } } final class SwitchStateMismatchException extends Exception { public function __construct($key) { parent::__construct("$key Must be either 0 (OFF) or 1 (ON)."); } } final class FanStateMismatchException extends Exception { public function __construct($key) { parent::__construct("$key Must be either 0 (FORWARD) or 1 (REVERSE)."); } } when i debug the application i get a filter exception when testing the SOURCEMSISDN, i can't understand why though as the msisdn (this is the primary key) provided is correct this is a valid XML message: <messagerx> <sourcemsisdn>12345</sourcemsisdn> <destinationmsisdn>12345</destinationmsisdn> <receivedtime>27/08/2018 02:19:28</receivedtime> <bearer>SMS</bearer> <messageref>0</messageref> <message> <id>abc123</id> <s1>0</s1> <s2>1</s2> <s3>0</s3> <s4>1</s4> <f>0</f> <t>38</t> <k>5</k> </message> </messagerx> This is my TestSMSvalidator: <?php require_once __DIR__ . '/../../../../includes/application/controllers/helpers/SMSValidator.php'; /* normally can't store arrays as constants, however if we serialize it... */ define('VALID_SMS_MESSAGE', serialize(array( 'SOURCEMSISDN' => M2M_MSISDN, 'DESTINATIONMSISDN' => M2M_MSISDN, 'RECEIVEDTIME' => '27/11/2014 02:19:28', 'BEARER' => 'SMS', 'ID' => SMS_IDENTIFIER, 'S1' => 0, 'S2' => 1, 'S3' => 0, 'S4' => 1, 'F' => 0, 'T' => 30, 'K' => 5 ))); final class TestSMSValidator extends M2MTestCase { function testValidMessage() { $message = unserialize(VALID_SMS_MESSAGE); $validator = new SMSValidator($message); $validator->validateStatus(); } static function validateMSISDN($msisdn) { $message = unserialize(VALID_SMS_MESSAGE); $message['SOURCEMSISDN'] = $msisdn; $validator = new SMSValidator($message); return $validator->validateMSISDN(); } function testValidMSISDN() { $this->assertIdentical(447817814149, $this->validateMSISDN(447817814149)); $this->assertIdentical(447817814149, $this->validateMSISDN('+447817814149')); $this->assertException('FilterException', [$this, 'validateMSISDN'], [-447817814149]); $this->assertIdentical(447817814149, $this->validateMSISDN('<447817814149>')); $this->assertIdentical(4401010101, $this->validateMSISDN(4401010101)); $this->assertIdentical(005, $this->validateMSISDN(005)); $this->assertIdentical(447817814149, $this->validateMSISDN('(+44) 7817 814 149')); $this->assertException('MissingSMSKeyException', [$this, 'validateMSISDN'], [null]); } function validateDate($date) { $message = unserialize(VALID_SMS_MESSAGE); $message['RECEIVEDTIME'] = $date; $validator = new SMSValidator($message); return $validator->validateDate(); } function testValidDate() { $this->assertNotNull($this->validateDate('27/12/2014 02:19:28')); $this->assertException('InvalidDateException', [$this, 'validateDate'], ['27/12/2014']); $this->assertException('InvalidDateException', [$this, 'validateDate'], ['Monday 29th Dec']); $this->assertNotNull($this->validateDate('1/1/2001 01:01:01')); $this->assertException('InvalidDateException', [$this, 'validateDate'], ['\'\'']); $this->assertException('InvalidDateException', [$this, 'validateDate'], ['<>\'\'#&']); $this->assertException('MissingSMSKeyException', [$this, 'validateDate'], [null]); } function validateBearer($bearer) { $message = unserialize(VALID_SMS_MESSAGE); $message['BEARER'] = $bearer; $validator = new SMSValidator($message); return $validator->validateBearer(); } function testValidBearer() { $this->assertIdentical('SMS', $this->validateBearer('SMS')); $this->assertException('BearerMismatchException', [$this, 'validateBearer'], ['sms']); $this->assertException('BearerMismatchException', [$this, 'validateBearer'], ['<sms>']); $this->assertException('BearerMismatchException', [$this, 'validateBearer'], ['<SMS>']); $this->assertException('MissingSMSKeyException', [$this, 'validateBearer'], [null]); } function validateSMSIdentifier($id) { $message = unserialize(VALID_SMS_MESSAGE); $message['ID'] = $id; $validator = new SMSValidator($message); return $validator->validateSMSIdentifier(); } function testValidSMSIdentifier() { $this->assertIdentical('abc123', $this->validateSMSIdentifier('abc123')); $this->assertException('IDMismatchException', [$this, 'validateSMSIdentifier'], ['ABC123']); $this->assertException('IDMismatchException', [$this, 'validateSMSIdentifier'], ['abc__123']); $this->assertException('IDMismatchException', [$this, 'validateSMSIdentifier'], ['#_&']); $this->assertException('MissingSMSKeyException', [$this, 'validateSMSIdentifier'], [null]); } function validateSwitch($state) { $switches = [1, 2, 3, 4]; $switchNumber = $switches[array_rand($switches)]; // pick a random switch $message = unserialize(VALID_SMS_MESSAGE); $message["S$switchNumber"] = $state; $validator = new SMSValidator($message); return $validator->validateSwitch($switchNumber); } function testValidSwitch() { $this->assertIdentical('OFF', $this->validateSwitch(0)); $this->assertIdentical('ON', $this->validateSwitch(1)); $this->assertException('FilterException', [$this, 'validateSwitch'], ['off']); $this->assertException('FilterException', [$this, 'validateSwitch'], [2]); $this->assertException('FilterException', [$this, 'validateSwitch'], [-1]); $this->assertException('MissingSMSKeyException', [$this, 'validateSwitch'], [null]); } function validateFan($fan) { $message = unserialize(VALID_SMS_MESSAGE); $message['F'] = $fan; $validator = new SMSValidator($message); return $validator->validateFan(); } function testValidFan() { $this->assertIdentical('FORWARD', $this->validateFan(0)); $this->assertIdentical('FORWARD', $this->validateFan('<0>')); $this->assertIdentical('REVERSE', $this->validateFan(1)); $this->assertIdentical('REVERSE', $this->validateFan('1;')); $this->assertException('FilterException', [$this, 'validateFan'], [2]); $this->assertException('FilterException', [$this, 'validateFan'], [3]); $this->assertException('FilterException', [$this, 'validateFan'], [-1]); $this->assertException('FilterException', [$this, 'validateFan'], ['On']); $this->assertException('FilterException', [$this, 'validateFan'], ['off']); $this->assertException('FilterException', [$this, 'validateFan'], ['FORWARD']); $this->assertException('MissingSMSKeyException', [$this, 'validateFan'], [null]); } function validateTemperature($temperature) { $message = unserialize(VALID_SMS_MESSAGE); $message['T'] = $temperature; $validator = new SMSValidator($message); return $validator->validateTemperature(); } function testValidTemperature() { $this->assertIdentical(25, $this->validateTemperature(25)); $this->assertIdentical(99, $this->validateTemperature(99)); $this->assertIdentical(105, $this->validateTemperature(105)); $this->assertIdentical(-12, $this->validateTemperature(-12)); $this->assertException('FilterException', [$this, 'validateTemperature'], ['HOT!']); $this->assertException('FilterException', [$this, 'validateTemperature'], ['really cold']); $this->assertIdentical(-55, $this->validateTemperature(-55)); $this->assertIdentical(-25, $this->validateTemperature(-25)); $this->assertIdentical(25, $this->validateTemperature('SELECT 25')); $this->assertException('MissingSMSKeyException', [$this, 'validateTemperature'], [null]); } function validateKeypad($keypad) { $message = unserialize(VALID_SMS_MESSAGE); $message['K'] = $keypad; $validator = new SMSValidator($message); return $validator->validateKeypad(); } function testValidKeypad() { $this->assertIdentical(0, $this->validateKeypad(0)); $this->assertIdentical(5, $this->validateKeypad(5)); $this->assertException('FilterException', [$this, 'validateKeypad'], [10]); $this->assertException('FilterException', [$this, 'validateKeypad'], [-1]); $this->assertException('FilterException', [$this, 'validateKeypad'], ['five']); $this->assertIdentical(5, $this->validateKeypad('_5')); $this->assertIdentical(2, $this->validateKeypad('&2&')); $this->assertException('MissingSMSKeyException', [$this, 'validateKeypad'], [null]); } }
  9. requinix

    Uninitialized string offset

    As you've already figured it, the problem is you think a variable is an array but for some reason something made it be a string. So you have to find out where that's happening. If you aren't sure where to start looking, posting your code would be a good first step.
  10. MrLeN

    How do I set up this cron job?

    I already paid someone on Fiverr. It's done and everything is working fine.
  11. papasmurf

    Uninitialized string offset

    I’m new to this group so I’m not sure if I’m posting this in the right category but I’m having a problem with some error messages that appear in Chrome’s View Page Source. They are generated after running a script that displays correctly on a web page but not in View Page Source. They seem to be connected to an array that I’m using in one of the classes. Without getting into too much detail, gettype() calls the array ‘array’ on the page but in View Page Source it calls it ‘string’. Because of this it generates a number of ‘Notice: Uninitialized string offset’ messages in code that follows that statement. This occurs when xdebug is enabled or disabled. If I hard-code this array in a separate script, independent of the program I’ve written, and run a loop to display data I get no errors in View Page Source as it only occurs within the program. If anyone has some good advice as to why this is happening I’d appreciate it. Thanks.
  12. Yesterday
  13. benanamen

    How do I set up this cron job?

    I will take the $50 to do it. PM me all the details.
  14. requinix

    how to do a drop right menu in html and css

    You should be showing and hiding the ULs, not their LIs. Example
  15. Hey guys! I am trying to do a drop right menu to add to my drop down menu and I almost got it but just can't seem to push the padding to the right of it... Here is my part of my html and css code:I put a div class there because I wasn't sure if I needed it but don't think so.... <!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity=">sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous"> <link href="https://fonts.googleapis.com/css?family=Aldrich|Mr+Dafoe" rel="stylesheet"> </head> <body> <header> <nav> <ul> <li><a href="#">Member's section</a><div class="down"><i class="fas fa-caret-down"></i></div> <ul> <li><a href="index.php">Main Page</a></li> <li><a href="practice_diary.php">Practice diary</a></li> <li><a href="redeem.php">Redeem Your Points!</a></li> <li><a href="forum_main.php">Forum</a></li> <li><a href="quiz.php">Music Test</a></li> <li><a href="review.php">Review</a></li> <li><a href="update.php">Update Profile</a></li> <li><a href="#">Games</a> <div class="games"> <ul> <li><a href="guessing_game.php">Guessing Game</a></li> <li><a href="rock_paper_scissors.php">Rock, Paper, Scissors</a></li> </ul> </div> </li> </ul> </li> <li><a href="primer.php">Primer Level</a><div class="down"><i class="fas fa-caret-down"></i></div> <ul> <li><a href="level1.php">Level 1</a></li> <li><a href="level2.php">Level 2</a></li> <li><a href="level3.php">Level 3</a></li> </ul> </li> <li><a href="signup.php">Signup</a></li> <li><a href="refer.php">Referral page</a></li> <li><a href="reset.php">Reset Password</a></li> <li><a href="qa.php">More Information</a><div class="down"><i class="fas fa-caret-down"></i></div> <ul> <li><a href="contact.php">Contact Us</a></li> <li><a href="donation.php">Donation</a></li> <li><a href="activate.php">Activate Email</a></li> </ul> </li> <div class="profile_image"> <ul> <li><a href="uploadform.php">Upload Profile Picture</a></li> <div class="delete_profile"><li><a href="deleteprofile.php">Delete picture profile</a></li></div> </ul> </div> CSS code: header nav ul ul ul li{ position: absolute; display: none; } header nav ul ul li:hover ul li{ display: block ; position: relative; left: 200px; bottom: 100px; }
  16. requinix

    How do I set up this cron job?

    At least it'll be cheaper.
  17. MrLeN

    How do I set up this cron job?

    You're a smart ass. I'm going to fiver.
  18. requinix

    How do I set up this cron job?

    1. Have you ever used the command line? On Windows or Linux? Sounds like you have not. 2. wget is a program that can retrieve webpages and other online content. -q -O - are arguments to it that mean to output that content (rather than save to a file) and to suppress any other unnecessary output. 3. If you have set up cronjobs in cPanel then surely you know that a cronjob involves a time, or time interval, and a command to run. My response may have been snippy because it your experience with cronjobs in cPanel should imply certain knowledge of what cronjobs are. And yet you're missing some important information that, at the very least, could be answered with a Google search. So there's something wrong here. But hey, if you want to pay someone to do something that should take literally seconds then that's your decision.
  19. MrLeN

    How do I set up this cron job?

    It's confusing because: 1: I don't know how to "run the command" 2: I don't know what wget -q -O - means 3). I have never set up a cron job in this way -- as explained I have only ever set one up using the cPanel form. Your response has p'd me off. If I don't know what it means or how to do it, I don't know what it means or how to do it. To tell me you're not sure why it's confusing implies that I am some kind of idiot. I don't like you. Bad administrator. Again, I have $50 for someone that can help me. *Someone that isn't so abrasive, caustic or mean.
  20. Last week
  21. maxxd

    Header problems

    What framework are you using?
  22. requinix

    Header problems

    What kinds of "vars" are you talking about? When do you know their values? When do they change?
  23. Destramic

    Header problems

    That is possible with my view when rendering but still I would need to pass vars on each page which seems unlogical and long winded Preloading vars in my bootstrap may be the best way to do this then in my case. Thank you
  24. requinix

    Header problems

    Depends on your framework. An easy solution is to allow for an array as a second argument to render(), perhaps $args, which the file could read from.
  25. Destramic

    Header problems

    Hey guys I include my header to my pages by adding this to the top of the page $this->render ('myheader.html'); The problem is I want to pass results from my db to the navigation menu, which would require me to assign vars in each controller view that includes the header. What is the best way to do this please? Another way I can think off is assigning the results to my view in my bootstrap ready for the controllers...but I'm sure there is a more logical way. Thank you
  26. Hi everyone, Been working on this for quite a while, and although still quite a ways from completion, it's done enough to begin getting initial feedback. If anyone of you have a spare few minutes, please take a look at: http://apex.envrin.com/ And quick start guide at: http://apex.envrin.com/quick_start Github: https://github.com/envrin/apex/ Would love any initial feedback. I would imagine it will get blasted as amateurish, which is fine with me, as I need it for myself anyway. Hopefully it's able to help some folks out there as well though. PS. Please ignore any design flaws. I went blind a couple years ago, but will get a designer on board shortly to fix up the design flaws. Thanks in advance!
  27. Barand

    PHP not able to connect to MySQL

    I know. Baldwindavidrye seems to have made it his mission to go through old posts and add his "pearls of wisdom".
  28. cyberRobot

    PHP not able to connect to MySQL

    Note that the original post was made several months ago. The OP stopped logging in a few days after the original post.
  29. This board only support the OP Zero cards. In general the quality of these addon boards is not very high, but this should not be a surprise given the low price. As it only has a 10/100 port in it, you are going to be constrained to a max throughput of 10 Megabytes per second max. While it supports SATA drives, it's through USB 2 connectors, so the connection to SATA drives is going to be throttled to USB 2.0 speeds. In summary, it's an interesting toy, but you should not expect to build a NAS server off this that works for anything other than low performance file sharing. There is also the problem of how you are going to power the thing and any external drives you might attach to it. Maybe when they address some of these issues and come out with a version that has a Gigabit ethernet port, it might be worth considering, but a NAS that doesn't have redundancy of some sort (RAID 0+1, RAID-5 or RAID-6) isn't a great idea, considering the amount of time its going to take to load the NAS with files as well as backing it up all the time.
  1. Load more activity
  • Newsletter

    Want to keep up to date with all our latest news and information?

    Sign Up
×

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.