Our minds cannot repel logic of that magnitude!
PHP
Long Awaited Release of the WordPress-SMF Bridge 0.2!
Nov 23rd
For those of you using this plugin, the long-awaited 0.2 release has been made today. It has only been tested in a development environment and may have bugs. For anybody wishing to report bugs do not do it here! Instead, please go to the Google Code page (http://code.google.com/p/wp-smf-bridge) and do so there. My response to questions here will be severely delayed. Please use Google Code and the Google Group created for this plugin. Thank you all for your support!
WP-SMF-Bridge is a simple user registration and logon bridge between WordPress and Simple Machine Forum. To get this working, it is highly recommended that you have a fresh, unmodified install of SMF 1.1 or higher installed and running. To install the plugin, either use WordPress’ built-in plugin installation features, or visit the Google Code page for more information.
WordPress Plugin: WP-SMF Bridge
Mar 23rd
So I finally got off my lazy butt and at least released one of my projects – my very own WordPress and Simple Machine Forum user registration and login bridge. I just committed the first round of code to the WordPress plugins SVN repository, tagged the first release, and it should show up in the WordPress plugins list any minute now. For those of you who use the plugin, want to contribute, need help, or want to let me know of some bugs – feel free to visit the website, which is conveniently a Redmine project page, here. Don’t go peeking around this WordPress blog trying to find it in action, though, because it isn’t here. It’s actually going to be used for a different WordPress website I’m putting up to manage LAN parties I plan on having in my new houses’ garage – provided we ever close on it, but that’s a different story.
Using expect to execute SSH commands in PHP
Apr 4th
Okay, so let’s say you want one of your PHP scripts to do something that PHP doesn’t necessarially have access to do – such as removing a file owned by you when PHP runs as nobody. Well, instead of poking a ton of holes in your server’s configuration and leaving yourself wide open to a bunch of exploits and attacks, why not just have the PHP script log in as you to localhost via SSH and then do what you desire? Sounds great, huh? Yeah, sure, PHP has built-in SSH2 functions – but what if you don’t have access to add the extension to your server’s configuration? Simple! Use the built-in PHP function exec and the command-line program expect! As in the example below, we let expect spawn up ssh, let it tell ssh that we accept the host verification crap (remove that if you need to), let it pass the password, and then echo out the result of the command. In this case, the command is ls ~/.
exec("echo 'spawn ssh username@localhost ls ~/; expect \"(yes/no)?\"; sleep 1; send \"yes\\r\"; expect \"password:\"; sleep 1; send \"password\\r\"; expect eof;' | expect",$str); foreach ($str as $strstr) { print_r($strstr); echo "\n\r"; }
Now obviously you do not need to echo out the results if you don’t care. That part is just in this example just so you can see how it works. If you’re doing something like removing a file, you can just run the exec command and then use the built-in PHP functions to check to see if the file was actually removed. Perty nifty, huh?
