This commit is contained in:
parent
ea7fc186db
commit
753e994d02
|
@ -10,6 +10,11 @@
|
|||
<option name="highlightLevel" value="WARNING" />
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpIncludePathManager">
|
||||
<include_path>
|
||||
<path value="$PROJECT_DIR$/../../bin/php/php8.2.13/includes" />
|
||||
</include_path>
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="8.2" />
|
||||
<component name="PhpStanOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
|
|
20
12.test1.php
20
12.test1.php
|
@ -1,9 +1,17 @@
|
|||
<?php
|
||||
//require_once ('jpgraph\jpgraph.php');
|
||||
//require_once ('jpgraph\jpgraph_pie.php');
|
||||
header("Content-type: image/gif");
|
||||
$im = imagecreate(200,60); //创建一个画布
|
||||
$grey = imagecolorallocate($im, 255,255,255); //设置画布的背景颜色为灰色
|
||||
imagegif($im); //输出图像
|
||||
imagedestroy($im);
|
||||
?>
|
||||
//header("Content-type: image/gif");
|
||||
//$im = imagecreate(200, 60);
|
||||
//$grey = imagecolorallocate($im, 255, 255, 255);
|
||||
//imagegif($im);
|
||||
//imagedestroy($im);
|
||||
|
||||
header("content-type:image/jpeg");
|
||||
$im = imagecreatefromjpeg("images/photo.jpg");
|
||||
$textcolor = imagecolorallocate($im,56,73,136);
|
||||
$fnt = "fonts/NotoSansSC-VariableFont_wght.ttf";
|
||||
$motto = "长白山天池";
|
||||
imagettftext($im,220,0,540,340,$textcolor,$fnt,$motto);
|
||||
imagejpeg($im);
|
||||
imagedestroy($im);
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
session_start();
|
||||
header("content-type:image/png");
|
||||
$image_width = 70;
|
||||
$image_height = 18;
|
||||
$new_number = "";
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
$k = rand(0, 2);
|
||||
if ($k == 0) { //小写字母
|
||||
$new_number .= chr(rand(97, 122));
|
||||
} else if ($k == 1) { //大写字母
|
||||
$new_number .= chr(rand(65, 90));
|
||||
} else { //数字
|
||||
$new_number .= chr(rand(48, 57));
|
||||
}
|
||||
|
||||
}
|
||||
$_SESSION['check_checks'] = $new_number;
|
||||
$num_image = imagecreate($image_width, $image_height);
|
||||
imagecolorallocate($num_image, 255, 255, 255);
|
||||
for ($i = 0; $i < strlen($_SESSION['check_checks']); $i++) {
|
||||
$font = mt_rand(3, 5);
|
||||
$x = mt_rand(1, 8) + intdiv($image_width * $i, 4);
|
||||
$y = mt_rand(1, intdiv($image_height, 4));
|
||||
$color = imagecolorallocate($num_image, mt_rand(0, 100), mt_rand(0, 150), mt_rand(0, 200));
|
||||
imagestring($num_image, $font, $x, $y, $_SESSION['check_checks'][$i], $color);
|
||||
}
|
||||
imagepng($num_image);
|
||||
imagedestroy($num_image);
|
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
session_start();
|
||||
if (!empty($_POST['submit'])) {
|
||||
$check = $_POST['check'];
|
||||
if (strtolower(trim($check)) == strtolower($_SESSION['check_checks'])) {
|
||||
echo '<script>alert("登陆成功");window.location.href="https://bing.com"</script>';
|
||||
} else {
|
||||
echo '<script>alert("验证码错误");window.location.href="12.test2.login.php"</script>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>登录</title>
|
||||
</head>
|
||||
<body>
|
||||
<form method="post" action="">
|
||||
<table>
|
||||
<tr>
|
||||
<th colspan="2" style="text-align: center">
|
||||
<h1>用户登录</h1>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="username1">用户名</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="username1" name="username" required>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="password1">密码</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="password" name="password" id="password1" required>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="check1">验证码</label>
|
||||
</td>
|
||||
<td>
|
||||
<img src="12.test2.checks.php" alt="验证码" onclick="refresh_check()" id="captchaImage">
|
||||
<input type="text" name="check" id="check1" required size=9>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: center">
|
||||
<input type="submit" value="登录" name="submit" id="submit1" onclick="return check()">
|
||||
<input type="reset" value="重置" name="reset" id="reset1" onclick="refresh_check()">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<script>
|
||||
function refresh_check() {
|
||||
// 获取验证码图像元素
|
||||
var captchaImage = document.querySelector('#captchaImage');
|
||||
|
||||
// 生成新的时间戳,用于强制刷新图像
|
||||
var timestamp = new Date().getTime();
|
||||
|
||||
// 修改验证码图像的src属性,添加时间戳参数
|
||||
captchaImage.src = '12.test2.checks.php?timestamp=' + timestamp;
|
||||
|
||||
}
|
||||
|
||||
function check() {
|
||||
//check username and password empty
|
||||
const username = document.getElementById("username1").value;
|
||||
const password = document.getElementById("password1").value;
|
||||
const check = document.getElementById("check1").value;
|
||||
if (username === "" || password === "" || check === "") {
|
||||
alert("用户名或密码或验证码不能为空!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
require_once 'jpgraph/jpgraph.php'; //引入jpgraph类库
|
||||
require_once 'jpgraph/jpgraph_bar.php'; //引入柱状图类库
|
||||
|
||||
$datay = array(160, 180, 203, 289, 405, 488, 489, 408, 299, 166, 187, 105); //销量数据
|
||||
$graph = new Graph(600, 300, 'auto'); //创建新的Graph对象 600*300像素 自动调整大小
|
||||
$graph->SetScale('textlin'); //设置刻度样式 为文本型
|
||||
$graph->yaxis->scale->SetGrace(20); //设置Y轴刻度值的上下限值 为20
|
||||
$graph->SetShadow(); //设置阴影
|
||||
|
||||
$graph->img->SetMargin(40, 30, 30, 40); //设置图像边距
|
||||
$barPlot = new BarPlot($datay); //创建BarPlot对象
|
||||
$barPlot->SetFillColor('orange'); //设置柱状图填充颜色
|
||||
$graph->Add($barPlot); //将柱状图添加到图像中
|
||||
$barPlot->value->Show(); //设置显示数字
|
||||
$barPlot->value->SetFormat('%d'); //设置数字显示格式
|
||||
$graph->SetMarginColor('lightblue'); //设置图像边距颜色 为浅蓝色
|
||||
$graph->title->Set(mb_convert_encoding('销量统计', 'gb2312', 'auto')); //设置图像标题
|
||||
|
||||
$a = mb_convert_encoding(array('1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月',
|
||||
'11月', '12月'),'gb2312', 'auto'); //设置X轴刻度值
|
||||
$graph->xaxis->SetTickLabels($a); //设置X轴刻度值
|
||||
$graph->title->SetFont(FF_SIMSUN); //设置图像标题字体
|
||||
$graph->xaxis->SetFont(FF_SIMSUN); //设置X轴刻度值字体
|
||||
$graph->Stroke(); //输出图像
|
Binary file not shown.
Loading…
Reference in New Issue