PHP Classes

File: app/modules/users/update_status.php

Recommend this page to a friend!
  Classes of Laudir Bispo   PHP Real Estate Website   app/modules/users/update_status.php   Download  
File: app/modules/users/update_status.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: 3 years ago
Size: 1,289 bytes
 

Contents

Class file image Download
<?php
require_once ($_SERVER['DOCUMENT_ROOT'].'/config/config.php');
session_name(SESSION_NAME);
session_start();
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( !isset(
$_POST['status']) )
{
    die(
'gggg');
}
else
{
    if(
$_POST['status'] != 'ON' or $_POST['status'] != 'OFF' or $_POST['status'] != 'ABSENT' )
    {
        die(
$_POST['status']);
    }
    else
    {
       
$con_db = new config\connect_db();
       
$con = $con_db->connect();
       
       
$status = filterString($_POST['status'], 'CHAR');
       
       
$update_status = $con->prepare("INSERT INTO online_users (user_id, status, last_access) VALUES (?, ?, NOW()) ON DUPLICATE KEY UPDATE status = VALUES(status), last_access = NOW() ) ") or die(mysqli_error($con));
       
$update_status->bind_param('is', $_SESSION['user_id'], $status);
       
$update_status->execute();
       
$rows = $update_status->affected_rows;
       
$update_status->close();


        if(
$update_status and $rows <= 0)
        {
            die(
'error');
        }
        else
        {
            die(
'success');
        }
           
    }
}
?>