} } else { return false; } if (ValueVar::delete_by_include_id($include_id)) { if (ValueVar::register_type("item", "ItemValueVar", true, $include_id) == false) { return false; } } else { return false; } if (!Registry::is_value("data_user_default_quota")) { $registry = new Registry(null); $registry->create("data_user_default_quota", $include_id, "53687091200"); } if (!Registry::is_value("data_quota_warning")) { $registry = new Registry(null); $registry->create("data_quota_warning", $include_id, "90"); } if (!Registry::is_value("data_max_cached_images")) { $registry = new Registry(null); $registry->create("data_max_cached_images", $include_id, "100000"); } if (!Registry::is_value("data_max_cache_period")) { $registry = new Registry(null); $registry->create("data_max_cache_period", $include_id, "30"); } return true; } $result = register_data($key);
if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) === false) { $error[] = 'Please Enter a valid email address'; } if (email_exists($_POST['email']) === true) { $error[] = 'the email \'' . $_POST['email'] . '\' already in used'; } } } ?> <div align="justify" style="alignment-adjust:hanging"><td><?php if (isset($_GET['success']) && empty($_GET['success'])) { echo "<div align='center' id= ><h2>you have registered successfully</h2></div>"; } else { if (empty($_POST) === false && empty($error) === true) { $register_data = array('username' => $_POST['username'], 'password' => $_POST['password'], 'firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'email' => $_POST['email'], 'branch' => strtolower($_POST['branch']), 'year' => $_POST['year'], 'emailcode' => sha1($_POST['username'] + date())); register_data($register_data); header('location:regstration.php?success'); exit; } else { if (empty($error) === false) { echo output_errors($error); } } ?> <h2 style="text-decoration:underline; background-position:top; position:relative; ">Registration Form</h2><form action="" method="post"> <ul > <li> Username*:<br><input type="text" name="username" autocomplete="on"></li><li> Password*:<br><input type="password" name="password" autocomplete="on"><br></li><li> Password again*:<br><input type="password" name="password_again" autocomplete="on"><br></li><li> First Name*:<br><input type="text" name="firstname" autocomplete="on"><br></li><li>
//フォームに文字が入力されているかどうか・他ユーザーと重複していないかチェック if ($_SERVER['REQUEST_METHOD'] == "POST") { if (empty($_POST['user_id']) or empty($_POST['password'])) { $display_message = 'ユーザーIDとパスワードを入力して下さい。'; } else { if (isset($_POST['user_id']) and isset($_POST['password'])) { $db = getDb(); $stt = $db->prepare("select * from login where user_id = :user_id and password = :password"); $stt->bindValue(':user_id', $_POST["user_id"]); $stt->bindValue(':password', $_POST["password"]); $stt->execute(); $result = $stt->fetch(); if ($result == false) { $user_id = $_POST['user_id']; $password = $_POST['password']; register_data($user_id, $password); $display_message = '登録が完了しました!'; } else { $display_message = 'ユーザーIDが他のユーザーと重複しているので変更して下さい。'; } } else { $display_message = 'ユーザーIDとパスワードを入力して下さい。'; } } } function register_data($user_id, $password) { try { $db = getDb(); $stt = $db->prepare('insert into login(user_id, password) values(:user_id, :password)'); $stt->bindvalue(':user_id', $user_id);