Antivirus
11-16-2006, 08:27 PM
I've been able to pass form variables between different scripts within admincp with no problem, however I am trying to use different branches within the same script (as I should), but this has really got me stumped and I can't see what i'm doing wrong here. If anyone can help, i'll do a little dance or something...
Data is submitted through a form with multiple events on each line and each line has a checkbox:
<input type=\"checkbox\" name=\"idsforaction[]\" value=\"" . $event['eventid'] . "\">
Here's how I am sending the eventids to the remove branch...
$strIDs = implode(",", $_POST['idsforaction']);
header("Location:scst_eventsmanager.php?" . $vbulletin->session->vars['sessionurl'] . "do=remove&eventids=".$strIDs);
Now i have echoed the location string above before calling the header function and it shows just as it should, for instance:
Location:scst_eventsmanager.php?do=remove&eventids=6,3,4,5
But when the remove branch is executed, the eventids never seem to pass. Here's my remove branch:
if ($_REQUEST['do'] == 'remove')
{
$vbulletin->input->clean->gpc('g', 'eventids', TYPE_STR);
$sql = $db->query_read("
SELECT eventid, eventdate AS date, eventdescription AS title
FROM " . TABLE_PREFIX . "scst_event
WHERE eventid IN '" . $vbulletin->GPC['eventids'] . "'
");
print_form_header('scst_eventsmanager', 'kill');
construct_hidden_code('idforaction', $vbulletin->GPC['eventids']);
print_table_header($vbphrase['confirm_deletion']);
while ($delevent = $db->fetch_array($sql))
{
$deleventdate = vbdate($vbulletin->options['dateformat'], $delevent['date'], 1);
print_description_row("
<blockquote><br />
" . construct_phrase($vbphrase["are_you_sure_want_to_delete_event_x"], $deleventdate, $delevent['title'], $delevent['eventid']) . "
<br /></blockquote>\n\t");
}
print_submit_row($vbphrase['yes'], '', 2, $vbphrase['no']);
}
Now for some reason, it doesn't seem to pass the eventids to the remove branch. If it did, I woudl see the info for each of them in the confirmation box's description rows which are printed for each event I am about to delete, correct?
If I ever get past the remove branch, my kill branch looks like this:
if ($_POST['do'] == 'kill')
{
// to delete event
$db->query_write("DELETE FROM " . TABLE_PREFIX . "scst_event
WHERE eventid = " . $vbulletin->GPC['idforaction']
);
// to delete event's associated staffnotes
$db->query_write("DELETE FROM " . TABLE_PREFIX . "scst_staffnotes
WHERE eventid = " . $vbulletin->GPC['idforaction']
);
define('CP_REDIRECT', 'scst_eventsmanager.php?do=modify');
print_stop_message('event_has_been_deleted');
}
Thanks!
Data is submitted through a form with multiple events on each line and each line has a checkbox:
<input type=\"checkbox\" name=\"idsforaction[]\" value=\"" . $event['eventid'] . "\">
Here's how I am sending the eventids to the remove branch...
$strIDs = implode(",", $_POST['idsforaction']);
header("Location:scst_eventsmanager.php?" . $vbulletin->session->vars['sessionurl'] . "do=remove&eventids=".$strIDs);
Now i have echoed the location string above before calling the header function and it shows just as it should, for instance:
Location:scst_eventsmanager.php?do=remove&eventids=6,3,4,5
But when the remove branch is executed, the eventids never seem to pass. Here's my remove branch:
if ($_REQUEST['do'] == 'remove')
{
$vbulletin->input->clean->gpc('g', 'eventids', TYPE_STR);
$sql = $db->query_read("
SELECT eventid, eventdate AS date, eventdescription AS title
FROM " . TABLE_PREFIX . "scst_event
WHERE eventid IN '" . $vbulletin->GPC['eventids'] . "'
");
print_form_header('scst_eventsmanager', 'kill');
construct_hidden_code('idforaction', $vbulletin->GPC['eventids']);
print_table_header($vbphrase['confirm_deletion']);
while ($delevent = $db->fetch_array($sql))
{
$deleventdate = vbdate($vbulletin->options['dateformat'], $delevent['date'], 1);
print_description_row("
<blockquote><br />
" . construct_phrase($vbphrase["are_you_sure_want_to_delete_event_x"], $deleventdate, $delevent['title'], $delevent['eventid']) . "
<br /></blockquote>\n\t");
}
print_submit_row($vbphrase['yes'], '', 2, $vbphrase['no']);
}
Now for some reason, it doesn't seem to pass the eventids to the remove branch. If it did, I woudl see the info for each of them in the confirmation box's description rows which are printed for each event I am about to delete, correct?
If I ever get past the remove branch, my kill branch looks like this:
if ($_POST['do'] == 'kill')
{
// to delete event
$db->query_write("DELETE FROM " . TABLE_PREFIX . "scst_event
WHERE eventid = " . $vbulletin->GPC['idforaction']
);
// to delete event's associated staffnotes
$db->query_write("DELETE FROM " . TABLE_PREFIX . "scst_staffnotes
WHERE eventid = " . $vbulletin->GPC['idforaction']
);
define('CP_REDIRECT', 'scst_eventsmanager.php?do=modify');
print_stop_message('event_has_been_deleted');
}
Thanks!