Beste,
Ik heb een werkende contact formulier. Nu wil ik er nog een file input veld bij (deze is al aangemaakt ) maar werkt niet.
Ik weet wel nieuwe velden aan te maken (ook werkend), alleen met type input is het voor mij wat lastiger.
Wat moet ik hierin plaatsen om afbeelingen met een contact form mee te sturen (de velden zijn al aangemaakt).
************************************************************
<?php
function Headline()
{
global $context, $mbname, $webmaster_email, $txt, $sourcedir, $modSettings, $scripturl;
// Check if the current user can send a message
isAllowedTo('view_headline');
if (isset($_GET['sa']))
{
if ($_GET['sa'] == 'save')
{
// Check whether the visual verification code was entered correctly.
if ((empty($modSettings['disable_visual_verification']) || $modSettings['disable_visual_verification'] != 1) && (empty($_REQUEST['visual_verification_code']) || strtoupper($_REQUEST['visual_verification_code']) !== $_SESSION['visual_verification_code']))
{
$_SESSION['visual_errors'] = isset($_SESSION['visual_errors']) ? $_SESSION['visual_errors'] + 1 : 1;
if ($_SESSION['visual_errors'] > 3 && isset($_SESSION['visual_verification_code']))
unset($_SESSION['visual_verification_code']);
fatal_lang_error('visual_verification_failed', false);
}
elseif (isset($_SESSION['visual_errors']))
unset($_SESSION['visual_errors']);
$from = $_POST['from'];
if ($from == '')
fatal_error($txt['smfcontact_errname'], false);
$subject = $_POST['subject'];
if ($subject == '')
fatal_error($txt['smfcontact_errsubject'], false);
$message = $_POST['message'];
if ($message == '')
fatal_error($txt['smfcontact_errmessage'], false);
$email = $_POST['email'];
if ($email == '')
fatal_error($txt['smfcontact_erremail'], false);
$phone = $_POST['phone'];
if ($phone == '')
fatal_error($txt['smfcontact_errphone'], false);
$titel = $_POST['titel'];
if ($titel == 'titel')
fatal_error($txt['smfcontact_errtitel'], false);
$artikelbron = $_POST['artikelbron'];
$foto = $_POST['foto'];
$fotobron = $_POST['fotobron'];
$subject = htmlspecialchars($subject, ENT_QUOTES);
$message = htmlspecialchars($message, ENT_QUOTES);
$from = htmlspecialchars($from, ENT_QUOTES);
$email = htmlspecialchars($email, ENT_QUOTES);
$titel = htmlspecialchars($titel, ENT_QUOTES);
$artikelbron = htmlspecialchars($artikelbron, ENT_QUOTES);
$foto = htmlspecialchars($foto, ENT_QUOTES);
$fotobron = htmlspecialchars($fotobron, ENT_QUOTES);
$m = $txt['smfcontact_form'] . $mbname . " \n";
$m .= "\n";
$m .= $txt['smfcontact_formname'] . $from . "\n";
$m .= $txt['smfcontact_formemail'] . $email . "\n";
$m .= $txt['smfcontact_formphone'] . $phone . "\n";
$m .= $txt['smfcontact_formtitel'] . $titel . "\n";
$m .= $txt['smfcontact_formartikelbron'] . $artikelbron . "\n";
$m .= $txt['smfcontact_formfoto'] . $foto . "\n";
$m .= $txt['smfcontact_formfotobron'] . $fotobron . "\n";
$m .= "\n";
$m .= $txt['smfcontact_formmessage'];
$m .= $message;
$m .= "\n";
// For send mail function
require_once($sourcedir . '/Subs-Post.php');
// Send email to webmaster
sendmail($webmaster_email, $subject, $m,$email);
// Show template that mail was sent
loadtemplate('Headline');
// Load the main contact template
$context['sub_template'] = 'send';
// Set the page title
$context['page_title'] = $mbname . $txt['smfcontact_titlesent'];
}
}
else
{
// Load the main Contact template
loadtemplate('Headline');
// Language strings
loadLanguage('Login');
// Load the main Contact template
$context['sub_template'] = 'main';
// Set the page title
$context['page_title'] = $mbname . ' - ' . $txt['smfcontact_contact'];
// Generate a visual verification code to make sure the user is no bot.
$context['visual_verification'] = empty($modSettings['disable_visual_verification']) || $modSettings['disable_visual_verification'] != 1;
if ($context['visual_verification'])
{
$context['use_graphic_library'] = in_array('gd', get_loaded_extensions());
$context['verificiation_image_href'] = $scripturl . '?action=verificationcode;rand=' . md5(rand());
// Only generate a new code if one hasn't been set yet
if (!isset($_SESSION['visual_verification_code']))
{
// Skip I, J, L, O and Q.
$character_range = array_merge(range('A', 'H'), array('K', 'M', 'N', 'P'), range('R', 'Z'));
// Generate a new code.
$_SESSION['visual_verification_code'] = '';
for ($i = 0; $i < 5; $i++)
$_SESSION['visual_verification_code'] .= $character_range[array_rand($character_range)];
}
}
}
}
?>
930 views