예제 #1
0
 public function log_in()
 {
     $objdata = new Database();
     $sth = $objdata->prepare('SELECT * FROM users WHERE logUser = :login AND pasUser = :pass');
     $sth->execute(array(':login' => $_POST['Usern'], ':pass' => $_POST['passU']));
     $data = $sth->fetch();
     $count = $sth->rowCount();
     if ($count > 0) {
         if ($data['id_matrix'] == 0) {
             $objMatrix = new Matrix();
             $matrix = $objMatrix->create_matrix();
             $objMatrix->insert_matri($matrix);
             $datos = $objMatrix->return_matrix();
             $objMatrix->matrix_assign($data['idUser'], $datos[0]['id_matrix']);
         } else {
             header('location: ' . URL . 'matrix.php?m=' . $data['id_matrix'] . '&u=' . $data['idUser']);
         }
     } else {
         header('location: ' . URL . 'index.php?iderr=1');
     }
 }