function __construct()
 {
     $variables = new Variables();
     $connect = new Connect($variables->dbHost, $variables->dbUser, $variables->dbPassword, $variables->dbName);
     $result;
     //receinving and striping the variables
     $this->userMatricula = $connect->antiInjection(isset($_POST["tfMatricula"]) ? $_POST["tfMatricula"] : NULL);
     $this->password = $connect->antiInjection(isset($_POST["tfPassword"]) ? $_POST["tfPassword"] : NULL);
     $this->select = $connect->antiInjection(isset($_POST["slSelect"]) ? $_POST["slSelect"] : NULL);
     if (!$connect->start()) {
         echo "Impossible to start connection in Sigin.";
     }
     //encoding to md5 hash
     $this->password = base64_encode($this->password);
     if (!($result = $connect->execute("SELECT * FROM Cadastros c INNER JOIN Folhas f ON c.codigo_fol = f.codigo_fol WHERE c.matricula = '{$this->userMatricula}' AND c.senha = '{$this->password}' AND f.codigo_fol = '{$this->select}'"))) {
         echo "Impossible to execute MySQL query.";
     }
     if ($connect->counterResult($result) > 0) {
         $result = $connect->execute("SELECT * FROM Pessoal WHERE matricula = '{$this->userMatricula}'");
         $row = mysql_fetch_assoc($result);
         $_SESSION["user"] = $this->userMatricula;
         $_SESSION["userPass"] = $this->password;
         $_SESSION["nome"] = $row["nome"];
         $connect->close();
         header("Location: ../index.php?ok=true");
         die;
     }
     $connect->close();
     header("Location: ../index.php?ok=false");
     die;
 }
 function __construct()
 {
     $variables = new Variables();
     $connect = new Connect($variables->dbHost, $variables->dbUser, $variables->dbPassword, $variables->dbName);
     //receinving and striping the variables
     $this->name = $connect->antiInjection(isset($_POST["tfNome"]) ? $_POST["tfNome"] : NULL);
     $this->description = $connect->antiInjection(isset($_POST["tdDescricao"]) ? $_POST["tdDescricao"] : NULL);
     if (strlen($this->name) == 0) {
         header("Location: ../importDocuments.php?upl=false&tab=folha");
         die;
     }
     if (!$connect->start()) {
         echo "Impossible to star connection in Sigin.";
     }
     if (!$connect->execute("INSERT INTO Folhas (nome, descricao) VALUES ('{$this->name}', '{$this->description}')")) {
         echo "Impossible to execute MySQL query.";
     }
     if ($connect->counterAffected() > 0) {
         header("Location: ../importDocuments.php?upl=true&tab=folha");
     } else {
         header("Location: ../importDocuments.php?upl=false&tab=folha");
     }
     $connect->close();
     die;
 }
Exemple #3
0
 public function __construct()
 {
     $db = new Connect();
     $act = $db->query("SELECT ultima_act FROM generales LIMIT 1;");
     $actualizacion = $db->recorrer($act);
     if (time() >= $actualizacion[0]) {
         $tops = $db->query("SELECT id,puntos FROM usuarios ORDER by puntos DESC;");
         $tope = 1;
         $psql = "UPDATE usuarios SET top = ? WHERE id = ? LIMIT 1;";
         $prepare_query = $db->prepare($psql);
         $prepare_query->bind_param('ii', $nuevo_top, $id_user);
         while ($top = $db->recorrer($tops)) {
             $nuevo_top = $tope++;
             $id_user = $top['id'];
             $prepare_query->execute();
         }
         $timer = time() + 30;
         $query = $db->query("UPDATE generales SET ultima_act='{$timer}' LIMIT 1;");
         $prepare_query->close();
         unset($actualizar, $tops, $timer, $tope, $query);
     } else {
         unset($actualizacion);
     }
     $db->liberar($act);
     $db->close();
 }
 function __construct()
 {
     foreach ($_POST as $fieldName => $value) {
         $comand = "\$" . $fieldName . "='" . $value . "';";
         eval($comand);
     }
     $DB;
     //seting up the matrix of datas
     for ($x = 0; $x < $numRows; $x++) {
         for ($y = 0; $y < $numFields; $y++) {
             $str = "tf{$x}{$y}";
             eval("\$aux = \"\${$str}\";");
             $DB[$x][$y] = $aux;
         }
     }
     //by security, it conts the amount of rows to update
     $loopForUpdate = 0;
     for ($x = 0; $x < $numRows; $x++) {
         if ($DB[$x][0] == NULL) {
             continue;
         }
         $loopForUpdate++;
     }
     //starting the data base
     $variables = new Variables();
     $MySQLconnect = new Connect($variables->dbHost, $variables->dbUser, $variables->dbPassword, $variables->dbName);
     //it conts the amount of rows it was updated
     $uptCont = 0;
     if (!$MySQLconnect->start()) {
         echo "Impossible to star connection in Handler.";
     }
     for ($x = 0; $x < $numRows; $x++) {
         if ($DB[$x][0] == NULL) {
             continue;
         }
         switch ($tableId) {
             case "dcr":
                 $aux = "UPDATE Cargos SET descricao_cargo = '" . $DB[$x][1] . "', tipo='" . $DB[$x][2] . "', vencimento=" . $DB[$x][3] . " WHERE cargo='" . $DB[$x][0] . "'";
                 break;
             case "dlt":
                 $aux = "UPDATE Lotacoes SET descricao_lotacao = '" . $this->DB[$x][1] . "', secretaria = '" . $this->DB[$x][2] . "' WHERE lotacao='" . $this->DB[$x][0] . "'";
                 break;
             case "especial":
                 $aux = "UPDATE Especialidades SET descricao_especialidade = '" . $this->DB[$x][1] . "', cargo = '" . $this->DB[$x][2] . "' WHERE codigo_esp='" . $this->DB[$x][0] . "'";
                 break;
             case "eventos":
                 $aux = "UPDATE Eventos SET descricao_evento='" . $this->DB[$x][1] . "', IRRF='" . $this->DB[$x][2] . "', IPMT='" . $this->DB[$x][3] . "', FAL='" . $this->DB[$x][4] . "', FIXO='" . $this->DB[$x][5] . "', TEMP='" . $this->DB[$x][6] . "', valor_eve=" . $this->DB[$x][7] . ", GRAT='" . $this->DB[$x][8] . "', FGTS='" . $this->DB[$x][9] . "', desconto=" . $this->DB[$x][10] . ", nivel_eve='" . $this->DB[$x][11] . "', INSS='" . $this->DB[$x][12] . "' WHERE codigo_eve='" . $this->DB[$x][0] . "'";
                 break;
         }
         if ($MySQLconnect->execute($aux)) {
             $uptCont++;
         }
     }
     $MySQLconnect->close();
     if ($uptCont == $loopForUpdate) {
         header("Location: ../importDocuments.php?upl=true&tab={$tableId}");
     } else {
         header("Location: ../importDocuments.php?upl=false&tab={$tableId}");
     }
 }
Exemple #5
0
 function __construct()
 {
     $variables = new Variables();
     $connect = new Connect($variables->dbHost, $variables->dbUser, $variables->dbPassword, $variables->dbName);
     //receinving and striping the variables
     $this->nivel = $connect->antiInjection(isset($_POST["slNivel"]) ? $_POST["slNivel"] : NULL);
     $this->userName = $connect->antiInjection(isset($_POST["tfUserName"]) ? $_POST["tfUserName"] : NULL);
     $this->password = $connect->antiInjection(isset($_POST["tfPassword"]) ? $_POST["tfPassword"] : NULL);
     $this->password2 = $connect->antiInjection(isset($_POST["tfPassword2"]) ? $_POST["tfPassword2"] : NULL);
     if ($this->password != $this->password2) {
         header("Location: ../importDocuments.php?sigin=false");
         die;
     }
     if (!$connect->start()) {
         echo "Impossible to star connection in Sigin.";
     }
     //encoding to md5 hash
     $this->password = md5($this->password);
     if (!$connect->execute("INSERT INTO Administradores (id_nivel, usuario, senha) VALUES ({$this->nivel}, '{$this->userName}', '{$this->password}')")) {
         echo "Impossible to execute MySQL query.";
     }
     if ($connect->counterAffected() > 0) {
         header("Location: ../importDocuments.php?sigin=true");
     } else {
         header("Location: ../importDocuments.php?sigin=false");
     }
     $connect->close();
     die;
 }
Exemple #6
0
 public function Register()
 {
     if (!empty($_POST['user']) and !empty($_POST['pass']) and !empty($_POST['email'])) {
         $db = new Connect();
         $this->user = $db->real_escape_string($_POST['user']);
         $this->email = $db->real_escape_string($_POST['email']);
         $this->pass = sha1($_POST['pass']);
         $sql = $db->query("SELECT usuario,email FROM usuarios \n            WHERE usuario='{$this->user}' OR email='{$this->email}' LIMIT 1;");
         if ($db->rows($sql) == 0) {
             $sql2 = $db->query("SELECT COUNT(id) FROM usuarios LIMIT 1;");
             $top = $db->recorrer($sql2);
             $top = $top[0] + 1;
             $sql3 = $db->query("INSERT INTO usuarios (usuario,password,email,faccion,top) \n                VALUES ('{$this->user}','{$this->pass}','{$this->email}','1','{$top}');");
             $sql4 = $db->query("SELECT MAX(id) AS id FROM usuarios LIMIT 1;");
             $id = $db->recorrer($sql4);
             $id = $id[0];
             $db->liberar($sql, $sql2, $sql3, $sql4);
             require 'core/models/class.GeneratePlanet.php';
             $planeta = new GeneratePlanet();
             $planeta->RegisterPlanet($id);
             $planet = $db->query("SELECT id_planeta FROM planetas WHERE id_dueno='{$id}' LIMIT 1;");
             $id_planet = $db->recorrer($planet);
             $id_planet = $id_planet[0];
             $_SESSION['id_planet'] = $id_planet;
             $_SESSION['user'] = $this->user;
             $_SESSION['id'] = $id;
             $login = '******';
             $db->liberar($planet);
             $db->close();
             unset($sql, $sql2, $sql3, $sql4, $top, $db, $id, $this->email, $this->pass);
         } else {
             $dato = $db->recorrer($sql);
             $db->liberar($sql);
             $db->close();
             $lng = new Lang();
             if (strtolower($dato[1]) == strtolower($this->email) and strtolower($dato[0]) != strtolower($this->user)) {
                 $login = $lng->e_email_existe;
             } else {
                 if (strtolower($dato[1]) != strtolower($this->email) and strtolower($dato[0]) == strtolower($this->user)) {
                     $login = $lng->e_user_existe;
                 } else {
                     $login = $lng->e_user_email_existe;
                 }
             }
             unset($sql, $db, $lng, $dato, $this->user, $this->email, $this->pass);
         }
     } else {
         $lng = new Lang();
         $login = $lng->e_datos_vac;
         unset($lng);
     }
     echo $login;
     unset($login);
 }
Exemple #7
0
 public function __construct($id_planet)
 {
     parent::__construct($id_planet);
     $db = new Connect();
     $sql = $db->query("SELECT imagen,nombre,campos,campos_usados,temperatura,pos,sistema,metal,cristal,tritio,materia\n        FROM planetas WHERE id_planeta='{$id_planet}' LIMIT 1;");
     $planeta = $db->recorrer($sql);
     $this->planet = array('image' => $planeta['imagen'], 'name' => $planeta['nombre'], 'fields' => $planeta['campos'], 'used_fields' => $planeta['campos_usados'], 'temperature' => $planeta['temperatura'], 'orbit' => $planeta['pos'], 'solar' => $planeta['sistema'], 'metal' => $planeta['metal'], 'cristal' => $planeta['cristal'], 'tritio' => $planeta['tritio'], 'matter' => $planeta['materia']);
     $db->liberar($sql);
     $db->close();
     unset($planeta, $db, $sql);
 }
Exemple #8
0
 public function __construct($id_user)
 {
     $this->id = $id_user;
     $db = new Connect();
     $sql = $db->query("SELECT usuario,email,faccion,puntos,alianza,top FROM usuarios WHERE id='{$this->id}' LIMIT 1;");
     $usuario = $db->recorrer($sql);
     $this->user = $usuario['usuario'];
     $this->email = $usuario['email'];
     $this->faction = $usuario['faccion'];
     $this->points = $usuario['puntos'];
     $this->alliance = $usuario['alianza'];
     $this->rank = $usuario['top'];
     $db->liberar($sql);
     $db->close();
     unset($sql, $db, $usuario, $this->id);
 }
 public function __construct($register)
 {
     if ($register === true) {
         //si esto es true, es porque se está pasando del registro
         $db = new Connect();
         $sql = $db->query("SELECT ultima_pos,ultimo_sis FROM generales LIMIT 1;");
         $coordenada = $db->recorrer($sql);
         $db->liberar($sql);
         $db->close();
         $this->u_orbit = $coordenada['ultima_pos'];
         $this->u_system = $coordenada['ultimo_sis'];
         $this->register = true;
         unset($sql, $db, $coordenada);
     } else {
         $this->u_orbit = 'LA ORBITA DE LA MISIO';
         $this->u_system = 'EL SISTEMA DE LA MISIÓN';
         $this->register = false;
     }
 }
Exemple #10
0
 public function __construct($id_planeta)
 {
     $this->id = $id_planeta;
     $db = new Connect();
     $sql = $db->query("SELECT edificios.fuente_base, edificios.planta_energia, edificios.reactor_fusion, \n        edificios.mina_metal, edificios.mina_cristal, edificios.mina_tritio, \n        edificios.almacen_metal, edificios.almacen_cristal, edificios.almacen_tritio, \n        edificios.satelites, edificios.modulos, edificios.almacen_materia, edificios.distribuidor, edificios.nanobots,\n        planetas.metal, planetas.cristal, planetas.tritio, \n        planetas.ultima_act, planetas.temp_promd FROM edificios, planetas WHERE edificios.id_planeta='{$this->id}' \n        AND planetas.id_planeta='{$this->id}' LIMIT 1;");
     $dat = $db->recorrer($sql);
     $this->niveles = array('mina_metal' => $dat['mina_metal'], 'mina_cristal' => $dat['mina_cristal'], 'mina_tritio' => $dat['mina_tritio'], 'reactor_fusion' => $dat['reactor_fusion'], 'planta_energia' => $dat['planta_energia'], 'distribuidor' => $dat['distribuidor'], 'satelites' => $dat['satelites'], 'modulos' => $dat['modulos'], 'almacen_metal' => $dat['almacen_metal'], 'almacen_cristal' => $dat['almacen_cristal'], 'almacen_tritio' => $dat['almacen_tritio'], 'almacen_materia' => $dat['almacen_materia'], 'nanobots' => $dat['nanobots']);
     $this->metal = $dat['metal'];
     $this->cristal = $dat['cristal'];
     $this->tritio = $dat['tritio'];
     $tiempo = time();
     $time = $tiempo - $dat['ultima_act'];
     parent::__construct($time, $this->niveles, $dat['fuente_base'], $dat['temp_promd'], $this->tritio);
     $prod_metal = $this->metal >= $this->getMetalCapacity() ? 0 : $this->getMetalProd();
     $prod_cristal = $this->cristal >= $this->getCristalCapacity() ? 0 : $this->getCristalProd();
     $prod_tritio = $this->tritio >= $this->getTritioCapacity() ? 0 : $this->getTritioProd();
     $this->prod_resources = array('metal' => $prod_metal, 'cristal' => $prod_cristal, 'tritio' => $prod_tritio);
     //Actualizacion de recursos cada tano
     $update = $db->query("UPDATE planetas SET ultima_act='{$tiempo}', metal= metal + '{$prod_metal}', \n        cristal= cristal + '{$prod_cristal}', tritio= tritio + '{$prod_tritio}' WHERE id_planeta='{$this->id}'");
     $db->liberar($sql, $update);
     $db->close();
     unset($prod_metal, $prod_cristal, $prod_tritio, $tiempo, $db);
 }
Exemple #11
0
 private function __construct()
 {
     require 'core/models/class.User.php';
     require 'core/models/implement.Menu.php';
     require 'core/models/class.Planet.php';
     require 'core/models/implement.Topnav.php';
     global $id_user, $id_planet;
     $lng = new Lang();
     $menu = new Menu($id_user);
     $topnav = new Topnav($id_planet, $id_user);
     $user = new User($id_user);
     $planet = new Planet($id_planet);
     require 'core/functions/class.UpdateStats.php';
     $update = new UpdateStats();
     $db = new Connect();
     $sql = $db->query("SELECT COUNT(*) id FROM usuarios;");
     $total_rank = $db->recorrer($sql);
     $db->liberar($sql);
     $db->close();
     $template = new Smarty();
     $template->assign(array('usuario_email' => $user->UserEmail(), 'usuario_faccion' => $user->UserFaction(), 'usuario_puntos' => $user->UserPoints(), 'usuario_top' => $user->TopUser(), 'total_rank' => number_format($total_rank[0], '0', ',', '.'), 'campos' => $planet->PlanetFields(), 'diametro' => $planet->PlanetDiameter(), 'temperatura' => $planet->PlanetTemperature(), 'p' => $planet->PlanetOrbit(), 's' => $planet->PlanetSystem(), 'nombre_planeta' => $planet->PlanetName(), 'imagen_planeta' => $planet->PlanetImage()));
     $template->display('overview/overview.xnv');
 }
