페이지 로딩시 자동로그인이 되도록 구현하고 싶습니다... 채택완료

1. 메인페이지에 get으로 mb_id를 지정  ex) URL/?mb_id=test

2. 메인에서 $(document).ready(function(){} 로 페이지가 시작될때 로그인.


인데 어떻게 해야 할지...


 $(document).ready(function(){

        if(window.location != "http://URL/?mb_id=user_ot0uje"){

            window.location.href = "http://URL/?mb_id=user_ot0uje";

        }


        if(document.getElementById('mb_id').value != null){

            //alert(document.getElementById('mb_id').value);

            //alert(document.getElementById('mb_password').value);

            if(window.location != "http://URL/?mb_id=user_ot0uje&login_check=true"){

                alert("성공");

            }else{

                    document.getElementById('ready_login').submit();

            }

            

        }

    });


<form action="http://URL/bbs/login_check.php" method="post" id="ready_login">

            <input type="hidden" name="mb_id" id="mb_id" value="<?= $_GET['mb_id'] ?>">

            <input type="hidden" name="mb_password" id="mb_password" value="1234">

        </form>

답변 1개

채택된 답변
+20 포인트

자동 로그인 구현하려는 의도는 모르겠지만 자동 로그인 처리를 위해서 라면 해당 정보를 기입해서 전달해 주면 되는걸로 아는데 정확하게 위 소스가 어떻게 반응하시는지에 대한 오류가 어떻게 되시는지 알려주시면 도움을 받으시는데 수월하실겁니다.

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인
🐛 버그신고