Пример #1
0
    $master_note = (string) db_result00($sql);
}
$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]));
Пример #2
0
function remindPassword($userid)
{
    $sql = "SELECT email, pw\n\t\tFROM " . PREF . "users\n\t\tWHERE active=1 AND id={$userid}\n\t\tLIMIT 1";
    $result = query($sql);
    $rows = num_rows($result);
    if (!$rows) {
        die("Регистрационные данные не будут высланы: пользователь №{$userid} не найден. ");
    }
    list($mail, $password) = fetch_row($result);
    $subject = "Регистрация в базе заявок Дурмштранга";
    $text = <<<EOT
\tВы зарегистрировались в базе заявок Дурмштранга.
\t<br />
\tВаш пароль: {$password}
\t<br />
\tПо техническим вопросам обращайтесь к Бодигриму (andrew.lelechenko@gmail.com, skype bodigrim).
EOT;
    send_mail_by_userid($userid, $subject, $text);
}
Пример #3
0
<?php

include "../include/config.php";
$post_get = new GetVarClass();
$email = $post_get->getemail("email");
if (!$email) {
    die("Редактирование заявки невозможно: введите корректный e-mail. ");
}
$editorid = loginbycookie();
if (!isAdmin($editorid)) {
    die("У вас недостаточно прав доступа, чтобы изменить статус заявки {$email}. ");
}
$status = $post_get->getenumkeys("status", $langStatuses);
if (!$status) {
    die("Редактирование заявки невозможно: введите корректный статус.");
}
$sql = "UPDATE " . PREF . "users\n\tSET status='{$status}'\n\tWHERE email='{$email}'\n\tLIMIT 1";
query($sql);
$updated = (bool) affected_rows();
if ($updated) {
    $status_out = $langStatuses[$status];
    $link = $_SERVER["HTTP_HOST"] . "/edit.php?" . http_build_query(["email" => $email]);
    send_mail_by_userid(emailToId($email), "Мастер изменил статус вашей заявки на " . $status_out, "<a href=\"{$link}\">Просмотреть</a>");
}
Пример #4
0
<?php

include "../include/config.php";
$post_get = new GetVarClass();
$email = $post_get->getemail("email");
if (!$email) {
    die("Отправить сообщение невозможно: введите корректный e-mail. ");
}
$editorid = loginbycookie();
if (!canEdit($editorid, $email)) {
    die("У вас недостаточно прав доступа, чтобы отправить сообщение {$email}. ");
}
$userid = (int) emailToId($email);
$message = $post_get->getvar("message");
$sql = "INSERT INTO " . PREF . "messages (userid, authorid)\n\tVALUE ({$userid}, {$editorid})";
query($sql);
$message_id = insert_id();
$sql = "UPDATE " . PREF . "messages\n\tSET message='{$message}'\n\tWHERE id={$message_id}\n\tLIMIT 1";
query($sql);
$message_out = nl2br(db_unescape($message));
$link = $_SERVER["HTTP_HOST"] . "/edit.php?" . http_build_query(["email" => $email]);
if ($editorid == $userid) {
    markUnread($userid);
    // send_mail_to_admin("$name написал сообщение", "$message_out <br /><a href=\"$link\">Ответить</a>");
} else {
    send_mail_by_userid($userid, "Мастер написал сообщение", "{$message_out} <br /><a href=\"{$link}\">Ответить</a>");
}