Beispiel #1
0
function GetPhonesearchData($phonesearchParam, $searchParam)
{
    $where = "";
    if ($searchParam == "0") {
        $where = " mobile_number ='{$phonesearchParam}'";
    } else {
        if ($searchParam == "1") {
            $where = " mobile_number like '{$phonesearchParam}%'";
        } else {
            $where = " mobile_number like '%{$phonesearchParam}'";
        }
    }
    $host = "localhost";
    $user = "******";
    $pass = "******";
    $database = "blinx";
    $conn = mysqli_connect($host, $user, $pass, $database) or die("Error " . mysqli_error($link));
    $query = "SELECT user_id, first_name, last_name, email_id, mobile_number, alternative_mobile_number, date_of_birth, gender, qualification, institution, occupation, state, district, location, address, document_path, create_time, update_time, cud, verified, m_id, verifier_mid, pwd \nFROM m_user where";
    $sql = $query . $where;
    logToFile($sql);
    $result = mysqli_query($conn, $sql);
    logToFile('-------------------------------------------');
    //logToFile($result);
    if (!$result) {
        echo "Could not successfully run query ({$sql}) from DB: " . mysql_error();
        exit;
    }
    $data['data'] = array();
    while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
        array_push($data['data'], $row);
    }
    echo json_encode($data);
    mysqli_close($conn);
}
Beispiel #2
0
function GetblocationsearchData($lat1, $lng1)
{
    $host = "localhost";
    $user = "******";
    $pass = "******";
    $database = "blinx";
    $conn = mysqli_connect($host, $user, $pass, $database) or die("Error " . mysqli_error($link));
    if ($lat1 == "" && $lng1 == "") {
        logToFile("No Latitude");
        $query = "SELECT UserId,\n       t.Id,\n       helpId,\n       h.Description,\n       CONCAT(u.first_name, ' ', u.last_name) AS Name,\n       t.Address,\n       Requesteddate,\n       Message\n  FROM t_help_request t\n       INNER JOIN f_help h ON t.helpId = h.Id\n       INNER JOIN m_user u ON u.user_id = t.UserId\nWhere DATEDIFF(NOW(),Requesteddate)<100\nORDER BY Requesteddate asc\n LIMIT 0, 20";
    } else {
        $query = "SELECT  ( 3959 * acos( cos( radians({$lat1}) ) * " . "cos( radians( latitude ) ) * cos( radians( longitude ) - radians({$lng1}) ) + sin( radians({$lat1}) ) * " . "sin( radians( latitude ) ) ) ) AS distance,latitude,longitude,UserId," . "t.Id,helpId,h.Description,CONCAT(u.first_name, ' ' ,u.last_name) as Name, t.Address," . " Requesteddate , Message" . " FROM t_help_request t inner join f_help h  on t.helpId=h.Id   " . " inner join m_user u on u.user_id=t.UserId " . " HAVING distance < 10 ORDER BY distance LIMIT 0 , 20";
    }
    $sql = $query;
    logToFile($sql);
    $result = mysqli_query($conn, $sql);
    logToFile('-------------------------------------------');
    //logToFile($result);
    if (!$result) {
        echo "Could not successfully run query ({$sql}) from DB: " . mysql_error();
        exit;
    }
    $data['data'] = array();
    while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
        array_push($data['data'], $row);
    }
    echo json_encode($data);
    mysqli_close($conn);
}
Beispiel #3
0
function processFbEvent($event)
{
    foreach ($event->changes as $change) {
        switch ($change->field) {
            case 'feed':
                // process new comment logic
                if ($change->value->item == 'comment' && $change->value->verb == 'add' && $change->value->parent_id == $change->value->post_id && $change->value->sender_id != PAGE_ID && (USER_COMMENT_AUTO_LIKE_ON || USER_COMENT_AUTO_REPLY_ON)) {
                    $params = ['client_id' => APP_ID, 'client_secret' => APP_SECRET, 'access_token' => PAGE_VERIFY_TOKEN, 'fields' => 'from{id}'];
                    $postAuthorId = json_decode(fb_api_get("/" . $change->value->post_id, $params))->from->id;
                    logToFile('curl.log', $postAuthorId);
                    if ($postAuthorId != PAGE_ID) {
                        continue;
                    }
                    if (USER_COMMENT_AUTO_LIKE_ON) {
                        $params = ['client_id' => APP_ID, 'client_secret' => APP_SECRET, 'access_token' => PAGE_VERIFY_TOKEN];
                        fb_api_post("/{$change->value->comment_id}/likes", $params);
                    }
                    if (USER_COMMENT_AUTO_REPLY_ON) {
                        $params = ['client_id' => APP_ID, 'client_secret' => APP_SECRET, 'access_token' => PAGE_VERIFY_TOKEN, 'message' => USER_COMMENT_AUTO_REPLY_MSG];
                        fb_api_post("/{$change->value->comment_id}/comments", $params);
                    }
                }
                // process new post logic
                if ($change->value->item == 'post' && $change->value->verb == 'add' && $change->value->sender_id != PAGE_ID && (USER_POST_AUTO_LIKE_ON || USER_POST_REPLY_ON)) {
                    if (USER_POST_AUTO_LIKE_ON) {
                        $params = ['client_id' => APP_ID, 'client_secret' => APP_SECRET, 'access_token' => PAGE_VERIFY_TOKEN];
                        fb_api_post("/{$change->value->post_id}/likes", $params);
                    }
                    if (USER_POST_AUTO_REPLY_ON) {
                        $params = ['client_id' => APP_ID, 'client_secret' => APP_SECRET, 'access_token' => PAGE_VERIFY_TOKEN, 'message' => USER_POST_AUTO_REPLY_MSG];
                        fb_api_post("/{$change->value->post_id}/comments", $params);
                    }
                }
                break;
            case 'conversations':
                if (CONVERSATION_REPLY_ON) {
                    $params = ['client_id' => APP_ID, 'client_secret' => APP_SECRET, 'access_token' => PAGE_VERIFY_TOKEN, 'fields' => 'from,created_time', 'since' => time() - CONVERSATION_AUTO_REPLY_COOLDOWN];
                    $lastMsgs = json_decode(fb_api_get("/{$change->value->thread_id}/messages", $params));
                    logToFile('curl.log', print_r($lastMsgs, 1));
                    $needReply = true;
                    foreach ($lastMsgs as $msg) {
                        if ($msg['from']['id'] == PAGE_ID) {
                            $needReply = false;
                            break;
                        }
                    }
                    if ($needReply) {
                        $params = ['client_id' => APP_ID, 'client_secret' => APP_SECRET, 'access_token' => PAGE_VERIFY_TOKEN, 'message' => CONVERSATION_AUTO_REPLY_MSG];
                        fb_api_post("/{$change->value->thread_id}/messages", $params);
                    }
                }
                break;
            default:
                //do nothing
        }
    }
}
Beispiel #4
0
function resetDemo()
{
    checkConn();
    unset($_SESSION['lastTextTime']);
    unset($_SESSION['lastAction']);
    $sql = "TRUNCATE TABLE `akshhhlt_blupay`.`users`";
    $result = mysqli_query($GLOBALS['sqli_conn'], $sql);
    logToFile($sql, $result);
    echo "reset successful";
    return "reset successful";
}
Beispiel #5
0
function InsertBenificiaryData($firstname1, $lastname1, $email1, $phone1, $place1, $place2, $pwd)
{
    $host = "localhost";
    $user = "******";
    $pass = "******";
    $database = "blinx";
    $conn = mysqli_connect($host, $user, $pass, $database) or die("Error " . mysqli_error($link));
    try {
        $sql1 = "select count(*)  as count from m_volunteer where mobile_number='{$phone1}'";
        logToFile($sql1);
        $result = mysqli_query($conn, $sql1);
        if (!$result) {
            logToFile(mysql_error());
            echo 'Failed Registration';
        } else {
            $count = mysqli_fetch_object($result)->count;
            //logToFile((string)$row[0]);
            if (intval($count) == 0) {
                $sql2 = "select COALESCE(MAX(volunteer_id), 0) as id from m_volunteer";
                logToFile($sql2);
                $result1 = mysqli_query($conn, $sql2);
                if (!$result1) {
                    echo "Failed Registration ({$sql2}) from DB: " . mysql_error();
                } else {
                    $id = mysqli_fetch_object($result1)->id;
                    $bid = intval($id) + 1;
                    logToFile($bid);
                    $sql = "INSERT INTO m_volunteer " . "(volunteer_id," . "first_name," . "last_name," . "email_id," . "mobile_number," . "lati," . "longi," . "cud," . "create_time," . "pwd)" . "VALUES" . "( {$bid},'{$firstname1}'," . "'{$lastname1}','{$email1}','{$phone1}','{$place1}','{$place2}','C',now(),'{$pwd}')";
                    logToFile($sql);
                    if (!mysqli_query($conn, $sql)) {
                        logToFile(mysql_error());
                        mysqli_close($conn);
                        echo '0';
                    } else {
                        logToFile("Registration Success");
                        mysqli_close($conn);
                        echo '1';
                    }
                }
            } else {
                echo '2';
            }
        }
    } catch (Exception $e) {
        logToFile($e->getMessage());
        logToFile(mysqli_close($conn));
        echo 'fail';
    }
}
Beispiel #6
0
function myErrorHandler($errno, $errstr, $errfile, $errline)
{
    header("HTTP/1.1 500 Internal Server Error");
    $date = date("Y-m-d H:i:s", time());
    $message = "";
    $message .= "-------------------------------------------------------\n";
    $message .= "DATE : " . $date . "\n";
    $message .= "ERRNO : " . $errno . "\n";
    $message .= "ERRSTR : " . $errstr . "\n";
    $message .= "ERRFILE : " . $errfile . "\n";
    $message .= "ERRLINE : " . $errline . "\n";
    $message .= "-------------------------------------------------------";
    logToFile($message);
    die('Erreur serveur');
}
Beispiel #7
0
function checkSolarTemp()
{
    global $minSolar;
    $sql = query("SELECT sensorId FROM sensoren where name = 'Solar'");
    $row = fetch($sql);
    $temp = getSensorTemp($row[sensorId]);
    logToFile("Skript: Prüfe Solartemperatur - Solarpanel IST: {$temp} Min.: {$minSolar}");
    if ($minSolar > $temp) {
        //logToFile("Skript: Solar EIN - Solarpanel IST: $temp Min.: $minSolar");
        return 1;
    } else {
        //logToFile("Skript: Solar AUS - Solarpanel IST: $temp Min.: $minSolar");
        return 0;
    }
}
function debugArrayToFile($array, $var_name = 'ARRAY')
{
    $keys = array_keys($array);
    foreach ($keys as $key) {
        $value = $array[$key];
        $name_length = strlen($var_name);
        $temp_name = '';
        for ($index = 0; $index < $name_length; $index++) {
            $temp_name .= ' ';
        }
        if (is_array($value)) {
            logToFile('DEBUG --- ' . $var_name);
            logArrayToFile($value, $temp_name . ' [\'' . $key . '\']');
        } else {
            logToFile('DEBUG --- ' . $var_name . ' [\'' . $key . '\'] => ' . $value);
        }
    }
}
Beispiel #9
0
function generateManifest($manifest_path, $parent, $catalog)
{
    $plist = new CFPropertyList();
    $plist->add($dict = new CFDictionary());
    if ($catalog != '') {
        // Add manifest to production catalog by default
        $dict->add('catalogs', $array = new CFArray());
        $array->add(new CFString($catalog));
    }
    // Add parent manifest to included_manifests to achieve waterfall effect
    $dict->add('included_manifests', $array = new CFArray());
    $array->add(new CFString($parent));
    $tmp = explode('/', $manifest_path);
    $manifest = end($tmp);
    logToFile("Generating manifest '{$manifest}'...");
    // Save the newly created plist
    $plist->saveXML($manifest_path);
}
Beispiel #10
0
function VerifyLogin($username1, $password1)
{
    $host = "localhost";
    $user = "******";
    $pass = "******";
    $database = "blinx";
    $conn = mysqli_connect($host, $user, $pass, $database) or die("Error " . mysqli_error($link));
    try {
        $sql1 = "select count(*) as count from m_volunteer where email_id='{$username1}'";
        logToFile($sql1);
        $result = mysqli_query($conn, $sql1);
        if (!$result) {
            logToFile(mysql_error());
            echo 'Failed Registration';
        } else {
            $count = mysqli_fetch_object($result)->count;
            logToFile($count);
            if (intval($count) >= 1) {
                $sql2 = "select count(*) as count from m_volunteer where email_id='{$username1}' and pwd='{$password1}'";
                logToFile($sql2);
                $result1 = mysqli_query($conn, $sql2);
                if (!$result1) {
                    echo "Failed Registration ({$sql2}) from DB: " . mysql_error();
                } else {
                    $value = mysqli_fetch_object($result1)->count;
                    if (intval($value) == 1) {
                        echo '0';
                    } else {
                        echo '1';
                    }
                }
            } else {
                echo '2';
            }
        }
    } catch (Exception $e) {
        logToFile($e->getMessage());
        logToFile(mysqli_close($conn));
        echo 'fail';
    }
}
Beispiel #11
0
function authenticateUser($username, $password)
{
    $sql = "SELECT * FROM users WHERE username = :username and password = :password";
    try {
        $db = getConnection();
        $stmt = $db->prepare($sql);
        $stmt->bindParam("username", $username);
        $stmt->bindParam("password", $password);
        $stmt->execute();
        $userDetails = $stmt->fetchAll(PDO::FETCH_OBJ);
        logToFile("/Applications/MAMP/htdocs/HealthCareSystem/RestAPI/errorlog.log", "Hello User Details are " . $userDetails);
        $db = null;
        //echo '{"user": '******'}';
    } catch (PDOException $e) {
        echo '{"error":{"text":' . $e->getMessage() . '}}';
        throw new Exception('Uncaught Exception' . $e->getMessage());
    } catch (Exception $e1) {
        echo '{"error1":{"text1":' . $e1->getMessage() . '}}';
        throw new Exception('Uncaught Exception' . $e1->getMessage());
    }
}
Beispiel #12
0
function GetDateFilterData()
{
    $host = "localhost";
    $user = "******";
    $pass = "******";
    $database = "blinx";
    $conn = mysqli_connect($host, $user, $pass, $database) or die("Error " . mysqli_error($link));
    $sql = "SELECT Id,Description,IsUsed from f_date";
    $result = mysqli_query($conn, $sql);
    logToFile('-------------------------------------------');
    //logToFile($result);
    if (!$result) {
        echo "Could not successfully run query ({$sql}) from DB: " . mysql_error();
        exit;
    }
    $data['data'] = array();
    while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
        array_push($data['data'], $row);
    }
    echo json_encode($data);
    mysqli_close($conn);
}
Beispiel #13
0
function InsertBenificiaryData($Uid1, $email1, $phone1, $helpdId1, $requestdate1, $place1, $place2, $address1, $message1, $education1, $latitide1, $logitude1, $duration1)
{
    try {
        $host = "localhost";
        $user = "******";
        $pass = "******";
        $database = "blinx";
        logToFile($database);
        $conn = mysqli_connect($host, $user, $pass, $database) or die("Error " . mysqli_error($link));
        $sql2 = "select COALESCE(MAX(Id), 0) as MaxID from t_help_request";
        logToFile($sql2);
        $result = mysqli_query($conn, $sql2);
        if (!$result) {
            logToFile("Failed");
            echo 'Failed Registration';
        } else {
            $row = mysqli_fetch_array($result, MYSQLI_ASSOC);
            $txnid = intval($row["MaxID"]) + 1;
            $Uid1 = intval($Uid1);
            $current_date = date("Y-m-d H:i:s");
            $requestdate1 = date("Y-m-d H:i:s", strtotime($requestdate1));
            $helpvalue1 = intval($helpvalue1);
            logToFile($requestdate1);
            $sql = "INSERT INTO t_help_request (Id,phone,email,UserId,helpId,Message,Address," . "Location,Requesteddate,Createddate,latitude,longitude,Duration)" . "VALUES( {$txnid},'{$phone1}','{$email1}',{$Uid1},{$helpdId1}," . "'{$message1}','{$address1}','{$place1}','{$requestdate1}'," . "'{$current_date}','{$latitide1}','{$logitude1}','{$duration1}')";
            logToFile($sql);
            if (!mysqli_query($conn, $sql)) {
                logToFile(mysql_error());
                echo 'Request Failed';
            } else {
                logToFile("callsid added");
                echo 'Request Success';
            }
        }
    } catch (Exception $e) {
        logToFile($e->getMessage());
        logToFile(mysql_close($con));
        echo 'fail';
    }
}
function checkPasswordForLogin($Email, $Plain)
{
    //Get the current password's salt, salt the given Plain-text password, and see if it's the same as
    // the existing saltedPasswordHash
    //While you're at it, if the user is valid, return the UserID for convenience (and efficiency, I suppose)
    $conn = connectToDB();
    $userInfo = GetSingleDbValue("SELECT `SaltedHash`, `Salt`, `UserID` FROM `Users` WHERE `EmailAddress`='" . $Email . "'", $conn);
    $conn->close();
    if (!$userInfo) {
        return false;
    }
    //Debug login override
    //TODO: Remove before final release and after properly instantiating User entries with salts and salted hashes
    if ($Plain == 'Debug') {
        return $userInfo['UserID'];
    }
    //TODO: next line temp
    logToFile("Log Debug Password.txt", $Email . "     Password: "******"     Salt: " . $userInfo['Salt'] . "     SaltedHash: " . hash("sha256", $Plain . $userInfo['Salt']));
    if (hash("sha256", $Plain . $userInfo['Salt']) !== $userInfo['SaltedHash']) {
        return false;
    }
    return $userInfo['UserID'];
}
Beispiel #15
0
function replacement($environment,$file,$pfad,$datei,$namearray) {
   $filecontent = file_get_contents($pfad.$datei);

   #####################
   # utf8
   # ----
   # text must be in utf8
   # if not, we must convert to utf8
   # because preg_match misses targets
   # if text is not in utf8
   #
   #####################

   include_once('functions/text_functions.php');
   $filecontent = cs_utf8_encode2($filecontent);

   #####################
   # utf8
   #####################

   logToFile($pfad.$datei);
   $disc_manager = $environment->getDiscManager();
   $disc_manager->setPortalID($environment->getCurrentPortalID());
   $disc_manager->setContextID($environment->getCurrentContextID());
   $path_to_file = $disc_manager->getFilePath();
   unset($disc_manager);
   $path = $path_to_file.'html_'.$file->getDiskFileNameWithoutFolder().'/';
   $linkpath = "";
   if ( $path != $pfad ) {
      $linkpath = str_replace($path,'',$pfad);
   }
   foreach ( $namearray['oldfilename'] as $index => $name ) {
      $pattern = "~[\\\./\d\wÄÖÜäöü_-]{0,}".$name."~isu";
      #$pattern = "~".$name."~isu";
      logToFile($pattern);
      #pr($pattern);
      preg_match_all($pattern, $filecontent, $current_treffer);
      #pr($current_treffer[0]);
      foreach ( $current_treffer[0] as $treffer ) {
         $trefferlowercase = mb_strtolower($treffer, 'UTF-8');
         $path_relative = '';
         if ( strlen($trefferlowercase) > (strlen($name)+1)
              and ( strstr($trefferlowercase,'/')
                    or strstr($trefferlowercase,'\\')
                  )
            ) {
            $path_relative = str_replace('\\','/',$treffer);
            $path_relative = str_replace($name,'',$path_relative);
            if ( $path_relative[0] == '.' ) {
               $path_relative = substr($path_relative,1);
            }
            if ( $path_relative[0] == '/'
                 or $path_relative[0] == '\\'
               ) {
               $path_relative = substr($path_relative,1);
            }
         }
         global $c_single_entry_point;
         if ( !isset($index)
              or !isset($namearray['filename'][$index])
            ) {
            $namearray_filename_index = '';
         } else {
            $namearray_filename_index = $namearray['filename'][$index];
         }
         if ( !empty($path_relative) ) {
            if ( !empty($linkpath)
                 and stristr($linkpath,$path_relative)
               ) {
               $path_relative = $linkpath;
            }
            $replacement = $c_single_entry_point.'?cid='.$environment->getCurrentContextID().'&mod=material&fct=showzip_file&iid='.$file->getFileID().'&file='.$path_relative.$namearray_filename_index;
         } else {
            $replacement = $c_single_entry_point.'?cid='.$environment->getCurrentContextID().'&mod=material&fct=showzip_file&iid='.$file->getFileID().'&file='.$linkpath.$namearray_filename_index;
         }
         if ( !mb_stristr($filecontent,$replacement) ) {
            $filecontent = str_replace($treffer, $replacement, $filecontent);
         }
      }
      if ( strstr($filecontent,"'".$name."'") ) {
         $trefferlowercase = mb_strtolower($name, 'UTF-8');
         $treffer = "'".$name."'";
         global $c_single_entry_point;
         if ( !isset($index)
              or !isset($namearray['filename'][$index])
            ) {
            $namearray_filename_index = '';
         } else {
            $namearray_filename_index = $namearray['filename'][$index];
         }
         $replacement = $c_single_entry_point.'?cid='.$environment->getCurrentContextID().'&mod=material&fct=showzip_file&iid='.$file->getFileID().'&file='.$linkpath.$namearray_filename_index;
         $filecontent = str_replace($treffer, "'".$replacement."'", $filecontent);
      }
   }
   return $filecontent;
}
Beispiel #16
0
<?php

