티스토리 뷰

사용할 페이지

<tr>
    <td>

         <img src="/include/secimg.php" align="absmiddle"> 왼쪽의 숫자 중 큰 숫자는?

         <input type="text" name="sec" size="10" class="form2">

    </td>
</tr>


사용한페이지 처리부분

  if($sec==$_SESSION["answer_session"]) //보안단어 처리
  {

        처리부분

  }
  else
  {
      echo "

          <script>alert('보안단어가 다릅니다.');

              location.href='/homepage/home_counsel.php';

          </script>";
  }


secimg.php

 

<?
header ("Content-type: image/png");

// $dan 이 보안단어 이다. |를 구분으로 2~3자리 한글로 만든다. 계속 추가하면 된다.
//$dan = "amour|ami|invite|libre|style|douze|ciel|tour|colorez";
$dan = "67  21|23  21|2  77|32  55|54  45|22  11|81  22|21  63|61  29";
$dan2 = "67|23|77|55|54|22|81|63|61";

$bbs_dan = explode("|",$dan);     // $dan을 explode 함수를 이용해서 배열로 만든다.
$bbs_dan2 = explode("|",$dan2);  // $dan2을 explode 함수를 이용해서 배열로 만든다.

$nowt=date("s"); //로딩된 시간
$scho=$nowt;

//$scho=$s;
//$nowt=$s;

srand ($nowt); //시간을 시드값으로 난수 생성
$numbers = rand(0,sizeof($bbs_dan)-1); //배열 중 하나 선택

$bbs_security = $bbs_dan[$numbers];        // 단어 선택 완료 $bbs_security값이 서버에서 세선에 저장되어야함
$bbs_answer = $bbs_dan2[$numbers];


    $width = "67";     //생성이미지 가로사이즈
    $height = "25";    //생성이미지 세로사이즈

    $im=ImageCreate($width,$height); // 이미지의 크기를 정합니다.

   
    $wgray = ImageColorAllocate ($im, 240, 240, 240);
    $green = ImageColorAllocate ($im, 0, 128, 0);
    $blue = ImageColorAllocate ($im, 0, 0, 128);
    $red = ImageColorAllocate ($im, 128, 0, 0);
 
    ImageFilledRectangle($im, 0, 0, $width, $height, $wgray);

    $x = 16;
    $y= 23;

   
    if(strlen($bbs_security)>4) {
        $x = $x - (strlen($bbs_security)-4)*3;
    }

    // ImageTTFText ("사이즈", "폰트사이즈", "각도", "여백(왼)", "여백(위)", "칼라", "폰트", "글자")
    ImageTTFText($im,13,10,$x,$y,$red,"/home/ignc/www/fonts/arial.ttf",$bbs_security);

    ImagePNG($im);

    ImageDestroy($im); // 이미지에 사용한 메모리 제거

    session_start();
    $_SESSION["answer_session"] = $bbs_answer;
?>

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2025/04   »
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 29 30
글 보관함