vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   conditional problem? (https://vborg.vbsupport.ru/showthread.php?t=66962)

sabret00the 07-08-2004 11:30 AM

conditional problem?
 
PHP Code:

                if ($_REQUEST['action'] == "delete")
                  {
                  if (
$bbuserinfo[usergroupid] == 6)
                      {
                   eval(
"\$delete_form = \"".fetch_template("confessions_deleteform")."\";");
  
                      if (
$POST['confirm'] == "delete")
                         {
                       if (
$bbuserinfo[usergroupid]==&& 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

HTML Code:

<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
Code:

/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

PHP Code:

if ($POST['confirm'] == "delete"

should be
PHP Code:

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

PHP Code:

    // administrative actions
     
if ($_POST['action'] == "report") {
         if (
$bbuserinfo[usergroupid] > && $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]==&& 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
HTML Code:

<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:
PHP Code:

// administrative actions

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

        if (
$bbuserinfo[usergroupid] > && $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] == && 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'));
        }
    } 

HTML Code:

<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>



All times are GMT. The time now is 08:41 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01173 seconds
  • Memory Usage 1,792KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (3)bbcode_html_printable
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete