Файл: play/service/name.php
Строк: 35
<?
include '../../connect.php';
$location = '(Слушает радиио)';
if(!$u['id']){
header ("Location: /registration.php?err=1");
exit;
}
require_once("../../core/ip.php");
$title = $title . ' : Совместимость имен';
require_once("../../head.php");
function calc_names($name1, $name2) {
$num1 = 0;
$num2 = 0;
$base = array("0" => 0, "1" => 1, "2" => 2, "3" => 3, "4" => 4, "5" => 5, "6" => 6, "7" => 7, "8" => 8, "9" => 9, "a" => 10, "b" => 11, "c" => 12, "d" => 13, "e" => 14, "f" => 15);
$md1 = md5($name1);
$md2 = md5($name2);
for($i = 0; $i < 32; $i++) {
$value = $base[substr($md1, $i, 1)];
$num1 += $value;
}
for($j = 0; $j < 32; $j++) {
$value = $base[substr($md2, $j, 1)];
$num2 += $value;
}
return 100 - round(abs(ceil($num1 / 3.1) - ceil($num2 / 3.1)) * 3);
}
if($_POST['ot'] == NULL AND $_POST['do'] == NULL){
$ot = 'Саша';
$do = 'Маша';
}else{
$ot = htmlspecialchars($_POST['ot']);
$do = htmlspecialchars($_POST['do']);
}
if(isset($_POST['submit'])){
$result = 'Результат: <b>'.$ot.' + '.$do.' = '.calc_names($_POST['ot'], $_POST['do']).'%</b><hr />';
}
echo '<div class="div"><form method="post">'.$result.'
Ваше имя:<br />
<input type="text" name="ot" value="'.$ot.'" /><br />
Имя вашей половинки:<br />
<input type="text" name="do" value="'.$do.'" /><br />
<input type="submit" name="submit" value="Получить" /> <input type="submit" name="refresh" value="Обновить" /></form></div>';
echo"<div class='div'>- <a href='/play/service/'> Вернутся назад</a></div>";
include_once '../../foot.php';
?>