<?php
error_reporting(0); // 0 = none, 63 = full
//DB-Information
//insert your DB configuration here
$database = "1234";
$username = "1234";
$password = "1234";
$hostname = "db.123.de";
$maxlinks=10; // Sets amount of links per page
// nothing else needs to be configured below
// some usefull functions
// Output Header with no caching
function headerNoCache() {
// set the correct MIME type
header("Content-type: text/vnd.wap.wml");
// expires in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Last modified, right now
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// Prevent caching, HTTP/1.1
header("Cache-Control: max-age=0");
// Prevent caching, HTTP/1.0
header("Pragma: no-cache");
// Set Document Type Definition (DTD)
echo("<?xml version=\"1.0\"?>\n");
echo("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"
\"http://www.wapforum.org/DTD/wml_1.1.xml\">\n\n");
}
// Check, if a user is already in DB and return UUID
function checkAuth($user, $pwd, $db) {
// Query Database
$result = mysql_query("SELECT UUID FROM passuser
WHERE user='$user' AND pwd='$pwd'", $db);
// If no value, output error message
$row = mysql_fetch_row($result) or die("
<wml>
<card id=\"c1\" title=\"Login\">
<p>
Die eingegebenen Login-Informationen
sind inkorrekt. Bitte versuchen Sie es erneut.<br/>
<a href=\"index.php4\">Zurück</a>
</p>
<do type=\"prev\" label=\"Zurück\"><prev/></do>
</card>
</wml>");
return $row[0];
}
// Convert Text to Unicode
function string2unicode ($text) {
for ($i=0;$i<strlen($text);$i++) {
$a=substr($text,$i,1); // Extract one single Character
// change special chars above dec 126 to Unicode
if (ord($a) > 126) {
$text = substr_replace ($text, "&#".ord($a).";", $i, 1);
$i=$i+5;
}
// Delete special chars below dec. 32 and above 255
if ((ord($a) < 32) || (ord($a) > 255)) {
$text = substr_replace($text, " ", $i, 1);
}
// Additionally change some other characters
if ($a == "\"") {
$text = substr_replace ($text, "&#".ord($a).";", $i, 1);
$i=$i+4;
};
if ($a == "\'") {
$text = substr_replace ($text, "&#".ord($a).";", $i, 1);
$i=$i+4;
};
if ($a == "<") {
$text = substr_replace ($text, "&#".ord($a).";", $i, 1);
$i=$i+4;
};
if ($a == ">") {
$text = substr_replace ($text, "&#".ord($a).";", $i, 1);
$i=$i+4;
};
if ($a == "&") {
$text = substr_replace ($text, "&#".ord($a).";", $i, 1);
$i=$i+4;
};
if ($a == "\$") { // $ must be $$
$text = substr_replace ($text, "\$\$", $i, 1);
$i=$i+1;
};
}
return $text;
}
?>