Пример #1
0
<?php

if (isset($_POST['title']) and isset($_POST['priority']) and isset($_POST['description'])) {
    $addTitle = $_POST['title'];
    $addPriority = $_POST['priority'];
    $addDescription = $_POST['description'];
    require $GLOBALS['LOF_SERVER_urlPhp'] . '/plugins/lof/popup.php';
    //GOOD
    $bdd = LOF_connect();
    $req = $bdd->prepare('UPDATE ' . $GLOBALS['LOF_BDD_TABLE_forums'] . '(title, description, priority) VALUES(:title,:description,:priority)');
    $req->execute(array('title' => $addTitle, 'description' => $addDescription, 'priority' => $addPriority));
    LOF_successPopup("Modification effectué !");
    ?>
        <meta http-equiv="refresh" content="1">
    <?php 
}
Пример #2
0
            throw new Exception('Certains champs ne sont pas remplit.');
        }
        //Author
        if (!($infosMessage['messageAuthorId'] == $_SESSION['id'])) {
            throw new Exception("Vous n'&ecirc;tes pas l'auteur de ce message");
        }
        //Verify Pin
        if (!($infosMessage['messagePin'] == $_GET['pin'])) {
            throw new Exception("Erreur dans le code pin");
        }
        //BDD connection
        $bdd = LOFConnect();
        //Update Message
        $req = $bdd->prepare('UPDATE ' . $GLOBALS['LOF_BDD_TABLE_messages'] . ' SET content = :content WHERE id = ' . $_GET['id'] . ' AND pin = "' . $_GET['pin'] . '"');
        $req->execute(array('content' => $_POST['message']));
        LOF_successPopup("Mise à jour effectuer ! Rediction en cours...");
        ?>
        <META http-equiv="refresh" content="1;URL=/forum/post.php?id=<?php 
        echo $_GET['postId'];
        ?>
&page=<?php 
        echo $_GET['postPage'];
        ?>
">    
        <?php 
    } catch (Exception $e) {
        LOF_errorPopup($e->getMessage());
    }
}
?>
	WHERE ' . $GLOBALS['LOF_BDD_TABLE_posts'] . '.id = ' . $_GET['postId'] . ' AND ' . $GLOBALS['LOF_BDD_TABLE_posts'] . '.pin = "' . $_GET['pin'] . '"';
    $bdd = LOFConnect();
    //BDD connect
    $postData = $bdd->query($request);
    $post = $postData->fetch();
    if (!($post['messageAuthorId'] == $_SESSION['id'])) {
        throw new Exception("Vous n'&ecirc;tes pas l'auteur de ce message");
    }
    if ($_GET['action'] <= 0 && $_GET['action'] >= 2) {
        throw new Exception("Erreur dans le type d'action");
    }
    // Update post
    $reqForum = $bdd->query('UPDATE ' . $GLOBALS['LOF_BDD_TABLE_posts'] . ' SET postState = ' . $_GET['action'] . ' WHERE id = ' . $post['postId'] . ' AND pin = "' . $_GET['pin'] . '"');
    $bdd = null;
    if ($_GET['action'] == 1) {
        LOF_successPopup("<strong>Le sujet est considéré comme résolu !</strong> Vous pouvez toujours répondre mais, si votre question est identique mais la solution proposée ici ne fonctionne pas/plus merci de faire un nouveau sujet.");
    } else {
        if ($_GET['action'] == 2) {
            LOF_errorPopup("Le sujet que vous consultez a été fermé par son auteur, vous ne pouvez plus y répondre.");
        }
    }
    ?>
 
    <noscript><META http-equiv="refresh" content="2;URL=/forum/post.php?id=<?php 
    echo $_GET['postId'];
    ?>
