View previous topic :: View next topic |
Author |
Message |
mango
Joined: 29 Dec 2004 Posts: 10
|
Posted: Sun Jan 23, 2005 7:21 pm Post subject: Where are the entries stored???!!! |
|
|
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 |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 365
|
Posted: Sun Jan 23, 2005 11:31 pm Post subject: |
|
|
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 |
|
 |
mango
Joined: 29 Dec 2004 Posts: 10
|
Posted: Wed Jan 26, 2005 5:37 am Post subject: |
|
|
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 |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 365
|
Posted: Wed Jan 26, 2005 7:46 pm Post subject: |
|
|
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 |
|
 |
mango
Joined: 29 Dec 2004 Posts: 10
|
Posted: Thu Jan 27, 2005 8:30 pm Post subject: |
|
|
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 |
|
 |
stevem
Joined: 15 Mar 2003 Posts: 365
|
Posted: Fri Jan 28, 2005 7:54 pm Post subject: |
|
|
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 |
|
 |
mango
Joined: 29 Dec 2004 Posts: 10
|
Posted: Sat Jan 29, 2005 5:55 am Post subject: |
|
|
wow!!! just what i was looking for all this time! thanks alot!!!  |
|
Back to top |
|
 |
Sigg3
Joined: 03 Jul 2003 Posts: 898 Location: Oslo, Norway
|
|
Back to top |
|
 |
|