온라인 로또복권

· 15년 전 · 2026
온라인로또가 어떤건지 게임 한판 해보기 ->

http://www.lottogame.wo.to

온라인 로또복권 입니다.
기능은, 로또복권과 100% 동일합니다.

제가 가상적으로 상상한 로또복권의 방식은
로또복권 기기에 OMR 방식으로 숫자를 읽은다음 DB 에 저장하고
영수증을 발부하는 그런 형태 라고 생각되었습니다.

제가만든 온라인 로또복권은 그와 동일합니다.

1. 사용자의 입력을 받는다
2. db 에 저장한다
3. 영수증 비스무리한 페이지를 출력한다.
4. 추첨한다(컴퓨터가 자동으로)


<b>계층구조를 설명해 보면 다음과 같습니다.</b>

index.html (자바스크립트와 html 로 구성,체크박스로 숫자를 입력받을수 있음)
success.php (index.html 에서 넘어온 값을 db 에 저장. 이메일과, 당첨확인용 비밀번호 저장)
statics.php (번호별로 찍은 횟수를 통계냄. -_- 저의 개인적인이유로 제작.)
select.php (추첨기. 중복되지않는 6개의 숫자와 보너스숫자생성하고 DB 안의 로또번호와 대조
각 등위조건에 해당하는 사람들의 레코드를 파일로 저장한다)

<b>보안적 측면</b>

보안적 측면으로는 한번에 2장의 복권 발매를 금지합니다. (브라우저를 껏다키면 가능. 쿠키이용)
그리고 success.php 로 곧바로 엑세스할수 없습니다.
db password 를 따로 만들어 include 함.

<b>소스공개</b>

