Guest User

Untitled

a guest
Jan 16th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>점심 뭐 먹지?</title>
  6. </head>
  7.  
  8. <body>
  9. <?php
  10. // 확률함수
  11. function gachaLunch($min,$max=100) {
  12. return(mt_rand(1,$max)<=$min);
  13. }
  14.  
  15. if($_GET['s'] == 'actoz') {
  16. // 음식점 정보
  17. $store1 = array('고리','bg','www','123');
  18. $store2 = array('교동짬뽕','bg','www','123');
  19. $store3 = array('김치찌개','bg','www','123');
  20. $store4 = array('남미식당','bg','www','123');
  21. $store5 = array('돌냄비김치찜','bg','www','123');
  22. $store6 = array('맥도날드','bg','www','123'); //20%
  23. $store7 = array('부대찌게','bg','www','123'); //20%
  24. $store8 = array('삼미기사식당','bg','www','123');
  25. $store9 = array('수제비','bg','www','123');
  26. $store10 = array('쌀국수','bg','www','123');
  27. $store11 = array('영주고기','bg','www','123');
  28. $store12 = array('작은가게','bg','www','123'); //5%
  29. $store13 = array('종로김밥','bg','www','123'); //5%
  30. $store14 = array('진짜 설렁탕','bg','www','123'); //5%
  31. $store15 = array('찰스김밥','bg','www','123'); //5%
  32. $store16 = array('콩나물국밥','bg','www','123');
  33. $store17 = array('한우마당','bg','www','123');
  34. $store18 = array('황톳길','bg','www','123');
  35. $store19 = array('LG건물 아워홈','bg','www','123'); //20%
  36. $store20 = array('25가츠','bg','www','123'); //20%
  37. // 확률설정 7.5:2:0.5
  38. if(gachaLunch(20)) {
  39. $getLunch = array($store6,$store7,$store19,$store20);
  40. }
  41. if(gachaLunch(5)) {
  42. $getLunch = array($store12,$store13,$store14,$store15);
  43. }
  44. else {
  45. $getLunch = array($store1,$store2,$store3,$store4,$store5,$store8,$store9,$store10,$store11,$store16,$store17,$store18);
  46. }
  47. // 결과 랜덤
  48. $answer = $getLunch[mt_rand(0, count($getLunch) - 1)];
  49.  
  50. } else {
  51. $answer[0] = '준비중입니다.';
  52. }
  53. ?>
  54. <div class="box">
  55. <h1>(ㅇ_ ㅇ)a<br>
  56. <i>점심 뭐 먹지잉?</i></h1>
  57. <h1 class="answer"><?php echo $answer[0]; ?></h1>
  58. <img src="svg/location.svg" width="32" height="32" alt="위치" title="위치">&nbsp;&nbsp;&nbsp;&nbsp;<img src="svg/phone.svg" width="32" height="32" alt="전화번호" title="전화번호">&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" onClick="window.location.reload(true);"><img src="svg/refresh.svg" width="32" height="32" alt="새로고침" title="새로고침"></a>
  59. </div>
  60. </body>
  61. </html>
Add Comment
Please, Sign In to add comment