Home > Backend Development > PHP Tutorial > PHP implements shake roll call program

PHP implements shake roll call program

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-08-08 09:28:30
Original
1485 people have browsed it

Professor Lu’s needs:

<form name="input" action="#" method="post">
Password:<input  name="auth" value="<?php echo $_POST[&#39;auth&#39;]?>" type="password"><br>
Number:<input type="text" name="i"><br>
Work:<input type="text" name="id">
<input type="submit" value="Submit" /></form>
<?php
//echo md5("ojtest");
date_default_timezone_set(&#39;Asia/Shanghai&#39;);#设置时区
//$_POST[&#39;auth&#39;]=1;
//$_GET[&#39;test&#39;]=0;#是否为测试模式 默认为否
//echo md5(&#39;1&#39;);
function ini($num)
{
	$values=parse_ini_file(&#39;name.ini&#39;);#解析ini文件 格式 : 姓名=学号
	return array_search($num,$values);#查找对应学号的姓名
}
if(md5($_POST[&#39;auth&#39;])==&#39;d49c880dd3d6e572ff1611f36b4ce04a&#39;)
{
error_reporting(0);
$I=$_POST[&#39;i&#39;];#数量
for($k=0;$k<$I;$k++)
{
$r=mt_rand(1,52);
while($r==31)$r=mt_rand(1,52);
echo &#39;<img src="&#39;.$r.&#39;.jpg"/><br>';//<img src="1.jpg" height=100 width=100 >
if($r>26)$r=3200+$r-26;
else $r=3100+$r;
echo $r."<br>".ini($r)."<br>";
$nm=ini($r);
//file_put_contents("./data.txt",$r);
//file_put_contents("./data.txt","\r\n");
$tim=date("y-m-d H:i:s");
$f=fopen("./data.xls", "a");
$id=$_POST['id'];
// $id;
if($id==NULL)fclose($f);
fwrite($f,"$r\t$nm\t$tim\t$id\r\n");#便于用excel打开
fclose($f);
}
}

?>
Copy after login

The above introduces the implementation of the shake roll call program in PHP, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template