function __destructor() { Disconnect(); }
function FMain() { global $argc, $argv, $__VERSION__, $__FILENAME__; // If run program without any parameters show usage if ($argc === 1) { FVer(1); die; } else { //ELSE // Initize $arrpos_u = 0; $arrpos_r = 0; $arrpos_d = 0; $arrpos_v = 0; $arrpos_h = 0; // Found parameters for ($i = 1; $i < $argc; $i++) { if ($argv[$i] == "-u") { $arrpos_u = $i; } if ($argv[$i] == "-r") { $arrpos_r = $i; } if ($argv[$i] == "-d") { $arrpos_d = $i; } if ($argv[$i] == "-v") { $arrpos_v = $i; } if ($argv[$i] == "-h") { $arrpos_h = $i; } } //echo ("$arrpos_d\t$arrpos_u\t$arrpos_r\t$arrpos_v\t$arrpos_h\n"); // Show version and help first if ($arrpos_h > 0) { FVer(1); die; } if ($arrpos_v > 0) { FVer(0); die; } // Check parameters if ($arrpos_d == 0) { if ($arrpos_u == 0 || $arrpos_r == 0) { FVer(1); die; } } else { if ($arrpos_u == 1 || $arrpos_r == 1) { FVer(1); die; } } // Disconnect First if ($arrpos_d > 0) { Disconnect(); die; } // Get Username and Password $username = $argv[$arrpos_u + 1]; $rsakey = $argv[$arrpos_r + 1]; // Print Version FVer(0); // Dialing and Watchdog while (true) { // Start Dial DialUp($username, $rsakey); // Watchdog Watchdog(); } } }
Query("delete from carrera where carr_codigo = '" . $codigo . "'"); Disconnect(); //* echo "<script type=\"text/javascript\">\n\t\t\t\t\talert(\"Se ha borrado exitosamente\");\n\t\t\t\t\twindow.location.href=\"../index.php\"\n\t\t\t\t</script>"; //*/ } catch (Exception $e) { echo "Message: " . $e->getMessage(); } } elseif (isset($_POST['modificar'])) { try { Connect(); $codigo = $_POST["codigo"]; $nombre = $_POST["nombre"]; $categoria = $_POST["categoria"]; $fecha = $_POST["fecha"]; $numCarr = $_POST["numCarr"]; $lote = $_POST["lote"]; $distancia = $_POST["distancia"]; $variante = $_POST["variante"]; $pista = $_POST["pista"]; $inicio = $_POST["inicio"]; $dia = $_POST["dia"]; Query("update carrera set carr_nombre='" . $nombre . "',carr_categoria='" . $categoria . "',carr_fecha=to_date('" . $fecha . "','yyyy-mm-dd'),carr_num_carrera=" . $numCarr . ",carr_lote='" . $lote . "',carr_distancia=" . $distancia . ",carr_variante=" . $variante . ",fk_pist=" . $pista . ",fk_hora=(select hora_codigo from hora where hora_inicio='" . $inicio . "' and hora_dia='" . $dia . "') where carr_codigo = '" . $codigo . "'"); Disconnect(); //* echo "<script type=\"text/javascript\">\n\t\t\t\t\talert(\"Se ha modificado exitosamente\");\n\t\t\t\t\twindow.location.href=\"../index.php\"\n\t\t\t\t</script>"; //*/ } catch (Exception $e) { echo "Message: " . $e->getMessage(); } }
function GetAllUsers() { $link = Connect(); $result = mysqli_query($link, "SELECT * FROM `users`"); if (false === $result) { die('Error: ' . mysqli_error($link)); //Er ging iets mis, dump de database-error op het scherm } else { $results = mysqli_fetch_all($result); //haal alle rijen uit het query-result object } Disconnect($link); return $results; }