Lovecalculator
Auteur: Insane - 26 september 2004 - 18:59 - Gekeurd door: Dennisvb - Hits: 3931 - Aantal punten: 2.30 (5 stemmen)
Kijken of je bij degene waarvan je dat denkt past!
|
Code: |
<?php
$letters = array();
$letters['a'] = 3;
$letters['b'] = 6;
$letters['c'] = 8;
$letters['d'] = 4;
$letters['e'] = 1;
$letters['f'] = 5;
$letters['g'] = 9;
$letters['h'] = 6;
$letters['i'] = 5;
$letters['j'] = 9;
$letters['k'] = 4;
$letters['l'] = 6;
$letters['m'] = 6;
$letters['n'] = 3;
$letters['o'] = 5;
$letters['p'] = 5;
$letters['q'] = 2;
$letters['r'] = 8;
$letters['s'] = 10;
$letters['t'] = 10;
$letters['u'] = 7;
$letters['v'] = 3;
$letters['w'] = 4;
$letters['x'] = 10;
$letters['y'] = 10;
$letters['z'] = 5;
?><html>
<head>
<title>Love Calculator</title>
<style>
body {
font-family: verdana;
font-size: 11px;
}
table {
font-family: verdana;
font-size: 11px;
}
</style>
</head>
<body>
<center>
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$naam[1] = $_POST['naam'][1];
$naam[2] = $_POST['naam'][2];
if(!empty($naam[1]) && !empty($naam[2]))
{
$naam[1] = strtolower($naam[1]);
$naam[2] = strtolower($naam[2]);
$naam[1] = wordwrap ($naam[1], 1, ',', 1);
$naam[2] = wordwrap ($naam[2], 1, ',', 1);
$naam[1] = explode(',', $naam[1]);
$naam[2] = explode(',', $naam[2]);
//Naam 1
$lengte[1] = count($naam[1]);
foreach($naam[1] as $key => $value)
{
$aantal[1] = $aantal[1]+$letters[$value];
}
$procent[1] = $aantal[1]/$lengte[1]*10;
//Naam 2
$lengte[2] = count($naam[2]);
foreach($naam[2] as $key => $value)
{
$aantal[2] = $aantal[2]+$letters[$value];
}
$procent[2] = $aantal[2]/$lengte[2]*10;
//Love
$procent = round(($procent[1]+$procent[2])/2, 2);
$echo = '<br>'.$_POST['naam'][1].' en '.$_POST['naam'][2].' passen '.$procent.'% bij elkaar!<br><br>';
}
else
{
$echo = 'Je moet allebei de namen invullen!';
}
}
?>
<form method="POST" action="<?=$_SERVER['REQUEST_URI'];?>" name="love">
<table width="60%" border=0>
<tr>
<td colspan=2 align=center>
<B>Love-calculator</B>
</td>
</tr>
<tr>
<td colspan=2 align=center>
<?=$echo;?>
</td>
</tr>
<tr>
<td width="30%" align=center>
<B>Persoon 1</B>
</td>
<td width="30%" align=center>
<B>Persoon 2</B>
</td>
</tr>
<tr>
<td width="30%" align=center>
<input type=text name=naam[1]>
</td>
<td width="30%" align=center>
<input type=text name=naam[2]>
</td>
</tr>
<tr>
<td colspan=2 align=center>
<input type=submit value="Uitrekenen">
</td>
</tr>
</table>
</form>
</body>
</html>
<?php $letters['a'] = 3; $letters['b'] = 6; $letters['c'] = 8; $letters['d'] = 4; $letters['e'] = 1; $letters['f'] = 5; $letters['g'] = 9; $letters['h'] = 6; $letters['i'] = 5; $letters['j'] = 9; $letters['k'] = 4; $letters['l'] = 6; $letters['m'] = 6; $letters['n'] = 3; $letters['o'] = 5; $letters['p'] = 5; $letters['q'] = 2; $letters['r'] = 8; $letters['s'] = 10; $letters['t'] = 10; $letters['u'] = 7; $letters['v'] = 3; $letters['w'] = 4; $letters['x'] = 10; $letters['y'] = 10; $letters['z'] = 5; ?><html> <head> <title>Love Calculator</title> <style> body { font-family: verdana; font-size: 11px; } table { font-family: verdana; font-size: 11px; } </style> </head> <body> <center> <?php if($_SERVER['REQUEST_METHOD'] == 'POST') { $naam[1] = $_POST['naam'][1]; $naam[2] = $_POST['naam'][2]; { $naam[1] = wordwrap ($naam[1], 1, ',', 1); $naam[2] = wordwrap ($naam[2], 1, ',', 1); //Naam 1 $lengte[1] = count($naam[1]); foreach($naam[1] as $key => $value) { $aantal[1] = $aantal[1]+$letters[$value]; } $procent[1] = $aantal[1]/$lengte[1]*10; //Naam 2 $lengte[2] = count($naam[2]); foreach($naam[2] as $key => $value) { $aantal[2] = $aantal[2]+$letters[$value]; } $procent[2] = $aantal[2]/$lengte[2]*10; //Love $procent = round(($procent[1]+$procent[2])/2, 2); $echo = '<br>'.$_POST['naam'][1].' en '.$_POST['naam'][2].' passen '.$procent.'% bij elkaar!<br><br>'; } else { $echo = 'Je moet allebei de namen invullen!'; } } ?> <form method="POST" action="<?=$_SERVER['REQUEST_URI'];?>" name="love"> <table width="60%" border=0> <tr> <td colspan=2 align=center> <B>Love-calculator</B> </td> </tr> <tr> <td colspan=2 align=center> <?=$echo;?> </td> </tr> <tr> <td width="30%" align=center> <B>Persoon 1</B> </td> <td width="30%" align=center> <B>Persoon 2</B> </td> </tr> <tr> <td width="30%" align=center> <input type=text name=naam[1]> </td> <td width="30%" align=center> <input type=text name=naam[2]> </td> </tr> <tr> <td colspan=2 align=center> <input type=submit value="Uitrekenen"> </td> </tr> </table> </form> </body> </html>
Download code (.txt)
|
|
|
Stemmen |
Niet ingelogd. |
|