Esempio n. 1
1
function test($serviceId)
{
    $tableau = Connexion::query('select url,port,texte,trl from services where id=\'' . $serviceId . '\'');
    $url = $tableau[0][0];
    $port = $tableau[0][1];
    $texte = $tableau[0][2];
    $ping = ping($url, $port, $texte, $tableau[0][3]);
    $date = date('Y-m-d');
    $heure = date('H:i:s');
    $trl = $ping[2];
    $etat = $ping[0] == true ? 1 : 0;
    $codeHttp = strlen($ping[1]) != 3 ? '500' : $ping[1];
    Connexion::exec('insert into tests (service_id,date,heure,trl,etat,codeHttp) values (\'' . $serviceId . '\',\'' . $date . '\',\'' . $heure . '\',\'' . $trl . '\',\'' . $etat . '\',\'' . $codeHttp . '\')');
    if ($ping[0] == false or $trl * 1000 > $tableau[0][3] or $codeHttp != '200') {
        $res = false;
    } else {
        $res = true;
        validation($serviceId, $date, $heure);
    }
    if ($res == false) {
        notif($serviceId, $date, $heure);
        erreur($serviceId, $date, $heure);
    }
    return $res;
}
Esempio n. 2
0
 public function __toString()
 {
     $html = '';
     if ($this->__is_form) {
         if (!validation()->passed()) {
             $html .= \Unity\Validation\Service::$out;
         }
         $html .= '<form method="' . $this->__is_form->method . '" action="' . $this->__is_form->action . '">';
         $html .= '<div><input type="text" name="__token" value="' . $this->__is_form->token . '"></div>';
     }
     $html .= implode('', $this->__form);
     if ($this->__is_form) {
         $html .= '</form>';
     }
     return $html;
 }
