SMF SSI.php Functions
Current Version: 2.0
This file is used to demonstrate the capabilities of SSI.php using PHP include functions. The examples show the include tag, then the results of it.
Include Code
To use SSI.php in your page add at the very top of your page before the <html> tag on line 1 of your php file:
<?php require("SSI.php"); ?>
Some notes on usage
All the functions have an output method parameter. This can either be "echo" (the default) or "array"
If it is "echo", the function will act normally - otherwise, it will return an array containing information about the requested task. For example, it might return a list of topics for ssi_recentTopics.
This functionality can be used to allow you to present the information in any way you wish.
Additional Guides & FAQ
Need more information on using SSI.php? Check out Using SSI.php article or the SSI FAQ.
Recent Topics Function
Code (simple mode)
<?php ssi_recentTopics(); ?>
Code (advanced mode)
<?php ssi_recentTopics($num_recent = 8, $exclude_boards = null, $include_boards = null, $output_method = 'echo'); ?>
Result
| [Chit Chat] | HTML5 Based Themes by Labradoodle-360 | Today at 08:44:33 PM |
| [SMF 2.x Support] | Social name of my current topic is showing as index by ubaidrehman | Today at 08:44:19 PM |
| [Español (Spanish)] | Error - Redirección by dazet | Today at 08:30:19 PM |
| [Modifications and Packages] | Pretty URLs 1.0RC5 - Updated for SMF 2.0 by distante | Today at 08:29:59 PM |
| [Modificaciones (Mods)] | Angry Birds en Arcade. by Geg123 | Today at 08:20:14 PM |
| [SMF 2.x Support] | Need profesional help by hcfwesker | Today at 08:17:49 PM |
| [Español (Spanish)] | Plantilla o generador de post by Muniecoo | Today at 08:13:26 PM |
| [Español (Spanish)] | Como puedo hacer esta simple modificación? by Geg123 | Today at 08:12:55 PM |
Recent Posts Function
Code
<?php ssi_recentPosts(); ?>
Result
| [Chit Chat] | Re: HTML5 Based Themes by Labradoodle-360 | Today at 08:44:33 PM |
| [SMF 2.x Support] | Re: Social name of my current topic is showing as index by ubaidrehman | Today at 08:44:19 PM |
| [Español (Spanish)] | Re: Error - Redirección by dazet | Today at 08:30:19 PM |
| [Modifications and Packages] | Re: Pretty URLs 1.0RC5 - Updated for SMF 2.0 by distante | Today at 08:29:59 PM |
| [Modificaciones (Mods)] | Angry Birds en Arcade. by Geg123 | Today at 08:20:14 PM |
| [SMF 2.x Support] | Re: Need profesional help by hcfwesker | Today at 08:17:49 PM |
| [Español (Spanish)] | Re: Plantilla o generador de post by Muniecoo | Today at 08:13:26 PM |
| [Español (Spanish)] | Re: Como puedo hacer esta simple modificación? by Geg123 | Today at 08:12:55 PM |
Top Boards Function
Shows top boards by the number of posts.
Code
<?php ssi_topBoards(); ?>
Result
| Board | Topics | Posts |
|---|---|---|
| SMF Online Manual | 0 | 780,362 |
SMF 1.x Support ![]() |
81,277 | 506,470 |
Modifications and Packages ![]() |
2,141 | 264,940 |
| Bugtracker | 0 | 232,478 |
| Srpski (Serbian) | 0 | 228,853 |
| Bosanski (Bosnian) | 0 | 192,783 |
| Hrvatski (Croatian) | 0 | 177,728 |
Türkçe Bölümü (Turkish) ![]() |
26,086 | 172,882 |
SMF 2.x Support ![]() |
25,173 | 168,917 |
Español (Spanish) ![]() |
25,815 | 156,498 |
Top Topics
Shows top topics by the number of replies or views.
Code (show by number of views)
<?php ssi_topTopicsViews(); ?>
Result
| Views | Replies | |
|---|---|---|
| nneonneo's Shoutbox | 1,440,062 | 6,074 |
| 2.0 Final has been released | 1,285,231 | 398 |
| General support topic for Aeva Media (Latest release: July 28, 2010) | 1,261,162 | 6,251 |
| SMF 1.1.14 has been released | 1,123,420 | 76 |
| Pretty URLs 1.0RC5 - Updated for SMF 2.0 | 1,047,017 | 6,514 |
| AjaxChat Integration (latest version 3.2.1) | 1,007,733 | 8,632 |
| SMF 2.0.1 and 1.1.15 critical security patches released | 1,001,330 | 175 |
| SMF Arcade | 997,442 | 4,684 |
| Ad Management mod 3.0 Released SMF 2.0 Support! | 975,913 | 6,565 |
| Simple Machines Forums attacks | 876,751 | 202 |
Code (show by number of replies)
<?php ssi_topTopicsReplies(); ?>
Result
| Views | Replies | |
|---|---|---|
| AjaxChat Integration (latest version 3.2.1) | 1,007,733 | 8,632 |
| Ad Management mod 3.0 Released SMF 2.0 Support! | 975,913 | 6,565 |
| Pretty URLs 1.0RC5 - Updated for SMF 2.0 | 1,047,017 | 6,514 |
| General support topic for Aeva Media (Latest release: July 28, 2010) | 1,261,162 | 6,251 |
| nneonneo's Shoutbox | 1,440,062 | 6,074 |
| SMF Media Gallery (SMG) - 2.0.5 is out! (December 2) | 749,808 | 5,532 |
| Aeva 6.9.99 and earlier (old) | 55,542 | 5,030 |
| Off Topic - Svaštara | 293,765 | 4,860 |
| SMF Arcade | 997,442 | 4,684 |
| SimplePortal - 2.3.4 Released! | 632,961 | 4,382 |
Top Poster Function
Shows the top poster's name and profile link.Code
<?php ssi_topPoster(); ?>
Result
Latest Member Function
Shows the latest member's name and profile link.
Code
<?php ssi_latestMember(); ?>
Result
Member of the Day
Shows one random member of the day. This changes once a day.
Code
<?php ssi_randomMember('day'); ?>
Result
Who's Online Function
This function shows who are online inside the forum.
Code
<?php ssi_whosOnline(); ?>
Result
louboutinchrisi, Storman, seattleseahawks, genindp2id, dressesinexpens, Hotman, Muniecoo, LSportal, DeviDarkL, CannedSoup, SleePy, Labradoodle-360, uggaustrslia, ubaidrehman, Dzonny, ForoGames.net, Bugo, hcfwesker, shubha, mashby, The Burglar!, mhbell, Baron1956, adthz, -Underdog-, Bigguy, NeoXII, engr_dood, Nelson123xd, Ignacioxd, FB92, salewigscorp, Hristo, Monzetti, daviloco, henny, kellyusm0hw, dazet, weddingcrystals, Arktive, holodoc, carmeet-cm, onlinebelstaff, C4G-TK, Geg123, ninja111, phonesbar, Michael Pfaff, PineWine, durubay, Ken., joanrxrtc, CASMAN, aeiou15, vanshmack
Log Online Presence
This function logs the SSI page's visitor, then shows the Who's Online list. In other words, this function shows who are online inside and outside the forum.
Code
<?php ssi_logOnline(); ?>
Result
louboutinchrisi, Storman, seattleseahawks, genindp2id, dressesinexpens, Hotman, Muniecoo, LSportal, DeviDarkL, CannedSoup, SleePy, Labradoodle-360, uggaustrslia, ubaidrehman, Dzonny, ForoGames.net, Bugo, hcfwesker, shubha, mashby, The Burglar!, mhbell, Baron1956, adthz, -Underdog-, Bigguy, NeoXII, engr_dood, Nelson123xd, Ignacioxd, FB92, salewigscorp, Hristo, Monzetti, daviloco, henny, kellyusm0hw, dazet, weddingcrystals, Arktive, holodoc, carmeet-cm, onlinebelstaff, C4G-TK, Geg123, ninja111, phonesbar, Michael Pfaff, PineWine, durubay, Ken., joanrxrtc, CASMAN, aeiou15, vanshmack
Login Function
Shows a login box only when user is not logged in.
Code
<?php ssi_login(); ?>
Result
Logout Function
Shows a logout link only when user is logged in.
Code
<?php ssi_logout(); ?>
Result
Welcome Function
Greets users or guests, also shows user's messages if logged in.
Code
<?php ssi_welcome(); ?>
Result
Today's Calendar Function
Code
<?php ssi_todaysCalendar(); ?>
Result
Today's Birthdays Function
Code
<?php ssi_todaysBirthdays(); ?>
Result
Today's Holidays Function
Code
<?php ssi_todaysHolidays(); ?>
Result
Today's Events Function
Code
<?php ssi_todaysEvents(); ?>
Result
Forum Stats
Shows some basic forum stats: total members, posts, topics, boards, etc.
Code
<?php ssi_boardStats(); ?>
Result
Total Posts: 3,084,077
Total Topics: 382,717
Total Categories: 14
Total Boards: 205
News Function
Shows random forum news.
Code
<?php ssi_news(); ?>
Result
Board News Function
Shows the latest posts from read only boards, or a specific board.
Code
<?php ssi_boardNews(); ?>
Result
Statement regarding SOPA
As some, and hopefully most, of you will know, a bill was introduced to the United States House of Representatives which is called Stop Online Piracy Act (SOPA).
Simple Machines would like to make an official stance on this bill. Whilst you may be used to us being completely neutral on many matters, such as politics, religion and many other aspects, this bill poses such a threat to the entire internet community, including possibly ourselves and yourself as end user of our software, that we figured it was time to raise awareness of the dangers and problems involved with this bill.
While we do wholeheartedly support the primary goal of SOPA, which is to protect innovators and copyright holders from infringement and piracy by malicious persons, the bill in its current form is highly dangerous towards day to day operations throughout the entire internet, even outside of the United States, and may cause innocent people and companies to be prosecuted under the United States law. People and companies may even lose their websites or get cut off from receiving funds from payment processors without due process or any discernible probable cause, as the terms on when such a block can be put in place is very vague.
Let us first tell you a little bit more about SOPA.
The bill was introduced on October 26, 2011 by representative Lamar Smith with 12 initial co-sponsors.
This bill will give the US law enforcement and copyright holders more abilities to block and stop the distribution of copyrighted material and counterfeits. (Note: related acts are PRO-IP and PROTECT IP Act)
However, the way it is handled leaves no room for proper defense.
Some of the main issues with the bill are:
- Threat to online businesses
- Direct threat towards Web hosting companies
- General negative effects to DNSSEC, DNS and internet security in its entirety
- Threat to online freedom of speech, the bill will make censorship very easy
- Destroying of the safe harbors in the current DMCA laws
- Potential criminalization of users uploading content (including jail time!)
- Threat to Open Source software
- Providers can be forced to deploy deep packet inspection to directly target users, which violates user privacy
- Providers can be forced to block internet access completely to individuals
- Search engines will be censored
- Payment providers can be forced to block funding to individuals without a legal process or having to check safe harbors
- DNS systems in the US can be forced to block your access to certain websites, you no longer have the rights to choose what you visit, regardless of whether a site is legal or not!
TL;DR: it will cripple the internet, free speech and free choice throughout the world.
This bill will change the fundamentals of the internet completely. Legal processes that would usually be required to get far reaching measures set in place towards malicious users can effectively be bypassed by SOPA, which means that completely legit users may also be attacked, simply because the SOPA bill has such a broad language inside of it that it can be interpreted in many ways and it leaves no room for payment processors, DNS providers and (hosting) providers to see what is true or false: they have no choice but to oblige. Why? Because when they cooperate voluntarily, they will be immune from persecution. If they do not cooperate because it is unclear: they can be held liable.
You do not have the power to "act in good faith" with SOPA, such as required in the current notice and takedown system of DMCA, primarily due to SOPA's broad language. The bill will allow corporations and the government more power over free speech and provide completely new methods of effectively starting internet censorship for whatever it is they see not fit as being on the internet. (Basically, what a corporation could see as slander, but free speech to the user, could lead to a request for blocks from payment processors and providers by the corporation which will have to be honored within a matter of days.)
Because there are no more safe harbors such as with the current DMCA system, third party and user-generated content providers (such as Youtube, Facebook, Twitter, Google, online communities like our own, and even the SMF websites that you create and use!) will be the ones liable and thus undermines the current legal structures that have allowed some internet platforms to evolve.
Again, let me make it clear that the proposed goal, to protect owners of content (copyright holders) against infringement and piracy, is a very good goal. However, SOPA itself contains many errors that will cause major problems to the functioning on the internet, it will threaten internet service providers and it can be a threat to all of you: the end users of the internet.
For example, your website can be shutdown solely for giving a negative opinion on something, as little as ONE user posting a link to copyrighted content or actually uploading it to your website. Next to that, YOU will run in to big trouble.
This is also why giant internet tech companies such as Google, Yahoo, Facebook, AOL, Ebay, Amazon, etc. are taking a hard stand against SOPA and are even threatening to blackout for a extended period of time to show the world what could happen if SOPA passes.
Please consider all of this well and try to understand the major negative impact this bill will have on the entire internet and especially to potentially innocent users and companies whom merely wish to use their right on Free Speech.
Make a stand against SOPA now! Contact your local Congressional representative, or if you are outside the US, sign petitions that request your government to make a firm stand against SOPA. After all, this can negatively effect all business and individuals all over the world.
For more information, please visit the following links:
https://www.eff.org/deeplinks/2011/10/sopa-hollywood-finally-gets-chance-break-internet
http://americancensorship.org/
http://savehosting.org/
http://en.wikipedia.org/wiki/Stop_Online_Piracy_Act
http://en.wikipedia.org/wiki/Stop_Online_Piracy_Act#Arguments_against
http://en.wikipedia.org/wiki/PROTECT_IP_Act
To join in, read americancensorship.org and see how you can get involved. You may also wish to 'censor' your website.
As part of the protest against SOPA, Simple Machines has decided to move all our domain names away from GoDaddy on a short notice, which is to say: as soon as possible. While we have done flawless business with GoDaddy to handle our domain registration for multiple years, their recent behavior in supporting SOPA, a law that if passed will be in direct conflict with the interests of their clients, is completely unacceptable and we do not feel like we can trust them to handle in our interests any longer. We are aware that GoDaddy suddenly, in response to the major amount of negative messages and many people leaving them, changed their point of view and "dropped" support for the act, such a change can occur again without problems when their larger clients do seem to enjoy the bill. Hence, the trust is gone and we will move.
Thank you for your due consideration and helping put a halt to the enrollment of this bill!
We sincerely hope that you will do all you can to attempt to stop this bill from ever passing Congress!
Thank you.
- Simple Machines Board of Directors
- Simple Machines Members
SMF 2.0.2 and 1.1.16 critical security patches released
Simple Machines Forum project has released SMF 1.1.16 and SMF 2.0.2 security patches for the SMF community.
Critical security issues have been identified and fixed with this patch, therefore it is highly recommended to make sure you update your forums immediately.
A few bug fixes for SMF 2.0.x are also available with the patch.
If you use 2.0.1, you can update your forum to 2.0.2. using package manager. You should see the notification in Admin panel, allowing you to download and install seamlessly. If you don't have a notification about the update, please run the scheduled task "Fetch Simple Machines files".
You can also download the patch for 2.0.1 from the customize site: smf_2.0.2 patch, and install it through package manager.
If you use 1.1.15, you can update to 1.1.16 with the smf_1.0.22_1.1.16 patch, also using package manager.
If you use older versions of SMF, you can upgrade with the full upgrade packages from the downloads page.
Please find the changelog for the latest release as usual, on the downloads page as well:
http://download.simplemachines.org/
Please do not use this topic for support requests. You will get a much quicker and better response by posting in the relevant support board!
Regards,
Simple Machines Forum project
We're on Google+

