function insert_new_poll() { global $INSTALLER09, $CURUSER, $mc1, $lang; if (!isset($_POST['poll_question']) or empty($_POST['poll_question'])) { stderr($lang['poll_inp_usr_err'], $lang['poll_inp_no_title']); } $poll_title = sqlesc(htmlsafechars(strip_tags($_POST['poll_question']), ENT_QUOTES)); //get the main crux of the poll data $poll_data = makepoll(); if (!is_array($poll_data) or !count($poll_data)) { stderr($lang['poll_inp_sys_err'], $lang['poll_inp_no_data']); } //all ok, serialize $poll_data = sqlesc(serialize($poll_data)); $username = sqlesc($CURUSER['username']); $time = TIME_NOW; sql_query("INSERT INTO polls (start_date, choices, starter_id, starter_name, votes, poll_question)VALUES({$time}, {$poll_data}, {$CURUSER['id']}, {$username}, 0, {$poll_title})") or sqlerr(__FILE__, __LINE__); $mc1->delete_value('poll_data_' . $CURUSER['id']); if (false == (is_null($___mysqli_res = mysqli_insert_id($GLOBALS["___mysqli_ston"])) ? false : $___mysqli_res)) { $msg = "<h2>{$lang['poll_inp_error']}</h2>\n <a href='javascript:history.back()' title='{$lang['poll_inp_fix_it']}' style='color:green;font-weight:bold'><span class='btn' style='padding:3px;'><img style='vertical-align:middle;' src='{$INSTALLER09['pic_base_url']}/polls/p_delete.gif' alt='{$lang['poll_inp_back']}' />{$lang['poll_inp_back']}</span></a>"; } else { $msg = "<h2>{$lang['poll_inp_worked']}</h2>\n <a href='staffpanel.php?tool=polls_manager&action=polls_manager' title='{$lang['poll_inp_return']}' style='color:green;font-weight:bold'><span class='btn' style='padding:3px;'><img style='vertical-align:middle;' src='{$INSTALLER09['pic_base_url']}/polls/p_tick.gif' alt='{$lang['poll_inp_success']}' />{$lang['poll_inp_success']}</span></a>"; } echo stdhead($lang['poll_inp_stdhead']) . $msg . stdfoot(); }
function insert_new_poll() { global $INSTALLER09, $CURUSER, $mc1; if (!isset($_POST['poll_question']) or empty($_POST['poll_question'])) { stderr('USER ERROR', 'There is no title defined!'); } $poll_title = sqlesc(htmlspecialchars(strip_tags($_POST['poll_question']), ENT_QUOTES)); //get the main crux of the poll data $poll_data = makepoll(); if (!is_array($poll_data) or !count($poll_data)) { stderr('SYSTEM ERROR', 'There was no data sent'); } //all ok, serialize $poll_data = sqlesc(serialize($poll_data)); $username = sqlesc($CURUSER['username']); $time = time(); @sql_query("INSERT INTO polls (start_date, choices, starter_id, starter_name, votes, poll_question)VALUES({$time}, {$poll_data}, {$CURUSER['id']}, {$username}, 0, {$poll_title})") or sqlerr(__FILE__, __LINE__); $mc1->delete_value('poll_data_' . $CURUSER['id']); if (false == mysql_insert_id()) { $msg = "<h2>An Error Occured!</h2>\r\n <a href='javascript:history.back()' title='Go back and fix the error' style='color:green;font-weight:bold'><span class='btn' style='padding:3px;'><img style='vertical-align:middle;' src='{$INSTALLER09['pic_base_url']}/polls/p_delete.gif' alt='Go Back' />Go Back</span></a>"; } else { $msg = "<h2>Groovy, everything went hunky dory!</h2>\r\n <a href='staffpanel.php?tool=polls_manager&action=polls_manager' title='Return to Polls Manager' style='color:green;font-weight:bold'><span class='btn' style='padding:3px;'><img style='vertical-align:middle;' src='{$INSTALLER09['pic_base_url']}/polls/p_tick.gif' alt='Success' />Success</span></a>"; } echo stdhead('Poll Manager::Add New Poll') . $msg . stdfoot(); }