-
Re: custom forms - data collection
I am trying to update one of text fields of the form to be a dropdown field populated with a result of my slq. I already asked couple days ago - http://www.zen-cart.com/forum/showthread.php?t=84820), but no suggestion yet, so I thought I would ask here.. This is what I have;
Code:
<?
$query = mysql_query("SELECT products_description.products_name'
. ' FROM products_description LEFT JOIN products_to_categories ON products_description.products_id = products_to_categories.products_id'
. ' WHERE (((products_to_categories.categories_id)=13))'
. ' ORDER BY products_description.products_name" );
$result = mysql_query ($query);
?>
<label class="inputLabel" for="band_name"><?php echo 'Select a Painting: '; ?></label>
<?php echo zen_draw_pull_down_menu('band_name', $result) . ' ' . (zen_not_null(ENTRY_REQUIRED_SYMBOL) ? '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>': '');?>
<br class="clearBoth" />
obviously I am missing something/lot (I tried different things by emulating my ASP code which I can work with), but no luck. I even tried to actually code in the values (since there will be only few at any given time), but even that did not work for me. Can some please give me help?
Thanks Veronika
-
Re: custom forms - data collection
Anyone have this working on 1.3.8a?
I just installed and it loads fine but when you click send it just refreshes the page and no mail is sent.
I need to create 3 custom forms for the same site so I would appreciate any advice/ tips or help.
Thanks in advance.
-
Re: custom forms - data collection
timed out!
Scrub my last request as I got it to work.
The problem was with the T and C's acceptance at the bottom of the page was commented out.
I removed it and now it works fine.
-
Re: custom forms - data collection
Bit of an update. I have everything working great except I need to add a dropdown selection.
What is the dropdown equivalent of a checkbox?
<?php echo zen_draw_checkbox_field('option1', 'Option 1', false, 'id="checkbox"');?>
-
Re: custom forms - data collection
OK, update again!
(once I get this working I'll post the results)
I got the pull down working but can only get it to use the manufacturers as an array (taken from the advanced search):
<?php echo zen_draw_pull_down_menu('bedrooms', zen_get_manufacturers(array(array('id' => '', 'text' => TEXT_PULLDOWN))), $sData['bedrooms']); ?>
Anyone know how I can point this to use another array besides the manufacturers?
Preferably one built in the header_php.php file with this mod.
-
Re: custom forms - data collection
I'm still stuck with this one.
Put simply I can get the pull down to display but it has no content.
I tried using the pull downs in advanced search and tried to adapt them, but nothing.
Anyone?
-
Re: custom forms - data collection
Hi
I have looked at your code and although I do not have a solution for you I altered the snippet to my requirements and it does work
Mine goes like this
<label class="inputLabel" for="book_category">Category:</label>
<?php echo zen_draw_pull_down_menu('book_category03', zen_get_categories(array(array('id' => '', 'text' => CATEGORY))), $sData['bedrooms']); ?>
My Categories do show up in the Drop down box for the User to select. The only Problem I have with this currently is that when I receive the Email with the Form Date I does not show the Category NAme but ID Nr i.e. 7 or 28 etc.
Any Idea how I can fix it
Other than that the Form works great and I have adjusted it to my needs with help from this forum and also looking at the specialorders example on the freshabundance.com site.
Regards
Manfred
Jeffreys Bay
-
Re: custom forms - data collection
Getting anything already built in, categories, manufacturers for example is no problem.
Getting a custom list, so far for me, is a problem.
-
Re: custom forms - data collection
Quote:
Originally Posted by
DrByte
The contact us form consists of the following files:
This one handles the layout, including all the fields you want to collect info for.
I'd take out the "SEND_TO_TEXT" one, and set the default like you do in your regular email form.
Then everything from "ENTRY_NAME" down to "ENTRY_ENQUIRY" would get replaced with your form.
This file checks for logic, errors, etc, and if OK, sends the message off to you, by joining all the fields together into the $message variable. It reads info from the form as $_POST['variable'] names.
This contains the display-text variables to be put into your template.
Is this useful fr me to research as a way of implementing this as a module?
Thanks
Glenn
-
Re: custom forms - data collection
Hi,
I was able to successfully install the band form on 1.3.8. I've customized it to how I wanted it. I'm having two problems though, they should be easy fixes. When Zen Cart attempts to give the success message it directs the user to a page that is non existent. Should I create an EZ page and direct it there? If so how can I do that?
Also, when I receive the email. Only 3 out of the 7 fields I am using are filled in. The customer name and email both show "Not logged in".
Oh, and one more thing. I didn't notice the question about what to replace ENTRY_REQUIRED_SYMBOL with if you dont need the customer to fill out that field get answered. Anybody have any instructions on what to do?
Thanks!
-
Re: custom forms - data collection
Looks like I fixed the album and sku fields but I'm still having problem with the Name and Email. Could it be that I changed those fields to customer_name and customer_email?
-
Re: custom forms - data collection
I fixed most of the problems. I did notice that the form only actually requires you to fill in name and address, even if you have the flags on. I'll look into this later. I've been going through too much code and too many changes to worry about it now.
The one major problem I'm still having though is that the name and email are still coming in with the not logged in message instead of what the customers input.
Any suggestions?
edit: I think I see what it is, I have my customer name and customer email fields (I have no clue about proper php terms), the same as the Office Use Only Login Name and Login Email
-
Re: custom forms - data collection
UPDATE: FIXED IT! I changed what I was using to store the customer name and email from customer_ to spclorder_
Now just to figure out why it really doesn't check to see if anything is entered in the other fields.
-
Re: custom forms - data collection
1st, many thanks to Dr Byte for a great contrib. I am using the band signup form, and it has produced excellent results.
My question: Are there any files for an admin side interface? (My client would like to do their own updates, and that would make my life a bit easier too.) If not, what files would be required and perhaps I can come up with them.
-
Re: custom forms - data collection
Finally! After days of searching (and worrying about my upcoming deadline), I've found what I need. At least it seems to be what I need.
This is an excellent add-on, and I thank you profusely for it.
I did come across one small problem in ZenCart v1.3.8 (final I guess...). The class inputLabel is overridden with the default stylesheet.css in the "Classic" template.
I doubt this is a big problem, because most people make their own styles anyway, but I figure I should report it.
Again, a big THANK YOU! for this, as I am still trying to muddle my way through ZenCart's...extensive...definition system.
Mike
-
Re: custom forms - data collection
I'm sorry for the double post, I cannot see any way to edit my previous.
I am wondering, where does this form submit to? Looking at the HTML, it submits to itself, but I don't see any place that processes the information to email or insert into a database. Has anyone used this to have a band sign themselves up so they could upload their own music? My client has requested something like this, but I honestly cannot figure out Zen Cart for the life of me. I have multiple years of PHP programming under my belt, and dozens designing webpages, but this seems to be a completely new language to me...O.o
Thanks,
Mike
-
Re: custom forms - data collection
Hi I wonder if anyone can help. I have downloaded this form and added it to my site http://www.jcraftz.co.uk/index.php?m...ge=send_direct. I would however like it to be an HTTPS page because ioof the nature of the information names and addresses etc. I have tried adding the code as suggested in this thread http://www.zen-cart.com/forum/showthread.php?t=100796 which worked and ensured the form was secure. But then the form would not send because it would not validate. I removed the code
//force redirect to secure page
if($_SERVER['SERVER_PORT'] != '443') { header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); exit(); }
and the form worked again.
Can anyone help? I would rather that this form was sent securely. While I have the begging bowl out I wonder if anyone could possibly point me to a way of defaulting an item in the shopping cart to a field in this form.
Thanks in advance
Ned
-
Re: custom forms - data collection
Well I have solved the validation problem. I should have put the code to redirect on the template for the form and not the form itself. I even managed to get the form to redirect correctly after submitting by copying some code from the shopping cart page. I feel so smug now.
However, I would still like to be able to default some fields in the form so if anyone out there knows how to do that Please let me know.
-
Re: custom forms - data collection
Well folks I have followed this tread closely but have one little question on the successful completion of the form and email process how can I add a link to either a category or product. We have several products that require a lot of information before purchase and after the form is complete we need to send the customer to a hidden product or category. How and where can I accomplish this.
-
Re: custom forms - data collection
If I recall correctly, (I've not looked at this code in ages) after the zen_mail() function call, there is a zen_redirect() call. Change that call to go to the page you desire.
Or, if there is a "thank you your message has been sent" page, add your link to that thank-you text. (this requires no "programming")
-
Re: custom forms - data collection
Well it is your code so I am sure you are correct I will tinker with it a bit more.
Mel
-
Re: custom forms - data collection
thanks for this great addon! I am using the "become_dist_v1.03.zip" version.
I was wondering if there would be a way to add a "upload picture" feature and have the photo emailed as an attachment with the rest of the email.
I'm trying to hack my way through this but haven't been succesful. (not a php expert)
I've tried looking at these
http://www.html-form-guide.com/email...ttachment.html
http://www.zymic.com/tutorials/php/c...-form-with-php
and tried to come up with a frankenstein. no luck. any suggestions?
-
Re: custom forms - data collection
I need some help with fixing the formatting of this form:
http://greenleafexhibits.com/index.p...age=contact_us
I added the phone number contrib, and it seems to have worked fine, but it's formatting is messed up. Can someone tell me why it doesnt line up with the other entrys? I'd also like for it to be the same length. Once I get this resolved, I feel pretty confident I can add other fields, by duplicating the new phone entry lines in the files and changing the names.
Thanks!
-
Re: custom forms - data collection
Nevermind. I found it in stylesheet_tm.css.... there was a 4px margin defined for the text area.
-
Re: custom forms - data collection
header_php.php question(s)
I'm trying to incorporate a three page form into my zen cart store and the problems I have are how to include include files and javascript.
I'm pretty sure the .js should go into the
includes/modules/pages/myformpage/jscript/myjs.js
for includes I've tried to put them on this page:
includes/modules/pages/myformpage/header_php.php
as
Code:
include('path_to_my/include.php');
also tried a variation with the file in the 'modules' directory and use this:
Code:
require(DIR_WS_MODULES . 'include.php');
either way my custom page comes up blank
same thing happens when I try to unset session variables in the header_php.php file or the tpl_myformpage_default.php file:
Code:
unset($_SESSION['myformvar']);
can someone point me in the right direction? Where do I put these things?
-
Re: custom forms - data collection
What a gem of a find!!! Got this working perfectly..
I do have one question.. A little earlier in this thread there was a bit of discussion on making this for work with SSL.. The posted solution is not very clear.. Can anyone confirm if this for will work with SSL and/or how to make the band solution work with SSL.
I'm wondering if accessing a form created using Dr Bytes solution via an EZ Page link (with SSL enabled) would be enough to do the trick??
-
Re: custom forms - data collection
To have the form process with SSL, you'd need to alter the zen_href_link parameters (I think it's the 3rd parameter that would need to be set to 'SSL') inside the zen_draw_form function call so that when the form's action parameter is produced it will contain the SSL URL instead. This will make the form be processed over SSL, regardless whether the URL in the browser is HTTPS or not.
If you want the browser URL to contain HTTPS, then whatever links you have pointing to the page will have to be manually coded to be in HTTPS.
-
Re: custom forms - data collection
Quote:
Originally Posted by
DrByte
To have the form process with SSL, you'd need to alter the zen_href_link parameters (I think it's the 3rd parameter that would need to be set to 'SSL') inside the zen_draw_form function call so that when the form's action parameter is produced it will contain the SSL URL instead. This will make the form be processed over SSL, regardless whether the URL in the browser is HTTPS or not.
If you want the browser URL to contain HTTPS, then whatever links you have pointing to the page will have to be manually coded to be in HTTPS.
Thanks for the response. Hope you don't mind me imposing on your expertise for one more thing?? Could I ask you to grade my homework here??
Is this the correct way to make this change?
Code:
<?php echo zen_draw_form('customer_questionnaire', zen_href_link(FILENAME_CUSTOMER_QUESTIONNAIRE, 'action=send', 'SSL')); ?>
-
Re: custom forms - data collection
Without going and actually studying the code, yes, that looks like it's probably correct.
-
Re: custom forms - data collection
Quote:
Originally Posted by
DrByte
Without going and actually studying the code, yes, that looks like it's probably correct.
That's good enough for me!:smile: Just wanted to make sure that the syntax looked correct.. (I looked at the login form for a little guidance after reading you hint)
Thanks again for the responses, and the awesome contribution!!! I hope the Zen Cart team enjoys the coffee I sent..:smile:
-
Re: custom forms - data collection
-
Re: custom forms - data collection
If anyone is using the "CAPTCHA using TTF & GD" mod and wanted to add that CAPTCHA mod to the forms created from this mod here's down and dirty what I did:
In the form you created located in "includes/templates/YOUR_TEMPLATE/templates" find this:
Code:
</fieldset>
<div class="buttonRow forward"><?php echo zen_image_submit(BUTTON_IMAGE_SEND, BUTTON_SEND_ALT); ?></div>
Paste the following just above this
Code:
<?php
// BOF Captcha
if(is_object($captcha) && (!$_SESSION['customer_id'])) {
?>
<br class="clearBoth" />
<?php echo $captcha->img(); ?>
<?php echo $captcha->redraw_button(BUTTON_IMAGE_CAPTCHA_REDRAW, BUTTON_IMAGE_CAPTCHA_REDRAW_ALT); ?>
<br class="clearBoth" />
<label for="captcha"><?php echo TITLE_CAPTCHA; ?></label>
<?php echo $captcha->input_field('captcha', 'id="captcha"') . ' <span class="alert">' . TEXT_CAPTCHA . '</span>'; ?>
<br class="clearBoth" />
<?php
}
// BOF Captcha
?>
In your header_php.php located in "includes/modules/pages/YOUR_FORM" find this:
Code:
require(DIR_WS_MODULES . 'require_languages.php');
$breadcrumb->add(NAVBAR_TITLE);
Just below this add:
Code:
// BOF Captcha
if(CAPTCHA_CONTACT_US != 'false') {
require(DIR_WS_CLASSES . 'captcha.php');
$captcha = new captcha();
}
// EOF Captcha
Then find this:
Code:
if ($error == false) {
// grab some customer info if logged in
if(isset($_SESSION['customer_id'])) {
And just above it paste this:
Code:
// BOF Captcha Validation
if (is_object($captcha) && !$captcha->validateCaptchaCode()) {
$error = true;
$messageStack->add('customer_questionnaire', ERROR_CAPTCHA);
}
// EOF Captcha Validation
I think this covers everything I did.. (Hopefully I didn't overlook anything) So far my testing shows this works just perfectly..
Here's the source I used: http://www.zen-cart.com/forum/showpo...&postcount=284
This post shows how to add the CAPTCHA to the Returns Authorization form, but it was pretty to adapt the instructions here to work with this form.. Hopefully someone else will find it useful too..
-
Re: custom forms - data collection
Spoke too soon.. Gotta figure out why when I am logged in the CAPTCHA does not display.. Hmmm..
-
Re: custom forms - data collection
Got it!! I picked up the wrong code from another post in the CAPTCHA support thread..
I've made the corrections to my original post.. (in bolded red)
Quote:
Originally Posted by
DivaVocals
If anyone is using the "
CAPTCHA using TTF & GD" mod and wanted to add that CAPTCHA mod to the forms created from this mod here's down and dirty what I did:
In the form you created located in "
includes/templates/YOUR_TEMPLATE/templates" find this:
Code:
</fieldset>
<div class="buttonRow forward"><?php echo zen_image_submit(BUTTON_IMAGE_SEND, BUTTON_SEND_ALT); ?></div>
Paste the following just above this
Code:
<?php
// BOF Captcha
if(is_object($captcha)) {
?>
<br class="clearBoth" />
<?php echo $captcha->img(); ?>
<?php echo $captcha->redraw_button(BUTTON_IMAGE_CAPTCHA_REDRAW, BUTTON_IMAGE_CAPTCHA_REDRAW_ALT); ?>
<br class="clearBoth" />
<label for="captcha"><?php echo TITLE_CAPTCHA; ?></label>
<?php echo $captcha->input_field('captcha', 'id="captcha"') . ' <span class="alert">' . TEXT_CAPTCHA . '</span>'; ?>
<br class="clearBoth" />
<?php
}
// BOF Captcha
?>
In your
header_php.php located in "
includes/modules/pages/YOUR_FORM" find this:
Code:
require(DIR_WS_MODULES . 'require_languages.php');
$breadcrumb->add(NAVBAR_TITLE);
Just below this add:
Code:
// BOF Captcha
if(CAPTCHA_CONTACT_US != 'false') {
require(DIR_WS_CLASSES . 'captcha.php');
$captcha = new captcha();
}
// EOF Captcha
Then find this:
Code:
if ($error == false) {
// grab some customer info if logged in
if(isset($_SESSION['customer_id'])) {
And just above it paste this:
Code:
// BOF Captcha Validation
if (is_object($captcha) && !$captcha->validateCaptchaCode()) {
$error = true;
$messageStack->add('your_form', ERROR_CAPTCHA);
}
// EOF Captcha Validation
FYI, where I have the text "your_form", this means you should use the same name as the form you created.. In the original file from DrByte I think this was "band_signup"
I think this covers everything I did.. (Hopefully I didn't overlook anything) So far my testing shows this works just perfectly..
Here's the source I used: http://www.zen-cart.com/forum/showpo...&postcount=284
This post shows how to add the CAPTCHA to the Returns Authorization form, but it was pretty to adapt the instructions here to work with this form.. Hopefully someone else will find it useful too..
-
Re: custom forms - data collection
Quote:
Originally Posted by
DrByte
Thanks!
Hi DrByte,
I am looking for a module to conduct surveys, where the client meets a series of questions and answers can be analyzed in the admin area.
Thanks
Rolando Maldonado
www.todoenguate.com
-
Re: custom forms - data collection
That would seem to be somewhat outside the scope of this discussion.
You might try the addons area, and search for "survey" or "poll" for potential ideas.
-
Re: custom forms - data collection
Quote:
Originally Posted by
rmaldonado
I am looking for a module to conduct surveys, where the client meets a series of questions and answers can be analyzed in the admin area.
I ran across this when I was looking for an time slot calendar to put both on our ZenCart site and our blog.
It's a form generator that you could conduct polls with. You'd probably have to correlate your own data.
phpjabbers.com/contact-form/
They have a poll scripts also.
phpjabbers.com/php-poll/
-
Re: custom forms - data collection
So I need a little clarification.
I need to add a few radioboxes and some dropdowns. I have SCOURCED this forum for answers, and the closest I've come are these two threads:
http://www.zen-cart.com/forum/showpo...2&postcount=12
&
http://www.zen-cart.com/forum/showpo...34&postcount=2
The first link makes perfect sense to my non-coding brain, and would be easy for me to implement.
I couldn't get the second one to work. (the dropdown showed fine, but it was not populated) Since I am no coder, I am sorta stumped in trying to troubleshoot why I couldn't get it to work.
So here's my question. I was reading a post from DrByte (http://www.zen-cart.com/forum/showpo...93&postcount=2) that stated:
Quote:
Quote:
Originally Posted by hyperspeed9 http://www.zen-cart.com/forum/images...s/viewpost.gif
I need make the list using Zen Carts method so that I can pass whatever a custom selects to be included in the email that is sent upon submission.
Actually, you don't.
All you need to do is check the value of the $_POST['merchant_desired'] variable, since that's what's set when someone chooses something from the SELECT ... OPTION .... OPTION ... OPTION ... /SELECT list you built in HTML.
So if I understand this response correctly, I can add the following to my form:
Code:
<label class="inputLabelQuestions" for="question5">Have you had experience with premium hair?:<?php echo '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label>
<select name="question5" id="question5">
<option value="[Select One]">[Select One]</option>
<option value="Yes">Yes</option>
<option value="No">No</option>
<option value="Not sure what premium hair is">Not sure what premium hair is</option>
</select>
and as long as I configure my header_php.php file correctly, this should be okay.. Am I understanding this correctly??
Code:
if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
$contact1_firstname = zen_db_prepare_input($_POST['contact1_firstname']);
$contact1_lastname = zen_db_prepare_input($_POST['contact1_lastname']);
$contact1_phone = zen_db_prepare_input($_POST['contact1_phone']);
$contact1_email = zen_db_prepare_input($_POST['contact1_email']);
$contact2_phone = zen_db_prepare_input($_POST['contact2_phone']);
$question1 = zen_db_prepare_input($_POST['question1']);
$question2 = zen_db_prepare_input($_POST['question2']);
$question3 = zen_db_prepare_input($_POST['question3']);
$question4 = zen_db_prepare_input($_POST['question4']);
$question5 = zen_db_prepare_input($_POST['question5']);
$question6 = zen_db_prepare_input($_POST['question6']);
$question7 = zen_db_prepare_input($_POST['question7']);
$question8 = zen_db_prepare_input($_POST['question8']);
$code = zen_db_prepare_input($_POST['code']);
$comments = zen_db_prepare_input(strip_tags($_POST['comments']));
-
Re: custom forms - data collection
Based only on what you posted, yes, that appears reasonable.
-
Re: custom forms - data collection
Quote:
Originally Posted by
DrByte
Based only on what you posted, yes, that appears reasonable.
Coming from you that's good enough for me!! :smile: I was concerned that if I used HTML form code versus the Zen form functions (because I am not fully grasping how to create pulldowns and radioboxes using them..) that there would be issues with the forms.
So here's what I came up with..
My Form:
Code:
<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The zen-cart developers |
// | |
// | http://www.zen-cart.com/index.php |
// | |
// | Portions Copyright (c) 2003 osCommerce |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.zen-cart.com/license/2_0.txt. |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | [email protected] so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// $Id: tpl_band_signup_default.php,v 1.3 2007/06/07 00:00:00 DrByteZen Exp $
//
?>
<div class="centerColumn" id="customerQuestionnaireDefault">
<h1 id="customerQuestionnaireDefaultHeading"><?php echo HEADING_TITLE; ?></h1>
<?php if ($messageStack->size('customer_questionnaire') > 0) echo $messageStack->output('customer_questionnaire'); ?>
<?php
if (isset($_GET['action']) && ($_GET['action'] == 'success')) {
?>
<div class="mainContent success"><?php echo TEXT_SUCCESS; ?></div>
<div class="buttonRow"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_BACK, BUTTON_BACK_ALT) . '</a>'; ?></div>
<?php
} else {
?>
<?php echo zen_draw_form('customer_questionnaire', zen_href_link(FILENAME_CUSTOMER_QUESTIONNAIRE, 'action=send', 'SSL')); ?>
<div id="customerQuestionnaireContent" class="content">
<p>This form can be used by first time customers and/or customers that aren't sure what to buy. Submit this form and some recommendations will be forwarded to you. This is a courtesy, [[Company Name Goes Here]] will not take any responsibilty if you do not like your purchase. Thanks again for choosing [[Company Name Goes Here]].</p>
<fieldset id="customerQuestionnaire-Info">
<legend> Contact Information </legend>
<div class="alert forward"><?php echo FORM_REQUIRED_INFORMATION; ?></div>
<br class="clearBoth" />
<label class="inputLabel" for="contact1_firstname">First Name:</label>
<?php echo zen_draw_input_field('contact1_firstname', zen_output_string_protected($contact1_firstname), ' size="30" id="contact1_firstname"') . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>
<br class="clearBoth" />
<label class="inputLabel" for="contact1_lastname">Last Name:</label>
<?php echo zen_draw_input_field('contact1_lastname', zen_output_string_protected($contact1_lastname), ' size="30" id="contact1_lastname"') . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>
<br class="clearBoth" />
<label class="inputLabel" for="contact1_email">Email:</label>
<?php echo zen_draw_input_field('contact1_email', zen_output_string_protected($contact1_email), ' size="30" id="contact1_email"') . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>
<br class="clearBoth" />
<label class="inputLabel" for="contact1_phone">Phone:</label>
<?php echo zen_draw_input_field('contact1_phone', zen_output_string_protected($contact1_phone), ' size="30" id="contact1_phone"') . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>
<br class="clearBoth" />
<label class="inputLabel" for="contact2_phone">Cell Phone:</label>
<?php echo zen_draw_input_field('contact2_phone', zen_output_string_protected($contact2_phone), ' size="30" id="contact2_phone"'); ?>
</fieldset>
<br class="clearBoth" />
<fieldset id="customerQuestionnaire-Contacts">
<legend> Please answer the following questions: </legend>
<label class="inputLabelQuestions" for="question1">What do you want your hair to do?:<?php echo '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label>
<?php echo zen_draw_textarea_field('question1', 30, 4, zen_output_string_protected($question1), 'id="question1"'); ?>
<br class="clearBoth" />
<label class="inputLabelQuestions" for="question2">What state is your natural hair currently in?:<?php echo '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label>
<?php echo zen_draw_textarea_field('question2', 30, 4, zen_output_string_protected($question2), 'id="question2"'); ?>
<br class="clearBoth" />
<label class="inputLabelQuestions" for="question3">What styling options are you interested in?:<?php echo '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label>
<?php echo zen_draw_textarea_field('question3', 30, 4, zen_output_string_protected($question3), 'id="question3"'); ?>
<br class="clearBoth" />
<br />
<label class="inputLabelQuestions" for="question4">Do you prefer virgin hair?:<?php echo '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label>
<select name="question4" id="question4">
<option value="[Select One]">[Select One]</option>
<option value="Yes - I prefer ONLY virgin hair">Yes - I prefer ONLY virgin hair</option>
<option value="No - I do not like virgin hair">No - I do not like virgin hair</option>
<option value="No preference - I like both virgin and premium processed hair">I like both virgin and premium processed hair</option>
<option value="Never used virgin hair before">Never used virgin hair before</option>
</select>
<br class="clearBoth" />
<br />
<label class="inputLabelQuestions" for="question5">Have you had experience with premium hair?:<?php echo '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label>
<select name="question5" id="question5">
<option value="[Select One]">[Select One]</option>
<option value="Yes">Yes</option>
<option value="No">No</option>
<option value="Not sure what premium hair is">Not sure what premium hair is</option>
</select>
<br class="clearBoth" />
<br />
<label class="inputLabelQuestions" for="question6">What daily regime are you familiar with?:<?php echo '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label>
<?php echo zen_draw_textarea_field('question6', 30, 4, zen_output_string_protected($question6), 'id="question6"'); ?>
<br class="clearBoth" />
<label class="inputLabelQuestions" for="question7">What was your favorite hair style to date?:<?php echo '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label>
<?php echo zen_draw_textarea_field('question7', 30, 4, zen_output_string_protected($question7), 'id="question7"'); ?>
<br class="clearBoth" />
<label class="inputLabelQuestions" for="question8">What are your celebrity style inspirations?:<?php echo '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label>
<?php echo zen_draw_textarea_field('question8', 30, 4, zen_output_string_protected($question8), 'id="question8"'); ?>
<br class="clearBoth" />
<label class="inputLabel" for="comments">Other Remarks:</label>
<?php echo zen_draw_textarea_field('comments', 30, 4, zen_output_string_protected($comments), 'id="comments"'); ?>
<br class="clearBoth" />
<?php
// BOF Captcha
if(is_object($captcha)) {
?>
<?php echo $captcha->img(); ?>
<?php echo $captcha->redraw_button(BUTTON_IMAGE_CAPTCHA_REDRAW, BUTTON_IMAGE_CAPTCHA_REDRAW_ALT); ?>
<br class="clearBoth" />
<label class="inputLabel" for="captcha"><?php echo TITLE_CAPTCHA; ?></label>
<?php echo $captcha->input_field('captcha', 'id="captcha"') . ' <span class="alert">' . TEXT_CAPTCHA . '</span>'; ?>
<br class="clearBoth" />
<?php
}
// BOF Captcha
?>
</fieldset>
<div class="buttonRow forward"><?php echo zen_image_submit(BUTTON_IMAGE_SEND, BUTTON_SEND_ALT); ?></div>
<div class="buttonRow back"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_BACK, BUTTON_BACK_ALT) . '</a>'; ?></div>
<br class="clearBoth" />
</div>
</form>
<?php
}
?>
</div>
My Form Handler:
Code:
<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The zen-cart developers |
// | |
// | http://www.zen-cart.com/index.php |
// | |
// | Portions Copyright (c) 2003 osCommerce |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.zen-cart.com/license/2_0.txt. |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | [email protected] so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// $Id: header_php.php,v 1.3 2007/06/07 00:00:00 DrByteZen Exp $
//
require(DIR_WS_MODULES . 'require_languages.php');
$breadcrumb->add(NAVBAR_TITLE);
// BOF Captcha
if(CAPTCHA_CONTACT_US != 'false') {
require(DIR_WS_CLASSES . 'captcha.php');
$captcha = new captcha();
}
// EOF Captcha
$error = false;
$contact1_firstname = '';
$contact1_lastname = '';
$contact1_phone = '';
$contact1_email = '';
$contact2_phone = '';
$question1 = '';
$question2 = '';
$question3 = '';
$question4 = '';
$question5 = '';
$question6 = '';
$question7 = '';
$question8 = '';
$comments = '';
$code = '';
if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
$contact1_firstname = zen_db_prepare_input($_POST['contact1_firstname']);
$contact1_lastname = zen_db_prepare_input($_POST['contact1_lastname']);
$contact1_phone = zen_db_prepare_input($_POST['contact1_phone']);
$contact1_email = zen_db_prepare_input($_POST['contact1_email']);
$contact2_phone = zen_db_prepare_input($_POST['contact2_phone']);
$question1 = zen_db_prepare_input($_POST['question1']);
$question2 = zen_db_prepare_input($_POST['question2']);
$question3 = zen_db_prepare_input($_POST['question3']);
$question4 = zen_db_prepare_input($_POST['question4']);
$question5 = zen_db_prepare_input($_POST['question5']);
$question6 = zen_db_prepare_input($_POST['question6']);
$question7 = zen_db_prepare_input($_POST['question7']);
$question8 = zen_db_prepare_input($_POST['question8']);
$code = zen_db_prepare_input($_POST['code']);
$comments = zen_db_prepare_input(strip_tags($_POST['comments']));
// BOF Error messages
if (!zen_validate_email($contact1_email)) {
$error = true;
$messageStack->add('customer_questionnaire', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
}
if (!zen_not_null($contact1_firstname)) {
$error = true;
$messageStack->add('customer_questionnaire', 'Please fill in your First Name');
}
if (!zen_not_null($contact1_lastname)) {
$error = true;
$messageStack->add('customer_questionnaire', 'Please fill in your Last Name');
}
if (!zen_not_null($contact1_phone)) {
$error = true;
$messageStack->add('customer_questionnaire', 'Please fill in your phone number');
}
if (!zen_not_null($question1)) {
$error = true;
$messageStack->add('customer_questionnaire', '<strong>What do you want your hair to do?:</strong> In order for us to assist you, please provide us as much information as possible. If a question does not apply to you, please enter "Not applicable"');
}
if (!zen_not_null($question2)) {
$error = true;
$messageStack->add('customer_questionnaire', '<strong>What state is your natural hair currently in?:</strong> In order for us to assist you, please provide us as much information as possible. If a question does not apply to you, please enter "Not applicable"');
}
if (!zen_not_null($question3)) {
$error = true;
$messageStack->add('customer_questionnaire', '<strong>What styling options are you interested in?:</strong> In order for us to assist you, please provide us as much information as possible. If a question does not apply to you, please enter "Not applicable"');
}
if (!zen_not_null($question6)) {
$error = true;
$messageStack->add('customer_questionnaire', '<strong>What daily regime are you familiar with?:</strong> In order for us to assist you, please provide us as much information as possible. If a question does not apply to you, please enter "Not applicable"');
}
if (!zen_not_null($question7)) {
$error = true;
$messageStack->add('customer_questionnaire', '<strong>What was your favorite hair style to date?:</strong> In order for us to assist you, please provide us as much information as possible. If a question does not apply to you, please enter "Not applicable"');
}
if (!zen_not_null($question8)) {
$error = true;
$messageStack->add('customer_questionnaire', '<strong>What are your celebrity style inspirations?:</strong> In order for us to assist you, please provide us as much information as possible. If a question does not apply to you, please enter "Not applicable"');
}
/*
if (!zen_not_null($code)) {
$error = true;
$messageStack->add('customer_questionnaire', 'Please enter validation code');
}
if (!zen_not_null($contact2_phone)) {
$error = true;
$messageStack->add('customer_questionnaire', 'Please fill in the contact2_phone');
}
if (!zen_not_null($question4)) {
$error = true;
$messageStack->add('customer_questionnaire', 'Please fill in the question4');
}
if (!zen_not_null($question5)) {
$error = true;
$messageStack->add('customer_questionnaire', 'Please fill in the question5');
}
if (!zen_not_null($comments)) {
$error = true;
$messageStack->add('customer_questionnaire', 'Please fill in the comments');
}
*/
// EOF Error messages
//BOF Captcha
if (is_object($captcha) && !$captcha->validateCaptchaCode()) {
$error = true;
$messageStack->add('customer_questionnaire', ERROR_CAPTCHA);
}
//EOF Captcha
if ($error == false) {
// grab some customer info if logged in
if(isset($_SESSION['customer_id'])) {
$check_customer = $db->Execute("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");
$customer_email = $check_customer->fields['customers_email_address'];
$customer_name = $check_customer->fields['customers_firstname'] . ' ' . $check_customer->fields['customers_lastname'];
} else {
$customer_email = 'Not logged in';
$customer_name = 'Not logged in';
}
//assemble the email contents:
$email_text = 'Customer Questionnaire' . "\n" .
'------------------------------------------------------' . "\n" .
'First Name:' . "\t" . $contact1_firstname . "\n" .
'Last Name:' . "\t" . $contact1_lastname . "\n" .
'Email:' . "\t" . $contact1_email . "\n" .
'Phone:' . "\t" . $contact1_phone . "\n" .
'Cell Phone:' . "\t" . $contact2_phone . "\n" .
'------------------------------------------------------' . "\n" .
'What do you want your hair to do?:' . "\n" . $question1 . "\n\n" .
'What state is your natural hair currently in?:' . "\n" . $question2 . "\n\n" .
'What styling options are you interested in?:' . "\n" . $question3 . "\n\n" .
'Do you prefer virgin hair?:' . "\t" . $question4 . "\n\n" .
'Have you had experience with Premium hair?:' . "\t" . $question5 . "\n\n" .
'What daily regime are you familiar with?:' . "\n" . $question6 . "\n\n" .
'What was your favorite hair style to date?:' . "\n" . $question7 . "\n\n" .
'What are your celebrity style inspirations?:' . "\n" . $question8 . "\n\n" .
'Other Remarks:' . "\n" . $comments . "\n\n" .
'------------------------------------------------------' . "\n" .
OFFICE_USE . "\t" . "\n" .
OFFICE_LOGIN_NAME . "\t" . $customer_name . "\n" .
OFFICE_LOGIN_EMAIL . "\t" . $customer_email . "\n" .
OFFICE_IP_ADDRESS . "\t" . $_SERVER['REMOTE_ADDR'] . "\n" .
OFFICE_HOST_ADDRESS . "\t" . gethostbyaddr($_SERVER['REMOTE_ADDR']) . "\n" .
OFFICE_DATE_TIME . "\t" . date("D M j Y G:i:s T") . "\n" .
'------------------------------------------------------' . "\n\n" .
$email_text = zen_output_string_protected($email_text);
$email_html = nl2br("\n" . $email_text);
//send the email
zen_mail(STORE_NAME, SEND_TO_ADDRESS, EMAIL_SUBJECT, $email_text, $contact1_firstname . ' ' . $contact1_lastname, $contact1_email, array('EMAIL_MESSAGE_HTML' => $email_html), 'customer_questionnaire');
zen_redirect(zen_href_link(FILENAME_CUSTOMER_QUESTIONNAIRE, 'action=success'));
} //endif $error=false
} // endif action
// default email and name if customer is logged in
if(isset($_SESSION['customer_id'])) {
$check_customer = $db->Execute("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . $_SESSION['customer_id'] . "'");
if ($contact1_email == '') $contact1_email = $check_customer->fields['customers_email_address'];
if ($contact1_firstname == '') $contact1_firstname = $check_customer->fields['customers_firstname'];
if ($contact1_lastname == '') $contact1_lastname = $check_customer->fields['customers_lastname'];
}
?>
-
Re: custom forms - data collection
Well I may have been confused by the array section of this code, but I understood enough of this post to figure out how to adapt the validation portion of this code for my own form's dropdowns..
PHP Code:
// do you want to set a default selection? if not, use '0':
$default_pulldown_selection = '2';
//For validation, you're looking for the contents of the $_POST['my_pulldown_menu'] variable
// this is only set after "submit" is clicked.
$pulldown_selected_item = (isset($_POST['my_pulldown_menu'])) ? $_POST['my_pulldown_menu'] : $default_pulldown_selection ;
//build an array of entries to be displayed on the template:
$pulldown_contents[] = array('id'=>'0', 'text'=>'Please Select');
$pulldown_contents[] = array('id'=>'1', 'text'=>'Choice Number 1');
$pulldown_contents[] = array('id'=>'2', 'text'=>'Choice Number 2');
$pulldown_contents[] = array('id'=>'3', 'text'=>'Choice Number 3');
$pulldown_contents[] = array('id'=>'4', 'text'=>'Choice Number 4');
$pulldown_contents[] = array('id'=>'5', 'text'=>'Choice Number 5');
// you could add some validation here.
if ($pulldown_selected_item==0) {
$messageStack->add_session('header','Please select an option from the pulldown menu','error');
}
From this I added the following to my own form handler:
Code:
if ($question4==0) {
$error = true;
$messageStack->add('customer_questionnaire','Do you prefer virgin hair?: Please select an option from the pulldown menu');
}
if ($question5==0) {
$error = true;
$messageStack->add('customer_questionnaire','Have you had experience with premium hair?: Please select an option from the pulldown menu');
}
I've seen the question on how to add dropdowns in this thread a bit.. So I wanted to share what I did in case it is of use to someone else.
Plus I also wanted to share the rest of the code posted here because someone with REAL coding skills might be able to use this information the way it's meant to be used.. :laugh:
-
Re: custom forms - data collection
Hey I just downloaded the mode, and I have been trying to figure out what went wrong. Basically all I needed was the name, Email, mailing address, city, zip code and order description. Anyways, I have went thru the tpl_Band_signup_default,php file and removed all the code that gathered information I didnt need. Well, then for my page (Local Orders) using EZ pages I have set up "index.php?main_page=band_signup"
Well the form shows up on that page, when I fill it up though it shos me whole bunch of errors about the required fields I have st up. Bascially why does it still follow those fields if i deleted them and how can I fix this problem?
Also, why this band mode doesnt show up in "define pages"??
:frusty:
thanks!
here is the link:
http://www.stephenmendenhall.com/del...ge=band_signup
PS O also dont need terms and conditions..
-
Re: custom forms - data collection
Quote:
Originally Posted by
Orange Wacko
Hey I just downloaded the mode, and I have been trying to figure out what went wrong. Basically all I needed was the name, Email, mailing address, city, zip code and order description. Anyways, I have went thru the tpl_Band_signup_default,php file and removed all the code that gathered information I didnt need. Well, then for my page (Local Orders) using EZ pages I have set up "index.php?main_page=band_signup"
Well the form shows up on that page, when I fill it up though it shos me whole bunch of errors about the required fields I have st up. Bascially why does it still follow those fields if i deleted them and how can I fix this problem?
Also, why this band mode doesnt show up in "define pages"??
:frusty:
thanks!
here is the link:
http://www.stephenmendenhall.com/del...ge=band_signup
PS O also dont need terms and conditions..
You removed the fields form the form, but failed to remove corresponding validation entries from the form handler script.. (hence the errors)
-
Re: custom forms - data collection
Okay I figured out that i need to look at header_php.php and try to find whatever fields I have removed. But my other question is how is it possible to actually add content to the band form? You know I though that it was possible with Define Pages from admin, but my panel doesn't show define band_signup.
All i want is to put some description and few pictures that will go with this form, and obviously make it work))
thanks
-
HELP PLZ!!! on the last PART
Okay :shocking: I am on red DEADline .. ehh Please help me with the last part, prolly (I hope the easiest)-customization..
I got the form working! The link below. All I need now is to be able to add additional content to the form page. I want to know what I have to do to use the Define Pages feature. Because I DO NOT see my band_signup mod anywhere in admin, it doesnt show up.. I just want to put a short guides on how to fill my form and put 3 screenshots of the Local Orders deals. :wacko:
I thought my admin would recognize this additional mode and see it in the Define Pages Editor, i guess not?
Appreciate any help
http://www.stephenmendenhall.com/del...ge=band_signup
:blink:
-
Re: HELP PLZ!!! on the last PART
Quote:
Originally Posted by
Orange Wacko
Okay :shocking: I am on red DEADline .. ehh Please help me with the last part, prolly (I hope the easiest)-customization..
I got the form working! The link below. All I need now is to be able to add additional content to the form page. I want to know what I have to do to use the Define Pages feature. Because I DO NOT see my band_signup mod anywhere in admin, it doesnt show up.. I just want to put a short guides on how to fill my form and put 3 screenshots of the Local Orders deals. :wacko:
I thought my admin would recognize this additional mode and see it in the Define Pages Editor, i guess not?
Appreciate any help
http://www.stephenmendenhall.com/del...ge=band_signup
:blink:
Add the content you want to the form you created.. Also, you might consider changing the name of the form to something other than band_signup (since it is not in fact a band signup form..)
-
Re: HELP PLZ!!! on the last PART
Hello All
I used the "specialorder" template together with the suggested CAPTCHA code and built a stunning form, but alas, it wouldn't work, not even getting to the breadcrumb!. After hours of painstaking work, I found the error to be in the CAPTCHA code at the beginning of header_php - the code suggested in this post to use is:
Quote:
Just after: ["require(DIR_WS_MODULES . 'require_languages.php');"
$breadcrumb->add(NAVBAR_TITLE);]
// BOF Captcha
if(CAPTCHA_CONTACT_US != 'false') {
require(DIR_WS_CLASSES . 'captcha.php');
$captcha = new captcha();
}
// EOF Captcha
When I comment this whole piece out, my form works like a dream. Anyone have any idea what's wrong with the CAPTCHA code?
Cheers
Cliff
-
Re: HELP PLZ!!! on the last PART
Quote:
Originally Posted by
cliffvt
Hello All
I used the "specialorder" template together with the suggested CAPTCHA code and built a stunning form, but alas, it wouldn't work, not even getting to the breadcrumb!. After hours of painstaking work, I found the error to be in the CAPTCHA code at the beginning of header_php - the code suggested in this post to use is:
When I comment this whole piece out, my form works like a dream. Anyone have any idea what's wrong with the CAPTCHA code?
Cheers
Cliff
Not trying to be a smart a$$, but you should clarify what you mean by "it wouldn't work". What didn't work?? the whole form?? just the CAPTCHA?? Both??
That said the only thing that stands out for me in your post is this (highlighted in red):
Quote:
Just after: ["require(DIR_WS_MODULES . 'require_languages.php');"
$breadcrumb->add(NAVBAR_TITLE);]
// BOF Captcha
if(CAPTCHA_CONTACT_US != 'false') {
require(DIR_WS_CLASSES . 'captcha.php');
$captcha = new captcha();
}
// EOF Captcha
If the characters I highlighted are in your header_php.php code, then that is DEFINITELY an issue..
Here's the code from in my original post. Those lines in your header_php.php should look like this:
Code:
require(DIR_WS_MODULES . 'require_languages.php');
$breadcrumb->add(NAVBAR_TITLE);
Hope that helps..
-
Re: HELP PLZ!!! on the last PART
Sorry, I should learn to express myself properly!
What I meant is that the form fails to load completely - I just get presented with a completely blank screen, and even when I select "View Source" from my browser, it's completely blank. As soon as I comment out the Captcha script, the form loads and validates fine upon submission.
The "[" brackets in my post was just to indicate where I pasted the captcha code after. The actual code in the PHP is correct.
However, since my post I've realised that I don't have any captcha installed - I just assumed that it was part of the standard Zencart install. I have now downloaded "captcha_using_ttf_gd_2-9.zip" and am in the process of installing this. I suspect that this may fix the problem. Will let you know if it doesn't.
Thanks for responding though - much appreciated.
Cliff
-
Re: custom forms - data collection
Quote:
Originally Posted by
cliffvt
Sorry, I should learn to express myself properly!
What I meant is that the form fails to load completely - I just get presented with a completely blank screen, and even when I select "View Source" from my browser, it's completely blank. As soon as I comment out the Captcha script, the form loads and validates fine upon submission.
The "[" brackets in my post was just to indicate where I pasted the captcha code after. The actual code in the PHP is correct.
However, since my post I've realised that I don't have any captcha installed - I just assumed that it was part of the standard Zencart install. I have now downloaded "captcha_using_ttf_gd_2-9.zip" and am in the process of installing this. I suspect that this may fix the problem. Will let you know if it doesn't.
Thanks for responding though - much appreciated.
Cliff
I should learn to express myself too..:laugh: It never ocurred to me to ask if you had the CAPTCHA add-on installed.. (duh!) :laugh::laugh:
I believe in my post on how to add the CAPTCHA code I included a linkto the add-on too, but lemme go look.. I may need to re-post and clarify things a bit..
As soon as you install the CAPTCHA add-on, life should be good for you again!:smile: Would love to see the final result!
-
Re: custom forms - data collection
Diva, on an aside matter, do you have any idea where I can find some code for allowing the "manufacturer" in this instance to also upload a file together with the form? I think the one I found in the forum only works with attributes on the product selection screens...
Thanks a lot
Cliff
-
Re: custom forms - data collection
Quote:
Originally Posted by
cliffvt
Diva, on an aside matter, do you have any idea where I can find some code for allowing the "manufacturer" in this instance to also upload a file together with the form? I think the one I found in the forum only works with attributes on the product selection screens...
Thanks a lot
Cliff
I did a half a$$ed search for something like that a while back and had no luck..:laugh:
My suggestion is to investigate the commercial section here or Rent-a-Coders.. (I've had good success with both) I am working with a coder now on two custom forms.. I had to have these created because of the somehwhat complex validation in both forms.. (which was beyond my skillset to create even using the band_signup zipfile as a template)
-
Re: custom forms - data collection
Diva hope you're good today!! Yes, you guessed it, today I am struggling with "pull_down menus" - implemented this suggested code, but on the form it displays a blank drop-down menu. If I leave all fields blank and then press "Submit" , as expected, it brings up errors for all the other fields, NOT the drop-down one, but viola!, the pulldown field is magically populated. Any ideas on what I am doing wrong here, seeing that you've mastered it?
here is my code:
HEADER_PHP:
Quote:
// Pulldown to select a country
// Set default selection:
$default_pulldown_selection = '0';
//For validation, you're looking for the contents of the $_POST['choir_country'] variable
// this is only set after "submit" is clicked.
$pulldown_selected_item = (isset($_POST['choir_country'])) ? $_POST['choir_country'] : $default_pulldown_selection ;
//build an array of entries to be displayed on the template for field 'choir_country':
$pulldown_contents[] = array('id'=>'0', 'text'=>'Please Select');
$pulldown_contents[] = array('id'=>'1', 'text'=>'England');
$pulldown_contents[] = array('id'=>'2', 'text'=>'Wales');
$pulldown_contents[] = array('id'=>'3', 'text'=>'Scotland');
$pulldown_contents[] = array('id'=>'4', 'text'=>'Northern Ireland');
// Validation for the 'choir_country' selected field here.
if ($pulldown_selected_item==0) {
$messageStack->add_session('header','You must select a country, please','error');
}
TEMPLATE:
Quote:
<label class="inputLabel" for="choir_country">Which country are you in?:</label>
<?php echo zen_draw_pull_down_menu('choir_country', $pulldown_contents, $pulldown_selected_item); ?>
<br class="clearBoth" />
Any ideas at all?
Cheers
Cliff
-
Re: custom forms - data collection
I figured out that the pulldown field contents are only generated AFTER the submit button is pressed. Any ideas how it could be generated BEFORE the submit button is pressed, i.e. on first display of the form?
Thanks
Cliff
-
Re: custom forms - data collection
All
Please pardon my stupidity. I have figured it out now and its sorted. :) It's all about WHERE I place the code for this - it should be placed BEFORE the "if (isset($_GET['action']) && ($_GET['action'] == 'send'))" line in the form handler file to work propely. I placed it after that. duh!!
Hope this helps other newbies too!
Cheers
Cliff
-
Re: custom forms - data collection
Good Morning Cliff..
:laugh::laugh:I have had a good laugh reading your dropdown field evolution..:laugh::laugh:
All I had mastered was the dropdown field validation so that the "Select One" value errored out if selected.. It looks like you figured out how to get the dropdown field to populate with the array from the header_php file.. (that was the part that STUMPED me..):clap::clap:
-
Re: custom forms - data collection
Hello
Drbyte
thank you very much for the module:
http://www.zen-cart.com/forum/showpo...2&postcount=72
It was very useful
I added many pages using it and it works, but sudenly after the form is sent I have a blank white page, I have no clue why??
my page is:
http://jeshop.ma/index.php?main_page=band_signup
after i send i get white page:
http://jeshop.ma/index.php?main_page...up&action=send
Your help is very apprciated
-
Re: custom forms - data collection
Quote:
Originally Posted by
joudesign
...I have a blank white page...
FAQ on troubleshooting blank pages: https://www.zen-cart.com/tutorials/index.php?article=82
-
Re: custom forms - data collection
Thank you drByte
I tried that but no clue
I re - installed a new band-signup files and I get the blank page
when i show the errors, when i press send button, I get:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/jeshop/public_html/includes/local/configure.php:1) in /home/jeshop/public_html/includes/functions/sessions.php on line 108
Notice: Constant OFFICE_IP_TO_HOST_ADDRESS already defined in /home/jeshop/public_html/includes/languages/french/email_extras.php on line 56
Notice: Constant OTHER_IMAGE_ already defined in /home/jeshop/public_html/includes/languages/french/other_images_names.php on line 35
Notice: Constant OTHER_IMAGE_ already defined in /home/jeshop/public_html/includes/languages/french/other_images_names.php on line 36
Notice: Constant OTHER_IMAGE_ already defined in /home/jeshop/public_html/includes/languages/french/other_images_names.php on line 37
Notice: Constant OTHER_IMAGE_ already defined in /home/jeshop/public_html/includes/languages/french/other_images_names.php on line 38
Notice: Constant BUTTON_IMAGE_GOTO_PROD_DETAILS already defined in /home/jeshop/public_html/includes/languages/french/other_images_names.php on line 44
Notice: Constant BUTTON_GOTO_PROD_DETAILS_ALT already defined in /home/jeshop/public_html/includes/languages/french/other_images_names.php on line 68
Warning: Cannot modify header information - headers already sent by (output started at /home/jeshop/public_html/includes/local/configure.php:1) in /home/jeshop/public_html/includes/init_includes/init_templates.php on line 78
Notice: Constant HEADING_TITLE already defined in /home/jeshop/public_html/includes/languages/french/band_signup.php on line 23
Notice: Undefined variable: email_text in /home/jeshop/public_html/includes/modules/pages/band_signup/header_php.php on line 194
Notice: Undefined index: EMAIL_TO_NAME in /home/jeshop/public_html/includes/functions/functions_email.php on line 83
Notice: Undefined index: EMAIL_TO_ADDRESS in /home/jeshop/public_html/includes/functions/functions_email.php on line 84
Notice: Undefined index: EMAIL_SUBJECT in /home/jeshop/public_html/includes/functions/functions_email.php on line 85
Notice: Undefined index: EMAIL_FROM_NAME in /home/jeshop/public_html/includes/functions/functions_email.php on line 86
Notice: Undefined index: EMAIL_FROM_ADDRESS in /home/jeshop/public_html/includes/functions/functions_email.php on line 87
Notice: Undefined variable: email_reply_to_address in /home/jeshop/public_html/includes/functions/functions_email.php on line 219
Notice: Undefined variable: email_reply_to_name in /home/jeshop/public_html/includes/functions/functions_email.php on line 220
Warning: Cannot modify header information - headers already sent by (output started at /home/jeshop/public_html/includes/local/configure.php:1) in /home/jeshop/public_html/includes/functions/functions_general.php on line 44
---------
Your help is appreciated , it was working and I have no clue what caused this
-
Re: custom forms - data collection
-
Re: custom forms - data collection
I have yet to upload my store to a server, hence cannot test any emails, but am seeking insight on the following:
That the person that completes the form also gets a copy of the form via email, but without any admin (OFFICE?) stuff, so that the person can reply to the email with file attachments or other correspondence...
In includes\modules\pages\my_page\header_php.php, after the line:
zen_mail(STORE_NAME, SEND_TO_ADDRESS, EMAIL_SUBJECT, $email_text, $email . ' ' . $lastname, $firstname, array('EMAIL_MESSAGE_HTML' => $email_html), 'my_page');
I propose to insert something like:
zen_mail($person_name, $person_email, $email_subject, $email_textX, SEND_TO_DEPT_ADDRESS . ' ' . STORE_DEPT_NAME, array('EMAIL_MESSAGE_HTML' => $email_html), 'my_page');
but with the following manipulations:
$person_name = $namefirst . ' ' . $namelast;
$person_email = $email
$email_subject = $work_id . ' ' . $work_title (where work_id and $work_title are each limited/truncated to 32 chars max, thus 64 chars total)
$email_textX = form input (My Page Data Submission) less any admin (OFFICE?) stuff
SEND_TO_DEPT_ADDRESS = as defined in includes\languages\english\my_page.php
STORE_DEPT_NAME = as defined in includes\languages\english\my_page.php
However, I have yet to work out what the last parts of the line do ie:
array('EMAIL_MESSAGE_HTML' => $email_html) (I only want to send and receive plain text, no html, emails)
'my_page'
Nor these lines located just above the proposed insertion
$email_text = zen_output_string_protected($email_text);
$email_html = nl2br("\n" . $email_text);
Thanks in advance.
-
Re: custom forms - data collection
Quote:
Originally Posted by
dw08gm
I have yet to upload my store to a server, hence cannot test any emails, but am seeking insight on the following:
That the person that completes the form also gets a copy of the form via email, but without any admin (OFFICE?) stuff, so that the person can reply to the email with file attachments or other correspondence...
In includes\modules\pages\my_page\header_php.php, after the line:
zen_mail(STORE_NAME, SEND_TO_ADDRESS, EMAIL_SUBJECT, $email_text, $email . ' ' . $lastname, $firstname, array('EMAIL_MESSAGE_HTML' => $email_html), 'my_page');
I propose to insert something like:
zen_mail($person_name, $person_email, $email_subject, $email_textX, SEND_TO_DEPT_ADDRESS . ' ' . STORE_DEPT_NAME, array('EMAIL_MESSAGE_HTML' => $email_html), 'my_page');
but with the following manipulations:
$person_name = $namefirst . ' ' . $namelast;
$person_email = $email
$email_subject = $work_id . ' ' . $work_title (where work_id and $work_title are each limited/truncated to 32 chars max, thus 64 chars total)
$email_textX = form input (My Page Data Submission) less any admin (OFFICE?) stuff
SEND_TO_DEPT_ADDRESS = as defined in includes\languages\english\my_page.php
STORE_DEPT_NAME = as defined in includes\languages\english\my_page.php
However, I have yet to work out what the last parts of the line do ie:
array('EMAIL_MESSAGE_HTML' => $email_html) (I only want to send and receive plain text, no html, emails)
'my_page'
Nor these lines located just above the proposed insertion
$email_text = zen_output_string_protected($email_text);
$email_html = nl2br("\n" . $email_text);
Thanks in advance.
Hi there. Are you still wanting to receive HTML email from your form?
Here's a pretty good explanation of the zen_mail() function: showpost.php?p=364047&postcount=6
DrByte says the last three parameters are optional. ($block [the array for html email], $module [in your case it looks to be 'my_page'], and $attachments_list [which it doesn't look like you're using].)
I personally would keep the line $email_text = zen_output_string_protected($email_text); but you can nix the other if you're sending plain text.
-
Re: custom forms - data collection
Quote:
Originally Posted by
mmand
Hi there. Are you still wanting to receive HTML email from your form?
In this instance, the initial thought was to receive just a pre-ordained list of labels/input in plain text, but not to do away with HTML emails altogether, as might be desireable for Newsletters and other correspondance. As such, the form primarily serves to guarantee a checklist of required info.
I appreciate the link, which I am currently viewing with other material.
The issues of how to code the sending of the email and excluding the admin (OFFICE) stuff remain to sorted.
-
Re: custom forms - data collection
I have created a supplier registration form based on this mod, where the only remaining problem is getting the Country to display as its Name rather than its Number (eg "Australia" rather than "13") after selection from the Country dropdown menu.
Rather than post the entire files, references to Country are as follows:
includes/modules/pages/supplier_registration/header_php.php
Line 33
$country = '';
After if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
Line 61
$country = zen_db_prepare_input($_POST['zone_country_id']);
After // BOF Error Messages
Line 111
if (!zen_not_null($country)) {
$error = true;
$messageStack->add('supplier_registration', 'Please select your country');
}
After //assemble the email contents:
Line 203
'country:' . "\t" . $country . "\n" .
includes/templates/your_template/tpl_supplier_registration_default.php
After <fieldset>
Line 76
<label class="inputLabel" for="country"><?php echo ENTRY_COUNTRY; ?></label>
<?php echo zen_get_country_list('zone_country_id', $selected_country, 'id="country" ') . (zen_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="alert">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?>
What have I done wrong?
TIA
-
Re: custom forms - data collection
Bump.
While I am sure the problem lies with the zone_country_id, changing this to country_name, as well as changing numerous other variants in the code, has not yet produced the desired effect - display of country name in the email.
I feel Wits End is fast approaching.
-
Re: custom forms - data collection
-
How to add country dropdown that returns the country name
Quote:
Originally Posted by
dw08gm
I have created a supplier registration form based on this mod, where the only remaining problem is getting the Country to display as its Name rather than its Number (eg "Australia" rather than "13") after selection from the Country dropdown menu.
Rather than post the entire files, references to Country are as follows:
includes/modules/pages/supplier_registration/header_php.php
Line 33
$country = '';
After if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
Line 61
$country = zen_db_prepare_input($_POST['zone_country_id']);
After // BOF Error Messages
Line 111
if (!zen_not_null($country)) {
$error = true;
$messageStack->add('supplier_registration', 'Please select your country');
}
After //assemble the email contents:
Line 203
'country:' . "\t" . $country . "\n" .
includes/templates/your_template/tpl_supplier_registration_default.php
After <fieldset>
Line 76
<label class="inputLabel" for="country"><?php echo ENTRY_COUNTRY; ?></label>
<?php echo zen_get_country_list('zone_country_id', $selected_country, 'id="country" ') . (zen_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="alert">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?>
What have I done wrong?
TIA
How to add country dropdown that returns the country name, rather than country_id number, in email forms (eg band_signup).
Further to my posts above, I think I have a solution. Although not thoroughly tested, eg text vs html emails, the country name now appears as such in Email Archive Manager. If anyone has a better solution, please post.)
A. In includes\functions\html_output.php, towards the end of the file and immediately before
Code:
/*
* Assesses suitability for additional parameters such as rel=nofollow etc
*/
add
Code:
/*
* Creates a pull-down list of countries names (and extract country name)
*/
function zen_get_country_listname($name, $selected = '', $parameters = '') {
$countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
$countries = zen_get_countries();
for ($i=0, $n=sizeof($countries); $i<$n; $i++) {
$countries_array[] = array('id' => $countries[$i]['countries_name'], 'text' => $countries[$i]['countries_name']);
}
return zen_draw_pull_down_menu($name, $countries_array, $selected, $parameters);
}
Notes A:
1. This code is a copy of the preceeding function zen_get_country_list, except 'countries_id' is replaced by 'countries_name'.
2. There is no override for includes\functions\html_output.php, therefore upon upgrade, the new file may have to be edited accordingly.
3. Ideally this code would be placed in either includes\modules\pages\your_page\header_php.php or includes\templates\your_template\templates\tpl_your_page_default.php, but I am unsure about the placement. Anyone?
B. In includes\modules\pages\your_page\header_php.php, after
Code:
if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
add (or change to)
Code:
$country = zen_db_prepare_input($_POST['countries_name']);
C. In includes\templates\your_template\templates\tpl_your_page_default.php, amongst the list of <labels>
add (or change to)
Code:
<label class="inputLabel" for="country"><?php echo ENTRY_COUNTRY; ?></label>
<?php echo zen_get_country_listname('countries_name', $selected_country, 'id="country"') . (zen_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="alert">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?>
<br class="clearBoth" />
Notes B and C:
1. If adding (rather than replacing) the code from steps B and C, you will need to add the other bits of code as per the above quoted post.
-
I want to share my custom form with a customer upload
I want to share my custom form with a customer upload. This custom form was made for my sellers to submit their products to us to sell.
1. This uses a custom form created from the "band signup"
2. A popup window created with a generator
3. An additional program called "upload-point"
4. Set up additional check to make sure customer uploads file
5. It emails me that a product is submitted - but requires the customer to enter the file name.
6. It puts the uploaded files in a folder named "files" with the original file name, not a zencart renumbered file name.
7. The popup window asks for the file, then shows the file being uploaded, then is reported that the file has been uploaded successfully.
Take a look creativelearnables.com/index.php?main_page=submit_product . You can try it with a small image or text file to see how it works.
I was just so excited, I had to share.
If anyone is interested in making a form like this, let me know.:clap:
-
Re: custom forms - data collection
I am interested, particularly the upload file part.
Can only one file be uploaded per form, or can it handle multiple file uploads with (say) advice of the filenames in the comments section?
Does it come with an auto-complete function, for those already with an account?
-
Re: I want to share my custom form with a customer upload
Sounds great.. Ever give any thought of bundling this up and submitting it as a contribution or even bundling it up and posting it to this thread.. I certainly would be interested in a form like this..
-
Re: custom forms - data collection
Quote:
Originally Posted by
dw08gm
I am interested, particularly the upload file part.
Can only one file be uploaded per form, or can it handle multiple file uploads with (say) advice of the filenames in the comments section?
Does it come with an auto-complete function, for those already with an account?
The Upload-Point is quite cool. I changed it to only upload one file, but it is set up for 5. It also has even more options, such as allowing the customer to see their uploaded files, delete, rename, file size and other options.
http://covertheweb.com/upload-point/
I used this in a popup window on my custom form.
-
Re: I want to share my custom form with a customer upload
Quote:
Originally Posted by
DivaVocals
Sounds great.. Ever give any thought of bundling this up and submitting it as a contribution or even bundling it up and posting it to this thread.. I certainly would be interested in a form like this..
I will try to get it together today and post it here. I am not a php wizard to answer lots of "how it works" problems, but I can try.
The reason I posted about it is because you see lots of people here looking for something like this and thought it might be helpful.:smile:
-
1 Attachment(s)
Re: I want to share my custom form with a customer upload
I hope this works for everyone. Please read the READ ME FIRST file, it gives you complete directions on how to install this form and needed changes to make it work correctly.
Since the UPLOAD-POINT file is to big for me to include in the total set up, you need to download it from here and upload it on your server first then upload my files. My files will overwrite 4 files in the "upload" folder.
If you have questions, I am very limited in my knowledge of php, but I will try to do my best. :smile:
-
Re: I want to share my custom form with a customer upload
Quote:
Originally Posted by
ladybugmom
I hope this works for everyone. Please read the READ ME FIRST file, it gives you complete directions on how to install this form and needed changes to make it work correctly.
Since the UPLOAD-POINT file is to big for me to include in the total set up, you need to download it from
here and upload it on your server first then upload my files. My files will overwrite 4 files in the "upload" folder.
If you have questions, I am very limited in my knowledge of php, but I will try to do my best. :smile:
This is awesome!!! Gonna check this out as soon as I get back home..:clap:
-
Re: I want to share my custom form with a customer upload
Quote:
Originally Posted by
ladybugmom
I hope this works for everyone. Please read the READ ME FIRST file, it gives you complete directions on how to install this form and needed changes to make it work correctly.
Since the UPLOAD-POINT file is to big for me to include in the total set up, you need to download it from
here and upload it on your server first then upload my files. My files will overwrite 4 files in the "upload" folder.
If you have questions, I am very limited in my knowledge of php, but I will try to do my best. :smile:
Hi ladybugmom
Thanks for a great contribution, which I am currently perusing.
In the ReadMeFirst, Point 9 states:
"You can specify which files you do not want uploaded."
Searching through the files for how to do this, I found many references to $up_ignore, and am wondering if this is what Point 9 refers to?
However, while the list of possible exclusions greatly exceeds the 5 provisions for up_ignore, this function also seems limited to whole filenames, eg index.php.
Instead what I want to do is limit the uploads to files with .jpg, .png, .gif, .pdf and .txt extensions only, which is contrary to the up_ignore function.
Could you please enlighten.
-
Re: I want to share my custom form with a customer upload
Quote:
Originally Posted by
dw08gm
Hi ladybugmom
Thanks for a great contribution, which I am currently perusing.
In the ReadMeFirst, Point 9 states:
"You can specify which files you do not want uploaded."
Searching through the files for how to do this, I found many references to $up_ignore, and am wondering if this is what Point 9 refers to?
However, while the list of possible exclusions greatly exceeds the 5 provisions for up_ignore, this function also seems limited to whole filenames, eg index.php.
Instead what I want to do is limit the uploads to files with .jpg, .png, .gif, .pdf and .txt extensions only, which is contrary to the up_ignore function.
Could you please enlighten.
Code:
$up_ignore1 = "";
$up_ignore2 = "";
$up_ignore3 = "";
$up_ignore4 = "";
$up_ignore5 = "";
Files to ignore(not list) in the upload directory. ".htaccess" is ignored by default.
The above is listed on the site, I guess I read it as file extensions to ignore. Sorry about that, I have emailed the fella from UPLOAD-POINT to see if he has an answer or if it is even possible to designate extensions. I had planned on a little blurb by the upload button stating which extensions we would except.
I will post his reply as soon as I get it.
Maybe someone here knows more about php code and would know what to put where to designate which files to accept.
:smile:
-
Re: custom forms - data collection
Can anyone help with the valuation and send of info
I have in header
$error = false;
$mhs_type = '';
// Pulldown to select a type
// Set default selection:
$default_pulldown_selection = '0';
//build an array of entries to be displayed on the template for field 'mhs_type':
$pulldown_contents[] = array('id'=>'0', 'text'=>'Please select');
$pulldown_contents[] = array('id'=>'1', 'text'=>'Campervan');
$pulldown_contents[] = array('id'=>'2', 'text'=>'Coachbuild');
if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
//For validation, you're looking for the contents of the $_POST['my_pulldown_menu'] variable
// this is only set after "submit" is clicked.
$pulldown_selected_item = (isset($_POST['mhs_type'])) ? $_POST['mhs_type'] : $default_pulldown_selection ;
if (!zen_validate_email($contact_email)) {
$error = true;
$messageStack->add('mhs_form', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
}
// Validation for the 'mhs_type' selected field here.
if ($pulldown_selected_item==0) {
$messageStack->add_session('header','Please select motorhome type','error');
}
//assemble the email contents:
$email_text = 'MHS Form Data Submission: ' . "\n" .
'------------------------------------------------------' . "\n" .
'mhs_type:' . "\t" . $mhs_type . "\n"
In the template
<label class="inputLabel" for="mhs_type">MotorHome Type:</label>
<?php echo zen_draw_pull_down_menu('mhs_type', $pulldown_contents, $pulldown_selected_item). '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>
<br class="clearBoth" />
So far so good....when I open form online all looks good with options showing but the form will submit even if the data in the 'TYPE' box is left blank of just with option 0
Sorry for the long post but I just cannot get the form to validate properly...any help please.
-
Re: I want to share my custom form with a customer upload
Quote:
Originally Posted by
ladybugmom
Code:
$up_ignore1 = "";
$up_ignore2 = "";
$up_ignore3 = "";
$up_ignore4 = "";
$up_ignore5 = "";
Files to ignore(not list) in the upload directory. ".htaccess" is ignored by default.
The above is listed on the site, I guess I read it as file extensions to ignore. Sorry about that, I have emailed the fella from UPLOAD-POINT to see if he has an answer or if it is even possible to designate extensions. I had planned on a little blurb by the upload button stating which extensions we would except.
I will post his reply as soon as I get it.
Maybe someone here knows more about php code and would know what to put where to designate which files to accept.
:smile:
Hi ladybugmom
Uploaded the mod and it works OK. However:
1. Further to the selective file upload query, I found some pointers at:
http://www.reconn.us/content/view/30/51/
http://www.plus2net.com/php_tutorial...ile_upload.php
Just need to work out where to put same.
2. In line 164 of \includes\templates\YOURTEMPLATE_(RENAME)\templates\tpl_submit_product_default.p hp
Code:
<a href="http://www.yourdomain.com/upload" rel="popup console 600 400"><?php echo zen_image_submit(BUTTON_IMAGE_UPLOADED, BUTTON_UPLOADED_ALT); ?></a>
I am not sure about the rel="popup console 600 400" especially with respect to the existing popupWindow function and the css. While I had to adjust the dimensions to 850 600, and would prefer the window to be aligned centre below my header, I could not get to control its display in css.
3. I still have not worked out the $up_ignore function.
Best Regards
-
Re: custom forms - data collection
I received an email back from the UPLOAD-POINT in regards to selecting only certain file extensions to be uploaded and this was his reply. I have not used it yet, but wanted to pass it on to those who wanted to used it.
Quote:
Hello Ladybugmom,
Sorry so long to reply, I've been out of town.
The latest version (1.62 Beta) does not have an easy fix. This is because of the addition of the ability to upload multiple files at once. The version before (1.61 Beta) is essentially the same, has an easy fix, but doesn't allow multiple files to be uploaded at once.
I've had many requests for this, but I've not had any free time for a while to try to work on it. A user has sent his fix for 1.62 Beta if you want it, but it's pretty long and may have a few minor problems.
I'm sorry I couldn't have been of more help, but I truly have not had any time to work on it lately.
Regards,
Todd
The easy ;) fix to 1.61 Beta is this:
Code:
In index.php after line 306 is: // Path from domain name to upload
directory and line 315 is: // Redirect to upload page.
Replace the current code between these lines with this:
$file_ext = basename($_FILES['ftp_file']['name']);
$ext = substr($file_ext, strrpos($file_ext, '.') + 1);
$upload_dir = ($_SERVER['DOCUMENT_ROOT'] . "/$fileupload_dir_name/");
$target_path = $upload_dir . basename( $_FILES['ftp_file']['name']);
if (($ext == "ai") || ($ext == "eps") || ($ext == "psd") || ($ext ==
"pdf") || ($ext == "png") || ($ext == "gif") || ($ext == "tif") || ($ext
== "rar") || ($ext == "7z") || ($ext == "zip")) {
if (move_uploaded_file($_FILES['ftp_file']['tmp_name'], $target_path)) {
chmod($upload_dir . basename( $_FILES['ftp_file']['name']), 0644);
echo $p."$l_upload13 ". basename( $_FILES['ftp_file']['name']). "$p2";
} else {
echo $p."$l_upload14 ". basename( $_FILES['ftp_file']['name']). "$p2";
}
} else {
echo $p."$l_upload14 ". basename( $_FILES['ftp_file']['name']). "$p2";
}
The new line 311:
if (($ext == "ai") || ($ext == "eps") || ($ext == "psd") || ($ext ==
"pdf") || ($ext == "png") || ($ext == "gif") || ($ext == "tif") || ($ext
== "rar") || ($ext == "7z") || ($ext == "zip")) {
is where you can add or remove file types. If you just want .jpg files
then it should be:
if (($ext == "jpg")) {
-
Re: custom forms - data collection
Hi Ladybugmom
Since my last post, I did a developer-tool-kit search for "upload" and "upload_files" etc and discovered the following zen cart files both provide for extensions:
admin\includes\classes\upload.php
includes\classes\upload.php
which function with
admin\mail.php
admin\media_manager.php
As I am not good with php, the problem remains how to incorporate these snippets into your mod.
However, your fix may save me a lot of bother. With the limitation of only applying to one file uploaded at a time, I suppose a little note to the uploader may cater to situations where more than one file is to be uploaded.
I imagine one can upload one file after another by multiple pressings of the "Upload your file" button before finally pressing the send button for the form. If this is the case, the form should provide a place to list the files so uploaded.
Best Regards
-
Re: custom forms - data collection
Hi.
I have a question. I'm using Zen Cart and want to add three contact forms. I have looked trough php form tutorial and found how forms are created. I just want to know how I can implement them with Zen Cart. Sorry for my bad knowledge in programming and thanks in advance.
-
Re: custom forms - data collection
This is just what I've been looking for, but I'm trying to incorporate it into a defined page via the define pages editor.
I basically copied the entire code from the http://www.silkblooms.co.uk/upload/data/index.php file and pasted it into this page:
http://www.silkblooms.co.uk/index.ph...e=testimonials
Needless to say, it don't work :)
I'm assuming it's because the 'upload' folder is not relative to the testimonial files? Would an easy way of fixing this be to move the upload folder into a relative position? If so, does anyone know where to?
I'm a complete amateur, if anyone knows a better way of incorporating this upload file function into a defined page then please share a technique with me. I'm very keen to have this function.
-
Re: custom forms - data collection
I am not exactly clear on what you want to do.
If Evilbr.png is a file that you uploaded, then the mod does work ipso facto.
IIRC the Upload folder must be placed outside of your cart for security reasons.
-
Re: custom forms - data collection
Ignore my previous post, I was just talking gibberish. All I had to do was insert the page into an IFrame. It's working now, at http://www.silkblooms.co.uk/index.ph...e=testimonials
My next question is now in line with the last few posts in this thread. How on earth do we prevent users from uploading .exe and .php malicious files?
I see that rolling back to v.1.61 is a quick fix, but I'd really like to keep the multiple file upload function. I've conversed with the mod author and he's basically saying it's not an easy fix using the php commands he's used to fix 1.61.
Does anyone know if there's a way of using a .htaccess file to prevent the upload of certain file types?
-
Re: custom forms - data collection
Quote:
Originally Posted by
limelites
Ignore my previous post, I was just talking gibberish. All I had to do was insert the page into an IFrame. It's working now, at
http://www.silkblooms.co.uk/index.ph...e=testimonials
My next question is now in line with the last few posts in this thread. How on earth do we prevent users from uploading .exe and .php malicious files?
I see that rolling back to v.1.61 is a quick fix, but I'd really like to keep the multiple file upload function. I've conversed with the mod author and he's basically saying it's not an easy fix using the php commands he's used to fix 1.61.
Does anyone know if there's a way of using a .htaccess file to prevent the upload of certain file types?
Suggest using the example posted earlier in this post for how to put your form in the proper Zen Cart format, and NOT to use an iframe for your form..
-
Re: custom forms - data collection
I'm quite happy with the iFrame though, it seems to do the trick.
All I need is to figure out how to maintain multiple file uplaods, without compromising security.
-
Re: custom forms - data collection
Quote:
Originally Posted by
limelites
I'm quite happy with the iFrame though, it seems to do the trick.
All I need is to figure out how to maintain multiple file uplaods, without compromising security.
The iframe can be troublesome for forms and interactive content.. and will most definitely compromise security.. (No SSL for forms sitting inside an iframe) Your choice.. Just a suggestion..
-
Re: custom forms - data collection
even though I used https:// when adding the page URL inside the frame?
-
Re: custom forms - data collection
Quote:
Originally Posted by
limelites
My next question is now in line with the last few posts in this thread. How on earth do we prevent users from uploading .exe and .php malicious files?
If you limit the file types to .jp*g, *.png, *.txt, *.rtf and *.pdf, you should have no problem.
See post #179 for where to put this.
Basically, I created a new page based on this band signup mod, to which I added the Upload Point code. No iFrame required.
If you want your testimonials page to automatically create itself from user inputs, I think you are in for a lot more work to maintain the appropriate controls..
-
Re: custom forms - data collection
Quote:
Originally Posted by
dw08gm
If you limit the file types to .jp*g, *.png, *.txt, *.rtf and *.pdf, you should have no problem.
See post #179 for where to put this.
Basically, I created a new page based on this band signup mod, to which I added the Upload Point code. No iFrame required.
If you want your testimonials page to automatically create itself from user inputs, I think you are in for a lot more work to maintain the appropriate controls..
Thanks for the reply. I did install your mod for the band signup page, but the required fields were far more than I needed. I only need #name, #city, #email and #testimonial. So, I just popped it in an iframe which seems to work for me. I don't envisage loads and loads of testimonials and I do realise I'll need a large amount of manual work to actually publish each testimonial once I receive the files. Probably take about ten minutes each one.
I looked at post #179 again, but that means rolling back to version 1.61 and losing the multiple file upload functionality. I'd much rather maintain that.
-
Re: custom forms - data collection
I suppose it is a tradeoff between customer convenience and your security. I opted for the latter.
-
Re: custom forms - data collection
Quote:
Originally Posted by
limelites
Thanks for the reply. I did install your mod for the band signup page, but the required fields were far more than I needed. I only need #name, #city, #email and #testimonial. So, I just popped it in an iframe which seems to work for me. I don't envisage loads and loads of testimonials and I do realise I'll need a large amount of manual work to actually publish each testimonial once I receive the files. Probably take about ten minutes each one.
I looked at post #179 again, but that means rolling back to version 1.61 and losing the multiple file upload functionality. I'd much rather maintain that.
The idea behind the band mod was not for you to use it AS IS, but to use it as a starting point to create your own form. Once I read through this thread, and looked at the form, and other forms on my sites (returns authorization, contact us, testimonials) it seemed fairly straightforward how to do this..
-
Re: custom forms - data collection
Quote:
Originally Posted by
limelites
I looked at post #179 again, but that means rolling back to version 1.61 and losing the multiple file upload functionality. I'd much rather maintain that.
Actually, I have just discovered that ZCv139c has been released and that in images/ there is a new .htaccess file which allows some of those filetypes I just mentioned. It would only require a minor edit to permit others. It may also work with Upload Point 1.62, or whichever the multi-upload version.
To wit
Code:
# but now allow just *certain* necessary files:
<FilesMatch ".*\.(jpe?g|JPE?G|gif|GIF|png|PNG|swf|SWF)$" >
Order Allow,Deny
Allow from all
</FilesMatch>
IndexIgnore */*
## NOTE: If you want even greater security to prevent hackers from running scripts in this folder, uncomment the following line (if your hosting company will allow you to use OPTIONS):
# OPTIONS -Indexes -ExecCGI
The last paragraph is especially interesting, and I wonder if some knowledge person (calling Dr Byte) could advise if unremming this option would prevent the Upload Point code from working.
Check it out.
-
Re: custom forms - data collection
Problems with limiting the file upload size and other issues with UploadPoint are further discussed in this thread
http://www.zen-cart.com/forum/showthread.php?t=155546
-
Re: custom forms - data collection
Quote:
Originally Posted by
dw08gm
The last paragraph is especially interesting, and I wonder if some knowledge person (calling Dr Byte) could advise if unremming this option would prevent the Upload Point code from working.
As I've stated elsewhere, that code is entirely separate from Zen Cart.
The code inside Zen Cart files is unrelated to that external script running from another part of your website.
-
Re: custom forms - data collection
Quote:
Originally Posted by
DrByte
As I've stated elsewhere, that code is entirely separate from Zen Cart.
The code inside Zen Cart files is unrelated to that external script running from another part of your website.
Hi Dr Byte
Do you know of any other upload software that works with zencart or that you would recommend running with zen cart?
TIA
-
Re: custom forms - data collection
For those of you using v.1.62 Beta of the upload file mod, here is a modified index.php that will let you to allow only certain file types to be uploaded. Just replace the index.php with this (there's also an added extra that sends e-mail notification of uploads):
PHP Code:
<?php
########################################################################
# Upload-Point 1.62 Beta - Simple Upload System
# Copyright (c)2005-2009 Todd Strattman
# strattman######################
# http://covertheweb.com/upload-point/
# License: LGPL
########################################################################
// Config.php is the main configuration file.
include('config.php');
// Password file.
if (is_file("$datadir/upload_pass.php")) {
include ("$datadir/upload_pass.php");
}
// Language file.
include("lang/$language");
// Name of page for links, title, and logout.
//$logout = "index.php";
//$page_name = "upload";
// Password protection.
// Random string generator.
function randomstring($length){
$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
$string = $chars{ rand(0,62) };
for($i=1;$i<$length;$i++){
$string .= $chars{ rand(0,62) };
}
return $string;
}
if ($password_protect == "on") {
session_start();
if(!empty($_POST['pass_hash_upload'])) {
// Crypt, hash, and store password in session.
$_SESSION['pass_hash_upload'] = crypt(md5($_POST['pass_hash_upload']), md5($_POST['pass_hash_upload']));
// Crypt random string with random string seed for agent response.
$string_agent = crypt($_SESSION['random'], $_SESSION['random']);
// Hash crypted random string for random string response.
$string_string = md5($string_agent);
// Hash and concatenate md5/crypted random string and password hash posts.
$string_response = md5($string_string . $_POST['pass_hash2']);
// Concatenate agent and language.
$agent_lang = getenv('HTTP_USER_AGENT') . getenv('HTTP_ACCEPT_LANGUAGE');
// Hash crypted agent/language concatenate with random string seed for check against post.
$agent_response = md5(crypt(md5($agent_lang), $string_agent));
// Check crypted pass against stored pass. Check random string and pass hashed concatenate against post. Check hashed and crypted agent/language concatenate against post.
} if (($_SESSION['pass_hash_upload'] != $upload_password) || ($_POST['pass_string_hash'] != $string_response) || ($_POST['agenthash'] != $agent_response)) {
// Otherwise, give login.
if ($head == "on") {
include("header.php");
}
// Set random string session.
$_SESSION['random'] = randomstring(40);
// Crypt random string with random string seed.
$rand_string = crypt($_SESSION['random'], $_SESSION['random']);
// Concatenate agent and language.
$agent_lang = getenv('HTTP_USER_AGENT').getenv('HTTP_ACCEPT_LANGUAGE');
// Crypt agent and language with random string seed for form submission.
$agent = crypt(md5($agent_lang), $rand_string);
// Form md5 and encrypt javascript.
echo "$p
<b>$l_global13</b>
$p2
<script type=\"text/javascript\" src=\"$datadir/crypt/sha256.js\"></script>
<script type=\"text/javascript\" src=\"$datadir/crypt/md5.js\"></script>
<script type=\"text/javascript\">
function obfuscate() {
document.form1.pass_hash_upload.value = hex_sha256(document.form1.pass_upload.value);
document.form1.pass_hash2.value = hex_md5(document.form1.pass_upload.value);
document.form1.string_hash.value = hex_md5(document.form1.string.value);
document.form1.pass_string_hash.value = hex_md5(document.form1.string_hash.value + document.form1.pass_hash2.value);
document.form1.agenthash.value = hex_md5(document.form1.agent.value);
document.form1.pass_upload.value = \"\";
document.form1.string.value = \"\";
document.form1.agent.value = \"\";
document.form1.jscript.value = \"on\";
return true;
}
</script>
<form action=\"index.php\" method=\"post\" name=\"form1\" onsubmit=\"return obfuscate()\">
$p
<input name=\"jscript\" type=\"hidden\" value=\"off\" />
<input name=\"pass_hash_upload\" type=\"hidden\" value=\"\" />
<input name=\"pass_hash2\" type=\"hidden\" value=\"\" />
<input name=\"string_hash\" type=\"hidden\" value=\"\" />
<input name=\"pass_string_hash\" type=\"hidden\" value=\"\" />
<input name=\"agenthash\" type=\"hidden\" value=\"\" />
<input name=\"string\" type=\"hidden\" value=\"$rand_string\" />
<input name=\"agent\" type=\"hidden\" value=\"$agent\" />
<input type=\"password\" name=\"pass_upload\" />
<input type=\"submit\" value=\"$l_global14\" />
$p2
</form>";
if ($head == "on") {
include("footer.php");
}
exit();
}
} else {
}
// End password protection.
function upload1() {
// Config.php is the main configuration file.
include('config.php');
// Language file.
include("lang/$language");
// Name of page for links, title, and logout.
$logout = "index.php";
$page_name = "upload";
// Include header if "on" in config.php.
if ($head == "on") {
include("header.php");
}
// Upload file form.
echo "<script type=\"text/javascript\">
function showIcon() {
window.setTimeout('showProgress()', 0);
}
function showProgress() {
document.getElementById('progressImg').style.display = 'inline';
}
</script>
<table class=\"upload\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">
<tr>
<td colspan=\"6\">
<form action=\"index.php\" method=\"post\" enctype=\"multipart/form-data\">
<div id =\"upload_popup\">
<input type=\"hidden\" name=\"cmd\" value=\"upload2\" /> <input type=\"file\" name=\"ftp_file[]\" />
<br />
<input type=\"hidden\" name=\"cmd\" value=\"upload2\" /> <input type=\"file\" name=\"ftp_file[]\" />
<br />
<input type=\"hidden\" name=\"cmd\" value=\"upload2\" /> <input type=\"file\" name=\"ftp_file[]\" />
<br />
<input type=\"hidden\" name=\"cmd\" value=\"upload2\" /> <input type=\"file\" name=\"ftp_file[]\" />
<br />
<input type=\"hidden\" name=\"cmd\" value=\"upload2\" /> <input type=\"file\" name=\"ftp_file[]\" />
<br /><br />
<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"10\" />
<input type=\"submit\" name=\"submit\" onclick=\"showIcon();\" value=\"$l_upload1\" />
</div>
<div class=\"progress\" id=\"progressImg\">
<img src=\"$datadir/progress.gif\" alt=\"$l_upload21\" />
</div>
</form>
</td>
</tr>";
// Hide file listing from logged in users.
if ($hide == "on") {
echo "</table>";
} else {
echo "<tr>";
// <td> colspan for rename/delete on/off.
if (($rename_file == "off") && ($delete_file == "off")) {
echo "<td colspan=\"4\">";
} elseif ($rename_file == "off") {
echo "<td colspan=\"5\">";
} elseif ($delete_file == "off") {
echo "<td colspan=\"5\">";
} else {
echo "<td colspan=\"6\">";
}
echo "
<hr />
$p
<b>$l_upload2</b>
$p2
<hr />
</td>
</tr>
</table>
<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" id=\"upload-point\" class=\"tablesorter\">
<thead>
<tr>
<th class=\"uploadlistname\"><b>$l_upload3</b></th>
<th class=\"uploadlistsize\"><b>$l_upload4</b></th>
<th class=\"uploadlistmod\"><b>$l_upload5</b></th>";
// Rename file on/off.
if ($rename_file == "on") {
echo "
<th class=\"uploadlistrename\"><b>$l_upload6</b></th>";
} else {
}
// Delete file on/off.
if ($delete_file == "on") {
echo "
<th class=\"uploadlistdelete\"><b>$l_upload7</b></th>";
} else {
}
echo "<th class=\"uploadlistloc\"><b>$l_upload8</b></th>
</tr>
</thead>
<tfoot>
<tr>
<th class=\"uploadlistname\"><b>$l_upload3</b></th>
<th class=\"uploadlistsize\"><b>$l_upload4</b></th>
<th class=\"uploadlistmod\"><b>$l_upload5</b></th>";
// Rename file on/off.
if ($rename_file == "on") {
echo "
<th class=\"uploadlistrename\"><b>$l_upload6</b></th>";
} else {
}
// Delete file on/off.
if ($delete_file == "on") {
echo "
<th class=\"uploadlistdelete\"><b>$l_upload7</b></th>";
} else {
}
echo "<th class=\"uploadlistloc\"><b>$l_upload8</b></th>
</tr>
</tfoot>
<tbody>";
}
// Path from Upload-Point directory to upload directory
$upload_dir = ($_SERVER['DOCUMENT_ROOT'] . "/$fileupload_dir_name");
// Create upload directory if it doesn't exist.
if (!is_dir($upload_dir)) {
if (!mkdir($upload_dir))
die ("$l_upload11");
if (!chmod($upload_dir,0755))
die ("$l_upload12");
}
// File listing code.
if ($hide == "on") {
} else {
if (is_empty_dir($upload_dir) == true) {
echo "</table>";
} elseif (is_empty_dir($upload_dir) == false) {
// List files in the upload directory.
$dir_handle = opendir($upload_dir);
if ($dir_handle) {
while (false !==($file = readdir($dir_handle))) {
$upload_files = "$upload_dir/$file";
if ((is_file($upload_files)) && ($file!=".htaccess" && $file!=$up_ignore1 && $file!=$up_ignore2 && $file!=$up_ignore3 && $file!=$up_ignore4 && $file!=$up_ignore5)) {
$upload_name_sort[] = $file;
}
}
sort($upload_name_sort);
foreach ($upload_name_sort as $file) {
echo "
<tr>
<td class=\"uploadlistname\">$file</td>
<td class=\"uploadlistsize\">".upload_file_size("$upload_dir/$file")."</td>
<td class=\"uploadlistmod\">".date("m(M) d Y - H:i:s", filemtime("$upload_dir/$file"))."</td>";
// Rename file on/off.
if ($rename_file == "on") {
echo "
<td class=\"uploadlistrename\">
<form action=\"index.php\" method=\"post\">
$p
<input type=\"hidden\" name=\"file\" value=\"$file\" />
<input type=\"hidden\" name=\"pg\" value=\"$pg\" />
<input type=\"hidden\" name=\"cmd\" value=\"upload_rename\" />
<input type=\"text\" name=\"upload_newname\" value=\"$file\" />
<input name=\"submit\" type=\"submit\" value=\"$l_upload6\" />
$p2
</form>
</td>";
} else {
}
// Delete file on/off.
if ($delete_file == "on") {
echo "
<td class=\"uploadlistdelete\">
<form action=\"index.php\" method=\"post\">
$p
<input type=\"hidden\" name=\"file\" value=\"$file\" />
<input type=\"hidden\" name=\"pg\" value=\"$pg\" />
<input type=\"hidden\" name=\"cmd\" value=\"upload_delete\" />
<input name=\"submit\" type=\"submit\" value=\"$l_upload7\" />
$p2
</form>
</td>";
} else {
}
echo "
<td class=\"uploadlistloc\"><a href=\"http://".$_SERVER['HTTP_HOST']."/$fileupload_dir_name/$file\"><i>http://".$_SERVER['HTTP_HOST']."/$fileupload_dir_name/$file</i></a></td>
</tr>";
}
}
closedir($dir_handle);
echo "
</tbody>
</table>
";
}
}
// Include footer if "on" in config.php.
if ($head == "on") {
include("footer.php");
}
}
// Upload file function.
function upload2($ftp_file, $upload_type) {
// Config.php is the main configuration file.
include('config.php');
// Language file.
include("lang/$language");
// Name of page for links, title, and logout.
$logout = "index.php";
$page_name = "upload";
// Include header if "on" in config.php.
if ($head == "on") {
include("header.php");
}
// Upload process.
// Path from domain name to upload directory
$upload_dir = ($_SERVER['DOCUMENT_ROOT'] . "/$fileupload_dir_name/");
$target_path1 = $upload_dir . basename($_FILES['ftp_file']['name'][0]);
$target_path2 = $upload_dir . basename($_FILES['ftp_file']['name'][1]);
$target_path3 = $upload_dir . basename($_FILES['ftp_file']['name'][2]);
$target_path4 = $upload_dir . basename($_FILES['ftp_file']['name'][3]);
$target_path5 = $upload_dir . basename($_FILES['ftp_file']['name'][4]);
//Email notification.
//$to = '[email protected]';
//$headers = 'From: [email protected]' . "\r\n" .
// 'Reply-To: [email protected]' . "\r\n" .
// 'X-Mailer: PHP/' . phpversion();
//date_default_timezone_set('America/New_York'); //http://us2.php.net/manual/en/timezones.php
//End of Email notification
$ext1 = end(explode('.', $_FILES['ftp_file']['name'][0]));
$ext2 = end(explode('.', $_FILES['ftp_file']['name'][1]));
$ext3 = end(explode('.', $_FILES['ftp_file']['name'][2]));
$ext4 = end(explode('.', $_FILES['ftp_file']['name'][3]));
$ext5 = end(explode('.', $_FILES['ftp_file']['name'][4]));
// Define allowed file types.
$allowed = array('gif', 'GIF', 'jpg', 'JPG', 'jpeg', 'JPEG', 'png', 'PNG');
// Define the maximum filesize - in kb.
define ("MAX_SIZE","2000");
$size1=filesize($_FILES['ftp_file']['tmp_name'][0]);
$size2=filesize($_FILES['ftp_file']['tmp_name'][1]);
$size3=filesize($_FILES['ftp_file']['tmp_name'][2]);
$size4=filesize($_FILES['ftp_file']['tmp_name'][3]);
$size5=filesize($_FILES['ftp_file']['tmp_name'][4]);
if ($size1 > MAX_SIZE*1024){$size_ok1 = 1;}
if ($size2 > MAX_SIZE*1024){$size_ok2 = 1;}
if ($size3 > MAX_SIZE*1024){$size_ok3 = 1;}
if ($size4 > MAX_SIZE*1024){$size_ok4 = 1;}
if ($size5 > MAX_SIZE*1024){$size_ok4 = 1;}
if ((in_array($ext1, $allowed)) && ($size_ok1 != 1)) {
if (move_uploaded_file($_FILES['ftp_file']['tmp_name'][0], $target_path1)) {
chmod($upload_dir . basename( $_FILES['ftp_file']['name'][0]), 0644);
//$subject = 'A new file has been uploaded to your website';
//$message = 'This is an automatic notification, a new file has been uploaded the the RC Signs website'. basename( $_FILES['ftp_file']['name'][4]) .' was uploaded on '. date('l jS \of F Y h:i:s A');
//mail($to, $subject, $message, $headers);
echo $p."$l_upload13 ". basename( $_FILES['ftp_file']['name'][0]). "$p2";
}
} else {
echo $p."$l_upload14 ". basename( $_FILES['ftp_file']['name'][0]). "$p2";
}
if ((in_array($ext2, $allowed)) && ($size_ok2 != 1)){
if (is_file($_FILES['ftp_file']['tmp_name'][1])) {
if (move_uploaded_file($_FILES['ftp_file']['tmp_name'][1], $target_path2)) {
chmod($upload_dir . basename( $_FILES['ftp_file']['name'][1]), 0644);
//$subject = 'A new file has been uploaded to your website';
//$message = 'This is an automatic notification, a new file has been uploaded the the RC Signs website'. basename( $_FILES['ftp_file']['name'][4]) .' was uploaded on '. date('l jS \of F Y h:i:s A');
//mail($to, $subject, $message, $headers);
echo $p."$l_upload13 ". basename( $_FILES['ftp_file']['name'][1]). "$p2";
}
} else {
echo $p."$l_upload14 ". basename( $_FILES['ftp_file']['name'][1]). "$p2";
}
}
if ((in_array($ext3, $allowed)) && ($size_ok3 != 1)){
if (is_file($_FILES['ftp_file']['tmp_name'][2])) {
if (move_uploaded_file($_FILES['ftp_file']['tmp_name'][2], $target_path3)) {
chmod($upload_dir . basename( $_FILES['ftp_file']['name'][2]), 0644);
//$subject = 'A new file has been uploaded to your website';
//$message = 'This is an automatic notification, a new file has been uploaded the the RC Signs website'. basename( $_FILES['ftp_file']['name'][4]) .' was uploaded on '. date('l jS \of F Y h:i:s A');
//mail($to, $subject, $message, $headers);
echo $p."$l_upload13 ". basename( $_FILES['ftp_file']['name'][2]). "$p2";
}
} else {
echo $p."$l_upload14 ". basename( $_FILES['ftp_file']['name'][2]). "$p2";
}
}
if ((in_array($ext4, $allowed)) && ($size_ok4 != 1)){
if (is_file($_FILES['ftp_file']['tmp_name'][3])) {
if (move_uploaded_file($_FILES['ftp_file']['tmp_name'][3], $target_path4)) {
chmod($upload_dir . basename( $_FILES['ftp_file']['name'][3]), 0644);
//$subject = 'A new file has been uploaded to your website';
//$message = 'This is an automatic notification, a new file has been uploaded the the RC Signs website'. basename( $_FILES['ftp_file']['name'][4]) .' was uploaded on '. date('l jS \of F Y h:i:s A');
//mail($to, $subject, $message, $headers);
echo $p."$l_upload13 ". basename( $_FILES['ftp_file']['name'][3]). "$p2";
}
} else {
echo $p."$l_upload14 ". basename( $_FILES['ftp_file']['name'][3]). "$p2";
}
}
if ((in_array($ext5, $allowed)) && ($size_ok5 != 1)){
if (is_file($_FILES['ftp_file']['tmp_name'][4])) {
if (move_uploaded_file($_FILES['ftp_file']['tmp_name'][4], $target_path5)) {
chmod($upload_dir . basename( $_FILES['ftp_file']['name'][4]), 0644);
//$subject = 'A new file has been uploaded to your website';
//$message = 'This is an automatic notification, a new file has been uploaded the the RC Signs website'. basename( $_FILES['ftp_file']['name'][4]) .' was uploaded on '. date('l jS \of F Y h:i:s A');
//mail($to, $subject, $message, $headers);
echo $p."$l_upload13 ". basename( $_FILES['ftp_file']['name'][4]). "$p2";
}
} else {
echo $p."$l_upload14 ". basename( $_FILES['ftp_file']['name'][4]). "$p2";
}
}
// Redirect to upload page.
if ($su == "on") {
$upload_redirect = $admin_redirect;
} else {
$upload_redirect = $edit_redirect;
}
echo "<script type=\"text/javascript\">
<!--
var URL = \"$logout\"
var speed = $upload_redirect
function reload() {
location = URL
}
setTimeout(\"reload()\", speed);
//-->
</script>
$p
$l_upload15
$p2";
// Include footer if "on" in config.php.
if ($head == "on") {
include("footer.php");
}
}
// Function to delete files.
function upload_delete($file, $pg) {
// Config.php is the main configuration file.
include('config.php');
// Language file.
include("lang/$language");
// Name of page for links, title, and logout.
$logout = "index.php";
$page_name = "upload";
// Include header if "on" in config.php.
if ($head == "on") {
include("header.php");
}
// Path to file.
$upload_file_path = ($_SERVER['DOCUMENT_ROOT'] . "/$fileupload_dir_name/$file");
// Delete file
unlink($upload_file_path);
echo "$p<b>$file</b> $l_upload18$p2";
// Redirect to upload page.
if ($su == "on") {
$upload_redirect = $admin_redirect;
} else {
$upload_redirect = $edit_redirect;
}
echo "<script type=\"text/javascript\">
<!--
var URL = \"$logout?pg=$pg\"
var speed = $upload_redirect
function reload() {
location = URL
}
setTimeout(\"reload()\", speed);
//-->
</script>
$p
$l_upload15
$p2";
// Include footer if "on" in config.php.
if ($head == "on") {
include("footer.php");
}
}
// Function to rename file.
function upload_rename($file, $upload_newname, $pg) {
// Config.php is the main configuration file.
include('config.php');
// Language file.
include("lang/$language");
// Name of page for links, title, and logout.
$logout = "index.php";
$page_name = "upload";
// Include header if "on" in config.php.
if ($head == "on") {
include("header.php");
}
// Path to file.
$upload_file_path = ($_SERVER['DOCUMENT_ROOT'] . "/$fileupload_dir_name/$file");
// Check is file exists and rename it.
if (file_exists($upload_file_path)) {
rename ($upload_file_path, $_SERVER['DOCUMENT_ROOT'] . "/$fileupload_dir_name/$upload_newname") or die ("$l_upload19");
echo "$p<b>$file</b> $l_upload20: <b>$upload_newname</b>.$p2";
}
// Redirect to upload page.
if ($su == "on") {
$upload_redirect = $admin_redirect;
} else {
$upload_redirect = $edit_redirect;
}
echo "<script type=\"text/javascript\">
<!--
var URL = \"$logout?pg=$pg\"
var speed = $upload_redirect
function reload() {
location = URL
}
setTimeout(\"reload()\", speed);
//-->
</script>
$p
$l_upload15
$p2";
// Include footer if "on" in config.php.
if ($head == "on") {
include("footer.php");
}
}
// Errorless check if directory is empty.
function is_empty_dir($dir) {
if (is_dir($dir)) {
$dl = opendir($dir);
if ($dl) {
while ($name = readdir($dl)) {
if (!is_dir("$dir/$name")) {
return false;
break;
}
}
closedir($dl);
} return true;
} else return true;
}
// Show readable file size function.
function upload_file_size($file) {
$file_size = 0;
if (file_exists($file)) {
$size = filesize($file);
if ($size < 1024) {
$file_size = $size.' Bytes';
} elseif (($size >= 1024) && ($size < 1024000)) {
$file_size = round($size/1024,2).' KB';
} elseif ($size >= 1024000) {
$file_size = round(($size/1024)/1024,2).' MB';
}
}
return $file_size;
}
function logout (){
// Config.php is the main configuration file.
include('config.php');
// Language file.
include("lang/$language");
// Name of page for links, title, and logout.
$logout = "index.php";
$page_name = "upload";
// Include header if "on" in config.php.
if ($head == "on") {
include("header.php");
}
session_destroy ();
session_unset ($_SESSION['pass_hash_upload']);
echo "<script type=\"text/javascript\">
<!--
var URL = \"$logout\"
var speed = $edit_redirect
function reload() {
location = URL
}
setTimeout(\"reload()\", speed);
//-->
</script>";
echo "$p
$l_global10
$p2
$p
$l_global11
$p2";
// Include footer if "on" in config.php.
if ($head == "on") {
include("footer.php");
}
}
switch(@$_REQUEST['cmd']) {
default:
upload1();
break;
case "upload2";
upload2(@$_POST['ftp_file'], @$_POST['upload_type'], $_POST['submit']);
break;
case "upload_delete";
upload_delete($_POST['file'], $_POST['pg']);
break;
case "upload_rename";
upload_rename($_POST['file'], $_POST['upload_newname'], $_POST['pg']);
break;
case "logout";
logout();
break;
}
?>
-
Re: custom forms - data collection
Welcome back and thanks for posting!
Is 1.6.2 working Ok for you.
-
Re: custom forms - data collection
Yeah, 1.6.2 beta is working with the index.php posted above.
-
Re: custom forms - data collection
My website site has been down for several hours. I have no way of contacting anyone nor can i find out what is happening, when the site is likely to be back up!! Help please !!!!! :(:(