function getData($name, $nombre1, $integrador, $producto) { $dataArray = ""; $fecha = date('H'); $dia = date('d', strtotime("+1 day")); try { $conexion = new MySQL(0); $query0 = ' select hour(date_add(NOW(), INTERVAL -' . HOURDB . ' hour));'; $result0 = $conexion->consulta($query0); $exec0 = $conexion->fetch_row($result0); $fecha = $exec0[0]; $query = 'CALL GetProductChargeToday("' . strtolower($name) . '",' . HOURDB . "," . $integrador . ',' . $producto . ');'; $result = $conexion->consulta($query); $conexion->prepareNextResult(); $query1 = 'CALL GetProductChargeYesterday("' . strtolower($name) . '",' . HOURDB . "," . $integrador . ',' . $producto . ');'; $result1 = $conexion->consulta($query1); $conexion->prepareNextResult(); $query2 = 'CALL GetProductChargeProm("' . strtolower($name) . '",' . HOURDB . "," . $integrador . ',' . $producto . ');'; $result2 = $conexion->consulta($query2); $conexion->prepareNextResult(); if (!$result or !$result1 or !$result2) { throw new Exception("No se logro obtener informacion de cobros....\n"); } else { $cont = 0; $hoy = $conexion->fetch_row($result); $ayer = $conexion->fetch_row($result1); $prom = $conexion->fetch_row($result2); while ($cont <= $fecha) { if ($ayer[1] == $cont) { $valor = $ayer[0]; $ayer = $conexion->fetch_row($result1); } else { $valor = 0; } if ($hoy[1] == $cont) { $valor1 = $hoy[0]; $hoy = $conexion->fetch_row($result); } else { $valor1 = 0; } if ($prom[0] == $cont) { $valor2 = $prom[1]; $prom = $conexion->fetch_row($result2); } else { $valor2 = 0; } $dataArray = $dataArray . "data1.addRow([" . $cont . ", " . $valor2 . "," . $valor . ", " . $valor1 . "]);\n"; $cont++; } } $conexion->MySQLClose(); } catch (Exception $e) { echo 'Excepcion capturada: ', $e->getMessage(), "\n"; } return $dataArray; }
function GoHome() { $conexion = new MySQL(0); $query = 'call GetHomeURL(' . $_SESSION['pais'] . ');'; $result1 = $conexion->consulta($query); $row = $conexion->fetch_row($result1); $conexion->MySQLClose(); switch ($_SESSION['access']) { case 1: case 2: case 3: $home = 'http://' . URL . DS . 'dashboard' . DS . 'metricas'; break; default: $home = 'http://' . URL . DS . $row[0]; break; } return $home; }
function GetSecondLevel($carrier, $al) { $conexion1 = new MySQL(0); if ($_SESSION['access'] == 5) { $query = 'call GetSubMenuLimits(' . $carrier . ');'; } else { $query = 'call GetSubMenu(' . $carrier . ');'; } $result = $conexion1->consulta($query); $miniBody = ''; while ($link = $conexion1->fetch_row($result)) { $urlC = $link[2] == 1 ? 'http://' . URL . DS . $link[0] : $link[0]; $IamHere = $al == $urlC ? 'class="active""' : ''; if ($link[2] == 1) { $miniBody = $miniBody . "\t\t\t\t\t\t\t" . '<li ' . $IamHere . '><a href="' . $urlC . '">' . $link[1] . '</a></li>' . "\n"; } else { $miniBody = $miniBody . "\t\t\t\t\t\t\t" . '<li ><a href="' . $urlC . '" target="_blank">' . $link[1] . '</a></li>' . "\n"; } } $conexion1->MySQLClose(); return $miniBody; }
if (!$combo) { throw new Exception("No se logro obtener informacion de cobros....\n"); } else { if ($integrador == 0) { echo "<option value='' selected>Integrador</option>"; } while ($dato = $conexion->fetch_row($combo)) { if ($integrador == $dato[0]) { $tituloG = $dato[1]; echo '<option value=' . $dato[0] . ' selected>' . $dato[1] . '</option>'; } else { echo '<option value=' . $dato[0] . '>' . $dato[1] . '</option>'; } } } $conexion->MySQLClose(); } catch (Exception $e) { echo 'Excepcion capturada: ', $e->getMessage(), "\n"; } ?> </select> </div> </div> </form> </div> </div> <!-- end panel --> <!-- BEGIN CarrierD_I --> <div class="panel panel-inverse" data-sortable-id="ui-buttons-2"> <div class="panel-heading">
function disable() { if (isset($_POST["usuario"]) and $_POST["usuario"] != '') { $conexion = new MySQL(0); $strIngreso = "update usuario set estatus = 'Baja' where Id_usuario = '" . $_POST["usuario"] . "';"; $value = $conexion->consulta($strIngreso); $conexion->MySQLClose(); $_SESSION['value'] = 'El usuario fue dado de baja.'; session_write_close(); exit(header('Location: http://' . URL . DS . 'dashboard' . DS . 'start')); } else { $_SESSION['value'] = "error"; session_write_close(); exit(header('Location: http://' . URL . DS . 'usuario' . DS . 'delete')); } }
function save_g() { if (isset($_POST["carrier"]) and isset($_POST["host"]) and isset($_POST["esquema"]) and isset($_POST["tabla"]) and isset($_POST["campo"]) and isset($_POST["cond"]) and $_POST["carrier"] != '' and $_POST["host"] != '' and $_POST["esquema"] != '' and $_POST["tabla"] != '' and $_POST["campo"] != '' and $_POST["cond"] != '') { $conexion = new MySQL(0); $strIngreso = "\tinsert into billing.cobro_carrier (id_cobro_carrier,id_carrier,id_base,esquema,tabla,condicion,estatus,field_sum)\r\n\t\t\t\t\t\t\t\t\tvalues (null," . $_POST["carrier"] . "," . $_POST["host"] . ",'" . $_POST["esquema"] . "','" . $_POST["tabla"] . "','" . $_POST["cond"] . "',1,'" . $_POST["campo"] . "');"; $value = $conexion->consulta($strIngreso); $conexion->MySQLClose(); $_SESSION['value'] = "ok"; session_write_close(); exit(header('Location: http://' . URL . DS . 'database' . DS . 'generate')); } else { exit(header('Location: http://' . URL . DS . 'database' . DS . 'generate')); } }
function getData($name, $num) { $dataArray = ""; $fecha = date('H', strtotime("+1 Hours")); $dia = date('d', strtotime("+1 day")); try { $conexion = new MySQL(0); $query0 = ' select hour(date_add(NOW(), INTERVAL -' . HOURDB . ' hour));'; $result0 = $conexion->consulta($query0); $exec0 = $conexion->fetch_row($result0); $fecha = $exec0[0]; $query = 'CALL GetCarrierChargeToday("' . strtolower($name) . '",' . HOURDB . ');'; $result = $conexion->consulta($query); $conexion->prepareNextResult(); $query1 = 'CALL GetCarrierChargeYesterday("' . strtolower($name) . '",' . HOURDB . ');'; $result1 = $conexion->consulta($query1); $conexion->prepareNextResult(); $query2 = 'CALL GetCarrierChargeProm("' . strtolower($name) . '",' . HOURDB . ');'; $result2 = $conexion->consulta($query2); $conexion->prepareNextResult(); if (!$result or !$result1 or !$result2) { throw new Exception("No se logro obtener informacion de cobros....\n"); } else { $cont = 0; @($hoy = $conexion->fetch_row($result)); @($ayer = $conexion->fetch_row($result1)); @($prom = $conexion->fetch_row($result2)); while ($cont <= $fecha) { if ($ayer[1] == $cont and $ayer[1] != '') { @($valor = $ayer[0]); @($ayer = $conexion->fetch_row($result1)); } else { $valor = 0; } if ($hoy[1] == $cont and $hoy[1] != '') { @($valor1 = $hoy[0]); @($hoy = $conexion->fetch_row($result)); } else { $valor1 = 0; } if ($prom[1] == $cont and $prom[1] != '') { @($valor2 = $prom[0]); @($prom = $conexion->fetch_row($result2)); } else { $valor2 = 0; } $dataArray = $dataArray . "data" . $num . ".addRow([" . $cont . ", " . number_format($valor2, 0, '', '') . ", " . $valor . " , " . $valor1 . "]);\n"; //$dataArray = $dataArray."data1.addRow([".$cont.", ".$valor2.",".$valor.", ".$valor1."]);\n"; $cont++; } /*while ($hoy = $conexion->fetch_row($result)){ if( @$ayer = $conexion->fetch_row($result1) and @$prom1 = $conexion->fetch_row($result2)){ if($hoy[0] == ''){$hoy[0] = 0;} if($ayer[0] == ''){$ayer[0] = 0;} if($prom1[0] == ''){$prom1[0] = 0;} $dataArray = $dataArray."data".$num.".addRow([".$hoy[1].", ".number_format($prom1[0],0,'','').", ".$ayer[0]." , ".$hoy[0]."]);\n"; } }*/ } $conexion->MySQLClose(); } catch (Exception $e) { echo 'Excepcion capturada: ', $e->getMessage(), "\n"; } return $dataArray; }
function disable() { if (isset($_POST["key"]) and isset($_POST["key2"])) { $conexion = new MySQL(0); $strIngreso = "update usuario set status = '" . $_POST["key2"] . "' where Id_usuario = '" . $_POST["key"] . "';"; $value = $conexion->consulta($strIngreso); $conexion->MySQLClose(); $_SESSION['value'] = 'El usuario fue dado de baja.'; session_write_close(); echo 'http://' . URL . DS . 'usuario' . DS . 'delete'; //exit(header( 'Location: http://'.URL.DS.'superagregador'.DS.'delete')); } else { $_SESSION['value'] = "error"; session_write_close(); echo 'http://' . URL . DS . 'usuario' . DS . 'delete'; //exit(header( 'Location: http://'.URL.DS.'superagregador'.DS.'delete')); } }
function GetCharges($db_selection, $query, $opt, $SaveAction) { if (isset($db_selection) and isset($query)) { try { $conectorLocal1 = new MySQL(0); $dbdata = "call GetDBKey(" . $db_selection . ");"; $exec = $conectorLocal1->consulta($dbdata); $conectorLocal1->prepareNextResult(); $result = $conectorLocal1->fetch_row($exec); self::MySQLExternal($result[1], $result[2], $result[3], $this->schema); if (!$this->ErrorExternalConector) { $execute = self::externalQuery($query); $i = 0; while ($row = self::externalfetch_row($execute)) { switch ($opt) { case 1: $LoadCant = 0; if ($row[0] != "") { $LoadCant = $row[0]; } self::AddBodyLog("Cobros generados: " . $LoadCant); self::AddBodyLog("Enviando a guardar informacion..........."); self::SaveCharges($row, $opt, $SaveAction); break; case 2: self::AddBodyLog("Cobros generados para " . $row[1] . ": " . $row[2]); self::AddBodyLog("Enviando a guardar informacion..........."); self::SaveCharges($row, $opt, $SaveAction); $i++; break; case 3: $LoadCant = 0; if ($row[0] != "") { $LoadCant = $row[0]; } $dbdata = "call GetAVGChargesPerCarrier(" . $this->id_carrier . ",2);"; $exec = $conectorLocal1->consulta($dbdata); $result = $conectorLocal1->fetch_row($exec); $info[0] = $row[0]; $info[1] = $result[0]; self::AddBodyLog("Obteniendo Promedio de cobros " . $dbdata . ": " . $result[0]); self::AddBodyLog("Cobros generados: " . $LoadCant); self::AddBodyLog("Enviando a guardar informacion..........."); self::SaveCharges($info, $opt, $SaveAction); break; case 4: self::AddBodyLog("Cobros generados para " . $row[2] . ": " . $row[3]); self::AddBodyLog("Enviando a guardar informacion..........."); self::SaveCharges($row, $opt, $SaveAction); $i++; break; break; } } if ($opt == 2) { self::AddBodyLog("Integradores Procesados: " . $i); } if ($opt == 4) { self::AddBodyLog("Productos Procesados: " . $i); } } $conectorLocal1->MySQLClose(); } catch (Exception $e) { self::AddBodyLog("No se logro obtener la informacion de " . $this->carrier_name . " Validar conexion a Base de datos!!!!!!!!!!!!!!!"); self::AddBodyLog("Trace " . $this->ErrorExternalConector); } } }
public static function getlogged($name) { $conexion = new MySQL(0); $query = "select logged, date_logged,session_id,now() as fe from usuario where usuario = '{$name}'"; $result1 = $conexion->consulta($query); $valor = $conexion->num_rows($result1); if ($valor == 1) { $row = $conexion->fetch_row($result1); $value1 = $row[0]; $value2 = $row[1]; $value3 = $row[2]; $ahora = $row[3]; $tiempo_transcurrido = strtotime($ahora) - strtotime($value2); if ($tiempo_transcurrido >= 875) { $query = "update usuario set logged = 0, date_logged = now() where usuario = '{$name}';"; $result1 = $conexion->consulta($query); $value1 = 0; } else { if (isset($_COOKIE['billing'])) { if ($_COOKIE['billing'] == $value3) { $query = "update usuario set logged = 0, date_logged = now(),session_id = '' where usuario = '{$name}';"; $result1 = $conexion->consulta($query); setcookie('billing', null, -1, '/'); $value1 = 0; } } else { if ($value1 != 0) { $value1 = 1; } } } if ($value1 == 1) { $return = "islogged"; } else { $return = "notlogged"; } $conexion->MySQLClose(); return $return; } else { $conexion->MySQLClose(); return "not.found"; } }
private function GetArrayInfo($option, $mensaje) { $conexion = new MySQL(0); $query = "call GetDescriptionInfo('" . $option . "');"; $exec = $conexion->consulta($query); $row2 = $conexion->fetch_row($exec); $return = array("Titulo" => "Billing Vas Pass", "mensaje" => $mensaje, "name1" => strtolower($row2[0]), "data1" => "", "pais" => $row2[1], "schema" => $row2[2], "bd_id" => $row2[3]); $conexion->MySQLClose(); return $return; }