Jump to content
TNG Community

Backup Living Script


thewag

Recommended Posts

I click OK and get:

Backing Up Living Flags....

Return to Main Menu\n"); die ("Couldn't open file ($filename)"); } $Query = "SELECT gedcom, personID, lastname, firstname, birthdate FROM $people_table WHERE `living` = '1' ORDER BY `lastname` ASC , `firstname` ASC"; $Result = mysql_db_query ($database_name, $Query, $Link); if (!$Result) { echo("Error performing query: ".mysql_error()."

\n"); echo ("Return to Main Menu\n"); die(); } echo("\n"); echo(" Living Number Gedcom | Person ID Name Date of Birth

\n"); $tmpCount=1; echo("\n"); while ($tmp = mysql_fetch_array ($Result)) { echo(" $tmpCount $tmp[0] | $tmp[1] $tmp[2], $tmp[3] $tmp[4]

\n"); $tmpCount++; $tmp_fwrite="$tmp[0]|+|$tmp[1]|+|$tmp[2]|+|$tmp[3]|+|$tmp[4]\n"; if (fwrite($fp, $tmp_fwrite) === FALSE) { echo "Cannot write to file ($filename)"; echo ("Return to Main Menu\n"); die(); } } echo(" "); fclose($fp); echo ("Return to Main Menu\n"); } else { echo("There was an error connecting to the database.

\n"); echo ("Return to Main Menu\n"); die(); } tng_footer(""); ?>

I have tried everythink I can to get this to work but nothing seems to fix it..

Using Backup_living_0.9r1.zip

Thanks

Darryl

Hey Darryl, welcome to the forums.

I've not had the ability to test this on a Windows type server running PHP. First impressions look like something to do with PHP settings and the living directory. I'm not sure why it would output the text of the file. Could you email (through the forum) your server specs and we'll see what can be worked out.

Thanks,

Ben

Link to comment
Share on other sites

  • Replies 116
  • Created
  • Last Reply

Top Posters In This Topic

  • thewag

    40

  • Ken Roy

    24

  • Scotty

    21

  • beckwith

    6

Top Posters In This Topic

Posted Images

Hey Darryl, welcome to the forums.

I've not had the ability to test this on a Windows type server running PHP. First impressions look like something to do with PHP settings and the living directory. I'm not sure why it would output the text of the file. Could you email (through the forum) your server specs and we'll see what can be worked out.

Thanks,

Ben

Ben, I just tried it with Wampserver2 on a localhost..... First the password function does not work at all. It does write the files. It just won't accept the data to login. So, I commented out those lines in index.php and got the menu. When I try a backup it burps out that same error.

Probably not too much help.

Scotty

Link to comment
Share on other sites

Hey Bruce,

In the living folder you created for the backup there is a .htaccess and .htpasswd file. You can delete them to start over with a new user/password combo. BTW, this script isn't integrated into the TNG user system, so the username/password you set up here might be different than the one you use for TNG. Or it could be an old one if you change your passwords often. That part I can't help with.

G'luck.

Ben

Thanks, Ben - all fixed.

Bruce

Link to comment
Share on other sites

Version 1.0 (BETA) release

I need testers please.

Ok, this should help the window server folks. The scripts will now use the TNG login system. Hope this helps. It also stores the backup data in a php file composed of an array, not a "flat" file.

--UPGRADE INSTRUCTIONS

DELETE everything, start over! :)

~Ben

backup_living_1.0.zip

Link to comment
Share on other sites

Version 1.0 (BETA) release

I need testers please.

Ok, this should help the window server folks. The scripts will now use the TNG login system. Hope this helps. It also stores the backup data in a php file composed of an array, not a "flat" file.

--UPGRADE INSTRUCTIONS

DELETE everything, start over! :)

~Ben

Ben....

Fix line 30 in index.php: $backup_filename

It works better that way..... :-P

After I changed line 30 it worked just fine on the server.

Spelling police: on line 5 'previos' should be previous

And for what its worth: wampserver pukes on line 3:

Fatal error: Call to undefined function tng_header() in C:\wamp\www\living\index.php on line 3

Scotty

Link to comment
Share on other sites

Fix line 30 in index.php: $backup_filename

It works better that way..... :-P

After I changed line 30 it worked just fine on the server.

Ahh, search and DIDN'T REPLACE. Thanks.

