Skip to content

Instantly share code, notes, and snippets.

@moonspam
Last active January 8, 2018 09:24
Show Gist options
  • Save moonspam/5263650354b222dde079959c7726f7f3 to your computer and use it in GitHub Desktop.
Save moonspam/5263650354b222dde079959c7726f7f3 to your computer and use it in GitHub Desktop.
점심뭐먹지? v1.1
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>점심 뭐 먹지?</title>
<script>
var query = location.href.split('#');
document.cookies = 'anchor=' + query[1];
</script>
<?php
// 확률함수
function gachaLunch($min,$max=100) {
return(mt_rand(1,$max)<=$min);
}
// 음식점 정보
include('store.php');
// 확률설정
for($i = 1; ${"store".$i}; $i++){
$stores[] = ${"store".$i};
}
foreach($stores as $value) {
if($value[4] == 5)
$valUltraRare[] = $value;
if($value[4] == 8)
$valSuperRare[] = $value;
if($value[4] == 30)
$valRare[] = $value;
if($value[4] == NULL)
$valNormal[] = $value;
}
if(gachaLunch(0.2)) {$getLunch = $valUltraRare;}
if(gachaLunch(8)) {$getLunch = $valSuperRare;}
if(gachaLunch(25)) {$getLunch = $valRare;}
else {$getLunch = $valNormal;}
// 밥집결과 랜덤공식
$answer = $getLunch[mt_rand(0, count($getLunch) - 1)];
?>
</head>
<body>
<div class="box">
<h1>;-P<br>
<i>점심 뭐 먹지?</i></h1>
<h1 class="answer">[<?php echo $answer[0]; ?>]</h1>
<?php
// 지도 정보 노출
if(!empty($answer[2])) {
echo '<a href="'.$answer[2].'" target="_blank"><img src="svg/location.svg" width="32" height="32" alt="약도보기" title="약도보기"></a>';
} else {
echo '<img src="svg/location.svg" width="32" height="32" alt="약도보기" title="약도보기" style="opacity:0.4;filter:alpha(opacity=40)">';
}
if(!empty($answer[3])) {
echo '<a href="tel:'.$answer[3].'" target="_blank"><img src="svg/phone.svg" width="32" height="32" alt="전화번호" title="전화번호"></a>';
} else {
echo '<img src="svg/phone.svg" width="32" height="32" alt="전화번호" title="전화번호" style="opacity:0.4;filter:alpha(opacity=40)">';
}
?><a href="/lunch/" target="_self"><img src="svg/refresh.svg" width="32" height="32" alt="새로고침" title="새로고침" style="cursor:pointer"></a>
<p class="store_tags">
<?php
foreach($stores as $value) {
echo $value[0];
// 마지막 기호 삭제
if(end($stores) !== $value) {
echo ' / ';
}
}
?>
</p>
</div>
<div class="bg_img blur" style="background:url(<?php echo $answer[1]; ?>) center center no-repeat fixed #000000;background-size:cover"></div>
</body>
</html>
<?php
// 이름, 배경이미지url, 약도url, 전화번호, 확률(NULL,30,8,5)
$store1 = array('놀부부대찌개','http://cfile205.uf.daum.net/image/13042B3F516F4DFB02E090','http://dmaps.kr/t56t','02-533-5766',NULL);
$store2 = array('김이박부대찌개','http://cfile224.uf.daum.net/image/23675A4B55880AFD02F50E','http://dmaps.kr/t56v','02-522-7025',NULL);
$store3 = array('부산아지매국밥','http://pds27.egloos.com/pds/201310/16/19/f0037419_525decc0743b9.jpg','http://dmaps.kr/t56y','02-523-9882',NULL);
$store4 = array('푸주옥','https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/e15/11330547_1591386817817118_932186265_n.jpg','http://dmaps.kr/t575','02-596-2350',NULL);
$store5 = array('기와집순두부','http://dev.menupan.com/restaurant/restimg/002/zzmenuimg/h1196522_z.jpg','http://dmaps.kr/t576','02-599-0579',NULL);
$store6 = array('허수아비','http://cfile10.uf.tistory.com/image/184198204C2B240141118A','http://dmaps.kr/t579','02-591-1040',8);
$store7 = array('국밥의신','http://cfile22.uf.tistory.com/image/27130B4455C994082199D8','http://dmaps.kr/t57b','02-3447-4468',NULL);
$store8 = array('오니기리와이규동','http://news20.busan.com/content/image/2010/08/11/20100811000219_0.jpg','http://dmaps.kr/t57d','02-535-1290',NULL);
$store9 = array('담소사골순대국','http://www.gukjenews.com/news/photo/201407/118231_51158_2855.jpg','http://dmaps.kr/t57f','02-535-1821',NULL);
$store10 = array('버거킹','http://www.neoanime.co.kr/files/attach/images/111/303/997/001/98580ba08cf2bc52cc439ac5db74510e.jpg','http://dmaps.kr/t57g','02-534-0231',30);
$store11 = array('맥도날드','http://cfile9.uf.tistory.com/image/266B733355424D2E02909D','http://dmaps.kr/t57m','070-7017-6987',30);
$store12 = array('블링블링','http://image.wemakeprice.com/dealimg/201311/166612/979c3fac835b4b8bdc8907e32eed7433b976ab9f.jpg','http://dmaps.kr/t57p','02-592-2900',NULL);
$store13 = array('육대장','http://www.menupan.com/restaurant/restimg/002/zzmenuimg/h4927724_z.jpg','http://dmaps.kr/t57s','02-6959-7889',NULL);
$store14 = array('포석정','http://www.hanampig.co.kr/new/upload/menu_01/2015_01_08/admin_Ebhim_2015_01_08_16_45_44.jpg','http://dmaps.kr/t57t','02-569-0003',NULL);
$store15 = array('시래옥','http://cfile205.uf.daum.net/R400x0/215E3546547950C43086A3','http://dmaps.kr/t57v','02-522-9977',8);
$store16 = array('자연별곡','http://cfile27.uf.tistory.com/image/2339BB3D5475323D193D8A','http://dmaps.kr/t57w','02-532-5425',5);
$store17 = array('사보텐','http://www.menupan.com/restaurant/restimg/008/zzmenuimg/j10374837_z.jpg','http://dmaps.kr/t57p','02-596-4510',30);
$store18 = array('홍콩반점','http://cfile232.uf.daum.net/image/1963AD514D5AAECC0654ED','http://dmaps.kr/t582','02-522-9089',NULL);
$store19 = array('바르다김선생','http://image.sportsseoul.com/wyzmob/timg//l/20140624/l_2014062401001457800090531.jpg','http://dmaps.kr/t583','02-582-0131',NULL);
$store20 = array('하이난','http://image.imotorclub.net/DATA/d/201110/PXTRX20111012033138.jpg','http://dmaps.kr/t584','02-595-2560',8);
$store21 = array('미스터피자','http://cfile207.uf.daum.net/image/11679F4050E54B62243FCF','http://dmaps.kr/t586','02-525-2700',8);
$store22 = array('카도야','http://files.idg.co.kr/ciokr/image/ramen4-100565870-primary_idge.jpg','http://dmaps.kr/t589','02-598-5090',30);
$store23 = array('탐라도야지','http://www.menupan.com/restaurant/restimg/000/zzmenuimg/h1190504_z.jpg','http://dmaps.kr/t58a','02-521-3337',30);
$store24 = array('교대이층집','http://file2.nocutnews.co.kr/newsroom/image/2015/01/02/20150102150102973639.jpg','http://dmaps.kr/t58d','02-525-6692',NULL);
$store25 = array('돌배기집','http://img.seeon.kr/place/1417506032947554.png','http://dmaps.kr/t58f','02-585-6780',NULL);
$store26 = array('동경구락부','http://cfile202.uf.daum.net/image/16475F374F66EEB82E1019','http://dmaps.kr/t58i','02-6497-9787',NULL);
$store27 = array('아끼야','https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s640x640/sh0.08/e35/11363823_1132682116760552_1659446932_n.jpg','http://dmaps.kr/t58j','02-3471-3453',30);
$store28 = array('한식뷔페','http://pds17.egloos.com/pds/200908/17/11/f0019011_4a88d6ebe97e3.jpg','http://dmaps.kr/t58m','02-3472-0038',NULL);
$store29 = array('이모네쭈꾸미','https://scontent.cdninstagram.com/hphotos-xap1/t51.2885-15/e15/11189566_1086630498018239_797402768_n.jpg','http://dmaps.kr/t58n','02-584-7087',NULL);
$store30 = array('밀숲','http://img.seeon.kr/place/1440757346176092.jpg','http://dmaps.kr/t58p','02-525-2431',30);
$store31 = array('창성식당','http://4.bp.blogspot.com/-T8vULOj6rIA/VOAV8qoCMFI/AAAAAAAAQFY/r7xrB0TG3Mo/s1600/2015-02-06%2B03.02.25.jpg','http://dmaps.kr/t58q','02-595-3630',NULL);
$store32 = array('듬북담북','http://www.menupan.com/restaurant/restimg/005/zzmenuimg/h1193954_z.jpg','http://dmaps.kr/t58r','02-3477-8689',NULL);
$store33 = array('코바코','http://cfile29.uf.tistory.com/image/2068184A4D940F24112A9C','http://dmaps.kr/t58t','02-582-2229',30);
$store34 = array('파이브스토리','http://cfile240.uf.daum.net/image/160B5F4F4FE535491F689C','http://dmaps.kr/t56v','02-587-7785',NULL);
$store35 = array('호아빈','http://img.newdaily.co.kr/data/photos/20130936/art_1378090382.jpg','http://dmaps.kr/t58y','02-6424-3838',30);
$store36 = array('명동칼국수','http://cfile216.uf.daum.net/image/14223A475168DFBB32B706','http://dmaps.kr/t59z','02-593-8961',30);
$store37 = array('교대왕돈까스','https://farm4.staticflickr.com/3738/9426024073_bcd871705f_z.jpg','http://dmaps.kr/t592',NULL,NULL);
$store38 = array('아웃백','http://cfile8.uf.tistory.com/image/13519A4550DAD156020CA9','http://dmaps.kr/t594','02-581-5761',5);
$store39 = array('임금님밥상','http://www.cheeseschool.or.kr/upData/bbs42/c_festival_1310003957_11310003957','http://dmaps.kr/t65y','02-522-5933',NULL);
$store40 = array('현경','http://www.gjwoori.com/board/data/file/woori02/563700354_7vX0BrVj_8C5C1BCF6C0B06.jpg','http://dmaps.kr/t8kw','02-595-8535',NULL);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment