示例#1
0
<?php

require_once "../utils.php";
$state = check_connected();
// User is connected
if ($state) {
    // User has bought the option
    if (checkOptions("reload")) {
        // Text header
        header("Content-type:text/plain");
        // Write timestamp into user file
        createFile("../../", $_COOKIE["ok"]);
    } else {
        NeedOption();
    }
    // Not connected
} else {
    ForbiddenAccess();
}
示例#2
0
<?php

require_once "../utils.php";
//Connected or not
$state = check_connected();
//If connected
if ($state) {
    //If user have buy option
    if (checkOptions("password")) {
        //If validation of the form
        if (isset($_POST["password_old"])) {
            //Inputs
            $current = checkInput("post", "password_old", "/^.+\$/");
            $new1 = checkInput("post", "password_new1", "/^.+\$/");
            $new2 = checkInput("post", "password_new2", "/^.+\$/");
            //If inputs are ok
            if ($current != false && $new1 != false && $new2 != false) {
                //Check current password
                $db = connectDataBase();
                $sql = "SELECT `user_id` FROM `webapp_users`\n\t\t\t\t\t\tWHERE `user_login` = '" . $_SESSION["user"]["login"] . "'\n\t\t\t\t\t\tAND `user_pass` = SHA1('{$current}') LIMIT 1;";
                $query = $db->query($sql);
                //Ok if one result
                if ($query->rowCount() == 1) {
                    //If new passwords are equal
                    if ($new1 == $new2) {
                        //Set new password in database
                        $sql = "UPDATE `webapp_users` SET `user_pass` = SHA1('" . $new1 . "') WHERE `webapp_users`.`user_id` = " . $_SESSION["user"]["id"] . ";";
                        if ($db->query($sql)) {
                            //---------------------------------------------------------------------------
                            //
                            // Password changed --- Start
<?php

require_once "../utils.php";
$state = check_connected();
header("Content-type:text/plain");
// User is connected
if ($state) {
    // User has bought the option
    if (checkOptions("scenario")) {
        /*
         * Check users inputs
         * Good practices against hackers !
         * Belt and shoulder strap :)
         *
         */
        $id = checkInput("post", "id", "/^[0-9]+\$/");
        //Good input
        if ($id != false) {
            /*
             * SQL Query
             *
             */
            $sql = "DELETE FROM `webapp_scenarios`\n\t\t\t\t\tWHERE `scenario_id` = " . $id . "\n\t\t\t\t\tAND `user_id` = " . $_SESSION["user"]["id"] . ";";
            /*
             * Exec query, transform the result in json and close the database
             *
             */
            // If there is an sql query
            if ($sql) {
                // New PDO
                $db = connectDataBase();
示例#4
0
			<li class="dropdown" id="menu_more">

				<a href="#" class="dropdown-toggle" data-toggle="dropdown" title="Options">
				<b style="font-size:15px;padding:0px;" b class="glyphicon glyphicon-cog"></b></a>

				<ul class="dropdown-menu">



					<li><strong>Utilisateur - <?php 
echo $_SESSION["user"]["login"];
?>
</strong></li>

					<?php 
if (checkOptions("password") || checkOptions("scenario") || checkOptions("reload")) {
    ?>
						<li><a href="#" data-toggle="modal" data-target="#LabelSettings" onClick="BuildSettings();"><span class="glyphicon glyphicon-cog"></span> Paramètres</a></li>
					<?php 
}
?>

					<li><a href="#" data-toggle="modal" data-target="#LabelLogout" onClick="BuildSignOut();"><span class="glyphicon glyphicon-log-out"></span> Déconnexion</a></li>
				</ul>
			</li>

			<!-- Admin menu-->
			<?php 
if (checkRoot()) {
    ?>
				<li class="dropdown" id="menu_more">