vb.org Archive

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

sabret00the 04-29-2004 07:34 AM

form handling
 
i thought i'd make my form a little more secure with
PHP Code:

        if (isset($source)) {
             if (
$source == '$PHP_SELF?projectid=$projectid') { 

at the top of the handler, however the else of both query's shows you an error message

and since i'm considentantly getting this error message everytime i try and do something through the form, i'm wondering what i'm doing wrong?

Xenon 04-29-2004 12:23 PM

if you use single quotes, then variables are not parsed, so you should use
PHP Code:

$source == $PHP_SELF '?projectid=' $projectid 


sabret00the 04-29-2004 12:39 PM

thanks xenon, however still can't get it to work, could you please take a look at this and tell me i'm just coding this badly or not
PHP Code:

         $projectid intval($_POST['projectid']);
         if (isset(
$rate_source)) {
             if (
$rate_source == $PHP_SELF '?projectid=' $projectid) {
                 if (
'project_rate' && $rate && $projectid != '' && $bbuserinfo[userid] > 0) {
                     
$projectid intval($_POST['projectid']);
                     
$verify $DB_site->query_first("
                         SELECT userid 
                         FROM project_rate 
                         WHERE projectid = 
$projectid AND userid = $bbuserinfo[userid]
                     "
);
                     if (
$verify) {
                         eval(
print_standard_error('error_project_novotetwice')); 
                     } else {
                        
$DB_site->query("INSERT INTO project_rate SET
                         projectid = '
$projectid',
                         userid = '
$bbuserinfo[userid]',
                         rate = '
$rate',
                         timestamp = '"
.time ()."'");
             
                         
header("Location: $PHP_SELF?s="); //takes you back to main project page
                     
}
                 } else {
                     eval(
print_standard_error('error_project_voteerror')); 
                 }
             } else {
                eval(
print_standard_error('error_project_shouldnotbehere')); 
             }
         } else {
            eval(
print_standard_error('error_project_shouldnotbehere'));
         } 


Xenon 04-29-2004 12:53 PM

well, you should start to use the vb3 coding rules, as it would make the code better readable.

but apart from that, i don't see, whats wrong right now..

btw, the second ($projectid = intval($_POST['projectid']);) is useless ;)


All times are GMT. The time now is 06:32 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.01031 seconds
  • Memory Usage 1,733KB
  • 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
  • (3)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