<?php session_start(); // require '../config/classes.php'; $class = new Mysql(); $username = mysqli_real_escape_string($class->conexion(), $_GET['username']); $password = mysqli_real_escape_string($class->conexion(), $_GET['password']); $login = mysqli_query($class->conexion(), "SELECT * FROM account.account where login='******' and password=PASSWORD('" . $password . "')"); $rows = mysqli_fetch_array($login, MYSQLI_ASSOC); if ($rows['id']) { $_SESSION['web_admin'] = $rows['web_admin']; $_SESSION['id'] = $rows['id']; $_SESSION['login'] = $rows['login']; $_SESSION['email'] = $rows['email']; $_SESSION['social_id'] = $rows['social_id']; $_SESSION['country'] = $rows['zipcode']; $_SESSION['status'] = $rows['status']; $_SESSION['last_play'] = $rows['last_play']; $_SESSION['pic'] = $rows['pic']; echo "ok"; } else { return false; }
public function registrar() { $mysql = new Mysql(); $mysql->conexion(); $consulta = $mysql->consulta("INSERT INTO empleados values ('{$this->cedula}','{$this->nombre}','{$this->apellido}','{$this->emailp}','{$this->emailc}','{$this->skype}','{$this->direccion}','{$this->telefono}','{$this->celular}','{$this->fechae}','{$this->fechac}','{$this->contactoe}','{$this->parentezco}','{$this->telefonoc}','{$this->eps}','{$this->cargo}','{$this->proyectoa}')"); }
<?php //please try to comment code in english include "mysql.php"; if (isset($_REQUEST['pos'])) { $inicio = $_REQUEST['pos']; } else { $inicio = 0; } $mysql = new Mysql(); $mysql->conexion(); // Creamos la variable consulta que nos servira como argumento en los metodos num_rows y fetch_array $consulta = $mysql->consulta("SELECT * from empleados limit {$inicio},3"); //si existe por lo menos un campo if ($mysql->num_rows($consulta) > 0) { echo "se encontraron valores"; //Guardaremos en la variable $resultado en Array que nos devuelva ?> <table id="resultados" border=1px> <tr><td>Cedula</td><td>nombre</td><td>telefono y celular</td><td>Cedula</td><td>Cedula</td><td>Cedula</td></tr> <?php $impresos = 0; while ($resultado = $mysql->fetch_array($consulta)) { $impresos++; ?> <tr><td><?php echo $resultado['Cedula']; ?> </td><td><?php echo $resultado['Nombres']; ?>
<?php require '../config/classes.php'; $class = new Mysql(); $username = mysqli_real_escape_string($class->conexion(), $_GET['username']); $password = mysqli_real_escape_string($class->conexion(), $_GET['password']); $socialid = mysqli_real_escape_string($class->conexion(), $_GET['socialid']); $email = mysqli_real_escape_string($class->conexion(), $_GET['email']); $pais = mysqli_real_escape_string($class->conexion(), $_GET['pais']); $captcha = mysqli_real_escape_string($class->conexion(), $_GET['captcha']); if (isset($_GET['username'])) { $check = mysqli_query($class->conexion(), "SELECT id from account.account where login='******'"); $rows = mysqli_fetch_array($check, MYSQLI_ASSOC); if ($rows['id']) { echo "exist"; } else { $sql = mysqli_query($class->conexion(), "INSERT INTO account.account (login,password,social_id,email,zipcode) VALUES ('" . $username . "',PASSWORD('" . $password . "'),'" . $socialid . "','" . $email . "','" . $pais . "')"); echo "ok"; } }
<?php session_start(); require 'config/classes.php'; $conn = new Mysql(); if (!empty($_FILES)) { if (is_uploaded_file($_FILES['userImage']['tmp_name'])) { $path = md5(date("d.m.YH:i:s")); //obtenemos el archivo a subir $peso = $_FILES['userImage']['size']; $file = $_FILES['userImage']['name']; $sourcePath = $_FILES['userImage']['tmp_name']; $imagen = getimagesize($sourcePath); $ancho = $imagen[0]; //Ancho $alto = $imagen[1]; //Alto if ($file && $peso <= 70720 && $ancho <= 150 && $alto <= 150) { if (move_uploaded_file($_FILES['userImage']['tmp_name'], "img/avatars/" . $path . ".jpg")) { sleep(3); //retrasamos la petición 3 segundos mysqli_query($conn->conexion(), "UPDATE account.account set pic='" . $path . "' where id='" . $_SESSION['id'] . "' LIMIT 1"); ?> <?php } } } }