コード例 #1
0
ファイル: sendSMS.class.php プロジェクト: Git-Host/sms
 private function validateResponse()
 {
     validator::loadDictionaries(array('TextAnywhereAPIResponse'));
     validator::validateInput($this->result);
     $this->cleanData = validator::getCleanData();
     $errors = validator::getErrors();
     if (!empty($errors)) {
         $this->logdb->logValidationErrors($this->result, $errors);
         exit;
     }
 }
コード例 #2
0
ファイル: textAnywhere.class.php プロジェクト: Git-Host/sms
 protected function send()
 {
     $sc = $this->soap->open($this->soapPath);
     $this->vars['method'] = $this->method;
     $method = ucfirst($this->method);
     validator::loadDictionaries(array(ucfirst($this->method)));
     validator::validateInput($this->vars);
     $cleanData = validator::getCleanData();
     $errors = validator::getErrors();
     if (empty($errors)) {
         if ($this->live == true) {
             $result = $sc->__call($method, array($this->params));
             if (!empty($this->vars['body'])) {
                 debug::output('***************LIVE SENDING START***************');
                 debug::output($this->vars['body']);
                 debug::output('***************LIVE SENDING END***************');
             }
             $resultMethod = $method . 'Result';
             //Dynamic method name dependent on the class name
             $this->response = $result->{$resultMethod};
             sleep(10);
             //give the api time to report the message status
             debug::output("\n");
             debug::output('***************LIVE CHECK DELIVERY START***************');
             $smsstatus = new smsstatus($this->vars);
             $this->fault = $smsstatus->database();
             debug::output('***************LIVE CHECK DELIVERY END***************');
         } else {
             //else dev
             //log for DEV
             //print_r($this->params);
             //$this->logdb->updateLogOutboundSMS($this->params);
             if (!empty($this->vars['body'])) {
                 debug::output('***************LIVE SENDING START***************');
                 debug::output($this->vars['body']);
                 debug::output('***************LIVE SENDING END***************');
             }
         }
         //else dev
     } else {
         debug::output("There were errors in the data to be sent");
         $logdb->logValidationErrors($this->vars, $errors);
     }
 }
コード例 #3
0
ファイル: process_airdb.php プロジェクト: Git-Host/sms
include_once 'start.inc.php';
try {
    $file_location = '/airdb.csv';
    debug::output("Processing file: {$file_location}");
    $csv = new csvparser($file_location);
    mysql::i()->query("truncate airports_backup");
    mysql::i()->query("insert into airports_backup select * from airports");
    mysql::i()->query("truncate airports");
    validator::loadDictionaries(array('AirDB'));
    $iata = array('BKN', 'AAS', 'BOO');
    $air = array();
    foreach ($csv as $row) {
        //print_r($row);
        validator::validateInput($row);
        $cleanData = validator::getCleanData();
        $errors = validator::getErrors();
        if (!empty($errors)) {
            print_r($errors);
            exit;
        }
        $cleanData['Airport'] = str_replace(']', '', str_replace('[', '', $cleanData['Airport']));
        $sql = "INSERT INTO airports (ICAO,IATA,place,state,airport,country) VALUES ('{$cleanData['ICAO']}','{$cleanData['IATA']}','{$cleanData['Place']}','{$cleanData['State']}','{$cleanData['Airport']}','{$cleanData['Country']}') ";
        mysql::i()->query($sql);
        //if(in_array($cleanData['IATA'], $iata))continue;
        //print_r($cleanData);
        //print_r($cleanData);
        /*
        		if(in_array($cleanData['IATA'], $air)){
        			if($air[$cleanData['IATA']]['Country'] == 'USA'){
        				$air[$cleanData['IATA']] = $cleanData;
        				
コード例 #4
0
ファイル: getSMSStatus.class.php プロジェクト: Git-Host/sms
 private function sendold()
 {
     $sc = $this->soap->open($this->soapPath);
     $this->vars['method'] = $this->method;
     $method = ucfirst($this->method);
     /*echo "VARS: ";
     		print_r($this->vars);
     		echo "END VARS";*/
     validator::loadDictionaries(array(ucfirst($this->method)));
     validator::validateInput($this->vars);
     $cleanData = validator::getCleanData();
     $errors = validator::getErrors();
     /*	echo "clean:";
     			print_r($cleanData);
     			print_r($errors);
     			echo "END clean";*/
     if (empty($errors)) {
         if ($this->live == true) {
             $result = $sc->__call($method, array($this->params));
             $resultMethod = $method . 'Result';
             //Dynamic method name dependent on the class name
             $this->response = $result->{$resultMethod};
             $logf = new log_file('/api/textanywhere/');
             $logf->request($this->method, $this->vars, $this->count);
             $logf->response($this->method, $this->response, $this->count);
         }
         //if live
     } else {
         debug::output("There were errors in the data to be sent");
         $logdb->logValidationErrors($this->vars, $errors);
     }
 }
コード例 #5
0
<?php

// Require app files
require 'app/User.php';
require 'app/Validator.php';
require 'app/Helper.php';
//Set data and validation rules
$rules = array('email' => 'required|email', 'password' => 'required|min:8');
$data = array('email' => '*****@*****.**', 'password' => '12346789', 'foo' => 'bar');
// Run validation
$validator = new validator();
if ($validator->validate($data, $rules) == true) {
    //Validation passed. Set user values.
    $joost = new User($data);
    $joost->email = '*****@*****.**';
    $joost->password = '******';
    //var_dump($joost->email);
    //var_dump($joost->password);
    //Dump user
    // var_dump($joost);
    echo $joost;
} else {
    // Validation failed. Dump validation errors.
    var_dump($validator->getErrors());
}
コード例 #6
0
ファイル: signup.php プロジェクト: sathish-narayanan/lamp
<link rel="stylesheet" type="text/css" href="../css/style.css" />
</head>
<body>
	<h1 align="center">Gmail</h1>
	<h2 align="center">signup</h2>
	<?php 
if (!empty($_POST)) {
    require_once 'function.php';
    $errors = array();
    $validatorObj = new validator($_POST);
    $validatorObj->validate();
    if ($validatorObj->getIsValid()) {
        // create user object for OOP manipulation
        $userObj = new User($_POST);
    } else {
        $errors = $validatorObj->getErrors();
    }
}
if (!empty($errors)) {
    ?>
<p> errors occured:please check</p>
<p class="error">
<?php 
    if (is_array($errors)) {
        foreach ($errors as $val) {
            echo $val . '<br />';
        }
    }
    ?>
</p>
<?php