&page=1"></noscript>
    <?php 
} catch (Exception $e) {
    header("HTTP/1.0 500 Internal Server Error");
    echo "Erreur interne : la lecture du message &agrave; &eacute;chou&eacute;e.";
Пример #4
0
        //BDD connection
        $bdd = LOFConnect();
        //Account exist ?
        $reply = $bdd->query("SELECT " . $GLOBALS['LOF_BDD_TABLE_account'] . ".id, " . $GLOBALS['LOF_BDD_TABLE_account'] . ".rank, " . $GLOBALS['LOF_BDD_TABLE_account'] . ".pseudo, " . $GLOBALS['LOF_BDD_TABLE_account'] . ".password FROM " . $GLOBALS['LOF_BDD_TABLE_account'] . " WHERE pseudo='" . $loginName . "'");
        //Modifier la requête
        $value = $reply->fetch();
        if (!($value['pseudo'] == $loginName and $value['password'] == $loginPassword)) {
            throw new Exception('Mot de passe ou nom de compte incorrect.');
        }
        //GOOD
        $req = $bdd->query('UPDATE ' . $GLOBALS['LOF_BDD_TABLE_account'] . ' SET lastlogin = NOW() WHERE id = ' . $value['id']);
        $_SESSION['id'] = $value['id'];
        $_SESSION['rank'] = $value['rank'];
        $_SESSION['user'] = $value['pseudo'];
        $_SESSION['connect'] = 1;
        LOF_successPopup("Connexion en cours à votre compte...");
        //Rediction
        /*if(isset($_GET['url']))
              header('Location: '.$_GET['url']); 
          else
              header('Location: /'); */
        if (isset($_GET['url'])) {
            ?>
           <META http-equiv="refresh" content="2;URL=<?php 
            echo $_GET['url'];
            ?>
">    
           <?php 
        } else {
            ?>
           <META http-equiv="refresh" content="2;URL=/">    
Пример #5
0
            $actualPassword = LOF_encrypt($_POST['actualPassword']);
            if ($data['password'] == $actualPassword) {
                $newPassword = LOF_encrypt($_POST['newPassword']);
                $newPasswordAgain = LOF_encrypt($_POST['newPasswordAgain']);
                if ($newPassword == $newPasswordAgain) {
                    $req = $bdd->prepare('UPDATE ' . $GLOBALS['LOF_BDD_TABLE_account'] . ' SET password = :password WHERE id = ' . $_SESSION['id']);
                    $req->execute(array('password' => $newPassword));
                    LOF_successPopup("Modification effectuée (Mot de passe), rechargement de la page dans quelques secondes ...");
                } else {
                    LOF_errorPopup("Le nouveau mot de passe n'est pas identiques dans les 2 champs.");
                }
            } else {
                LOF_errorPopup("Le mot de passe actuel n'est pas valide.");
            }
        }
        //Update About
        if ($_POST['signature'] != $data['signature'] or $_POST['skype'] != $data['skype'] or $_POST['twitter'] != $data['twitter'] or $_POST['facebook'] != $data['facebook'] or $_POST['youtube'] != $data['youtube'] or $_POST['website1'] != $data['website1'] or $_POST['website2'] != $data['website2'] or $_POST['website3'] != $data['website3']) {
            $req = $bdd->prepare('UPDATE ' . $GLOBALS['LOF_BDD_TABLE_account'] . ' SET signature = :signature, skype = :skype, twitter = :twitter, facebook = :facebook, youtube = :youtube, website1 = :website1, website2 = :website2, website3 = :website3 WHERE id = ' . $_SESSION['id']);
            $req->execute(array('signature' => $_POST['signature'], 'skype' => $_POST['skype'], 'twitter' => $_POST['twitter'], 'facebook' => $_POST['facebook'], 'youtube' => $_POST['youtube'], 'website1' => $_POST['website1'], 'website2' => $_POST['website2'], 'website3' => $_POST['website3']));
            LOF_successPopup("Modification effectuée (Facultatif), rechargement de la page dans quelques secondes ...");
        }
        $bdd = NULL;
        //Rediction
        header('Refresh: 2');
    } catch (Exception $e) {
        LOF_errorPopup($e->getMessage());
    }
}
?>

Пример #6
0
        //BDD connection
        $bdd = LOFConnect();
        //Generate Pin code for post
        $pin = LOF_generatePin();
        $req = $bdd->prepare('INSERT INTO ' . $GLOBALS['LOF_BDD_TABLE_posts'] . '(category, title, description, author, messageNb, pin) VALUES(:category,:title,:description,:author,:messageNb,:pin)');
        $req->execute(array('category' => $_GET['id'], 'title' => $title, 'description' => $description, 'author' => $_SESSION['id'], 'messageNb' => 1, 'pin' => $pin));
        $postId = $bdd->lastInsertId();
        //Generate Pin code for message
        $pin = LOF_generatePin();
        //Create Message
        $reqMsg = $bdd->prepare('INSERT INTO ' . $GLOBALS['LOF_BDD_TABLE_messages'] . '(postId, headerMsg, content, author, publish, pin) VALUES(:postId, :headerMsg, :content,:author,:publish,:pin)');
        $reqMsg->execute(array('postId' => $postId, 'headerMsg' => 1, 'content' => $message, 'author' => $_SESSION['id'], 'publish' => $date->format('Y-m-j H:i:s'), 'pin' => $pin));
        $messageId = $bdd->lastInsertId();
        $reqForum = $bdd->query('UPDATE ' . $GLOBALS['LOF_BDD_TABLE_posts'] . ' SET lastMessage = ' . $messageId . ' WHERE id = ' . $postId);
        //Update Forum
        $reqForum = $bdd->query('UPDATE ' . $GLOBALS['LOF_BDD_TABLE_forums'] . ' SET messageNb = messageNb + 1, postNb = postNb + 1, lastMessage = ' . $messageId . ' WHERE id = ' . $_GET['id']);
        $bdd = null;
        LOF_successPopup("Votre poste est en ligne !");
        //Rediction
        if (isset($_GET['url'])) {
            header('Location: ' . $_GET['url']);
        } else {
            header('Location: /');
        }
    } catch (Exception $e) {
        LOF_errorPopup($e->getMessage());
    }
}
?>

