Exemplo n.º 1
0
function getUserFromCookie()
{
    $db = new DBConnection();
    $q = "call getassociate(:username)";
    $stmt = $db->prepare($q);
    $userac = htmlEntities2($_COOKIE["UserName"]);
    //    $stmt->setFetchMode(PDO::FETCH_CLASS, 'User');
    $stmt->execute(array(':username' => $userac));
    $user = $stmt->fetch(PDO::FETCH_OBJ);
    $_SESSION["UserName"] = $user;
}
Exemplo n.º 2
0
function getCustomerFromCookie()
{
    $db = new DBConnection();
    $q = "call getCustomer(:acronym)";
    $stmt = $db->prepare($q);
    //    $stmt->setFetchMode(PDO::FETCH_CLASS, 'User');
    $cusac = $_COOKIE["Kunde"];
    $cusac = htmlEntities2($cusac);
    $stmt->execute(array(':acronym' => $cusac));
    $customer = $stmt->fetch(PDO::FETCH_OBJ);
    $_SESSION["Kunde"] = $customer;
}
Exemplo n.º 3
0
function getProjectsFromCus()
{
    $db = new DBConnection();
    $orderby = $_COOKIE["orderby"];
    $state = $_COOKIE["state"];
    $acronym = $_COOKIE["Kunde"];
    $acronym = htmlEntities2($acronym);
    $showTask = '0';
    $q = "call getallTaskfromcus(:acronym, :state, :orderby, :showtask)";
    $stmt = $db->prepare($q);
    $stmt->setFetchMode(PDO::FETCH_OBJ);
    $stmt->execute(array(':acronym' => $acronym, ':state' => $state, ':orderby' => $orderby, ':showtask' => $showTask));
    $ctasks = $stmt->fetchAll();
    return $ctasks;
}
Exemplo n.º 4
0
<?php

require_once '../DBConnection.php';
function htmlEntities2($str)
{
    $text = str_replace("oe", "Ø", $str);
    $text = str_replace("aaa", "Å", $text);
    $text = str_replace("ae", "Æ", $text);
    //    window.alert(text);
    return $text;
}
try {
    $oldUser = htmlEntities2($_COOKIE["UserName"]);
    $newName = $_POST["newName"];
    $newUser = $_POST["newUser"];
    $newPwd = $_POST["newPwd"];
    $newPriv = $_POST["newPriv"];
    $newMail = $_POST["newMail"];
    $db = new DBConnection();
    $q = "call alterassociate(:oldUser, :newUser, :newPwd, :newName, :newPriv, :newMail);";
    $stmt = $db->prepare($q);
    $stmt->execute(array(':oldUser' => $oldUser, ':newName' => $newName, ':newUser' => $newUser, ':newPwd' => $newPwd, ':newPriv' => $newPriv, ':newMail' => $newMail));
    $count = $stmt->rowCount();
    if ($stmt != FALSE) {
        setcookie("UserName", $newUser, time() + 86400, "/planning/");
        header("location:" . $_COOKIE['previous']);
    } else {
        header("location:../../associateForm.php?edit&error");
    }
} catch (PDOException $e) {
    echo $e->getMessage();
Exemplo n.º 5
0
require_once '../DBConnection.php';
$session_expiration = time() + 3600 * 24;
// +1 days
session_set_cookie_params($session_expiration);
session_start();
function htmlEntities2($str)
{
    $text = str_replace("oe", "Ø", $str);
    $text = str_replace("aaa", "Å", $text);
    $text = str_replace("ae", "Æ", $text);
    //    window.alert(text);
    return $text;
}
try {
    $id = $_COOKIE['Task'];
    $cus = htmlEntities2($_COOKIE["Kunde"]);
    $title = $_POST["title"];
    $assi = $_POST["assi"];
    $db = new DBConnection();
    $q = "call altermainprojekt(:id, :title, :cus, :assi);";
    $stmt = $db->prepare($q);
    $stmt->execute(array(':id' => $id, ':title' => $title, ':cus' => $cus, ':assi' => $assi));
    $count = $stmt->rowCount();
    if ($count > 0) {
        header("location:" . $_COOKIE['previous']);
    } else {
        header("location:../../projectForm.php?error");
    }
} catch (PDOException $ex) {
    echo $ex->getMessage();
}
Exemplo n.º 6
0
<?php

function htmlEntities2($str)
{
    $text = str_replace("oe", "Ø", $str);
    $text = str_replace("aaa", "Å", $text);
    $text = str_replace("ae", "Æ", $text);
    return $text;
}
require_once '../DBConnection.php';
$db = new DBConnection();
$orderby = $_COOKIE["orderby"];
$state = $_COOKIE["state"];
$acronym = $_COOKIE["Kunde"];
$acronym = htmlEntities2($acronym);
$showTask = $_COOKIE['showtask'];
$q = "call getallTaskfromcus(:acronym, :state, :orderby, :showtask)";
$stmt = $db->prepare($q);
$stmt->setFetchMode(PDO::FETCH_OBJ);
$stmt->execute(array(':acronym' => $acronym, ':state' => $state, ':orderby' => $orderby, ':showtask' => $showTask));
echo '<div class="panel panel-default dcenter">
    <div id="no-more-tables" class="table-responsive">
        <table class="table table-condensed ">
            <thead class="thead-style">';
if ($_COOKIE['showtask'] === '1') {
    echo '<tr>
                    <th>Opgave</th>
                    <th style="max-width: 125px;">Medarb.</th>
                    <th style="max-width: 125px;">Kommentar</th>
                </tr>
            </thead>
Exemplo n.º 7
0
<?php

require_once '../DBConnection.php';
function htmlEntities2($str)
{
    $text = str_replace("oe", "Ø", $str);
    $text = str_replace("aaa", "Å", $text);
    $text = str_replace("ae", "Æ", $text);
    //    window.alert(text);
    return $text;
}
try {
    $delName = htmlEntities2($_COOKIE["UserName"]);
    $db = new DBConnection();
    $q = "call deleteassociate(:delName);";
    $stmt = $db->prepare($q);
    $stmt->execute(array(":delName" => $delName));
    $count = $stmt->rowCount();
    if ($stmt != FALSE) {
        header("location:../../associates.php");
    } else {
        header("location:../../singleAssociate.php?error");
    }
} catch (PDOException $e) {
    echo $e->getMessage();
}
Exemplo n.º 8
0
                $('#pressdate').val($.datepicker.formatDate("yy-mm-dd", new Date(dat)));
            }
        });
    });
</script>

<!-- Header -->
<div class="container dcenter hpic img-responsive">
    <div class="section group">
        <div class="col span_1_of_2">
            <h4 class="chead" id="editH4"><span class="header-img">Opret Opgave(<a href="singleCustomer.php"><?php 
print_r(htmlEntities2($_COOKIE["Kunde"]));
?>
</a>)</span></h4>
            <h2 class="chead" id="editH2"><span class="header-img">Opret Opgave(<a href="singleCustomer.php"><?php 
print_r(htmlEntities2($_COOKIE["Kunde"]));
?>
</a>)</span></h2>
        </div>
        <br>
    </div>
</div>
<!-- Form for creating/altering task -->
<div class="vertically-align" align="center">
    <form id="form" role="form" action="database/actions/createTask.php" method="post">
        <input type="hidden" id="cus" name="cus" value="<?php 
echo $_SESSION["Task"]->t_customer;
?>
"/>
        <input type="hidden" id="mainid" name="mainid" value="<?php 
echo $_SESSION["Task"]->ttm_mainid;
Exemplo n.º 9
0
<?php

