File: D:/HostingSpaces/SBogers44/ledubtoernooi.nl/wwwroot/minikamp/converter/converter.php
<?php
/**
* Created by PhpStorm.
* User: joepvanhunsel
* Date: 12-02-14
* Time: 10:38
*/
$output = "";
if(isset($_POST['tekst'])){
$tekst = $_POST['tekst'];
$str = encodeForDb($tekst);
$output = str_replace("&","&",$str);
}
function encodeForDb($str)
{
// Remove whitespace
$str = trim($str);
// Convert html text to utf-8 special characters
$str = htmlentities($str, ENT_NOQUOTES, 'utf-8');
// Keep html tags
$str = str_replace("<","<",$str);
$str = str_replace(">",">",$str);
$str = str_replace("&","&",$str);
return $str;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="Author" content="Komma, (c) Komma Mediadesign, 2013. All Rights Reserved." />
<meta name="Subject" content="utf-8 converter" />
<meta name="Description" content="utf-8 converter" />
<meta name="Language" content="Nederlands" />
<title>Converter</title>
</head>
<body>
<h2>converter</h2>
<?php if ($output != "")
{
echo ($output);
}
?>
<br/>
<br />
<form method="post" action="converter.php">
<textarea name="tekst" cols=80 rows=10></textarea>
<input type="submit">
</form>
</body>
</html>