Max,
What happen ist the following:
I have a CF where a group of users are entering a description string of the tour they are planning
The data are stored correctly (including special characters) in the MySQL dB.
A list of the next tours will then be selected, sorted and published inside Joomla docs.
What now happen is, that if the users enters special characters, the description shown in the Joomla page, is corrupted or cut.
Again, the data are stored correctly in the data base, but PHP will probably not allow certain characters to be used for reason of security (code injection).
I want to prevent the users to enter special characters in the first place, because filtering out inside my code may give meaningless results.
Masking is the best solution, i guess, since the user has full control of the string entry.
Bob's proposed alternative (dd. 9. 6. 2017) does not work.
The mask I use
data-inputmask='mask' : '(*| |-|.|,){1,35}'
does the trick.
The only thing that disturbs is that the lagging spaces up to the max. string length (35 char. in my case) are filled with underlines. It does not look very nice!
I use following code inside a few webpages:
{source}
<span style="font-size: 14pt;font-family:Dosis">
<?php $db=JFactory::getDBO(); $db->
setQuery("SELECT * FROM cf_EingabeVeranstaltungen where veranstaltung_art !='Interessenmeldung' and (durchfuehrungsdatum1 >=CURDATE() or durchfuehrungsdatum2 >=CURDATE()) order by durchfuehrungsdatum1 asc"); $cf_id = $db->loadObjectList();
include_once "Auswerteroutine.php";
?>
{/source}
The variable "veranstaltungs_art" changes from page to page.
The following code "Auswerteroutine.php" is the same for all my pages:
<?php
/**
* @author Adriano Devide
* @copyright Copyright (C) 2016 Adriano Devide, Windisch
* Erzeugt ein Liste der in der Datenbanktabelle gespeicherten Daten
* formatiert diese und ergänzt es mit Meldungen über Anmeldung und eventuelle Teilnehmerliste
*/
if (count($cf_id)> 0) { ?>
<div style="text-align: left; color: #ff0006; font-family: Dosis; font-size: 14pt;">
<table class="tg" style="margin-right: auto; margin-left: auto;">
<tbody>
<?php $cnt=1;
foreach ($cf_id as $item) {
if($cnt==11) break; ?>
<tr class="ms_row<?php echo ($cnt%2); ?>">
<td class="tg-6wtj">
<span style="color: #000000; font-family: Dosis; font-size: 14pt; text-align:center;">
<?php echo $item->durchfuehrungstag1." ";
$newDate=date( "d-m-Y", strtotime($item->durchfuehrungsdatum1 ));
echo $newDate;?>
<br />
<?php if ($item->veranstaltung_art == '4 TR'){
?> bis
<br />
<?php } ?>
<?php if ($item->durchfuehrungsdatum2 >0) {
echo $item->durchfuehrungstag2." ";
$newDate = date("d-m-Y", strtotime($item->durchfuehrungsdatum2));
echo $newDate; ?>
<br />
<?php } ?>
<?php if ($item->durchfuehrungsdatum3 >0) {
echo $item->durchfuehrungstag3." ";
$newDate = date("d-m-Y", strtotime($item->durchfuehrungsdatum3));
echo $newDate; ?>
<br />
<?php } ?>
</span>
</td>
<td class="tg-6wtj">
<?php if (($item->veranstaltung_art == 'Montagstreff')|| ($item->veranstaltung_art == 'Interessenmeldung')||($item->veranstaltung_art == 'VortragComputeria')) { ?>
<div style="text-align: left; color: #ff0006; font-family: Dosis; font-size: 14pt;">
<a href="components/com_chronoforms5/chronoforms/uploads/<?php echo $item->datei_flyer?> " target="_blank">
<strong>
<?php echo str_replace(".pdf","",$item->beschreibung)?>
</strong>
</div>
</td>
<td>
<div style="text-align: left; color: #ff0006; font-family: Dosis; font-size: 12pt;">
Anmeldung nicht notwendig.
</div>
</td>
<td>
</td>
<?php }
else if (($item->datei_flyer =='')|| ($item->freigabe_anmeldung == '')){ ?>
<div style="text-align: left; color: #ff0006; font-family: Dosis; font-size: 14pt;">
<a href="components/com_chronoforms5/chronoforms/uploads/<?php echo $item->datei_flyer?> " target="_blank">
<strong>
<?php
/* header('Content-type: text/html; charset=utf-8'); */
echo str_replace(".pdf","",$item->beschreibung)?>
</strong>
</div>
</td>
<td>
<div style="text-align: left; color: #ff0006; font-family: Dosis; font-size: 12pt;">
Anmeldung noch nicht möglich.
</div>
</td>
<td>
</td> <?php
}
else { ?>
<div style="text-align: left; color: #ff0006; font-family: Dosis; font-size: 14pt;">
<a href="components/com_chronoforms5/chronoforms/uploads/<?php echo $item->datei_flyer?> " target="_blank">
<strong>
<?php echo str_replace(".pdf","",$item->beschreibung)?>
</strong>
</div>
</td>
<td>
<div style="text-align: left; color: #ff0006; font-family: Dosis; font-size: 12pt;">
<?php if ($item->freigabe_anmeldung == '1'){?>
Hier anmelden:
<?php
/* header('Content-type: text/html; charset=utf-8'); */
if ($item->veranstaltung_art=='Exkursion'){ ?> <a href="index.php/2-uncategorised/103-anmeldeform_Exkursion?&$form_typ=<?php echo str_replace(".pdf","",$item->beschreibung)?>" target="_blank"> <img src="images/pfeil_links.png" alt="pfeil links" width="24" height="24" /> <?php }
else if ($item->veranstaltung_art=='4 TR'){ ?> <a href="index.php/2-uncategorised/102-anmeldeform_4TR?&$form_typ=<?php echo str_replace(".pdf","",$item->beschreibung)?>" target="_blank"> <img src="images/pfeil_links.png" alt="pfeil links" width="24" height="24" /> <?php }
else if ($item->veranstaltung_art=='KulturAnlass'){ ?> <a href="index.php/2-uncategorised/66-anmeldeform_einfach?&$form_typ=<?php echo str_replace(".pdf","",$item->beschreibung)?>" target="_blank"> <img src="images/pfeil_links.png" alt="pfeil links" width="24" height="24" /> <?php }
else if ($item->veranstaltung_art=='Vortrag'){ ?> <a href="index.php/2-uncategorised/66-anmeldeform_einfach?&$form_typ=<?php echo str_replace(".pdf","",$item->beschreibung)?>" target="_blank"> <img src="images/pfeil_links.png" alt="pfeil links" width="24" height="24" /> <?php }
else if ($item->veranstaltung_art=='Wanderung'){ ?> <a href="index.php/2-uncategorised/109-anmeldeform_wanderung?&$form_typ=<?php echo str_replace(".pdf","",$item->beschreibung)?>" target="_blank"> <img src="images/pfeil_links.png" alt="pfeil links" width="24" height="24" /> <?php }
else if ($item->veranstaltung_art=='Baldegghock'){ ?> <a href="index.php/2-uncategorised/66-anmeldeform_einfach?&$form_typ=<?php echo str_replace(".pdf","",$item->beschreibung)?>" target="_blank"> <img src="images/pfeil_links.png" alt="pfeil links" width="24" height="24" /> <?php }
else if ($item->veranstaltung_art=='8090100'){ ?> <a href="index.php/2-uncategorised/66-anmeldeform_einfach?&$form_typ=<?php echo str_replace(".pdf","",$item->beschreibung)?>" target="_blank"> <img src="images/pfeil_links.png" alt="pfeil links" width="24" height="24" /> <?php }
else if ($item->veranstaltung_art=='JA'){ ?> <a href="index.php/2-uncategorised/66-anmeldeform_einfach?&$form_typ=<?php echo str_replace(".pdf","",$item->beschreibung)?>" target="_blank"> <img src="images/pfeil_links.png" alt="pfeil links" width="24" height="24" /> <?php }
else if ($item->veranstaltung_art=='JV'){ ?> <a href="index.php/2-uncategorised/100-anmeldeform_JV?&$form_typ=<?php echo str_replace(".pdf","",$item->beschreibung)?>" target="_blank"> <img src="images/pfeil_links.png" alt="pfeil links" width="24" height="24" /> <?php }
else if ($item->veranstaltung_art=='WorkshopComputeria'){ ?> <a href="index.php/2-uncategorised/99-anmeldeform_WSC?&$form_typ=<?php echo str_replace(".pdf","",$item->beschreibung)?>" target="_blank"> <img src="images/pfeil_links.png" alt="pfeil links" width="24" height="24" /> <?php }
else if ($item->veranstaltung_art=='KKL'){ ?> <a href="index.php/2-uncategorised/101-anmeldeform_KKL?&$form_typ=<?php echo str_replace(".pdf","",$item->beschreibung)?>" target="_blank"> <img src="images/pfeil_links.png" alt="pfeil links" width="24" height="24" /> <?php }
else if ($item->veranstaltung_art=='KurzW'){ ?> <a href="index.php/2-uncategorised/108-anmeldeform_KurzW?&$form_typ=<?php echo str_replace(".pdf","",$item->beschreibung)?>" target="_blank"> <img src="images/pfeil_links.png" alt="pfeil links" width="24" height="24" /> <?php }
else{
echo "Keine Anmeldung möglich!";}
}
?>
</div>
</td>
<td>
<?php
$user=JFactory::getUser();
jimport( 'joomla.user.helper' );
$userID=$user->id; $userProfile = JUserHelper::getProfile($userId);
if ($userProfile->profile['uservor']=='')
{$usr=gast;}
if(( $item->teilnehmerliste !=='')&&($usr!='gast')){ ?>
<div style="text-align: left; color: #ff0006; font-family: Dosis; font-size: 12pt;">
Stand der Anmeldungen:
<a href="components/com_chronoforms5/chronoforms/uploads/<?php echo $item->teilnehmerliste?> " target="_blank">
<img src="images/pfeil_rechts.png" alt="" width="25" height="24" />
</div>
<?php }?>
</td> <?php } ?>
</tr>
<? $cnt++;} ?>
</tbody>
</table>
</div> <? }
else { ?>
<div style="border:none; font-family: Dosis; font-size: 14pt;color: #ff0006;">
Informationen folgen sobald bekannt.
</div> <? } ?>
</span>