Ejemplo n.º 1
0
<?php

include_once "functions.inc.php";
if (!isset($_SESSION['admin'])) {
    header('Location: login.php');
}
$failed = 0;
if (isset($_POST['sent']) && csrf_validate($_POST['csrf'])) {
    $newname = $_POST['name'];
    $newlogin = $_POST['user'];
    $newpass = $_POST['pass'];
    $link = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_BASE);
    $newname = mysqli_real_escape_string($link, $newname);
    $newlogin = mysqli_real_escape_string($link, $newlogin);
    $newpass = mysqli_real_escape_string($link, $newpass);
    if (strlen($newpass) < 8) {
        $failed = 1;
    }
    $newpass = hash("sha512", $newpass);
    $test = mysqli_query($link, "SELECT * FROM users WHERE login = '******'");
    if ($test->num_rows > 0 || $failed) {
        $failed = 1;
    } else {
        mysqli_query($link, "INSERT INTO users (login, password, name) VALUES ('{$newlogin}','{$newpass}','{$newname}')");
        header("location: index.php?action=created");
    }
}
?>
<head>
	<title>Nowy użytkownik - adminpanel</title>
	<meta name="robots" content="nofollow, noindex">
<?php

include_once 'functions.inc.php';
showHead("Kontakt");
if (isset($_POST['submit'])) {
    if (csrf_validate($_POST['csrfprotection'])) {
        $topic = htmlspecialchars($_POST['topic']);
        $name = htmlspecialchars($_POST['name']);
        $email = htmlspecialchars($_POST['email']);
        $text = htmlspecialchars($_POST['msg']);
        $headers = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
        $headers .= 'To: Biuro Watchdog <' . NET_MAIL . '>' . "\r\n";
        $headers .= "From: {$name} <{$email}>" . "\r\n";
        mail(NET_MAIL, "Wiadomość z formularza kontaktowego Ambasadorów Jawności", "Temat: <br/>" . $topic . "<br/><br/>Treść wiadomości: <br/>" . $text . "<br/><br/>IP: " . htmlspecialchars(get_client_ip_env()), $headers);
    }
}
?>

<div id="contactInfoBlock">
    <div id="contactInfo1" class="block grayBlock">
        <div class="blockFoldHold">
            <div class="blockFold"></div>
            <div class="blockFoldClear"></div>
        </div>
        <div class="blockContent">
            <h2>Kontakt</h2>
            <h3>Koordynator projektu</h3>
            <address>
                <i class="fa fa-envelope fa-fw"></i> 
                <a class="fooBar" href="http://www.google.com/recaptcha/mailhide/d?k=0133IYp4KK6_WtYnLoma6bsg==&c=xkFwb7Xs0uxvl9Kz56Fp9GHpm9kZRxoc6SI4Du0zXyGFIJpvo_XHt-_ksaeX7i92"><span>roksana.maslankiewicz</span></a>