<title>Exemple simple de site en PHP </title>
    </head>
    <body>
        <h1>Liste des utilisateurs</h1>
        <?php 
if (isset($_GET['action']) && $_GET['action'] == "save") {
    if (!empty($_GET[id])) {
        update_users($_GET[nom], $_GET[prenom], $_GET[id]);
    } else {
        insert_users($_GET[nom], $_GET[prenom]);
    }
}
if (isset($_GET['action']) && $_GET['action'] == "ajouter" || isset($_GET['action']) && $_GET['action'] == "modifier") {
    $nom = "";
    $prenom = "";
    $id = "";
    if ($_GET['action'] == "modifier") {
        $result = select_one_user($_GET['id']);
        $user = mysqli_fetch_assoc($result);
        $nom = $user['nom'];
        $prenom = $user['prenom'];
        $id = $user['id'];
    }
    include 'Views/addOrModifyUserView.php';
} else {
    $result = select_users();
    include 'Views/listUsersView.php';
}
?>
    </body>
</html>
示例#2
0
 // 2段階認証の状態を取得
 $session_twostep = 0;
 if ($twostep == 1 && isset($_COOKIE['auth']['session'])) {
     $sessions = select_sessions(array('select' => 'twostep', 'where' => array('id = :session AND user_id = :user_id', array('session' => $_COOKIE['auth']['session'], 'user_id' => $id))));
     if (!empty($sessions)) {
         $session_twostep = $sessions[0]['twostep'];
     }
 }
 // 2段階認証
 if ($twostep == 1 && $session_twostep == 0) {
     $_view['user'] = $_POST;
     $_view['twostep'] = true;
     $success = false;
     if (isset($_POST['twostep_code'])) {
         // 2段階認証用コードを確認
         $users = select_users(array('select' => 'id, twostep_expire', 'where' => array('username = :username AND password = :password AND twostep_code = :twostep_code', array('username' => $_POST['username'], 'password' => hash_crypt($_POST['password'], $password_salt . ':' . $GLOBALS['config']['hash_salt']), 'twostep_code' => $_POST['twostep_code']))));
         if (empty($users)) {
             $_view['warnings'] = array('2段階認証用コードが違います。');
         } else {
             if (localdate(null, $users[0]['twostep_expire']) < localdate()) {
                 $_view['warnings'] = array('2段階認証用コードの有効期限が終了しています。');
             } else {
                 $success = true;
             }
         }
     } else {
         // 2段階認証用コードを作成
         $twostep_code = rand_string(6);
         // トランザクションを開始
         db_transaction();
         // 2段階認証用コードを通知
示例#3
0
<?php

include '../action_bdd/action_bdd.php';
if (!isset($_GET['id_user'])) {
    $traitement = select_users($_GET['droits']);
    ?>
<b><u>Suppression des donn&eacute;es des utilisateurs  : </u>
<br><font color="#FF0000">Attention ! vous ne pouvez suppprimer que les utilisateurs ayant des droits inf&eacute;rieurs aux votres</font></b><br><br>
<table>
	<tr>
		<th>supprimer</th>
		<th>nom</th>
		<th>pr&eacute;nom</th>
		<th>login</th>
		<th>mot de passe</th>
		<th>droits</th>
	</tr>
	<?php 
    while ($resultat = mysql_fetch_array($traitement, MYSQL_ASSOC)) {
        ?>
	<tr>
		<td><a href="./action_bdd/del_user.php?id_user=<?php 
        echo $resultat['id'];
        ?>
">Supprimer</a></td>
		<td><?php 
        echo $resultat['nom'];
        ?>
</td>
		<td><?php 
        echo $resultat['prenom'];
示例#4
0
    } else {
        echo 'Запись "' . $name . '" добавленна в базу.';
    }
    $add_dev->close;
}
// Конец Склада
// Вызовы. Ночало.
// Форма для оформления нового вызова
if (isset($_GET['visov'])) {
    echo '<div class="row popap">';
    echo '<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">';
    echo '<form action="add.php" method="post">';
    echo '<div style="margin-top: 10px;">';
    echo '<select class="form-control" name="partner">';
    echo '<option value="0">Выберите партнера</option>';
    select_users('no', 'yes');
    echo '</select>';
    echo '</div>';
    echo '<div class="mtop10" id="sandbox-container"><div class="input-group date">
		<input type="text" name="data" class="form-control" required placeholder="Дата вызова" value="' . $base_date . '" ><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
	</div></div>';
    echo '<div class="input-group clockpicker mtop10">
		<input type="text" name="time" required class="form-control" value="' . $base_time . '">
		<span class="input-group-addon">
			<span class="glyphicon glyphicon-time"></span>
		</span>
	</div>';
    echo '<div id="select" style="display:inline-block; margin-top: 10px;"><span style="cursor:pointer;" onclick="fisik()">Физ.лицо</span><span style="margin-left:10px; cursor:pointer;" onclick="yurik()">Организация</span></div>';
    echo '<div id="fisik" style="display:none;">';
    echo '<div style="margin-top: 10px;"><input class="form-control" name="street" type="text" placeholder="Введите улицу"></div>';
    echo '<div style="margin-top: 10px;"><input class="form-control" name="home" type="text" placeholder="№ дома"></div>';
示例#5
0
<div class="container-fluid">
	<div class="row pagetitle"><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="">Оформление выплаты</div></div>
	<div class="row popap">
		<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
			<form action="./viplaty.php" method="post">
				<input type="text" name="summa" placeholder="Сумма выплаты">
				<input type="hidden" name="id" value="<?php 
echo $id;
?>
">
				<input type="submit" name="add" value="Отправить">
			</form>
		</div>
		<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
			<?php 
$select_partner = select_users('partner', $id);
$fetch_partner = $select_partner->fetch_assoc();
$get_viplaty = get_viplaty($fetch_partner['partner_id']);
if (is_array($get_viplaty)) {
    foreach ($get_viplaty as $key => $val) {
        ?>
			<table class="table table-striped">
				<thead>
					<tr>
						<th>Дата</th>
						<th>Сумма</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td><?php 
示例#6
0
<?php

import('libs/plugins/hash.php');
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // パスワードのソルトを取得
    $users = select_users(array('select' => 'password_salt', 'where' => array('id = :id', array('id' => $_SESSION['auth']['user']['id']))));
    if (empty($users)) {
        $password_salt = null;
    } else {
        $password_salt = $users[0]['password_salt'];
    }
    // パスワード認証
    $users = select_users(array('select' => 'id, twostep, twostep_email', 'where' => array('id = :id AND password = :password', array('id' => $_SESSION['auth']['user']['id'], 'password' => hash_crypt($_POST['password'], $password_salt . ':' . $GLOBALS['config']['hash_salt'])))));
    if (empty($users)) {
        // パスワード認証失敗
        $_view['user'] = $_POST;
        $_view['warnings'] = array('パスワードが違います。');
    } else {
        $_SESSION['auth']['password'] = true;
        // リダイレクト
        redirect('/user/password');
    }
}
// タイトル
$_view['title'] = 'パスワード再入力サンプル';
示例#7
0
            ok();
        } else {
            warning($warnings);
        }
    } else {
        if (empty($warnings)) {
            $_SESSION['post']['user'] = $post['user'];
            // フォワード
            forward('/password/post');
        } else {
            $_view['user'] = $post['user'];
            $_view['key'] = $post['user']['key'];
            $_view['warnings'] = $warnings;
        }
    }
} else {
    // パスワード再発行用URLを検証
    $users = select_users(array('select' => 'token_expire', 'where' => array('email = :email AND token = :token', array('email' => $_GET['key'], 'token' => $_GET['token']))));
    if (empty($users)) {
        error('不正なアクセスです。');
    }
    if (localdate(null, $users[0]['token_expire']) < localdate()) {
        error('URLの有効期限が終了しています。');
    }
    $_view['user'] = array('password' => '');
    $_view['key'] = $_GET['key'];
    // 投稿セッションを初期化
    unset($_SESSION['post']);
}
// タイトル
$_view['title'] = 'パスワード再登録';
示例#8
0
	</head>
	<body>
		<?php 
connect();
?>
		<h3>Administrators</h3>
		<hr/>
		<?php 
$admins = select_users('admin');
foreach ($admins as $key => $value) {
    echo "- " . $value . "<br/>";
}
?>
		<br/><br/>
		<h3>Students</h3>
		<hr/>
		<?php 
$students = select_users('student');
foreach ($students as $key => $value) {
    echo "- " . $value . "<br/>";
}
?>
		<hr/>
		
		
	
	</body>
</html>

<?php 
include "footer.php";
示例#9
0
<?php

import('libs/plugins/ui.php');
// ページを取得
if (isset($_GET['page'])) {
    $_GET['page'] = intval($_GET['page']);
} else {
    $_GET['page'] = 1;
    $_SESSION['bulk']['user'] = array();
}
// ユーザを取得
$_view['users'] = select_users(array('order_by' => 'users.id', 'limit' => array(':offset, :limit', array('offset' => $GLOBALS['config']['limits']['user'] * ($_GET['page'] - 1), 'limit' => $GLOBALS['config']['limits']['user']))), array('associate' => true));
$_view['user_count'] = select_users(array('select' => 'COUNT(*) AS count'), array('associate' => true));
$_view['user_count'] = $_view['user_count'][0]['count'];
$_view['user_page'] = ceil($_view['user_count'] / $GLOBALS['config']['limits']['user']);
// ページャー
$pager = ui_pager(array('key' => 'page', 'count' => $_view['user_count'], 'size' => $GLOBALS['config']['limits']['user'], 'width' => $GLOBALS['config']['pagers']['user'], 'query' => '?'));
$_view['user_pager'] = $pager['first'] . ' ' . $pager['back'] . ' ' . implode(' | ', $pager['pages']) . ' ' . $pager['next'] . ' ' . $pager['last'];
// タイトル
$_view['title'] = 'ユーザ一覧';
示例#10
0
}
?>

