Advertisement
aligatro

Plug result code

Dec 24th, 2013
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.91 KB | None | 0 0
  1. <?php
  2. /*Выводим результаты голосования для тех кто не голосовал по ссылке*/
  3. $pool1_abspath = dirname(__FILE__);
  4. $pool1_abspath_1 = str_replace('wp-content/plugins/pool-one-wp-plugin', '', $pool1_abspath);
  5. $pool1_abspath_1 = str_replace('wp-content\plugins\pool-one-wp-plugin', '', $pool1_abspath_1);
  6. require_once($pool1_abspath_1 .'wp-config.php');
  7.  
  8. $ans = @$_GET["ans"];
  9. $res = "";
  10. global $wpdb, $wp_version;
  11. $pool1_que_css = "<div class='pool-question'>##QUESTION##</div>";
  12. $pool1_ans_css = "<div class='pool-answer'>##ANSWER## <span class='pool-result'>(##RES##)</span></div>";
  13.  
  14.  
  15.  
  16.  
  17.     $sSql = "select poolq_id, poolq_question from ". POOLONETABLEQ ." where 1=1";
  18.     $sSql = $sSql . " limit 0,1;";
  19.     $pool_question = $wpdb->get_results($sSql);
  20.  
  21.  
  22.             $pool1_que_css = "<div class='pool-question'>##QUESTION##</div>";
  23.             $pool1_ans_css = "<div class='pool-answer'>##ANSWER## <span class='pool-result'>(##RES##)</span></div>";
  24.             $res = '<div id="pool1">';
  25.             foreach ( $pool_question as $question )
  26.             {
  27.                 $poolq_id = $question->poolq_id;
  28.                 $poolq_question = stripslashes($question->poolq_question);
  29.                 $poolq_question = str_replace( "##QUESTION##" , $poolq_question, $pool1_que_css);
  30.                 $res = $res . $poolq_question;
  31.                 $sSql = "select poola_id, poola_answer, poola_vote from ". POOLONETABLEA ." where 1=1 and poolq_id = ". $poolq_id;
  32.                 $pool_answer = $wpdb->get_results($sSql);
  33.                
  34.             }
  35.             foreach ( $pool_answer as $answer )
  36.             {
  37.                         $poola_id = $answer->poola_id;
  38.                         $poola_answer = stripslashes($answer->poola_answer);
  39.                         $poola_vote = $answer->poola_vote;
  40.                         $poola_answer = str_replace( "##ANSWER##" , $poola_answer, $pool1_ans_css);
  41.                         $poola_answer = str_replace( "##RES##" , $poola_vote, $poola_answer, $pool1_res_css);
  42.                         $res = $res . $poola_answer;
  43.             }
  44.             $res = $res . '</div>';
  45.             echo $res;
  46.        
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement