boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Where are the entries stored???!!!

 
Post new topic   Reply to topic    boardom Forum Index -> How to ?
View previous topic :: View next topic  
Author Message
mango



Joined: 29 Dec 2004
Posts: 10

PostPosted: Sun Jan 23, 2005 7:21 pm    Post subject: Where are the entries stored???!!! Reply with quote

Every time i post an entry, i kno that somehow the php database saves it so i can view it on the website but where exactly are all the entries stored??? If i decided to not use B2 anymore but i wana keep my entries and save them on my computer, which file to i save? or if my host crashed down then all my entries will be gone rite? So just in case, i wana save them, but which file!??? please help!
Back to top
View user's profile Send private message
stevem



Joined: 15 Mar 2003
Posts: 365

PostPosted: Sun Jan 23, 2005 11:31 pm    Post subject: Reply with quote

It's kept in a database on the server, so not in a simple file you can download. You may be able to see the database via your control panel where you set up databases - look for a utility like phpMyAdmin.

Also see Quick Backup for an easy way of backing up your b2 data onto your own computer.
Back to top
View user's profile Send private message
mango



Joined: 29 Dec 2004
Posts: 10

PostPosted: Wed Jan 26, 2005 5:37 am    Post subject: Reply with quote

thank you! so there's only one way huh... I wish they were all stored in a text file or something so i can read them still 20 years later...hehe!
Back to top
View user's profile Send private message
stevem



Joined: 15 Mar 2003
Posts: 365

PostPosted: Wed Jan 26, 2005 7:46 pm    Post subject: Reply with quote

This will save all your posts into a text file for easy reading
Put it into a file called b2backup.posts.php
Code:
<?php
require_once ('b2config.php');
require_once($b2inc."/b2functions.php");
dbconnect();
get_currentuserinfo();
$dateformat=get_settings('date_format');

if (!($user_login)) exit;
if ($user_level<8) exit;

$filename = "my_posts_" . date("y-m-d");
header("Content-Disposition: filename=$filename.text");
header("Content-Type: application/force-download");
$sql = "SELECT * FROM $tableposts ORDER BY post_date DESC";
$result = mysql_query($sql);

while($row = mysql_fetch_object($result)) {
   $firstline=stripslashes($row->post_title) . "   ".mysql2date($dateformat,$row->post_date);
   $n=strlen($firstline);
   echo $firstline."\r\n" . str_repeat("-",$n)."\r\n";
   $content=str_replace("<br />","\r\n",stripslashes($row->post_content)) . "\r\n\r\n";
   $content=str_replace("\r\n\n","\r\n",$content);
   $content=str_replace("<br>","\r\n",$content);
   echo $content;
}

?>


You can do the same with comments:
b2backup.comments.php
Code:
<?php
require_once ('b2config.php');
require_once($b2inc."/b2functions.php");
dbconnect();
get_currentuserinfo();
$dateformat=get_settings('date_format');

if (!($user_login)) exit;
if ($user_level<8) exit;

$filename = "my_comments_" . date("y-m-d");
header("Content-Disposition: filename=$filename.text");
header("Content-Type: application/force-download");
$sql = "SELECT * FROM $tablecomments ORDER BY comment_date DESC";
$result = mysql_query($sql);

while($row = mysql_fetch_object($result)) {
    $postdata = get_postdata($row->comment_post_ID);
    echo stripslashes($postdata['Title'])."\r\n";
   $firstline=$row->comment_author . "   ".mysql2date($dateformat,$row->comment_date);
   $n=strlen($firstline);
   echo $firstline."\r\n" . str_repeat("-",$n)."\r\n";
   $content=str_replace("<br />","\r\n",stripslashes($row->comment_content)) . "\r\n\r\n";
   $content=str_replace("\r\n\n","\r\n",$content);
   $content=str_replace("<br>","\r\n",$content);
   echo $content;
}

?>


Someone might like to play with these files and put them together and make the output into a nice HTML file.
Back to top
View user's profile Send private message
mango



Joined: 29 Dec 2004
Posts: 10

PostPosted: Thu Jan 27, 2005 8:30 pm    Post subject: Reply with quote

thanks for the code! just what i need! but what do i do with the code though? i save it as b2backup.posts.php but what do i do after that? simply upload it in my server? then how i get my entries in a text file??
Back to top
View user's profile Send private message
stevem



Joined: 15 Mar 2003
Posts: 365

PostPosted: Fri Jan 28, 2005 7:54 pm    Post subject: Reply with quote

You do the same as for Quick Backup. Upload it to the server into b2's directory. Then in b2-include/b2menutop.txt add the line (before ***)
Code:
8   b2backup.posts.php   Download Posts

(those blank spaces are a single tab)
upload and then you will get a Download Posts menu to click on. When you do you will get a text file to save onto your computer.
Back to top
View user's profile Send private message
mango



Joined: 29 Dec 2004
Posts: 10

PostPosted: Sat Jan 29, 2005 5:55 am    Post subject: Reply with quote

wow!!! just what i was looking for all this time! thanks alot!!! Very Happy Very Happy
Back to top
View user's profile Send private message
Sigg3



Joined: 03 Jul 2003
Posts: 896
Location: Oslo, Norway

PostPosted: Mon Jan 31, 2005 11:22 pm    Post subject: Reply with quote

I just came across this article on hacking OpenOffice (Writer)
when I thought... hey! This could be made b2-friendly.

How about having your blog in a "word" file? Actually, it's XML, but openoffice (which is free:) can save to word format.

But... I digress. I don't have the 1337 skills or the time to throw myself into a project like this. Just thought I'd share the idea, though:)
_________________
Sigg3.net - You know you're worth it! | b2 Cafelog Resource Center | Fight my BattleImp!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> How to ? All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group