Пример #7
0
        if (empty($postId) and empty($message)) {
            throw new Exception('Certains champs ne sont pas remplit.');
        }
        //BDD connection
        $bdd = LOFConnect();
        //Create Message
        $reqMsg = $bdd->prepare('INSERT INTO ' . $GLOBALS['LOF_BDD_TABLE_messages'] . '(postId, content, author, publish, pin) VALUES(:postId,:content,:author,:publish,:pin)');
        $reqMsg->execute(array('postId' => $postId, 'content' => $message, 'author' => $_SESSION['id'], 'publish' => $date->format('Y-m-j H:i:s'), 'pin' => $pin));
        $messageId = $bdd->lastInsertId();
        $reqForum = $bdd->query('UPDATE ' . $GLOBALS['LOF_BDD_TABLE_posts'] . ' SET messageNb = messageNb + 1, lastMessage = ' . $messageId . ' WHERE id = ' . $postId);
        //Update Forum
        $reqInfosPost = $bdd->query('SELECT ' . $GLOBALS['LOF_BDD_TABLE_posts'] . '.category FROM ' . $GLOBALS['LOF_BDD_TABLE_posts'] . ' WHERE id = ' . $postId);
        $infosPost = $reqInfosPost->fetch();
        $reqForum = $bdd->query('UPDATE ' . $GLOBALS['LOF_BDD_TABLE_forums'] . ' SET messageNb = messageNb + 1, lastMessage = ' . $messageId . ' WHERE id = ' . $infosPost['category']);
        //Update user information (msgNb)
        $reqUser = $bdd->query('UPDATE ' . $GLOBALS['LOF_BDD_TABLE_account'] . ' SET msgNb = msgNb + 1 WHERE id = ' . $_SESSION['id']);
        $bdd = null;
        LOF_successPopup("Merci de votre réponse ! Redirection en cours...");
        ?>
        <META http-equiv="refresh" content="2;URL=/forum/post.php?id=<?php 
        echo $_GET['id'];
        ?>
&page=1">    
        <?php 
    } catch (Exception $e) {
        LOF_errorPopup($e->getMessage());
    }
}
?>

Пример #8
0
require '../plugins/lof/popup.php';
require '../plugins/lof/addOn/encrypt.php';
//Update avatar
try {
    // User connect ?
    if (!isset($_SESSION['connect'])) {
        throw new Exception('Seules les personnes connectees peuvent supprimer des messages');
    }
    //Image format
    if (!($extension = strrchr($_FILES['avatar']['name'], '.') == ".png")) {
        throw new Exception('Le format de l\'image n\'est pas de type .png.');
    }
    //Size of image
    if (filesize($_FILES['avatar']['tmp_name']) > 32768) {
        throw new Exception('L\'image est trop volumineuse.');
    }
    //Upload image
    if (!move_uploaded_file($_FILES['avatar']['tmp_name'], "avatar/" . $_SESSION['id'] . ".png")) {
        throw new Exception('Erreur lors de la mise en ligne.');
    }
    //Rediction
    LOF_successPopup("Votre avatar est maintenant en ligne ! Redirection en cours...");
    ?>
        <META http-equiv="refresh" content="2;URL=editProfile.php">    
    <?php 
} catch (Exception $e) {
    LOF_errorPopup($e->getMessage());
}
?>

Пример #9
0
<?php

