teh interwebz
RSS icon Home icon
  • phpBB admin password manual reset

    Posted on March 31st, 2009 Josh Highland No comments

    phpbb_logo

    Today I ran into a situation where I had forgotten the password to my development instance of phpBB 3. I was stuck in a situation were I needed to reset the password. I had full admin access to the database, so changing it there wouldn’t be the problem. The real problem is that phpBB uses its own password hashing, not MD5.

    In a work around, I created a new user and used the password “123456″ looking at the database , in the users table of the phpBB install. I saw the “user_password” field was “e10adc3949ba59abbe56e057f20f883e”.

    I then changed my admin accounts user to the same string, “e10adc3949ba59abbe56e057f20f883e”.

    phpbbpasswordreset

    I went to the phpBB login screen, fillled out my username, and entered the password “123456″… BINGO! it worked.

    So to save you the work. You can follow what I did or just use these hashes to reset your own password:

    Hash: e10adc3949ba59abbe56e057f20f883e
    Password: 123456

    Hash: $H$9Ae3Uk.ECdWW5ya13M4ErWhr4c.761/
    Password: password

    I hope this helps someone else out there.

  • Modifying MimboPro to Add Paged Navigation To Category Pages

    Posted on December 8th, 2008 Josh Highland 3 comments

    Recently I have been doing a lot of work with Wordpress. I love Wordpress. one of the things I like most about Wordpress is the plugins and themes.

    I recently bought a copy of the MimboPro theme. Mimbo is clean and very professional. More of a CMS theme then a blogging theme, prefect for what I want to use it for.

    As I dug into MimboPro and Wordpress, I realized something strange, the MimboPro theme doesn’t support paging in a category view. What this means is EVERY SINGLE post you make is shown on one page. If you have a very active site, like the one I’m working on, this quickly gets out of hand. Look at this image and you will see what I mean (click for full version).

    One of the reasons I like MimboPro was the support that the authors of the theme offer. I headed over to their message forums and found other people like me asking for the Additon of Paged Navigation To Category Pages. The original post was 8 months ago, and no one had resolved anything. I made a post to the MimboPro authors only to be told that there is going to be a new theme that will handle this and it will be available at a deep discount to MimboPro owner. This upset me a bit, so taking matters into my own hand, I fixed what Mimbo wont, and I am handing out my own patch to solve this issue. Below are the instructions to hack your own files, or you can just download my zip file with the pre-hacked files.

    Pre-Hacked Files:
    Download with pre-hacked files: JoshHighlands_MimboPro_CategoryPagingHack.zip

    DIY INSTRUCTIONS (click images for full sizes):

    1. Save a copy of your current categories.php and styles.css files inside of the MimboPro theme directory to a safe location
    2. Open up categories.php inside of the MimboPro theme directory, and find line 17
    3. Comment line 17 with a double back slash (//)
    4. Go to line 87 of category.php and add the following code
    5. Save and close category.php
    6. Open up style.css inside of the MimboPro theme directory
    7. Add the following CSS code to the bottom of the file (should be close to line 852)
    8. Save styles.css
    9. Upload categories.php and styles.css to the MimboPro theme directory on your server
    10. Everything should be working. Here is what my wordpress running MimboPro looks like

    That’s it! MimboPro will now have paging in all of the categories. The next and previous links will only show up when you have enough posts. The Wordpress default is 10 posts. You can edit the number of posts by going to change the number of posts to show on a category page, go into to the admin and under “setting” > “reading” you will find the option, as highlighted here.

    If you had any problem reading the code in the image files, download the zip files with the pre-hacked files in them.

    Download with pre-hacked files: JoshHighlands_MimboPro_CategoryPagingHack.zip

    If you have any further questions, please post them in the comment.

  • WordPress 2.7 is almost here!

    Posted on December 3rd, 2008 Josh Highland 2 comments

    OMG OMG OMG! WordPress 2.7 is almost here. Here is a long list of the changes that are going to be in the latest release. I have been a huge wordpress fan for some years now. Its always treated me well. Its treated me so well that I have decided to move my main website, notPopular.com, to the wordpress platform for content management. I’m really nervous though, I have done a lot of custom work on the notpop install of wordpress, and it isnt released yet. I hope that my plugins and custom code doesnt break to badly. I will have a full review of wordpress 2.7 once it is released later this week.

  • How I do layouts and views in CodeIgniter

    Posted on November 9th, 2008 Josh Highland 2 comments

    I have been a loyal fan of the kick-ass php framework, codeIgniter, for some time now. A while back I made a post on how to improve the view handling of codeIgniter. I would like to retract that post. Through the comments on that post I found out about an undocumented parameter (as of version 1.7, it has been documented) that allows view to be rendered into a variable. This changes everything, and totally negates any of the complaint I had about how CI handles layouts and views.

    Below is an example of live code I have running at loudson.gs. It shows how I have been able to take advantage of of this powerful third parameter that stops CI from rendering a view to the screen when loading it.

    &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
    Inside of my controller

    function index()
    {
    $base_url = base_url();

    //what the nav needs
    $navigation_data['navTab'] = “home”;

    //basic info for the header
    $layout_data['pageTitle'] = “LoudSon.gs”;
    $layout_data['meta_description'] = “Under Ground Lyrics, hardcore, metal, emo, rock”;
    $layout_data['meta_keywords'] = “lyrics,song,songs,words,hardore,metal,emo,rock”;
    $layout_data['meta_url'] = “$base_url”;
    $layout_data['meta_classification'] = “home”;
    $layout_data['searchInput'] = “”;
    $layout_data['searchOptions'] = “”;

    $this->load->model(’search’);
    $lastest_albums = $this->search->last_n_albumsAdded(10);
    $popular_songs = $this->search->popular_n_songs(10);

    //get the featured Albums
    $featuredAlbums = $this->search->getFeaturedAlbums();

    $body_data['featured'] = $featuredAlbums;
    $body_data['newest'] = $lastest_albums;
    $body_data['popular'] = $popular_songs;

    //load the content variables
    $layout_data['content_navigation'] = $this->load->view(’navigation’, $navigation_data, true);
    $layout_data['content_body'] = $this->load->view(’home/homePage’, $body_data, true);

    $this->load->view(’layouts/main’, $layout_data);
    }

    &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
    /views/navigation.php

    <div id=”header”>
    <h1 title=”Loud Songs Logo”>LoudSongs search – hard to find obscure lyrics</h1>

    <ul title=”navigation”>
    <li <? if($navTab == “about”){echo ” id=\”active\”";}?>><a href=”<?= base_url(); ?>about” title=”About Page”>About</a></li>
    <li <? if($navTab == “add”){echo ” id=\”active\”";}?>><a href=”<?= base_url(); ?>add” title=”Add Lyrics”>Add Lyrics</a></li>
    <li <? if($navTab == “home”){echo ” id=\”active\”";}?>><a href=”<?= base_url(); ?>” title=”Home Page”>Home</a></li>
    </ul>
    </div>

    &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
    /views/home/homePage.php

    <div>
    Thanks for visiting LoudSongs
    <br/>
    We are trying to build a maintain a collection of punk rock, hardcore, emo, metal and other lyrics.
    This website is free and open to all.
    Please help us by <a href=”http://www.LoudSon.gs/add”>contributing to the collection</a>.
    </div>

    <div>
    <? $this->load->view(’home/featuredAlbums’); ?>
    </div>

    <div class=”middle_col_split”>
    <? $this->load->view(’home/recentlyAdded’); ?>
    </div>

    <div class=”middle_col_split”>
    <? $this->load->view(’home/mostPopularSongs’); ?>
    </div>

    &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
    /views/layouts/main.php

    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
    <html>
    <head>
    <meta http-equiv=”Content-Type” content=”text/html;charset=us-ascii”>
    <meta name=”description” content=”<?= $meta_description ?>”>
    <meta name=”keywords” content=”<?= $meta_keywords ?>”>
    <meta http-equiv=”expires” content=”0″ />
    <meta name=”classification” content=”<?= $meta_classification ?>” />
    <meta name=”Robots” content=”index,follow”>
    <meta name=”revisit-after” content=”2 Days”>
    <meta name=”language” content=”en-us”>

    <link href=”<?= base_url() ?>includes/styles/lyrics.css” rel=”stylesheet” type=”text/css” media=”screen” title=”default”>

    <script language=”javascript” type=”text/javascript” src=”<?= base_url() ?>includes/scripts/jquery-1.2.6.min.js”></script>

    <title><?= $pageTitle ?></title>
    </head>

    <body id=”home”>
    <div id=”nav”>
    <?= $content_navigation; ?>
    </div>

    <div id=”middle_column”>

    <?= $content_body ?>

    </div>
    </body>

    </html>

    &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

    wow, ok, so that might be a lot to digest. The bottom line is this, CI doesnt have “layouts” like other frameworks, so you have to become creative and use a view AS a layout by using the mythical 3rd parameter when loading a view. We load data into the navigation view and store all of that into the $layout_data array, then we load a view named homePage and pass data into it, and stor it into the $layout_data array. When we are done loading all of the views into the array, we pass that array into another view. This view acts as our layout. easy as that! check it out below:

    //load the content variables
    $layout_data['content_navigation'] = $this->load->view(’navigation’, $navigation_data, true);
    $layout_data['content_body'] = $this->load->view(’home/homePage’, $body_data, true);

    $this->load->view(’layouts/main’, $layout_data);

    I hope this helps someone understand how codeigniter does have layout and view functionality, you just have to structure it that way in your code.

    post some comments if you need more clarification.

  • php sprintf + sql like

    Posted on July 6th, 2008 Josh Highland 9 comments

    Sometimes I do my best programming when I’m tired. Don’t ask me why, I just do. It’s a skill I picked up in college.

    Being tired and producing good code wasn’t the case last night. I was trying to use the sprintf PHP function with a SQL “Like” statement. I made some dumb mistakes that tripped me up for a while. Hopefully someone out there will find this post and help them not make the problems I made, sleepy or not!

    Normally the LIKE is used in mysql like this:
    SELECT name FROM users WHERE name LIKE 'J%';

    That would get all names including: Josh, Jason, Jimi, etc.
    In a SQL Like statement the % is a wild card, so the command is to match everything starting with “J”

    Now when you use the sprintf() function it looks kind like this:
    $query = sprintf("SELECT name FROM users WHERE name='%s'", $searchString);
    The %s will be replaced with the value of $searchString

    Trying to combined them is where I had some problems….

    At first I tried to do something like this:
    $query = sprintf("SELECT name FROM users WHERE name LIKE'%s'", $searchString);
    didnt return what I was looking for at all, it had no wild cards in it!

    Then I tried this:
    $query = sprintf("SELECT name FROM users WHERE name LIKE'%s%'", $searchString);
    didnt work either, this time it threw errors

    But this worked great
    $query =
    sprintf("SELECT name FROM users WHERE name LIKE '%s'", $searchString . "%");

    So the moral of the story is, if you want to use a SQL Like statement, appent the wildcard for the Like statement to the string to be inserted by the sprintf funtion.