print_r($_POST);
print_r($_SERVER["REQUEST_METHOD"]);
#print_r( $_SERVER["HTTP_X_FORWARDED_FOR"] );
if (isset($_POST)) {
    logToFile('POST.log', $_POST);
} elseif (isset($_GET)) {
    logToFile('POST.log', $_GET);
}
function logToFile($filename, $msg)
{
    $fd = fopen($filename, "a");
    fwrite($fd, getDateString() . $_SERVER['REQUEST_METHOD'] . " " . $_SERVER['HTTP_X_FORWARDED_FOR'] . "\n");
    if (is_array($msg)) {
        foreach ($msg as $key => $val) {
            fwrite($fd, $key . ":" . $val . "\n");
        }
    }
    fclose($fd);
}
function getDateString()
{
    return "[" . date("Y/m/d h:i:s", mktime()) . "] ";
}
Beispiel #17
0
<?php

include_once "includes/logging.php";
// include for logging
$db_host = "localhost";
// host
$db_user = "******";
// user
$db_pass = "******";
// password
$db_name = "mdbx10mx_mdbdb";
// name
$conn = new mysqli($db_host, $db_user, $db_pass, $db_name);
if ($conn->connect_error) {
    logToFile("Connection failed: " . $conn->connect_error, "logs/log.txt");
    die('Oops, database selection problem! --> ' . $conn->connect_error);
}
Beispiel #18
0
                        logToFile('Bulleting', 'Added', $title);
                    }
                    // Logger
                    header("Location: ./?module=admin&part=bulletin");
                } elseif ($_GET['a'] == 'update') {
                    $title = mysql_real_escape_string($_POST['title']);
                    $content = mysql_real_escape_string($_POST['content']);
                    $author = mysql_real_escape_string($_POST['author']);
                    $id = $_POST['id'];
                    mysql_query("UPDATE bulletin SET title='{$title}', content='{$content}', author='{$author}' WHERE id = '{$id}'");
                    $_SESSION['text'] = 'Bulletin "' . $title . '" edited!';
                    $_SESSION['type'] = 'success';
                    if ($logFile) {
                        logToFile('Bulleting', 'Edit', $title);
                    }
                    // Logger
                    header("Location: ./?module=admin&part=bulletin");
                } elseif ($_GET['a'] == 'delete') {
                    mysql_query("DELETE FROM bulletin WHERE id='" . $_GET['id'] . "'");
                    $_SESSION['text'] = 'Bulletin successfully removed!';
                    $_SESSION['type'] = 'success';
                    if ($logFile) {
                        logToFile('Bulleting', 'Deletion', $title);
                    }
                    // Logger
                    header("Location: ./?module=admin&part=bulletin");
                }
            }
        }
    }
}
Beispiel #19
0
          $allRecords[$month] = $parsed;
          $months[] = $month;
      }
  }
  //of foreach
  // if not found, display error
  if (!$found) {
      echo "<div class=\"container\"><div class=\"row\"><div class=\"col-md-4\">";
      echo "<p>Ο υπάλληλος δε βρέθηκε ή έχετε καταχωρήσει λανθασμένα στοιχεία...</p><br><br></div></div>";
      echo "<div class=\"row\"><div class=\"col-md-2\"><a href=\"index.php\" class=\"btn btn-lg btn-primary btn-block\" >Επιστροφή</a>";
      echo "</div></div></div>";
      exit;
  }
  // log to file
  if ($canLog) {
      logToFile($inpAfm, $logFile);
  }
  ?>
 <div class="container">
    <!-- Create nav-tabs -->
    <div class="panel with-nav-tabs panel-default">
      <div class="panel-heading">
        <ul class="nav nav-tabs">
          <?php 
  $first = 1;
  foreach ($months as $mon) {
      echo "<li ";
      echo $first ? "class=\"active\"" : '';
      echo "><a data-toggle=\"tab\" href=\"#{$mon}\">{$mon}</a></li>";
      $first = 0;
  }