http://gplus.to/SimpleMachinesForum
Server maintenance
We have planned required maintenance to our server infrastructure.
This maintenance causes us to have downtime several times, both short and a bit longer in time.
(Exact timeframe cannot be predicted)
We will of course do our utmost best to keep the interruptions as short as possible.
The maintenance is scheduled to start at:
Sunday, October 30 2011.
The first maintenance session will most likely be the one causing the longest interruption.
Other dates will be released when they are planned.
For more information, please see all details about this maintenance in the Team Blog article:
http://www.simplemachines.org/community/index.php?topic=457092
To be able to receive quick updates regarding the progress and status, please:
Follow us on Twitter
Add us on Facebook
If you require urgent support when our community is down, please visit our backup forum. Make sure to bookmark it!!
http://www.simplemachinesforum.org/
Please do not open support topics there unless it is really urgent and cant wait a few hours.
Thank you

Regards,
- Servers Team
Simple Machines
Simple Machines Forums attacks
Lately, a number of forums have reported experiencing ongoing attacks by malicious users repeatedly hitting their pages, especially the login pages. There seem to be several different types of attacks ongoing, and SMF forums are not the only sites being attacked.
How to better protect your forum
If you're on SMF 2.0 RC4 or earlier version, you might have also reports of members being logged out when they shouldn't have been. This is a result of the bots trying a large number of random passwords for member accounts. If you have this problem, please install the SMF 2.0 RC4 Security Patch or upgrade to SMF 2.0 RC5 to fix this behavior. On a number of forums, bots attack the login pages, trying random passwords for your member accounts. If you see many more than the usual number of "invalid password" errors in your forum error log than usual, then it seems your forum may be experiencing one of these attacks. On other forums, you may see more requests to to action=login2 in your webserver error log, than you see "invalid passwords" in the SMF error log. If you see this, please let us know here, or feel free to contact me at norv@simplemachines.org.
Set the password strength to high in your Admin panel:
Security and Moderation > Required strength for user passwords.
Use strong passwords for your accounts, do not reuse your password at multiple sites. Advise your members to follow these rules, too. A strong password has 8 or more characters, is not a dictionary word or common, easily-guessed combination of characters.
Additional protection for your members accounts
We have verified that several forums have gotten very good protection from these attacks by using httpBL or a forum spam stop mod combined with a Tor blocker.
1. Switch to email login instead of username
cb|Emailogin
Because it requires members to use a secret value (their email address) to login, it helps protect your member accounts from being attacked by bots. This option may not be appropriate for all forums. It can be inconvenient on big boards. You know best if it is suitable for your forum or not.
2. Add verification to the login page
Login verification
This mod enhances the login page, by adding security verification, just as can be done during registration. We strongly recommend to use custom questions, rather than Captcha. Questions that a human would answer easily, but a bot could not guess work well. Once you install it, the settings in your forum admin panel
Security and Moderation > Anti-Spam:
> Require verification on registration and login pages
> Visual verification image to display
> Number of verification questions user must answer
> Verification Questions
will be applied to both registration and login pages.
In addition, the mod enhances logging in your SMF error log.
3. Blacklist IPs with a configurable number of attempts failures
Login Security
Please see the mod's readme for the added features that it provides. This may cause problems for members who receive dynamic IPs from their ISPs, but it may help. You decide if this is a good choice for your forum.
Protect your forum from the attacking IPs
4. Install anti-spam mods
For example, httpBL is an implementation of the Project Honeypot API. The project gathers reports about suspicious activities of IPs and the mod uses their online database to block the blacklisted IPs before doing anything on your forum. Since the project Honeypot seems to verify the reports from more sources before blacklisting IPs, their database has a good chance to be accurate.
There are many other mods fighting spammers, please see the Customize site.
5. Temporarily block access to your forum through Tor
These mods have been tested and should work. The first has been more thouroughly tested.
Tor Blocker
Tor access
The Tor service simply provides a proxy to users all over the world, and there is nothing wrong with that. Unfortunately, these days it has been heavily used by malicious users. Evidence of this use has shown up on quite a number of forums we have checked.
Other enhancements
Targeted at login bots:
Login detector mod. It works perfectly fine on many forums preventing successfully the invalid bot login attempts.
Helpful mods on these and related problems:
Bad Behavior mod, targeting spam and other malicious attempts against your site.
Forum Firewall, targeting a wide range of possible attempts to the security of your site.
We are monitoring a number of forums and working on enhancing the options presented above and more options. Please try what you think is appropriate for your forum. Search this forum for problems similar to yours, to find out how other forum owners have solved them. Please let us know what works for you.
For support on any the mods listed above, please use the appropriate mod support thread.
Recent Attachments Function
Code
<?php ssi_recentAttachments(); ?>
Result
| File | Posted by | Downloads | Filesize |
|---|---|---|---|
| SleePy | 41 | 1.53kB | |
| Norv | 3727 | 1.21kB | |
| noex | 888 | 3.5kB | |
| noex | 720 | 44.01kB | |
| MrPM | 705 | 26.22kB | |
| Neakro | 652 | 3.25kB | |
| mediman | 1147 | 36.04kB | |
| ディン1031 | 1826 | 3.47kB | |
| noex | 758 | 9.88kB | |
| noex | 1266 | 16.14kB |
Show Single Poll
Shows a poll in the specified topic.
Code
<?php ssi_showPoll($topicID); ?>
Result
Show Single Post
Fetches a post with a particular IDs. By default will only show if you have permission to the see the board in question. This can be overriden by passing the 2nd parameter as true.
Code
<?php ssi_fetchPosts($postIDs, $isOverride); ?>
Result
Show Single Member
Shows the specified member's name and profile link.
Code
<?php ssi_fetchMember($memberIDs); ?>
Result
Show Group Members
Shows all members in a specified group.
Code
<?php ssi_fetchGroupMembers($groupIDs); ?>
Result
Home Page Sample
This sample uses the following features: ssi_recentTopics(), ssi_logOnline(), ssi_welcome(), and ssi_boardNews(). ssi_recentTopics() is fetched using the array method, to allow further customizations on the output.Code
<?php require("SSI.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SSI.php example for home page</title>
<style type="text/css">
body { font-family: Arial, Tahoma, sans-serif; font-size: 80%; background: #DFDFDF; color: #FFFFFF; margin: 0 }
ul,ol { padding-left: 19px; margin: 0; }
li { font-size: 11px; }
h1,h2,h3 { margin: 0; padding: 0; }
h3 { font-size: 15px; }
a:link,a:visited { color: #FF9000; text-decoration: none; }
a:hover { text-decoration: underline; }
#container { background: #52514E; width: 100%; border: 1px solid midnightblue; line-height: 150%; margin: 0; }
#header,#footer { color: lightgray; background-color: #2A2825; clear: both; padding: .5em; }
#leftbar { background: #DF7E00; float: left; width: 160px; margin: 0; padding: 1em; }
#leftbar a { color: #000000; text-decoration: underline; }
#content { margin-left: 190px; padding: 1em; }
#navigation { float: right; }
#navigation a:link,#navigation a:visited { color: #FF9000; }
</style>
</head>
<body>
<div id="container">
<div id="header">
<div id="navigation">
<a href="#">Link</a> | <a href="#">Link</a> | <a href="#">Link</a> | <a href="#">Link</a> | <a href="#">Link</a>
</div>
<h1 class="header">YourWebsite.com</h1>
</div>
<div id="leftbar">
<h3>Recent Forum Topics</h3>
<ul>
<?php
// Using array method to show shorter display style.
$topics = ssi_recentTopics(8, null, null, 'array');
foreach ($topics as $topic)
{
// Uncomment the following code to get a listing of array elements that SMF provides for this function.
// echo '<pre>', print_r($topic), '</pre>';
echo '
<li><a href=\"', $topic['href'], '\">', $topic['subject'], '</a> ', $txt['by'], ' ', $topics[$i]['poster']['link'], '</li>';
}
unset($topics);
?>
</ul><br />
<h3>Online Users</h3>
<?php ssi_logOnline(); ?>
</div>
<div id="content">
<?php ssi_welcome(); ?><br /><br />
<h2>News</h2>
<?php ssi_boardNews(); ?>
</div>
<div id="footer">
<a target="_blank" rel="license" href="http://creativecommons.org/licenses/publicdomain/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/publicdomain/88x31.png" /></a>
This sample website layout is dedicated to the <a target="_blank" rel="license" href="http://creativecommons.org/licenses/publicdomain/">Public Domain</a>.
</div>
</div>
</body>
</html>
