Exemple #1
0
     } else {
         include_once 'includes/pages/adminban.inc';
     }
     break;
 case "userslist":
     $page = $_GET['page'];
     $userlist = usersList($page);
     include_once 'includes/pages/adminusers.inc';
     break;
 case "banslist":
     include_once 'includes/pages/adminbans.inc';
     break;
 case "forum":
     if ($_GET['action'] == 'newTopic') {
         if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['name']) && isset($_POST['message'])) {
             $topic = newTopic($_POST['name'], $id, $_POST['message']);
             redirect('admin.php?page=forum&topic=' . $topic, 0);
         } else {
             include_once 'includes/pages/adminnewtopic.inc';
         }
     } elseif ($_GET['action'] == 'newPost' && $_GET['topic']) {
         if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['message'])) {
             newPost($_GET['topic'], $id, $_POST['message']);
             redirect('admin.php?page=forum&topic=' . $_GET['topic'], 0);
         } else {
             include_once 'includes/pages/adminnewpost.inc';
         }
     } elseif ($_GET['topic']) {
         $topic = Topic($_GET['topic']);
         include_once 'includes/pages/adminposts.inc';
     } else {
Exemple #2
0
<?php

include "functions.php";
session_start();
// -------------------- DELETE TOPIC -----------------------
if (isset($_POST['deleteID'])) {
    deleteTopic($_POST['deleteID']);
}
if (isset($_POST['newID']) && isset($_POST['subj']) && !isset($POST['topicID'])) {
    newTopic($_POST['newID'], $_POST['subj']);
}
if (isset($_POST['topicName']) && isset($_POST['subj']) && isset($_POST['topicID'])) {
    editTopic($_POST['topicName'], $_POST['subj'], $_POST['topicID']);
}
if (isset($_POST['drag_topic'])) {
    //die($_SESSION['user_ID']);
    getTableQuestionSingle($_POST['drag_topic'], $_SESSION['user_ID']);
    //echo "all good so far";
    // showSelectTopic()
}
//edit question
if (isset($_POST['ans']) && isset($_POST['ques']) && isset($_POST['diff']) && isset($_POST['question_ID'])) {
    editQuestion($_POST['question_ID'], $_POST['ques'], $_POST['ans'], $_POST['diff']);
}
//delete question
if (isset($_POST['questionID']) && isset($_POST['questionConfirm'])) {
    deleteQuestionSingle($_POST['questionID']);
}
//save new question
if (isset($_POST['ques']) && isset($_POST['topicID']) && isset($_POST['ans']) && isset($_POST['diff']) && isset($_POST['newQues'])) {
    //first, validate the data
Exemple #3
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);
    }
}