[eluser]Captain_Fluffy_Pants[/eluser]
Today I was wanting to make a voting script but im not really any good at making
javescript scripts. but I was wondering if I was doing this right
and if I could get any help on it?.
Code:
(function())
$vote('vote_up, vote_down')
if $vote_up('get_cookie');
eals
if ('vote_down')
$votedown('delete_cookie'); $die;
$vote_down = 'delete_cookie';
$vote_upp = 'get_cookie';
$this->load->helper('cookie_helpers');
function get_cookie($index = '', $xss_clean = FALSE)
{
$CI =& get_instance();
$prefix = '';
if ( ! isset($_COOKIE[$index]) && config_item('cookie_prefix') != '')
{
$prefix = config_item('cookie_prefix');
}
return $CI->input->cookie($prefix.$index, $xss_clean);
}
if ( ! function_exists('delete_cookie'))
{
function delete_cookie($name = '', $domain = '', $path = '/', $prefix = '')
{
set_cookie($name, '', '', $domain, $path, $prefix);
}
}