728x90

Android Studio 에서 타이틀 바가 안나오게 하는 방법은 두가지가 있다.

values 폴더 밑에 styles.xml 파일을 수정한다.


방법 1.

styles.xml 파일을 아래와 같이 수정한다.

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

</resources> 


방법2.

styles.xml 파일을 아래와 같이 수정한다.

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>
    <style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

</resources>


AndroidManifest.xml 파일 수정사항

    <application
        android:allowBackup="false"
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme.NoActionBar">
 



두번째 방법이 손 댈 곳이 좀 더 많다.

블로그 이미지

Link2Me

,
728x90

일반적으로 HTML5 에서는 아래와 같이 테이블 체크박스를 만들어주면 된다.

<table>
    <thead>
        <tr>
            <th><input type="checkbox" id="chkall" /></th>
            <th>성명</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><input type="checkbox" /></td>
            <td>홍길동</td>
        </tr>
        <tr>
            <td><input type="checkbox" /></td>
            <td>이상철</td>
        </tr>
    </tbody>
</table>

 

하지만 MDB에서는 이렇게 하면 동작 자체가 안된다.

아래와 같은 형식으로 구현해야 코드가 동작한다.

<table>
    <thead>
        <tr>
            <th>
            <th scope="col">
                <div class="form-check form-check-inline">
                <input type="checkbox" class="form-check-input" id="checkall">
                <label class="form-check-label" for="checkall"></label>
                </div>
            </th>
            </th>
            <th>성명</th>
        </tr>
    </thead>
    <tbody>
        <?php $i=0; while($R = mysql_fetch_array($RCD)):?>
        <tr>
            <td>
                <div class="form-check form-check-inline">
                <input type="checkbox" class="form-check-input" name="uid[]" id="<?php echo $R['uid'];?>" value="<?php echo $R['uid'];?>">
                <label class="form-check-label" for="<?php echo $R['uid'];?>"></label>
                </div>
            </td>
            <td><?php echo $R['name'];?></td>
        </tr>
        <?php $i++; endwhile;?>
    </tbody>
</table>

 

$i=0;
while($R = mysqli_fetch_array($result)){
	$i++;
	if(in_array($R['id'],$cat3Array)){ 
		echo'<div class="form-check form-check-inline">
			  <input type="checkbox" class="form-check-input" name="cat3[]" id="'.$R['id'].'" value="'.$R['id'].'" checked>
			  <label class="form-check-label" for="'.$R['id'].'">'.$R['name'].'</label>
			</div>';
	} else {
		echo'<div class="form-check form-check-inline">
			  <input type="checkbox" class="form-check-input" name="cat3[]" id="'.$R['id'].'" value="'.$R['id'].'">
			  <label class="form-check-label" for="'.$R['id'].'">'.$R['name'].'</label>
			</div>';
	}
	if($i % 3 == 0) {echo '<br />';}
}

 

필요할 때만 구현하다보니검색하고 사용법을 익히는 시간 낭비를 하게 되어 적어둔다.

블로그 이미지

Link2Me

,
728x90

File Download 공격

설명
서버에 존재하는 파일이 의도하지 않게 클라이언트로 다운로드 되는 취약점이다.
해커가 원하는 파일을 임의로 다운로드하거나 파일 내용을 노출시킬 수 있다.
 발생원인 애플리케이션 로직에서 파일을 클라이언트로 다운로드할 때 입력 값 검증을 하지 않을 경우 발생한다.
 위험성 공격자에게 권한이 없는 데이터를 획득할 수 있도록 하며, 시스템 정보 등 중요 파일을 획득할 수 있도록 한다.
 대응 ㅇ외부 입력값을 자원의 식별자로 사용하는 경우, 철저하게 검증한 후 사용한다.
ㅇ사용자별 사용 가능한 자원을 사전에 리스트로 정의하여 사용 범위를 제한한다.
ㅇ파일을 사용하는 경우, 파일명에 경로순회공격 위험이 있는 문자를 제거하는 필터를 이용한다.

 

공격자가 의도적인 공격을 방지하기 위해서는 웹사이트 게시판, 자료실 등에서 php 프로그램을 이용하여 파일을 다운로드 받은 페이지가 있는지 조사를 한다.

 

$file_id = $_REQUEST['file_id'];
if(strstr($file_id,"../") || strstr($file_id,"..\\")){
    echo "<script>alert('Access Denied!')</script>";
    exit;
}

 

와 같이 ../ 상위 폴더로 이동을 못하게 검사하여 처리하는 걸 추가한다.

JSP, CGI 기반인 경우에는 관련 코드를 추가하여 방지하도록 한다.

 

<?php
require_once '../sessionChk.php'// 세션 체크
 
if(isset($_GET['filename'])) {
    $filename = $_GET['filename'];
    if(strstr($filename,"../"|| strstr($filename,"..\\")){
        echo("<meta http-equiv='Refresh' content='0; URL=/error.php'>");;
        exit;
    }
 
else {
    $dir="../files/"
    $filename = "upload_form.xlsx";
 
    if (file_exists($dir.$filename)) {
         header("Content-Type: application/octet-stream");
         header("Content-Disposition: attachment;; filename=$filename");
         header("Content-Transfer-Encoding: binary"); 
         header("Content-Length: ".(string)(filesize($dir.$filename))); 
         header("Cache-Control: cache, must-revalidate"); 
         header("Pragma: no-cache"); 
         header("Expires: 0"); 
         $fp = fopen($dir.$filename"rb"); //rb 읽기전용 바이러니 타입
         if(!fpassthru($fp)) {
             fclose($fp);                        
         }
    } else {
        header("Location: /"); // web root 디렉토리로 이동
        exit;
    }
}
 
?>

 

'Web 프로그램 > Web Security' 카테고리의 다른 글

HTML Purifier 사용법 예시  (0) 2023.02.28
remote IP address  (0) 2021.03.24
파일 업로드 공격 방지  (0) 2019.06.21
Cross-Site Scripting (XSS) 방지  (0) 2019.06.20
SQL Injection 공격 방지  (1) 2019.06.19
블로그 이미지

Link2Me

,