Category: Software
A phpBB 3 iPhone Style Theme With Option to Disable
A forum that I am an adminstrator for has been clamoring for an iPhone theme (style) for a long time now. In the past, I hadn’t seen any usable iPhone template for phpBB3, until now.
The theme is hosted on Google code and is named phpbb-iphone-style. It is downloadable here and was last updated June 18th, as of today.
The theme works wonderfully on the iPhone. However, the issue that I ran into is automatically displaying it for mobile browsers, such as the iPhone, Android and other platforms.
Fortunately there is a modification you can make to the phpbb code which is effectively a theme switcher for mobile browsers. The how to is located within the download file for the theme above.
What if a user wants to turn off the mobile style?
I modified the code to allow a user to set an option on their profile to permentently disable the theme when logged in on a mobile browser.
First, install the style as described above. As part of the switcher, you need to find out the theme ID. You can do so, after installing the style, by hovering over the ‘Detail’ tab in the ACP (Administrator Control Panel) and looking for the ‘id’ variable. In the example below it is ’6′.
Once the theme is installed, move over to the “Users and Groups” tab, and then the “Custom Profile Fields” area. At the bottom of this page there is a box to add a new profile field. Type ‘disable_mobile’ as the name, and Boolean (Yes/No) as the type and click add.
For the options, I selected:
- Publicly display profile field: No
- Display in user control panel: Checked
- Display on registration screen: Unchecked
- Display on viewtopic screen: Unchecked
- Required field: Unchecked
- Hide profile field: Unchecked
- Field name/title presented to the user: Disable Mobile Browser
- Field description: When viewing on a mobile device (iPhone, Android, etc), clicking ‘yes’ will disable the mobile browser.
- Entries: First option: Yes, Second option: No
On the second screen select the following items:
- Field type: Radio Buttons
- Default value: no
Save your custom profile field.
It will end up looking like this in the profile control panel of the end user:

Now the fun part, adding the code to your install to select which mobile browser to use automatically.
Back up, then open install dir/includes/session.php
Around line 1468 in the function setup
1468 1469 1470 1471 1472 | /** * Setup basic user-specific items (style, language, ...) */ function setup($lang_set = false, $style = false) { |
Replace
1 | global $db, $template, $config, $auth, $phpEx, $phpbb_root_path, $cache; |
with
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | global $db, $template, $config, $auth, $phpEx, $phpbb_root_path, $cache, $user; //-----Begin phone detection & redirection code----- $user->get_profile_fields( $user->data['user_id'] ); $user_fields = $user->profile_fields; // if (!($user_fields['pf_disable_mobile'] == 1)) { // Thanks to Chris Dembek for this code fix if (isset($user_fields['pf_disable_mobile']) && !($user_fields['pf_disable_mobile'] == 1)) //id of the iphone/mobile theme - SELECT THIS FROM YOUR STYLES $mobilestyleid = 6; //Fetch the users browser $user_browser = strtolower($this->browser); //List of mobile user-agent keywords $browsers_array = array('240x320', '320x240','blackberry', 'iemobile', 'minimobile', 'mobile', 'opera mini', 'pda', 'phone', 'pocket', 'psp', 'symbian', 't-shark', 'wireless'); //Check for the user-agent in the list of mobile user-agents foreach ($browsers_array as $ua_match) { if (strpos($user_browser, $ua_match) !== false) { //a match $style = $mobilestyleid; $this->data['is_mobile'] = true; break; } } } //-----End phone detection/redirection code----- |
Make sure to replace $mobilestyleid = 6 with your style id number!
Save your file. Test out the modifications on your phone, you should be presented with the mobile version on reload (make sure to purge any cache if you don’t see it right away).
Finally go into your profile and select the ‘disable mobile browser’ option and make sure it reverts back to your regular default theme.
Let me know if you have any problems implementing this but it has worked great for this phpbb forum!
HBO GO Online Streaming Video Review and Screenshots
HBO GO has been in the works for a while now, and is an indication of what some networks are trying to do to add value to their subscription rate. Offering video for streaming online is definitely a benefit to a premium channel like HBO. And it is a glimpse as to what the future of online video will hold.

I recently got rid of my cable box and implemented a do-it-yourself solution. Since HBO is a premium channel and encrypted, they force you to either buy a cable box via subscription or also a cable-card (which they also charge for). This actually gives me a unique perspective on the service: would I pay for HBO to receive the HBO GO online only offering? Read more…
UbunTOS – Ubuntu 9.10 + TinyOS 2.x VirtualBox Image
This is my admittedly minor but I hope useful contribution to the TinyOS development community. TinyOS is an Operating System and development framework for Wireless Sensor Networks and other platforms which has a small footprint and is very energy conscious.
The TinyOS source code is available for free online for many operating systems, however it takes a long time to get the environment set up and it is not portable at all. I came across XubunTOS but it did not seem to be in active development anymore, so I endeavored to install TinyOS 2.1 and 2.x from source into a regular Ubuntu image. The most help came from Matt Keally’s Blog. While doing this, I thought it might be useful to many others who wish to develop in the TinyOS framework but might not have the skills necessary to install it. Therefore, I developed this VirtualBox image so that you can install it on any system for which VirtualBox is available and supports USB passthrough for the programming of the motes. I’ve tested on Windows 7, Windows XP and it should work on any other host OS, but I would love to hear your feedback. All funny business aside, I present to the world UbunTOS: Read more…
Replacing the Cable Box – Boxee and Live HD TV with the Acer Revo 3610
Gone is my 500+ channel television subscription along with the required boxes necessary to decode all of that content. The DVR, which has been a mainstay of my family’s television viewing habits, has been ousted. In it’s place is a kick-ass system that keeps the DVR functionality for many of the TV shows that we usually watch, brings in much new content, and also saves me a few bucks each month.
Let’s face it, you don’t want all of the content that your cable provider offers. Cable providers have fought a-la-carte programming tooth and nail for this very reason. Much of it is specialty programming, and though I admit it is nice to know it was there, my family and I rarely watched any of it. My new setup brings many new sources as well as a CHOICE to what you want to view. I am very happy with the results so far. Read more…
Operation Replace Cable Programming and HD DVR Box – Part 1 – The Plan
I’ve decided to replace my cable plan and DVR box with something a little more… functional.
Sure we get a ton of channels from Verizon FiOS, but we hardly ever watch them. Our television viewing habits mainly consist of a few programs that my wife watches and a few programs that I watch, but we almost never watch them live. We typically DVR them and then watch them on our own time. For the few instances where we would like to watch live TV, for example when a Penn State game is on, we would like to be able to watch that. Normally the games are on ABC/NBC/Fox so premium cable channels such as ESPN aren’t necessarily needed. There will be some instances where a game may only be available on the Big 10 network or some other premium channel, but honestly I am not that big into sports and the times that this might occur will be few and far between, maybe 1 or 2 times a year, which I can deal with. Read more…
Tweaking TCP for Fast (100mbps+) Connections and Transfers on Linux
We recently did some speed testing on a few of the servers on our network, and we were not receiving the speeds expected considering they were sitting on a physical 100mbps ethernet port. The servers were indeed on physical 100mbps connection, however wget (TCP/IP, HTTP Port 80) download tests showed only a max of about 1.5MB/sec (note the 8bit/byte conversion, so this translates to about 12mbits).
This is due to how TCP frames data packets and optimizes them for connections. I believe by default TCP on most systems assumes about a 10mbit max capable transfer rate, so it does not show performance gains on a larger pipe without modification to the kernel options which govern TCP/IP frame size and features. Some distributions may make this change for you automatically however many will not.
To keep things short and sweet, we took the following advice from Speedguide.net on tweaking TCP parameters on linux kernel systems. This will cover Linux 2.1 and above – which means CentOS, RedHat, Ubuntu, Debian and many more distributions.
The TCP Parameters we will change are:
- /proc/sys/net/core/rmem_max - Maximum TCP Receive Window
- /proc/sys/net/core/wmem_max – Maximum TCP Send Window
- /proc/sys/net/ipv4/tcp_timestamps - (RFC 1323) timestamps add 12 bytes to the TCP header…
- /proc/sys/net/ipv4/tcp_sack – tcp selective acknowledgements.
- /proc/sys/net/ipv4/tcp_window_scaling – support for large TCP Windows (RFC 1323). Needs to be set to 1 if the Max TCP Window is over 65535.
If you recall /proc/ is the volatile portion of kernel configuration, you can change it on the fly but it will be reset on reboot unless settings are changed via an init file or setting the options in /etc/sysctl.conf. To change the settings once (to test):
echo 256960 > /proc/sys/net/core/rmem_default echo 256960 > /proc/sys/net/core/rmem_max echo 256960 > /proc/sys/net/core/wmem_default echo 256960 > /proc/sys/net/core/wmem_max echo 0 > /proc/sys/net/ipv4/tcp_timestamps echo 1 > /proc/sys/net/ipv4/tcp_sack echo 1 > /proc/sys/net/ipv4/tcp_window_scaling
And to apply them for good, add the following lines to /etc/sysctl.conf:
net.core.rmem_default = 256960 net.core.rmem_max = 256960 net.core.wmem_default = 256960 net.core.wmem_max = 256960 net.ipv4.tcp_timestamps = 0 net.ipv4.tcp_sack = 1 net.ipv4.tcp_window_scaling = 1
Use ‘sysctl -p’ to apply the changes in this file to your running Linux instance. Feel free to experiment with these numbers to see how they impact your transfers, it depends a lot on how many and how large the files are that you transferring. These changes must be made on the SERVER side, any change on the client side would not impact the download speed from the server.
There are several other variables to consider, and these all depend on your application so change them if you know what you are attempting to do. After changing these settings, you will see speeds of about 10MB/sec (80mbps) on a 100mbps connection. The other 20mbps are lost in TCP and other network layer overhead, which is unavoidable.
How To Reset Windows XP, Vista, Windows 7 Passwords with Ubuntu 9.10 Live Image and a USB Drive
I put this together for a project in a class I am taking, and thought it would be handy for others as well. The goal is to access a Windows filesystem and reset the password for a user, for example if someone forgot the Administrator password or the account is locked out from too many bad password login attempts. This works on all modern Windows Operating Systems: Windows 2000, 2003, XP, Vista, Win7 etc. Make sure to create a backup if you want to make sure you don’t corrupt your Windows install, as it can happen.
Tools used:
- Unetbootin
- Ubuntu 9.10 Desktop ISO
- One flash drive, 1 gig or larger
- chntpw
Accessing the Filesystem
First we use unetbootin to install Ubuntu 9.10 to a flash drive. The flash drive needs to be at least 1GB to install the image.
Select “Diskimage” and then the .iso file we downloaded of the Ubuntu 9.10 image.
Select the USB Drive and Drive Letter to install the ISO onto. Click OK:
Once the program is done, click ‘exit’ and remove the USB Drive. You now have a bootable live image of Ubuntu 9.10.
Plug the usb drive into the target system. Boot off of the drive, you may need to change the boot options in the BIOS if it is set to boot off of the hard drive. Select “Default” in the unetbootin boot menu to boot into the Ubuntu OS. It will automatically log you in.
Once booted you already have access to the Windows filesystem since the ntfs filesystem driver is included in the kernel. This is nice and wasn’t the case not too long ago.
We chose two reasons to use unetbootin and Ubuntu 9.10. The first is the ease of use of installing a bootable image. After downloading the two packages, it is trivial to load the OS onto the drive, and since it includes ntfs drivers it allows us to access the unencrypted hard drive on boot. Since it is on a USB drive, any system made since 2000 or so should be able to boot this. You don’t need to lug around a CD or even access the CD drive.
To prevent easy access to the hard drive, encryption of the hard drive partition would be necessary using Microsoft EFS or TrueCrypt hard drive encryption software. After encrypting the hard drive, any live operating system running would not be able to decrypt the hard drive easily.
Furthermore, installation of a BIOS level password would ensure that any unauthorized users would not be able to boot alternative operating systems via USB, CDROM, Floppy or other method. The only way to defeat a BIOS level password would be to reset the BIOS (requiring entrance into the hardware of the system) or using an Evil Maid style attack.
The Evil Maid attack is performed by a theoretical malicious party that has access to the target PC without alerting the legitimate user. Without knowledge of the authorized; a root kit or device would be installed (for example, on the USB connector of the keyboard) to sniff out the password as entered on bootup. After the user boots the system and finishes her work, ostensibly shutting down the system securely, at least to her knowledge, the Evil Maid would then collect the password entered into the BIOS, thereby defeating the BIOS password security measure.
Resetting the Password
We can now reset the Administrator or any other password on this system using the tool chntpw. To install this package, ensure the system has a connection to the internet (via dhcp perhaps?) and run the command:
sudo software-properties-gtk --enable-component=universe --enable-component=multiverse; sudo apt-get update; sudo apt-get install chntpw
Alternatively, you can download the executable and place it on the USB drive to give access without connecting to the internet. chntpw is the software that modifies the SAM (Security Accounts Manager) database file. Use the terminal to change directories to the password file
cd /media/path/to/disk/WINDOWS/system32/config/
Then execute the chntpw utility:
# sudo chntpw -u username SAM SYSTEM
View the sample output:
ubuntu@ubuntu:/media/B830C9BC30C981BC/WINDOWS/system32/config$ sudo chntpw SAM SECURITY chntpw version 0.99.5 070923 (decade), (c) Petter N Hagen Hive <SAM> name (from header): <\SystemRoot\System32\Config\SAM> ROOT KEY at offset: 0x001020 * Subkey indexing type is: 666c <lf> Page at 0x7000 is not 'hbin', assuming file contains garbage at end File size 262144 [40000] bytes, containing 6 pages (+ 1 headerpage) Used for data: 255/20736 blocks/bytes, unused: 9/3648 blocks/bytes. Hive <SECURITY> name (from header): <emRoot\System32\Config\SECURITY> ROOT KEY at offset: 0x001020 * Subkey indexing type is: 666c <lf> Page at 0xe000 is not 'hbin', assuming file contains garbage at end File size 262144 [40000] bytes, containing 13 pages (+ 1 headerpage) Used for data: 1074/49024 blocks/bytes, unused: 9/3808 blocks/bytes. * SAM policy limits: Failed logins before lockout is: 0 Minimum password length : 0 Password history count : 0 | RID -|---------- Username ------------| Admin? |- Lock? --| | 01f4 | Administrator | ADMIN | dis/lock | | 03ec | ASPNET | | dis/lock | | 03ed | CSC603 | ADMIN | dis/lock | | 01f5 | Guest | | dis/lock | | 03e8 | HelpAssistant | | dis/lock | ---------------------> SYSKEY CHECK <----------------------- SYSTEM SecureBoot : -1 -> Not Set (not installed, good!) SAM Account\F : 1 -> key-in-registry SECURITY PolSecretEncryptionKey: 1 -> key-in-registry ***************** SYSKEY IS ENABLED! ************** This installation very likely has the syskey passwordhash-obfuscator installed It's currently in mode = -1, Unknown-mode SYSKEY is on! However, DO NOT DISABLE IT UNLESS YOU HAVE TO! This program can change passwords even if syskey is on, however if you have lost the key-floppy or passphrase you can turn it off, but please read the docs first!!! ** IF YOU DON'T KNOW WHAT SYSKEY IS YOU DO NOT NEED TO SWITCH IT OFF!** NOTE: On WINDOWS 2000 it will not be possible to turn it on again! (and other problems may also show..) NOTE: Disabling syskey will invalidate ALL passwords, requiring them to be reset. You should at least reset the administrator password using this program, then the rest ought to be done from NT. Do you really wish to disable SYSKEY? (y/n) [n] RID : 0500 [01f4] Username: Administrator fullname: comment : Built-in account for administering the computer/domain homedir : User is member of 1 groups: 00000220 = Administrators (which has 2 members) Account bits: 0x0210 = [ ] Disabled | [ ] Homedir req. | [ ] Passwd not req. | [ ] Temp. duplicate | [X] Normal account | [ ] NMS account | [ ] Domain trust ac | [ ] Wks trust act. | [ ] Srv trust act | [X] Pwd don't expir | [ ] Auto lockout | [ ] (unknown 0x08) | [ ] (unknown 0x10) | [ ] (unknown 0x20) | [ ] (unknown 0x40) | Failed login count: 1, while max tries is: 0 Total login count: 1 - - - - User Edit Menu: 1 - Clear (blank) user password 2 - Edit (set new) user password (careful with this on XP or Vista) 3 - Promote user (make user an administrator) 4 - Unlock and enable user account [probably locked now] q - Quit editing user, back to user select Select: [q] >
Depending on the status of the SYSKEY password security, you may only be able to blank the password and not actually change it. I recommend blanking the password and then resetting it once you log into the system.
You can also unlock a system if the user accounts have all been locked out due to too many login attempts or any other reason. Using these tools you can gain access to almost any unencrypted Windows system, from Windows NT up to Windows 7.
As a warning, If there is data on the hard drive you wish to keep, make sure to make a backup of the hard drive before performing this password as it can corrupt the Windows installation.




Recent Comments