Errors when including php with the use of User-defined-tags

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Errors when including php with the use of User-defined-tags

Post by RonnyK »

I try to include a php-page, in which a mail-form is set-up. When I open the file directly through IE it runs OK. If I add a user-defined-tag in a page, I get all kinds of errors:

What is the best/working method to get this running in CMS. Is that using user-defined-tags or is it even possible to include the code directly in the page-logic.

Is it also necessary to edit the config.php to allow php to run. I didn't change a line, I noticed two lines stating something about PHP and smarty. The message below is with the flag allow Smarty/PHP set to true, but is the same as running with the flag set to false

Errors:

Code: Select all

Warning: Division by zero in /storage/mijndomein/users/025008/public/sites/test.krijt.eu/cms/lib/content.functions.php(663) : eval()'d code on line 1

Warning: Division by zero in /storage/mijndomein/users/025008/public/sites/test.krijt.eu/cms/lib/content.functions.php(663) : eval()'d code on line 1

Warning: cms_tmp_rk_mailform_userplugin_function(php): failed to open stream: Onbekend bestand of map in /storage/mijndomein/users/025008/public/sites/test.krijt.eu/cms/lib/content.functions.php(663) : eval()'d code on line 1

Warning: cms_tmp_rk_mailform_userplugin_function(): Failed opening 'php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /storage/mijndomein/users/025008/public/sites/test.krijt.eu/cms/lib/content.functions.php(663) : eval()'d code on line 1
Code to include:

Code: Select all

<?php
//start $config array
$c				=	array();

//naam van de website
$c['site']		=	'Jouw website';

//instellen of je een bedankt-mail terug wil zenden bedankt moet TRUE = wel, of FALSE = niet zijn
$c['bedankt']	=	TRUE;

//arrays starten voor naam en emailadres
$c['naam']		=	array();
$c['naar']		=	array();

//alle namen met bijbehorenden emailadressen daaronder
$c['naam'][]	=	'Dennisvb';
$c['naar'][]	=	'dennisvb@sitemasters.be';
$c['naam'][]	=	'Dennis hotmail adres';
$c['naar'][]	=	'dennis_van_braak@hotmail.com';
$c['naam'][]	=	'Wijnand';
$c['naar'][]	=	'wijnand@sitemasters.be';
$c['naam'][]	=	'Tuinstoel';
$c['naar'][]	=	'tuinstoel@sitemasters.be';

//EINDE CONFIG\\

if(isset($_POST['verzenden'])) //wanneer gebruiker op verzenden heeft gedrukt
	{
		$fouten	=	array(); //array voor fouten starten
		
		if(empty($_POST['onderwerp'])) //onderwerp checken
			{
				$fouten[]	=	'Je moet een onderwerp invullen'; //wanneer onderwerp leeg is
			}
		elseif(empty($_POST['naam'])) //naam checken
			{
				$fouten[]	=	'Je moet je naam invullen'; //wanneer naam leeg is
			}
		elseif($_POST['naar'] == 'ontvanger') //wanneer de ontvanger nog op "Ontvanger" staat
			{
				$fouten[]	=	'Je moet een ontvanger selecteren'; //wanneer dat zo is
			}
		elseif(empty($_POST['email']) || !eregi('@',$_POST['email']) || !eregi('.',$_POST['email']) || eregi(' ',$_POST['email'])) //wanneer het adres niet geldig is
			{
				$fouten[]	=	'Je moet een geldig emailadres invullen'; //wanneer het niet geldig is
			}
		elseif(empty($_POST['bericht'])) //wanneer het bericht leeg is
			{
				$fouten[]	=	'Je moet een bericht invullen'; //fout weergeven wanneer het leeg is
			}

	if(count($fouten) == 0) //wanneer er 0 fouten zijn
		{
			$headers	=	'From: '.$_POST['naam'].' < '.$_POST['email'].' >'; //headers maken
			$bericht	=	

htmlspecialchars($_POST['bericht'], ENT_QUOTES).
'\n
--------------------------------------------------
Deze mail is verzonden vanaf '.$c['site']; //bericht opstellen voor het bericht naarwie de persoon wil mailen

					
			mail($_POST['naar'], $_POST['onderwerp'], $bericht, $headers); //verzenden email


			if($c['bedankt'] === TRUE) //wanneer bedankmail aanstaat
				{
					$headers2	=	'From: '.$c['site'].' < '.$_POST['naar'].' >'; //headers maken
					$bericht2	=	

'Bedankt voor je mail. We zullen je vraag zo spoedig mogelijk in behandeling nemen
\n
--------------------------------------------------
dit is een auto-gegenereerde mail die is verzonden vanaf '.$c['site']; //bericht om terug te zenden

					
					mail($_POST['email'], 'Bedankt', $bericht2, $headers2); //zend
					echo	'Je email is succesvol verzonden. Er is een email gestuurd naar je adres'; //tekst wanneer bedankmail aanstaat
				}
			else
				{
					echo	'je email is succesvol verzonden.'; //wanneer bedankmail uitstaat
				}
		}
	else //wanneer er wel fouten zijn
		{
		?>
<table>
  <tr>
    <td class="kop">
    <p align="center"><b>Fout:</b></td>
  </tr>
  <tr>
    <td>
	<?php
	for($i = 0; $i < count($fouten); $i++) //for lus die fouten telt
		{
			echo '<div class="fout"> - '.$fouten[$i].'</div><BR />'; //fouten weergeven
		}
	?>
	Klik <A href="javascript:history.go(-1);"> hier </a> om terug te gaan naar het formulier</A>
	</td>
  </tr>
</table>
<?php
		}
	}
else
	{
?>
<form method="post" action="<?=$_SERVER['PHP_SELF']?>">
<table>
  <tr>
    <td colspan="2" class="kop">
    <p align="center"><b>Contact</b></td>
  </tr>
  <tr>
    <td width="24%">Aan:</td>
    <td width="76%">
	<select size="1" name="naar">
	<option value="ontvanger">Ontvanger</option>
	
<?php
foreach($c['naar'] as $key => $value) //namen van ontvangers ophalem
	{
		echo '<option value="'.$value.'">'.$c['naam'][$key].'</option>'; //en ze in een dropdownbox zetten
	}
?>
		
	
    </select></td>
  </tr>
   <tr>
    <td width="24%">Onderwerp:</td>
    <td width="76%"><input type="text" name="onderwerp" size="38"></td>
  </tr>
  <tr>
    <td width="24%">Je naam:</td>
    <td width="76%"><input type="text" name="naam" size="38"></td>
  </tr>
  <tr>
    <td width="24%">Je emailadres:</td>
    <td width="76%"><input type="text" name="email" size="38"></td>
  </tr>
  <tr>
    <td width="24%">Bericht:</td>
    <td width="76%"><textarea rows="7" name="bericht" cols="32"></textarea></td>
  </tr>
 </table>
 <BR />
 <input type="submit" name="verzenden" value="verzenden">
 </form>
<?php
	} //klaar
?>
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm

Re: Errors when including php with the use of User-defined-tags

Post by tsw »

why not use formbuilder and do it the cmsms way?
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: Errors when including php with the use of User-defined-tags

Post by RonnyK »

Because the formbuilder didn't have the choice of recipient, which this form has. If the formbuilder is easily to adust, I'll go there, but I want to have the option to choose a recipient out of a pull-down list
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm

Re: Errors when including php with the use of User-defined-tags

Post by tsw »

feedback form has "email results based on dropdown" option for sending
Post Reply

Return to “CMSMS Core”