vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   FORM to THREAD/ FORUM/ POLL/ PM/ EMAIL - CUSTOMIZABLE FORMS - Mod Apps, Orders, News. (https://vborg.vbsupport.ru/showthread.php?t=66082)

Spinball 11-20-2004 10:04 AM

*installed*
Very nice hack - does, with a bit of tweaking, just what I need.
I'm using it to ensure people enter all the required information in classified adverts. I'll be trying to change the target address of the 'New thread' button in certain forums to call this script.
Many thanks Mr Erwin, Sir!

Question/request for you.
How would I implement the $messagearea and $posticons variables so that the user interface for one of the fields is identical to a normal new thread?

Spinball 11-20-2004 10:27 PM

I hope you don't mind but I'd like to share how I got this working to use a form to submit the first post in new threads.
It's for our classifieds forums (3 of them) where people often dive in and break several trading rules.
I wanted to make sure they were given plenty of opportunities to read the rules before submitting their adverts.
See the attached screen grab.
Our 3 forums have forum ids of 51,62 and 99.

Firstly I used a temporary forum invisible to the public to test this out.
I followed Erwin's instructions to edit the form and formanswers templates and form.php.
The only things I needed to change in the form.txt template was to add a variable 'f' to store the forumid rather than hard code it.

HTML Code:

  <input type="hidden" value="$userid" name="userid">
  <input type="hidden" value="$f" name="f">
  <input type="hidden" value="submit" name="action">

and the tickbox code looked like this.
HTML Code:

      <tr>
        <td class="alt1" valign="top"><b>$ad_agreequestion</b></td>
        <td class="alt1" valign="top" colspan="2"><input name="ad_agree" type="checkbox" value="Confirmed"> <font class="smallfont">$ad_agreeexplain</font></td>
      </tr>

(I used the smallfont class to reduce the size of the explanation text).

Then most of the work goes in the form.php. Aside from changing it to put in my own variables etc., I had to make a few additional tweaks.

At the top I globalised the variables used in the form plus the forum id 'f'

HTML Code:

globalize($_POST, array(
'ad_title' => STR,
'ad_description' => STR,
'ad_location' => STR,
'ad_agree' => STR,
'action' => STR,
'f' => STR
));

and set the forumid to the passed variable $f instead of hard coding it.

PHP Code:

//FORUM TO POST NEW THREAD IN
$formforumid $f

and changed the form validation to insist that the checkbox be checked:

PHP Code:

if ($answerall == "1") {
    if (
$ad_title == '' OR $ad_description == '' OR $ad_location == '' OR $ad_agree <> 'Confirmed')
    {
    
$errormessage "Please complete all the information on the classified submission form and agree that you have read and abide by the trading rules.<br>Press the Back button to return to the form.";
    eval(
'print_output("' fetch_template('STANDARD_ERROR') . '");');
    exit();
    }


The last thing I did was to edit the FORUMDISPLAY template to make the 'New Thread' buttons call the form. In both places (there are 2 buttons):

PHP Code:

<!-- -------------- new thread button logic for classifieds form -----  -->
<if 
condition="$show['newthreadlink']">
<if 
condition="$foruminfo[forumid] == 51 OR $foruminfo[forumid] == 62 OR $foruminfo[forumid] == 99">
<
a href="form.php?$session[sessionurl]&amp;f=$foruminfo[forumid]">
<else />
<
a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]">
</if>
<!-- ------------ / new 
thread button logic for classifieds form -----  --> 

Note that it calls the form.php with the f= to the forumid.
And it works perfectly.

The next enhancement might be to install a separate hack which creates an [admin] bb code which hides text within it from all users except admin. And then get people to enter a phone number for security purposes which only admin can see in the posts.

Maybe Erwin will want to add my suggestions into his standard hack.

blue_chi 11-21-2004 07:47 PM

THIS IS GOOD.

Going to install it soon! ;)

defi 11-23-2004 08:16 PM

I was wondering;

1.) Is there a way to change it so the user can enter a name for the thread rather then a pre-defined one being made?

2.) Have attachments been added to the capability of this form?

neofootball 11-23-2004 08:34 PM

Nice hack! Is there a way to pm & email more than one person?

glenvw 11-26-2004 09:04 AM

I am looking for a registration process where a person:

First has to fill out a separate front-end registration process I already have. The applicant fills out name, address, phone, birthdate, etc (common demographic information) . He is presented with opt-in co-reg offers etc.

He is then automatically sent to the VBBS registration page where he/she enters a user name and password. It would be nice if the user name, birthdate, etc could be passed from the first form (not on a VBBS page) and inserted in the VBBS registration. This would make it look uniform. It is not necessary though.

My goal is first to monetize the registration process.

Restrict access to all forums unless they were registered.

However, if a person is not registered now, they are sent directly to the VBBS registration page. This process would require that they be sent to the new front end registration page.

After a member is regsitered, I would like it if they were made to log in only on the front end page where they could just log in if already registered.

I have no idea if this could be done but I am looking for a programmer that knows his stuff and can make this happen. I am posting it here because Erwin's hack was as close as I have seen.

Thank in advance.

The Markus 11-27-2004 10:36 PM

Quote:

Originally Posted by BarHopper
This sia stupid question, but where are the two templates?

If that was stupid then my question is ridiculous... :nervous:

Where do you upload these to?? I am somewhat PHP inept at the moment, but I am learning.. I can feel my brain swelling :ninja:

ChrisBaktis 12-12-2004 06:43 PM

Need some Mod Help....

I run a site that mambers trade on - I want to use this form to post a thread of what is being traded....This is what I would like to do...

Instead of the username and form title to show up as the 'Thread Title' I would like to use $normalanswer1 / $normalanswer2

For Example..I would like the title show up as 'member#1 / member#2' This way when our mods are going through the posts the title of each post is the two members names that are making the trade with an '/' in between.

Can this be done? if so how?

Also is it possible to use Bold and underline in the output when this is posted to a thread? I know I cannot use HTML because I dont allow HTML in the thread but is there any other way?

Chris

Erwin 12-12-2004 08:35 PM

Quote:

Originally Posted by ChrisBaktis
Need some Mod Help....

I run a site that mambers trade on - I want to use this form to post a thread of what is being traded....This is what I would like to do...

Instead of the username and form title to show up as the 'Thread Title' I would like to use $normalanswer1 / $normalanswer2

For Example..I would like the title show up as 'member#1 / member#2' This way when our mods are going through the posts the title of each post is the two members names that are making the trade with an '/' in between.

Can this be done? if so how?

Also is it possible to use Bold and underline in the output when this is posted to a thread? I know I cannot use HTML because I dont allow HTML in the thread but is there any other way?

Chris

1. You can change the thread title within the code - look at the code and you can work it out.

2. You can modify the form template with bbcode tags to add bold.

ChrisBaktis 12-12-2004 08:47 PM

problem is i have no idea where to change it in the form.php file....$formtitle shows up all over the place and i dont know which to replace and how I would put 2 variables with an "/" between them.

ChrisBaktis 12-12-2004 08:57 PM

figured it out!

oldford 12-13-2004 06:20 PM

I've had this great mod (thanks Erwin!) running fine for months, but I do have one problem. Every couple of weeks I get someone complaining that they get the following error:

Quote:

There seems to have been a slight problem with the Discussion Boards database.
Please try again by pressing the refresh button in your browser.

An E-Mail has been dispatched to our Technical Staff, who you can also contact if the problem persists.

We apologise for any inconvenience.
The error doesn't seem to happen very often and I can't recreate the error on my end. I do know that the problem only occurs on the forum that I used this mod on.

Any thoughts? :surprised:

TheDPQ 12-13-2004 07:07 PM

Installed
Its just so...mind bogglingly useful. THANK YOU.

Erwin 12-13-2004 09:49 PM

Quote:

Originally Posted by oldford
I've had this great mod (thanks Erwin!) running fine for months, but I do have one problem. Every couple of weeks I get someone complaining that they get the following error:



The error doesn't seem to happen very often and I can't recreate the error on my end. I do know that the problem only occurs on the forum that I used this mod on.

Any thoughts? :surprised:

What is the actual mysql error?

alqadir 12-16-2004 05:42 AM

Firstly, I would like to say I love this hack, it is really awesome and used on a daily basis at www.wetnerds.com. After using this hack for some time, I am trying to mod it so it can better fit my site. I was hoping someone can help me out for the following:
a) have an image uploading option which allows users to upload an image upto a certian size
b) If a user tries to post a topic(subject), where that topic already exists, the system does not allow the post to be posted.

thanks

sensimilla 12-16-2004 06:46 AM

looks like a great hack thanks alot!

alqadir 12-16-2004 07:10 PM

Has anyone had problems when " ' " (single quotes) are inputted by the user?

oldford 12-17-2004 03:30 PM

Quote:

Originally Posted by Erwin
What is the actual mysql error?

I don't actually get the error myself so I'm not sure. Is there a log I can find to see what the mysql error was?

j_86 12-21-2004 11:37 PM

Having problems using different form templates and form.php names.

Can someone give me a step by step to doing this? It's not working for me, i'm completeley stumped!

alkatraz 12-27-2004 06:28 AM

Quote:

a) have an image uploading option which allows users to upload an image upto a certian size
I've been watching this thread for months hoping to see the option for attachments.

As soon as it's added this hack will become invaluable to every admin who has a classifieds sections or a members _____ section (fill in the blank, with anything from car profiles to collections)

My #1 pet peeve is people posting classifieds without the required info and it's a huge waste of time for my moderators to make sure the info gets posted.


I dropped $100 bucks on the ClassifiedPost system which ended up being a nightmare for my members. Adding attachments to this hack (combined with the recently released thumbnail threadview) will make all my headaches go away!!!

I would gladly paypal you $25 bucks for your time Erwin if you can make it happen by Jan 1st. =) (I realize your time is probably worth more then that, but am hoping a small donation will give you some incentive.)

Erwin 12-28-2004 08:34 PM

Quote:

Originally Posted by alkatraz
I've been watching this thread for months hoping to see the option for attachments.

As soon as it's added this hack will become invaluable to every admin who has a classifieds sections or a members _____ section (fill in the blank, with anything from car profiles to collections)

My #1 pet peeve is people posting classifieds without the required info and it's a huge waste of time for my moderators to make sure the info gets posted. (I realize your time is probably worth more then that, but am hoping a small donation will give you some incentive)


I dropped $100 bucks on the ClassifiedPost system which ended up being a nightmare for my members. Adding attachments to this hack (combined with the recently released thumbnail threadview) will make all my headaches go away!!!

I would gladly paypal you $25 bucks for your time Erwin if you can make it happen by Jan 1st. =)

Definitely not by Jan 1st. :) I've better things to do with my time. But I will be adding this, just not in the near future. I have a million things to do for my own forums.

alkatraz 12-29-2004 06:08 AM

lol I understand, it was worth a shot ;)

Spinball 12-29-2004 07:59 AM

Hi Dr Eriwin, Sir,
do you intend to implement the attachments functionality as part of a general duplication of the other options when creating a thread?
I ask because my members are requesting the ability to subscribe to the threads at the point of submitting the form.

Abe1 12-29-2004 01:24 PM

Quote:

Originally Posted by Spinball
Hi Dr Eriwin, Sir,
do you intend to implement the attachments functionality as part of a general duplication of the other options when creating a thread?
I ask because my members are requesting the ability to subscribe to the threads at the point of submitting the form.

This is what i do. After someone clicks 'submit,' they are directed to the 'edit post' page. This gives them a chance to add attachments. Also, when they click on 'update post' is adds the words in the post to the search index.

Spinball 12-29-2004 01:37 PM

Quote:

Originally Posted by Abe1
This is what i do. After someone clicks 'submit,' they are directed to the 'edit post' page. This gives them a chance to add attachments. Also, when they click on 'update post' is adds the words in the post to the search index.

Thanks, Abe1, it's a nice solution but unfortunately not appropriate for my forum where people submitting their classified adverts are not then allowed to edit them.

mod2000 12-30-2004 10:48 PM

is there no need of updateing the searchindex table ? I see some mysql inserts but no update of the searchindex of the board.

EDIT: And my question ???? HEEELOOO

alkatraz 12-31-2004 07:28 AM

Quote:

Originally Posted by Abe1
This is what i do. After someone clicks 'submit,' they are directed to the 'edit post' page. This gives them a chance to add attachments. Also, when they click on 'update post' is adds the words in the post to the search index.

sweet! that will do the trick until attachments are added.

for anyone else that wants the code to do this,

Find
PHP Code:

if ($redirectoption == "3") {
            
$url "forumdisplay.php?$session[sessionurl]f=$forum[forumid]";
        eval(
print_standard_redirect('redirect_postthanks'));
   exit();


Add BELOW,
PHP Code:

if ($redirectoption == "4") {
            
$url "editpost.php?do=editpost&$session[sessionurl]p=$post[postid]";
            eval(
print_standard_redirect('redirect_postthanks'));
   exit();


and then use $redirectoption = "4";

alkatraz 12-31-2004 07:32 AM

SPINBALL

Thanks for your code too!!

ChrisBaktis 01-02-2005 02:58 AM

Is there a way to have this Pm'd to more then one person? I get a database error if I try to add 2 user ID's.

Chris

alqadir 01-04-2005 05:36 AM

thanks alkatraz, this hack addition works perfectly. :)

alkatraz 01-04-2005 04:25 PM

np alqadir!


When the script creates a new thread in a forum,
an error occurs if a member has posted a ' in the thread title.

I'd like to process $ad_title (the var. i've used for the title) to strip out ' and " or any characters that could cause a problem.

doing some research into it, the trim function might do it
http://ca.php.net/trim

Think this would remove ' ? How would I remove "?
trim($ad_title, " ' ");

I crossposted this in the wrong thread (oops) but Delphy suggested using this:

$ad_title = html_entities($ad_title, ENT_QUOTES)

but it creates an error when entering the script...

anyone have any suggestions?

Wifey 01-05-2005 02:16 AM

Alright, I thought I had done everything right but obviously not.

This is my form1.php file:

PHP Code:

<?php

/*======================================================================*\
|| #################################################################### ||
|| # FORM TO THREAD/ FORUM/ PM/ EMAIL - Totally CUSTOMIZABLE FORMS    # ||
|| # Version 1.5 for vBulletin 3.x.x by Dr Erwin Loh                  # ||
|| # ---------------------------------------------------------------- # ||
|| # Copyright ?2000?2004 Dr Erwin Loh. All Rights Reserved.          # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| #################################################################### ||
\*======================================================================*/

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

$globaltemplates = array(
    
'form1',
    
'formanswers'
);

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

globalize($_POST, array(
'normalanswer1' => STR,
'normalanswer2' => STR,
'normalanswer3' => STR,
'normalanswer4' => STR,
'normalanswer5' => STR,
'normalanswer6' => STR,
'radioanswer1' => STR,
'radioanswer2' => STR,
'radioanswer3' => STR,
'radioanswer4' => STR,
'answer1' => STR,
'answer2' => STR,
'answer3' => STR,
'longanswer1' => STR,
'action' => STR
));

// #######################################################################
// ######################## CUSTOMIZE VARIABLES ##########################
// #######################################################################

////////////////////////////////////////////////////////////////////////////////////////////////////
////// BEGIN CUSTOMIZATION BELOW////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//USERGROUPS ALLOWED
//You can add or remove usegroups that are ALLOWED to use this form by changing the numbers below in the array 
////////////////////////////////////////////////////////////////////////////////////////////////////

if (!in_array($bbuserinfo['usergroupid'], array(10,11,13,14,15,16,17,18,5,6,7))) print_no_permission();

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//NAME OF THIS PHP FILE AND TEMPLATES - DO THIS BIT IF YOU ARE MAKING MORE FORMS!
//You can easily make more forms by just copying this file, renaming it, and modifying the variable in
//this file. You can keep the same templates for different forms. For more customization, you can 
//use different templates, by renaming and modifying the templates.
////////////////////////////////////////////////////////////////////////////////////////////////////

// Name of this file
$phpfilename "form1.php";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//CHOOSE WHETHER YOU WANT FORM TO BE POSTED IN A NEW THREAD, NEW POLL, REPLY TO EXISITING THREAD, PMed OR EMAILED
///////////////////////////////////////////////////////////////////////////////////////////////////

//ENABLE FORM TO BE POSTED - 1 = yes, 0 = no
$formforum "0";

//FORUM TO POST NEW THREAD IN
$formforumid "181";

//ENABLE POLL TO BE CREATED - 1 = yes, 0 = no
$formpoll "1";
$formoption1 "Yes";
$formoption2 "No";

////////////////////////////////////////////////////////////////////////////////////////////////////

//ENABLE FORM TO REPLY TO EXISTING THREAD
$formreply "0";

//EXISTING THREAD ID FOR FORM TO REPLY IN
$formreplythreadid "0";

//FORUM ID WHERE THE EXISTING THREAD IS IN
$formreplyforumid "0";

////////////////////////////////////////////////////////////////////////////////////////////////////

//ENABLE FORM TO BE PMED - 1 = yes, 0 = no
$formpm "0";

//USERID TO PM TO
$formpmid "1";

////////////////////////////////////////////////////////////////////////////////////////////////////

//ENABLE FORM TO BE EMAILED - 1 = yes, 0 = no
$formemail "1";

//EMAIL ADDRESS TO EMAIL TO
$formemailaddress "admin@degrassi-boards.com";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//REDIRECT OPTIONS:
// 0 - thank you message
// 1 - redirect to post
// 2 - redirect to thread
// 3 - redirect to forum
//
// Feel free to change the thank you message if you choose option 0
////////////////////////////////////////////////////////////////////////////////////////////////////

$redirectoption "0";

$errormessage "Thank you so much for submitting this survey!  We value your opinion and hope that this can help to make D-B even better!"//This is the thank you message

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//FORCE USER TO ANSWER ALL QUESTIONS - 1 = yes, 0 = no
////////////////////////////////////////////////////////////////////////////////////////////////////

$answerall "0";

