date_sub(now(), interval '2' minute)"; $r5 = mysql_query($q5); if(mysql_num_rows($r5) == 0) { $pollRes = $pollFormData["answer_pp"]; $q1 = "update answer set hit = hit + 1 where id_answer = ".$pollRes; $r1 = mysql_query($q1); $q6 = "insert into poll_ip (id_poll_ip, ip, puttime) values('%', '".$client_ip."', NOW())"; $r6 = mysql_query($q6); $pol = mysql_query("SELECT * FROM poll WHERE archive=0 AND hide=0"); if(mysql_num_rows($pol) > 0) { $poll = mysql_fetch_array($pol); $aaa = ""; // Просматриваем вопросы опроса $q2 = "SELECT * FROM answer WHERE id_poll = ".$poll['id_poll']; $r2 = mysql_query($q2); if(mysql_num_rows($r2) > 0) { $total_answers = 0; while($l2 = mysql_fetch_array($r2)) { $total_answers += $l2['hit']; } } $query = "SELECT * FROM answer WHERE id_poll=".$poll['id_poll']." ORDER BY pos;"; $ans = mysql_query($query); $first = true; if(mysql_num_rows($ans) > 0) { while($answer = mysql_fetch_array($ans)) { $hit = $answer['hit']; if($first) { $addon = 'checked'; $first = false;} else { $addon = ''; } $percent = round(($hit/$total_answers)*100,2); $aaa .= ""; } $aaa .= ""; $aaa .= ""; } $aaa .= "
".$poll['name']."
".$answer['name']."".$hit."
Проголосувало:".$total_answers."
Архив
"; } } else { $aaa = "
Вибачте, але ви нещодавно
вже проголосували.
"; } $objResponse = new xajaxResponse(); $objResponse->addAssign("main_poll","innerHTML",$aaa); return $objResponse; } function last_blog($blog_id, $limit=3) { $r = mysql_query("SELECT *, DATE_FORMAT(`post_date`, '%Y/%m/%d') as create_date FROM wp_{$blog_id}_posts WHERE post_status='publish' and post_type<>'page' ORDER BY post_date DESC LIMIT {$limit}"); // год/месяц/день if (mysql_num_rows($r)>0) { echo ""; } } ?>