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> <nav>
<ul> <ul>
<li><a href="./">Accueil</a></li>
<li><a href="./list.php">Liste des questions</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> </ul>
</nav> </nav>
</header> </header>

View File

@ -1,23 +1,4 @@
<!DOCTYPE html> <?php include("header.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>
<section id="introduction"> <section id="introduction">
<article id="left"> <article id="left">
<h2>Inscription</h2> <h2>Inscription</h2>
@ -43,6 +24,5 @@
</form> </form>
</article> </article>
</section> </section>
</body> </body>
</html> </html>

View File

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