コード例 #1
0
ファイル: checkAdmin.php プロジェクト: ezpz-cz/web-pages
function checkAdminByUsername($username)
{
    $pdo = getPDOConnection();
    $query = "SELECT id FROM `soe-csgo`.`sb_admins` WHERE name = :username";
    $num_rows = getPDOParametrizedQueryResult($pdo, $query, array(":username" => $username), __FILE__, __LINE__, True);
    if ($num_rows > 0) {
        return TRUE;
    } else {
        return FALSE;
    }
}
コード例 #2
0
         }
     }
 }
 if (count($conditions) > 1) {
     $where = implode(' AND ', $conditions);
     $where = " WHERE " . $where;
 } elseif (count($conditions) == 1) {
     $where = " WHERE " . $conditions[0];
 } elseif (count($conditions) == 0) {
     $where = "";
 }
 $query = "\n      SELECT\n        DATE(time_create) AS time_create_date,\n        GROUP_CONCAT(r.id SEPARATOR ',') AS report_ids,\n        a.name AS admin_name, a.id AS admin_id,\n        trg.nick AS trg_nick,\n        trg.ip AS trg_ip,\n        trg.sid AS trg_sid,\n        trg.hlstats_id\n      FROM\n        `ezpz-report-g`.report_report AS r\n      LEFT JOIN\n        `ezpz-report-g`.report_report_reason AS rs_join ON rs_join.report_id = r.id\n      LEFT JOIN\n        `ezpz-report-g`.report_reason AS rs ON rs.id = rs_join.reason_id\n      LEFT JOIN\n        `ezpz-report-g`.report_players AS rep ON rep.id = r.reporter_id\n      LEFT JOIN\n        `ezpz-report-g`.report_players AS trg ON trg.id = r.target_id\n      LEFT JOIN\n        `soe-csgo`.utils_servers AS s ON s.server_id = r.server_id\n      LEFT JOIN\n        `ezpz-report-g`.report_status AS st ON st.id = r.status_id\n      LEFT JOIN\n        `ezpz-report-g`.report_map AS m ON m.id = r.map_id\n      LEFT JOIN\n        `soe-csgo`.sb_admins AS a ON a.id = r.admin_id" . $where . "\n      GROUP BY\n        DAY(time_create_date), target_id\n      ORDER BY\n        time_create_date DESC";
 //echo $query;
 //print_r($parameters);
 //echo "$query <br /><br />";
 $result = getPDOParametrizedQueryResult($pdo, $query, $parameters, __FILE__, __LINE__);
 if (!$result and !empty($result)) {
     throw new Exception("Cannot get the query result!");
 }
 $table_header = "\n                <th>" . $lang["table_headers"]["date"] . "</th>\n                <th>" . $lang["table_headers"]["target"] . "</th>\n                <th>" . $lang["table_headers"]["admin"] . "</th>";
 $table = '
             <table id="table-reports-group" class="row-border hover">
                 <thead>
                     <tr>' . $table_header . '</tr>
                 </thead>
                 <tbody>';
 $i = 0;
 foreach ($result as $row) {
     $report_ids = join(array_unique(explode(",", $row["report_ids"])), ",");
     $table .= sprintf('
         <tr group_id="%d" report_ids="%s">
コード例 #3
0
ファイル: add_report.php プロジェクト: ezpz-cz/report-system
             $query = "INSERT INTO `ezpz-report-g`.report_report_reason(report_id, reason_id) VALUES (:report_id, :reason_id)";
             $parameters = array(":report_id" => $report_id, ":reason_id" => $reason_id);
             PDOExecParametrizedQuery($pdo, $query, $parameters, __FILE__, __LINE__);
         }
     }
     header('Content-Type: application/json');
     echo json_encode(array("success" => True, "data" => sprintf($translation["texts"]["report_add_success"], $max_allowed_report_count - $report_count_day - 1, $report_id, $report_id)));
     //send email to admin
     $query = "SELECT a.language, a.email FROM `soe-csgo`.`sb_admins` AS a WHERE id = :admin_id";
     $result = getPDOParametrizedQueryResult($pdo, $query, array(":admin_id" => $admin_id), __FILE__, __LINE__);
     foreach ($result as $row) {
         $translation = getEmailTranslation($row["language"]);
         $email = $row["email"];
     }
     $query = "SELECT r.id, r.time_create, s.status_" . $translation["db"]["suffix"] . " AS status FROM `ezpz-report-g`.`report_report` AS r\n              JOIN `ezpz-report-g`.`report_status` AS s ON s.id = r.status_id\n              WHERE r.admin_id = :admin_id AND s.id IN (1, 2)";
     $result = getPDOParametrizedQueryResult($pdo, $query, array(":admin_id" => $admin_id), __FILE__, __LINE__);
     $rs_url = "http://ezpz.cz/page/report-system?report_ids=%d";
     $message_other = "";
     if ($result) {
         $message_other = "<div style='font-size: large;'><b>" . $translation["message_other"] . ":</b></div><br /><br />";
         foreach ($result as $row) {
             $message_other .= sprintf("<a href='{$rs_url}'><b>" . $row["status"] . "</b> | <i>" . $row["time_create"] . "</i></a><br />", $row["id"]);
         }
     }
     $message = "<div style='font-size: large;'><b>" . $translation["message_new"] . ": </b>" . sprintf("<a href='{$rs_url}'>{$rs_url}</a>", $report_id, $report_id) . "</div><br /> <br />" . $message_other;
     $headers = "From: admin@ezpz.cz\r\n";
     $headers .= "MIME-Version: 1.0\r\n";
     $headers .= "Content-Type: text/html; charset=cp1250\r\n";
     mail($email, $translation["subject"], $message, $headers);
 } else {
     print_r($admins);
コード例 #4
0
ファイル: PDOQuery.php プロジェクト: ezpz-cz/web-pages
/**
 *
 * @return True when SQL query returns empty result set. False otherwise.
 */
function PDOcheckEmptyQuery($pdo, $query, $file, $line_number, $parameters = NULL)
{
    try {
        if (empty($parameters) || $parameters === NULL) {
            $result = getPDOQueryResult($pdo, $query, $file, $line_number);
        } else {
            $result = getPDOParametrizedQueryResult($pdo, $query, $parameters, $file, $line_number);
        }
        if (count($result) == 0) {
            return True;
        } else {
            return False;
        }
    } catch (Exception $ex) {
        echo getErrorDescription($ex->getMessage(), $query, $file, $line_number);
        return False;
    }
}
コード例 #5
0
<?php

if (!isset($_GET["playerid"])) {
    die("playerid is not set!");
} else {
    $playerId = $_GET["playerid"];
}
include_once dirname(__FILE__) . "/getPDO.php";
include_once dirname(__FILE__) . "/PDOQuery.php";
$pdo = getPDOConnection();
$query = "\n    SELECT oldName, newName, eventTime\n    FROM `soe-hlstats`.hlstats_Events_ChangeName\n    WHERE playerId = :playerId";
$result = getPDOParametrizedQueryResult($pdo, $query, array(":playerId" => $playerId), __FILE__, __LINE__);
if (!$result or empty($result)) {
    echo "Žádná změna nicků / No nickname changes";
} else {
    $nicknames = "";
    foreach ($result as $row) {
        $nicknames .= "<br /><i>" . $row["eventTime"] . "</i><br />" . $row["oldName"] . " <b>→</b> " . $row["newName"] . "<br />";
    }
    echo $nicknames;
}
コード例 #6
0
ファイル: mail_info.php プロジェクト: ezpz-cz/report-system
    die("pw not set!");
}
include_once dirname(__FILE__) . "/../scripts-generic/getPDO.php";
include_once dirname(__FILE__) . "/../scripts-generic/PDOQuery.php";
$pdo = getPDOConnection();
$query = "SELECT a.name, a.id AS admin_id FROM `soe-csgo`.`sb_admins` AS a WHERE a.active = 1";
$result = getPDOQueryResult($pdo, $query, __FILE__, __LINE__);
$table_active = "<table>\n<thead>\n    <tr>\n        <th>admin</th>\n        <th>nové</th>\n        <th>řeší se</th>\n        <th>hotové</th>\n        <th>hotové – přijato</th>\n        <th>hotové – přijato, ban</th>\n        <th>hotové – zamítnuto</th>\n    </tr>\n</thead>\n<tbody>";
for ($i = 0; $i < count($result); $i++) {
    $table_active .= "<tr>\n        <td>" . $row["name"] . "</td>\n        <td>new_" . $row["admin_id"] . "</td>\n        <td>progress_" . $row["admin_id"] . "</td>\n        <td>finished_" . $row["admin_id"] . "</td>\n        <td>finished_accept" . $row["admin_id"] . "</td>\n        <td>finished_ban" . $row["admin_id"] . "</td>\n        <td>finished_rejected" . $row["admin_id"] . "</td>";
}
print_r($result);
foreach ($result as $row) {
    $table_active .= "<tr><td>" . $row["name"] . "</td>";
    $query = "SELECT s.id, COUNT(r.id) AS s_count FROM `ezpz-report-g`.`report_report` AS r\n                JOIN `ezpz-report-g`.`report_status` as s ON s.id = r.status_id\n                WHERE r.admin_id = :admin_id\n                GROUP BY status_id, admin_id\n                ORDER BY s.id ASC";
    $result_count = getPDOParametrizedQueryResult($pdo, $query, array(":admin_id" => $row["admin_id"]), __FILE__, __LINE__);
    echo "admin: " . $row["name"] . "<br />";
    print_r($result_count);
    echo "<br />";
    for ($i = 1; $i <= 5; $i++) {
        echo $i;
        if (array_key_exists(strval($i), $result_count)) {
            $table_active .= "<td>" . $result_count[$i]["s_count"] . "</td>";
        } else {
            $table_active .= "<td>0</td>";
        }
    }
    $table_active .= "</tr>";
}
$table_active .= "</tbody></table>";
/*$query = "SELECT a.name, a.id FROM `soe-csgo`.`sb_admins` AS a WHERE a.active = 0 AND a.name <> 'test-admin'";