Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Utility stuff
- error_reporting(E_ALL);
- ini_set('display_errors', 'On');
- session_start();
- $loggedIn = isset($_SESSION['login_username']);
- if (!$loggedIn) {
- header("Location: ../index.php?action=login");
- die("Website doesn't work apparantely if you dare ignore headers");
- }
- $action = "";
- if (isset($_GET['action'])) {
- $action = $_GET['action'];
- } else {
- $action = "index";
- }
- ?>
- <head>
- <link rel="stylesheet" type="text/css" href="index.css">
- <title>ProTo's website - Loup (<?php echo strtoupper($action); ?>)</title>
- </head>
- <body>
- <?php
- if ($action == "index") {
- echo '
- <form class="login-form" method="POST" action="">
- <div class="login-page">
- <div class="tble form">
- <form class="login-form" method="POST" action="XXXX.php">
- <table>
- <tr>
- <th></th>
- <th>Role Name</th>
- <th>Description</th>
- </tr>
- ';
- $loginName = base64_decode($_SESSION['login_username']);
- $conn = new mysqli("localhost", "proto_proto", "12351235", "proto_maindb");
- $sql = "SELECT * FROM loup_roles
- WHERE account = '$loginName'";
- echo '<p>Hey '.base64_decode($_SESSION['login_username']).'!</p>';
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- while ($row = $result->fetch_assoc()) {
- echo "<tr><td><input type='checkbox' name='checkedRoles[]' value='selected'><br></td><td>".$row['nom']."</td><td>".$row['description']."</td></tr>";
- }
- }
- echo '
- </table>
- <br><br>
- <br><br>
- <table>
- <tr>
- <th></th>
- <th>Player Name</th>
- </tr>
- ';
- $sql = "SELECT * FROM loup_players
- WHERE account = '$loginName'";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- $results_array = array();
- while ($row = $result->fetch_assoc()) {
- echo "<tr><td><input type='checkbox' name='checkedPlayers[]' value='selected'><br></td><td>".$row['nom']."</td></tr>";
- }
- }
- echo'
- </table>
- <br><br>
- <button name="pick">Pick</button><br><br>
- <button name="delete">Delete</button>
- ';
- if (isset($_SESSION['msg'])){
- echo '<p>'.$_SESSION['msg'].'</p>';
- //$_SESSION['msg'] = "";
- }else {echo'hi';}
- echo'
- </form>
- </div>
- </div>
- </form>';
- $_SESSION["TEST"] = "Test";
- if (isset($_POST["delete"]) == 1){
- if (isset($_POST['checkedRoles']) && isset($_POST['checkedPlayers'])){
- $checkedRolesArray = $_POST['checkedRoles'];
- $checkedPlayersArray = $_POST['checkedPlayers'];
- if (count($checkedRolesArray) != count($checkedPlayersArray)){
- $_SESSION['msg'] = "<br><br>ERROR: Number of checked roles should be equal to the number of checked players!";
- }else{
- header("Location: ../loup/delete.php");
- }
- }
- }
- else if (isset($_POST["pick"]) == 1){
- header("Location: ../loup/pick.php");
- }
- echo'
- <div class="login-page">
- <div class="form">
- <form class="login-form" method="POST" action="addrole.php">
- <input type="text" id="T1" name="T1" placeholder="Role name">
- <textarea name="T2" id="textarea" cols="35" placeholder="Enter description here (optional)"></textarea>
- <br>
- <br>
- <br>
- <button>Add role</button>
- ';
- if (isset($_SESSION['message_paste'])) {
- echo '<br><p>'.$_SESSION['message_paste'].'</p>';
- unset($_SESSION['message_paste']);
- }
- echo '
- </form>
- </div>
- </div>
- <div class="login-page">
- <div class="form">
- <form class="login-form" method="POST" action="addplayer.php">
- <input type="text" id="T1" name="T1" placeholder="Player name">
- <br>
- <br>
- <br>
- <button>Add player</button>
- ';
- if (isset($_SESSION['message_paste'])) {
- echo '<br><p>'.$_SESSION['message_paste'].'</p>';
- unset($_SESSION['message_paste']);
- }
- echo'
- </form>
- </div>
- </div>';
- }
- ?>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement