Example #1
0
 public static function construct($_rid, $_token = "")
 {
     self::$sid = self::getSid();
     self::$id = null;
     self::$rid = $_rid;
     self::$ip = self::getIp();
     self::$token = $_token;
 }
Example #2
0
 public static function LoadSession()
 {
     global $user, $bd_users;
     $user = false;
     $check_ip = GetRealIp();
     $check = true;
     $session = Filter::input('session_id', 'get');
     if (!class_exists('User', false)) {
         exit('include user class first');
     }
     if (!session_id() and !empty($session) and preg_match('/^[a-zA-Z0-9]{26,40}$/', $session)) {
         session_id($session);
     }
     if (!isset($_SESSION)) {
         session_start();
     }
     if (isset($_SESSION['user_name'])) {
         $user = new User($_SESSION['user_name'], $bd_users['login']);
     }
     if (isset($_COOKIE['PRTCookie1']) and empty($user)) {
         $user = new User($_COOKIE['PRTCookie1'], $bd_users['tmp']);
         if ($user->id()) {
             $_SESSION['user_name'] = $user->name();
             $_SESSION['ip'] = $check_ip;
         }
     }
     if (!empty($user)) {
         if (!$user->id() or $user->lvl() <= 0 or $check and $check_ip != $user->ip()) {
             if ($user->id()) {
                 $user->logout();
             }
             setcookie("PRTCookie1", "", time(), '/');
             $user = false;
         }
     }
 }
Example #3
0
$html = '';
$info = '';
$server_info = '';
$user_id = Filter::input('user_id', 'post', 'int', true);
$ban_user = false;
if ($user_id === false) {
    $user_id = Filter::input('user_id', 'get', 'int', true);
}
if ($user_id) {
    $ban_user = new User($user_id);
}
if ($ban_user and $ban_user->id()) {
    $user_name = $ban_user->name();
    $user_gen = $ban_user->isFemale();
    $user_mail = $ban_user->email();
    $user_ip = $ban_user->ip();
    $user_lvl = $ban_user->lvl();
} else {
    $ban_user = false;
}
if ($do == 'gettheme') {
    $id = Filter::input('sid', 'get', 'string', true);
} else {
    $id = Filter::input('sid', 'get', 'int', true);
}
function RatioList($selectid = 1)
{
    $html_ratio = '<option value="1" ' . (1 == $selectid ? 'selected' : '') . '>64x32 | 22x17</option>';
    for ($i = 2; $i <= 32; $i = $i + 2) {
        $html_ratio .= '<option value="' . $i . '" ' . ($i == $selectid ? 'selected' : '') . '>' . 64 * $i . 'x' . 32 * $i . ' | ' . 22 * $i . 'x' . 17 * $i . '</option>';
    }
Example #4
0
 public function ShowUserListing($list = 1, $search_by = 'name', $input = false)
 {
     global $bd_users, $bd_names;
     if ($input == 'banned') {
         $input = 0;
     }
     switch ($search_by) {
         case 'name':
             $sql = "SELECT `{$bd_users['id']}` FROM `{$bd_names['users']}` " . "WHERE {$bd_users['login']} LIKE :input " . "ORDER BY {$bd_users['login']} LIMIT " . 10 * ($list - 1) . ",10";
             $countSql = "SELECT COUNT(*) FROM `{$bd_names['users']}` WHERE {$bd_users['login']} LIKE :input";
             $input = array('input' => '%' . $input . '%');
             $result = getDB()->ask($sql, $input);
             break;
         case 'none':
             $sql = "SELECT `{$bd_users['id']}` FROM `{$bd_names['users']}` " . "ORDER BY {$bd_users['login']} LIMIT " . 10 * ($list - 1) . ",10";
             $countSql = "SELECT COUNT(*) FROM `{$bd_names['users']}`";
             $input = false;
             $result = getDB()->ask($sql);
             break;
         case 'ip':
             $sql = "SELECT `{$bd_users['id']}` FROM `{$bd_names['users']}` " . "WHERE {$bd_users['ip']} LIKE :input " . "ORDER BY {$bd_users['login']} LIMIT " . 10 * ($list - 1) . ",10";
             $countSql = "SELECT COUNT(*) FROM `{$bd_names['users']}` WHERE {$bd_users['ip']} LIKE :input";
             $input = array('input' => '%' . $input . '%');
             $result = getDB()->ask($sql, $input);
             break;
         case 'lvl':
             $result = getDB()->fetchRow("SELECT `id` FROM `{$bd_names['groups']}` WHERE `lvl`=':input'", $input, 'num');
             $input = $result[0];
             $sql = "SELECT `{$bd_users['id']}` FROM `{$bd_names['users']}` " . "WHERE `{$bd_users['group']}` = ':input' " . "ORDER BY {$bd_users['login']} LIMIT " . 10 * ($list - 1) . ",10";
             $countSql = "SELECT COUNT(*) FROM `{$bd_names['users']}` WHERE `{$bd_users['group']}`=':input'";
             $input = array('input' => $input);
             $result = getDB()->ask($sql, $input);
             break;
     }
     ob_start();
     while ($line = $result->fetch('num')) {
         if (!isset($found)) {
             include $this->GetView('admin/user/user_find_header.html');
             $found = true;
         }
         $inf_user = new User($line[0]);
         $user_name = $inf_user->name();
         $user_id = $inf_user->id();
         $user_ip = $inf_user->ip();
         $user_lvl = $inf_user->getGroupName();
         $user_lvl_id = $inf_user->group();
         unset($inf_user);
         include $this->GetView('admin/user/user_find_string.html');
     }
     if (!isset($found)) {
         include $this->GetView('admin/user/user_not_found.html');
         return ob_get_clean();
     }
     include $this->GetView('admin/user/user_find_footer.html');
     $html = ob_get_clean();
     $line = getDB()->fetchRow($countSql, $input, 'num');
     $html .= $this->arrowsGenerator($this->work_skript, $list, $line[0], 10);
     return $html;
 }
Example #5
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.";
                 }
             }
         }
     }
 }
Example #6
0
 private static function setIP()
 {
     $ipAddr = '';
     $method = ['HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR'];
     foreach ($method as $m) {
         if ($rawIp = getenv($m)) {
             if ($m == 'HTTP_X_FORWARDED') {
                 $rawIp = explode(',', $rawIp)[0];
             }
             // [ip, proxy1, proxy2]
             // check IPv4
             if ($ipAddr = filter_var($rawIp, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
                 break;
             }
             // check IPv6
             if ($ipAddr = filter_var($rawIp, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
                 break;
             }
         }
     }
     self::$ip = $ipAddr ?: null;
 }