Example #1
0
function append_rows($service, $tableID, $taxon)
{
    $rows = prepare_data($taxon['concept_id']);
    //append batches of 10k
    $i = 0;
    $partial = array();
    //initialize
    foreach ($rows as $row) {
        if (number_of_cols($row) != 11) {
            continue;
        }
        //exclude row if total no. of cols is not 11, if not it will cause Fatal error "(400) Content has a different number of columns than the table".
        $row = str_replace('"', "'", $row);
        //need to do this to avoid "Parsing failure. Quotation mark found in unquoted value"
        $partial[] = $row;
        $i++;
        if ($i % 10000 == 0) {
            echo "\n[{$i}]\n";
            insert_rows($partial, $tableID, $service);
            echo "...sleep 20 secs...\n";
            sleep(20);
            $i = 0;
            $partial = array();
            //initialize again...
        }
    }
    if ($partial) {
        insert_rows($partial, $tableID, $service);
    }
    //insert last batch
}
Example #2
0
PrintMenu();
?>

<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>

<?php 
$dbconnection = cohortdb_connect($cohort_db_server, $cohort_db_username, $cohort_db_password);
$db_selected = mysql_select_db($cohort_db_name, $dbconnection);
if (!$db_selected) {
    die('Can\'t use ' . $cohort_db_name . ' : ' . mysql_error());
}
//validate_data("atomiko_anamnistiko", $_GET);
check_patient($_GET['code']);
$data_array2 = prepare_data("atomiko_anamnistiko", $_GET);
if ($_GET['NeoplasmaID0'] == "Z99") {
    $data_array2['NeoplasmaID0'] = $_GET['NeoplasmaICD0'];
    $_GET['NeoplasmaID0'] = $_GET['NeoplasmaICD0'];
}
$names = array_keys($data_array2);
$has_entry_query = "SELECT * FROM atomiko_anamnistiko WHERE PatientCode=" . $_GET['code'];
$result = execute_query($has_entry_query);
$has_entry = mysql_num_rows($result);
mysql_free_result($result);
if ($has_entry) {
    $atomic_sql = "UPDATE `atomiko_anamnistiko` SET ";
    for ($i = 1; $i < count($data_array2) - 1; $i++) {
        $atomic_sql .= "`" . $names[$i] . "`='" . $data_array2[$names[$i]] . "' , ";
    }
    $atomic_sql .= "`" . $names[$i] . "`='" . $data_array2[$names[$i]] . "' ";
Example #3
0
?>

<HTML><HEAD>
<TITLE>Καταχώρηση Νέου Ασθενή</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1253">
<link href="./include/cohort.css" rel="stylesheet" type="text/css"></HEAD>
<?php 
PrintTopMenu();
?>

<P>&nbsp;</P>
<P>&nbsp;</P>

<?php 
validate_data('patients', $_GET);
$data_array = prepare_data('patients', $_GET);
if ($_GET['PatientCode'] == "" && $_GET['MELCode'] == "1111111") {
    $codetype = "NOMELNOKEELCODE";
    $data_array['PatientCode'] = $_GET['next_nonmelkeelcode'];
} elseif ($_GET['PatientCode'] == "" && $_GET['MELCode'] != "") {
    $codetype = "NOKEELCODE";
    $data_array['PatientCode'] = $_GET['clinic'] * 100000 + $data_array['MELCode'];
} else {
    $codetype = "FROMKEEL";
}
$sql = "INSERT INTO `patients` (`PatientCode`, `MELCode`, `Name`, `Surname`, `BirthDate`, `CodeType`) ";
$sql .= "VALUES ( '" . $data_array['PatientCode'] . "' , '" . $data_array['MELCode'] . "' , '" . $data_array['Name'] . "' , '" . $data_array['Surname'] . "' , '" . $data_array['BirthDate'] . "', '" . $codetype . "') ";
//echo $sql;
$what_happened = execute_query($sql);
if ($what_happened == 1) {
    echo "<script>alert('Τα δεδομένα καταχωρήθηκαν με επιτυχία!')</script>\n";
Example #4
0
function store_slide()
{
    global $url_tail, $wp_session, $wpdb;
    if (!empty($_POST) && check_admin_referer('store_slide', '_alfw_nonce')) {
        $file = new alfw_manage_files();
        $wpdb->show_errors();
        $user_data = prepare_data($_POST);
        $create_slide = false;
        if (empty($_POST['slide_id'])) {
            /**
             * Insert
             */
            if ($wpdb->insert($wpdb->prefix . SLIDES_TABLE, $user_data['data'], $user_data['format'])) {
                $error_statuses[] = __('Information saved');
            } else {
                $error_statuses[] = __('Information not saved');
            }
            $slide_id = $wpdb->insert_id;
            $create_slide = true;
        } else {
            /**
             * Update
             */
            if ($wpdb->update($wpdb->prefix . SLIDES_TABLE, $user_data['data'], array('id' => $_POST['slide_id']), $user_data['format'], array('%d'))) {
                $error_statuses[] = __('Information saved');
            } else {
                $error_statuses[] = __('Information not saved');
            }
            $slide_id = $_POST['slide_id'];
        }
        if ($_POST['tmp_picture']) {
            /**
             * Get slider options
             */
            $slider_options = $wpdb->get_results($wpdb->prepare("SELECT\n                            id, deny_resize_img, width, height, thumb_width, thumb_height\n                        FROM\n                            `" . $wpdb->prefix . SLIDER_TABLE . "`\n                    WHERE\n                        id = %d\n                    ", $user_data['data']['slider_id']), ARRAY_A);
            $upload_dir_info = wp_upload_dir();
            $upload_dir_info = $upload_dir_info['basedir'];
            /**
             * Store original image
             */
            $file->create_folder_recursive(FULL_UPLOAD_PATH_ORIG . "/" . $slider_options[0]['id'], 0755);
            //$picture_name = $file->modif_file_name(FULL_UPLOAD_PATH_ORIG . "/" . $slider_options[0]['id'] . "/", $_POST['tmp_picture_name']);
            $picture_name = $file->copy_file($upload_dir_info . "/" . $_POST['tmp_picture'], FULL_UPLOAD_PATH_ORIG . "/" . $slider_options[0]['id'] . "/", $_POST['tmp_picture_name']);
            /*
            if (!copy($upload_dir_info . "/" . $_POST['tmp_picture'], FULL_UPLOAD_PATH_ORIG . "/" . $slider_options[0]['id'] . "/" . $_POST['tmp_picture_name'])){
                throw new Exception('File can\'t copyed to destination folder!');
            }
            */
            /**
             * Work with thumb
             */
            $thumb_width = $slider_options[0]['thumb_width'];
            $thumb_height = $slider_options[0]['thumb_height'];
            /**
             * Check orientation
             */
            $thumb_check_result = $file->check_orientation($thumb_width, $thumb_height, $upload_dir_info . "/" . $_POST['tmp_picture']);
            $force_resize_flag = true;
            /**
             * Different orientation
             */
            $need_places_thmb = false;
            if (!$thumb_check_result['check']) {
                $force_resize_flag = false;
                $thumb_height = $thumb_check_result['resize_height'];
                $thumb_width = $thumb_check_result['resize_width'];
                $need_places_thmb = true;
            }
            $file->resize_upload_img($upload_dir_info . "/" . $_POST['tmp_picture'], $picture_name, $thumb_height, $thumb_width, FULL_UPLOAD_PATH_THUMB . "/" . $slider_options[0]['id'] . "/", $force_resize_flag);
            /**
             * Centered image on canvas
             */
            if ($need_places_thmb) {
                $file->center_place_img_to_canvas($slider_options[0]['thumb_width'], $slider_options[0]['thumb_height'], $thumb_check_result['frame_orient'], FULL_UPLOAD_PATH_THUMB . "/" . $slider_options[0]['id'] . "/" . $picture_name);
            }
            /**
             * Work with main picture
             */
            /**
             * Check orientation
             */
            $check_result = $file->check_orientation($slider_options[0]['width'], $slider_options[0]['height'], $upload_dir_info . "/" . $_POST['tmp_picture']);
            if ($slider_options[0]['deny_resize_img']) {
                /**
                 * No resize image
                 */
                if ($check_result['check']) {
                    $file->copy_file($upload_dir_info . "/" . $_POST['tmp_picture'], FULL_UPLOAD_PATH . "/" . $slider_options[0]['id'] . "/", $picture_name);
                } else {
                    /**
                     * however needs correction
                     */
                    $file->resize_upload_img($upload_dir_info . "/" . $_POST['tmp_picture'], $picture_name, $check_result['resize_height'], $check_result['resize_width'], FULL_UPLOAD_PATH . "/" . $slider_options[0]['id'] . "/", false);
                    $file->center_place_img_to_canvas($slider_options[0]['width'], $slider_options[0]['height'], $check_result['frame_orient'], FULL_UPLOAD_PATH . "/" . $slider_options[0]['id'] . "/" . $picture_name);
                }
            } else {
                /**
                 * Needs resize
                 */
                if ($check_result['check']) {
                    $file->resize_upload_img($upload_dir_info . "/" . $_POST['tmp_picture'], $picture_name, $slider_options[0]['height'], $slider_options[0]['width'], FULL_UPLOAD_PATH . "/" . $slider_options[0]['id'] . "/", true);
                } else {
                    $file->resize_upload_img($upload_dir_info . "/" . $_POST['tmp_picture'], $picture_name, $check_result['resize_height'], $check_result['resize_width'], FULL_UPLOAD_PATH . "/" . $slider_options[0]['id'] . "/", false);
                    $file->center_place_img_to_canvas($slider_options[0]['width'], $slider_options[0]['height'], $check_result['frame_orient'], FULL_UPLOAD_PATH . "/" . $slider_options[0]['id'] . "/" . $picture_name);
                }
            }
            /**
             * Update picture field
             */
            $wpdb->update($wpdb->prefix . SLIDES_TABLE, array('picture' => $picture_name), array('id' => $slide_id), array('%s'), array('%d'));
            /**
             * Delete old picture
             */
            if (!empty($_POST['old_picture']) && $picture_name) {
                $file->delete_file(FULL_UPLOAD_PATH . "/" . $slider_options[0]['id'] . "/" . $_POST['old_picture']);
                $file->delete_file(FULL_UPLOAD_PATH_THUMB . "/" . $slider_options[0]['id'] . "/" . $_POST['old_picture']);
                $file->delete_file(FULL_UPLOAD_PATH_ORIG . "/" . $slider_options[0]['id'] . "/" . $_POST['old_picture']);
            }
            /**
             * Delete tmp picture
             */
            $file->delete_file($upload_dir_info . "/" . $_POST['tmp_picture']);
            $file->delete_file($upload_dir_info . "/preview_" . $_POST['tmp_picture']);
        }
        $wp_session->s_set('errors', $error_statuses);
    }
}
Example #5
0
<? PrintMenu(); ?>

<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>

<?php
*/
//form_data2table($_GET);
$dbconnection = mysql_connect($cohort_db_server, $cohort_db_username, $cohort_db_password);
$db_selected = mysql_select_db($cohort_db_name, $dbconnection);
if (!$db_selected) {
    die('Can\'t use ' . $cohort_db_name . ' : ' . mysql_error());
}
validate_data('demographic_data', $_GET);
$data_array2 = prepare_data('demographic_data', $_GET);
if ($_GET['country'] > 0) {
    $result = execute_query("SELECT Category FROM countries_list WHERE ID='" . $_GET['country'] . "'");
    $row = mysql_fetch_array($result);
    $data_array2['Origin'] = $row[0];
}
if ($_GET['has_entry'] == 0) {
    $query = "SELECT UPPER(LEFT(Name, " . $preferences['num_initials'] . ")), UPPER(LEFT(Surname, " . $preferences['num_initials'] . ")), BirthDate FROM patients WHERE PatientCode = " . $data_array2['PatientCode'];
    $result = execute_query($query);
    $row = mysql_fetch_array($result);
    $data_array2['Name'] = $row[0];
    $data_array2['Surname'] = $row[1];
    $data_array2['BirthDate'] = $row[2];
    mysql_free_result($result);
    $names = array_keys($data_array2);
    $sql = "INSERT INTO `demographic_data` ( ";
                echo "<P>Τα δεδομένα καταχωρήθηκαν με επιτυχία!</P>";
            } else {
                echo "<P>{$what_happened}</P>";
            }
        }
    }
}
if ($what_to_store['HasAIDS']) {
    $what_happened = insert_data("patient_has_aids", $_GET);
    if ($what_happened == 1) {
        echo "<P>Τα δεδομένα καταχωρήθηκαν με επιτυχία!</P>";
    } else {
        echo "<P>{$what_happened}</P>";
    }
    if ($_GET['HasReappearance'] == 1) {
        $data_array2 = prepare_data("patient_has_aids_reapperances", $_GET);
        for ($i = 0; $i < $_GET['num_nosoi_reappear']; $i++) {
            $sql = "";
            $sql .= " INSERT INTO `patient_has_aids_reapperances` ( `PatientCode` , `MELCode` , `NososSymptID`, `NososSymptDiagnosis`, `NososSymptDate` )";
            $sql .= " VALUES ( '" . $data_array2['PatientCode'] . "' , '" . $data_array2['MELCode'] . "' , '" . $data_array2['NososSymptID' . $i] . "', '" . $data_array2['NososSymptDiagnosis' . $i] . "', '" . $data_array2['NososSymptDate' . $i] . "' );";
            echo "<BR>" . $sql . "<BR><BR>";
            $what_happened = execute_query($sql);
            if ($what_happened == 1) {
                echo "<P>Τα δεδομένα καταχωρήθηκαν με επιτυχία!</P>";
            } else {
                echo "<P>{$what_happened}</P>";
            }
        }
    }
}
?>
Example #7
0
<? PrintMenu(); ?>

