내 HTML 양식이 처리 할 PHP 페이지로 보내집니다. 양식에 captcha를 추가해야하지만 HTML 페이지를 PHP로 변경할 수 없으므로 HTML 양식 내의 이미지로 출력되는 capcha.php 페이지에 표시된 captcha에 대한 세션을 설정해야합니다. 페이지로드시 세션 변수가 설정되었지만 프로세스 PHP 페이지에서이 세션을 검색 할 수 없습니다. 그냥 파이어 폭스 나 크롬 어디서이 문제가 참아. 그것은 IE에서 작동합니다.PHP 세션 - Firefox 또는 Chrome에서 세션을 검색 할 수 없습니다.
session_start(); // start a session
$image = imagecreate(50, 20); //create blank image (width, height)
$bgcolor = imagecolorallocate($image, 0, 0, 0); //add background color with RGB.
$textcolor = imagecolorallocate($image, 255, 255, 255); //add text/code color with RGB.
$code = rand(1000, 9999); //create a random number between 1000 and 9999
$_SESSION['code'] = $code; //add the random number to session 'code'
imagestring($image, 10, 8, 3, $_SESSION['code'], $textcolor); //create image with all the settings above.
header ("Content-type: image/png"); // define image type
imagepng($image); //display image as PNG
PHP 프로세스 페이지 :
session_start();
print_r($_SESSION['code']);
사람이 도움을 수있는 capcha.php에 세션을 설정
코드?
편집 * 나는 세션 함께 할 수있는 그 무언가가 내 HTML 양식에 이미지로 추가 capcha.php에 설정되는 생각합니다. 브라우저에서 capcha.php로 간 다음 process_email.php로 이동하면 세션이 설정됩니다. 따라서 이미지로 포함될 때 설정되지 않습니다. 누구든지이 문제를 해결할 방법을 알고 있습니까? *
** process.php ** 페이지에서 세션을 다시 시작하는 이유는 무엇입니까? – dreamweiver
파이어 폭스 또는 크롬에서 세션을 검색 할 수 없다고 했으므로 IE에서 할 수 있다고 말하고 있습니까? 아니면 세션을 전혀 가져올 수 없습니까? –
IE에서 세션을 검색 할 수 있습니다. 세션 [ 'code'] 값이 있습니다. 파이어 폭스 나 크롬에 어떤 가치도 없다. – LeeTee