5.
@东城,<?php
header("content-type:text/html;charset=UTF-8");
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "
http://www.wapforum.org/DTD/xhtml-mobile10.dtd">';
echo '<html xmlns="
http://www.w3.org/1999/xhtml">';
?>
<head>
<title>生肖星座计算</title>
<head>
<body><hr/>
<?php
if(isset($_GET['a'])==null)
{main0();}
else if($_GET['a']=='1')
{main1();}
else{
echo '传值错误!<br/>';
}
function main0()
{
echo <<<INPUT
<form action="{$_SERVER['PHP_SELF']}?a=1" method="post">
输入出生年月日(例19950106):<br/>
<input name="b" size="20"/><br/>
<input type="submit" value="计算"/><br/>
</form>
INPUT;
}
function main1()
{
$b=$_REQUEST['b'];
$nian=substr("$b",-8,-4);
$y=substr("$b",-4,4);
echo '生肖:'.shengxiao($nian).'<br/>星座:'.xingzuo($y).'座<br/>';
}
function shengxiao($nian)
{
$all=Array('猪','鼠','牛','虎','兔','龙','蛇','马','羊','猴','鸡','狗','猪');
$n=$nian-3;
$n=$n%12;
return $all[$n];
}
function xingzuo($y)
{
if($y>=120 && $y<=218)
{$x='水瓶';}
elseif($y>=219 && $y<=320)
{$x='双鱼';}
elseif($y>=321 && $y<=419)
{$x='白羊';}
elseif($y>=420 && $y<=520)
{$x='金牛';}
elseif($y>=521 && $y<=621)
{$x='双子';}
elseif($y>=622 && $y<=722)
{$x='巨蟹';}
elseif($y>=723 && $y<=822)
{$x='狮子';}
elseif($y>=823 && $y<=922)
{$x='处女';}
elseif($y>=923 && $y<=1023)
{$x='天秤';}
elseif($y>=1024 && $y<=1122)
{$x='天蝎';}
elseif($y>=1123 && $y<=1221)
{$x='射手';}
elseif(($y>=1222 && $y<=1231) || ($y>=101 && $y<=119))
{$x='摩羯';}
else{
$x='●未知●';
}
return $x;
}
?>
<hr/>
</html>
6. 我记得之前在网上见过类似源码,不过是javascript的