<?php

include '../../functions.php';
/*************************************/
if (isset($_REQUEST["close"])) {
    unset_vars(["ejer1", "ejer1Nombre"]);
    header("Location: formulario_basico.php");
}
session_start();
if (!isset($_SESSION["ejer1"])) {
    $_SESSION["ejer1"] = false;
} elseif (isset($_SESSION["ejer1Nombre"])) {
    $mostrarFormulario = false;
    $nombreCompleto = $_SESSION["ejer1Nombre"];
}
/*************************************/
/**
 * Formulario básico para introducir el nombre
 * @author Juan Antonio Romero Molero
 * @version 0.9
 */
include '../../header.php';
$ruta = $_SERVER['PHP_SELF'];
echo '<h3>Formulario básico</h3>';
echo '<p><a href="/php/vercodigo.php?file=' . end(explode("/", dirname($ruta))) . '/' . basename($ruta) . '">Ver código fuente</a>
	  | <a href="../">Volver</a></p>';
/*************************************/
$formClose = '<form action="" method="post">
				<input type="submit" name="close" value="CERRAR SESIÓN">
			</form>';
if (isset($nombreCompleto)) {
Exemple #2
0
function MakeStats()
{
    global $resource, $pricelist, $reslist, $game_config, $xgp_root, $phpEx;
    $CheckUserQuery = false;
    $CheckAllyQuery = false;
    // Initial Time
    $mtime = microtime();
    $mtime = explode(" ", $mtime);
    $mtime = $mtime[1] + $mtime[0];
    $starttime = $mtime;
    //Initial Memory
    $result['initial_memory'] = array(round(memory_get_usage() / 1024, 1), round(memory_get_usage(1) / 1024, 1));
    //Change the last stats time
    $stats_time = time();
    //Delete old messages
    $del_before = time() - 24 * 60 * 60;
    // 1 DAY
    $del_inactive = time() - 60 * 60 * 24 * 30;
    // 1 MONTH
    $del_deleted = time() - 60 * 60 * 24 * 7;
    // 1 WEEK
    $ChooseToDelete = doquery("SELECT `id` FROM `{{table}}` WHERE (`db_deaktjava` < '" . $del_deleted . "' AND `db_deaktjava` <> 0) OR `onlinetime` < '" . $del_inactive . "'", 'users');
    if ($ChooseToDelete) {
        include_once $xgp_root . 'includes/functions/DeleteSelectedUser.' . $phpEx;
        while ($delete = mysql_fetch_array($ChooseToDelete)) {
            DeleteSelectedUser($delete[id]);
        }
    }
    doquery("DELETE FROM {{table}} WHERE `message_time` < '" . $del_before . "' ;", 'messages');
    doquery("DELETE FROM {{table}} WHERE `time` < '" . $del_before . "' ;", 'rw');
    //STATS FOR USERS....
    //Here we make the select query, with this all the custom stuff with be included
    $select_defenses = '';
    foreach ($reslist['defense'] as $n => $Defense) {
        if ($resource[$Defense] != 'small_protection_shield' && $resource[$Defense] != 'big_protection_shield') {
            $select_defenses .= " SUM(p." . $resource[$Defense] . ") AS " . $resource[$Defense] . ",";
        }
    }
    $select_buildings = '';
    foreach ($reslist['build'] as $n => $Building) {
        $select_buildings .= " p." . $resource[$Building] . ",";
    }
    $selected_tech = '';
    foreach ($reslist['tech'] as $n => $Techno) {
        $selected_tech .= " u." . $resource[$Techno] . ",";
    }
    $select_fleets = '';
    foreach ($reslist['fleet'] as $n => $Fleet) {
        $select_fleets .= " SUM(p." . $resource[$Fleet] . ") AS " . $resource[$Fleet] . ",";
    }
    //If you have some data type enmu is better if you put it here, because that data give a error in the SUM function.
    $selected_enum = "p.small_protection_shield, p.big_protection_shield";
    //For now...
    $select_planet = "p.id_owner,";
    //For Stats table..
    $select_old_ranks = "id_owner, stat_type,tech_rank AS old_tech_rank, build_rank AS old_build_rank, defs_rank AS old_defs_rank, fleet_rank AS old_fleet_rank, total_rank AS old_total_rank";
    //For users table
    $select_user = "******";
    //We check how many users are for not overload the server...
    $total_users = doquery("SELECT COUNT(*) AS `count` FROM {{table}} WHERE 1;", 'users', true);
    //We will make query every $game_config['stat_amount'] users
    //Min amount = 10, if it is less than 10, it is not a good system
    $game_config['stat_amount'] = $game_config['stat_amount'] >= 10 ? $game_config['stat_amount'] : 10;
    $amount_per_block = $game_config['stat_amount'] < $game_config['users_amount'] ? $game_config['users_amount'] : $game_config['stat_amount'];
    if ($total_users['count'] > $amount_per_block) {
        $LastQuery = roundUp($total_users['count'] / $amount_per_block);
    } else {
        $LastQuery = 1;
    }
    for ($Query = 1; $Query <= $LastQuery; $Query++) {
        if ($Query == 1) {
            //based on:http://www.desarrolloweb.com/articulos/1035.php
            $start = 0;
        } else {
            $start = ($Query - 1) * $amount_per_block;
        }
        $minmax_sql = 'SELECT Max(id) AS `max`, Min(id) AS `min` FROM
						(SELECT id FROM {{table}}users ORDER BY id ASC LIMIT
						' . $start . ',' . $amount_per_block . ') AS A';
        $minmax = doquery($minmax_sql, '', true);
        $sql_parcial = 'SELECT ' . $select_buildings . $select_planet . $selected_enum . ', p.id FROM {{table}}planets as p WHERE p.id_owner <=' . $minmax['max'] . ' AND p.id_owner >= ' . $minmax['min'] . ';';
        //We delete now the old stats of the users
        $sql_old_stats = 'SELECT ' . $select_old_ranks . ' FROM {{table}} WHERE stat_type = 1 AND stat_code = 1 AND id_owner <= ' . $minmax['max'] . ' AND id_owner >=  ' . $minmax['min'] . ';';
        //Here we make the array with the planets buildings array and the user id and planet id for use in the next step...
        //Here we excecute all the querys
        $parcial_data = doquery($sql_parcial, '');
        //Here we obtained the stuff that can not be SUM
        while ($CurPlanet = mysql_fetch_assoc($parcial_data)) {
            $Buildings_array[$CurPlanet['id_owner']][$CurPlanet['id']] = $CurPlanet;
            //We made a array with the content of the query
        }
        unset($CurPlanet, $parcial_data);
        $old_stats = doquery($sql_old_stats, 'statpoints');
        while ($CurStats = mysql_fetch_assoc($old_stats)) {
            $old_stats_array[$CurStats['id_owner']] = $CurStats;
        }
        unset($CurStats, $old_stats);
        //We take the data of flying fleets if stat_flying is =1 in game config
        //If you have trouble with the RAM and CPU usage, please set stat_flying = 0 and a low value of stat_amount (25, 15...)
        if ($game_config['stat_flying'] == 1) {
            $sql_flying_fleets = 'SELECT fleet_array, fleet_owner, fleet_id FROM {{table}} WHERE fleet_owner <= ' . $minmax['max'] . ' AND fleet_owner >= ' . $minmax['min'] . ';';
            $flying_fleets = doquery($sql_flying_fleets, 'fleets');
            while ($CurFleets = mysql_fetch_assoc($flying_fleets)) {
                $flying_fleets_array[$CurFleets['fleet_owner']][$CurFleets['fleet_id']] = $CurFleets['fleet_array'];
            }
            unset($CurFleets, $flying_fleets);
        }
        //This query will have a LOT of data...
        $sql = 'SELECT  ' . $select_planet . $select_defenses . $selected_tech . $select_fleets . $select_user . 'FROM {{table}}planets as p
					INNER JOIN {{table}}users as u ON u.id = p.id_owner
					WHERE p.id_owner <= ' . $minmax['max'] . ' AND p.id_owner >=  ' . $minmax['min'] . '
					GROUP BY p.id_owner, u.id, u.authlevel;';
        $total_data = doquery($sql, '');
        unset($sql, $sql_old_stats, $sql_parcial);
        doquery("DELETE FROM {{table}} WHERE stat_type = 1 AND stat_code = 1 AND id_owner <= " . $minmax['max'] . " AND id_owner >= " . $minmax['min'] . ";", 'statpoints');
        $insert_user_query = "INSERT INTO {{table}}\r\n\t\t\t\t\t\t\t\t(`id_owner`, `id_ally`, `stat_type`, `stat_code`,\r\n\t\t\t\t\t\t\t\t`tech_old_rank`, `tech_points`, `tech_count`,\r\n\t\t\t\t\t\t\t\t`build_old_rank`, `build_points`, `build_count`,\r\n\t\t\t\t\t\t\t\t`defs_old_rank`, `defs_points`, `defs_count`,\r\n\t\t\t\t\t\t\t\t`fleet_old_rank`, `fleet_points`, `fleet_count`,\r\n\t\t\t\t\t\t\t\t`total_old_rank`, `total_points`, `total_count`, `stat_date`) VALUES ";
        //Here we start the update...
        while ($CurUser = mysql_fetch_assoc($total_data)) {
            $u_OldTotalRank = $old_stats_array[$CurUser['id']]['old_total_rank'] ? $old_stats_array[$CurUser['id']]['old_total_rank'] : 0;
            $u_OldTechRank = $old_stats_array[$CurUser['id']]['old_tech_rank'] ? $old_stats_array[$CurUser['id']]['old_tech_rank'] : 0;
            $u_OldBuildRank = $old_stats_array[$CurUser['id']]['old_build_rank'] ? $old_stats_array[$CurUser['id']]['old_build_rank'] : 0;
            $u_OldDefsRank = $old_stats_array[$CurUser['id']]['old_defs_rank'] ? $old_stats_array[$CurUser['id']]['old_defs_rank'] : 0;
            $u_OldFleetRank = $old_stats_array[$CurUser['id']]['old_fleet_rank'] ? $old_stats_array[$CurUser['id']]['old_fleet_rank'] : 0;
            //We dont need this anymore...
            unset($old_stats_array[$CurUser['id']]);
            //1 point=  $game_config['stat_settings'] ressources
            //Make the tech points XD
            $u_points = GetTechnoPoints($CurUser);
            $u_TTechCount = $u_points['TechCount'];
            $u_TTechPoints = $u_points['TechPoint'] / $game_config['stat_settings'];
            //Make the defense points
            $u_points = GetDefensePoints($CurUser);
            $u_TDefsCount = $u_points['DefenseCount'];
            $u_TDefsPoints = $u_points['DefensePoint'] / $game_config['stat_settings'];
            //Make the fleets points (without the flying fleets...
            $u_points = GetFleetPoints($CurUser);
            $u_TFleetCount = $u_points['FleetCount'];
            $u_TFleetPoints = $u_points['FleetPoint'] / $game_config['stat_settings'];
            //Now we add the flying fleets points
            //This is used if($game_config['stat_flying'] == 1)
            if ($game_config['stat_flying'] == 1) {
                if ($flying_fleets_array[$CurUser['id']]) {
                    foreach ($flying_fleets_array[$CurUser['id']] as $fleet_id => $fleet_array) {
                        $u_points = GetFlyingFleetPoints($fleet_array);
                        $u_TFleetCount += $u_points['FleetCount'];
                        $u_TFleetPoints += $u_points['FleetPoint'] / $game_config['stat_settings'];
                    }
                }
                //We dont need this anymore...
                unset($flying_fleets_array[$CurUser['id']], $fleet_array, $fleet_id);
            } else {
                //We take one query per fleet in flying, with this we increase the time and the querys, but we decrease the cpu load...
                $OwnFleets = doquery("SELECT fleet_array, fleet_id FROM {{table}} WHERE `fleet_owner` = '" . $CurUser['id'] . "';", 'fleets');
                while ($FleetRow = mysql_fetch_array($OwnFleets)) {
                    $u_points = GetFlyingFleetPoints($FleetRow['fleet_array']);
                    $u_TFleetCount += $u_points['FleetCount'];
                    $u_TFleetPoints += $u_points['FleetPoint'] / $game_config['stat_settings'];
                }
                //We dont need this anymore...
                unset($OwnFleets, $FleetRow);
            }
            $u_TBuildCount = 0;
            $u_TBuildPoints = 0;
            if ($Buildings_array[$CurUser['id']]) {
                foreach ($Buildings_array[$CurUser['id']] as $planet_id => $building) {
                    $u_points = GetBuildPoints($building);
                    $u_TBuildCount += $u_points['BuildCount'];
                    $u_TBuildPoints += $u_points['BuildPoint'] / $game_config['stat_settings'];
                    //We add the shields points (this way is a temporary way...)
                    $u_points = GetDefensePoints($building);
                    $u_TDefsCount += $u_points['DefenseCount'];
                    $u_TDefsPoints += $u_points['DefensePoint'] / $game_config['stat_settings'];
                }
                //We dont need this anymore...
                unset($Buildings_array[$CurUser['id']], $planet_id, $building);
            } else {
                //Here we will send a error message....print_r("<br>usuario sin planeta: ". $CurUser['id']);
            }
            $u_GCount = $u_TDefsCount + $u_TTechCount + $u_TFleetCount + $u_TBuildCount;
            $u_GPoints = $u_TTechPoints + $u_TDefsPoints + $u_TFleetPoints + $u_TBuildPoints;
            if ($CurUser['authlevel'] >= $game_config['stat_level'] && $game_config['stat'] == 1 || $CurUser['bana'] == 1) {
                $insert_user_query .= '(' . $CurUser['id'] . ',' . $CurUser['ally_id'] . ',1,1,' . $u_OldTechRank . ',
										0,0,' . $u_OldBuildRank . ',0,0,' . $u_OldDefsRank . ',0,0,' . $u_OldFleetRank . ',
										0,0,' . $u_OldTotalRank . ',0,0,' . $stats_time . '),';
            } else {
                $insert_user_query .= '(' . $CurUser['id'] . ',' . $CurUser['ally_id'] . ',1,1,' . $u_OldTechRank . ',
										' . $u_TTechPoints . ',' . $u_TTechCount . ',' . $u_OldBuildRank . ',' . $u_TBuildPoints . ',
										' . $u_TBuildCount . ',' . $u_OldDefsRank . ',' . $u_TDefsPoints . ',' . $u_TDefsCount . ',
										' . $u_OldFleetRank . ',' . $u_TFleetPoints . ',' . $u_TFleetCount . ',' . $u_OldTotalRank . ',
										' . $u_GPoints . ',' . $u_GCount . ',' . $stats_time . '),';
            }
            unset_vars('u_');
            $CheckUserQuery = true;
        }
        //TODO, make a end string check in case that insert_user_query end in VALUE...
        //Here we change the end of the query for ;
        if ($CheckUserQuery == true) {
            $insert_user_query = substr_replace($insert_user_query, ';', -1);
            doquery($insert_user_query, 'statpoints');
        }
        unset($insert_user_query, $total_data, $CurUser, $old_stats_array, $Buildings_array, $flying_fleets_array);
    }
    //STATS FOR ALLYS
    //Delet invalid allys
    doquery("DELETE FROM {{table}} WHERE ally_members='0'", "alliance");
    //We create this just for make a check of the ally
    $ally_check = doquery("SELECT * FROM {{table}}", 'alliance');
    $total_ally = 0;
    while ($CurAlly = mysql_fetch_assoc($ally_check)) {
        ++$total_ally;
        $ally_check_value[$CurAlly['id']] = 1;
    }
    unset($ally_check);
    unset($start, $QueryValue, $Query, $LastQuery);
    if ($total_ally > 0) {
        //Min amount = 10, if it is less than 10, it is not a good system
        $game_config['stat_amount'] = $game_config['stat_amount'] >= 10 ? $game_config['stat_amount'] : 10;
        $amount_per_block = $game_config['stat_amount'] < $game_config['users_amount'] ? $game_config['users_amount'] : $game_config['stat_amount'];
        if ($total_ally > $amount_per_block) {
            $LastQuery = roundUp($total_ally / $amount_per_block);
        } else {
            $LastQuery = 1;
        }
        for ($Query = 1; $Query <= $LastQuery; $Query++) {
            if ($Query == 1) {
                //based on:http://www.desarrolloweb.com/articulos/1035.php
                $start = 0;
            } else {
                $start = ($Query - 1) * $amount_per_block;
            }
            $minmax_sql = 'SELECT Max(id) AS `max`, Min(id) AS `min` FROM
						(SELECT id FROM {{table}}alliance ORDER BY id ASC LIMIT
						' . $start . ',' . $amount_per_block . ') AS A';
            $minmax = doquery($minmax_sql, '', true);
            $select_old_a_ranks = "s.id_owner , s.stat_type,\ts.tech_rank AS old_tech_rank,\r\n\t\t\t\t\t\t\t\ts.build_rank AS old_build_rank, s.defs_rank AS old_defs_rank, s.fleet_rank AS old_fleet_rank,\r\n\t\t\t\t\t\t\t\ts.total_rank AS old_total_rank";
            $select_ally = " a.id ";
            $sql_ally = 'SELECT  ' . $select_ally . ', ' . $select_old_a_ranks . '
							FROM {{table}}alliance AS a
							INNER JOIN {{table}}statpoints AS s ON a.id = s.id_owner  AND s.stat_type = 2
							WHERE a.id <= ' . $minmax['max'] . ' AND a.id >=  ' . $minmax['min'] . '
							ORDER BY a.id;';
            $ally_data = doquery($sql_ally, '');
            $ally_sql_points = 'SELECT
							s.stat_type, s.id_ally, Sum(s.tech_points) AS TechPoint,
								Sum(s.tech_count) AS TechCount, Sum(s.build_points) AS BuildPoint,
								Sum(s.build_count) AS BuildCount, Sum(s.defs_points) AS DefsPoint,
								Sum(s.defs_count) AS DefsCount, Sum(s.fleet_points) AS FleetPoint,
								Sum(s.fleet_count) AS FleetCount, Sum(s.total_points) AS TotalPoint,
								Sum(s.total_count) AS TotalCount
								FROM
								{{table}}statpoints AS s
								WHERE	s.stat_type =  1 AND s.id_ally > 0
								AND s.id_ally <= ' . $minmax['max'] . ' AND s.id_ally >=  ' . $minmax['min'] . '
								GROUP BY	s.id_ally;';
            $ally_points = doquery($ally_sql_points, '');
            //We delete now the old stats of the allys
            doquery('DELETE FROM {{table}} WHERE `stat_type` = 2 AND id_owner <= ' . $minmax['max'] . ' AND id_owner >=  ' . $minmax['min'] . ';', 'statpoints');
            while ($CurAlly = mysql_fetch_assoc($ally_data)) {
                $ally_old_data[$CurAlly['id']] = $CurAlly;
            }
            unset($CurAlly, $ally_data);
            $insert_ally_query = "INSERT INTO {{table}}\r\n\t\t\t\t\t\t\t\t\t(`id_owner`, `id_ally`, `stat_type`, `stat_code`,\r\n\t\t\t\t\t\t\t\t\t`tech_old_rank`, `tech_points`, `tech_count`,\r\n\t\t\t\t\t\t\t\t\t`build_old_rank`, `build_points`, `build_count`,\r\n\t\t\t\t\t\t\t\t\t`defs_old_rank`, `defs_points`, `defs_count`,\r\n\t\t\t\t\t\t\t\t\t`fleet_old_rank`, `fleet_points`, `fleet_count`,\r\n\t\t\t\t\t\t\t\t\t`total_old_rank`, `total_points`, `total_count`, `stat_date`) VALUES ";
            while ($CurAlly = mysql_fetch_assoc($ally_points)) {
                if ($ally_check_value[$CurAlly['id_ally']] == 1) {
                    $u_OldTotalRank = $ally_old_data[$CurAlly['id_ally']]['old_total_rank'] ? $ally_old_data[$CurAlly['id_ally']]['old_total_rank'] : 0;
                    $u_OldTechRank = $ally_old_data[$CurAlly['id_ally']]['old_tech_rank'] ? $ally_old_data[$CurAlly['id_ally']]['old_tech_rank'] : 0;
                    $u_OldBuildRank = $ally_old_data[$CurAlly['id_ally']]['old_build_rank'] ? $ally_old_data[$CurAlly['id_ally']]['old_build_rank'] : 0;
                    $u_OldDefsRank = $ally_old_data[$CurAlly['id_ally']]['old_defs_rank'] ? $ally_old_data[$CurAlly['id_ally']]['old_defs_rank'] : 0;
                    $u_OldFleetRank = $ally_old_data[$CurAlly['id_ally']]['old_fleet_rank'] ? $ally_old_data[$CurAlly['id_ally']]['old_fleet_rank'] : 0;
                    $u_TTechCount = $CurAlly['TechCount'];
                    $u_TTechPoints = $CurAlly['TechPoint'];
                    $u_TBuildCount = $CurAlly['BuildCount'];
                    $u_TBuildPoints = $CurAlly['BuildPoint'];
                    $u_TDefsCount = $CurAlly['DefsCount'];
                    $u_TDefsPoints = $CurAlly['DefsPoint'];
                    $u_TFleetCount = $CurAlly['FleetCount'];
                    $u_TFleetPoints = $CurAlly['FleetPoint'];
                    $u_GCount = $CurAlly['TotalCount'];
                    $u_GPoints = $CurAlly['TotalPoint'];
                    $insert_ally_query .= '(' . $CurAlly['id_ally'] . ',0,2,1,' . $u_OldTechRank . ',
											' . $u_TTechPoints . ',' . $u_TTechCount . ',' . $u_OldBuildRank . ',' . $u_TBuildPoints . ',
											' . $u_TBuildCount . ',' . $u_OldDefsRank . ',' . $u_TDefsPoints . ',' . $u_TDefsCount . ',
											' . $u_OldFleetRank . ',' . $u_TFleetPoints . ',' . $u_TFleetCount . ',' . $u_OldTotalRank . ',
											' . $u_GPoints . ',' . $u_GCount . ',' . $stats_time . '),';
                    unset($CurAlly);
                    unset_vars('u_');
                } else {
                    doquery("UPDATE {{table}}\tSET `ally_id`=0, `ally_name` = '', \t`ally_register_time`= 0, `ally_rank_id`= 0 \tWHERE `ally_id`='{$CurAlly['id_ally']}'", "users");
                }
                $CheckAllyQuery = true;
            }
            //Here we change the end of the query for ;
            if ($CheckAllyQuery == true) {
                $insert_ally_query = substr_replace($insert_ally_query, ';', -1);
                doquery($insert_ally_query, 'statpoints');
            }
            unset($insert_ally_query, $ally_old_data, $CurAlly, $ally_points);
        }
        unset($ally_check_value);
        //We update the ranks of the allys
        MakeNewRanks(2);
    }
    //We update the ranks of the users
    MakeNewRanks(1);
    // Calcul de la duree de traitement (calcul)
    $mtime = microtime();
    $mtime = explode(" ", $mtime);
    $mtime = $mtime[1] + $mtime[0];
    $endtime = $mtime;
    $result['stats_time'] = $stats_time;
    $result['totaltime'] = $endtime - $starttime;
    $result['memory_peak'] = array(round(memory_get_peak_usage() / 1024, 1), round(memory_get_peak_usage(1) / 1024, 1));
    $result['end_memory'] = array(round(memory_get_usage() / 1024, 1), round(memory_get_usage(1) / 1024, 1));
    $result['amount_per_block'] = $amount_per_block;
    return $result;
}
function display()
{
    global $dbh, $db_functions, $foundX_match, $reltext, $bloodreltext, $name1, $name2, $spouse, $rel_arrayspouseX;
    global $special_spouseY, $special_spouseX, $spousenameX, $spousenameY, $table, $doublespouse;
    global $rel_arrayX, $rel_arrayY, $famX, $famY, $language, $dutchtext, $searchDb, $searchDb2;
    global $sexe, $selected_language, $dirmark1, $famspouseX, $famspouseY, $reltext_nor, $reltext_nor2;
    global $fampath;
    // path to family.php for Joomla and regular. Defined above all functions
    global $person, $person2, $tree_id;
    global $tree_prefix_quoted;
    // *** Use person class ***
    $pers_cls = new person_cls();
    $language_is = ' ' . __('is') . ' ';
    if ($selected_language == "he") {
        if ($sexe == "m") {
            $language_is = ' הוא ';
        } else {
            $language_is = ' היא ';
        }
    } elseif ($selected_language == "cn") {
        $language_is = '的';
    }
    $bloodrel = '';
    search_bloodrel();
    if ($reltext) {
        //print '<table class="humo container"><tr><td>';
        print '<table class="ext"><tr><td style="padding-right:30px;vertical-align:text-top;">';
        $bloodrel = 1;
        print __('BLOOD RELATIONSHIP: ');
        echo "<br><br>";
        if ($selected_language == "cn" and strpos($reltext, "notext") !== false) {
            // don't display text if relation can't be phrased
        } else {
            if ($selected_language == "fi") {
                print 'Kuka: ';
            }
            // who
            print "&nbsp;&nbsp;<a class='relsearch' href='" . $fampath . "database=" . safe_text($_SESSION['tree_prefix']) . "&amp;id=" . $famX . "&amp;main_person=" . $rel_arrayX[0][0] . "'>";
            print $name1 . "</a>";
            if ($selected_language == "fi") {
                print '&nbsp;&nbsp;' . 'Kenelle: ';
            } else {
                print $language_is . $reltext;
            }
            print "<a class='relsearch' href='" . $fampath . "database=" . safe_text($_SESSION['tree_prefix']) . "&amp;id=" . $famY . "&amp;main_person=" . $rel_arrayY[0][0] . "'>" . $name2 . "</a>" . $reltext_nor . "<p>";
            print $dutchtext;
            if ($selected_language == "fi") {
                echo 'Sukulaisuus tai muu suhde: <b>' . $reltext . '</b>';
            }
            print '<hr style="width:100%;height:0.25em;color:darkblue;background-color:darkblue;"  >';
        }
        $bloodreltext = $reltext;
        display_table();
    }
    if ($table != 1 and $table != 2 and $table != 7) {
        unset_vars();
        search_marital();
        if ($reltext) {
            // notext is used in Chinese display if relation can't be worded.
            //check if this is involves a marriage or a partnership of any kind
            $relmarriedX = 0;
            if (isset($famspouseX)) {
                $kindrel = $dbh->query("SELECT fam_kind FROM humo_families\n\t\t\t\t\tWHERE fam_tree_id='" . $tree_id . "' AND fam_gedcomnumber='" . $famspouseX . "'");
                @($kindrelDb = $kindrel->fetch(PDO::FETCH_OBJ));
                if ($kindrelDb->fam_kind != 'living together' and $kindrelDb->fam_kind != 'engaged' and $kindrelDb->fam_kind != 'homosexual' and $kindrelDb->fam_kind != 'unknown' and $kindrelDb->fam_kind != 'non-marital' and $kindrelDb->fam_kind != 'partners' and $kindrelDb->fam_kind != 'registered') {
                    $relmarriedX = 1;
                    // use: husband or wife
                } else {
                    $relmarriedX = 0;
                    // use: partner
                }
            }
            $relmarriedY = 0;
            if (isset($famspouseY)) {
                $kindrel2 = $dbh->query("SELECT fam_kind\n\t\t\t\t\tFROM humo_families WHERE fam_tree_id='" . $tree_id . "' AND fam_gedcomnumber='" . $famspouseY . "'");
                @($kindrel2Db = $kindrel2->fetch(PDO::FETCH_OBJ));
                if ($kindrel2Db->fam_kind != 'living together' and $kindrel2Db->fam_kind != 'engaged' and $kindrel2Db->fam_kind != 'homosexual' and $kindrel2Db->fam_kind != 'unknown' and $kindrel2Db->fam_kind != 'non-marital' and $kindrel2Db->fam_kind != 'partners' and $kindrel2Db->fam_kind != 'registered') {
                    $relmarriedY = 1;
                    // use: husband or wife
                } else {
                    $relmarriedY = 0;
                    // use: partner
                }
            }
            if ($bloodrel == 1) {
                if (CMS_SPECIFIC == "Joomla") {
                    print '</td></tr><tr><td>';
                    // in joomla we want blood- and marital tables one under the other for lack of space
                } else {
                    print '</td><td style="padding-left:30px;border-left:2px solid #bbbbbb;vertical-align:text-top;">';
                }
            } else {
                echo '<table class="ext"<tr><td>';
            }
            print __('MARITAL RELATIONSHIP: ');
            echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input style="font-size:110%" type="submit" name="extended" value="' . __('Use Extended Calculator') . '">';
            echo "<br><br>";
            $spousetext1 = '';
            $spousetext2 = '';
            $finnish_spouse1 = '';
            $finnish_spouse2 = '';
            if ($doublespouse == 1) {
                // X and Y are both spouses of Z
                $spouseidDb = $db_functions->get_person($rel_arrayspouseX[$foundX_match][0]);
                $name = $pers_cls->person_name($spouseidDb);
                $spousename = $name["name"];
                print "<span>&nbsp;&nbsp;<a class='relsearch' href='" . $fampath . "database=" . safe_text($_SESSION['tree_prefix']) . "&amp;id=" . $famX . "&amp;main_person=" . $rel_arrayX[0][0] . "'>";
                //print $name1."</a> and ";
                print $name1 . "</a> " . __('and') . ': ';
                print "<a class='relsearch' href='" . $fampath . "database=" . safe_text($_SESSION['tree_prefix']) . "&amp;id=" . $famY . "&amp;main_person=" . $rel_arrayY[0][0] . "'>" . $name2 . "</a>";
                if ($searchDb->pers_sexe == "M") {
                    echo ' ' . __('are both husbands of') . ' ';
                } else {
                    print ' ' . __('are both wifes of') . ' ';
                }
                print "<a href='" . $fampath . "database=" . safe_text($_SESSION['tree_prefix']) . "&amp;id=" . $famY . "&amp;main_person=" . $rel_arrayspouseX[$foundX_match][0] . "'>" . $spousename . "</a></span><br>";
            } elseif ($reltext != "notext") {
                if ($spouse == 1 and $special_spouseX !== 1 or $spouse == 3) {
                    if ($relmarriedX == 0 and $selected_language != "cn") {
                        $spousetext1 = strtolower(__('Partner')) . __(' of ');
                        $finnish_spouse1 = strtolower(__('Partner'));
                    } else {
                        if ($searchDb->pers_sexe == 'M') {
                            $spousetext1 = ' ' . __('husband of') . ' ';
                            if ($selected_language == "fi") {
                                $finnish_spouse1 = 'mies';
                            }
                            if ($selected_language == "cn") {
                                $spousetext1 = '妻子';
                            }
                            // "A's wife is B"
                        } else {
                            $spousetext1 = ' ' . __('wife of') . ' ';
                            if ($selected_language == "fi") {
                                $finnish_spouse1 = 'vaimo';
                            }
                            if ($selected_language == "cn") {
                                $spousetext1 = '丈夫';
                            }
                            // "A's husband is B"
                        }
                    }
                }
                if (($spouse == 2 or $spouse == 3) and $special_spouseY !== 1) {
                    if ($relmarriedY == 0 and $selected_language != "cn") {
                        $spousetext2 = strtolower(__('Partner')) . __(' of ');
                        $finnish_spouse2 = strtolower(__('Partner'));
                    } else {
                        if ($searchDb2->pers_sexe == 'M') {
                            $spousetext2 = ' ' . __('wife of') . ' ';
                            if ($selected_language == "fi") {
                                $finnish_spouse2 = 'mies';
                            }
                            // yes - it's really husband cause the sentence goes differently
                            if ($selected_language == "cn") {
                                $spousetext2 = '丈夫';
                            }
                            // "A's uncle's husband is B"
                        } else {
                            $spousetext2 = ' ' . __('husband of') . ' ';
                            if ($selected_language == "fi") {
                                $finnish_spouse2 = 'vaimo';
                            }
                            // yes - it's really wife cause the sentence goes differently
                            if ($selected_language == "cn") {
                                $spousetext2 = '妻子';
                            }
                            // "A's uncle's wife is B"
                        }
                    }
                }
                if ($selected_language == "fi") {
                    // very different phrasing for correct grammar
                    print 'Kuka: ';
                    print "<span>&nbsp;&nbsp;<a class='relsearch' href='" . $fampath . "database=" . safe_text($_SESSION['tree_prefix']) . "&amp;id=" . $famX . "&amp;main_person=" . $rel_arrayX[0][0] . "'>";
                    print $name1 . "</a>";
                    print '&nbsp;&nbsp;Kenelle: ';
                    print "<a class='relsearch' href='" . $fampath . "database=" . safe_text($_SESSION['tree_prefix']) . "&amp;id=" . $famY . "&amp;main_person=" . $rel_arrayY[0][0] . "'>" . $name2 . "</a></span><br>";
                    print 'Sukulaisuus tai muu suhde: ';
                    if (!$special_spouseX and !$special_spouseY and $table != 7) {
                        if ($spousetext2 != '' and $spousetext1 == '') {
                            // X is relative of spouse of Y
                            print '(';
                            print "<a href='" . $fampath . "database=" . safe_text($_SESSION['tree_prefix']) . "&amp;id=" . $famX . "&amp;main_person=" . $rel_arrayX[0][0] . "'>" . $name1 . "</a>";
                            print ' - ' . $spousenameY . '):&nbsp;&nbsp;' . $reltext . '<br>';
                            print $spousenameY . ', ' . $finnish_spouse2 . ' ';
                            print "<a href='" . $fampath . "database=" . safe_text($_SESSION['tree_prefix']) . "&amp;id=" . $famY . "&amp;main_person=" . $rel_arrayY[0][0] . "'>" . $name2 . "</a>";
                        } elseif ($spousetext1 != '' and $spousetext2 == '') {
                            // X is spouse of relative of Y
                            print '(' . $spousenameX . ' - ';
                            print "<a href='" . $fampath . "database=" . safe_text($_SESSION['tree_prefix']) . "&amp;id=" . $famY . "&amp;main_person=" . $rel_arrayY[0][0] . "'>" . $name2 . "</a>";
                            print '):&nbsp;&nbsp;' . $reltext . '<br>';
                            print $spousenameX . ', ' . $finnish_spouse1 . ' ';
                            print "<a href='" . $fampath . "database=" . safe_text($_SESSION['tree_prefix']) . "&amp;id=" . $famX . "&amp;main_person=" . $rel_arrayX[0][0] . "'>" . $name1 . "</a>";
                        } else {
                            // X is spouse of relative of spouse of Y
                            print '(' . $spousenameX . ' - ' . $spousenameY . '):&nbsp;&nbsp;' . $reltext . '<br>';
                            print $spousenameX . ', ' . $finnish_spouse1 . ' ';
                            print "<a href='" . $fampath . "database=" . safe_text($_SESSION['tree_prefix']) . "&amp;id=" . $famX . "&amp;main_person=" . $rel_arrayX[0][0] . "'>" . $name1 . "</a><br>";
                            print $spousenameY . ', ' . $finnish_spouse2 . ' ';
                            print "<a href='" . $fampath . "database=" . safe_text($_SESSION['tree_prefix']) . "&amp;id=" . $famY . "&amp;main_person=" . $rel_arrayY[0][0] . "'>" . $name2 . "</a>";
                        }
                    } elseif ($special_spouseX or $special_spouseY) {
                        // brother-in-law/sister-in-law/father-in-law/mother-in-law
                        print '<b>' . $reltext . '</b><br>';
                    } elseif ($table == 7) {
                        if ($relmarriedX == 0 or $relmarriedY == 0) {
                            print '<b>' . strtolower(__('Partner')) . '</b><br>';
                        } else {
                            print '<b>' . $finnish_spouse1 . '</b><br>';
                        }
                    }
                } else {
                    if ($spousetext2 == '') {
                        $reltext_nor2 = '';
                    } else {
                        $reltext_nor = '';
                    }
                    if ($selected_language == "cn") {
                        $language_is = '的';
                        if ($reltext == " ") {
                            // A's husband/wife is B
                            $reltext = "是";
                        } else {
                            mb_internal_encoding("UTF-8");
                            if ($spousetext1 != "" and $spousetext2 == "") {
                                $spousetext1 .= '的';
                            } elseif ($spousetext2 != "" and $spousetext1 == "") {
                                $reltext = mb_substr($reltext, 0, -1) . '的';
                                $spousetext2 .= '是';
                            } elseif ($spousetext1 != "" and $spousetext2 != "") {
                                $spousetext1 .= '的';
                                $reltext = mb_substr($reltext, 0, -1) . '的';
                                $spousetext2 .= '是';
                            }
                        }
                    }
                    if ($table == 6 or $table == 7) {
                        $reltext_nor = '';
                    }
                    print "<span>&nbsp;&nbsp;<a class='relsearch' href='" . $fampath . "database=" . safe_text($_SESSION['tree_prefix']) . "&amp;id=" . $famX . "&amp;main_person=" . $rel_arrayX[0][0] . "'>";
                    print $name1 . "</a>" . $language_is . $spousetext1 . $reltext . $reltext_nor2 . $spousetext2;
                    print "<a class='relsearch' href='" . $fampath . "database=" . safe_text($_SESSION['tree_prefix']) . "&amp;id=" . $famY . "&amp;main_person=" . $rel_arrayY[0][0] . "'>" . $name2 . "</a>" . $reltext_nor . "</span><br>";
                }
            }
            print '<hr style="width:100%;height:0.25em;color:darkblue;background-color:darkblue;" >';
            display_table();
            /*			
            			echo '<br><br><div style="margin-left:auto;margin-right:auto;padding:3px;width:400px;background-color:#eeeeee"><input type="submit" name="next_path" value="'.__('Try to find another path').'" style="font-size:115%;">';
            			echo '<br>'.__('(With each consecutive search the path may get longer and computing time may increase!)').'</div>';
            */
        }
    }
    //if($bloodreltext=='' AND $reltext=='') {
    if ($reltext == '') {
        if ($bloodreltext == '') {
            echo '<br><table class="ext"><tr><td>';
            echo '<td style="text-align:left;border-left:0px;padding10px;vertical-align:text-top;width:800px">';
            echo "<div style='font-weight:bold'>" . __('No blood relation or direct marital relation found') . "</div>";
        } else {
            echo '<td style="width:60px">&nbsp;</td>';
            echo '<td style="padding-left:50px;padding-right:10px;vertical-align:text-top;border-left:2px solid #bbbbbb;width:350px">';
            print __('MARITAL RELATIONSHIP: ');
            echo "<br><br><div style='font-weight:bold;margin-bottom:10px'>" . __('No direct marital relation found') . "</div>";
        }
        print '<hr style="width:100%;height:0.25em;color:darkblue;background-color:darkblue;" >';
        echo __("You may wish to try finding a connection with the <span style='font-weight:bold'>Extended Marital Calculator</span> below.<br>\t\n\t\t\t\tThis will find connections that span over many marital relations and generations.<br>\t\n\t\t\t\tComputing time will vary depending on the size of the tree and the distance between the two persons.<br>\t\n\t\t\t\tFor example, in a 10,000 person tree even the most distant persons will usually be found within 1-2 seconds.<br>\t\n\t\t\t\tIn a 75,000 person tree the most distant persons may take up to 8 sec to find.<br><br>");
        echo '<input type="submit" name="extended" value="' . __('Perform extended marital calculation') . '" style="font-size:115%;">';
        echo "</td></tr></table>";
    } else {
        print '</td></tr></table>';
    }
    print '<br><br>';
}
Exemple #4
0
 private function MakeStatsUser()
 {
     global $db;
     $select_planet = "p.id_owner";
     $select_old_ranks = "s.id_owner, s.stat_type,s.tech_rank AS old_tech_rank, s.build_rank AS old_build_rank, s.defs_rank AS old_defs_rank, s.fleet_rank AS old_fleet_rank,s. total_rank AS old_total_rank";
     $select_user = "******";
     $sql = 'SELECT p.id ,' . $this->select_buildings . $select_planet . '  FROM {{table}}planets as p ORDER BY p.id ASC ';
     $sql_old_stats = 'SELECT ' . $select_old_ranks . ' FROM {{table}} as s WHERE stat_type = 1;';
     //CARGAMOS CONSTRUCCIONES
     $parcial_data = $db->query($sql, '');
     while ($CurPlanet = mysql_fetch_assoc($parcial_data)) {
         $points = $this->GetBuildPoints($CurPlanet);
         $Buildings_array[$CurPlanet['id_owner']]['count'] += $points['BuildCount'];
         $Buildings_array[$CurPlanet['id_owner']]['point'] += $points['BuildPoint'] / $db->game_config['stat_settings'];
     }
     //unset($CurPlanet, $parcial_data);
     arsort($Buildings_array);
     $i = 1;
     foreach ($Buildings_array as $key => $val) {
         $Buildings_array[$key]["rank"] = $i;
         ++$i;
     }
     //FIN DE CARGA CONSTRUCCIONES
     //CARGAMOS ANTIGUO RANQUIN
     $old_stats = $db->query($sql_old_stats, 'statpoints');
     while ($CurStats = mysql_fetch_assoc($old_stats)) {
         $old_stats_array[$CurStats['id_owner']] = $CurStats;
     }
     //CARGAMOS TECNOLOGIA
     $sql = 'SELECT  ' . $this->selected_tech . ' u.id FROM {{table}} as u';
     $user_tech = $db->query($sql, 'users');
     while ($CurStats = mysql_fetch_assoc($user_tech)) {
         $points = $this->GetTechnoPoints($CurStats);
         $tech_array[$CurStats['id']]['count'] = $points['TechCount'];
         $tech_array[$CurStats['id']]['point'] = $points['TechPoint'] / $db->game_config['stat_settings'];
         $list_user[] = $CurStats['id'];
     }
     arsort($tech_array);
     $i = 1;
     foreach ($tech_array as $key => $val) {
         $tech_array[$key]["rank"] = $i;
         ++$i;
     }
     //FIN DE CARGA TECNOLOGIA
     //CARGAMOS  FLOTA
     $sql = 'SELECT ' . $this->select_fleets . $select_planet . ' FROM {{table}}planets as p GROUP BY p.id_owner;';
     $total_data = $db->query($sql, '');
     while ($CurStats = mysql_fetch_assoc($total_data)) {
         $points = $this->GetFleetPoints($CurStats);
         $fleets_array[$CurStats['id_owner']]['count'] = $points['FleetCount'];
         $fleets_array[$CurStats['id_owner']]['point'] = $points['FleetPoint'] / $db->game_config['stat_settings'];
     }
     if ($db->game_config['stat_flying'] == 1) {
         $sql_flying_fleets = 'SELECT fleet_array, fleet_owner FROM {{table}} ;';
         $flying_fleets = $db->query($sql_flying_fleets, 'fleets');
         while ($CurFleets = mysql_fetch_assoc($flying_fleets)) {
             $points = $this->GetFlyingFleetPoints($CurFleets['fleet_array']);
             $fleets_array[$CurFleets['fleet_owner']]['count'] += $points['FleetCount'];
             $fleets_array[$CurFleets['fleet_owner']]['point'] += $u_points['FleetPoint'] / $db->game_config['stat_settings'];
         }
         //unset($CurFleets, $flying_fleets);
     }
     //unset($CurStats, $total_data);
     arsort($fleets_array);
     $i = 1;
     foreach ($fleets_array as $key => $val) {
         $fleets_array[$key]["rank"] = $i;
         ++$i;
     }
     //FIN DE LA CARGA FLOTA
     //CARGAMOS DEFENSA
     $sql = 'SELECT ' . $this->select_defenses . $select_planet . ' FROM {{table}}planets as p GROUP BY p.id_owner;';
     $total_data = $db->query($sql, '');
     while ($CurStats = mysql_fetch_assoc($total_data)) {
         $points = $this->GetDefensePoints($CurStats);
         $defs_array[$CurStats['id_owner']]["count"] = $points['DefenseCount'];
         $defs_array[$CurStats['id_owner']]["point"] = $points['DefensePoint'] / $db->game_config['stat_settings'];
         //unset($points);
     }
     arsort($defs_array);
     $i = 1;
     foreach ($defs_array as $key => $val) {
         $defs_array[$key]["rank"] = $i;
         ++$i;
     }
     //FIN DE LA CARGA DEFENSA
     //CARGAMOS TODAS LAS PUNTUACIONES
     foreach ($list_user as $id) {
         $total[$id] = $defs_array[$id]["point"];
         $total[$id] += $fleets_array[$id]['point'];
         $total[$id] += $tech_array[$id]['point'];
         $total[$id] += $Buildings_array[$id]['point'];
     }
     arsort($total);
     $i = 1;
     foreach ($total as $key => $val) {
         unset($total[$key]);
         $orden[$key] = $i;
         ++$i;
     }
     //FIN DE LA CARGA DE PUNTUACIONES
     $sql = 'SELECT  ' . $select_user . ' FROM {{table}} as u';
     $users = $db->query($sql, 'users');
     while ($CurUser = mysql_fetch_assoc($users)) {
         if ($old_stats_array[$CurUser['id']]) {
             $u_OldTotalRank = $old_stats_array[$CurUser['id']]['old_total_rank'];
             $u_OldTechRank = $old_stats_array[$CurUser['id']]['old_tech_rank'];
             $u_OldBuildRank = $old_stats_array[$CurUser['id']]['old_build_rank'];
             $u_OldDefsRank = $old_stats_array[$CurUser['id']]['old_defs_rank'];
             $u_OldFleetRank = $old_stats_array[$CurUser['id']]['old_fleet_rank'];
             unset($old_stats_array[$CurUser['id']]);
         } else {
             $u_OldTotalRank = 0;
             $u_OldTechRank = 0;
             $u_OldBuildRank = 0;
             $u_OldDefsRank = 0;
             $u_OldFleetRank = 0;
         }
         //VOLCAMOS LOS DATOS DE LA TECNOLOGIA AL USUARIO
         $u_tech_rank = $tech_array[$CurUser['id']]['rank'];
         $u_TTechCount = $tech_array[$CurUser['id']]['count'];
         $u_TTechPoints = $tech_array[$CurUser['id']]['point'];
         unset($tech_array[$CurUser['id']]);
         //VOLCAMOS LOS DATOS DE LA DEFENSA AL USUARIO
         $u_defs_rank = $defs_array[$CurUser['id']]["rank"];
         $u_TDefsCount = $defs_array[$CurUser['id']]['count'];
         $u_TDefsPoints = $defs_array[$CurUser['id']]['point'];
         unset($defs_array[$CurUser['id']]);
         //VOLCAMOS LOS DATOS DE LA FLOTA AL USUARIO
         $u_fleet_rank = $fleets_array[$CurUser['id']]["rank"];
         $u_TFleetCount = $fleets_array[$CurUser['id']]['count'];
         $u_TFleetPoints = $fleets_array[$CurUser['id']]['point'];
         unset($fleets_array[$CurUser['id']]);
         if ($Buildings_array[$CurUser['id']]) {
             $u_TBuildCount = $Buildings_array[$CurUser['id']]['count'];
             $u_TBuildPoints = $Buildings_array[$CurUser['id']]['point'];
             if ($CurUser['ally_id'] != 0) {
                 $this->Ally_Build[$CurUser['ally_id']]['count'] += $u_TBuildCount;
                 $this->Ally_Build[$CurUser['ally_id']]['point'] += $u_TBuildPoints;
             }
             $u_build_rank = $Buildings_array[$CurUser['id']]['rank'];
             unset($Buildings_array[$CurUser['id']]);
         }
         //SI ESTA EN UNA ALIANZA CARGAMOS LOS VALORES
         if ($CurUser['ally_id'] != 0) {
             $this->Ally_Fleet[$CurUser['ally_id']]['count'] += $u_TFleetCount;
             $this->Ally_Fleet[$CurUser['ally_id']]['point'] += $u_TFleetPoints;
             $this->Ally_Defs[$CurUser['ally_id']]['count'] += $u_TDefsCount;
             $this->Ally_Defs[$CurUser['ally_id']]['point'] += $u_TDefsPoints;
             $this->Ally_Tech[$CurUser['ally_id']]['count'] += $u_TTechCount;
             $this->Ally_Tech[$CurUser['ally_id']]['point'] += $u_TTechPoints;
             $this->Ally_rank[$CurUser['ally_id']] += $u_TTechPoints + $u_TDefsPoints + $u_TFleetPoints + $u_TBuildPoints;
             $this->Ally_array[] = $CurUser['ally_id'];
         }
         if ($CurUser['authlevel'] >= $db->game_config['stat_level'] && $db->game_config['stat'] == 1 || $CurUser['bana'] == 1) {
             $insert__query[] .= '(' . $CurUser['id'] . ',' . $CurUser['ally_id'] . ',1,1,' . $u_OldTechRank . ',
                                             0,0,' . $u_OldBuildRank . ',0,0,' . $u_OldDefsRank . ',0,0,' . $u_OldFleetRank . ',
                                             0,0,' . $u_OldTotalRank . ',0,0,' . $this->stats_time . ',
                                             0,0,0,0,0),';
         } else {
             $u_GCount = $u_TDefsCount + $u_TTechCount + $u_TFleetCount + $u_TBuildCount;
             $u_GPoints = $u_TTechPoints + $u_TDefsPoints + $u_TFleetPoints + $u_TBuildPoints;
             $insert__query[] .= '(' . $CurUser['id'] . ',' . $CurUser['ally_id'] . ',1,1,' . $u_OldTechRank . ',
                                         ' . $u_TTechPoints . ',' . $u_TTechCount . ',' . $u_OldBuildRank . ',' . $u_TBuildPoints . ',
                                         ' . $u_TBuildCount . ',' . $u_OldDefsRank . ',' . $u_TDefsPoints . ',' . $u_TDefsCount . ',
                                         ' . $u_OldFleetRank . ',' . $u_TFleetPoints . ',' . $u_TFleetCount . ',' . $u_OldTotalRank . ',
                                         ' . $u_GPoints . ',' . $u_GCount . ',' . $this->stats_time . ',
                                         ' . $u_fleet_rank . ',' . $u_defs_rank . ',' . $u_build_rank . ',' . $u_tech_rank . ',' . $orden[$CurUser['id']] . '),';
         }
         unset_vars('u_');
     }
     //BORRAMOS STAT_TYPE 1 USUARIOS
     $db->query("DELETE FROM {{table}} WHERE `stat_type` = '1';", 'statpoints');
     //YA HEMOS CREADOS LOS ARRAYS DE LA ACTUALIZACION
     $this->NewQueryStats($this->total_users, $insert__query);
 }
    foreach ($test as $var) {
        if (is_array(${$var_prefix . $var . $var_suffix})) {
            unset_vars(${$var_prefix . $var . $var_suffix});
            @reset(${$var_prefix . $var . $var_suffix});
        }
        if (is_array(${$var})) {
            unset_vars(${$var});
            @reset(${$var});
        }
    }
    if (is_array(${'_FILES'})) {
        unset_vars(${'_FILES'});
        @reset(${'_FILES'});
    }
    if (is_array(${'HTTP_POST_FILES'})) {
        unset_vars(${'HTTP_POST_FILES'});
        @reset(${'HTTP_POST_FILES'});
    }
}
// PHP5 with register_long_arrays off?
if (!isset($HTTP_POST_VARS) && isset($_POST)) {
    $HTTP_POST_VARS = $_POST;
    $HTTP_GET_VARS = $_GET;
    $HTTP_SERVER_VARS = $_SERVER;
    $HTTP_COOKIE_VARS = $_COOKIE;
    $HTTP_ENV_VARS = $_ENV;
    $HTTP_POST_FILES = $_FILES;
}
//
// addslashes to vars if magic_quotes_gpc is off
// this is a security precaution to prevent someone
Exemple #6
0
<?php

/**
* 1. Escriba una página que permita crear una cookie de duración limitada, comprobar el estado
* de la cookie y destruirla. 
*/
$cookie = "";
if (isset($_REQUEST["delete"])) {
    unset_vars("custom_cookie");
}
if (isset($_REQUEST["submit"])) {
    if (strlen($_REQUEST["cookie"]) > 0) {
        if (is_numeric($_REQUEST["time"])) {
            if (intval($_REQUEST["time"]) > 0) {
                $time = round(time() + $_REQUEST["time"]);
                setcookie("custom_cookie", $_REQUEST["cookie"], $time);
                setcookie("custom_cookie_time", $time, $time);
                Header("Location: http://192.168.115.103/?cat=php&p=cookie_state");
            }
        }
    }
}
if (isset($_COOKIE["custom_cookie"])) {
    $cookie = $_COOKIE["custom_cookie"];
    $time = $_COOKIE["custom_cookie_time"];
    echo "<p>Su cookie caduca: " . date("j-m-Y H:i:s", $time) . "</p>";
}
?>
<form method="post" action="#">
    <p>
        <strong>Su cookie: </strong>