PHP Classes

File: upload/plugins/bulletinboard/api_libs/bb_get_list_message_inbox.php

Recommend this page to a friend!
  Classes of James Brows   PHP Bulletin Board   upload/plugins/bulletinboard/api_libs/bb_get_list_message_inbox.php   Download  
File: upload/plugins/bulletinboard/api_libs/bb_get_list_message_inbox.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Bulletin Board
Manage and post messages in multi-user forums
Author: By
Last change:
Date: 3 years ago
Size: 1,553 bytes
 

Contents

Class file image Download
<?php


function bb_get_list_message_inbox()
{
   
//Ki?m tra Cookie, n?u ko ??ng nh?p thì tr? v? false
   
$cookie_username=isset(Configs::$_['user_data']['user_id'])?Configs::$_['user_data']['user_id']:'';

    try {
       
isValidAccessAPI();
    } catch (\
Exception $e) {
        echo
responseData($e->getMessage(),'yes');return false;
    }

   
$keywords=addslashes(getPost('keywords',''));
   
$start_date=addslashes(getPost('start_date',''));
   
$end_date=addslashes(getPost('end_date',''));
   
$username=addslashes(getPost('username',''));

   
$limit=addslashes(getPost('limit','30'));
   
$page_no=addslashes(getPost('page_no','1'));

    if((int)
$page_no > 0)
    {
       
$page_no=(int)$page_no-1;
    }
    if((int)
$page_no<=0)
    {
       
$page_no=0;
    }

   
$offset=(int)$page_no*30;
 
   
$queryStr='';

   
$queryStr="select a.*,b.subject,b.ent_dt,b.username,b.user_id from bb_message_user_data as a ";
   
$queryStr.=" left join bb_message_data as b ON a.message_id=b.message_id WHERE CAST(b.ent_dt as date) BETWEEN '".$start_date."' AND '".$end_date."' AND a.target_user_id='".Configs::$_['user_data']['user_id']."' ";


    if(isset(
$keywords[2]))
    {
       
$queryStr.=" AND (b.subject LIKE '%".$keywords."%' OR b.content LIKE '%".$keywords."%') ";
    }

    if(isset(
$username[1]))
    {
       
$queryStr.=" AND b.username='".$username."' ";
    }

   
$queryStr.=" order by b.ent_dt desc limit ".$offset.",".$limit;

   
$db=new Database();
   
$result=$db->query($queryStr);

    return
$result;
}