vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   What the hell is wrong with this? (https://vborg.vbsupport.ru/showthread.php?t=46108)

Link14716 11-25-2002 08:28 PM

What the hell is wrong with this?
 
Code:

                if ($submit=="true") {
                        if (!title) {
                                show_nopermission();
                        }
                        if (!code) {
                                show_nopermission();
                        }
                        $DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,pagetext,ipaddress,site,siteid) VALUES (NULL,'$gid','".addslashes(htmlspecialchars($title))."','".addslashes($bbuserinfo[username])."','$bbuserinfo[userid]','".time()."','".addslashes($code)."','$ipaddress','2','$siteid')");
                        header ("Location: content.php?action=code&do=display&gid=$gid");
                        exit;
                }

It stops before it even hits the redirect. No errors, nothing. Just a blank page. What is wrong with it?

Xenon 11-25-2002 08:32 PM

i'd say your variable $submit would be not "true"

where do you get this var?

also title and code should be introduced with an $ ;)

Link14716 11-25-2002 08:38 PM

Code:

$siteheader
$sitemiddle1
Add Codes ($gamename)
$sitemiddle2

<form $enctype action="addcontent.php?action=code&subaction=main" name="vbform" method="post">
<input type="hidden" name="submit" value="true">
<input type="hidden" name="gid" value="$gid">

<center>Code Title:</center><br>
<input type="text" class="bginput" name="title" value="$title" size="40" maxlength="85" tabindex="1"><br><br>
<center>Code Content:</center><br>
<textarea name="code" rows="7" cols="$textareacols" wrap="virtual" tabindex="2">$message</textarea>
<br><br>        <input type="submit" class="bginput" name="submit" value="Submit Code" accesskey="s" tabindex="3">
</form>
$sitefooter

I am using that template to submit the variables in a form. Everything appears correctly.

And I missed the $ and didn't notice it due to lack of parse error. ;)

EDIT:
Code:

                if (!$submit) {
                        eval("dooutput(\"".gettemplate("site_v$v" . "_addcodes_main")."\");");
                }

That is when submit s not true. ;)

Xenon 11-25-2002 08:40 PM

ah i see your fault:

Code:

$siteheader
$sitemiddle1
Add Codes ($gamename)
$sitemiddle2

<form $enctype action="addcontent.php?action=code&subaction=main" name="vbform" method="post">
<input type="hidden" name="submit" value="true">
<input type="hidden" name="gid" value="$gid">

<center>Code Title:</center><br>
<input type="text" class="bginput" name="title" value="$title" size="40" maxlength="85" tabindex="1"><br><br>
<center>Code Content:</center><br>
<textarea name="code" rows="7" cols="$textareacols" wrap="virtual" tabindex="2">$message</textarea>
<br><br><input type="submit" class="bginput" name="submit" value="Submit Code" accesskey="s" tabindex="3">
</form>
$sitefooter

as you can see you have two variablenames called submit, and the last one counts i think, so your true will always be overwritten ;)

Link14716 11-25-2002 08:42 PM

And this is exactly why I hate HTML ;)

Link14716 11-25-2002 08:43 PM

Changed that variable to send, modified the file, BAM! It works. Thank you, Xenon! :D

Xenon 11-25-2002 08:44 PM

:)
you're welcome


All times are GMT. The time now is 10:52 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.00968 seconds
  • Memory Usage 1,728KB
  • 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
  • (4)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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