예제 #1
0
<?php

require_once "php/include.php";
require_once "php/email.php";
needLogin();
if (!check_brute("sendFeedback", 10, 3600)) {
    echo json_encode($tr["ERR_SEND_FEEDBACK_BRUTE"]);
} else {
    if (isset($_POST["subject"]) || isset($_POST["text"])) {
        sendFeedbackMail($_POST["subject"], $_POST["text"]);
        echo json_encode($tr["FEEDBACK_THANKS"]);
    }
}
예제 #2
0
파일: login.php 프로젝트: csiki/Croupier
                if ($res[0]["password"] == $password) {
                    // Check if the password in the database matches the password the user submitted.
                    // Password is correct!
                    clear_brute("login");
                    $user_browser = $_SERVER['HTTP_USER_AGENT'];
                    // Get the user-agent string of the user.
                    $_SESSION['accountID'] = $res[0]["id"];
                    $_SESSION['username'] = $res[0]["username"];
                    $_SESSION["lang"] = $res[0]["lang"];
                    $_SESSION['gravatar'] = md5(strtolower($res[0]["email"]));
                    $_SESSION['login_string'] = hash('sha512', $password . $user_browser . getenv("REMOTE_ADDR"));
                    header('Location: ../summary.php');
                    exit;
                } else {
                    $errors[] = $tr["ERR_LOGIN"];
                    if (!check_brute("login", 5, 300)) {
                        $showCaptcha = true;
                        //show captcha after 5 try
                    }
                }
            }
        }
    }
}
?>
<!DOCTYPE html>
<html>
<head>
    <?php 
require "php/head.php";
?>
예제 #3
0
파일: add_bot.php 프로젝트: csiki/Croupier
     }
 } else {
     if (isset($_POST["code"])) {
         if (strlen($_POST["code"]) < BOT_CODE_MIN_LENGTH) {
             $errors[] = $tr["ERR_CODE_SHORT"];
         } else {
             $code = $_POST["code"];
         }
     }
 }
 if (isset($_POST["lang"]) && isValidCodeLang($_POST["lang"])) {
     $lang = $_POST["lang"];
 } else {
     die("Invalid request");
 }
 if (!check_brute("addBot", 30, 3600)) {
     $errors[] = $tr["ERR_ADDBOT_BRUTE"];
 } else {
     if (count($errors) == 0) {
         //update database
         SQL("INSERT INTO bots (id, accountID, name, className, lastChangeTime, code_lang, state)\n              VALUES (NULL, ?, ?, ?, NOW(), ?, 'processing')", $_SESSION["accountID"], $name, $className, $lang);
         //create account folder if not exits
         $dir = _BOT_AI_RELATIVE_PATH_ . $_SESSION['accountID'] . '/';
         if (!is_dir($dir)) {
             $ret = true;
             $ret = mkdir($dir);
             chmod($dir, 0770);
             if ($ret === false) {
                 SQL("DELETE FROM bots WHERE id = ?", $id);
                 //remove db entry
                 die("Couldn't create folder for bot: " . $name);