예제 #1
0
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
include_once '../../includes/includes.php';
sec_session_start();
if (!isset($_SESSION['username'])) {
    header("Location: ../../logout.php");
    exit;
}
if (isset($_GET['opt'])) {
    $check = dbCheckCorrectDevPwd($_POST['devName'], $_POST['devActualPwd']);
    if ($check == true) {
        if ($_GET['opt'] == "info") {
            $result = dbCheckDevName_format($_POST['devNewName']);
            if ($result == false) {
                header('Location: ../devDetails.php?devName=' . $_POST['devName'] . '&errorMessage=New device name has not correct format');
                exit;
            }
            $result = dbCheckDevName_exist($_POST['devNewName']);
            if ($_POST['devName'] != $_POST['devNewName'] && $result == true) {
                header('Location: ../devDetails.php?devName=' . $_POST['devName'] . '&errorMessage=New device name already exist');
                exit;
            }
            $email = dbGetUserEmail($_SESSION['username']);
            if ($email == false) {
                header('Location: ../../error.php?err=Please log in again');
예제 #2
0
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
include_once '../../includes/includes.php';
sec_session_start();
if (!isset($_SESSION['username'])) {
    header("Location: ../../logout.php");
    exit;
}
if (isset($_POST['names']) && isset($_GET['devName'])) {
    if (isset($_POST['devActualPwd'])) {
        $result = dbCheckCorrectDevPwd($_GET['devName'], $_POST['devActualPwd']);
        if ($result == true) {
            $result = dbChangeNameOfFields($_GET['devName'], $_POST['names']);
            if ($result == true) {
                header('Location: ../devDetails.php?devName=' . $_GET['devName'] . '&success=Name of fields changed');
                exit;
            }
            header('Location: ../devDetails.php?devName=' . $_GET['devName'] . '&errorMessage=Impossible to change name of fields');
            exit;
        }
        header('Location: ../devDetails.php?devName=' . $_GET['devName'] . '&errorMessage=Please insert the correct password for this device');
        exit;
    }
    header('Location: ../devDetails.php?devName=' . $_GET['devName'] . '&errorMessage=you should insert the password for this device');
    exit;
}