Sri lanka web server - 340 CHAPTER 11 MODIFYING PHPBB Using the

340 CHAPTER 11 MODIFYING PHPBB Using the template code in Listing 11-5, the values 1, 2, and 3 will display accordingly. If you were to run Listing 11-5 through the template engine, it would look a little something like this: I can count! 1 2 3 Working with phpBB Sessions phpBB provides several facilities for working with sessions. A lot of these facilities are automatically called during the script execution and rarely need manipulation. However, you may need to work with these functions if your modifications use custom pages. While browsing the phpBB code, you may have noticed the existence of an append_sid() function surrounding every hyperlink URI, like this: $foo_uri = ““; If you ever code a hyperlink in the phpBB source code, this is a necessary evil. The append_sid() function, when used around a URI, adds a session ID to the end of that URI to facilitate a continuous session for users who elect not to accept cookies in their browser. Typically, this session ID an MD5 hash of a hashed version of the user s IP address is passed via cookies from page to page, not requiring the passing of a session ID between URIs. It is good practice to make sure append_sid() is used consistently whenever you create a new hyperlink, as forgetting to use this function can cause continuity issues with users who are logged in without cookies. If they click a link on your site that does not have the session ID built in, this can cause phpBB to generate a new session, which may result in problems with topic marking and other related functions. Note The phpBB developers heard the call of its community, and they have dropped the append_sid() requirement in phpBB 3.0. Getting User Information phpBB offers some functions for getting user information. Two particularly useful ones are get_userdata() and auth(). If you do a lot of work with users, you will find the get_userdata() function immensely helpful. You can pass either the username or user ID number of the user whose data you wish to retrieve to the function. phpBB will figure it out and return a value. If you wish, you can also pass a second, optional parameter called force_str. If you pass true in as the second parameter, it will force a username check. If the user ID or username was found, the function will return the user s data. If the user does not exist, the function returns false. You are also able to retrieve permissions for a user or group by using the auth() function, which is the programming interface to the permissions system. This can help you write hacks that are dependent on the rights of a user. auth() takes four parameters:
Please visit
Domain Name Hosting services for high quality webhost to host and run your jsp applications.

Leave a Reply