<?php 
$title = 'Редактировать запись';
echo $modal_title_start . $title . $modal_title_end;
?>
	
<form action="editwork.php" method="post">
	<div class="row popap">
		<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
		    <div class="mtop10">
				<select class="form-control" name="partner">
				    <option value="0">Выберите партнера</option>
				    <?php 
select_users('no', $fetch_edit_work['partner']);
?>
				</select>
			</div>
			<div style="margin-top: 10px;">
				<div>
					Тип аппарата:<img onclick="newEl()" style="margin-left:5px; cursor:pointer;" width="15px" title="Добавить аппарат" alt="Добавить аппарат" src="../img/add.jpg">
				</div>
				<select class="form-control" id="selectdevice" style="display:block;" name="device">
					<option><?php 
echo $fetch_edit_work['device'];
?>
</option>
					<?php 
select_dev();
?>
示例#11
0
            if (empty($warnings)) {
                $_SESSION['post']['user'] = $post['user'];
                // フォワード
                forward('/admin/user_post');
            } else {
                $_view['user'] = $post['user'];
                $_view['warnings'] = $warnings;
            }
        }
    }
} else {
    // 初期データを取得
    if (empty($_GET['id'])) {
        $_view['user'] = default_users();
    } else {
        $users = select_users(array('where' => array('id = :id', array('id' => $_GET['id']))));
        if (empty($users)) {
            warning('編集データが見つかりません。');
        } else {
            $_view['user'] = $users[0];
        }
    }
    // 投稿セッションを初期化
    unset($_SESSION['post']);
    // 編集開始日時を記録
    if (!empty($_GET['id'])) {
        $_SESSION['update']['user'] = localdate('Y-m-d H:i:s');
    }
}
// タイトル
if (empty($_GET['id'])) {
示例#12
0
</script>';
}
require "config.php";
$user = $_SESSION['login'];
$who = 'arhiv';
// Получаем должность пользователя
$select_user = $connect_db->query("SELECT * FROM `users` WHERE `login` = '{$user}' LIMIT 1");
$fetch_user = $select_user->fetch_assoc();
$doljnost = $fetch_user['doljnost'];
// Получаем id должности для отображения документов пользователя, либо документов всех пользователей
$select_doljnost = $connect_db->query("SELECT * FROM `doljnosti` WHERE `doljnost` = '{$doljnost}' LIMIT 1");
$fetch_doljnost = $select_doljnost->fetch_assoc();
if ($fetch_doljnost['id'] == '6' || $fetch_doljnost['id'] == '13') {
    echo '<form class="form-inline"><div class="form-group"><select id="arhiv_select_users" class="form-control mbottom10 max-width300" name="user">
			<option value="no">Выберите пользователя</option>';
    select_users($who);
    echo '</select></div>';
}
?>
	<div class="form-group">
		<select id="arhiv_select_document" class="form-control mbottom10 max-width300" name="doc">
			<option value="no">Выберите документ</option>
			<option value="cheki">Чеки, гарантия</option>
			<option value="aktswork">Акты выполненных работ</option>
		</select>
	</div>
