Toggle navigation
Toggle navigation
This project
Loading...
Sign in
최시원
/
Singer-Composer
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Mukho
2021-11-23 01:48:43 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9340b43e5a3a41f00fd1390394f303695ced3199
9340b43e
1 parent
272e28e8
update little bit
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
62 additions
and
34 deletions
app.js
public/about.html
public/board.html
public/login.html
public/register.html
readme.md
router/chat/chat.js
views/about.ejs
views/chat.ejs
views/list.ejs
views/login.ejs
views/profile.ejs
views/profmsgedit.ejs
views/read.ejs
views/register.ejs
views/write.ejs
app.js
View file @
9340b43
...
...
@@ -38,14 +38,23 @@ app.use("/chat", express.static(__dirname+ "/chat"));
app
.
set
(
'view engine'
,
'ejs'
)
// 로그용
var
today
=
new
Date
();
var
year
=
today
.
getFullYear
();
var
month
=
(
'0'
+
(
today
.
getMonth
()
+
1
)).
slice
(
-
2
);
var
day
=
(
'0'
+
today
.
getDate
()).
slice
(
-
2
);
var
hour
=
(
'0'
+
today
.
getHours
()).
slice
(
-
2
);
var
minute
=
(
'0'
+
today
.
getMinutes
()).
slice
(
-
2
);
var
second
=
(
'0'
+
today
.
getSeconds
()).
slice
(
-
2
);
var
logString
=
'['
+
year
+
'-'
+
month
+
'-'
+
day
+
' '
+
hour
+
':'
+
minute
+
':'
+
second
+
'] '
;
var
logString
;
function
getTime
(){
var
today
=
new
Date
();
var
year
=
today
.
getFullYear
();
var
month
=
(
'0'
+
(
today
.
getMonth
()
+
1
)).
slice
(
-
2
);
var
day
=
(
'0'
+
today
.
getDate
()).
slice
(
-
2
);
var
hour
=
(
'0'
+
today
.
getHours
()).
slice
(
-
2
);
var
minute
=
(
'0'
+
today
.
getMinutes
()).
slice
(
-
2
);
var
second
=
(
'0'
+
today
.
getSeconds
()).
slice
(
-
2
);
logString
=
'['
+
year
+
'-'
+
month
+
'-'
+
day
+
' '
+
hour
+
':'
+
minute
+
':'
+
second
+
'] '
;
}
// 시간 갱신용
function
init
(){
getTime
();
setInterval
(
getTime
,
1000
)
}
init
()
app
.
use
(
session
({
secret
:
'keyboard cat'
,
...
...
@@ -84,7 +93,7 @@ io.sockets.on('connection', function(socket) {
/* 새로운 유저가 접속했을 경우 다른 소켓에게도 알려줌 */
socket
.
on
(
'newUser'
,
function
(
name
)
{
console
.
log
(
name
+
' 님이 접속하였습니다.'
)
console
.
log
(
logString
+
name
+
' 님이 접속하였습니다.'
)
/* 소켓에 이름 저장해두기 */
socket
.
name
=
name
...
...
@@ -106,7 +115,7 @@ io.sockets.on('connection', function(socket) {
/* 접속 종료 */
socket
.
on
(
'disconnect'
,
function
()
{
console
.
log
(
socket
.
name
+
'님이 나가셨습니다.'
)
console
.
log
(
logString
+
socket
.
name
+
'님이 나가셨습니다.'
)
/* 나가는 사람을 제외한 나머지 유저에게 메시지 전송 */
socket
.
broadcast
.
emit
(
'update'
,
{
type
:
'disconnect'
,
name
:
'SERVER'
,
message
:
socket
.
name
+
'님이 나가셨습니다.'
});
...
...
public/about.html
View file @
9340b43
...
...
@@ -5,7 +5,7 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta
name=
"description"
content=
""
/>
<meta
name=
"author"
content=
""
/>
<title>
묵호 -
놀이터
</title>
<title>
묵호 -
About
</title>
<!-- Favicon-->
<link
rel=
"icon"
type=
"image/x-icon"
href=
"../assets/favicon.ico"
/>
<!-- Bootstrap icons-->
...
...
public/board.html
View file @
9340b43
...
...
@@ -5,7 +5,7 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta
name=
"description"
content=
""
/>
<meta
name=
"author"
content=
""
/>
<title>
묵호 -
놀이터
</title>
<title>
묵호 -
게시판
</title>
<!-- Favicon-->
<link
rel=
"icon"
type=
"image/x-icon"
href=
"../assets/favicon.ico"
/>
<!-- Bootstrap icons-->
...
...
public/login.html
View file @
9340b43
...
...
@@ -5,7 +5,7 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta
name=
"description"
content=
""
/>
<meta
name=
"author"
content=
""
/>
<title>
묵호 -
놀이터
</title>
<title>
묵호 -
로그인
</title>
<!-- Favicon-->
<link
rel=
"icon"
type=
"image/x-icon"
href=
"../assets/favicon.ico"
/>
<!-- Bootstrap icons-->
...
...
public/register.html
View file @
9340b43
...
...
@@ -5,7 +5,7 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta
name=
"description"
content=
""
/>
<meta
name=
"author"
content=
""
/>
<title>
묵호 -
놀이터
</title>
<title>
묵호 -
회원가입
</title>
<!-- Favicon-->
<link
rel=
"icon"
type=
"image/x-icon"
href=
"../assets/favicon.ico"
/>
<!-- Bootstrap icons-->
...
...
readme.md
View file @
9340b43
...
...
@@ -60,19 +60,14 @@ create table board(
>UPDATE board SET idx = @COUNT:=@COUNT+1;
---
### 최종 수정: 2021-11-2
0 21:44
<br>
### 최종 수정: 2021-11-2
3 01:48
<br>
### 수정 내용:
1.
최근 있었던 DB명세구조 변경
>alter table board drop passwd;<br>
>alter table board add ID varchar(20) not null;<br>
>alter table board change name nickname;<br>
>alter table board modify nickname varchar(20);
0.
채팅기능에 버그가 있는 것 같음-피드백 바람(undefined님이 나가셨습니다. -> 콘솔에 계속 출력됨)
1.
일부 수정
2.
로그에 시간 추가
3.
시간 실시간 반영
4.
게시글 수정 및 삭제 세션+권한 연동/DB수정
5.
버그 수정
6.
게시글 조회수 구현
7.
프로필 수정 세션 연동
8.
etc
8.
etc
\ No newline at end of file
...
...
router/chat/chat.js
View file @
9340b43
...
...
@@ -5,11 +5,35 @@ var path = require('path') // 상대경로
var
mysql_odbc
=
require
(
'../../db/db_board'
)();
var
myinfo
=
mysql_odbc
.
init
();
// 로그용
var
logString
;
function
getTime
(){
var
today
=
new
Date
();
var
year
=
today
.
getFullYear
();
var
month
=
(
'0'
+
(
today
.
getMonth
()
+
1
)).
slice
(
-
2
);
var
day
=
(
'0'
+
today
.
getDate
()).
slice
(
-
2
);
var
hour
=
(
'0'
+
today
.
getHours
()).
slice
(
-
2
);
var
minute
=
(
'0'
+
today
.
getMinutes
()).
slice
(
-
2
);
var
second
=
(
'0'
+
today
.
getSeconds
()).
slice
(
-
2
);
logString
=
'['
+
year
+
'-'
+
month
+
'-'
+
day
+
' '
+
hour
+
':'
+
minute
+
':'
+
second
+
'] '
;
}
// 시간 갱신용
function
init
(){
getTime
();
setInterval
(
getTime
,
1000
)
}
init
()
router
.
get
(
'/'
,
function
(
req
,
res
){
var
id
=
req
.
user
;
if
(
!
id
)
res
.
sendFile
(
path
.
join
(
__dirname
,
"../../public/login.html"
))
if
(
!
id
){
console
.
log
(
logString
+
'익명 유저의 채팅 접근을 거부했습니다.'
)
res
.
sendFile
(
path
.
join
(
__dirname
,
"../../public/login.html"
))
}
if
(
id
){
res
.
render
(
'chat.ejs'
,
{
'nickname'
:
id
.
nickname
})
var
nickname
=
req
.
user
.
nickname
console
.
log
(
logString
+
req
.
user
.
ID
+
'('
+
nickname
+
') 유저가 채팅 중입니다.'
)
res
.
render
(
'chat.ejs'
,
{
'nickname'
:
nickname
})
}
});
...
...
views/about.ejs
View file @
9340b43
...
...
@@ -5,7 +5,7 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta
name=
"description"
content=
""
/>
<meta
name=
"author"
content=
""
/>
<title>
묵호 -
놀이터
</title>
<title>
묵호 -
About
</title>
<!-- Favicon-->
<link
rel=
"icon"
type=
"image/x-icon"
href=
"../assets/favicon.ico"
/>
<!-- Bootstrap icons-->
...
...
views/chat.ejs
View file @
9340b43
...
...
@@ -2,7 +2,7 @@
<html>
<head>
<meta
charset=
"utf-8"
>
<title>
채팅
</title>
<title>
묵호 - 놀이터
</title>
<link
rel=
"stylesheet"
href=
"/css/chat.css"
>
<script
src=
"/socket.io/socket.io.js"
></script>
<script
src=
"/js/chat.js"
></script>
...
...
views/list.ejs
View file @
9340b43
...
...
@@ -5,7 +5,7 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta
name=
"description"
content=
""
/>
<meta
name=
"author"
content=
""
/>
<title>
묵호 -
놀이터
</title>
<title>
묵호 -
게시판
</title>
<!-- Favicon-->
<link
rel=
"icon"
type=
"image/x-icon"
href=
"../assets/favicon.ico"
/>
<!-- Bootstrap icons-->
...
...
views/login.ejs
View file @
9340b43
...
...
@@ -5,7 +5,7 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta
name=
"description"
content=
""
/>
<meta
name=
"author"
content=
""
/>
<title>
묵호 -
놀이터
</title>
<title>
묵호 -
로그인
</title>
<!-- Favicon-->
<link
rel=
"icon"
type=
"image/x-icon"
href=
"../assets/favicon.ico"
/>
<!-- Bootstrap icons-->
...
...
views/profile.ejs
View file @
9340b43
...
...
@@ -5,7 +5,7 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta
name=
"description"
content=
""
/>
<meta
name=
"author"
content=
""
/>
<title>
내 정보
</title>
<title>
묵호 -
내 정보
</title>
<!-- Favicon-->
<link
rel=
"icon"
type=
"image/x-icon"
href=
"../assets/favicon.ico"
/>
<!-- Bootstrap icons-->
...
...
views/profmsgedit.ejs
View file @
9340b43
...
...
@@ -5,7 +5,7 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta
name=
"description"
content=
""
/>
<meta
name=
"author"
content=
""
/>
<title>
정보 수정
</title>
<title>
묵호 - 내
정보 수정
</title>
<!-- Favicon-->
<link
rel=
"icon"
type=
"image/x-icon"
href=
"../assets/favicon.ico"
/>
<!-- Bootstrap icons-->
...
...
views/read.ejs
View file @
9340b43
<!DOCTYPE html>
<html>
<head>
<title>
묵호 -
놀이터
</title>
<title>
묵호 -
<
%= row.title %>
</title>
<!-- Favicon-->
<link
rel=
"icon"
type=
"image/x-icon"
href=
"../assets/favicon.ico"
/>
<!-- Bootstrap icons-->
...
...
views/register.ejs
View file @
9340b43
...
...
@@ -5,7 +5,7 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta
name=
"description"
content=
""
/>
<meta
name=
"author"
content=
""
/>
<title>
묵호 -
놀이터
</title>
<title>
묵호 -
회원가입
</title>
<!-- Favicon-->
<link
rel=
"icon"
type=
"image/x-icon"
href=
"../assets/favicon.ico"
/>
<!-- Bootstrap icons-->
...
...
views/write.ejs
View file @
9340b43
<!DOCTYPE html>
<html>
<head>
<title>
묵호 -
놀이터
</title>
<title>
묵호 -
글쓰기
</title>
<!-- Favicon-->
<link
rel=
"icon"
type=
"image/x-icon"
href=
"../assets/favicon.ico"
/>
<!-- Bootstrap icons-->
...
...
Please
register
or
login
to post a comment