Need someone to lead product management at your software company? I create software for people that create software and I'm looking for my next opportunity. Check out my resume and get in touch.

Comments

Comments for Password protect your blog

Excerpt: Password protecting a Movable Type blog using Movable Type’s own user database. Read the whole article…

Trackback from Neil's Smaller World
August 14, 2004 1:48 AM

Password protect your blog

Excerpt: Use PHP to add password protection to your MT blog. Integrates with existing MT user database....

Trackback from Movalog
August 14, 2004 3:51 AM

Password Protection

Excerpt: Adam Kalsey has posted a tip on how to password protect your blog by adding PHP to your templates. The PHP is very easily integrated with MT’s database !...

Trackback from Gadgetopia
August 14, 2004 4:06 AM

Password Protecting Movable Type

Excerpt: Password protect your blog :: Kalsey Consulting Group: Good documentation on a long overdue improvement. I've got a new project, let's call it Project X, and one of the things I needed to do was set up a password-protected blog...

Wilson
August 14, 2004 6:14 AM

I tried to do exactly the same thing about a year ago, and only halfway succeeded. This would have come in handy - hopefully it will come in handy again!

BillSaysThis
August 14, 2004 9:47 AM

Looks very interesting and like, a bit generalized, it would work for most any secure PHP situation. Just a couple of questions: > while ($row = mysql_fetch_array($result)) { Why is this in a while loop instead of just taking the one row? Where is PHP_AUTH_USER and PHP_AUTH_PW being set?

kellan
August 14, 2004 10:58 AM

A quick note, this won't work in PHP5.0.0 though it will in PHP5.0.1

Trackback from Warnadunia.NET Plug
August 14, 2004 12:13 PM

Password protected blog

Excerpt: If you are using MT, and you want to protect your blog. There is a method by Adam Kalsey....

Trackback from Learning Movable Type
August 14, 2004 12:22 PM

Movable Type Resources

Excerpt: Movable Type (MT) is a powerful web content publishing system, though often difficult for beginners to implement. Here are the links I have found most useful while implementing Movable Type weblogs. This list will grow as I continue to add features to ...

Scott
August 14, 2004 9:51 PM

I would have just used the mod_auth_mysql to protect the whole directory. But it works only if you have the rights to install an Apache module. http://www.diegonet.com/support/mod_auth_mysql.shtml If using the php solution, to avoid having to change every single template, you could put the code in a separate file and put this in .htaccess: php_value auto_prepend_file /path/to/auth.php

Adam Kalsey
August 14, 2004 9:59 PM

Bill: Those two variables are set when by the Web server when you submit the basic authentication form. The loop isn't really a problem since the SQL always returns one row. So it only executes once. Scott: The MySQL auth module should work, but as you said, you need to me able to install a module. Most people can't. I'd also want to review the source of that before using it. (And you have to be using Apache.) An alternative would be to write an authentication wrapper for Apache in Perl if you have mod_perl running.

Trackback from synapse
August 14, 2004 11:25 PM

Password protection and MT

Excerpt: Adam Kalsey has a dandy way to restrict your Movable Type blog to authors only.

cVaughn
August 15, 2004 12:37 PM

This looks exactly like what I need. You mentioned 5.0 won't work. I've got php4.3.4- will it work? I'm also running cgi-wrap (php-cgiwrap), using mySQL, and configured for php files.

Joey Horne
September 2, 2004 2:19 PM

When applying this code, I get the following error: Warning: main(protect.php): failed to open stream: No such file or directory in /home/jhornef/public_html/journal/index.php on line 5 Warning: main(): Failed opening 'protect.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/jhornef/public_html/journal/index.php on line 5 Any ideas?

Adam Kalsey
September 2, 2004 2:26 PM

You have an error that says Warning: main(protect.php): failed to open stream: No such file or directory That always means you're trying to include a file that doesn't exist. Either protect.php isn't on your server or it iisn't in the spot on your server where journal/index.php is at.

brad
September 6, 2004 12:35 PM

it's not working for me. it seems it never enters the first "if" loop. using php 4.3.8

Trackback from Mama Write's Sideblog
September 14, 2004 11:11 AM

Password Please

Excerpt: Password protect a blog using MT author credentials. Something to consider if/when I include blogs in my 102 course website....

Trackback from Mama Write's Sideblog
September 14, 2004 11:19 AM

Password Please!

Excerpt: How to password protect a blog using MT author credentials. Intriguing idea for my 102 website if/when I include blogging as a course requirement....

Trackback from sideblog
September 17, 2004 3:45 PM

Need a password?

Excerpt: Password protect your blog :: Kalsey Consulting Group...

Trackback from Links
September 17, 2004 10:11 PM

Password Protecting Your Blog

Excerpt: In case you want to password protect an entry in Movable Type.

Christian
September 18, 2004 9:32 AM

There's a problem with the code. One of your curly brackets (whatever) is in the wrong place. The while statements should contain the following if statement. Like this: while ($row = mysql_fetch_array($result)) { $real_pass = $row['author_password']; if (crypt($_SERVER['PHP_AUTH_PW'], substr($real_pass, 0, 2)) == $real_pass) { $auth = true; }//end if }//end while

Trackback from Five Live Links
November 3, 2004 11:31 AM

Password protect your blog :: Adam Kalsey

Excerpt: Only works for some blogs and some hosts (where you control the templates, and can add and execute PHP). But still useful....

ByteRun
November 17, 2004 12:46 PM

Probably last statement else statement ( ...} else { return true; }... ) is useless because function always returns true or stops execution.

Ton Ensing
November 17, 2005 2:07 PM

Discovered this more than a year later but it's great nonetheless. I'm curious though if it would be possible to limit access to the author(s) associated with the blog_id=x, not just every author in the MySQL database.

crys
December 8, 2005 1:44 PM

So, I'm trying to password protect my blog, could you break down the instructions for me? I'm sorry, I am a little computer illiterate. Thanks Crys

This discussion has been closed.

Recently Written

Too Big To Fail (Apr 9)
When a company piles resources on a new product idea, it doesn't have room to fail. That keeps it from succeeding.
Go small (Apr 4)
The strengths of a large organization are the opposite of what makes innovation work. Starting something new requires that you start with a small team.
Start with a Belief (Apr 1)
You can't use data to build products unless you start with a hypothesis.
Mastery doesn’t come from perfect planning (Dec 21)
In a ceramics class, one group focused on a single perfect dish, while another made many with no quality focus. The result? A lesson in the value of practice over perfection.
The Dark Side of Input Metrics (Nov 27)
Using input metrics in the wrong way can cause unexpected behaviors, stifled creativity, and micromanagement.
Reframe How You Think About Users of your Internal Platform (Nov 13)
Changing from "Customers" to "Partners" will give you a better perspective on internal product development.
Measuring Feature success (Oct 17)
You're building features to solve problems. If you don't know what success looks like, how did you decide on that feature at all?
How I use OKRs (Oct 13)
A description of how I use OKRs to guide a team, written so I can send to future teams.

Older...

What I'm Reading

Contact

Adam Kalsey

+1 916 600 2497

Resume

Public Key

© 1999-2024 Adam Kalsey.