Exemple #12
0
 function construct()
 {
     $field = array("us_ide", "us_id", "us_nam", "us_su", "us_da", "us_mo", "us_ye", "us_ge", "us_re", "us_pho", "us_mob", "us_na", "us_em", "us_pa");
     $register = new Register();
     $vfields = $register->vfields($field);
     if ($vfields != false) {
         $year = date("Y");
         $month = date("m");
         $day = date("d");
         $hours = date("H");
         $minutes = date("i");
         $seconds = date("s");
         $user = new User();
         $us_id = $user->iget("us_id");
         $us_su = $user->iget("us_su");
         $us_da = $user->iget("us_da");
         $us_mo = $user->iget("us_mo");
         $us_ye = $user->iget("us_ye");
         $us_ge = $user->iget("us_ge");
         $us_re = $user->iget("us_re");
         $us_ide = $user->iget("us_ide");
         $us_nam = $user->iget("us_nam");
         $us_pho = $user->iget("us_pho");
         $us_mob = $user->iget("us_mob");
         if ($user->vdate($us_da, $us_mo, $us_ye, $year, $month, $day)) {
             if ($vfields == "account") {
                 $us_na = $user->iget("us_na");
                 $us_em = $user->iget("us_em");
                 $us_pa = $user->iget("us_pa");
                 if ($user->vemail($us_em)) {
                     if ($user->vpassword($us_pa)) {
                         $connect = new Connect();
                         $conn = $connect->conn("soccermail");
                         if ($conn != false) {
                             $segud = new Segud();
                             if ($segud->existsv2("id", $us_id, "identity", $us_ide, "applicant", $conn)) {
                                 if (!$segud->exists("name", $us_na, "account", $conn)) {
                                     if (!$segud->exists("email", $us_em, "account", $conn)) {
                                         $us_sc = $segud->get("school", "id", $us_id, "applicant", $conn);
                                         $data = array($us_id, $us_nam, $us_su, $us_da, $us_mo, $us_ye, $us_ge, $us_re, $us_pho, $us_mob, $us_ide, $us_sc);
                                         if ($segud->set($data, "user", $conn)) {
                                             if ($segud->delete("id", $us_id, "applicant", $conn)) {
                                                 $data = array($us_id, $day, $month, $year, $seconds, $minutes, $hours);
                                                 if ($segud->set($data, "signup", $conn)) {
                                                     $us_bi = "La biografía de " . $us_nam;
                                                     $us_ph = "La foto de " . $us_nam;
                                                     $us_he = "El encabezado de " . $us_nam;
                                                     $data = array($us_id, $us_bi, $us_ph, $us_he);
                                                     if ($segud->set($data, "profile", $conn)) {
                                                         $mysqli = $conn->query("select max(id) from account");
                                                         $row = $mysqli->fetch_array(MYSQLI_NUM);
                                                         $ac_id = trim($row[0]) + 1;
                                                         $data = array($ac_id, "true", "true", $us_id, $us_na, $us_em, $us_pa);
                                                         if ($segud->set($data, "account", $conn)) {
                                                             $data = array($us_id, 0, 0);
                                                             if ($segud->set($data, "follow", $conn)) {
                                                                 $us_ag = filter_input(INPUT_SERVER, "HTTP_USER_AGENT");
                                                                 $ip = $user->ip();
                                                                 $os = $user->os($us_ag);
                                                                 $browser = $user->browser($us_ag);
                                                                 $version = $user->version($us_ag, $os);
                                                                 $data = array($ac_id, $day, $month, $year, $seconds, $minutes, $hours, $os, $version, $browser, $ip);
                                                                 if ($segud->set($data, "login", $conn)) {
                                                                     if ($segud->update("session", "true", "id", $ac_id, "account", $conn)) {
                                                                         session_start();
                                                                         $_SESSION["logac_id"] = $ac_id;
                                                                         $_SESSION["logus_em"] = $us_em;
                                                                         $_SESSION["logus_id"] = $us_id;
                                                                         $_SESSION["logus_na"] = $us_na;
                                                                         $_SESSION["logus_sc"] = $us_sc;
                                                                         $_SESSION["session"] = true;
                                                                         if ($connect->close($conn)) {
                                                                             echo "true";
                                                                         }
                                                                         /*close conn*/
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     } else {
                                         echo "La dirección de correo electrónico ya ha sido registrada.";
                                     }
                                 } else {
                                     echo "El nombre de usuario ya existe, intenta nuevamente con uno distinto.";
                                 }
                             } else {
                                 echo "El documento de identidad no ha sido registrado o no corresponde al tipo de usuario " . "del mismo. Obtén más información con un entrenador de la escuela.";
                             }
                         }
                     } else {
                         echo "La contraseña no es segura. Por favor verifica que tenga mayúsculas, números y que sea" . "almenos de 9 caracteres, e inténtalo nuevamente.";
                     }
                 } else {
                     echo "La dirección de correo electrónico es incorrecta. Si presentas algún inconveniente " . "con el símbolo del arroba puedes copiarlo: " . "<b>" . "@" . "</b>" . " y pegarlo.";
                 }
             }
         }
     }
 }
Exemple #13
0
 public function NewCologne()
 {
     $lng = new Lang();
     $metal = mt_rand(0, 1500);
     $cristal = mt_rand(0, 1500);
     $tritio = mt_rand(0, 1000);
     $imagen = $this->GenerateImage();
     #jugamos con la posibilidad de obtener materia oscura en una colonia xd totalmente al azar
     $x = mt_rand(5000, 10000);
     if ($x > 9950) {
         $materia = mt_rand(3400, 6000);
     } else {
         $materia = 0;
     }
     $campos = $this->GenerateFields();
     $temperatura = $this->GenerateTemp();
     $temp_promd = $this->TempPromd();
     $db = new Connect();
     $sql = "INSERT INTO planetas (id_ppal,id_dueno,nombre,imagen,metal,cristal,tritio,materia,campos,campos_usados,temperatura,temp_promd)\n        VALUES (0,'{$this->id}','{$lng->x_colonia}','{$imagen}','{$metal}','{$cristal}','{$tritio}','{$materia}','{$campos}',0,'{$temperatura}','{$temp_promd}');";
     /*
     EN LA CONSULTA DE ARRIBA FALTA INTRODUCIR LAS COORDENADAS, LAS CUALES SERÁN LAS DE LA MISIÓN         
     */
     $db->liberar($sql);
     $db->close();
     unset($db, $campos, $temperatura, $temp_promd);
 }
session_start();
if (isset($_SESSION["user"]) == NULL && isset($_SESSION["userPass"]) == NULL) {
    header("Location: admin.php");
}
include_once "../beans/Variables.class.php";
require_once "../utils/Connect.class.php";
$variables = new Variables();
$connect = new Connect($variables->dbHost, $variables->dbUser, $variables->dbPassword, $variables->dbName);
$oldPass = $connect->antiInjection(isset($_POST["tfOldPass"]) ? $_POST["tfOldPass"] : NULL);
$newPass1 = $connect->antiInjection(isset($_POST["tfNewPass1"]) ? $_POST["tfNewPass1"] : NULL);
$newPass2 = $connect->antiInjection(isset($_POST["tfNewPass2"]) ? $_POST["tfNewPass2"] : NULL);
if (strcmp($newPass1, $newPass2) == 0) {
    $newPass1 = base64_encode($newPass1);
    $oldPass = base64_encode($oldPass);
} else {
    $connect->close();
    header("Location: ../index.php?pass=false");
    die;
}
if (!$connect->start()) {
    echo "Impossible to star connection in Sigin.";
}
if (!($result = $connect->execute("SELECT * FROM Cadastros WHERE matricula = '" . $_SESSION["user"] . "' AND senha = '" . $oldPass . "'"))) {
    echo "Impossible to execute MySQL query.";
}
if ($connect->counterResult($result) > 0) {
    $connect->execute("UPDATE Cadastros SET senha='" . $newPass1 . "' WHERE matricula = '" . $_SESSION["user"] . "'");
    $_SESSION["userPass"] = $newPass1;
    $connect->close();
    header("Location: ../index.php?pass=true");
    die;
Exemple #15
0
 private function __construct()
 {
     require 'core/models/class.User.php';
     require 'core/models/implement.Menu.php';
     require 'core/models/class.Planet.php';
     require 'core/models/implement.Topnav.php';
     global $id_user, $id_planet;
     $lng = new Lang();
     $menu = new Menu($id_user);
     $topnav = new Topnav($id_planet, $id_user);
     $user = new User($id_user);
     $db = new Connect();
     $sql = $db->query("SELECT sistema FROM planetas WHERE id_planeta='{$id_planet}' LIMIT 1;");
     $system = $db->recorrer($sql);
     $db->liberar($sql);
     if (isset($_GET['sistema']) and is_numeric($_GET['sistema']) and $_GET['sistema'] > 0 and $_GET['sistema'] <= 700) {
         $this->system_id = intval($_GET['sistema']);
     } else {
         $this->system_id = intval($system['sistema']);
     }
     unset($system, $sql);
     $x = 1;
     $psql = "SELECT SQL_BIG_RESULT DISTINCT id_planeta, pos, nombre, imagen, usuario, id_dueno \n            FROM planetas JOIN usuarios \n            ON planetas.id_dueno=usuarios.id WHERE sistema=? \n            AND pos=? ORDER BY pos ASC LIMIT 1;";
     $prepare_sql = $db->prepare($psql);
     $prepare_sql->bind_param('ii', $orbit, $system_id);
     while ($x < 16) {
         $orbit = $x;
         $system_id = $this->system_id;
         $prepare_sql->execute();
         $id_planeta = '';
         $pos = '';
         $nombre = '';
         $imagen = '';
         $usuario = '';
         $id_dueno = '';
         $prepare_sql->bind_result($id_planeta, $pos, $nombre, $imagen, $usuario, $id_dueno);
         $prepare_sql->fetch();
         $o_s = "&o={$x}&s={$this->system_id}";
         if ($x != $pos) {
             if ($x == 1 or $x == 5 or $x == 9 or $x == 13) {
                 $universe[] = array('posicion' => $x, 'nombre' => 'Brecha', 'imagen' => 'brecha_espacio', 'usuario' => 'Agujero de gusano', 'escombros' => 'no_in', 'luna' => 'no_in', 'habitado' => 'deshabitado', 'accion' => '<a href=\'?core=fleets&mision=saltar' . $o_s . '\'>' . $lng->x_saltar . '</a>');
             } else {
                 $universe[] = array('posicion' => $x, 'nombre' => 'Planeta Habitable', 'imagen' => 'planeta_desconocido', 'usuario' => 'La atmósfera es apta para colonizar', 'escombros' => 'no_in', 'luna' => 'no_in', 'habitado' => 'deshabitado', 'accion' => '<a href=\'?view=flotas&mision=colonizar' . $o_s . '\'>' . $lng->x_colonizar . '</a>');
             }
         } else {
             if ($id_dueno == $id_user and $id_planeta != $id_planet) {
                 $universe[] = array('posicion' => $pos, 'nombre' => $nombre, 'imagen' => $imagen, 'usuario' => $usuario, 'escombros' => 'no_es', 'luna' => 'no_es', 'habitado' => 'habitado', 'accion' => '<a href=\'?view=flotas&mision=transportar' . $o_s . '\'>' . $lng->x_transportar . '</a> |
                                 <a href=\'?view=flotas&mision=desplegar' . $o_s . '\'>' . $lng->x_desplegar . '</a>');
             } else {
                 if ($id_planeta == $id_planet and $id_dueno == $id_user) {
                     $universe[] = array('posicion' => $pos, 'nombre' => $nombre, 'imagen' => $imagen, 'usuario' => $usuario, 'escombros' => 'no_es', 'luna' => 'no_es', 'habitado' => 'habitado', 'accion' => '<br />' . $lng->x_no_hay . '');
                 } else {
                     $universe[] = array('posicion' => $pos, 'nombre' => $nombre, 'imagen' => $imagen, 'usuario' => $usuario, 'escombros' => 'no_es', 'luna' => 'no_es', 'habitado' => 'habitado', 'accion' => '<a href=\'?view=flotas&mision=transportar' . $o_s . '\'>' . $lng->x_transportar . '</a> |
                                 <a href=\'?view=flotas&mision=desplegar' . $o_s . '\'>' . $lng->x_desplegar . '</a> | <br /> 
                                 <a href=\'?view=flotas&mision=tomar_recursos' . $o_s . '\'>' . $lng->x_tomar_recursos . '</a> |  
                                 <a href=\'?view=flotas&mision=defender' . $o_s . '\'>' . $lng->x_defender . '</a> <br />
                                 <a href=\'?view=flotas&mision=espiar' . $o_s . '\'>' . $lng->x_espiar . '</a> |
                                 <a href=\'?view=flotas&mision=atacar' . $o_s . '\'>' . $lng->x_atacar . '</a> |
                                 <a href=\'?view=flotas&mision=sac' . $o_s . '\'>' . $lng->x_sac . '</a>');
                 }
             }
         }
         $x++;
         //bucle increment
     }
     $prepare_sql->close();
     $db->close();
     $template = new Smarty();
     $template->assign(array('sistema' => $this->system_id, 'x_ir' => $lng->x_ir, 'x_anterior' => $lng->x_anterior, 'x_siguiente' => $lng->x_siguiente, 'x_orbita' => $lng->x_orbita, 'x_planeta' => $lng->x_planeta, 'x_emperador' => $lng->x_emperador, 'x_accion' => $lng->x_accion, 'universe' => $universe));
     $template->display('universe/universe.xnv');
     unset($x, $template);
 }