index.html 은 (http://www.lottogame.wo.to 에 오시면 볼수있습니다.)
자바스크립트는 Onlymarch 홈페이지에서 복사하여 용도에맞게 수정해 썼습니다.

<b>DB 스키마</b>

CREATE TABLE lotto (
email varchar(35) NOT NULL,
name varchar(10) NOT NULL,
password varchar(10) NOT NULL,
lotto1 int(2) NOT NULL,
lotto2 int(2) NOT NULL,
lotto3 int(2) NOT NULL,
lotto4 int(2) NOT NULL,
lotto5 int(2) NOT NULL,
lotto6 int(2) NOT NULL
)

<b>소스 URL : http://hirosue.rootguide.com/lotto/success.phps

### success.php ###
### 제작 by Dopesoul ###</b>
<pre>
<?
$where = "$HTTP_POST_VARS[where]";

if ( $where != "right" ) {
echo ("<script>window.alert('올바른곳에서 방문하십시요 Do not Hacking');</script> ");
echo "<meta http-equiv=\"refresh\" content=\"0;url=http://hirosue.rootguide.com/lotto\">";
}

include "password.php";
$connect = @mysql_connect($hostname,$user_id,$password) or die("MySQL-DB Connect<br>Error!!!");
$db = mysql_select_db($dbname);

if(!db) {
echo (" <script>window.alert('db 가 없습니다');</script> ");
}

$email = "$HTTP_POST_VARS[email]";
$name = "$HTTP_POST_VARS[name]";
$password = "$HTTP_POST_VARS[password]";
$checksum = "$HTTP_POST_VARS[checksum]";
$lotto[1] = "$HTTP_POST_VARS[lottov1]";
$lotto[2] = "$HTTP_POST_VARS[lottov2]";
$lotto[3] = "$HTTP_POST_VARS[lottov3]";
$lotto[4] = "$HTTP_POST_VARS[lottov4]";
$lotto[5] = "$HTTP_POST_VARS[lottov5]";
$lotto[6] = "$HTTP_POST_VARS[lottov6]";

//쿠키를 받아온다.
$getcookie = "$HTTP_COOKIE_VARS[selectornot]";

if ( $getcookie == "1" ) {
echo"<script>window.alert('복권 발매는 1회로 한정되어 있습니다.');</script>";
echo "<b>복권 발매는 1회로 한정되어 있습니다.</b>";
}

if ( $getcookie != "1" && $where == "right" ){
Setcookie("selectornot","1","0");
//Cookie
$table="insert into lotto (email,name,password,lotto1,lotto2,lotto3,lotto4,lotto5,lotto6) VALUES ('$email','$name','$password','$lotto[1]','$lotto[2]','$lotto[3]','$lotto[4]','$lotto[5]','$lotto[6]')";
$result = mysql_query($table, $connect) or die ("테이블 생성실패");
echo "<table border=0 width=400>";
echo "<tr>";
echo "<td colspan=6><b>복권이 발매되었습니다. 결과가 Database 에 저장되었습니다.</b></td>";
echo "</tr>";
for($i=1;$i<=6;$i++){
echo "<td width=16% bgcolor=FFE641 align=center>";
echo "<b>".$lotto[$i]."</b>";
echo "</td>";
}
echo "<img src=logo.gif>";
echo "<h1>대박 나시길 바랍니다!</h1><br><br>";

}
?>
</pre>

<b>소스 URL : http://hirosue.rootguide.com/lotto/select.phps
### 추첨기 프로그램 ###</b>
<pre>
<?
// 당첨자 파일 지정
$fp = fopen("/home/dopesoul/public_html/lotto/당첨자.txt","w+");
if(!$fp){
echo "<b>파일오픈 실패</b>";
}
include "password.php";
$connect = @mysql_connect($hostname,$user_id,$password) or die("MySQL-DB Connect<br>Error!!!");
$db = mysql_select_db($dbname);

if(!db) {
echo (" <script>window.alert('db 가 없습니다');</script> ");
}

srand ((double) microtime() * 1000000);
//당첨번호 생성루틴
$dang[0] = rand(1,45);
do { $dang[1] = rand(1,45); } while ( $dang[1] == $dang[0] );
do { $dang[2] = rand(1,45); } while ( $dang[2] == $dang[0] || $dang[2] == $dang[1] );
do { $dang[3] = rand(1,45); } while ( $dang[3] == $dang[0] || $dang[3] == $dang[1] || $dang[3] == $dang[2] );
do { $dang[4] = rand(1,45); } while ( $dang[4] == $dang[0] || $dang[4] == $dang[1] || $dang[4] == $dang[2] || $dang[4] == $dang[3] );
do { $dang[5] = rand(1,45); } while ( $dang[5] == $dang[0] || $dang[5] == $dang[1] || $dang[5] == $dang[2] || $dang[5] == $dang[3] || $dang[5] == $dang[4] );
do { $dang[6] = rand(1,45); } while ( $dang[6] == $dang[0] || $dang[6] == $dang[1] || $dang[6] == $dang[2] || $dang[6] == $dang[3] || $dang[6] == $dang[4] || $dang[6] == $dang[5] );

/*
임현을 기준으로 되어있다.
$dang[0]="1";
$dang[1]="4";
$dang[2]="11";
$dang[3]="17";
$dang[4]="18";
$dang[5]="45";
$dang[6]="25"; // 보너스숫자
*/


?>

<?
//출력 루틴
$query = "select * from lotto";
$result = mysql_query($query);
$fields = mysql_num_fields($result);

$howmany = mysql_num_rows($result);
echo "<b>현재까지 $howmany 명 참여<br></b>";
//당첨번호 출력
echo "컴퓨터가 뽑은 당첨번호는 ";
for($x=0;$x<=6;$x++){

if ($x != 6) {
echo "$dang[$x] ";
}

if ( $x == 6 ) {
echo "보너스 숫자는 $dang[$x]";
}
}
echo " 입니다.";


//당첨번호는 쿠키값이 1이 아닐때만 가동
echo("<table width=100% border=1>\n");
echo("<tr>\n");
// fiend 정보를 읽어온다.
for($i = 0 ; $i < $fields; $i++){
$field_name = mysql_field_name($result,$i);
echo("<td align=center>$field_name</td>\n");
}

// 등위판정칸을 위한 마지막칸
echo "<td align=center> </td>";

//한줄끝냄
echo("</tr>\n");


$num = mysql_num_rows($result);
$detector = "0";
$secondplace = "0";
for ($j=0 ; $j < $num; $j++ ) {
echo("<tr>\n");
$row = mysql_fetch_row($result);

// $fields = 9 까지 이다. 즉, 이메일 이름 비번 로또번호 6자리
for($k=0; $k<$fields ; $k++){

// 테이블컬러 변수 초기화
$tablecolor="";

// 당첨여부로 테이블 색깔결정 및 detector 라는 변수로 당첨판정한다. 그리고 필드 0 1 2 는 판정하지 않는다. 왜냐면 이름과 이메일 비번이니까!
if ( $k!=0 && $k!=1 && $k!=2) {

if ($row[$k] == $dang[0] || $row[$k] == $dang[1] || $row[$k] == $dang[2] || $row[$k] == $dang[3] || $row[$k] == $dang[4] || $row[$k] == $dang[5]) {
$tablecolor="red";
$detector++;
}

// 2등판정 $secondplace 라는 변수로 판정하며 , 1이 2등을 의미하고 0 은 아무것도아님.
if ($detector == 5 && $dang[6] == $row[$k] ){ $secondplace = "1"; }
// 2등판정 끝

}
// 당첨 판정 및 테이블 종류 판정끝.

echo("<td align=center bgcolor=$tablecolor>$row[$k]</td>\n");

}

$file = "";
if ($detector == 6){ $yesno="1등"; $file = "$yesno Email $row[0] 이름 $row[1] 비번 $row[2] 맞춘갯수 $detector\n"; fwrite($fp,$file);}
if ($detector == 5 && $secondplace == "0"){ $yesno="3등"; $file = "$yesno EMAIL $row[0] 이름 $row[1] 비번 $row[2] 맞춘갯수 $detector\n"; fwrite($fp,$file); }

// 위의 3등판정보다 후에있어야 변수내용이 바뀌면서 2등당첨자가 addon 된다. php 의 interpreter 적 요소를 이용함
if ($detector ==5 && $secondplace == "1"){
$yesno="2등";
$file = "$yesno Email $row[0] 이름 $row[1] 비번 $row[2] 맞춘갯수 $detector\n";
fwrite($fp,$file);
}
// 2등판정 끝

if ($detector == 4){ $yesno="4등"; $file = "$yesno EMAIL $row[0] 이름 $row[1] 비번 $row[2] 맞춘갯수 $detector\n"; fwrite($fp,$file); }
if ($detector == 3){ $yesno="5등"; $file = "$yesno EMAIL $row[0] 이름 $row[1] 비번 $row[2] 맞춘갯수 $detector\n"; fwrite($fp,$file); }
if ($detector < 3){ $yesno = "꽝"; }
echo("<td align=center>$yesno <b>$detector 개 맞춤</b></td>");
echo("</tr>\n");
$detector = "0";

}

echo("</table>");

?>
</pre> 
 
[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
15년 전 조회 2,669
15년 전 조회 1,494
15년 전 조회 869
15년 전 조회 894
15년 전 조회 1,335
15년 전 조회 1,367
15년 전 조회 1,621
15년 전 조회 1,113
15년 전 조회 1,478
15년 전 조회 770
15년 전 조회 1,127
15년 전 조회 1,377
15년 전 조회 2,782
15년 전 조회 1,159
15년 전 조회 1,132
15년 전 조회 1,022
15년 전 조회 916
15년 전 조회 912
15년 전 조회 3,511
15년 전 조회 2,878
15년 전 조회 2,059
15년 전 조회 2,506
15년 전 조회 1,591
15년 전 조회 1,145
15년 전 조회 1,139
15년 전 조회 2,422
15년 전 조회 958
15년 전 조회 2,004
15년 전 조회 804
15년 전 조회 1,952
15년 전 조회 887
15년 전 조회 2,558
15년 전 조회 812
15년 전 조회 1,238
15년 전 조회 794
15년 전 조회 2,954
15년 전 조회 1,342
15년 전 조회 1,373
15년 전 조회 1,390
15년 전 조회 1,433
15년 전 조회 1,038
15년 전 조회 1,808
15년 전 조회 1,339
15년 전 조회 916
15년 전 조회 2,786
15년 전 조회 1,169
15년 전 조회 1,368
15년 전 조회 1,165
15년 전 조회 2,012
15년 전 조회 2,027
15년 전 조회 1,680
15년 전 조회 1,032
15년 전 조회 1,272
15년 전 조회 969
15년 전 조회 911
15년 전 조회 1,170
15년 전 조회 2,524
15년 전 조회 2,548
15년 전 조회 1,523
15년 전 조회 1,066
15년 전 조회 1,221
15년 전 조회 1,222
15년 전 조회 1,086
15년 전 조회 987
15년 전 조회 924
15년 전 조회 1,281
15년 전 조회 1,233
15년 전 조회 986
15년 전 조회 954
15년 전 조회 1,136
15년 전 조회 1,594
15년 전 조회 1,122
15년 전 조회 1,450
15년 전 조회 1,289
15년 전 조회 1,958
15년 전 조회 3,020
15년 전 조회 2,366
15년 전 조회 961
15년 전 조회 1,969
15년 전 조회 2,162
15년 전 조회 1,459
15년 전 조회 1,422
15년 전 조회 2,689
15년 전 조회 2,582
15년 전 조회 5,573
15년 전 조회 1,531
15년 전 조회 4,296
15년 전 조회 1,427
15년 전 조회 1,724
15년 전 조회 1,691
15년 전 조회 1,684
15년 전 조회 1,184
15년 전 조회 1,431
15년 전 조회 1,559
15년 전 조회 1,486
15년 전 조회 2,199
15년 전 조회 1,345
15년 전 조회 1,411
15년 전 조회 964
15년 전 조회 1,055