<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>

<?php
*/
$dbconnection = cohortdb_connect($cohort_db_server, $cohort_db_username, $cohort_db_password);
$db_selected = mysql_select_db($cohort_db_name, $dbconnection);
if (!$db_selected) {
    die('Can\'t use ' . $cohort_db_name . ' : ' . mysql_error());
}
//validate_data("exams_anosologikes", $_GET);
check_patient($_GET['PatientCode']);
$data_array2 = prepare_data("exams_anosologikes", $_GET);
$names = array_keys($data_array2);
$sql = "";
for ($k = 0; $k < $_GET['exams']; $k++) {
    $sql = "INSERT INTO `exams_anosologikes` ( `PatientCode` , `ExamDate` , `AbsoluteLemf` , `AbsoluteCD4` , `PercentCD4` , `AbsoluteCD8` , `PercentCD8`)";
    $sql .= " VALUES ('" . $data_array2['PatientCode'] . "', '" . $data_array2['ExamDate' . $k] . "', ";
    $sql .= "'" . replacecomma($data_array2['AbsoluteLemf' . $k]) . "', '" . replacecomma($data_array2['AbsoluteCD4' . $k]) . "', '" . replacecomma($data_array2['PercentCD4' . $k]);
    $sql .= "', '" . replacecomma($data_array2['AbsoluteCD8' . $k]) . "', '" . replacecomma($data_array2['PercentCD8' . $k]) . "');";
    //echo $sql;
    $sql = replace2null($sql);
    $what_happened = execute_query($sql);
    echo mysql_error();
    /*
    if ($what_happened == 1)
        {
            echo "<P>Τα δεδομένα καταχωρήθηκαν με επιτυχία!</P>";
Example #8
0
{
    $dns = dns_get_record($host, DNS_ANY);
    return $dns;
}
$i = 0;
function prepare_data($array)
{
    if (!is_array($array)) {
        return "<error>";
    } else {
        $str = array();
        foreach ($array as $item) {
            if (isset($item['ip'])) {
                $str[] = $item['ip'];
            }
            if (isset($item['target'])) {
                $str[] = $item['target'];
            }
        }
        return join("\t", $str);
    }
}
foreach ($zones[1] as $zone) {
    if (strlen($zone) > 3) {
        $info = check_dns($zone);
        $str = $zone . " " . prepare_data($info) . "\n";
        file_put_contents("/php/includes/dns.log", $str, FILE_APPEND);
        echo $i . " " . $str;
        $i++;
    }
}
Example #9
0
function insert_data($table, $data_array)
{
    validate_data($table, $data_array);
    $data_array2 = prepare_data($table, $data_array);
    $names = array_keys($data_array2);
    $sql = "INSERT INTO `" . $table . "` ( ";
    for ($i = 0; $i < count($data_array2) - 1; $i++) {
        $sql .= "`" . $names[$i] . "` , ";
    }
    $sql .= "`" . $names[$i] . "` ) VALUES ( ";
    for ($i = 0; $i < count($data_array2) - 1; $i++) {
        $sql .= "'" . $data_array2[$names[$i]] . "' , ";
    }
    $sql .= "'" . $data_array2[$names[$i]] . "' );";
    echo $sql;
    return execute_query($sql);
}
Example #10
0
    }
}
$place = isset($_GET['place']) ? $_GET['place'] : null;
if (is_null($place) || $place == '') {
    $response['messages'] = get_docs();
    echo json_encode($response);
    die;
}
if (!array_key_exists($place, $places)) {
    $response['messages'] = get_docs();
    echo json_encode($response);
    die;
}
$latlong = $places[$place];
list($method, $year, $latitude, $longitude, $timeZone) = array(5, $today['year'], $latlong[0], $latlong[1], 8);
$prayTime = new PrayTime($method);
if (isset($_GET['monthly']) && $_GET['monthly'] != "" && $_GET['monthly'] == 1) {
    $date = strtotime($year . '-' . $today['mon'] . '-1');
    $endDate = strtotime($year . '-' . ($today['mon'] + 1) . '-1');
    prepare_data($date, $endDate, $latitude, $longitude, $timeZone, $prayTime, $arr);
} elseif (isset($_GET['anually']) && $_GET['anually'] != "" && $_GET['anually'] == 1) {
    $date = strtotime($year . '-1-1');
    $endDate = strtotime($year + 1 . '-1-1');
    prepare_data($date, $endDate, $latitude, $longitude, $timeZone, $prayTime, $arr);
} else {
    $date = strtotime($year . '-' . $today['mon'] . '-' . $today['mday']);
    $endDate = strtotime($year . '-' . $today['mon'] . '-' . ($today['mday'] + 1));
    prepare_data($date, $endDate, $latitude, $longitude, $timeZone, $prayTime, $arr);
}
$response['data'] = $arr;
echo json_encode($response);
Example #11
0
<?php 
PrintMenu();
?>

<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>

<?php 
$dbconnection = cohortdb_connect($cohort_db_server, $cohort_db_username, $cohort_db_password);
$db_selected = mysql_select_db($cohort_db_name, $dbconnection);
if (!$db_selected) {
    die('Can\'t use ' . $cohort_db_name . ' : ' . mysql_error());
}
check_patient($_GET['PatientCode']);
$data_array2 = prepare_data("exams_ourwn", $_GET);
$names = array_keys($data_array2);
//print_r($_GET);
//print_r($data_array2);
$sql = "";
for ($k = 0; $k < $_GET['exams']; $k++) {
    $sql = "INSERT INTO `exams_ourwn` ( `PatientCode` , `ExamDate` , `EB` , `Leukwma` , `Leukwma_extra` , `Puosfairia`, `Eruthra`, `Kulindroi`)";
    $sql .= " VALUES ('" . $data_array2['PatientCode'] . "', '" . $data_array2['ExamDate' . $k];
    $sql .= "', '" . $data_array2['EB' . $k] . "', '" . $data_array2['Leukwma' . $k] . "', '" . $data_array2['Leukwma_extra' . $k] . "', '" . $data_array2['Puosfairia' . $k];
    $sql .= "', '" . $data_array2['Eruthra' . $k] . "', '" . $data_array2['Kulindroi' . $k] . "');";
    echo $sql;
    $sql = replace2null($sql);
    echo $sql;
    $what_happened = execute_query($sql);
    if ($what_happened == 1) {
        echo "<P>Τα δεδομένα καταχωρήθηκαν με επιτυχία!</P>";