Fix subscription (not saved when confirm)

This commit is contained in:
Némunaire 2012-06-19 21:22:31 +02:00
parent 9438b9d236
commit b39b9931ef
3 changed files with 13 additions and 47 deletions

View File

@ -17,10 +17,9 @@
<nav>
<ul>
<li><a href="./">Accueil</a></li>
<li><a href="./list.php">Liste des questions</a></li>
<li><a href="./subscribe.html">S'inscrire</a></li>
<li><a href="./subscribe.php">S'inscrire</a></li>
</ul>
</nav>
</header>

View File

@ -1,23 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8" />
<link rel="Stylesheet" href="style.css" />
<title>Every AskWeb (BETA)</title>
</head>
<body>
<header>
<div id="main_title">
<a href="http://www.h2g2.com" target="_blank">
<img src="marvin-robot_normal.png" alt="" id="banner"/>
</a>
<h1>Nemubot AskWeb (BETA)</h1>
</div>
</header>
<?php include("header.html") ?>
<section id="introduction">
<article id="left">
<h2>Inscription</h2>
@ -43,6 +24,5 @@
</form>
</article>
</section>
</body>
</html>

View File

@ -1,38 +1,25 @@
<?php
include ("header.html");
?>
<section id="introduction">
<article>
<h2>
<?php
include("User.class.php");
$users = User::getUsers();
if (!array_key_exists($_GET['id'], $users))
{
$message = "unknown";
}
echo "Une erreur est survenue";
else if (!$users[$_GET['id']]->isValidated())
{
$users[$_GET['id']]->set_validated(true);
$message = "ok";
User::setUsers($users);
echo "Vous êtes maintenant inscrit !";
}
else
{
$message = "already";
}
?>
<section id="introduction">
<article>
<?php
if ($message == "ok") {
?>
<h2>Vous êtes maintenant inscrit !</h2>
<?php } else if ($message == "already") {
?>
<h2>Vous êtes déjà inscrit</h2>
<?php } else {?>
<h2>Une erreur est survenue</h2>
<?php } ?>
echo "Vous êtes déjà inscrit";
?></h2>
</article>
</section>