if (isset($_POST['title']) and isset($_POST['priority']) and isset($_POST['description'])) {
    $addTitle = $_POST['title'];
    $addPriority = $_POST['priority'];
    $addDescription = $_POST['description'];
    require $GLOBALS['LOF_SERVER_urlPhp'] . '/plugins/lof/popup.php';
    //GOOD
    $bdd = LOF_connect();
    $req = $bdd->prepare('INSERT INTO ' . $GLOBALS['LOF_BDD_TABLE_forums'] . '(title, description, priority) VALUES(:title,:description,:priority)');
    $req->execute(array('title' => $addTitle, 'description' => $addDescription, 'priority' => $addPriority));
    LOF_successPopup("L'ajout est effectué !");
    ?>
        <meta http-equiv="refresh" content="1">
    <?php 
}
Пример #10
0
	    ' . $GLOBALS['LOF_BDD_TABLE_posts'] . '.id AS postId,
	    ' . $GLOBALS['LOF_BDD_TABLE_account'] . '.id AS messageAuthorId
	FROM ' . $GLOBALS['LOF_BDD_TABLE_posts'] . '
	LEFT JOIN ' . $GLOBALS['LOF_BDD_TABLE_account'] . ' ON ' . $GLOBALS['LOF_BDD_TABLE_account'] . '.id=' . $GLOBALS['LOF_BDD_TABLE_posts'] . '.author
	WHERE ' . $GLOBALS['LOF_BDD_TABLE_posts'] . '.id = ' . $_GET['postId'] . ' AND ' . $GLOBALS['LOF_BDD_TABLE_posts'] . '.pin = "' . $_GET['pin'] . '"';
    $bdd = LOFConnect();
    //BDD connect
    $postData = $bdd->query($request);
    $post = $postData->fetch();
    if (!($post['messageAuthorId'] == $_SESSION['id'])) {
        throw new Exception("Vous n'&ecirc;tes pas l'auteur de ce message");
    }
    // Update post
    $reqForum = $bdd->query('UPDATE ' . $GLOBALS['LOF_BDD_TABLE_posts'] . ' SET postState = 0 WHERE id = ' . $post['postId'] . ' AND pin = "' . $_GET['pin'] . '"');
    $bdd = null;
    LOF_successPopup("<strong>Le sujet est de nouveau ouvert !</strong> Vous pouvez maintenant répondre au sujet.");
    ?>
 
    <noscript><META http-equiv="refresh" content="2;URL=/forum/post.php?id=<?php 
    echo $_GET['postId'];
    ?>
&page=1"></noscript>
    <?php 
} catch (Exception $e) {
    header("HTTP/1.0 500 Internal Server Error");
    echo "Erreur interne : la lecture du message &agrave; &eacute;chou&eacute;e.";
    die;
}
?>

Пример #11
0
        //Password
        if (!($registrationPassword == $registrationPassword_again)) {
            throw new Exception('Les mots de passe ne sont pas identiques.');
        }
        $req = $bdd->prepare('INSERT INTO ' . $GLOBALS['LOF_BDD_TABLE_account'] . '(rank, pseudo, password, email, created, lastlogin) VALUES(:rank,:pseudo,:password,:email,:created,:lastlogin)');
        $req->execute(array('rank' => 0, 'pseudo' => $registrationName, 'password' => $registrationPassword, 'email' => $minEmail, 'created' => $date->format('Y-m-d'), 'lastlogin' => $date->format('Y-m-d')));
        //Generate Avatar
        $avatar = imagecreate(170, 170);
        //Colors list
        $colorsList = array(imagecolorallocate($avatar, 255, 128, 0), imagecolorallocate($avatar, 192, 57, 43), imagecolorallocate($avatar, 26, 188, 156), imagecolorallocate($avatar, 142, 68, 173), imagecolorallocate($avatar, 41, 128, 185), imagecolorallocate($avatar, 39, 174, 96), imagecolorallocate($avatar, 241, 196, 15), imagecolorallocate($avatar, 108, 122, 137));
        $white = imagecolorallocate($avatar, 255, 255, 255);
        //Foreground Color
        $font = '../css/OpenSans-Light.ttf';
        $size = imagettfbbox(44, 0, $font, strtoupper(substr($registrationName, 0, 1)));
        $c = $size[4] - $size[6];
        $d = $size[3] - $size[5];
        $x = (170 - $d) / 2;
        $y = (170 + $c) / 2;
        imagefill($avatar, 0, 0, $colorsList[array_rand($colorsList)]);
        imagettftext($avatar, 44, 0, $x, $y, $white, $font, strtoupper(substr($registrationName, 0, 1)));
        //Write Pseudo
        imagepng($avatar, "avatar/" . $bdd->lastInsertId() . ".png");
        //Save avatar
        LOF_successPopup("Bravo, votre compte est maintenant disponible !");
    } catch (Exception $e) {
        LOF_errorPopup($e->getMessage());
    }
}
?>