|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /home/queenjbs/www/test/ |
Upload File : |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JYJ LOTTO</title>
<link rel="stylesheet" type="text/css" href="./css/common.css">
</head>
<?
//**************************************
// Name: PHP Lottery 6/49
// Description:Return 6 number random 1 to 49 witout double in ASC order.
// By: Jason Fleury Gazon
//
//This code is copyrighted and has// limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=2827&lngWId=8//for details.//**************************************
?>
<body>
<?php
$Value = Array(0,0,0,0,0,0);
$i=1;
while($i<=6)
{
$Value[$i] = rand(1,45);
if ($i != 1)
{
$Find = False;
for ($nb=1; $nb<$i; $nb++)
{
if ($Value[$nb] == $Value[$i])
{
$Find = True;
$nb = 7;
}
}
}
if ($Find == False)
{
$i = $i +1;
}
}
// Mettre séquence par ordre croissant
$CurrIndex = 0;
$ValueSort = Array(0,0,0,0,0,0);
for ($i=1; $i <=6; $i++)
{
$MinValue = 99;
for ($ii=1; $ii <=6; $ii++)
{
if ($Value[$ii] < $MinValue)
{
$MinValue = $Value[$ii];
$CurrIndex = $ii;
}
}
$ValueSort[$i] = $MinValue;
$Value[$CurrIndex] = 99;
}
echo "당첨번호! : " . $ValueSort[1] . ", " . $ValueSort[2] . ", " . $ValueSort[3] . ", " . $ValueSort[4] . ", " . $ValueSort[5] . ", " . $ValueSort[6] ;
?>
<?
function lottery($maxn = "45",$maxb="6") {
srand((double) microtime() * 1000000);
while (1>0) {
$lottery[] = rand(1,$maxn);
$lottery = array_unique($lottery);
if (sizeof($lottery) == $maxb) break;
}
sort($lottery);
return implode(", ",$lottery);
}
echo "<br/>당첨번호! : ".$lotterynums = lottery();
?>
</body>
</html>