////////////////////////////////////////////////////////////////////////////////////////////////////
//TITLE OF FORM (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$formtitle "Degrassi-Boards Survey";

////////////////////////////////////////////////////////////////////////////////////////////////////
//PURPOSE OF FORM (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$formpurpose "The purpose of this survey is to get your feedback on things happening around the boards.  We value and appreciate you all and hope that you will take the time to submit this.  The answers willbe automatically posted in a hidden forum so nobody but staff will be able to see your answers.  Once the survey is over, a general post will be made with some general results.";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 1 (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion1 "What is the best thing about DB?";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 2 (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion2 "What is the worst thing about DB?";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//RADIO BOX CHOICES : QUESTION 3a (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$radioquestion1 "Do you agree with all the rules?";

// The following choices must NOT have quotation marks
$radiochoice1a "yes";
$radiochoice1b "no";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 3b (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion3 "If you answered no to 3a, which rule do you disagree with? (You may simply put the number)";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 3c (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion4 "If you disagreed with a rule, why is that particular rule one you do not think is right?";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//RADIO BOX CHOICES : QUESTION 4a (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$radioquestion2 "Which of the following would you use to describe the DB staff?";

// The following choices must NOT have quotation marks
$radiochoice2a "Excellent";
$radiochoice2b "Average";
$radiochoice2c "Poor";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 4b (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion5 Why do you feel that way?;

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//RADIO BOX CHOICES : QUESTION 5a (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$radioquestion4 "Do you feel the rules and signature guidelines are easy to understand";

$radioquestion3 "Do you feel included on the boards?";

// The following choices must NOT have quotation marks
$radiochoice3a "Always";
$radiochoice3b "Most of the time";
$radiochoice3c "Never";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 5b (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$normalquestion6 "Why do you feel that way?";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//RADIO BOX CHOICES : QUESTION 6 (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

// The following choices must NOT have quotation marks
$radiochoice4a "yes";
$radiochoice4b "no;

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//QUESTION 1 (do not use quotation marks or you will get a parse error)
$question1 = "What is your name?";
$explain1 = "Please enter your real name here.";

//QUESTION 2 (do not use quotation marks or you will get a parse error)
$question2 = "What is your email?";
$explain2 = "Please enter your real email here.";

//QUESTION 3 (do not use quotation marks or you will get a parse error)
$question3 = "What is your website?";
$explain3 = "Please enter your URL here.";

////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//LONG TEXT AREA INPUT: QUESTION 7 (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////

$longquestion1 = "Any additional comments to add?";
$longexplain1 = "For examplea bit about your experience in this area.";

////////////////////////////////////////////////////////////////////////////////////////////////
////// END OF CUSTOMIZATION ////////////////////////////////////////////////////////////////////
/////  DO NOT CHANGE BELOW UNLESS YOU KNOW WHAT YOU ARE DOING!!! ////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

// start navbar
$navbits = array(
    "
$phpfilename?$session[sessionurl]" => $formtitle
);

$navbits = construct_navbits($navbits);
eval('
$navbar = "' . fetch_template('navbar') . '";');

if (
$action=="submit") {

if (
$answerall == "1") {
    if (
$normalanswer1 == '' OR $normalanswer2 == '' OR $radioanswer1 == '' OR $normalanswer3 == '' $normalanswer4 == '' OR OR $radioanswer2 == '' OR $normalanswer5 == '' OR $radioanswer3 == '' OR $normalanswer6 == '' $radioanswer4 == '' OR $answer1 == '' OR $answer2 == '' OR $answer3 == '' OR $longanswer1 == '')
    {
    
$errormessage = "$bbuserinfo[username], you need to answer every question!";
    eval('print_output("' . fetch_template('
STANDARD_ERROR') . '");');
    exit();
    }
}

    eval('
$formsend = "' . fetch_template('formanswers') . '";');

    if (
$formforum == "1") {
                    
$DB_site->query("
                                
INSERT INTO " . TABLE_PREFIX . "thread(titlelastpostforumidopenreplycount,
                                
postusernamepostuseridlastposterdatelineiconidvisibleattach)
                                
VALUES
                                        
('".addslashes(htmlspecialchars($bbuserinfo[username]))." $formtitle'" . TIMENOW . "$formforumid,
                                         
10'" . addslashes($bbuserinfo['username']) . "'$bbuserinfo[userid],
                                         
'" . addslashes($bbuserinfo['username']) . "'" . TIMENOW . "01,
                                         
0)
                        
");
                
$thread['threadid'] = $DB_site->insert_id();
                
$DB_site->query("
                        
INSERT INTO " . TABLE_PREFIX . "post
                                
(threadidtitleusernameuseriddatelinepagetextallowsmilie,
                                 
showsignatureiconidvisible)
                        
VALUES
                                
($thread[threadid], '".addslashes(htmlspecialchars($bbuserinfo[username]))." $formtitle',
                                 
'" . addslashes($bbuserinfo['username']) . "'$bbuserinfo[userid], " . TIMENOW . ",
                                 
'" . addslashes($formsend) . "'11,
                                 
01)
                
");
                
$post['postid'] = $DB_site->insert_id();
                
$DB_site->query("
                                
UPDATE " . TABLE_PREFIX . "thread
                                SET firstpostid 
$post[postid]
                                
WHERE threadid $thread[threadid]
                        
");
                
$DB_site->query("
                                
UPDATE " . TABLE_PREFIX . "forum
                                SET replycount 
replycount +  1,
                                
threadcount threadcount 1,
                                
lastpost " . TIMENOW . ",
                                
lastposter '" . addslashes($bbuserinfo['username']) . "',
                                
lastthread '".addslashes(htmlspecialchars($bbuserinfo[username]))." $formtitle',
                                
lastthreadid $thread[threadid]
                                
WHERE forumid $formforumid
                        
");
$forum[forumid] = $formforumid;
    }

    if (
$formpoll == "1") {
              
$DB_site->query("INSERT INTO " . TABLE_PREFIX . "poll (question,dateline,options,votes,active,numberoptions,timeout,multiple,public) VALUES ('".addslashes(htmlspecialchars($bbuserinfo[username]))." $formtitle'," . TIMENOW . ",'$formoption1|||$formoption2','" . addslashes("0|||0") . "',1,2,0,0,0)");
            
$pollid = $DB_site->insert_id();
            
$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET pollid '".$pollid."' WHERE threadid '".$thread[threadid]."'");
}

    if (
$formreply == "1") {
      
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,pagetext,allowsmilie,showsignature,ipaddress,iconid,visibleVALUES (NULL,'$formreplythreadid','".addslashes(htmlspecialchars($bbuserinfo[username]))." $formtitle','".addslashes($bbuserinfo[username])."','$bbuserinfo[userid]','".time()."','" . addslashes($formsend) . "','1','1','0','0','1')");
      
$DB_site->query("UPDATE thread SET replycount replycount 1lastpost " . TIMENOW . "lastposter '".addslashes($bbuserinfo[username])."' WHERE threadid $formreplythreadid"); 
                      
$DB_site->query("
                                
UPDATE " . TABLE_PREFIX . "forum
                                SET replycount 
replycount +  1,
                                
lastpost " . TIMENOW . ",
                                
lastposter '".addslashes(htmlspecialchars($bbuserinfo[username]))."',
                                
lastthread '" . addslashes($bbuserinfo['username']) . " $formtitle',
                                
lastthreadid $formreplythreadid
                                WHERE forumid 
$formreplyforumid
                        
");
$forum[forumid] = $formreplyforumid;
    }

if (
$formpm == "1") {
$DB_site->query("INSERT INTO " . TABLE_PREFIX . "pmtext\n\t(fromuseridfromusernametitlemessagetouserarrayiconiddatelineshowsignature)\nVALUES\n\t($bbuserinfo[userid], '" . addslashes($bbuserinfo['username']) . "''".addslashes(htmlspecialchars($formtitle))."''".addslashes(htmlspecialchars($formsend))."''" . addslashes(serialize($tostring)) . "'0" . TIMENOW . "1)");
$pmtextid = $DB_site->insert_id();
$DB_site->query("INSERT INTO " . TABLE_PREFIX . "pm (pmtextiduseridmessagereadVALUES ($pmtextid$formpmid0)");
$DB_site->shutdown_query("UPDATE " . TABLE_PREFIX . "user SET pmtotal=pmtotal+1pmunread=pmunread+1 WHERE userid $formpmid");
    }

    if (
$formemail == "1") {
    vbmail(
$formemailaddress$formtitle$formsend);
    }

if (
$redirectoption == "1") {
            
$url = "showthread.php?$session[sessionurl]p=$post[postid]";
            eval(print_standard_redirect('redirect_postthanks'));
   exit();

if (
$redirectoption == "2") {
            
$url = "showthread.php?$session[sessionurl]t=$thread[threadid]";
            eval(print_standard_redirect('redirect_postthanks'));
   exit();

if (
$redirectoption == "3") {
            
$url = "forumdisplay.php?$session[sessionurl]f=$forum[forumid]";
        eval(print_standard_redirect('redirect_postthanks'));
   exit();
}
   eval('print_output("' . fetch_template('
STANDARD_ERROR') . '");');
   exit();
}
eval('print_output("' . fetch_template('
form') . '");');
?>

And this is form1 template:

Quote:

$stylevar[htmldoctype]
<html id="form" dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle] - $formtitle</title>
$headinclude
</head>
<body>
$header
$navbar

<br>

<form enctype="multipart/form-data" method="post" action="$phpfilename">
<input type="hidden" value="$userid" name="userid">
<input type="hidden" value="submit" name="action">

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat" colspan="3">
$vboptions[bbtitle] - $formtitle
</td>
</tr>
<tr>
<td class="panelsurround" align="center" colspan="3">

<table class="panel" cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
<tr>
<td align="$stylevar[left]">
<fieldset class="fieldset" style="margin:0px">
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
<tr>
<td>
$formpurpose

</td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="alt1" colspan="3">
<b>$normalquestion1</b>
</td>
</tr>
<tr>
<td class="alt2" colspan="3">
<input type="text" size="30" name="normalanswer1">
</td>
</tr>
<tr>
<td class="alt1" colspan="3">
<b>$normalquestion2</b>
</td>
</tr>
<tr>
<td class="alt2" colspan="3">
<input type="text" size="30" name="normalanswer2">
</td>
</tr>
<tr>
<td class="alt1" colspan="3">
<b>$radioquestion1</b>
</td>
</tr><tr>
<td><INPUT TYPE="radio" NAME="radioanswer1" value="$radiochoice1a"> $radiochoice1a </td>
<td><INPUT TYPE="radio" NAME="radioanswer1" value="$radiochoice1b"> $radiochoice1b </td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="alt1" colspan="3">
<b>$normalquestion3</b>
</td>
</tr>
<tr>
<td class="alt2" colspan="3">
<input type="text" size="30" name="normalanswer3">
</td>
</tr>

<tr>
<td class="alt1" colspan="3">
<b>$normalquestion4</b>
</td>
</tr>
<tr>
<td class="alt2" colspan="3">
<input type="text" size="30" name="normalanswer4">
</td>
</tr>
<tr>
<td class="alt2" colspan="3">
<b>$radioquestion2</b>
</td></tr><tr>
<td><INPUT TYPE="radio" NAME="radioanswer2" value="$radiochoice2a"> $radiochoice2a </td>
<td><INPUT TYPE="radio" NAME="radioanswer2" value="$radiochoice2b"> $radiochoice2b </td>
<td><INPUT TYPE="radio" NAME="radioanswer2" value="$radiochoice2c"> $radiochoice2c </td>
</tr>
<tr>
<td class="alt1" colspan="3">
<b>$normalquestion5</b>
</td>
</tr>
<tr>
<td class="alt2" colspan="3">
<input type="text" size="30" name="normalanswer5">
</td>
</tr>
<tr>
<td class="alt1" colspan="3">
<b>$radioquestion3</b>
</td>
</tr><tr>
<td><INPUT TYPE="radio" NAME="radioanswer1" value="$radiochoice3a"> $radiochoice1a </td>
<td><INPUT TYPE="radio" NAME="radioanswer1" value="$radiochoice3b"> $radiochoice1b </td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="alt1" colspan="3">
<b>$normalquestion6</b>
</td>
</tr>
<tr>
<td class="alt2" colspan="3">
<input type="text" size="30" name="normalanswer6">
</td>
</tr>
<td class="alt1" colspan="3">
<b>$radioquestion4</b>
</td>
</tr><tr>
<td><INPUT TYPE="radio" NAME="radioanswer3" value="$radiochoice4a"> $radiochoice3a </td>
<td><INPUT TYPE="radio" NAME="radioanswer3" value="$radiochoice4b"> $radiochoice3b </td>
</tr>
<tr>
<td class="alt2" valign="middle">
<b>Username</b>:<br>
Your Username.</td>
<td class="alt2" valign="middle" colspan="2">
<b>$bbuserinfo[username]</b></td>
</tr>
<tr>
<td class="alt1" valign="middle">
<b>$question1</b>:<br>
$explain1</td>
<td class="alt1" valign="middle" colspan="2">
<input type="text" size="30" name="answer1"></td>
</tr>
<tr>
<td class="alt2" valign="middle">
<b>$question2</b>:<br>
$explain2</td>
<td class="alt2" valign="middle" colspan="2">
<input type="text" size="30" name="answer2"></td>
</tr>
<tr>
<td class="alt1" valign="middle">
<b>$question3</b>:<br>
$explain3</td>
<td class="alt1" valign="middle" colspan="2">
<input type="text" size="30" name="answer3"></td>
</tr>
<tr>
<td class="alt2" valign="middle">
<b>$longquestion1</b><br>
$longexplain1</td>
<td class="alt2" valign="middle" colspan="2">
<textarea rows="20" cols="70" name="longanswer1"></textarea>
</td>
</tr>
<tr>
<td valign="top">
<p align="center">
<input type="submit" value="Submit" name="submit" style="font-family: Verdana; font-size: 10pt" class="button">
<input type="reset" value="Reset" name="reset" style="font-family: Verdana; font-size: 10pt" class="button">
</p></td></tr>
</table>
</td>
</tr>
</table>

</form>

$footer
</body>
</html>
And this is formanswers template:

Quote:

$formtitle
$bbuserinfo[username]

$normalquestion1
$normalanswer1

$normalquestion2
$normalanswer2

$radioquestion1
$radioanswer1

$normalquestion3
$normalanswer3

$normalquestion4
$normalanswer4

$radioquestion2
$radioanswer2

$normalquestion5
$normalanswer5

$radioquestion3
$radioanswer3

$normalquestion6
$normalanswer6

$radioquestion4
$radioanswer4

$question1
$answer1

$question2
$answer2

$question3
$answer3

-----------------------------------------------------
$longquestion1

$longanswer1

------------------------------------------------------
It all matches up, so what the heck am I doing wrong? I keep getting a blank page. No errors, just a blank page. The templates were added to my default style which rolls over to every other style I have. However when I got to http://www.degrassi-boards.com/form1.php it's a blank page.

Erwin 01-05-2005 02:39 AM

Easy.

Rename your form1 template as form. The template is meant to be called form.

Alternatively, you can do this:

In your form1.php, find:

PHP Code:

eval('print_output("' fetch_template('form') . '");'); 

Replace with:

PHP Code:

eval('print_output("' fetch_template('form1') . '");'); 

Your form1.php file is looking for the form template, which you are calling form1.

Deaths 01-05-2005 01:42 PM

Looks really good , I'll install it when I have some time ;).

[high]* Deaths installs[/high]

Erwin 01-05-2005 09:26 PM

Version 1.6 minor update - added the option to redirect to editpost to upload attachments. Good simple solution provided by abe1, posted by alkatraz - saves me from figuring out a way to hack it. ;)

alkatraz 01-05-2005 09:49 PM

Quote:

saves me from figuring out a way to hack it.
doh! I should have shut my mouth, lol
hopefully adding attachments to the form is still on your to do list

also, I think having the ability to trim characters that can cause errors with the MYSQL insert would be a huge bonus..
Quote:

$ad_title = html_entities($ad_title, ENT_QUOTES)
Does that sound like it should work? I tried it but the form gives an instant error if it's included. I'm not a coder tho and could be putting it in the wrong spot.

j_86 01-05-2005 10:00 PM

wouldn't add_slashes() work for that?

Erwin 01-06-2005 12:40 AM

Quote:

Originally Posted by JimpsEd
wouldn't add_slashes() work for that?

Yup, that would do it. I should have sanity checking in the code, but may have forgotten to add it.

alkatraz 01-06-2005 02:44 AM

Quote:

Originally Posted by Erwin
Yup, that would do it. I should have sanity checking in the code, but may have forgotten to add it.

Here's what that section of code looks like from your script (unmodified)
PHP Code:

('".addslashes(htmlspecialchars($bbuserinfo[username]))." $formtitle'" . TIMENOW . "$formforumid,
                                         
10'" . addslashes($bbuserinfo['username']) . "'$bbuserinfo[userid],
                                         
'" . addslashes($bbuserinfo['username']) . "'" . TIMENOW . "01,
                                         
0

I see ".addslashes(htmlspecialchars($bbuserinfo[username]))." has addslashes around it but $formtitle', doesn't..

I guess that's because you're predefining $formtitle within form.php whereas i've modified it so the form title is specified in an INPUT box on the form which gets submitted. (useful in my situation where i'm forcing members to submit their classified ads through this form)

alkatraz 01-06-2005 02:57 AM

interesting..

I changed it to,

".addslashes(htmlspecialchars($ad_title))."

and it no longer gives an error, but still allows the new thread to posted with the ' in it!? So it's not removing anything, it's just adding slashes to allow that character I imagine?

tried adding,
trim($ad_title, " ' ");
inside the submit part of the script to remove ' from the title, but that didn't seem to work either..


All times are GMT. The time now is 01:07 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.02344 seconds
  • Memory Usage 2,127KB
  • 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_html_printable
  • (9)bbcode_php_printable
  • (16)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete