include "conecta.php"; $abc = mysqli_query ($conecta,"SELECT estado, cookie, dia from regalos"); list ($activo, $cookie, $dia) = mysqli_fetch_row ($abc); $id = 0; if ($activo == 0) { echo "AHORA MISMO NO SE PUEDE PARTICIPAR"; setcookie("$cookie","x",time()-3600, "/", ".hipercarcampanar.com");; die (); } function rstring($length = 10) { return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length); } function get_client_ip() { $ipaddress = ''; if (getenv('HTTP_CLIENT_IP')) $ipaddress = getenv('HTTP_CLIENT_IP'); else if(getenv('HTTP_X_FORWARDED_FOR')) $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); else if(getenv('HTTP_X_FORWARDED')) $ipaddress = getenv('HTTP_X_FORWARDED'); else if(getenv('HTTP_FORWARDED_FOR')) $ipaddress = getenv('HTTP_FORWARDED_FOR'); else if(getenv('HTTP_FORWARDED')) $ipaddress = getenv('HTTP_FORWARDED'); else if(getenv('REMOTE_ADDR')) $ipaddress = getenv('REMOTE_ADDR'); else $ipaddress = 'UNKNOWN'; return $ipaddress; } $prueba1 = $_COOKIE["$cookie"]; //die ("p $prueba1"); if ($_COOKIE["$cookie"] == "") { $alea = rstring (10); setcookie("$cookie",$alea,time()+1296000, "/", ".hipercarcampanar.com"); $ip = get_client_ip(); $abc = mysqli_query ($conecta,"SELECT id from regalos_gente where ip = '$ip'"); if (mysqli_num_rows ($abc) == 1) mysqli_query ($conecta,"UPDATE regalos_gente set aleatorio = '$alea' where ip = '$ip'"); else mysqli_query ($conecta,"INSERT INTO regalos_gente values (NULL, '$alea', '$ip', '0')") or die (mysqli_error ()); $valorx = $alea; } else { $valorx = $_COOKIE["$cookie"]; $abc = mysqli_query ($conecta,"SELECT id from regalos_gente where aleatorio = '$valorx'"); if (mysqli_num_rows ($abc) == 0) { $alea = rstring (10); setcookie("$cookie",$alea,time()+1296000, "/", ".hipercarcampanar.com"); $ip = get_client_ip(); $abc = mysqli_query ($conecta,"SELECT id from regalos_gente where ip = '$ip'"); if (mysqli_num_rows ($abc) == 1) mysqli_query ($conecta,"UPDATE regalos_gente set aleatorio = '$alea' where ip = '$ip'"); else mysqli_query ($conecta,"INSERT INTO regalos_gente values (NULL, '$alea', '$ip', '0')") or die (mysqli_error ()); $valor = $alea; } } ?>
$abc = mysqli_query ($conecta,"SELECT id from regalos_gente where aleatorio = '$valorx'"); list ($id) = mysqli_fetch_row ($abc);; $premio = 0; if (mysqli_num_rows ($abc) == 0) { setcookie("$cookie","x",time()-3600, "/", ".hipercarcampanar.com"); header("location:index.php"); } $purl = ""; if (($id % 10) == 1) { $purl = "