Beispiel #1
0
<!-- insertion de la fonction permettant d'ajouter des utilisateurs à la base de données !-->
<?php 
require 'FonctionsUtilisateurs.php';
insert_users();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http;//www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">

	<head>
		<title> INSCRIPTION </title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<link rel="stylesheet" href="Style-form.css"/>
	</head>

	<body>
		<centralform>
		<h2> Formulaire de création de profil </h2>
		<!-- insertion du formulaire!-->
		<?php 
include "Form-Profil.php";
?>
	 </centralform>
	</body>

</html>
require 'model.php';
?>
<!DOCTYPE HTML>
<html>
    <head>        
        <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 {
Beispiel #3
0
        ?>
 <table border="1" style="width:70%">
						<tr>
						<td> <?php 
        echo $result[0]->ans_title;
        ?>
 </td>
						<td><?php 
        echo 100 * round($result[0]->votes / $findVotes, 4);
        ?>
</td>
						</tr>
				</table><?php 
    }
} else {
    insert_users($user_id, $post_id);
    global $wpdb;
    $findVotes = $wpdb->get_var($wpdb->prepare("\n\t\t\t\t\tSELECT all_votes \n\t\t\t\t\tFROM wp_polls \n\t\t\t\t\tWHERE poll_id = %d\n\t\t\t\t", $post_id));
    $findVotes = $findVotes + 1;
    $wpdb->query("UPDATE wp_polls SET all_votes={$findVotes} WHERE poll_id={$post_id}");
    $findvotes = $wpdb->get_var("\n\t\t\t\t\tSELECT votes \n\t\t\t\t\tFROM wp_answers \n\t\t\t\t\tWHERE poll_id = {$post_id} AND ans_id = {$vote}\n\t\t\t\t");
    $findvotes = $findvotes + 1;
    $wpdb->query("UPDATE wp_answers SET votes={$findvotes} WHERE poll_id={$post_id} AND ans_id={$vote}");
    $str1 = get_post_field('post_content', $post_id);
    $count = substr_count($str1, '-') + 1;
    ?>
			<h2> Results: <h3><?php 
    for ($i = 0; $i < $count; $i++) {
        $result = $wpdb->get_results("SELECT ans_title,votes FROM wp_answers WHERE poll_id={$post_id} AND ans_id={$i}");
        ?>
 <table border="1" style="width:70%">
Beispiel #4
0
}
if (!isset($_POST['users'])) {
    header('location: add_users_form.php');
    exit;
}
if (empty($_POST['users'])) {
    display_warning('Wype�nij poprawnie formularz!');
    exit;
}
$users = str_replace("\r", '', $_POST['users']);
$users = explode("\n", $users);
$users = array_map('trim', $users);
$valid_users = array();
foreach ($users as $user) {
    if (preg_match('/^[a-z.]+$/', $user) === 1) {
        $valid_users[] = $user;
    }
}
if (isset($_POST['confirmed'])) {
    if (!insert_users($valid_users)) {
        display_warning('Dodanie u�ytkownik�w zako�czone niepowodzeniem!');
        exit;
    }
    display_warning('Dodanie u�ytkownik�w zako�czone sukcesem! Ich nowe has�o to ' . DEFAULT_PASSWORD . '.');
} else {
    display_html_header();
    display_document_header();
    display_menu();
    display_add_users_conf_form($valid_users);
    display_document_footer();
}
function process_success($workflow_id, $returnJSON)
{
    $returnJSON = insert_permissions($workflow_id, $returnJSON);
    $returnJSON = insert_users($workflow_id, $returnJSON);
    return $returnJSON;
}
Beispiel #6
0
import('libs/plugins/hash.php');
// フォワードを確認
if (forward() === null) {
    error('不正なアクセスです。');
}
// 投稿データを確認
if (empty($_SESSION['post'])) {
    // リダイレクト
    redirect('/register');
}
// パスワードのソルトを作成
$password_salt = hash_salt();
// トランザクションを開始
db_transaction();
// ユーザを登録
$resource = insert_users(array('values' => array('username' => $_SESSION['post']['user']['username'], 'password' => hash_crypt($_SESSION['post']['user']['password'], $password_salt . ':' . $GLOBALS['config']['hash_salt']), 'password_salt' => $password_salt, 'email' => $_SESSION['post']['user']['email'])));
if (!$resource) {
    error('データを登録できません。');
}
// IDを取得
$user_id = db_last_insert_id();
// プロフィールを登録
$resource = insert_profiles(array('values' => array('user_id' => $user_id)));
if (!$resource) {
    error('データを登録できません。');
}
// トランザクションを終了
db_commit();
// 投稿セッションを初期化
unset($_SESSION['post']);
// リダイレクト