</form>
<div>
	<table id="arhive_table" class="table table-striped">
	<!-- Тут выводится таблица -->
	</table>
示例#13
0
 if (isset($_POST['_type']) && $_POST['_type'] === 'json') {
     if (empty($warnings)) {
         ok();
     } else {
         warning($warnings);
     }
 } else {
     if (empty($warnings)) {
         // トランザクションを開始
         db_transaction();
         // パスワード再発行用URLを通知
         $resource = update_users(array('set' => array('token' => rand_string(), 'token_code' => rand_number(1000, 9999), 'token_expire' => localdate('Y-m-d H:i:s', time() + 60 * 60 * 24)), 'where' => array('email = :email', array('email' => $_POST['email']))));
         if (!$resource) {
             error('指定されたメールアドレスが見つかりません。');
         }
         $users = select_users(array('where' => array('email = :email', array('email' => $_POST['email']))));
         // メール送信内容を作成
         $_view['url'] = $GLOBALS['config']['http_url'] . MAIN_FILE . '/password/form?key=' . rawurlencode($users[0]['email']) . '&token=' . $users[0]['token'];
         $_SESSION['expect']['token_code'] = $users[0]['token_code'];
         $to = $users[0]['email'];
         $subject = $GLOBALS['config']['mail_subjects']['password/send'];
         $message = view('mail/password/send.php', true);
         $headers = $GLOBALS['config']['mail_headers'];
         // メールを送信
         if (service_mail_send($to, $subject, $message, $headers) === false) {
             error('メールを送信できません。');
         }
         // トランザクションを終了
         db_commit();
         // リダイレクト
         redirect('/password/send');
示例#14
0
            $_SESSION['post']['profile'] = $post['profile'];
            // リダイレクト
            redirect('/user/modify_preview');
        } else {
            $_view['user'] = $post['user'];
            $_view['profile'] = $post['profile'];
            $_view['warnings'] = $warnings;
        }
    }
} elseif (isset($_GET['referer']) && $_GET['referer'] === 'preview') {
    // 入力データを復元
    $_view['user'] = $_SESSION['post']['user'];
    $_view['profile'] = $_SESSION['post']['profile'];
} else {
    // 初期データを取得
    $users = select_users(array('where' => array('id = :id', array('id' => $_SESSION['auth']['user']['id']))));
    if (empty($users)) {
        warning('編集データが見つかりません。');
    } else {
        $_view['user'] = $users[0];
        $_view['user']['password'] = '';
    }
    $profiles = select_profiles(array('where' => array('user_id = :id', array('id' => $_SESSION['auth']['user']['id']))));
    if (empty($profiles)) {
        warning('編集データが見つかりません。');
    } else {
        $_view['profile'] = $profiles[0];
    }
    // 投稿セッションを初期化
    unset($_SESSION['post']);
    // 編集開始日時を記録
示例#15
0
						</div>
					</div>
					<div class="mtop10">
						<div>
							Заявленная проблема
						</div>
						<input class="form-control" name="problemsk" type="text" placeholder="Заявленная проблема" value="<?php 
echo $fetch_visov['problemsk'];
?>
">
					</div>
					<div class="mtop10">
				        <select class="form-control" name="partner">
				            <option value="0">Выберите партнера</option>
				            <?php 
select_users('no', $fetch_visov['partner']);
?>
				        </select>
			        </div>
				</div>
				<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
					<div class="mtop10">
						<div>
							Ведущий инженер
						</div>
						<select  class="form-control" id="username" name="engineer" required> 
							<option><?php 
echo $fetch_visov['engineer'];
?>
</option>
							<?php 
示例#16
0
						<div class="mtop10"><input class="form-control" required name="addfamiliya" type="text" placeholder="Введите фамилию"></div>
						<div class="mtop10"><input class="form-control" required name="addotchestvo" type="text" placeholder="Введите отчество"></div>
						<div class="mtop10">
							<select class="form-control" name="adddoljnost" required>
								<?php 
select_doljnost_option($userid = 0);
?>
							</select>
						</div>
						<div class="mtop10"><input class="form-control" required name="addtelefon" type="tel" placeholder="Введите телефон"></div>
						<div class="mtop10"><input class="form-control" required name="addemail" type="email" placeholder="Введите email"></div>
						<div class="mtop10"><input class="btn btn-success btn-block" name="submit" type="submit" value="Добавить"></div>
					</form>
				</div>
			</div>
		</div>
		<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
			<div class="mtop10 gborder">
				<div class="subtitle">Существующие пользователи</div>
				<div class="pad0555">
					<table class="table table-striped mperimetr mtop10">
						<?php 
select_users();
?>
					</table>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
示例#17
0
//$balans = oborot($partner, '0', '1');
if ($_SESSION['login'] == 'maxim') {
    $www = select_users('partner', $_SESSION['partner_id']);
    //var_dump($www);
}
?>
<table class="table table-striped mtop10">
	<tbody>
		<tr>
		    <th>Номер</th>
		    <th>Ф.И.О. партнера</th>
		    <th>Телефон</th>
		    <th>E-mail</th>
		    <th>Баланс</th>
		    <th>Действия</th>
		</tr>
		<?php 
$select_users = select_users('partner', $_SESSION['partner_id']);
while ($fetch_users = $select_users->fetch_assoc()) {
    $fio = $fetch_users['familiya'] . ' ' . $fetch_users['name'] . ' ' . $fetch_users['otchestvo'];
    echo '<tr><td>' . $fetch_users['partner_id'] . '</td><td>' . $fio . '</td><td>' . $fetch_users['telefon'] . '</td><td>' . $fetch_users['email'] . '</td>';
    echo '<td>' . oborot($fetch_users['partner_id'], $vsego = '0', $ostatok = '1') . '</td>
            <td><a title="Выплаты" class="fancybox fancybox.iframe" href="/inc/resellers/viplaty.php?id=' . $fetch_users['id'] . '"><span class="glyphicon glyphicon-usd"></span></a>
            <a title="Клиенты от реселлера" href="/inc/resellers/index.php?resellers_id=' . $fetch_users['partner_id'] . '"><span class="glyphicon glyphicon-th-list"></span></a></td></tr>';
}
?>
	</tbody>
</table>

<?php 
include "template/default/footer.php";