<?php
//Xml
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml" />
<link rel="stylesheet" type="text/css" href="/style.css" media="screen" />
<title>Num Pad Convert</title>
</head>
<body>
<h1 class="center">Convertion de texte en numérique de téléphone portable</h1>
<h2>(Ex : jtm = 586)</h2>
<form method="get" action="num.php">
<p>
Message original :
<br />
<textarea name="msg" rows="3" cols="35"><?php if(isset($_GET['msg'])) echo $_GET['msg']; ?></textarea>
</p>
<p>
Message converti :
<br />
<textarea name="res" rows="3" cols="35"><?php
//Converte table
$tab[' '] = "#";
$tab['.'] = "1";
$tab['+'] = "0";
$tab['a'] = $tab['A'] = "2";
$tab['b'] = $tab['B'] = "22";
$tab['c'] = $tab['C'] = "222";
$tab['d'] = $tab['D'] = "3";
$tab['e'] = $tab['E'] = "33";
$tab['f'] = $tab['F'] = "333";
$tab['g'] = $tab['G'] = "4";
$tab['h'] = $tab['H'] = "44";
$tab['i'] = $tab['I'] = "444";
$tab['j'] = $tab['J'] = "5";
$tab['k'] = $tab['K'] = "55";
$tab['l'] = $tab['L'] = "555";
$tab['m'] = $tab['M'] = "6";
$tab['n'] = $tab['N'] = "66";
$tab['o'] = $tab['O'] = "666";
$tab['p'] = $tab['P'] = "7";
$tab['q'] = $tab['Q'] = "77";
$tab['r'] = $tab['R'] = "777";
$tab['s'] = $tab['S'] = "7777";
$tab['t'] = $tab['T'] = "8";
$tab['u'] = $tab['U'] = "88";
$tab['v'] = $tab['V'] = "888";
$tab['w'] = $tab['W'] = "9";
$tab['x'] = $tab['X'] = "99";
$tab['y'] = $tab['Y'] = "999";
$tab['z'] = $tab['Z'] = "9999";
if(isset($_GET['msg']))
{
//Out message
$msg = "";
//Loop on each char
for($i = 0; $i <= strlen($_GET['msg']); $i++)
{
//Get char
$c = substr($_GET['msg'], $i, 1);
//Convert char
if(isset($tab[$c]))
$msg .= $tab[$c] . " ";
}
//Display message
echo $msg;
}
?></textarea>
</p>
<p>
<input type="submit" value="Convertir" />
</p>
</form>
<hr />
<p>
© SulphurEagle 2008 : GPL
</p>
<p>
<a href="http://validator.w3.org/check?uri=referer">
<img src="http://www.w3.org/Icons/valid-xhtml11-blue"
alt="Valid XHTML 1.1" height="31" width="88" />
</a>
</p>
</body>
</html>