include "../translate/lang/en.php"; include "../translate/lang/{$langpref}"; error_reporting(0); session_start(); include "custom.class.php"; $mysql_database = $_SESSION['db']; $dbconn = mysql_connect($_SESSION['server'], $_SESSION['username'], $_SESSION['password']) or die; mysql_select_db($mysql_database); $proceed = mysql_query("SELECT name\r\nFROM APP\r\nWHERE value LIKE '4.6%' OR value LIKE '4.7%'"); $proceed = mysql_fetch_assoc($proceed); if ($proceed['name']) { $date_time = date("m-d-Y"); $Export_FileName = $mysql_database . '_' . $date_time . '.sql'; $myFile = "upgrade.sql"; executeSQL($myFile); backup_db($mysql_database, $Export_FileName); $res_student_field = 'SHOW COLUMNS FROM STUDENTS WHERE FIELD LIKE "CUSTOM_%"'; $objCustomStudents = new custom($mysql_database); $objCustomStudents->set($res_student_field, 'STUDENTS'); $res_staff_field = 'SHOW COLUMNS FROM STAFF WHERE FIELD LIKE "CUSTOM_%"'; $objCustomStaff = new custom($mysql_database); $objCustomStaff->set($res_staff_field, 'STAFF'); mysql_query("drop database {$mysql_database}"); mysql_query("create database {$mysql_database}"); mysql_select_db($mysql_database); #$myFile = "opensis-4.5-schema-mysql.sql"; #$myFile = "opensis-4.7-schema-mysql.sql"; $myFile = "opensis-4.8-schema-mysql.sql"; executeSQL($myFile); //execute custome field for student foreach ($objCustomStudents->customQueryString as $query) {
<?php $tpl = new bQuickTpl(); $tpl->page_title = "Admin Panel - Backup & Restore"; if (!isset($_SESSION['admin_user_id'])) { header("Location: " . _admin_url . "/login"); exit; } //get contents of backup folder $backup_files = directory_contents(getcwd() . "/config/backup_restore", "sql"); //pr($params); if (isset($params[2]) && $params[2] == 'backup') { $backup = backup_db($database); if ($backup) { header("Location: " . _admin_url . "/backup_restore/success/backup"); } else { header("Location: " . _admin_url . "/backup_restore/error/backup"); } } if (isset($params[2]) && $params[2] == 'restore') { $restore = restore_db($database); if ($restore) { header("Location: " . _admin_url . "/backup_restore/success/restore"); } else { header("Location: " . _admin_url . "/backup_restore/error/restore"); } } $tpl->backup_files = $backup_files; include getcwd() . "/modules/adminarea/common.php"; echo $tpl->render("themes/adminarea/html/backup_restore.php");
dbn("delete from user_accounts where signed_up <= '{$time_to_del_from}' && session_exp = 0 && login_id > 5 && login_count = 0"); $final_str .= "\n<br />" . mysql_affected_rows() . " unauthorised user accounts deleted...<br />"; //change AI passwords daily. Wouldn't do to have someone get access to them. $p_pass = md5(create_rand_string(50)); dbn("update user_accounts set passwd = '{$p_pass}' where login_id = '2' || login_id = 3 || login_id = 4 || login_id = 5"); $final_str .= "\n<br />Special accounts pass changed...<br />"; //delete user history older than 3 weeks. dbn("delete from user_history where timestamp < " . time() . "-1814400"); $final_str .= "\n<br />" . mysql_affected_rows() . " old rows from the user_history deleted...<br />"; //delete posts to the central forum that are older than 3 weeks. dbn("delete from se_central_messages where timestamp < " . time() . "-1814400"); $final_str .= "\n<br />" . mysql_affected_rows() . " messages from the central forum were deleted...<br />"; print_time(); //backup the DB if requested. & delete old files if ($make_database_backups == 1) { backup_db(); print_time(); delete_old_backups($max_num_db_backups, "_db_backup"); print_time(); } //build a new index of the stylesheets directory. build_ss_index(); print_time(); dbn("update se_central_table set last_ran_s_maint = '" . time() . "'"); //print that maint was run, and how long it took. $end_time = explode(" ", microtime()); $end_time = $end_time[1] + $end_time[0]; $total_time = $end_time - $maint_time; $final_str .= "\n<p>... All done in {$total_time} seconds.<br />\n"; return 1; /******************************* Functions *********************************/