Location: PHPKode > projects > PHPEcho CMS > blocks/voting/index.php
<?php
/*  +--------------------------------------------
*   |
*   |     Product:       PHPEchoCMS
*   |     Author:        Anas Husseini
*   |     License:       GPL
*   |     Last updated:  18.03.07
*   |     For version:   2.0 
*   |     Desc:          Voting block
*   |        
*   +--------------------------------------------
*/

if( !@$BASE_LOAD )
{
    die('Application error.');
}

$block_display_name = $lang['020'];

$max_id = query ("SELECT MAX(`id`) FROM `".PREFIX."voting`", 2);
$last_voting = query ("SELECT * FROM `".PREFIX."voting` WHERE `id` = '".$max_id."'", 4);

if ($last_voting['id'])
{
	$voting_elements = query ("SELECT * FROM `".PREFIX."voting_elements` WHERE `parent`='".$last_voting['id']."'", 1);

	$block_content = "<form action='index.php?module=voting&id=".$last_voting['id']."&vote=1' method='post'>";
	$block_content .= "<b>".$last_voting['title']."</b><br>";
	$ii = 1;
	while ($element = mysql_fetch_array($voting_elements))
	{
		$block_content .= "<input type=radio name='child_id' value=".$element['id'].">".$element['title']."<br>";
		$ii++;
	}
	$block_content .= "<input type=submit name='sumbit_vote' value='".$lang['021']."'></form>";
}
else
	$block_content = "<center>".$lang['022']."</center>";

?>
Return current item: PHPEcho CMS