Analysis:
We use a file (data.dat) to store the voting columns. Each column occupies one line.
In this way, you can add and subtract the columns you want to vote at will.
We will then Use a file (votes.dat) to store our voting results.
And record the IP address of the latest voter to simply prevent one person from voting more than once.
So, you should create it yourself in the program directory Two files data.dat and votes.dat
Part of the program running process
When the program is running, there should first be a voting HTML form, waiting for voting.
When someone votes on the HTML form, determine its Whether the IP is the IP of the most recent voter,
If this person has just voted, the two values should be equal, showing "You have already voted, thank you for your participation!"
If this person has just voted If you have not voted, the two values are not equal, write its vote to the file (votes.dat)
(The method to get the voter’s IP here is: the Web client needs to provide a table when sending a request to the server
This representation is stored in the environment variable REMOTE_ADDR, we can just reference it.)
Finally, the voting results are displayed. Usually we use "bar chart + percentage" to display the voting situation.
So, we need to choose a rectangular shape with a single color to adapt to the requirements of horizontal scaling.
-------------------------- -------------------------------------------------- ----
The program code part can be downloaded
//The voting column stores the file, you can change the file name
$data="data.dat";
//The voting result storage file
$votes="votes.dat";
//Graphic file name used to display the proportion of voting results,
//It is better to use a single-color rectangle to facilitate horizontal scaling of voting results,
//Upload it to the directory of this program by yourself
$path_img="vote.gif";
//Poll title
$poll_name="Which of my columns do you like?";
// The following parts do not need to be changed //
//Open the voting column file and save all the contents in the variable $dataf in the form of an array for later use.
$dataf=file($data);
if ( $go !=1)
{
//Display voting program form
echo "$poll_name
n";
echo "
echo "View results";
}
else
{
// $go==1 means someone voted, // Now it will The votes are read from the file in another way $file_votes=fopen($votes, "r");
$line_votes=fgets($file_votes, 255);
fclose($file_votes);
// Cut the data according to the specified string, and then transfer the string back to the array variable
$single_vote=explode("|", $line_votes);
//Prepare to write the voting results
if ($result!=1)
{
//Check if the IP address is duplicated
$file_votes=file($votes, "r");
if ($REMOTE_ADDR == $file_votes[1])
{
echo "
exit;
}
//If the IP is not repeated, execute the following procedure
$ficdest=fopen($votes, "w") ;
for ($i=0; $i{
//Judge which column to vote for
if ($i == $ vote)
{
$single_vote[$i]+=1;
}
//Write the data back to the file
fputs($ficdest, "$single_vote[$i]|" );
}
//Write the voter IP
fputs($ficdest, "n$REMOTE_ADDR");
fclose($ficdest);
$result=1; // Voting successful
}
//Write the voting results and display the voting results
if ($result==1)
{ echo "
"; echo " ![]() //Output percentage printf("%.1f", "$stat[$i]"); echo "% | < ;td align=center>"; //Output the number of votes in this column
";
echo "Total votes: $tot_votes ";
}
}
?>

硬盘序列号是硬盘的一个重要标识,通常用于唯一标识硬盘以及进行硬件识别。在某些情况下,我们可能需要查询硬盘序列号,比如在安装操作系统、查找正确设备驱动程序或进行硬盘维修等情况下。本文将介绍一些简单的方法,帮助大家查询硬盘序列号。方法一:使用Windows命令提示符打开命令提示符。在Windows系统中,按下Win+R键,输入"cmd"并按下回车键即可打开命

技嘉的主板怎么设置键盘开机首先,要支持键盘开机,一定是PS2键盘!!设置步骤如下:第一步:开机按Del或者F2进入bios,到bios的Advanced(高级)模式普通主板默认进入主板的EZ(简易)模式,需要按F7切换到高级模式,ROG系列主板默认进入bios的高级模式(我们用简体中文来示范)第二步:选择到——【高级】——【高级电源管理(APM)】第三步:找到选项【由PS2键盘唤醒】第四步:这个选项默认是Disabled(关闭)的,下拉之后可以看到三种不同的设置选择,分别是按【空格键】开机、按组

1.处理器在选择电脑配置时,处理器是至关重要的组件之一。对于玩CS这样的游戏来说,处理器的性能直接影响游戏的流畅度和反应速度。推荐选择IntelCorei5或i7系列的处理器,因为它们具有强大的多核处理能力和高频率,可以轻松应对CS的高要求。2.显卡显卡是游戏性能的重要因素之一。对于射击游戏如CS而言,显卡的性能直接影响游戏画面的清晰度和流畅度。建议选择NVIDIAGeForceGTX系列或AMDRadeonRX系列的显卡,它们具备出色的图形处理能力和高帧率输出,能够提供更好的游戏体验3.内存电

广联达软件是一家专注于建筑信息化领域的软件公司,其产品被广泛应用于建筑设计、施工、运营等各个环节。由于广联达软件功能复杂、数据量大,对电脑的配置要求较高。本文将从多个方面详细阐述广联达软件的电脑配置推荐,以帮助读者选择适合的电脑配置处理器广联达软件在进行建筑设计、模拟等操作时,需要进行大量的数据计算和处理,因此对处理器的要求较高。推荐选择多核心、高主频的处理器,如英特尔i7系列或AMDRyzen系列。这些处理器具有较强的计算能力和多线程处理能力,能够更好地满足广联达软件的需求。内存内存是影响计算

如何通过PHP编写一个简单的在线预约系统随着互联网的普及和用户对便利性的追求,在线预约系统越来越受到欢迎。无论是餐厅、医院、美容院还是其他服务行业,都可以通过一个简单的在线预约系统来提高效率并为用户提供更好的服务体验。本文将介绍如何使用PHP编写一个简单的在线预约系统,并提供具体的代码示例。创建数据库和表格首先,我们需要创建一个数据库来存储预约信息。在MyS

如何使用Java编写一个简单的学生成绩报表生成器?学生成绩报表生成器是一个可以帮助老师或教育者快速生成学生成绩报告的工具。本文将介绍如何使用Java编写一个简单的学生成绩报表生成器。首先,我们需要定义学生对象和学生成绩对象。学生对象包含学生的姓名、学号等基本信息,而学生成绩对象则包含学生的科目成绩和平均成绩等信息。以下是一个简单的学生对象的定义:public

快速入门:使用Go语言函数实现简单的图书管理系统引言:随着计算机科学领域的不断发展,软件应用的需求也越来越多样化。图书管理系统作为一种常见的管理工具,也成为很多图书馆、学校和企业必备的系统之一。在本文中,我们将使用Go语言函数来实现一个简单的图书管理系统。通过这个例子,读者可以学习到Go语言中函数的基本用法以及如何构建一个实用的程序。一、设计思路:我们首先来

如何通过C++编写一个简单的音乐推荐系统?引言:音乐推荐系统是现代信息技术的一个研究热点,它可以根据用户的音乐偏好和行为习惯,向用户推荐符合其口味的歌曲。本文将介绍如何使用C++编写一个简单的音乐推荐系统。一、收集用户数据首先,我们需要收集用户的音乐偏好数据。可以通过在线调查、问卷调查等方式来获得用户对不同类型音乐的喜好程度。将数据保存在一个文本文件或数据库


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
