예제 #1
0
        <title>Forum</title>
    </head>

    <body>
        <header><a href="index.php"><img src="design/banniere.png" alt="Bannière"/></a></header>
		<section>
			<div id="panel">
				<?php 
    disp_connexion_p();
    ?>
			</div>
			
			<div id="mid">
			<?php 
    if (isset($error)) {
        disp_error($error);
    } else {
        disp_body();
    }
    ?>
			</div>
			
			<div id="panel">
				<?php 
    disp_members_p();
    ?>
			</div>
		</section>
		<!-- Piwik -->
		<script type="text/javascript">
			var _paq = _paq || [];
예제 #2
0
function disp_body()
{
    if (!isset($_GET['p'])) {
        disp_cats();
    } elseif (isset($_GET['id'])) {
        if ($_GET['p'] == 'f') {
            if (isset($_POST['topicname']) && isset($_POST['message']) && connected()) {
                if (newTopic($_POST['topicname'], $_GET['id'], $_SESSION['id'], $_POST['message'])) {
                    disp_error(ERR_404);
                } elseif (disp_forum($_GET['id'])) {
                    disp_error(ERR_404);
                }
            } elseif (disp_forum($_GET['id'])) {
                disp_error(ERR_404);
            }
        } else {
            if ($_GET['p'] == 't') {
                if (isset($_POST['message']) && connected()) {
                    if (newPost($_POST['message'], $_GET['id'], $_SESSION['id'])) {
                        disp_error(ERR_404);
                    } elseif (disp_topic($_GET['id'])) {
                        disp_error(ERR_404);
                    }
                } elseif (disp_topic($_GET['id'])) {
                    disp_error(ERR_404);
                }
            } else {
                if ($_GET['p'] == 'm') {
                    if (disp_member($_GET['id'])) {
                        disp_error(ERR_404);
                    }
                } elseif ($_GET['p'] == 'newt' || $_GET['p'] == 'newp') {
                    if (connected()) {
                        ?>
				<div id="forum"><h2><?php 
                        if ($_GET['p'] == 'newt') {
                            ?>
Créer un nouveau topic :<?php 
                        } else {
                            ?>
Poster un nouveau message : <?php 
                        }
                        ?>
</h2>
				<form method="post" action="index.php?p=<?php 
                        if ($_GET['p'] == 'newt') {
                            echo 'f';
                        } else {
                            echo 't';
                        }
                        ?>
&id=<?php 
                        echo $_GET['id'];
                        ?>
">
					<p>
						<?php 
                        if ($_GET['p'] == 'newt') {
                            ?>
<label for="topicname">Nom du topic :</label><input id="topicname" type="text" name="topicname" maxlength="64"/><br/><?php 
                        }
                        ?>
						<label for="message">Message :</label><textarea id="message" name="message"></textarea><br/>
						<input type="submit" value="Valider"/>
					</p>
				</form>
				</div>
			<?php 
                    } else {
                        disp_error(ERR_GDC_DC);
                    }
                } else {
                    disp_error(ERR_404);
                }
            }
        }
    } elseif ($_GET['p'] == 'inscr') {
        disp_inscriptionForm();
    } elseif ($_GET['p'] == 'dc') {
        ?>
<p>Vous êtes maintenant déconnecté.</p><?php 
    } elseif ($_GET['p'] == 'co_ok') {
        ?>
<p>Vous êtes maintenant connecté.</p><?php 
    } elseif ($_GET['p'] == 'inscr_ok') {
        ?>
<p>Vous êtes maintenant incrit sur ce forum.</p><?php 
    } elseif ($_GET['p'] == 'gdc') {
        if (connected()) {
            if (isset($_POST['gdc_mdp']) && isset($_POST['gdc_cmdp'])) {
                if ($_POST['gdc_mdp'] == $_POST['gdc_cmdp']) {
                    if (changeMDP($_SESSION['id'], $_POST['gdc_mdp'])) {
                        disp_error(ERR_INSCR_MDP);
                    } else {
                        echo '<div id="green"><p>' . GDC_MDP_CHANGED . '</p></div>';
                    }
                } else {
                    disp_error(ERR_INSCR_CONF);
                }
            } elseif (isset($_POST['gdc_email'])) {
                if (changeEmail($_SESSION['id'], $_POST['gdc_email'])) {
                    disp_error(ERR_INSCR_EMAIL);
                } else {
                    echo '<div id="green"><p>' . GDC_EMAIL_CHANGED . '</p></div>';
                }
            } else {
                disp_gdc();
            }
        } else {
            disp_error(ERR_GDC_DC);
        }
    } else {
        disp_error(ERR_404);
    }
}