| Handle the incoming request | through our class, and send the associated response back to | the client's browser allowing them to enjoy the creative | and wonderful application we have prepared for them. | */ $path = mt\Http\Requests::capture(); /* * If we have the users URL ? * we can now load the right page for our friend * */ if (isset($path)) { $page = mt\pages::getPage($path, 'public', 'home'); } $row_count = row_count($dbc); ?> <!DOCTYPE html> <html> <head> <title><?php echo $site_title . ' | ' . $page->pagetitle; ?> </title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="<?php echo $page->metadesc; ?> "> <link rel="stylesheet" href="<?php
function activate_user() { if ($_SERVER['REQUEST_METHOD'] == 'GET') { if (isset($_GET['email'])) { $email = clean($_GET['email']); $validation_code = clean($_GET['code']); // Check to see if we have a row in the db if we do then we will activate $sql = "SELECT id FROM users WHERE email = '" . escape($email) . "' AND validation_code = '" . escape($validation_code) . "' "; $result = query($sql); confirm($result); if (row_count($result) == 1) { $sql2 = "UPDATE users SET active = 1, validation_code = 0 WHERE email = '" . escape($email) . "' AND validation_code = '" . escape($validation_code) . "' "; $result2 = query($sql2); confirm($result2); set_message("<p class='bg-sucsess>Your account has been activated please login</p>"); // redirect("login.php"); } else { set_message("<p class='bg-danger'>Sorry your account has not been activated, please try again</p>"); } } } }
function add_document($tbl, $link, $name_db_new, $name_db_old, $meta_data_tbl) { $data = search_all($tbl, $link, $name_db_old); $meta_data_tbl = array_filter($meta_data_tbl); $fields_documento = $meta_data_tbl['is_document']; $cantidad = ceil(row_count($tbl, $link, $name_db_old) / $fields_documento['num_consultas']); unset($meta_data_tbl['is_document']); unset($meta_data_tbl['num_consultas']); $offsets = 0; for ($i = 0; $i < $fields_documento['num_consultas']; $i++) { $datos = search_limit($tbl, $link, $name_db_old, $where, $offsets, $cantidad); //foreach sobre datos $rows = ""; foreach ($data as $keys => $fila) { $row = null; //foreach sobre columnas $columnas_new = null; foreach ($fila as $cols => $va) { $isset = in_array($cols, array_keys($fields_documento)); //obtiene campos que se deben ingresar en documentos if ($isset) { $columnas_new .= $fields_documento[$cols] . ","; //normaliza datos para tabla if ($cols == "Producto") { //si la columna es Producto cambia los id (relaciones) $tbl = 'producto'; $where = "codigo___prd='{$va}'"; $ids = 'id_______prd'; $new_value = search($tbl, $link, $name_db_new, $where, $ids); //busca categorias if (isset($new_value[0][$ids])) { $va = $new_value[0][$ids]; } else { $va = 0; //si no lo encuentra, cambia el valor por cero } } $row .= "'" . trim($va) . "',"; } } $row = rtrim($row, ','); $rows .= "(" . $row . "),"; } $rows = rtrim($rows, ','); $columnas_new = rtrim($columnas_new, ','); print_r($rows); $tbl = 'documento'; //cambia la tabla para realizar la inserción print_r(insert($link, $name_db_new, $tbl, $columnas_new, $rows)); $offsets = $offsets + $cantidad; //paginador de registros } //obtiene columnas $columnas_new = NULL; $columnas_old = NULL; foreach ($meta_data_tbl as $key => $value) { $columnas_old .= $key . ","; $columnas_new .= $value . ","; $fields_for_insert[] = $key; } $columnas_old = rtrim($columnas_old, ","); $columnas_new = rtrim($columnas_new, ","); }
xdebug_disable(); } include 'functions.php'; gc_enable(); $link = mysqli_connect("localhost", "root", "tinto", "tintoreriaCI") or die("No se pudo conectar a base de datos: " . mysqli_error($link)); $link->query("set foreign_key_checks=0"); $tiempo_inicio = microtime(true); $db_old = "tintoreria"; $db_new = "tintoreriaCI"; /*master_maquina*/ $table_old = "master_maquina"; $table_new = "maquinaria"; $num_querys = 2; $relations = ['Nombre' => 'nombre___maq', 'Capacidad' => 'capacidadmaq', 'Hora' => null, 'Minutos' => null, 'Jornada' => null, 'Dispon' => null]; $count_old = row_count($table_old, $link, $db_old); $count_new = row_count($table_new, $link, $db_new); $offsets = 0; $cantidad = ceil($count_old / $num_querys); for ($i = 0; $i < $num_querys; $i++) { $asd = search_limit($table_old, $link, $db_old, $offsets, $cantidad); $offsets = $offsets + $cantidad; } print_r($asd); /*fim master_maquina*/ /*mantencion*/ /*fin mantencion*/ $tiempo_fin = microtime(true); echo "<br>Tiempo empleado: " . ($tiempo_fin - $tiempo_inicio); echo "<br>Memory Peak Usage: "; echo memory_get_peak_usage(), "\n"; $link->query("set foreign_key_checks=1");