일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 로그인
- lord of sql injection
- cors
- XSS
- sql injection
- 과제
- CTF
- Cross Site Request Forgery
- php
- css
- file upload
- 쿠키
- Python
- Reflected Xss
- 모의해킹
- Los
- lord of sqli
- Error based sql injection
- 게시판 만들기
- 웹개발
- sql injection point
- MySQL
- csrf
- 세션
- JWT
- blind sql injection
- cookie 탈취
- union sql injection
- JS
- 로그인페이지
- Today
- Total
목록웹개발 (9)
Almon Dev

게시글 이미지 추가게시글을 입력할 때 글 내부에 이미지를 추가할 수 있는 기능입니다. 사진 추가 UI 만들기 // 이미지 업로드 const uploadContainer = document.createElement('div'); uploadContainer.classList.add('upload-container'); const imgInput = document.createElement('input'); imgInput.classList.add('upload-btn'); imgInput.setAttribute('type', 'file'); imgInput.setAttribute('accept', '.jpg, .jpeg, .png, .gif'); imgInput.addEventListener..

게시글 검색 기능검색어를 입력하면 서버에서 search 쿠키에 검색어를 저장한 뒤에 게시글을 불러올 때 조건문에 포함시킵니다. 쿠키 관리하는 함수 JS에는 setCookie 같은 함수가 따로 없고 document.cookie에 직접 접근해서 설정을 해야 합니다.function setCookie(name, value) { let date = new Date(); date.setTime(date.getTime() + 60 * 60 * 24); document.cookie = name + '=' + encodeURIComponent(value) + '; expires=' + date.toUTCString() + ';path=/forum/';}쿠키의 이름과 값을 입력받아서 ..

마이페이지 수정 기능마이페이지 생성에서 만들었던 마이페이지에 수정기능이 빠져있어 추가했습니다. 마이페이지 수정 버튼// login_successful.php// 수정 전수정하기// 수정 후수정하기마이페이지의 수정 버튼을 클릭했을 때 mypage_update.php로 리다이렉트 하도록 변경했습니다. mypage_update.phpsub; $sql = "select profile_img_path, nickname, email, password, name from users where user_id='$user_id'"; try { $result = runSQL($sql)->fetch_array(); $db_pass = $result['password']; $n..

추가한 기능 아이디 찾기이름과 이메일을 이용해 아이디를 찾는 기능입니다. forget_id.phpnum_rows == 1) { $id = $result->fetch_array()['user_id']; $find_message = "아이디를 찾았습니다.ID : $id"; }else { $find_message = "아이디를 찾지 못했습니다."; }}?> Almond 아이디 찾기 아이디 찾기 if(isset($_POST['n..

로그인 로직 구현하기 사전작업비밀번호에 해쉬를 저장하기 위해서 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가 없는 경우 로그인 페이지로 이동합니다. 세션 파일..

고민사실 4,5일 차는 어떻게 해야 할지 고민하는 시간이었습니다.글쓰기 기능을 추가하려고 보니 txt파일로 DB를 대체하는 것은점점 복잡해지는 것 같습니다폴더를 board --- ID --- Title 이런 식으로 구성하고,글의 내용을 작성시간(수정시간):글내용 이런 식으로 저장해보려고 했으나이제는 그냥 DB를 쓰는 게 더 나을 거 같다는 들어 Mysql을 사용해보고자 합니다. 우선 mysql의 비밀번호부터 설정합니다.처음 mysql을 설치하고 나면 root의 비밀번호가 설정되어있지 않습니다.이는 보안상 매우 취약하기도 하니 비밀번호를 설정해 줍니다. sudo mysql_secure_installationmysql설치 시 다운로드되는 mysql_secure_installation 스크립트를 실행합니다. ..