public static function isMyProposal($employer_id) { $db = Db::GetConnection(); $query = $db->prepare("SELECT reg_employer_id FROM employers WHERE employer_id = :employer_id;"); $query->execute(array('employer_id' => "{$employer_id}")); $result = $query->fetch(); $reg_id = $result['reg_employer_id']; $Info = GetMainUserInfo::GetInfo($reg_id); if (strcmp(md5($Info['reg_password_hash']), $_COOKIE['h2']) == 0) { return True; // хозяин предложения } else { return False; // не хозяин предложения } }
echo '</div>'; echo '</div>'; echo '</div>'; if (isset($nacessaryArticlesArray)) { foreach ($nacessaryArticlesArray as $singleArticleDescription) { echo '<div class="container">'; echo '<div class="row article_index_bgc">'; echo '<div class="col-md-4 article_index_picture">'; echo '<img src="' . $singleArticleDescription['article_picture1'] . '" width="300px">'; echo '</div>'; echo '<div class="col-md-8 article_index_text">'; echo '<p id="article_name"><a href="/articles/' . $singleArticleDescription['article_id'] . '">' . $singleArticleDescription['article_name'] . '</a></p>'; echo '<p>' . $singleArticleDescription['article_short_contents'] . '</p>'; echo '<p id="grey_date">Добавлена: ' . $singleArticleDescription['article_publication_date'] . '</p>'; if (CheckForLogIn::isLogin()) { $user_info_array = GetMainUserInfo::GetInfo($regId); if ($user_info_array['is_admin'] == 1) { echo '<a id="article_edit" href="/edit-article/' . $singleArticleDescription['article_id'] . '"><i class="fa fa-pencil"></i> Редактировать статью</a> | '; echo '<a id="article_delete" href="/delete-article/' . $singleArticleDescription['article_id'] . '"><i class="fa fa-times"></i> Удалить статью (клик один раз на ссылку удалит статью)</a>'; echo '<hr>'; } } echo '</div>'; echo '</div>'; echo '</div>'; } } else { echo '<div class="container">'; echo '<div class="row article_index_bgc">'; echo '<div class="col-md-12">'; echo '<p id="error404">404 Страница не найдена.</p><br><br>';
<?php include_once ROOT . '/components/islogin.php'; if (CheckForLogIn::isLogin()) { if (strlen($_POST['to_do']) > 0 && strlen($_POST['object_location']) > 0 && strlen($_POST['object_region']) > 0 && strlen($_POST['ETA']) > 0 && strlen($_POST['materials']) > 0 && strlen($_POST['payment']) > 0 && strlen($_POST['work_text_info']) > 0) { $reg_employer_id = base64_decode(base64_decode($_COOKIE['h3'])); include_once ROOT . '/models/EmployerModel.php'; include_once ROOT . '/models/AuthModel.php'; include_once ROOT . '/models/RegModel.php'; $UserInfo = GetMainUserInfo::GetInfo($reg_employer_id); $name = $UserInfo['reg_name']; $surname = $UserInfo['reg_surname']; $email = $UserInfo['reg_email']; $phone = $UserInfo['reg_phone']; $avatar = $UserInfo['reg_avatar']; $to_do = $_POST['to_do']; $object_location = $_POST['object_location']; $object_region = $_POST['object_region']; $eta = $_POST['ETA']; $materials = $_POST['materials']; $payment = $_POST['payment']; $work_text_info = $_POST['work_text_info']; if (isset($_POST['ppk'])) { $ppk = $_POST['ppk']; } else { $ppk = ''; } if (isset($_POST['otd'])) { $otd = $_POST['otd']; } else { $otd = '';
<?php include_once ROOT . '/components/islogin.php'; include_once ROOT . '/models/AuthModel.php'; include_once ROOT . '/models/EmployeeModel.php'; include_once ROOT . '/models/EmployerModel.php'; include_once ROOT . '/models/MetadataModel.php'; if (CheckForLogIn::isLogin()) { $regId = base64_decode(base64_decode($_COOKIE['h3'])); $regInfo = GetMainUserInfo::GetInfo($regId); $reg_name = $regInfo['reg_name']; $reg_surname = $regInfo['reg_surname']; } ?> <!DOCTYPE html> <html lang="ru"> <head> <?php $URI_array = explode('/', $_SERVER['REQUEST_URI']); $meta_page = $URI_array['1']; $metaData = new Metadata(); $metaDataArray = $metaData->getMetaData($meta_page); ?> <meta charset="utf-8" /> <title><?php echo $metaDataArray['meta_title']; ?> </title>
<?php include ROOT . '/components/islogin.php'; if (CheckForLogIn::isLogin()) { $reg_id = base64_decode(base64_decode($_COOKIE['h3'])); if (CheckForProfileOwner::isMyProfile($reg_id)) { if (strlen($_FILES['new_avatar_picture']['type']) !== 0) { $new_avatar_picture_array = explode('/', $_FILES['new_avatar_picture']['type']); $new_avatar_picture_type = array_pop($new_avatar_picture_array); $avatar_picture_name = $reg_id . 'new'; copy($_FILES['new_avatar_picture']['tmp_name'], ROOT . '/uploads/' . $avatar_picture_name . '.' . $new_avatar_picture_type); // копируем временный файл в аплоад папку (до окончания работы скрипта) $new_avatar_path = '/uploads/' . $avatar_picture_name . '.' . $new_avatar_picture_type; } else { $main_info_array = GetMainUserInfo::GetInfo($reg_id); $new_avatar_path = $main_info_array['reg_avatar']; } Avatar::changeAvatar($new_avatar_path, $reg_id); header('Location: /my-profile/' . $reg_id); } else { header('Location: /'); } } else { header('Location: /'); }