File: app/modules/contracts/open_contracts.php

Recommend this page to a friend!
  Classes of Laudir Bispo  >  PHP Real Estate Website  >  app/modules/contracts/open_contracts.php  >  Download  
File: app/modules/contracts/open_contracts.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Real Estate Website
Manage the properties of a real estate business
Author: By
Last change:
Date: 5 months ago
Size: 2,384 bytes
 

Contents

Class file image Download
<?php
require_once ($_SERVER['DOCUMENT_ROOT'].'/config/config.php');
session_name(SESSION_NAME);
session_start();
header('Content-Type: application/json');
require_once (
$_SERVER['DOCUMENT_ROOT'].'/config/autoload.php');
require_once (
$_SERVER['DOCUMENT_ROOT'].'/config/public_functions.php');
require_once (
$_SERVER['DOCUMENT_ROOT'].'/app/controls/adminFunctions.php');

if(
$_SESSION['user_type'] != 'administrador' and $_SESSION['user_type'] != 'suporte' )
{
    if(!isset(
$_SESSION['contracts_view']) or $_SESSION['contracts_view'] !== 'Y' )
    {
       
$response = array(
          
'status' => 'error',
          
'message' => 'Você não tem permissão para realizar está ação.',
          
'link' => '',
        );
        die(
json_encode($response));
    }
   
}
if(!isset(
$_GET['actionid']) or empty($_GET['actionid']))
{
   
$response = array(
       
'status' => 'warning',
       
'message' => 'Selecione um contrato para executar esta ação.',
       
'link' => '',
     );
     die(
json_encode($response));
}
else
{
   
$actionid = filterString(base64_decode($_GET['actionid']), 'INT');
}
//--------------------------------------------------------------------------

$con_db = new config\connect_db();
$con = $con_db->connect();

$open_contract = $con->prepare("SELECT model, description, text FROM tempantes_contracts WHERE id = ? LIMIT 1");
$open_contract->bind_param('i', $actionid);
$open_contract->execute();
$open_contract->store_result();
$open_contract->bind_result($model, $description, $text);
$open_contract->fetch();
$rows = $open_contract->num_rows;
$open_contract->free_result();
$open_contract->close();

if (
$open_contract and $rows > 0)
{
    require_once (
$_SERVER['DOCUMENT_ROOT'].'/libs/HTMLPurifier/HTMLPurifier.auto.php');
   
$HTMLPurifier_config = HTMLPurifier_Config::createDefault();
   
$purifier = new HTMLPurifier($HTMLPurifier_config);
   
$html = $purifier->purify($text);

   
$response = array(
       
'status' => 'success',
       
'message' => 'Modelo carregado',
       
'model' => $model,
       
'description' => $description,
       
'html' => $html,
       
    );
    die(
json_encode($response));
}
else
{
   
$response = array(
       
'status' => 'error',
       
'message' => 'Um erro inesperado aconteceu! Tente novamente mais tarde.',
       
'link' => '',
     );
     die(
json_encode($response));
}


For more information send a message to info at phpclasses dot org.