13); $_result['visibility'] = array(); $_initialvars = arrayExclude(get_defined_vars(), array("_*", "form_*", "s_*", "GLOBALS", "Link", "thisname")); } // isbasewindow: // On Open while( ($__action == "" or $__action == "executedonopen") and (empty($_x) or in('onopen', $_x)) ) { $__action = "executedonopen"; if( $server == "" ) { $server = $argv[1]; } $cfgfile = "servers/$server.cfg"; $slaves = readProperty($cfgfile, "replicate_slaves"); $tables = readProperty($cfgfile, "replicate_tables"); $aslaves = StringTokenize($slaves, ','); $atables = StringTokenize($tables, ','); print("slaves: "); print_r($aslaves); print("tables:"); print_r($atables); $host = $server; $dbname = readProperty($cfgfile, "dbname", ""); $dbuser = readProperty($cfgfile, "dbuser", ""); $dbpassword = readProperty($cfgfile, "dbpassword", ""); $Link2 = mysql_connect($host, $dbuser, $dbpassword, true) or die ("ERROR: Cant connect to database $dbname at $server with user $dbuser"); mysql_select_db($dbname, $Link2); print("

Master $server

"); // Tabla rplog print("

rplog table

"); if( istable($Link2, "rplog") ) { print("Already"); } else { print("Creating ..."); sqlexec($Link2, "create table rplog(id int not null auto_increment, fecha timestamp, modo char(1), tabla varchar(100), idregistro int, primary key(id))"); print("OK"); } print("
"); // Triggers print("

Triggers

"); foreach($atables as $table) { print("$table
"); print("Insert trigger... "); $sql = "DROP TRIGGER IF EXISTS {$table}_insert_after"; sqlexec($Link2, $sql); $sql = "create trigger {$table}_insert_after after insert on $table for each row begin insert into rplog(tabla, modo, idregistro) values('$table', 'I', new.id); end;"; sqlexec($Link2, $sql); print("OK
"); $sql = "DROP TRIGGER IF EXISTS {$table}_update_after"; sqlexec($Link2, $sql);print("Update trigger... "); $sql = "create trigger {$table}_update_after after update on $table for each row begin insert into rplog(tabla, modo, idregistro) values('$table', 'U', new.id); end;"; sqlexec($Link2, $sql); print("OK
"); $sql = "DROP TRIGGER IF EXISTS {$table}_delete_after"; sqlexec($Link2, $sql);print("Update trigger... "); print("Delete trigger... "); $sql = "create trigger {$table}_delete_after after delete on $table for each row begin insert into rplog(tabla, modo, idregistro) values('$table', 'D', old.id); end;"; sqlexec($Link2, $sql); print("OK
"); } // Si puso header location para ir a otra pagina cierra el script if( !isset($_x) and $__exiting ) { disconnectDb($Link); exit(0); } break; } // PHP Vars while( ($__action == "" or $__action == "executedonopen") and isset($_GET['_x']) and empty($_x) ) { $__row0 = array(); $_result['morevars'] = $__row0; break; } if( has($_x, 'pdf') or has($_x, 'pdfprint') or has($_x, 'pdfprint2') ) { require_once('../include/fpdfreport.php'); $_pdf = new PDF((isset($_orientation) ? $_orientation : 'P'),'pt', (isset($_size) ? $_size : 'A4' )); $_pdf->initialPage = ($_page != '' ? $_page : 1); //$_pdf->SetAutoPageBreak(true); $_pdf->title = ""; $_pdf->SetTopMargin(50); $_pdf->AliasNbPages(); $_pdf->AddPage(); } if( has($_x, 'pdf') or has($_x, 'pdfprint') or has($_x, 'pdfprint2') ) { $_pdf->Output(); } ?> '); //echo(''); echo(''); ?> class="popup" >