Spelling police: on line 5 'previos' should be previous

That error has been there for a LONG time.. did ya know I nearly flunked spelling? *GRIN*

And for what its worth: wampserver pukes on line 3:

Fatal error: Call to undefined function tng_header() in C:\wamp\www\living\index.php on line 3

Scotty

The script is excepting to be installed one level down from TNG. Try this simple fix to the config.living.php:


<?
//DIRECTORY OF SCRIPT
//MOST OF THE TIME YOU ARE SAFE TO LEAVE IT BLANK
//BE SURE TO INCLUDE THE BEIGNING AND ENDING slash '/' mark

//This is actually the web_root
$doc_root="/living/";

//File name for the backup file
$backup_filename="living_data.backup.php";

//Change this to reference where TNG is from this folder
$cms[tngpath] = "../";

/* DO NOT EDIT BELOW THIS LINE */
include( "../config.php");   //Nuke users must include "../../../begin.php" here
include($cms[tngpath] ."genlib.php");
include($cms[tngpath] ."getlang.php");
include($cms[tngpath] ."$mylanguage/text.php");

$Link = tng_db_connect($database_host,$database_name,$database_username,$database_password) or exit;

include("../checklogin.php");

if( !$allow_admin_db ) {
    $message = "You need to be LOGGED IN as a site admin to run these scripts.";
    header( "Location: ../login.php?message=" . urlencode($message) );
    exit;
}
?>

Let me know if ti works.

Ben

Link to comment
Share on other sites

The script is excepting to be installed one level down from TNG. Try this simple fix to the config.living.php:


<?
//DIRECTORY OF SCRIPT
//MOST OF THE TIME YOU ARE SAFE TO LEAVE IT BLANK
//BE SURE TO INCLUDE THE BEIGNING AND ENDING slash '/' mark

//This is actually the web_root
$doc_root="/living/";

//File name for the backup file
$backup_filename="living_data.backup.php";

//Change this to reference where TNG is from this folder
$cms[tngpath] = "../";

/* DO NOT EDIT BELOW THIS LINE */
include( "../config.php");   //Nuke users must include "../../../begin.php" here
include($cms[tngpath] ."genlib.php");
include($cms[tngpath] ."getlang.php");
include($cms[tngpath] ."$mylanguage/text.php");

$Link = tng_db_connect($database_host,$database_name,$database_username,$database_password) or exit;

include("../checklogin.php");

if( !$allow_admin_db ) {
    $message = "You need to be LOGGED IN as a site admin to run these scripts.";
    header( "Location: ../login.php?message=" . urlencode($message) );
    exit;
}
?>

Let me know if ti works.

Ben

Guess, I shudda mentioned I did change the doc_root variable. Still the same error.

I then added the $cms[tngpath] = "../"; still the same error. then I changed this one to the absolute path of C:/wamp/www/ and it still gives the same error.

I use a program called WeBuilder for editing as it allows me to preview code using PHP. Most of the TNG files will display the page. None of the backup files will display and I get that same error on the files that should display something.

NOW, as far as I'm concerned it works on the server. And that is good enough for me. But, I'm sorta curious as to why it doesn't work with Wampserver.

Scotty

Link to comment
Share on other sites

Guess, I shudda mentioned I did change the doc_root variable. Still the same error.

I then added the $cms[tngpath] = "../"; still the same error. then I changed this one to the absolute path of C:/wamp/www/ and it still gives the same error.

Did you install the script under admin? From some poking I think you did. If so, you need to set the $cms[tngpath] to "../../" or C:/wamp/www/genealogy/ since your TNG installation is farther down the path.

Ben

Link to comment
Share on other sites

Did you install the script under admin? From some poking I think you did. If so, you need to set the $cms[tngpath] to "../../" or C:/wamp/www/genealogy/ since your TNG installation is farther down the path.

Ben

C:/wamp/www/living/ is the path.

And making the changes to $cms[tngpath] still produces the same error.

Scotty

Link to comment
Share on other sites

C:/wamp/www/living/ is the path.

And making the changes to $cms[tngpath] still produces the same error.

Scotty

$cms[tngpath] needs to point to your TNG installation.

Link to comment
Share on other sites

$cms[tngpath] needs to point to your TNG installation.

Here is the root path from config.php = C:/wamp/www/

so, I make $cms[tngpath] = "C:/wamp/www/"; still the same error.

