Example #1
0
            continue;
        }
        $_POST[$key] = trim(htmlspecialchars($value));
    }
    switch ($submit) {
        case 'Подать объявление':
            $_POST['date'] = date('d.m.Y H:i:s');
            $ads_db['db'][] = $_POST;
            break;
        case 'Сохранить':
            $id = $_POST['hidden_id'];
            $_POST['date'] = $ads_db['db'][$id]['date'];
            $ads_db['db'][$id] = $_POST;
            break;
    }
    save_all($ads_db);
    file_put_serialize_contents(ADS_DB, $ads_db);
    // запись массива в файл
    header("Location: index3.php");
    exit;
}
// Обработка команд на удаление
if (isset($_GET['delete'])) {
    $del = $_GET['delete'];
    delete_item($del, $ads_db);
    header("Location: index3.php");
    exit;
}
// Вывод объявления
if (isset($_GET['show'])) {
    $change_id = $_GET['show'];
Example #2
0
<?php

require '../core/boot.php';
$status = $_SESSION['status'];
$pwd = $_GET['pwd'];
$email = $_GET['email'];
$firstname = $_GET['firstname'];
$lastname = $_GET['lastname'];
$birthday = $_GET['birthday'];
$phone_number = $_GET['phone_number'];
$address = $_GET['address'];
$security_question = $_GET['security_question'];
$security_answer = $_GET['security_answer'];
function save_all()
{
    $requete = "\n\t\tUPDATE users\n\t\tSET password = '******'pwd']}'\n\t\tWHERE login='******'login']}'";
    $requete1 = "\n\t\tUPDATE profils\n\t\tSET email = '{$_GET['email']}',firstname = '{$_GET['firstname']}',lastname = '{$_GET['lastname']}',birthday = '{$_GET['birthday']}',phone = '{$_GET['phone_number']}',address = '{$_GET['address']}',securityQuestion = '{$_GET['security_question']}',securityAnswer = '{$_GET['security_answer']}'\n\t\tWHERE profils.idP = (SELECT users.idP \n\t\t\t\t\t\t\t FROM users\n\t\t\t\t\t\t\t WHERE login='******'login']}')";
    mysql_query($requete) or die(mysql_error());
    mysql_query($requete1) or die(mysql_error());
}
save_all();
if ($status == "admin") {
    header('Location:../pages/admin_homepage.php');
} else {
    header('Location:../pages/user_homepage.php');
}