2014-09-17 2 views
0

임을 수정할 수 없습니다, 로그인 말림, 내 코드는 다음과 같습니다이 웹 사이트에 로그인 PHP 컬을 사용하여 헤더 정보

경고 : 수정할 수 없습니다 헤더 정보

<?php 
$Luser = ""; 
$Lpass = ""; 

if(isset($_POST['username']) && isset($_POST['password'])) 
{ 
    $Luser = $_POST['username']; 
    $Lpass = $_POST['password']; 
    $L_info="http://registration.zwinky.com/registration/loginAjax.jhtmlusername=".$Luser."&password=".$Lpass; 
    $zwinky_login_file = file_get_contents($L_info, true); 
    if (substr($zwinky_login_file, 12, 1) == "u"){ $message = "Blank username!"; } 
    if (substr($zwinky_login_file, 12, 1) == "p"){ $message = "Blank password!"; } 
    if (substr($zwinky_login_file, 12, 1) == "w"){ $message = "Wrong user/pass combination!"; } 
    if (substr($zwinky_login_file, 12, 1) == "s"){ 
    $ch = curl_init(); 

    curl_setopt($ch, CURLOPT_URL , $L_info); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt($ch, CURLOPT_COOKIEFILE, "sessions/".$Luser); 
    curl_setopt($ch, CURLOPT_COOKIEJAR, "sessions/".$Luser); 
    $response = curl_exec($ch); 
    curl_close($ch); 

    $_SESSION['username'] = $Luser; 
    $_SESSION['password'] = $Lpass; 

    header('Location: http://idane.me/start.html'); 
    } 
    echo($message); 
} 
?> 

을하지만 메신저 오류가 - /customers/2/9/0/idane.me/httpd.www/에서 이미 보낸 헤더 (/customers/2/9/0/idane.me/httpd.www/login.php:49에서 시작된 출력) line 73의 login.php

라인 73 :

header('Location: http://idane.me/start.html'); 

문제가 있습니까?

+0

가능한 중복 [ "헤더는 이미 전송"해결하는 방법에 PHP의 오류 (http://stackoverflow.com/questions/8028957/ how-to-fix-headers-already-sent-error-in-php) – hindmost

답변

1

49 번 라인은 무엇입니까?

그리고 당신은 당신이 헤더 후 exit()를 추가해야합니다 :

header('Location: http://idane.me/start.html'); 
exit(); 
+0

49 호는 php 태그 –

+0

Ho를 여는 것일 뿐이므로 출력을 생성하는 다른 파일에이 파일을 포함 시키시겠습니까? PHP가 브라우저에 출력을 표시하자마자 헤더를 보내면 나중에 헤더를 수정할 수 없습니다 => 따라서 오류가 발생합니다 – MaxouMask

+0

전체 코드 : http://pastebin.com/vWWcxq45 –

관련 문제