2011-04-27 11 views
0

사용자가 내가 만든 양식을 게시하면 흰색 화면이 나타납니다. 흥미로운 것은 사이트의 관리자 (이 사이트는 WordPress를 사용하여 실행)에서 양식의 동일한 데이터를 게시하고 작동 시키지만 사용자가 흰색 화면을 사용하면 도움이됩니다. 아래는 양식 데이터와 내가 사용하고있는 다른 코드입니다. 여기 양식 게시시 흰색 화면

누군가가 여기에 도움이 될 수 있다면 좋을 것

function bio_form(){ 
global $wpdb, $current_user; 

//get current user info 
get_currentuserinfo(); 

$yes = $_GET['submitted']; 

//check log in 
if(!is_user_logged_in()) { 
    //user isnt logged in 
    echo "You must be logged in to use this form"; 
    //show login form 
    if (!(current_user_can('level_0'))){ 
     echo "<h2>Login</h2>"; 
     echo "<form action=" . get_option('home') . "/wp-login.php method='post' enctype='multipart/form-data'>"; 
     echo "<input type='text' name='log' id='log' value='" . wp_specialchars(stripslashes($user_login), 1) . "' size='20' />"; 
     echo "<input type='password' name='pwd' id='pwd' size='20' />"; 
     echo "<input type='submit' name='submit' value='Send' class='button' />"; 
     echo "<p>"; 
     echo "<label for='rememberme'><input name='rememberme' id='rememberme' type='checkbox' checked='checked' value='forever' /> Remember me</label>"; 
     echo "<input type='hidden' name='redirect_to' value=" . $_SERVER['REQUEST_URI'] . " />"; 
     echo "</p>"; 
     echo "</form>"; 
     echo "<a href='" . get_option('home') . "/wp-login.php?action=lostpassword'>Recover password</a>"; 
     //add register link 
    } else { 
     echo "<h2>Logout</h2>"; 
     echo "<a href=" . wp_logout_url(urlencode($_SERVER['REQUEST_URI'])) . ">logout</a><br />"; 
    } 
}else{ 
    $gg = false; 
    if($yes == NULL){ 
     $id = $_GET['enID']; 
     $em = $_GET['em']; 
     $sub = $_GET['submit']; 
     if($id == NULL || $em == NULL){  
      echo "<div align='center'><form action=''>"; 
      echo "<p>Plese use the email you used on the your entry, and the entryID that was generated for your entry.</p>"; 
      echo "Email: <input type='text' name='em' value='$em'></input></br>"; 
      echo "EntryID: <input type='text' name='enID' value='$id'></input></br>"; 
      echo "<input type='hidden' name='submit' value='yes'></input>"; 
      echo "<input type='submit' value='submit'></input></form></div>"; 
    }else{ 
     $sql = "SELECT * FROM `" . WP_BIO_GIRLS_DATA . "`"; 
     $users = $wpdb->get_results($sql); 
     foreach($users as $user){ 
      if(($user->id == $id)&& ($user->email == $em)){ 
       $gg = true; 
       break; 
      } 
     } 
    } 
}else{ 
    $gg = true; 
} 

    if($gg == true){ 
     //user is logged in 
     $sql = "SELECT * FROM `" . WP_BIO_GIRLS . "`"; 
     $users = $wpdb->get_results($sql); 

     //Check to see if user is in GG DB 
     $userThere = false; 

     foreach($users as $user){ 
      if($user->user_id == $current_user->ID){  
       $userThere = true; 
       break; 
      } 
     } 

     //If not in GG DB add to it 
     if($userThere == false){ 
      $sql = "INSERT INTO `" . WP_BIO_GIRLS . "` (user_id,title1,title2,title3,title4,title5,title6,title7,title8,title9,title10,title11,title12,title13,title14,title15) VALUES ($current_user->ID,'What game consoles (if any) do you own & which is your favorite?','What are your Gamertags & corresponding gamerscores for those consoles?','What are your top 3 games? Movies? Favorite Genre?','What nerd icon, hero, or villian do you have a crush on?','What was your first exposure to nerd culture?','What is your dream game?','What would be your ideal character to cosplay?','What do you feel makes nerd culture unique?','What do you feel nerd culture lacks?','How do you feel about professional Video Gaming?','What superpower would you have and would/should you register it?','What is the worst pick up line you have ever heard?','Do you find Murdoc (our mascot) sexy?','How many hours a day would you say you spend nerding out?','How do you envision D-day coming about?')"; 
      $insert = $wpdb->query($sql); 
     } 

     //Place to get post and store data 
     $fName = $_GET['firstname']; 
     $lName = $_GET['lastname']; 
     $email = $_GET['email']); 
     $dName = $_GET['disname']; 
     $enID = $_GET['eid']; 
     $Q1 = $_GET['Q1']; 
     $Q2 = $_GET['Q2']; 
     $Q3 = $_GET['Q3']; 
     $Q4 = $_GET['Q4']; 
     $Q5 = $_GET['Q5']; 
     $Q6 = $_GET['Q6']; 
     $Q7 = $_GET['Q7']; 
     $Q8 = $_GET['Q8']; 
     $Q9 = $_GET['Q9']; 
     $Q10 = $_GET['Q10']; 
     $Q11 = $_GET['Q11']; 
     $Q12 = $_GET['Q12']; 
     $Q13 = $_GET['Q13']; 
     $Q14 = $_GET['Q14']; 
     $Q15 = $_GET['Q15']; 


    if($dName != NULL && $email != NULL && $lName != NULL && $fName != NULL && $enID != NULL && ($_GET['submitted'] != NULL)){ 
     //Call entry id db to see if they are a GG. 
     echo "<div align='center'>Information was saved!!</div>"; 

     //Store database 
     $sql = "UPDATE `" . WP_BIO_GIRLS . "` SET FirstName='$fName', LastName='$lName', Email='$email', DisName='$dName', EID='$enID', text1='$Q1', text2='$Q2', text3='$Q3', text4='$Q4', text5='$Q5', text6='$Q6', text7='$Q7', text8='$Q8', text9='$Q9', text10='$Q10', text11='$Q11', text12='$Q12', text13='$Q13', text14='$Q14', text15='$Q15' WHERE user_id='$current_user->ID'"; 
     $stored = $wpdb->query($sql); 

    }else{ 
     //Need to fill required fields 
     if(($fName == NULL || $lName == NULL || $email == NULL || $dName == NULL || $enID == NULL) && ($_GET['submitted'] != NULL)){ 
      echo "<div align='center'><style>h2 {color:#FF0000;}</style><h2>Please fill out all the required boxes</h2></div>"; 
    } 
     //Old, needs deleted 
     $status = false;  

     $sql = "SELECT * FROM `" . WP_BIO_GIRLS . "`"; 
     $users = $wpdb->get_results($sql);  

     foreach($users as $user){  
      if($user->user_id == $current_user->ID){    
       $status = true;       
       break;  
      } 
     } 

     if($status == false){  
      echo "<div align='center'><h3>Sorry only gamer girls can fill out this form</h3></div>"; 
     }else{ 
      //Show form if all checks pass 

      //get current users current values 
      $sql = "SELECT * FROM `" . WP_BIO_GIRLS . "` WHERE user_id='$current_user->ID'";  
      $users = $wpdb->get_results($sql);  

      //get values from db 
      foreach($users as $user){ 
       $userID = $user->user_id; 
       $fName = $user->FirstName; 
       $lName = $user->LastName; 
       $dName = $user->DisName; 
       $email = $user->Email; 
       $EID = $user->EID; 
       $userQ1T = $user->title1; 
       $userQ1X = $user->text1; 
       $userQ2T = $user->title2; 
       $userQ2X = $user->text2; 
       $userQ3T = $user->title3; 
       $userQ3X = $user->text3; 
       $userQ4T = $user->title4; 
       $userQ4X = $user->text4; 
       $userQ5T = $user->title5; 
       $userQ5X = $user->text5; 
       $userQ6T = $user->title6; 
       $userQ6X = $user->text6; 
       $userQ7T = $user->title7; 
       $userQ7X = $user->text7; 
       $userQ8T = $user->title8; 
       $userQ8X = $user->text8; 
       $userQ9T = $user->title9; 
       $userQ9X = $user->text9; 
       $userQ10T = $user->title10; 
       $userQ10X = $user->text10; 
       $userQ11T = $user->title11; 
       $userQ11X = $user->text11; 
       $userQ12T = $user->title12; 
       $userQ12X = $user->text12; 
       $userQ13T = $user->title13; 
       $userQ13X = $user->text13; 
       $userQ14T = $user->title14; 
       $userQ14X = $user->text14; 
       $userQ15T = $user->title15; 
       $userQ15X = $user->text15; 
      } 
      //create form 
      echo "<style>textarea {resize:none;} table {text-align: center;}</style>";  
      echo "<div align='center' id='form'><h1>Gaming Girls Information Form</h1>"; 
      echo "<h7>* denoted required fields</h7>"; 
      echo "<table cellspacing='20' cellpadding='3'>"; 
      echo "<tr><td><form name='info_form' action='' method='get' ENCTYPE='multipart/form-data'></td></tr>"; 
      echo "<tr><td colspan='2'>*First Name: <input type='text' name='firstname' value='$fName'></input></td></tr>"; 
      echo "<tr><td colspan='2'>*Last Name: <input type='text' name='lastname' value='$lName'></input></td></tr>";  
      echo "<tr><td colspan='2'>*Display Name: <input type='text' name='disname' value='$dName'></input></td></tr>"; 
      echo "<tr><td colspan='2'>*Email: <input type='text' name='email' value='$email'></input></td></tr>"; 
      echo "<tr><td colspan='2'>*OHMS Gaming EntryID: <input type='text' name='eid' value='$EID'></input></td></tr>"; 
      echo "<tr><td>$userQ1T : <TEXTAREA rows='3' cols='30' name='Q1'>$userQ1X</TEXTAREA></td>"; 
      echo "<td>$userQ2T : <TEXTAREA rows='3' cols='30' name='Q2'>$userQ2X</TEXTAREA></td></tr>"; 
      echo "<tr><td>$userQ3T : <TEXTAREA rows='3' cols='30' name='Q3'>$userQ3X</TEXTAREA></td>";    
      echo "<td>$userQ4T : <TEXTAREA rows='3' cols='30' name='Q4'>$userQ4X</TEXTAREA></td></tr>"; 
      echo "<tr><td>$userQ5T : <TEXTAREA rows='3' cols='30' name='Q5'>$userQ5X</TEXTAREA></td>"; 
      echo "<td>$userQ6T : <TEXTAREA rows='3' cols='30' name='Q6'>$userQ6X</TEXTAREA></td></tr>"; 
      echo "<tr><td>$userQ7T : <TEXTAREA rows='3' cols='30' name='Q7'>$userQ7X</TEXTAREA></td>"; 
      echo "<td>$userQ8T : <TEXTAREA rows='3' cols='30' name='Q8'>$userQ8X</TEXTAREA></td></tr>"; 
      echo "<tr><td>$userQ9T : <TEXTAREA rows='3' cols='30' name='Q9'>$userQ9X</TEXTAREA></td>"; 
      echo "<td>$userQ10T : <TEXTAREA rows='3' cols='30' name='Q10'>$userQ10X</TEXTAREA></td></tr>"; 
      echo "<tr><td>$userQ11T : <TEXTAREA rows='3' cols='30' name='Q11'>$userQ11X</TEXTAREA></td>"; 
      echo "<td>$userQ12T : <TEXTAREA rows='3' cols='30' name='Q12'>$userQ12X</TEXTAREA></td></tr>"; 
      echo "<tr><td>$userQ13T : <TEXTAREA rows='3' cols='30' name='Q13'>$userQ13X</TEXTAREA></td>"; 
      echo "<td>$userQ14T : <TEXTAREA rows='3' cols='30' name='Q14'>$userQ14X</TEXTAREA></td></tr>"; 
      echo "<tr><td>$userQ15T : <TEXTAREA rows='3' cols='30' name='Q15'>$userQ15X</TEXTAREA></td></tr>"; 
      echo "<input type='hidden' value='yes' name='submitted'></input>";  
      echo "<tr><td colspan='2'><input type='submit' value='Submit'></input></td></tr>";  
      echo "</form></table></div>"; 
      } 
     } 
    }else{ 
     if($sub == true){ 
      echo "<div align='center'><h1>Not a vaild id</h1></div>"; 
     } 
    } 
} 
} 

(나는 좋은 코드 나는 아직도 배우고 아니라는 것을 알고) 양식 부분입니다 코드입니다. 예를 들어, 게시물 데이터와 관련이 있는지 궁금합니다. 이것은 양식을 제출할 때 url의 샘플입니다.

http://ohmsgaming.com/gaming-girls/gaming-girls-form/?firstname=Lilith&lastname=Crimson&disname=Lilith+Crimson&email=laceylynn325%40yahoo.com&eid=18301743&Q1=Sega+Genesis%2C+Super+Nintendo-2%2C+Nintendo-+2%2C+PlayStation+1%2C+Game+cube%2C+Gameboy%2C+Gameboy+Color%2C+Gameboy+Advanced%2C+Gameboy+SP%2C+Nintendo+64%2C+Xbox+360.&Q2=N%2FA&Q3=Games-%0D%0A1.+Battle+Toads%0D%0A2.+Elder+Scrolls%0D%0A3.+tales+of+symphonia%0D%0A%0D%0AMovies-%0D%0A1.+Labyrinth%0D%0A2.+Strangeland%0D%0A3.+Ace+Ventura+2%0D%0A%0D%0AGenre%0D%0AScifi&Q4=Anthony+Edward+Stark+%28Tony+Stark%2C+Iron+Man%29&Q5=My+Eldest+Brother+and+his+friends+playing+D%26D+and+Magic+the+Gathering+back+in+the+90%27s&Q6=Not+sure+what+you+mean+by+that%2C+but+Skyriim+at+the+Moment.+%0D%0A%0D%0AIf+I+could+create+one%3F+%0D%0A%0D%0AOne+that+takes+place+in+all+time+periods%2C+larger+then+Elder+Scrolls%2C+Being+able+to+create+your+own+fashions+Vastly%2C+weapons%2C+creatures%2C+looks%2C+Kinect+probably+could+take+a+self+scan+and+place+you+into+that+world+and+allow+you+to+live+the+world%2C+as+if+its+your+own+world.&Q7=Poison+Ivy%2C+or+Black+Widow..or+maybe+Red+Sonja.+Really+just+redheaded.+&Q8=The+Ability+to+see+past+reality+and+create+Their+own+Universal+Dimension+if+you+can+say%2C+and+expand+our+minds+into+thinking+%22What+if%22.+%0D%0A%0D%0AThe+nerds+mind+have+been+ubiquitous%2C+and+created+a+vast+reality+of+our+own%2C+making+life%2C+easier+for+some%2C+and+much+more+fun+for+others%2C+and+all+really.+%0D%0A%0D%0ATo+be+a+nerd%2C+isn%27t+just+about+having+brains+anymore%2C+Its+about+having+fun+and+bringing+a+new+level+of+reality+to+all+who+wishes+to+hear+it.&Q9=Pizza.+&Q10=I+think+its+a+great+idea.+Video+gaming+is+a+sport+%28in+its+own+way%29%2C+and+it+allows+gamers+to+pick+up+their+game+and+improve+their+abilities+and+others+learn.+Challenging+skills+allow+those+to+really+see%2C+who+can+kick+A**+and+who+just+need+to+go+home+and+continue+playing+Halo+with+their+friends+at+parties.&Q11=Flying%2FControl+of+Elements+%28really+that+would+be+considered+air%29.+No.+Where+is+the+fun+in+that%3F&Q12=-Hey+girl%2C+what%E2%80%99s+up%3F+Guess+what%3F+It%E2%80%99s+your+lucky+day.+Out+of+all+the+girls+here%2C+I+picked+you+to+talk+to-&Q13=In+a+Sense%2C+yes.+He%27s+very+Attractive.+I+want+to+hug+him+and+feed+him+Cheese+Lol&Q14=Probably+all+day..My+teacher+is+a+huge+nerd%2C+and+all+we+talk+about+is+video+games.+Yes%2C+she%27s+65.+%0D%0A%0D%0AThen+I+come+home%2C+and+pop+in+whatever+game+we+were+talking+about+all+day%2C+or+Oblivion.+Then+spend+the+rest+on+here+on+Deviant+Art+talking+about+Marvel%2C+DC%2C+and+Dark+Horse+Comics%2C+along+with+others.+%0D%0A%0D%0AAlso+D%26D+with+Magic+the+Gathering+with+one+of+my+young+friends+who+is+obsessed+with+them+and+needs+me+to+guide+them+Lol.+So+its+actually+kind+of+forced+sometimes&Q15=Nuclear+Apocalypse%2C+Zombies+then+Follow!&submitted=yes 

정말 길고, 그 문제의 경우 그 안에 많은 일들이, 내가 궁금가 말했듯이 생각 나는가 로그인하고 때 나를 위해 잘 작동 상기와 동일한 문자열을 사용하는 경우 관리자로

피씨 코드가 코드 블록에서 잘 포맷되지 않아 죄송합니다.

+0

먼저 출력물을 볼 수있는 "소스보기"를 수행하지만 빈 페이지 만 렌더링하는 것입니다. 둘째, 웹 서버의 오류 로그를 조사해야합니다. 해당 페이지의 문제에 대해 알려주는 메시지가있을 수 있습니다. – Marvo

+0

오류 로그를 보았습니다. 아무 것도 없습니다. 그리고 아무 소스도 없다고 생각합니다. 쿼리의 % 27 코드와 관련이 있습니다. – Tempus35

+0

양식의 메서드를 변경하여 수정했습니다. – Tempus35

답변

1

흰색 화면은 일반적으로 오류로 인해 충돌하는 것을 의미합니다. PHP 코드 줄에 추가하여 검색 오류를 시도하는 것이 좋습니다.

print_r (error_get_last());

오류가 발생하면 오류가 출력되지 않습니다.

또한 데이터베이스에서 오류가 반환되지 않았는지 확인하십시오 (mysql, mysqli, PDO .. 다른 기능을 사용하여 오류가 발생 함).

+0

코드 줄을 추가했지만 어디에도 아무 것도 인쇄하지 않습니다. 라인이 함수의 맨 위에 있습니다. – Tempus35

+0

add print_r (error_get_last()); 귀하의 PHP 코드의 하단에 – xeranas

+0

나는 오류 코드를 얻을 수 있지만 폼, 다른 뭔가, 그리고 다른 함수에서 정의되지 않은 var. – Tempus35

1

흰색 화면은 일반적으로 서버 500 오류이지만 브라우저에 아무 것도 표시되지 않으면주의 사항이 표시됩니다. 참으로 당신의 WP-config.php를 설정 디버그에서

:

define('WP_DEBUG', true); 

그런 다음, 플러시 캐시를 로그 아웃 한 후 쿠키를 삭제 일반 사용자로 양식을 제출하려고하면 오류 메시지를 받게됩니다 .

+0

양식의 방법을 변경하여 수정했습니다 – Tempus35

관련 문제