Esempio n. 1
0
}
$sql = "UPDATE " . PREF . "users\n\tSET name='{$name}',\n\t\tnick='{$nick}',\n\t\tcity='{$city}',\n\t\tage='{$age}',\n\t\tcontacts='{$contacts}',\n\t\tcontraindication='{$contraindication}',\n\t\tchronicdesease='{$chronicdesease}',\n\t\twishes='{$wishes}',\n\t\tpublicity='{$publicity}',\n\t\tcharacter_name='{$character_name}',\n\t\tcharacter_age='{$character_age}',\n\t\tcountry='{$country}',\n\t\tbirth='{$birth}',\n\t\trank='{$rank}',\n\t\tquota='{$quota}',\n\t\tquenta='{$quenta}',\n\t\twishes2='{$wishes2}',\n\t\tmaster_note='{$master_note}',\n\t\tgo_royal_wedding={$go_royal_wedding}\n\n\tWHERE id={$userid}\n\tLIMIT 1";
query($sql);
$updated = (bool) affected_rows();
if (isset($_FILES["photo"]) && $_FILES["photo"]['error'] != 4) {
    $options = new FileUploadOptions();
    $options->key = "photo";
    $options->extensions = ["png", "jpg", "jpeg", "gif"];
    $options->dir = "../photos/";
    $options->is_critical = true;
    $options->neoname = photoFileName($email) . ".jpg";
    if (file_exists("../photos/{$options->neoname}")) {
        unlink("../photos/{$options->neoname}");
    }
    $filename = file_upload($options);
    if ($filename != $options->neoname) {
        rename("../photos/" . $filename, "../photos/" . $options->neoname);
    }
    $updated = true;
}
if ($updated) {
    $link = $_SERVER["HTTP_HOST"] . "/edit.php?" . http_build_query(["email" => $email]);
    if ($editorid == emailToId($email)) {
        markUpdated(emailToId($email));
        // send_mail_to_admin("$name обновил заявку", "<a href=\"$link\">Просмотреть</a>");
    } else {
        send_mail_by_userid(emailToId($email), "Мастер отредактировал вашу заявку", "<a href=\"{$link}\">Просмотреть</a>");
    }
}
redirect(isAdmin($editorid) ? "/table.php#{$email}" : "/edit.php?" . http_build_query(["email" => idToEmail($editorid), "justUpdated" => true]));
Esempio n. 2
0
<?php

include "include/config.php";
$editorid = loginbycookie();
if ($editorid) {
    redirect(isAdmin($editorid) ? "/table.php" : "/edit.php?" . http_build_query(["email" => idToEmail($editorid)]));
}
$a = rand(10, 99);
$b = rand(1, 9);
$c = $a + $b;
$render_data = ["a" => $a, "b" => $b, "chash" => antispamhash($c)];
$ret = constructTwig()->render("index.twig", $render_data);
echo $ret;