PHP Classes

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

Recommend this page to a friend!
  Classes of James Brows   PHP Bulletin Board   upload/plugins/bulletinboard/api_libs/bb_add_message_ads.php   Download  
File: upload/plugins/bulletinboard/api_libs/bb_add_message_ads.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: 2 years ago
Size: 1,463 bytes
 

Contents

Class file image Download
<?php

function bb_add_message_ads()
{
       
  
$username=isset(Configs::$_['user_data']['user_id'])?Configs::$_['user_data']['user_id']:'';

  
// useClass('EmailSystem');

    // Check default post status of user group
   
$status='1';

   
$subject=addslashes(getPost('subject'));
   
$content=addslashes(getPost('content'));


   
$useID=rand(6,20);

   
$message_id=newID($useID);

   
$insertData=array(
       
'message_id'=>$message_id,
       
'subject'=>$subject,
       
'content'=>$content,
       
'allow_reply'=>'0',
       
'username'=>Configs::$_['user_data']['username'],
       
'user_id'=>Configs::$_['user_data']['user_id'],
    );

    if(!isset(
$insertData['content'][1]))
    {
        return
'Content not allow blank!';
    }

    if(!isset(
$insertData['subject'][1]))
    {
        return
'Subject not allow blank!';
    }

   
$db=new Database();

   
$queryStr=arrayToInsertStr('bb_message_data',$insertData);
   
   
$db->nonquery($queryStr);

       
   
$insertData=array(
   
'message_id'=>$message_id,
   
'user_id'=>Configs::$_['user_data']['user_id'],
    );

   
$queryStr=arrayToInsertStr('bb_message_ads_data',$insertData);
   
   
$db->nonquery($queryStr);

   
$queryStr=" insert into bb_message_user_data";
   
$queryStr.=" select '".$message_id."',username,user_id,'".Configs::$_['user_data']['user_id']."','0',NULL";
   
$queryStr.=" from user_mst";

   
$db->nonquery($queryStr);

    return
'Done';
}