search
HomeBackend DevelopmentPHP Tutorial基于mysql的bbs设计(四)_php基础

5。版面模块设计
  所谓分类,更多的是为telnet服务端考虑的,在cq66模式下,用户可以按
照自己的意愿进行分类,反正最后都是直接以版为基本单位访问的。
  对于版面文章的访问,存放的时候以整篇文章为参数,文章的分块由本层
完成,如果上层以块为单位传送,则在上层全部传完,组合后,再传参到本层
分解;在读取 的时候,本层则以块为单位访问,如果上层要以全文为单位访问
,则在上层做合并 工作,本层不管。
  至于要不要独立出索引,不影响上层的操作,主要和下层的数据库构造有
关, 主要考虑可行性,效率需求等。
  权限的检查放在哪里进行呢?还是放在上层吧,其实就telnet服务器端,
和cq66 的客户端,根本不会给一般用户显示特殊指令的菜单,当然,用户可
以直接发送cq66 的指令,服务器方还是要检查的。但应该不用在它下面的功
能模块层再检查一次吧
。   Class BoardManage {
  private:

  public:
    // 有关分类的操作
    int GetClassNameInfo( int maxclass, char **classid,
              char ** classname );
      返回分类的信息,中英文名。
    int GetBoardName( int maxboards, char *classid,
              char **boardname );
      返回某分类中的版面信息,一般分类,直接select ..
      from sboard
      where boardclass == .... 特殊分类则查相应的表。。。。

    // 修改需要版面管理员以上的特权
    int NewClass( char * newclassname, int type );
      新建分类,普通分类还是特殊分类,
    int DeleteClass( char *newclassname );
      删除分类,但不cascade,即本层不负责一致性,由上层负责将
      相应的版面的分类信息改为别的。分类改名也是先删再建,
    int AddClassBoard( const char *classname, char *newboardname );
      将已建好的版加入某分类中,专门针对特殊分类,对一般分类,其
      效果和modifyboardinfo一样,
    int DeleteClassBoard( const char *classname, char *boardname );
      从分类中删除某个版,也是针对特殊分类,对一般分类,效果也
      是和modifyboardinfo一样,一个版的分类属性可以为空,即不属
      于任何分类。

    // 有关版的信息的操作。
    int NewBoard( const char *boardid,char *boardname);
      新建一个版,建立对应的表。其他参数取默认值。
    int DeleteBoard( const char *boardid );
      删除一个版,删除对应的表。
    int GetBoardInfo( const char *boardid, char *boardname,
            int& numposts, char *masters, char *class,
            long &level );
      取的版面的信息。
    int ModifyBoardId( const char *oldid, char *newid );
      改变版的英文id,对应table的名称也要改变,
    int ModifyBoardInfo( const char *boardid, char *boardname,
            int numposts, char *masters, char *class,
            long level );
      修改版面信息,需要特权。

    // 有关版面文章的操作。
    int AddText( char *boardid, char *title, char *writer,
            char *text );
      往版面中增加文章,内部将长文章分割成2k的块。
    int DeleteText( char *boardid, int num );
      删除文章,只是做一个标记,并不立刻修改对应的table。
    int FlushTable( char *boardid );
      刷新版面,删除被删文章的对应的记录。
    int MarkText( char *boardid, int num, char mark );
      给文章做标记。
    int ModifyTitle( char *boardid, int num, char *newtitle );
      修改文章的标题。
    int ModifyText( char *boardid, int num, char *newtext );
      修改文章内容,不是自己的文章需要特权。
    int GetTextInfo( const char *boardid, int num, char *title,
            char *writer, char& mark );
      取得文章的标题信息。
    int GetText( const char *boardid, int num, int block,
            char *text );
      读取文章的内容,以块为单位。

    // 文章和作者的查询
    // 一次将查询的结果全部返回?
    int QueryWriter( const char *boardid, char *writer,
            char **result );
      查询版面上,某作者的文章。
    int QueryTitle( const char *boardid, char *title,
            char **result );
      查询版面上,标题中包含指定内容的文章。
  }
    参数的传递是一件比较讨厌的事,从抽象的角度,希望返回的数据与
  底层无关,所以应该加以处理,但从效率的角度,又不希望数据进行多次
  复制,另一方面,空间的申请释放,究竟是在上层中完成还是在本层中完成
  呢?一不小心,很容易有内存错误。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What is the difference between unset() and session_destroy()?What is the difference between unset() and session_destroy()?May 04, 2025 am 12:19 AM

Thedifferencebetweenunset()andsession_destroy()isthatunset()clearsspecificsessionvariableswhilekeepingthesessionactive,whereassession_destroy()terminatestheentiresession.1)Useunset()toremovespecificsessionvariableswithoutaffectingthesession'soveralls

What is sticky sessions (session affinity) in the context of load balancing?What is sticky sessions (session affinity) in the context of load balancing?May 04, 2025 am 12:16 AM

Stickysessionsensureuserrequestsareroutedtothesameserverforsessiondataconsistency.1)SessionIdentificationassignsuserstoserversusingcookiesorURLmodifications.2)ConsistentRoutingdirectssubsequentrequeststothesameserver.3)LoadBalancingdistributesnewuser

What are the different session save handlers available in PHP?What are the different session save handlers available in PHP?May 04, 2025 am 12:14 AM

PHPoffersvarioussessionsavehandlers:1)Files:Default,simplebutmaybottleneckonhigh-trafficsites.2)Memcached:High-performance,idealforspeed-criticalapplications.3)Redis:SimilartoMemcached,withaddedpersistence.4)Databases:Offerscontrol,usefulforintegrati

What is a session in PHP, and why are they used?What is a session in PHP, and why are they used?May 04, 2025 am 12:12 AM

Session in PHP is a mechanism for saving user data on the server side to maintain state between multiple requests. Specifically, 1) the session is started by the session_start() function, and data is stored and read through the $_SESSION super global array; 2) the session data is stored in the server's temporary files by default, but can be optimized through database or memory storage; 3) the session can be used to realize user login status tracking and shopping cart management functions; 4) Pay attention to the secure transmission and performance optimization of the session to ensure the security and efficiency of the application.

Explain the lifecycle of a PHP session.Explain the lifecycle of a PHP session.May 04, 2025 am 12:04 AM

PHPsessionsstartwithsession_start(),whichgeneratesauniqueIDandcreatesaserverfile;theypersistacrossrequestsandcanbemanuallyendedwithsession_destroy().1)Sessionsbeginwhensession_start()iscalled,creatingauniqueIDandserverfile.2)Theycontinueasdataisloade

What is the difference between absolute and idle session timeouts?What is the difference between absolute and idle session timeouts?May 03, 2025 am 12:21 AM

Absolute session timeout starts at the time of session creation, while an idle session timeout starts at the time of user's no operation. Absolute session timeout is suitable for scenarios where strict control of the session life cycle is required, such as financial applications; idle session timeout is suitable for applications that want users to keep their session active for a long time, such as social media.

What steps would you take if sessions aren't working on your server?What steps would you take if sessions aren't working on your server?May 03, 2025 am 12:19 AM

The server session failure can be solved through the following steps: 1. Check the server configuration to ensure that the session is set correctly. 2. Verify client cookies, confirm that the browser supports it and send it correctly. 3. Check session storage services, such as Redis, to ensure that they are running normally. 4. Review the application code to ensure the correct session logic. Through these steps, conversation problems can be effectively diagnosed and repaired and user experience can be improved.

What is the significance of the session_start() function?What is the significance of the session_start() function?May 03, 2025 am 12:18 AM

session_start()iscrucialinPHPformanagingusersessions.1)Itinitiatesanewsessionifnoneexists,2)resumesanexistingsession,and3)setsasessioncookieforcontinuityacrossrequests,enablingapplicationslikeuserauthenticationandpersonalizedcontent.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment