PDA

View Full Version : conditional problem?


sabret00the
07-08-2004, 11:30 AM
if ($_REQUEST['action'] == "delete")
{
if ($bbuserinfo[usergroupid] == 6)
{
eval("\$delete_form = \"".fetch_template("confessions_deleteform")."\";");

if ($POST['confirm'] == "delete")
{
if ($bbuserinfo[usergroupid]==6 && confessionid==$confessionid)
{
$DB_site->query("
DELETE FROM confessions
WHERE confessionid = $confessionid
");

$url = "../confessions/";
eval(print_standard_redirect("confess_deletion_success"));
}
else
{
//header("Location: index.php?confessionid=$confessionid");;
eval(print_standard_error('confessions_error'));
}
}

}
}

i've got this code, this form

<form method="post" name="confess_delete" action="index.php?confessionid=$confessionid&action=report&confirm=delete" source="index.php?confessionid=$confessionid&action=report">
<input type="hidden" name="confessionid" value="$confessionid">
<input type="hidden" name="userid" value="$bbuserinfo[userid]">
<table class="tborder" cellpadding="5" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>

<td class="tcat"> are you sure you want to delete this confession</td>
</tr>
<tr>
<td valign="top" class="alt1" align="center">
<textarea name="reason" cols="50" rows="5">
please confirm deletion of confession number $confessionid

this should be the same as the number above
</textarea>
</td>
</tr>
<tr>
<td class="thead" align="center">
<input type="submit" name="confession_delete" value="Delete Confession" accesskey="s">
<input type="button" value="Cancel" onClick="history.back()">
</td>
</tr>
</table>
</form>

sends it there, however it's not working, the url of said form /confessions/index.php?confessionid=170&action=delete

but i can't see why this wouldn't work, help :nervous: :o

Xenon
07-08-2004, 12:20 PM
if ($POST['confirm'] == "delete")


should be
if ($_POST['confirm'] == "delete")


^^

sabret00the
07-08-2004, 12:58 PM
that never worked so i thought ok xhtml compliancy and moved the php to the main part of the script

// administrative actions
if ($_POST['action'] == "report") {
if ($bbuserinfo[usergroupid] > 0 && $confessionid && $action=="report" && $reason) {
$body = "Please review confession $confessionid and take
appropriate action as you see fit\n\nReason given:\n
$reason\n\n$confessionurl\n\nThank You\n$bbuserinfo[username]";

vbmail($vboptions[$webmasteremail], 'Reporting A Confession', $body,
"From: \"$bbtitle Mailer\" <$vboptions[webmasteremail]>");

$url = "../confessions/";
eval(print_standard_redirect("confess_error_shouldnotbehere"));
} else {
eval(print_standard_error('confessions_error'));
}
} elseif ($_POST['action'] == "delete") {
if ($bbuserinfo[usergroupid]==6 && confessionid==$confessionid) {
eval(print_standard_error('confessions_error'));
$DB_site->query("
DELETE FROM confessions
WHERE confessionid = $confessionid
");

$url = "../confessions/";
eval(print_standard_redirect("confess_deletion_success"));
} else {
//header("Location: index.php?confessionid=$confessionid");;
eval(print_standard_error('confessions_error'));
}
}

and updated the form accordingly
<form method="post" name="confess_delete" action="index.php" source="index.php?confessionid=$confessionid&action=report">
<input type="hidden" name="confessionid" value="$confessionid">
<input type="hidden" name="userid" value="$bbuserinfo[userid]">
<table class="tborder" cellpadding="5" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>

<td class="tcat"> are you sure you want to delete this confession</td>
</tr>
<tr>
<td valign="top" class="alt1" align="center">
<textarea name="reason" cols="50" rows="5">
please confirm deletion of confession number $confessionid

this should be the same as the number above
</textarea>
</td>
</tr>
<tr>
<td class="thead" align="center">
<input type="submit" name="confession_delete" value="Delete Confession" accesskey="s">
<input type="button" value="Cancel" onClick="history.back()">
</td>
</tr>
</table>
</form> but it still don't work :confused:

Dark_Wizard
07-08-2004, 03:03 PM
Try this:

// administrative actions

if ($_POST['do'] == "report") {
globalize($_POST, array('confessionid' => INT));

if ($bbuserinfo[usergroupid] > 0 && $confessionid && $do == "report" && $reason) {
$body = "Please review confession $confessionid and take
appropriate action as you see fit\n\nReason given:\n
$reason\n\n$confessionurl\n\nThank You\n$bbuserinfo[username]";

vbmail($vboptions[$webmasteremail], 'Reporting A Confession', $body,
"From: \"$bbtitle Mailer\" <$vboptions[webmasteremail]>");

$url = "../confessions/";
eval(print_standard_redirect("confess_error_shouldnotbehere"));
} else {
eval(print_standard_error('confessions_error'));
}
} elseif ($_POST['do'] == "delete") {
if ($bbuserinfo[usergroupid] == 6 && confessionid == $confessionid) {
eval(print_standard_error('confessions_error'));
$DB_site->query("
DELETE FROM confessions
WHERE confessionid = $confessionid
");

$url = "../confessions/";
eval(print_standard_redirect("confess_deletion_success"));
} else {
//header("Location: index.php?confessionid=$confessionid");;
eval(print_standard_error('confessions_error'));
}
}



<form action="index.php" name="confess_delete" method="post">
<input type="hidden" name="do" value="report" />
<input type="hidden" name="confessionid" value="$confessionid" />
<input type="hidden" name="userid" value="$bbuserinfo[userid]" />
<table class="tborder" cellpadding="5" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>

<td class="tcat"> are you sure you want to delete this confession</td>
</tr>
<tr>
<td valign="top" class="alt1" align="center">
<textarea name="reason" cols="50" rows="5">
please confirm deletion of confession number $confessionid

this should be the same as the number above
</textarea>
</td>
</tr>
<tr>
<td class="thead" align="center">
<input type="submit" name="confession_delete" value="Delete Confession" accesskey="s">
<input type="button" value="Cancel" onClick="history.back()">
</td>
</tr>
</table>
</form>