View previous topic :: View next topic |
Author |
Message |
Cyberian75
Joined: 26 Sep 2002 Posts: 1227 Location: Oregon
|
Posted: Mon Sep 01, 2003 9:05 pm Post subject: Revised Improved Private Entry Hack |
|
|
Since devilkid81 took down his private entry hack, because he didn't like me modifying it, I thought I would post my revised version of it.
I have modified it so that a cookie is used to retain the password; therefore, the users don't have to type in the password over and over again. I have also made it possible for you to control the output of comments link and others.
Also, since the cookie check is written in a function, you can use it in other areas of your blog without too much duplication of code.
You can get the hack here.  _________________ Michael P.

Last edited by Cyberian75 on Wed Oct 13, 2004 11:30 pm; edited 2 times in total |
|
Back to top |
|
 |
billy
Joined: 05 Jul 2003 Posts: 40
|
Posted: Mon Sep 01, 2003 9:18 pm Post subject: |
|
|
thanks a lot! i was gonna download the other one, but then i saw he took it down. thanks again  |
|
Back to top |
|
 |
Reese
Joined: 07 Sep 2002 Posts: 60
|
Posted: Tue Sep 02, 2003 1:37 am Post subject: |
|
|
Isn't Mike just so cool! :insert throbbing heart smiley:
No really though, it is awesome that finally a password protection hack including comment protection and cookie usage has come to be. _________________ --- |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1227 Location: Oregon
|
Posted: Tue Sep 02, 2003 2:05 am Post subject: |
|
|
Thanks for the compliments, guys, but the credit for the idea of this hack should go to devilkid81.  _________________ Michael P.
 |
|
Back to top |
|
 |
moose
Joined: 04 May 2003 Posts: 196 Location: Winnipeg Canada
|
Posted: Tue Sep 02, 2003 3:28 am Post subject: |
|
|
i got a parse error in b2edit, because of:
Code: | $query = "INSERT INTO $tableposts (ID, post_author, post_date, post_content, post_title, post_category, private) VALUES ('0','$user_ID','$now','$content','".$post_title."','".$post_category."','".$private)";
|
i changed it to...
Code: |
$query = "INSERT INTO $tableposts (ID, post_author, post_date, post_content, post_title, post_category, private) VALUES ('0','$user_ID','$now','$content','".$post_title."','".$post_category."','".$private."')";
|
so it works fine now just pointing that out.
it's missing the ."' on the end of $private  |
|
Back to top |
|
 |
moose
Joined: 04 May 2003 Posts: 196 Location: Winnipeg Canada
|
Posted: Tue Sep 02, 2003 3:39 am Post subject: |
|
|
another thing, you shouldnt put
'private' => $row->private
for get_postdata2 under
Code: | 'Karma' => $row->post_karma // this isn't used yet |
because you will get a parse error, because there is no comma after that line. if you get this error, add a comma after $row->post_karma so it looks like
Code: |
$row->post_karma, // this isin't used yet
|
then paste 'private' => $row->private under it |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1227 Location: Oregon
|
Posted: Tue Sep 02, 2003 3:53 am Post subject: |
|
|
Thank you for the corrections.
I updated the file. _________________ Michael P.
 |
|
Back to top |
|
 |
Reese
Joined: 07 Sep 2002 Posts: 60
|
Posted: Tue Sep 02, 2003 3:22 pm Post subject: |
|
|
Well I think that you deserve some credit, because the best thing about this is the inclusion of all these features.
I'm going to upgrade (or try to ) in a few minutes. It's terrible, I'm going through the hacks section looking for all the useful ones that I don't have yet, which means I'll be doing alot of screwing up my b2 installing them all. I already installed the smilie hack - where you have them on b2edit.php. Very neat.
edited for emphasis on "all" - cause I'm a perfectionist _________________ --- |
|
Back to top |
|
 |
Reese
Joined: 07 Sep 2002 Posts: 60
|
Posted: Tue Sep 02, 2003 5:03 pm Post subject: |
|
|
Alright, I told you I was going to have problems.
All went well, except when I went to post a test private entry.
Here's the error I'd gotten:
Quote: | Oops, MySQL error!
Your query:
MySQL said:
Column count doesn't match value count at row 1
|
...? If you're going to ask if I'd went into phpmyadmin and run "ALTER TABLE b2posts ADD private INT(1) DEFAULT 0 NOT NULL;", I did.
Also, as far as I can tell everything else is alright.
Perhaps it's just another case of my b2 hating me? _________________ --- |
|
Back to top |
|
 |
moose
Joined: 04 May 2003 Posts: 196 Location: Winnipeg Canada
|
Posted: Tue Sep 02, 2003 5:16 pm Post subject: |
|
|
Can you post your query for posting (the thing that looks like $query = "INSERT INTO $tableposts...." here? |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1227 Location: Oregon
|
Posted: Tue Sep 02, 2003 5:27 pm Post subject: |
|
|
moose, you're really good and smart for your age.  _________________ Michael P.
 |
|
Back to top |
|
 |
Reese
Joined: 07 Sep 2002 Posts: 60
|
Posted: Tue Sep 02, 2003 5:55 pm Post subject: |
|
|
resolved _________________ ---
Last edited by Reese on Tue Sep 02, 2003 10:09 pm; edited 1 time in total |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1227 Location: Oregon
|
Posted: Tue Sep 02, 2003 6:01 pm Post subject: |
|
|
In the comments page, there should be a form for commenting. I meant that form, not the one you are instructed to place.
Also, it seems that you are calling "the_content" function twice, hence your double entry. If you can't figure it out, show us your codes of your content template. _________________ Michael P.
 |
|
Back to top |
|
 |
kenshin
Joined: 03 Sep 2003 Posts: 4
|
Posted: Wed Sep 03, 2003 7:55 am Post subject: Post not showing |
|
|
Hi. I installed it and rechecked but still it is not working for me. It doesn't shows the post eventhough I entered the correct password. It does not even shows the error I am supposed to see if ever I do enter the wrong password/no password.
Last edited by kenshin on Thu Sep 04, 2003 2:39 am; edited 1 time in total |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 1227 Location: Oregon
|
Posted: Wed Sep 03, 2003 8:05 am Post subject: |
|
|
In the function, have you changed the domain name to yours?
And the following should be placed before any output is sent to the browser:
Code: |
$blog=1;
include("blog.header.php");
//private cookie check
$private = setprivate($password);
|
_________________ Michael P.

Last edited by Cyberian75 on Wed Sep 03, 2003 8:11 am; edited 1 time in total |
|
Back to top |
|
 |
|