require_once '../DBConnection.php';
function htmlEntities2($str)
{
    $text = str_replace("oe", "Ø", $str);
    $text = str_replace("aaa", "Å", $text);
    $text = str_replace("ae", "Æ", $text);
    //    window.alert(text);
    return $text;
}
try {
    $delName = htmlEntities2($_COOKIE["Kunde"]);
    $db = new DBConnection();
    $q = "call deletecustomer(:delName);";
    $stmt = $db->prepare($q);
    $stmt->execute(array(":delName" => $delName));
    $count = $stmt->rowCount();
    if ($stmt != FALSE) {
        setcookie('state', '0', time() + 86400, "/planning/");
        setcookie('orderby', 'c_name', time() + 86400, "/planning/");
        header("location:../../customers.php");
    } else {
        header("location:../../singleCustomer.php?error");
    }
} catch (PDOException $e) {
    echo $e->getMessage();
}
Exemplo n.º 10
0
             $stmt = $db->prepare($q);
             $stmt->execute(array(':mailto' => $mail));
             $asmail = $stmt->fetch(PDO::FETCH_OBJ);
             array_push($mails, $asmail->a_email);
         }
         sendmail($mails, $_SESSION['user']->a_email, 'Ny kommentar på en opgave', 'Kunde: ' . $cus . '<br><br>Opgave: ' . $title . '<br><br>' . $user . ' har tilføjet en kommentar:<br>' . $comment);
     }
 }
 if ($stmt != FALSE) {
     setcookie("Kunde", $cus, time() + 86400, "/planning/");
     if (session_status() == PHP_SESSION_NONE) {
         session_start();
     }
     $previous = $_COOKIE['previous'];
     setcookie('Task', $project, time() + 86400, "/planning/");
     $associate = htmlEntities2($_COOKIE['UserName']);
     $loggedin = $_SESSION['user']->a_username;
     if (strpos($previous, 'ssociate') != FALSE) {
         setcookie('kunder', '', time() + 86400, "/planning/");
         if ($associate === $loggedin) {
             setcookie('login', 'active', time() + 86400, "/planning/");
         } else {
             setcookie('medarbejder', 'active', time() + 86400, "/planning/");
         }
     } else {
         if (strpos($previous, 'time') != FALSE) {
             setcookie('kunder', '', time() + 86400, "/planning/");
             setcookie('timeoversigt', 'active', time() + 86400, "/planning/");
         } else {
             if (strpos($previous, 'overview') != FALSE) {
                 setcookie('kunder', '', time() + 86400, "/planning/");
Exemplo n.º 11
0
<?php

include_once '../DBConnection.php';
function htmlEntities2($str)
{
    $text = str_replace("oe", "Ø", $str);
    $text = str_replace("aaa", "Å", $text);
    $text = str_replace("ae", "Æ", $text);
    //    window.alert(text);
    return $text;
}
try {
    $comment = htmlEntities2($_COOKIE['commentId']);
    $task = $_COOKIE['Task'];
    $db = new DBConnection();
    $q = "call deletecomment(:comment)";
    $stmt = $db->prepare($q);
    $stmt->setFetchMode(PDO::FETCH_OBJ);
    $stmt->execute(array(':comment' => $comment));
    $count = $stmt->rowCount();
    if ($stmt != FALSE) {
        $q = 'call getAllComments(:task)';
        $stmt = $db->prepare($q);
        $stmt->setFetchMode(PDO::FETCH_OBJ);
        $stmt->execute(array(':task' => $task));
        $comments = $stmt->fetchAll();
        echo '<div class="form-group">
                <textarea class="form-control input-style" rows="1" id="newComment" name="newComment" placeholder="Ny Kommentar"></textarea>
            </div>';
        foreach ($comments as $comment) {
            echo '<div class="form-group"><textarea  onclick="SetCookie(' . "'" . 'commentId' . "'" . ', ' . $comment->tc_id . ', ' . "'" . '1' . "'" . ');