📄 vote.inc.php
字号:
<?php
class vote
{
var $cookie_expire = 96;
function create_poll( )
{
global $msql;
global $tbl_poll_index;
global $tbl_poll_data;
global $tbl_poll_config;
$logging = $_POST['logging'];
$expire = $_POST['expire'];
$day = $_POST['day'];
$status = $_POST['status'];
$comments = $_POST['comments'];
$option_id = $_POST['option_id'];
$question = $_POST['question'];
$color = $_POST['color'];
$timestamp = time( );
if ( !isset( $expire ) )
{
$expire = 0;
}
if ( !isset( $day ) )
{
$day = $timestamp;
}
else
{
$exp_time = $timestamp + $day * 86400;
}
if ( !get_magic_quotes_gpc( ) )
{
$question = addslashes( $question );
}
$msql->query( " INSERT INTO {$tbl_poll_index} values(\r\n\t 0,\r\n\t '{$question}',\r\n\t '{$timestamp}',\r\n\t '{$status}',\r\n\t '{$exp_time}',\r\n\t '{$expire}'\r\n\t)" );
$msql->query( " SELECT poll_id FROM {$tbl_poll_index} WHERE timestamp={$timestamp} " );
if ( $msql->next_record( ) )
{
$poll_id = $msql->f( "poll_id" );
}
$i = 1;
for ( ; $i <= sizeof( $option_id ); $i++ )
{
$option_id[$i] = trim( $option_id[$i] );
if ( !empty( $option_id[$i] ) )
{
if ( !get_magic_quotes_gpc( ) )
{
$option_id[$i] = addslashes( $option_id[$i] );
}
$msql->query( "INSERT INTO {$tbl_poll_data} values (\r\n\t\t\t\t0,\r\n\t\t\t\t'{$poll_id}',\r\n\t\t\t\t'{$i}',\r\n\t\t\t\t'{$option_id[$i]}',\r\n\t\t\t\t'{$color[$i]}',\r\n\t\t\t\t'0'\r\n\t\t\t)" );
}
}
}
function delete_poll( $poll_id )
{
global $msql;
global $tbl_poll_index;
global $tbl_poll_data;
global $tbl_poll_config;
global $strVoteDelOK;
$msql->query( " DELETE FROM {$tbl_poll_data} WHERE poll_id = '{$poll_id}' " );
$msql->query( " DELETE FROM {$tbl_poll_index} WHERE poll_id = '{$poll_id}' " );
$del_message = sayok( $strVoteDelOK, "poll_set.php?action=show", "" );
return $del_message;
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -