Home Backend Development PHP Tutorial PHP implements shake roll call program

PHP implements shake roll call program

Aug 08, 2016 am 09:28 AM
gt lt post quot

Professor Lu’s needs:

<form name="input" action="#" method="post">
Password:<input  name="auth" value="<?php echo $_POST['auth']?>" 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('Asia/Shanghai');#设置时区
//$_POST['auth']=1;
//$_GET['test']=0;#是否为测试模式 默认为否
//echo md5('1');
function ini($num)
{
	$values=parse_ini_file('name.ini');#解析ini文件 格式 : 姓名=学号
	return array_search($num,$values);#查找对应学号的姓名
}
if(md5($_POST['auth'])=='d49c880dd3d6e572ff1611f36b4ce04a')
{
error_reporting(0);
$I=$_POST['i'];#数量
for($k=0;$k<$I;$k++)
{
$r=mt_rand(1,52);
while($r==31)$r=mt_rand(1,52);
echo '<img src="'.$r.'.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.

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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What are the differences between Huawei GT3 Pro and GT4? What are the differences between Huawei GT3 Pro and GT4? Dec 29, 2023 pm 02:27 PM

What are the differences between Huawei GT3 Pro and GT4?

Fix: Snipping tool not working in Windows 11 Fix: Snipping tool not working in Windows 11 Aug 24, 2023 am 09:48 AM

Fix: Snipping tool not working in Windows 11

A brief analysis of the POST method in PHP with parameters to jump to the page A brief analysis of the POST method in PHP with parameters to jump to the page Mar 23, 2023 am 09:15 AM

A brief analysis of the POST method in PHP with parameters to jump to the page

How to determine whether a post has been submitted in PHP How to determine whether a post has been submitted in PHP Mar 21, 2023 pm 07:12 PM

How to determine whether a post has been submitted in PHP

How to Fix Can't Connect to App Store Error on iPhone How to Fix Can't Connect to App Store Error on iPhone Jul 29, 2023 am 08:22 AM

How to Fix Can't Connect to App Store Error on iPhone

How to use python requests post How to use python requests post Apr 29, 2023 pm 04:52 PM

How to use python requests post

How does java initiate an http request and call the post and get interfaces? How does java initiate an http request and call the post and get interfaces? May 16, 2023 pm 07:53 PM

How does java initiate an http request and call the post and get interfaces?

How to solve the problem that NGINX reverse proxy returns 405 for POST request of HTML page How to solve the problem that NGINX reverse proxy returns 405 for POST request of HTML page May 22, 2023 pm 07:49 PM

How to solve the problem that NGINX reverse proxy returns 405 for POST request of HTML page

See all articles