Originally Posted by MrTchMan
Here is my form.php I have that option checked. It does requre me to fill out all info but when a user doesn't it gives them the error message and when they hit back it doesn't go back. Maybe I am over looking something. THanks in advance
PHP Code:
<?php
/*======================================================================*\
|| #################################################################### ||
|| # FORM TO THREAD/ FORUM/ PM/ EMAIL - Totally CUSTOMIZABLE FORMS # ||
|| # Version 1.6 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(
'form',
'formanswers'
);
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
globalize($_POST, array(
'normalanswer1' => STR,
'answer1' => STR,
'answer2' => STR,
'answer3' => STR,
'answer4' => STR,
'answer5' => STR,
'answer6' => STR,
'answer7' => STR,
'answer8' => STR,
'answer9' => STR,
'answer10' => STR,
'answer11' => 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(2,5,6,7,9,10))) 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 = "form.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 = "1";
//FORUM TO POST NEW THREAD IN
$formforumid = "24";
//ENABLE POLL TO BE CREATED - 1 = yes, 0 = no
$formpoll = "0";
$formoption1 = "Yes";
$formoption2 = "No";
////////////////////////////////////////////////////////////////////////////////////////////////////
//ENABLE FORM TO REPLY TO EXISTING THREAD
$formreply = "0";
//EXISTING THREAD ID FOR FORM TO REPLY IN
$formreplythreadid = "12345";
//FORUM ID WHERE THE EXISTING THREAD IS IN
$formreplyforumid = "456";
////////////////////////////////////////////////////////////////////////////////////////////////////
//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 = "0";
//EMAIL ADDRESS TO EMAIL TO
$formemailaddress = "youremail@yourforums.com";
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
//REDIRECT OPTIONS:
// 0 - thank you message
// 1 - redirect to post
// 2 - redirect to thread
// 3 - redirect to forum
// 4 - redirect to editpost to upload attachments
//
// Feel free to change the thank you message if you choose option 0
////////////////////////////////////////////////////////////////////////////////////////////////////
$redirectoption = "4";
$errormessage = "Thank you for submitting this form!"; //This is the thank you message
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
//FORCE USER TO ANSWER ALL QUESTIONS - 1 = yes, 0 = no
////////////////////////////////////////////////////////////////////////////////////////////////////
$answerall = "1";
////////////////////////////////////////////////////////////////////////////////////////////////////
//TITLE OF FORM (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////
$formtitle = "Trading Post Form";
////////////////////////////////////////////////////////////////////////////////////////////////////
//PURPOSE OF FORM (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////
$formpurpose = "The purpose of this form is to create a standard way of entering items for sale in the flea market. If you item is not a cell phone please put a N/A in all fields that don't apply to you, and then post all your details in the additional details section";
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
//NORMAL INPUT BOX : QUESTION 1 (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////
$normalquestion1 = "What is the title of your thread?";
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
//QUESTION 1 (do not use quotation marks or you will get a parse error)
$question1 = "What is your asking price?";
$explain1 = "Please enter a asking price. If it is a trade specify what you are looking for";
//QUESTION 2 (do not use quotation marks or you will get a parse error)
$question2 = "What color is the item";
$explain2 = "Please enter the color of the item.";
//QUESTION 3 (do not use quotation marks or you will get a parse error)
$question3 = "What is included?";
$explain3 = "Please let people know what is included with your item";
//QUESTION 4 (do not use quotation marks or you will get a parse error)
$question4 = "What Service Provider?";
$explain4 = "List the networks this phone has been used or tested on.";
//QUESTION 5 (do not use quotation marks or you will get a parse error)
$question5 = "What is the life timer?";
$explain5 = "Please enter your life time here. For sprint phones press ##786#";
//QUESTION 6 (do not use quotation marks or you will get a parse error)
$question6 = "What is the condition of the item?";
$explain6 = "Item Condition.";
//QUESTION 7 (do not use quotation marks or you will get a parse error)
$question7 = "Do you have pictures?";
$explain7 = "If you have pictures post them in additional details box via the [img] code or click submit and add an attachment";
//QUESTION 8 (do not use quotation marks or you will get a parse error)
$question8 = "What is the location you are shipping from?";
$explain8 = "Please enter a location.";
//QUESTION 9 (do not use quotation marks or you will get a parse error)
$question9 = "What is your shipping method";
$explain9 = "Shipping terms and how will you ship. Please inlcude Price.";
//QUESTION 10 (do not use quotation marks or you will get a parse error)
$question10 = "What Payment methods do you accept?";
$explain10 = "Please list preferred payment methods";
//QUESTION 11 (do not use quotation marks or you will get a parse error)
$question11 = "How can users contact you?";
$explain11 = "Contact Information";
//////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
//LONG TEXT AREA INPUT: QUESTION 1 (do not use quotation marks or you will get a parse error)
////////////////////////////////////////////////////////////////////////////////////////////////////
$longquestion1 = "What are your additional details?.";
$longexplain1 = "Please use this area to enter more details. (i.e. Why you are selling) You can also use this space to put in any information that you could not in the above questions. Like items other than cell phones.";
////////////////////////////////////////////////////////////////////////////////////////////////
////// 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 $answer1 == '' OR $answer2 == '' OR $answer3 == '' OR $answer4 == '' OR $answer5 == '' OR $answer6 == '' OR $answer7 == '' OR $answer8 == '' OR $answer9 == '' OR $answer10 == '' OR $answer11 == '' OR $longanswer1 == '' 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();
}
}
eval('$formsend = "' . fetch_template('formanswers') . '";');
if ($formforum == "1") {
$DB_site->query("
INSERT INTO " . TABLE_PREFIX . "thread(title, lastpost, forumid, open, replycount,
postusername, postuserid, lastposter, dateline, iconid, visible, attach)
VALUES
('normalanswer1', " . TIMENOW . ", $formforumid,
1, 0, '" . addslashes($bbuserinfo['username']) . "', $bbuserinfo[userid],
'" . addslashes($bbuserinfo['username']) . "', " . TIMENOW . ", 0, 1,
0)
");
$thread['threadid'] = $DB_site->insert_id();
$DB_site->query("
INSERT INTO " . TABLE_PREFIX . "post
(threadid, title, username, userid, dateline, pagetext, allowsmilie,
showsignature, iconid, visible)
VALUES
($thread[threadid], '$normalanswer1',
'" . addslashes($bbuserinfo['username']) . "', $bbuserinfo[userid], " . TIMENOW . ",
'" . addslashes($formsend) . "', 1, 1,
0, 1)
");
$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 = '$normalanswer1',
lastthreadid = $thread[threadid]
WHERE forumid = $formforumid
");
$DB_site->query("
UPDATE " . TABLE_PREFIX . "user
SET posts = posts + 1
WHERE userid = $bbuserinfo[userid]
");
$forum[forumid] = $formforumid;
}
if ($formpoll == "1") {
$DB_site->query("INSERT INTO " . TABLE_PREFIX . "poll (question,dateline,options,votes,active,numberoptions,timeout,multiple,public) VALUES ('$normalanswer1'," . 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,visible) VALUES (NULL,'$formreplythreadid','$normalanswer1','".addslashes($bbuserinfo[username])."','$bbuserinfo[userid]','".time()."','" . addslashes($formsend) . "','1','1','0','0','1')");
$DB_site->query("UPDATE thread SET replycount = replycount + 1, lastpost = " . 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
");
$DB_site->query("
UPDATE " . TABLE_PREFIX . "user
SET posts = posts + 1
WHERE userid = $bbuserinfo[userid]
");
$forum[forumid] = $formreplyforumid;
}
if ($formpm == "1") {
$DB_site->query("INSERT INTO " . TABLE_PREFIX . "pmtext\n\t(fromuserid, fromusername, title, message, touserarray, iconid, dateline, showsignature)\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 (pmtextid, userid, messageread) VALUES ($pmtextid, $formpmid, 0)");
$DB_site->shutdown_query("UPDATE " . TABLE_PREFIX . "user SET pmtotal=pmtotal+1, pmunread=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();
}
if ($redirectoption == "4") {
$url = "editpost.php?do=editpost&$session[sessionurl]p=$post[postid]";
eval(print_standard_redirect('redirect_postthanks'));
exit();
}
eval('print_output("' . fetch_template('STANDARD_ERROR') . '");');
exit();
}
eval('print_output("' . fetch_template('form') . '");');
?>
|