$lastname = $_POST['lastname'];
$landline = $_POST['landline'];
$mobile = $_POST['mobile'];
$homeline = $_POST['homeline'];
$address = $_POST['address'];
$birth = $_POST['birth'];
$twitter = $_POST['twitter'];
$facebook = $_POST['facebook'];
$email = $_POST['email'];
$password = $_POST['password'];
$new_password = $_POST['new_password'];
$type = isset($_POST['type']) ? $_POST['type'] : 2;
$employee = new employee($name, $lastname, $landline, $mobile, $homeline, $address, $birth, $twitter, $facebook, $email, $password, $type, $id);
/*Transaction status*/
$status = 'ok';
if ($result = $employee->checkPassword($connection)) {
    //Error
    $row = $result->fetch_array();
    $pass = $row['valid'];
    $result->close();
    if ($pass == 1) {
        $employee->setPassword($new_password);
        if (!$employee->changePassword($connection)) {
            //Error
            $error = $connection->lastError();
            $status = "Error {$error['errno']}: {$error['error']}";
        }
    } else {
        $status = 'invalid';
    }
} else {
Ejemplo n.º 2
0
<?php

require_once '../model/employee.php';
require_once '../model/error.php';
include_once '../controller/getText.php';
session_start();
$login = $_GET["login"];
$password = $_GET["password"];
$employee = new employee();
if ($employee->checkPassword($login, $password)) {
    $_SESSION["employee"] = $employee->getId();
    $_SESSION["connected"] = "true";
    header("location:viewIndex.php");
    exit;
} else {
    $_SESSION["error"] = serialize(new error($tf->getText(1)));
    $_SESSION["connected"] = "false";
    header("location:viewConnection.php");
    exit;
}