Beispiel #20
0
function type2QtType($fieldMeta)
{
    logToFile('FIELD ' . $fieldMeta->name . ': ' . $fieldMeta->type . ' (' . $fieldMeta->blob . ', ' . $fieldMeta->zerofill . ')');
    if ($fieldMeta->type == 'blob' && $fieldMeta->type != 1) {
        $type = 'string';
    } else {
        $type = $fieldMeta->type;
    }
    $map = array('string' => 'QString', 'blob' => 'QByteArray', 'date' => 'QDate', 'time' => 'QTime', 'datetime' => 'QDateTime');
    if (isset($map[$type])) {
        return $map[$type];
    } else {
        return $type;
    }
}
Beispiel #21
0
    $p_title = mysql_real_escape_string($_POST['p_title']);
    $p_content = mysql_real_escape_string($_POST['p_content']);
    $charid = mysql_real_escape_string($_SERVER['HTTP_EVE_CHARID']);
    $date = strtotime(date('Y-m-d H:i:s'));
    $id = mysql_real_escape_string($_POST['id']);
    mysql_query("UPDATE pages SET p_name='{$p_name}', p_title='{$p_title}', p_content='{$p_content}', char_id='{$charid}', datetime='{$date}' WHERE id = '{$id}'");
    $_SESSION['text'] = 'Page "' . $p_name . '" Updated Successfully!';
    $_SESSION['type'] = 'success';
    if ($logFile) {
        logToFile('Site Pages', 'Edit', $p_name);
    }
    // Logger
    //header('Location: ./?p=page_manager&do=edit&id='.$id.'');
    redirect('./?module=admin&part=page&do=edit&id=' . $id . '');
    exit;
}
if (isset($_GET['a']) && $_GET['a'] == 'del') {
    $id = mysql_real_escape_string($_GET['id']);
    $get_name = good_query_assoc("SELECT p_title FROM pages WHERE id='" . $id . "'");
    $show_name = $get_name['p_title'];
    $_SESSION['text'] = 'Page "' . $show_name . '" Deleted Successfully!';
    $_SESSION['type'] = 'success';
    if ($logFile) {
        logToFile('Site Pages', 'Deletion', $show_name);
    }
    // Logger
    mysql_query("DELETE FROM pages WHERE id='" . $id . "'");
    //header('Location: ./?p=page_manager');
    redirect('./?module=admin&part=page');
    exit;
}
Beispiel #22
0
function logError($logfile, $msg, $level = 0)
{
    if ($GLOBALS['nolog']) {
        return;
    }
    $trace = $msg . "\r\n";
    if ($logfile != 'notrace') {
        ob_start();
        debug_print_backtrace();
        $trace .= "<<<\r\n" . ob_get_clean() . ">>>\r\n";
    }
    logToFile('log/error.log', $trace);
    if ($level >= 10 || $logfile == 'display') {
        print '<div class="banner">' . $msg . '</div>';
        if ($level >= 20) {
            die;
        }
    }
}
Beispiel #23
0
function writeCrontab($start, $stop, $start1, $stop1, $startTablet, $stopTablet, $ladezeit)
{
    $file = <<<END
# Dieser Crontab wurde automatisch mit der Pool Steuerung erstellt.
# Hier Keine Einträge machen, da diese automatisch mit einem Skript überschrieben werden.
# CD 2013

END;
    //$file .= "@reboot wget -q -O /dev/null localhost/python/initial.php\n";
    $file .= "*/5 {$start}-{$stop} * * * wget -q -O /dev/null localhost/python/steuerung.php\n";
    $file .= "*/5 {$start1}-{$stop1} * * * wget -q -O /dev/null localhost/python/steuerung.php\n";
    $file .= "*/5 {$startTablet}-{$stopTablet} * * {$ladezeit} wget -q -O /dev/null localhost/python/steuerungTablet.php\n";
    logToFile("cronjob: {$file}");
    $tmp = tempnam('/tmp', 'pooltimer');
    $tmpHandle = fopen($tmp, "w");
    fwrite($tmpHandle, $file);
    fclose($tmpHandle);
    exec("/usr/bin/crontab {$tmp}");
    unlink($tmp);
}
Beispiel #24
0
<?php

// Export to PDF using mPDF
require_once './vendor/autoload.php';
require_once 'config.php';
require_once 'functions.php';
$data = htmlspecialchars_decode($_REQUEST['data']);
$afm = $_REQUEST['afm'];
$stylesheet = file_get_contents('lib/bootstrap.min.css');
$fname = 'pdf/es_' . $afm . '_' . rand() . '.pdf';
$footer = "{$dnsiStrShort}";
// mPDF initialization & pdf creation
$mpdf = new mPDF();
$mpdf->SetFooter($footer);
$mpdf->WriteHTML($stylesheet, 1);
$mpdf->WriteHTML($data, 2);
$mpdf->Output($fname);
//log to file
if ($canLog) {
    logToFile($afm, $logFile, 1);
}
// echo (return) file link
echo "<a href='{$fname}' target='_blank'><strong>Λήψη αρχείου</strong></a>";
Beispiel #25
0
        header("HTTP/1.1 418 I'm a teapot");
        return;
    }
    $curl = curl_init($service_url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    //we need it to echo
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_post_data);
    logToFile("Executing request");
    $response = curl_exec($curl);
    $httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    //if 0, server not found
    logToFile("{$httpcode} recieved");
    curl_close($curl);
    if ($httpcode >= 200 && $httpcode < 300) {
        echo $response;
        //default code is 200
    } else {
        http_response_code($httpcode ? $httpcode : 404);
    }
} catch (Exception $e) {
    logToFile('Message: ' . $e->getMessage());
}
logToFile("end");
///////////////
//UTILITIES///
/////////////
function logToFile($log)
{
    file_put_contents("logs.log", $log . PHP_EOL, FILE_APPEND);
}
Beispiel #26
0
 $cacheUpdate = "UPDATE cacheduntil SET cacheexpire = '" . $xmlCache . "' WHERE keyID = '" . $keyID . "' AND addressID = '2'";
 $cacheUpdateResult = mysql_query($cacheUpdate) or die(mysql_error());
 if (!$cacheUpdateResult) {
     //echo "die";
     $sm = "DB Update Failed!";
     if ($logFile) {
         logToFile('MembTrack V2', 'DB Update', 'Failed');
     }
     // Logger
     $_SESSION['text'] = 'DB Update Failed!';
     $_SESSION['type'] = 'warning';
 } else {
     //echo "success!!!!";
     $sm = "DB Update Success!";
     if ($logFile) {
         logToFile('MembTrack V2', 'DB Update', 'Success');
     }
     // Logger
     $_SESSION['text'] = 'DB Update Succeeded!';
     $_SESSION['type'] = 'success';
     // (step 6) Load the local functional xml file and retrieve online times!
     //#################################################################### updateDB.php BOF
     $string = file_get_contents($apiUrlLocal);
     $xml = new SimpleXMLElement($string);
     $xmlrowset = $xml->result->rowset;
     $xmlrow = $xml->result->rowset->row;
     $member = $xml->result->rowset->row;
     // (step 7) Update all results and skip duplicates based on charid and charlogon!
     $cnt = 0;
     /*
     while ($member->$cnt) {
} catch (Exception $e) {
    $messageCode = $e->getMessage();
    $message = array();
    $createMessage = FALSE;
    switch ($messageCode) {
        case 'SUBMIT-ERROR':
            $message["type"] = "error";
            $message["text"] = "Er werd met het formulier geknoeid";
            break;
        case 'VALIDATION-CODE-LENGTH':
            $message['type'] = "error";
            $message['text'] = "niet de juiste lengte";
            $createMessage = TRUE;
            break;
    }
    logToFile($message);
    if ($createMessage) {
        createMessage($message);
    }
    $toShow = showMessage();
    echo $toShow;
}
function showMessage()
{
    if (isset($_SESSION["message"])) {
        $type = $_SESSION["message"]["type"];
        $newMessage = $_SESSION["message"]["message"];
        unset($_SESSION["message"]);
        return " er was een " . $type . " met bootschap " . $newMessage;
    } else {
        return FALSE;
Beispiel #28
0
     }
     foreach ($promotions as $key => $val) {
         foreach ($val as $or_key => $or_val) {
             $rows_affected = $wpdb->insert($wpdb->prefix . "plimus_pn", array('pn_orn' => $transaction_id, 'pn_meta_key' => $or_key, 'pn_meta_value' => $or_val));
         }
     }
     if (pn_is_ntf_mail_service_on() && $pn_request['transactionType'] == "CHARGE") {
         pn_send_email_notification($pn_request['email'], $pn_request['title'] . ' ' . $pn_request['firstName'] . ' ' . $pn_request['lastName'], $pn_request['productName'], $pn_request['contractName'], $pn_request['transactionDate']);
     }
 }
 if ($pn_request['username'] != '' && pn_is_register_user_on() && $pn_request['transactionType'] == "CHARGE") {
     $pn_user = $pn_request['email'];
     $pn_email = $pn_request['email'];
     $pass_u = pn_create_user($pn_user, $pn_email, $pn_request['firstName'], $pn_request['lastName'], $pn_request['title']);
     if ($pass_u) {
         logToFile($pn_user . ', ' . $pn_email . ', ' . $pass_u);
         $m_sub = 'Account information';
         $m_msg = html_entity_decode(get_option('pn_email_template'));
         $m_user = $pn_user;
         $m_pass = $pass_u;
         $m_login = get_bloginfo('wpurl') . '/wp-login.php';
         $tmp_from = array('{USER_NAME}', '{PASSWORD}', '{LOGIN_URL}');
         $tmp_to = array($m_user, $m_pass, $m_login);
         $m_msg = str_replace($tmp_from, $tmp_to, $m_msg);
         $m_headers = 'MIME-Version: 1.0' . "\r\n";
         $m_headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
         $m_headers .= 'From: "Administrator" ' . get_bloginfo('admin_email') . "\r\n";
         if (pn_is_reg_mail_service_on()) {
             mail($pn_request['email'], $m_sub, $m_msg, $m_headers);
         }
     }
Beispiel #29
0
        // if the $txn_id isn't set then this might be a recurring payment id, for which we log the txn_id as it uses the
        // field name recurring_payment_id instead of txn_id for recurring profiles (PayPal)
        if (!$txn_id) {
            $txn_id = isset($_POST['recurring_payment_id']) ? $dbSocket->escapeSimple($_POST['recurring_payment_id']) : "";
        }
        // sadly, on some txn_type's like subscribe and not payment the field name will be subscr_id and on recurring payments it
        // will be recurring_payments_id, though both of those fields are idential, just differ in the different transactions types
        // being made.
        if (!$txn_id) {
            $txn_id = isset($_POST['subscr_id']) ? $dbSocket->escapeSimple($_POST['subscr_id']) : "";
        }
        provisionUser($dbSocket, $txnId, $txn_id);
        include 'library/closedb.php';
    } else {
        // log for manual investigation
        logToFile();
        saveToDb();
    }
    fclose($fp);
}
/*****************************************************************************************
 * logToFile()
 * logs all post variables to file
 *
 * $customMsg		custom text to be written to the log file
 *****************************************************************************************/
function logToFile($customMsg = "")
{
    include 'library/config_read.php';
    $fh = fopen($configValues['CONFIG_LOG_MERCHANT_IPN_FILENAME'], 'a');
    if ($fh) {
Beispiel #30
0
                         } else {
                             $message = $message . "\n" . "info=updated " . $localPgnFile;
                             if ($newLastPgnUrlModification != "") {
                                 $message = $message . "\n" . "oldTimestamp=" . $lastPgnUrlModification;
                                 $message = $message . "\n" . "newTimestamp=" . $newLastPgnUrlModification;
                                 $lastPgnUrlModification = $newLastPgnUrlModification;
                             }
                             $logOk = TRUE;
                         }
                     }
                 }
             }
             if ($logOk) {
                 logToFile("step 1 of " . $refreshSteps . ", new PGN data found", $overwrite);
             } else {
                 logToFile("step 1 of " . $refreshSteps . ", no new data", $overwrite);
             }
             if ($refreshSteps == 0) {
                 $message = $message . "\n" . "info=timer not restarted";
             } else {
                 $message = $message . "\n" . "info=timer restarted";
                 print "<script type='text/javascript'>" . "if (grabTimeout) { clearTimeout(grabTimeout); } " . "grabTimeout = setTimeout('grabPgnUrl()'," . 1000 * $refreshSeconds . "); " . "</script>";
             }
         }
     }
     break;
 case "save PGN text":
     $message = $message . "\n" . "action=" . $action . "\n" . "localPgnFile=" . $localPgnFile;
     $errorMessage = checkFileExisting($localPgnFile, $localPgnTmpFile, $localPgnLogFile);
     if (!$overwrite && $errorMessage) {
         $message = $message . "\n" . $errorMessage;