Note:
First I want to Thank you to Frederic Cloquell (Bramsyur) - sNews1.6 mod.
With this mod you can do:
- Backup your database and will be sent a copy to your e-mail
- Restore your database when it was damage
- Apply a cron job to save database everytime you want
#BACKUP
$l['t_dir_backup'] = 'Folder to backup files';
$l['t_dbbackup'] = 'Database Backup';
$l['t_dbbackup_info'] = 'Please, verify or moddify the e-mail that your want to be used to get the database backup file.<br />';
$l['t_dbbackup_name'] = 'Database name';
$l['t_dbbackup_email'] = 'E-mail to send your created backup';
$l['t_backup'] = 'Backup now';
$l['t_system_mail'] = 'System DB-Backup';
$l['t_dbb_subject'] = 'MySQL Backup';
$l['t_dbb_message'] = 'MySQL Backup created successfully.';
$l['db_backup_directory'] = 'Currently Backup Files';
$l['db_no_files_found'] = 'No files found!';
$l['dbbackup'] = 'Admin MySQL Backup';
#DATABASE CONFIGURATION
function db2($variable) {
$db = array(
'dbhost' => 'localhost', // MySQL host
'dbname' => 'database',
'dbuname' => 'username', // Database Username
'dbpass' => 'password', // Database password
'prefix' => '' // Table prefix
); return $db[$variable];
}
// CONSTANTS
define('SECURE_ID','12345');
define('USERNAME', 'admin');
define('PASSWORD',md5('test').date('d-m-YH'));
define('_PRE',db2('prefix'));
define('pw','password'); // plain password to auto backup
After this save file and copy to your root domain or where you have snews.php
Change permitions to chmod 777
If you use coreftp make a right click on backups folder and choose properties, like this pictures

INSERT INTO `settings` (name, value) VALUES ('dir_db', '');

include_once('dbbackup.php');
case 'snews_settings': settings(); return; break;
case 'dbbackup': dbbackup(); return; break;
echo '<p><a href="snews_settings/">'.l('settings').'</a></p>
<p><a href="dbbackup/" title="'.l('t_dbbackup').'">'.l('t_dbbackup').'</a></p>
<p><a href="snews_files/">'.l('files').</a></p></fieldset></div>
case 'dbbackup_start': case_dbbackup(); break;
case 'hide':
case 'show':
# AFTER TO GET THIS INFORMATION COMMENT OUT OR ERASE NEXT LINES
// START CRON INFO
if ($_GET['task']=='cron'){
$path = $_ENV['DOCUMENT_ROOT'].$_SERVER['SCRIPT_NAME'];
$path = str_replace('dbbackup.php','',$path);
$cron = 'cd ''.$path.'' ; php -q 'dbbackup.php' '?' 'task=auto' 'pw='.pw.'' ; > /dev/null ;';
echo $cron;
}
// END CRON INFO



Rui,
Thanks, I'll add this to my next sNews template.
Poppoll
PS Have a look @ http://mdj.us/snews-cms/themes-templates/admin-styles-for-snews-17/
for a better snews style! (the website url is to short!!)
Under construction
Under construction
Write a comment
* = required field