일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- Los
- csrf
- CTF
- 모의해킹
- MySQL
- file upload
- JS
- Error based sql injection
- 로그인
- lord of sqli
- Python
- 과제
- lord of sql injection
- php
- sql injection point
- union sql injection
- cors
- 쿠키
- Reflected Xss
- css
- Cross Site Request Forgery
- sql injection
- JWT
- 세션
- 게시판 만들기
- cookie 탈취
- blind sql injection
- 로그인페이지
- XSS
- 웹개발
- Today
- Total
목록php (26)
Almon Dev
게시판 만들기 게시글 삭제하기 delete_post.jsfunction deletePost(e, postId, categoryId, categoryName) { e.preventDefault(); if (confirm('게시글을 삭제하시겠습니까?')) { url = '/forum/db/delete_post.php'; fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json; charset=utf-8', }, body: JSON.stringify({ post_id: postId, category_id: categoryId, }), ..
게시판 만들기 게시글 읽기 read_post.jsfunction readPost() { document.querySelectorAll('.td-title').forEach((tdTitle) => { tdTitle.addEventListener('click', (e) => { const post_id = e.target .closest('tr') .querySelector('.td-id').textContent; console.log(post_id); const pageNum = e.target.dataset.page_num; console.log(pageNum); const categoryId = e.target.dataset...

게시판 만들기 게시글 작성기능DB생성포스트를 저장할 posts 테이블을 생성합니다.create table posts ( post_id int auto_increment primary key, title varchar(100) not null, content text not null, writer_id int not null, created_at timestamp DEFAULT CURRENT_TIMESTAMP, updated_at timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, category_id int not null, views int not null DEFAULT 0, FOREIGN ..

로그인 로직 구현하기 사전작업비밀번호에 해쉬를 저장하기 위해서 varchar(512)로 최대 512바이트까지 저장하도록 변경했습니다.alter table users modify column password varchar(512) not null; 식별 - 인증 동시sql문에서 식별과 인증을 동시에 하는 로직입니다.login1_proc.php $sql = "select nickname from users where id='$id' and password='$pass';";이 코드처럼 where과 and를 이용해 식별과 인증을 동시에 처리합니다. 식별 - 인증 분리login2_proc.php $sql = "select nickname,password from users where id='$id..

JWT로 로그인 구현하기 php에서 jwt를 사용하기 위해서는 firebase/php-jwt라는 패키지를 사용해야 합니다.php-jwt를 설치하기 위해서는 php의 패키지 관리 툴인 composer를 사용해야 합니다.composer 설치하기php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'; } el..

세션(Session)으로 로그인 구현하기 인덱스 페이지index.php수정 전 수정 후 session_start();사용자의 쿠키에 세션 ID가 있는지 확인하고, 없으면 세션 ID를 생성해 사용자의 쿠키에 저장합니다.세션 ID가 있는 경우 세션 ID와 일치하는 파일을 찾아서 내용을 읽어 $_SESSION 배열에 저장합니다. if (isset($_SESSION["user_id"])) { header("Location: login_successful.php"); exit;세션에 user_id가 있는 경우 프로필 페이지로 이동합니다. }else { header("Location: login2.php"); exit;세션에 user_id가 없는 경우 로그인 페이지로 이동합니다. 세션 파일..

쿠키(Cookie)로 로그인 구현하기 인덱스 페이지index.php if (isset($_COOKIE['user_id'])){isset() 함수를 이용해서 요청에 같이 온 쿠키 중에 user_id라는 이름의 값이 세팅되어 있는지 확인합니다. header("Location: login_successful.php"); exit;쿠키가 존재한다면 프로필 페이지로 리다이렉션 시킵니다. exit를 이용해서 코드를 바로 종료합니다. }else { header("Location: login2.php");}만일 쿠키가 없다면 로그인 페이지로 리다이렉션 시킵니다.로그인 페이지login2.php ..

쿠키(Cookie)쿠키는 유저의 정보를 브라우저에 저장하기 위해서 사용되는 파일입니다.브라우저가 종료되어도 파일상태로 남아있으며 만료날짜를 지정할 수 있습니다.쿠키는 장바구니 목록이나 로그인 상태 정보를 브라우저에 저장해 둘 수 있습니다. 쿠키 생성 방법서버는 클라이언트의 요청에 응답할 때 set-cookie 헤더를 전송해서 쿠키를 생성할 수 있습니다.set-cookie 헤더 구조 : set-cookie: name = value; expires=만료날짜; domain=도메인; path=경로응답을 받은 브라우저가 쿠키를 생성하고 관리합니다. name : 이름과 값으로 이루어진 쿠키의 정보입니다. ex)id=admin expires : 쿠키의 만료 날짜를 지정할 수 있습니다. 지정된 날짜가 지나면 자동으로 ..