Rather than this bouncing back and forth.... you should try Wampserver yourself. I might have a setting that is wrong in php.ini.

Or wait and see if this version works on Win 2003 server that Darryl said failed earlier.

Scotty

Link to comment
Share on other sites

OK tried V1 Beta and at first with no changes only get blank screen when going to /living/index.php

tried all fixes listed after V1beta post.

removed:

//tng_header( "Backup and Restore Living Flags - Homepage", "" );

from index.php and now ge the index page but plain white page with error no backup found.. then clicked the backup and nothing happend...

removed:

//tng_header( "Backing Up Living Flags", "" );

form backup.php and then got the option to clidk OK/Cancel

Clicked ok got:

Backing Up Living Flags....

Return to Main Menu\n"); die ("Couldn't open file ($backup_filename)"); } $tmp_fwrite="Return to Main Menu\n"); die(); } $Query = "SELECT gedcom, personID, lastname, firstname, birthdate FROM $people_table WHERE `living` = '1' ORDER BY `lastname` ASC , `firstname` ASC"; $Result = mysql_db_query ($database_name, $Query, $Link); if (!$Result) { echo("Error performing query: ".mysql_error()."

\n"); echo ("Return to Main Menu\n"); die(); } echo("\n"); echo(" Living Number Gedcom Person ID Name Date of Birth

\n"); $tmpCount=1; echo("\n"); while ($tmp = mysql_fetch_array ($Result)) { echo <<< ROW_DOC $tmpCount {$tmp['gedcom']} {$tmp['personID']} {$tmp['lastname']}, {$tmp['firstname']} {$tmp['birthdate']}

ROW_DOC; $tmp_fwrite = <<"); $tmp_fwrite="?>"; fwrite($fp, $tmp_fwrite); fclose($fp); echo ("Return to Main Menu\n"); } else { echo("There was an error connecting to the database.

\n"); echo ("Return to Main Menu\n"); die(); } //tng_footer(""); ?>

looking in the folder it dosnt write a file.... and I checked all rights giving everyone all rights...

also I gather that if i'm not loged in as Admin... I should get some sort of error... I get same (logged in or not)

Thanks

Darryl

also I have two gedcoms loaded - it seems that the code looks at the gedcom... what if you have two...?

Looking forward to V1.1 Beta :grin:

Link to comment
Share on other sites


<?
//DIRECTORY OF SCRIPT
//MOST OF THE TIME YOU ARE SAFE TO LEAVE IT BLANK
//BE SURE TO INCLUDE THE BEIGNING AND ENDING slash '/' mark

//This is actually the web_root
$doc_root="/living/";

//File name for the backup file
$backup_filename="living_data.backup.php";

//Change this to reference where TNG is from this folder
$tngpath = "../";

/* DO NOT EDIT BELOW THIS LINE */
include( "../config.php");   //Nuke users must include "../../../begin.php" here
$cms[tngpath] = $tngpath;
include($cms[tngpath] ."genlib.php");
include($cms[tngpath] ."getlang.php");
include($cms[tngpath] ."$mylanguage/text.php");

$Link = tng_db_connect($database_host,$database_name,$database_username,$database_password) or exit;

include("../checklogin.php");

if( !$allow_admin_db ) {
    $message = "You need to be LOGGED IN as a site admin to run these scripts.";
    header( "Location: ../login.php?message=" . urlencode($message) );
    exit;
}
?>

I think this should fix some problems. It looks like $cms[tngpath] is changed in the TNG config. Let me know if this works.

Link to comment
Share on other sites

  • 1 month later...


<?
//DIRECTORY OF SCRIPT
//MOST OF THE TIME YOU ARE SAFE TO LEAVE IT BLANK
//BE SURE TO INCLUDE THE BEIGNING AND ENDING slash '/' mark

//This is actually the web_root
$doc_root="/living/";

//File name for the backup file
$backup_filename="living_data.backup.php";

//Change this to reference where TNG is from this folder
$tngpath = "../";

/* DO NOT EDIT BELOW THIS LINE */
include( "../config.php");   //Nuke users must include "../../../begin.php" here
$cms[tngpath] = $tngpath;
include($cms[tngpath] ."genlib.php");
include($cms[tngpath] ."getlang.php");
include($cms[tngpath] ."$mylanguage/text.php");

$Link = tng_db_connect($database_host,$database_name,$database_username,$database_password) or exit;

include("../checklogin.php");

if( !$allow_admin_db ) {
    $message = "You need to be LOGGED IN as a site admin to run these scripts.";
    header( "Location: ../login.php?message=" . urlencode($message) );
    exit;
}
?>

I think this should fix some problems. It looks like $cms[tngpath] is changed in the TNG config. Let me know if this works.

I can't find any way to make this fully functional. I'm usting TNG 6.2 with template 5. My directory

structure is "root/genealogy/living".

In config.living.php, I had to either delete the following line:

$doc_root="/living/";

or replace it with:

$doc_root="/genealogy/living/";

to get the initial paths correct.

In index.php, I correct the following line:

if (is_file($filename)) {

to:

if (is_file($backup_filename)) {

However, I couldn't get index.php to pick up the underlying CSS files (genstyle.css and mytngstyle.css).

Has anyone actually gotten this to work? Can someome tell me what I have to change?

Jerry

Link to comment
Share on other sites

I can't find any way to make this fully functional. I'm usting TNG 6.2 with template 5. My directory

structure is "root/genealogy/living".

In config.living.php, I had to either delete the following line:

$doc_root="/living/";

or replace it with:

$doc_root="/genealogy/living/";

to get the initial paths correct.

In index.php, I correct the following line:

if (is_file($filename)) {

to:

if (is_file($backup_filename)) {

However, I couldn't get index.php to pick up the underlying CSS files (genstyle.css and mytngstyle.css).

Has anyone actually gotten this to work? Can someome tell me what I have to change?

Jerry

Just copy the .css you use to the 'living' directory. I gave up trying to make it look for them in another folder.

That way you'll the get visual look back to what you want.

I'm also still using .91r never could never get the newer version to work consistently using my TNG user name and password.

Scotty

Link to comment
Share on other sites

  • 6 months later...

Ben,

Does this still work in version 7.x?

Thanks,

Arnold

Version 1.0 (BETA) release

I need testers please.

Ok, this should help the window server folks. The scripts will now use the TNG login system. Hope this helps. It also stores the backup data in a php file composed of an array, not a "flat" file.

--UPGRADE INSTRUCTIONS

DELETE everything, start over! :)

~Ben

Link to comment
Share on other sites

Ben,

Does this still work in version 7.x?

Thanks,

Arnold

Hey Arnold,

I don't know. I haven't had the necessary time and funds to upgrade and test. Maybe someone else can comment.

Sorry,

~Ben

Link to comment
Share on other sites

Hi Ben,

Thank you for your quick reply.

Let me ask you a different question. I forget where your files are placed. Please advise and I will not bug you anymore.

Appreciate it,

Arnold

P.S. Your program is wonderful. I have nearly a hundred living folks I have to "hide" after each import. Your program saves me so much time since it "hides" them just about automatically.

Link to comment
Share on other sites

Let me ask you a different question. I forget where your files are placed. Please advise and I will not bug you anymore.

[snip]

P.S. Your program is wonderful. I have nearly a hundred living folks I have to "hide" after each import. Your program saves me so much time since it "hides" them just about automatically.

Hey Arnold,

If you mean for downloading, they are attached to this thread a page or so back. Otherwise, I'm not sure what your asking.

Thanks for the compliment. The program is actually in need of a make over. I wrote it when I had only a little knowledge of PHP.

If I can help any, feel free to email at: thewag |at| wagners [.] homeip [.] net

Link to comment
Share on other sites

Hey Arnold,

If you mean for downloading, they are attached to this thread a page or so back. Otherwise, I'm not sure what your asking.

Thanks for the compliment. The program is actually in need of a make over. I wrote it when I had only a little knowledge of PHP.

If I can help any, feel free to email at: thewag |at| wagners [.] homeip [.] net

I have updated the TNG Wiki article on Backup / Restore Living Flag to add the Download links.

Ben, feel free to update the TNG Wiki Article. I have been using your script since you provided it and now maintain over 1600 manually set living flags.

Link to comment
Share on other sites

  • 4 months later...

I have updated the TNG Wiki article on Backup / Restore Living Flag to add the Download links.

Ben, feel free to update the TNG Wiki Article. I have been using your script since you provided it and now maintain over 1600 manually set living flags.

Does anyone have the Backup / Restore Living Flags scripts working in a Windows WampServer environment? Windows does not seem to like the .htaccess password and keeps returning the password prompt. I never worried about the Backup / Restore Living Flags on my previous WampServer environment, but I am trying to get it as close to my production site as possible.

TIA

Link to comment
Share on other sites

Does anyone have the Backup / Restore Living Flags scripts working in a Windows WampServer environment? Windows does not seem to like the .htaccess password and keeps returning the password prompt. I never worried about the Backup / Restore Living Flags on my previous WampServer environment, but I am trying to get it as close to my production site as possible.

TIA

message #27 a year back I mentioned this....

And I was never able to get the version 1.0 to work either....

Scotty

Link to comment
Share on other sites

message #27 a year back I mentioned this....

And I was never able to get the version 1.0 to work either....

Scotty

Hi Scotty,

I tried to install version 0.9r1 but it won't display the index page unless I protect the page, but then it won't let me login. So I don't think it is related to version 1.0 necessarily. So I tried to install version 0.8r1 but have issues here as well.

Do you have 0.9r1 working with the protection turned on? Of course it may be Vista Home Premium 64-bit causing me problems as well.

Link to comment
Share on other sites

Hi Scotty,

I tried to install version 0.9r1 but it won't display the index page unless I protect the page, but then it won't let me login. So I don't think it is related to version 1.0 necessarily. So I tried to install version 0.8r1 but have issues here as well.

Do you have 0.9r1 working with the protection turned on? Of course it may be Vista Home Premium 64-bit causing me problems as well.

Ken,

yup... tried that.... the index loads and if I try to run the backup I get this error.

Backing Up Living Flags....
Return to Main Menu\n"); die ("Couldn't open file ($filename)"); } $Query = "SELECT gedcom, personID, lastname, firstname, birthdate FROM $people_table WHERE `living` = '1' ORDER BY `lastname` ASC , `firstname` ASC"; $Result = mysql_db_query ($database_name, $Query, $Link); if (!$Result) { echo("Error performing query: ".mysql_error()."
\n"); echo ("Return to Main Menu\n"); die(); } echo("\n"); echo("\n"); $tmpCount=1; echo("\n"); while ($tmp = mysql_fetch_array ($Result)) { echo("\n"); $tmpCount++; $tmp_fwrite="$tmp[0]|+|$tmp[1]|+|$tmp[2]|+|$tmp[3]|+|$tmp[4]\n"; if (fwrite($fp, $tmp_fwrite) === FALSE) { echo "Cannot write to file ($filename)"; echo ("Return to Main Menu\n"); die(); } } echo("
Living Number    Gedcom | Person ID    Name    Date of Birth
$tmpCount    $tmp[0] | $tmp[1]    $tmp[2], $tmp[3]    $tmp[4]
"); fclose($fp); echo ("Return to Main Menu\n"); } else { echo("There was an error connecting to the database.
\n"); echo ("Return to Main Menu\n"); die(); } tng_footer(""); ?>
oh and I'm running XP Pro SP3, so I doubt it is the OS causing problems. and for comparisons sake here is the code I changed in index.php:
//if ((file_exists(".htaccess")) || (file_exists(".htpasswd"))) {
    echo ("<h2>Please select one of the following.</h2>\n");
    echo ("<ul>\n");
    echo ("<li><a href=\"{$doc_root}backup.php\">Backup Living Flags</a> - <i><b>This will overwrite the previous backup</b></i></li>\n");
    if (is_file($filename)) {
        echo ("<li><a href=\"{$doc_root}restore.php\">Restore Living Flags</a> - <i><b>This restore cannot be undone.  Please backup before using.</b></i></li>\n");
    } else {
        echo ("<li>Restore Living Flags - This item will be available when a backup file can be found.</li>\n");
    }
    echo ("<br>\n");
    echo ("<li><a href=\"{$doc_root}unprotectthisfolder.php\">Delete Security Files</a> - Remove the files that protect this directory from general viewing.  You will need to rerun the directory protection script to continue using this script.</li>\n");
    echo ("</ul>\n");
// else {
//    echo("<b><i>For security of your site, please run this <a href=\"{$doc_root}protectthisfolder.php\">directory protection script</a>.</i></b>\n");
//}

I played with $doc_root and couldn't find a setting that worked either.

don't know what to say....

Scotty

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...