function defaultResult($permits, $model)
{
    return array('validate' => validation($permits, $model), 'validator' => count(array_merge($permits['foda']['validate'], $permits['metaP']['validate'], $permits['valorF']['validate'], $permits['metaF']['validate'])) > 0, 'admin' => count($permits['conf']['edit']) + count($permits['conf']['view']) > 0, 'foda' => seeFODAStrategy($permits), 'budget' => seeBudget($permits), 'role' => $permits['title']);
}
Esempio n. 4
0
             $smarty->assign("totalTitlePlusRecords", totalDb("titleplus"));
             break;
         case "Operator":
             $smarty->assign("totalMaskRecords", totalDb("mask"));
             $smarty->assign("totalTitleRecords", totalDb("title"));
             $smarty->assign("totalTitlePlusRecords", totalDb("titleplus"));
             break;
     }
 }
 // CHECKING ACTION
 if (!isset($_GET["edit"]) && !isset($_GET["delete"]) && $_GET['hldg'] == 'execute') {
     $myAction = 'holdings';
 } elseif (isset($_GET["edit"]) && !preg_match("=/=", $_GET["edit"])) {
     if ($_GET['edit'] == 'validation') {
         //$myAction = 'validation';
         $formValidation = validation($_GET["m"]);
         //var_dump($formValidation);
         if ($formValidation == false) {
             foreach ($errorField as $key => $value) {
                 print_r("erro no campo " . $errorField[$key] . " <br>");
             }
         } else {
             $myAction = 'save';
         }
         //die(" fimm");
     } elseif ($_GET['edit'] == 'save' && $_REQUEST["gravar"] != "false") {
         $myAction = 'save';
     } else {
         if ($_GET["edit"] == "save") {
             $myAction = 'save?';
         } else {
Esempio n. 5
0
<?php

/**
 * Created by PhpStorm.
 * User: Keith Murphy
 * Date: 11/10/2015
 * Time: 10:54 PM
 */
$user_input_1 = $_POST[CHOSEN_COUNTRY_KEY_1];
$user_input_2 = $_POST[CHOSEN_COUNTRY_KEY_2];
$array_data = create_country_array();
$country_names_array = country_names($array_data);
$validated_country_1 = validation($user_input_1, $country_names_array);
$validated_country_2 = validation($user_input_2, $country_names_array);
$json_country_data_1 = find_country($validated_country_1, $array_data);
$json_country_data_2 = find_country($validated_country_2, $array_data);
Esempio n. 6
0
<br>


<?php 
$addressGroups = getAddressGroups();
$newAddressData = array();
if (isPostRequest()) {
    $newAddressData[0] = $_SESSION['currentUserID'];
    $newAddressData[1] = filter_input(INPUT_POST, 'selected_address_group');
    $newAddressData[2] = filter_input(INPUT_POST, 'fullname');
    $newAddressData[3] = filter_input(INPUT_POST, 'email');
    $newAddressData[4] = filter_input(INPUT_POST, 'address');
    $newAddressData[5] = formatPhone(stripPhone(filter_input(INPUT_POST, 'phone')));
    $newAddressData[6] = filter_input(INPUT_POST, 'website');
    $newAddressData[7] = filter_input(INPUT_POST, 'birthday');
    $errors = validation($newAddressData);
    if (count($errors) == 0) {
        $newAddressData[8] = uploadImage();
        if (empty($newAddressData[8])) {
            $errors[] = 'Image could not be uploaded';
            $results = 'Empty Image';
        }
        if (createContact($newAddressData)) {
            $results = 'New item added to address book';
        } else {
            $results = 'Item was not Added';
        }
    } else {
        $results = 'Errors found';
    }
}
Esempio n. 7
0
    if (!authoriseUserRoles($userRole, ["SUPER_USER", "STAFF"])) {
        header("Location: ../unauthorisedAccess.php");
        exit;
    }
}
$user = $_SESSION["user"];
$wname = filter_input(INPUT_POST, 'worksheetname', FILTER_SANITIZE_STRING);
$vname = filter_input(INPUT_POST, 'versionname', FILTER_SANITIZE_STRING);
$author = filter_input(INPUT_POST, 'author', FILTER_SANITIZE_NUMBER_INT);
$date = filter_input(INPUT_POST, 'date', FILTER_SANITIZE_STRING);
$number = filter_input(INPUT_POST, 'questions', FILTER_SANITIZE_STRING);
$link = filter_input(INPUT_POST, 'link', FILTER_SANITIZE_URL);
$rawTags = filter_input(INPUT_POST, 'tags', FILTER_SANITIZE_STRING);
$wid = filter_input(INPUT_POST, 'wid', FILTER_SANITIZE_NUMBER_INT);
$informationArray = array($wname, $vname, $author, $date, $number, $rawTags, $link);
if (validation($wname, $author, $date, $number)) {
    db_begin_transaction();
    $newdate = date('Y-d-m h:m:s', strtotime(str_replace('/', '-', $date)));
    $query = "INSERT INTO TWORKSHEETVERSION (`WName`, `VName`, `Link`, `Author ID`) VALUES ('{$wname}', '{$vname}', '{$link}', {$author});";
    try {
        $resultArray = db_insert_query_exception($query);
        $vid = $resultArray[1];
    } catch (Exception $ex) {
        db_rollback_transaction();
        $message = "Something went wrong adding the worksheet, please try again.";
        returnToPageError($message, $ex);
    }
    if (!isset($wid)) {
        $wid = $vid;
    }
    $query1 = "UPDATE TWORKSHEETVERSION SET `Worksheet ID` =  {$wid} WHERE `Version ID` = {$vid};";
Esempio n. 8
0
function Patient($doc, $r, $pid)
{
    global $msg;
    $patient_data = sqlQuery("select *, DATE_FORMAT(DOB,'%Y%m%d') AS date_of_birth from patient_data where pid=?", array($pid));
    $b = $doc->createElement("Patient");
    $b->setAttribute('ID', $patient_data['pid']);
    $PatientName = $doc->createElement("PatientName");
    $patient_data['lname'] = stripSpecialCharacter($patient_data['lname']);
    $patient_data['lname'] = trimData($patient_data['lname'], 35);
    $msg = validation(xl('Patient Last name'), $patient_data['lname'], $msg);
    $last = $doc->createElement("last");
    $last->appendChild($doc->createTextNode($patient_data['lname']));
    $PatientName->appendChild($last);
    $patient_data['fname'] = stripSpecialCharacter($patient_data['fname']);
    $patient_data['fname'] = trimData($patient_data['fname'], 35);
    $msg = validation(xl('Patient First name'), $patient_data['fname'], $msg);
    $first = $doc->createElement("first");
    $first->appendChild($doc->createTextNode($patient_data['fname']));
    $PatientName->appendChild($first);
    $patient_data['mname'] = stripSpecialCharacter($patient_data['mname']);
    $patient_data['mname'] = trimData($patient_data['mname'], 35);
    $middle = $doc->createElement("middle");
    $middle->appendChild($doc->createTextNode($patient_data['mname']));
    $PatientName->appendChild($middle);
    $b->appendChild($PatientName);
    $PatientAddress = $doc->createElement("PatientAddress");
    $patient_data['street'] = stripSpecialCharacter($patient_data['street']);
    $patient_data['street'] = trimData($patient_data['street'], 35);
    $address1 = $doc->createElement("address1");
    $address1->appendChild($doc->createTextNode($patient_data['street']));
    $PatientAddress->appendChild($address1);
    $msg = validation(xl('Patient City'), $patient_data['city'], $msg);
    $city = $doc->createElement("city");
    $city->appendChild($doc->createTextNode($patient_data['city']));
    $PatientAddress->appendChild($city);
    $msg = validation(xl('Patient State'), $patient_data['state'], $msg);
    $state = $doc->createElement("state");
    $state->appendChild($doc->createTextNode($patient_data['state']));
    $PatientAddress->appendChild($state);
    $msg = validation(xl('Patient Zip'), $patient_data['postal_code'], $msg);
    $zip = $doc->createElement("zip");
    $zip->appendChild($doc->createTextNode($patient_data['postal_code']));
    $PatientAddress->appendChild($zip);
    $msg = validation(xl('Patient Country'), $patient_data['country_code'], $msg);
    $county_code = substr($patient_data['country_code'], 0, 2);
    $country = $doc->createElement("country");
    $country->appendChild($doc->createTextNode($county_code));
    $PatientAddress->appendChild($country);
    $b->appendChild($PatientAddress);
    $PatientContact = $doc->createElement("PatientContact");
    $patient_data['phone_home'] = stripPhoneSlashes($patient_data['phone_home']);
    $msg = validation(xl('Patient Home phone'), $patient_data['phone_home'], $msg);
    $homeTelephone = $doc->createElement("homeTelephone");
    $homeTelephone->appendChild($doc->createTextNode($patient_data['phone_home']));
    $PatientContact->appendChild($homeTelephone);
    $b->appendChild($PatientContact);
    $PatientCharacteristics = $doc->createElement("PatientCharacteristics");
    $msg = validation(xl('Patient DOB'), $patient_data['date_of_birth'], $msg);
    $dob = $doc->createElement("dob");
    $dob->appendChild($doc->createTextNode($patient_data['date_of_birth']));
    $PatientCharacteristics->appendChild($dob);
    $msg = validation(xl('Patient Gender'), $patient_data['sex'], $msg);
    $gender_val = substr($patient_data['sex'], 0, 1);
    $gender = $doc->createElement("gender");
    $gender->appendChild($doc->createTextNode($gender_val));
    $PatientCharacteristics->appendChild($gender);
    $b->appendChild($PatientCharacteristics);
    PatientFreeformHealthplans($doc, $b, $pid);
    PatientFreeformAllergy($doc, $b, $pid);
    $r->appendChild($b);
}
<b><center>
<?php 
require_once 'util/main.php';
require_once 'util/Validation.php';
$gender_error = validation(0);
?>

<p>
<form action= "start.php" method="post"> 
        
        
    <label>Your Gender:</label>
        <input type="radio" name="gender" value=1 /> Male 
        <input type="radio" name="gender" value=0 /> Female <br /></p>
    <button type="submit" /> Submit</button>
    </form>


<font color='red'><?php 
echo $gender_error;
?>
</font>
<center></b>
Esempio n. 10
0
<?php

/**
 * Created by PhpStorm.
 * User: Keith Murphy
 * Date: 11/10/2015
 * Time: 10:54 PM
 */
$user_input = $_POST[USER_INPUT_KEY];
$array_data = create_country_array();
$country_names_array = country_names($array_data);
$validated_input = validation($user_input, $country_names_array);
$json_data = find_country($validated_input, $array_data);
     }
     if (!$myEmail == preg_match('/^\\S+@[\\w\\d.-]{2,}\\.[\\w]{2,6}$/iU', $myEmail)) {
         //$errMsg .= "Error: Enter your email.\n";
         $result = false;
     }
     if ($myPhone == 0) {
         $errMsg .= "Error: enter your phone number.";
         $result = false;
     }
     if ($errMsg != "") {
         // display message if there are errors
         echo "<p>  {$errMsg}  </p>";
     }
     return $result;
 }
 validation();
 //$con = @mysqli_connect($host, $user, $pwd, $sqldb);
 if ($conn) {
     $matchquery = "SELECT myEmail FROM CUSTOMER WHERE myEmail = '{$myEmail}'";
     $result = mysqli_query($conn, $matchquery);
     if (mysqli_num_rows($result) == 0) {
         $sqlInsert = "INSERT INTO CUSTOMER (myName, myPwd, confPwd, myEmail, myPhone)\n                              VALUES";
         $sqlInsert .= " ('{$myName}', '{$myPwd}', '{$confPwd}', '{$myEmail}', {$myPhone})";
         $result = mysqli_query($conn, $sqlInsert);
         if ($result) {
             $useridQuery = "SELECT userid FROM CUSTOMER ORDER BY userid DESC LIMIT 1";
             $idArray = mysqli_query($conn, $useridQuery);
             $row = mysqli_fetch_assoc($idArray);
             echo "Thank you for registering! Dear " . $myName . ", you have been sucessful register into Ship Online and your ID is " . $row["userid"] . ".\n                            </br>A confirmation email has been sent to " . $myEmail . "";
         }
         if ($result > 1) {
<b><center>
<?php 
require_once 'util/main.php';
require_once 'util/Validation.php';
include 'Questionnaire_header.php';
$error = validation(1);
$id = $_SESSION['id'];
?>

rate each of the following: 
<p>
    <form action="how_interested_job.php" method="post"> 
        
 <label>How interested are you in the job? </label>
 <br>     
 <?php 
for ($i = 0; $i <= 6; $i++) {
    $j = $i + 1;
    echo "<input type=radio name='interest_level' value={$j}/>" . $j . "&nbsp &nbsp &nbsp &nbsp";
}
?>
    
    <br /><br>
        
</p>

<button type="submit" /> Submit</button>
</form>


<font color='red'><?php 
Esempio n. 13
0
if(!empty($dl)){
	if(REFCHECK){
		$c_okurl=count($okurl);
		$is_okurl=false;
		for($i=0; $i<$c_okurl; $i++){
			if(isset($_SERVER['HTTP_REFERER']) && ($is_okurl = strstr($_SERVER['HTTP_REFERER'],$okurl[$i]) !== FALSE))
				break;
			if(!$is_okurl && $i==$c_okurl-1)
				die("指定URL以外からはDLできません");
		}
	}
	count_dl($dl);
	exit;
}
switch($job){
case 'detail':
	if($detail) show_detail($detail);
	break;
case 'admin':
	if($admin_submit) $admin = md5($admin_submit);
	validation($admin);
	if($act) manage($act,$id,$new);
	if($submit=="Add Entry") add_data($new_loc,$new_id,$description,$new_ref);
	show_track();
	break;
default:
	if(time()-filemtime(LOGFILE) > 3600) @copy(LOGFILE,LOGFILE.".bak");
	show_table($top,$option);
}
?>
Esempio n. 14
0
function Patient($doc, $r, $pid)
{
    global $msg, $warning_msg, $dem_check;
    $patient_data = sqlQuery("select *, DATE_FORMAT(DOB,'%Y%m%d') AS date_of_birth from patient_data where pid=?", array($pid));
    $b = $doc->createElement("Patient");
    $b->setAttribute('ID', $patient_data['pid']);
    $PatientName = $doc->createElement("PatientName");
    $patient_data['lname'] = stripSpecialCharacter($patient_data['lname']);
    $patient_data['lname'] = trimData($patient_data['lname'], 35);
    //$msg = validation(xl('Patient Last name'),$patient_data['lname'],$msg);
    if ($patient_data['lname'] == '') {
        $dem_check .= htmlspecialchars(xl("Patient Last name is missing"), ENT_NOQUOTES) . "<br>";
    }
    $last = $doc->createElement("last");
    $last->appendChild($doc->createTextNode($patient_data['lname']));
    $PatientName->appendChild($last);
    $patient_data['fname'] = stripSpecialCharacter($patient_data['fname']);
    $patient_data['fname'] = trimData($patient_data['fname'], 35);
    //$msg = validation(xl('Patient First name'),$patient_data['fname'],$msg);
    if ($patient_data['fname'] == '') {
        $dem_check .= htmlspecialchars(xl("Patient First name is missing"), ENT_NOQUOTES) . "<br>";
    }
    $first = $doc->createElement("first");
    $first->appendChild($doc->createTextNode($patient_data['fname']));
    $PatientName->appendChild($first);
    $patient_data['mname'] = stripSpecialCharacter($patient_data['mname']);
    $patient_data['mname'] = trimData($patient_data['mname'], 35);
    $middle = $doc->createElement("middle");
    $middle->appendChild($doc->createTextNode($patient_data['mname']));
    $PatientName->appendChild($middle);
    $b->appendChild($PatientName);
    $PatientAddress = $doc->createElement("PatientAddress");
    $patient_data['street'] = stripSpecialCharacter($patient_data['street']);
    $patient_data['street'] = trimData($patient_data['street'], 35);
    $msg = validation(xl('Patient Address'), $patient_data['street'], $msg);
    if (trim($patient_data['street']) == '') {
        $warning_msg .= "<br>" . htmlspecialchars(xl("Patient Address is missing"), ENT_NOQUOTES);
    }
    $address1 = $doc->createElement("address1");
    $address1->appendChild($doc->createTextNode($patient_data['street']));
    $PatientAddress->appendChild($address1);
    //$msg = validation(xl('Patient City'),$patient_data['city'],$msg);
    if ($patient_data['city'] == '') {
        $dem_check .= htmlspecialchars(xl("Patient City is missing"), ENT_NOQUOTES) . "<br>";
    }
    $city = $doc->createElement("city");
    $city->appendChild($doc->createTextNode($patient_data['city']));
    $PatientAddress->appendChild($city);
    if ($patient_data['state']) {
        $state = $doc->createElement("state");
        $state->appendChild($doc->createTextNode($patient_data['state']));
        $PatientAddress->appendChild($state);
    }
    if ($patient_data['postal_code']) {
        $zip = $doc->createElement("zip");
        $zip->appendChild($doc->createTextNode($patient_data['postal_code']));
        $PatientAddress->appendChild($zip);
    }
    //$msg = validation(xl('Patient Country'),$patient_data['country_code'],$msg);
    if (trim($patient_data['country_code']) == '' && $GLOBALS['erx_default_patient_country'] == '') {
        $dem_check .= htmlspecialchars(xl("Patient Country is missing. Also you have not set default Patient Country in Global Settings"), ENT_NOQUOTES) . "<br>";
    } elseif (trim($patient_data['country_code']) == '') {
        $patient_data['country_code'] = $GLOBALS['erx_default_patient_country'];
    }
    $county_code = substr($patient_data['country_code'], 0, 2);
    $country = $doc->createElement("country");
    $country->appendChild($doc->createTextNode($county_code));
    $PatientAddress->appendChild($country);
    $b->appendChild($PatientAddress);
    $PatientContact = $doc->createElement("PatientContact");
    $patient_data['phone_home'] = stripPhoneSlashes($patient_data['phone_home']);
    if ($patient_data['phone_home']) {
        $homeTelephone = $doc->createElement("homeTelephone");
        $homeTelephone->appendChild($doc->createTextNode($patient_data['phone_home']));
        $PatientContact->appendChild($homeTelephone);
    }
    $b->appendChild($PatientContact);
    $PatientCharacteristics = $doc->createElement("PatientCharacteristics");
    if (trim($patient_data['date_of_birth']) == '' || $patient_data['date_of_birth'] == '00000000') {
        $warning_msg .= "<br>" . htmlspecialchars(xl("Patient Date Of Birth is missing"), ENT_NOQUOTES);
    }
    if ($patient_data['date_of_birth'] && $patient_data['date_of_birth'] != '00000000') {
        $dob = $doc->createElement("dob");
        $dob->appendChild($doc->createTextNode($patient_data['date_of_birth']));
        $PatientCharacteristics->appendChild($dob);
    }
    if (trim($patient_data['sex']) == '') {
        $warning_msg .= "<br>" . htmlspecialchars(xl("Patient Gender is missing"), ENT_NOQUOTES);
    }
    if ($patient_data['sex']) {
        $gender_val = substr($patient_data['sex'], 0, 1);
        $gender = $doc->createElement("gender");
        $gender->appendChild($doc->createTextNode($gender_val));
        $PatientCharacteristics->appendChild($gender);
    }
    $b->appendChild($PatientCharacteristics);
    PatientFreeformHealthplans($doc, $b, $pid);
    $allergyId = PatientFreeformAllergy($doc, $b, $pid);
    $r->appendChild($b);
    return $allergyId;
}
Esempio n. 15
0
 * @copyright    Rensselaer Polytechnic Institute
 * @license      GPLv2, see www.gnu.org/licenses/gpl-2.0.html
 * @version      $Revision$
 */
//Content Rendering API
//Version 0.07
//Notes: You shouldn't be touching this file directly.  You should be calling through the render/index.php handler and passing the version 007
include(COMMON_DIR.'user.php');     //Class to represent a site user
include(COMMON_DIR.'feed.php');     //Class to represent a content feed
include(COMMON_DIR.'content.php');  //Class to represent content items in the system


if($_REQUEST['select'] == 'system'){
    system_info();
} else {
    $criteria = validation($_REQUEST);
    $contents = content_selection($criteria);
    if($criteria['format'] == 'raw'){
        render_raw($contents, $criteria);
    }elseif($criteria['format'] == 'html'){
        render_html($contents, $criteria);
    }elseif($criteria['format'] == 'rss'){
        render_rss($contents, $criteria);
    }elseif($criteria['format'] == 'json'){
        render_json($contents, $criteria);
    }
}

//Grab and check user values
function validation($request){
    //Default Values
Esempio n. 16
0
    header("location: edit_menu.php?msg=empty_data&id={$id}");
    die;
}
/*
empty image or new image
*/
if (empty($_FILES['file']['name'])) {
    $img_name = $img;
} else {
    if (file_exists('image/' . $img)) {
        unlink('image/' . $img);
    }
    $img_name = $_FILES['file']['name'];
    //function used to be sure this is image
    require '../helpers/filevalidate.php';
    if (!validation($img_name, array('jpg', 'png', 'jpeg'))) {
        // function return false
        header("location: edit_menu.php?id={$id}&msg=error_data");
        die;
    }
    //function used to know file type
    require '../helpers/filetype.php';
    $type = get_type($img_name);
    //class used to resize images
    require_once '../helpers/ImageManipulator.php';
    //to make random name
    $randomstring = substr(str_shuffle("1234567890abcdefghijklmnopqrstuvwxyz"), 0, 15);
    $img_name = $randomstring . ".{$type}";
    $newName = time() . '_';
    $img = new ImageManipulator($_FILES['file']['tmp_name']);
    //resize image
<b><?php 
require_once 'util/main.php';
require_once 'util/Validation.php';
require_once 'util/db_function.php';
$error = validation(2);
$id = $_SESSION['id'];
$interest = $_SESSION['interest_level'];
add_interest($id, $interest);
//writeToFile($interest);
?>

<p>
    <form action="accept_or_not.php" method="post"> 
        
    <center>
  
    <label>Do you accept the job</label>
        <input type="radio" name="accept" value=1 /> Yes 
        <input type="radio" name="accept" value=0 /> No <br />
    </p>
    
    <button type="submit" /> Submit</button>
    </form>
    </center>

<font color='red'><?php 
echo $error;
?>
</font>
<?php 
$_SESSION['id'] = $id;