コード例 #1
0
ファイル: captcha.php プロジェクト: FantasticThought/tfsda
if (!isset($_SESSION)) {
    session_start();
}
//檢查SESSION是否啟動
$_SESSION['captcha'] = '';
//設置存放檢查碼的SESSION
//設置定義為圖片
header("Content-type: image/PNG");
/* 
  imgcode($nums,$width,$high) 
  設置產生驗證碼圖示的參數 
  $nums 生成驗證碼個數 
  $width 圖片寬 
  $high 圖片高 
*/
imgcode(4, 100, 25);
//imgcode的function
function imgcode($nums, $width, $high)
{
    //去除了數字0和1 字母小寫O和L,為了避免辨識不清楚
    //$str = "23456789abcdefghijkmnpqrstuvwxyzABCDEFGHIJKLMOPQRSTUBWXYZ";
    $str = "0123456789";
    $code = '';
    for ($i = 0; $i < $nums; $i++) {
        $code .= $str[mt_rand(0, strlen($str) - 1)];
    }
    $_SESSION['captcha'] = $code;
    //建立圖示,設置寬度及高度與顏色等等條件
    $image = imagecreate($width, $high);
    $black = imagecolorallocate($image, mt_rand(0, 200), mt_rand(0, 200), mt_rand(0, 200));
    $border_color = imagecolorallocate($image, 21, 106, 235);
コード例 #2
0
ファイル: login.php プロジェクト: haseok86/millkencode
<?php

//====================================================
//		FileName:	login.php
//		Summary:	后台登录入口
//		Author:		millken(迷路林肯)
//		LastModifed:2008-3-9
//		copyright (c)2008 millken@gmail.com
//====================================================
include '../common.inc.php';
$imgcode = imgcode();
if (imgcode($checkcode, false)) {
    die('ok');
} else {
    m_exit($_POST);
}
$tpl = new template(basename(__FILE__, '.php') . '.html');
$tpl->tpl_dir = 'templates/default/';
$tpl->debug = true;
include $tpl->compiledFile();
コード例 #3
0
ファイル: login.php プロジェクト: haseok86/millkencode
	<title>系统管理登陆</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel="stylesheet" href="admin.css" type="text/css">
</head>
<body topmargin="10" leftmargin="10" >
	<form action="login.php?action=login" method="post">
		<table class="tableborder2" cellspacing="1" cellpadding="4" width="30%" align="center"  >
			<tr class="head">
			<td colspan="2" align="center">后台管理</td>
			</tr>
			<tr class="b">
			<td width="30%"><b>用户名:</b></td>
			<td><input type="text" size="20" name="username"></td>
			</tr>
			<tr class="b">
			<td width="30%"><b>密码:</b></td>
			<td><input type="password" size="20" name="passwd"></td>
			</tr>
			<tr class="b">
				<td width="30%"><b>验证码:</b></td>
				<td><input type="text" class="capital" size="10" name="securitycode">&nbsp;&nbsp;<?php 
echo imgcode();
?>
</td>
			</tr>
		</table>
		<br><center><input type="submit" value="提 交">&nbsp;&nbsp; <input type="reset" value="重置"></center>
	</form>
</body>
</html>
コード例 #4
0
if (!isset($_SESSION)) {
    session_start();
}
//檢查SESSION是否啟動
$_SESSION['check_word'] = '';
//設置存放檢查碼的SESSION
//設置定義為圖片
header("Content-Type: image/png");
/* 
  imgcode($nums,$width,$high) 
  設置產生驗證碼圖示的參數 
  $nums 生成驗證碼個數 
  $width 圖片寬 
  $high 圖片高 
*/
imgcode(4, 105, 35);
//imgcode的function
function imgcode($nums, $width, $high)
{
    $str = "1234567890";
    $code = '';
    for ($i = 0; $i < $nums; $i++) {
        $code .= $str[mt_rand(0, strlen($str) - 1)];
    }
    $_SESSION['check_word'] = $code;
    //建立圖示,設置寬度及高度與顏色等等條件
    $image = imagecreate($width, $high);
    $black = imagecolorallocate($image, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
    $border_color = imagecolorallocate($image, 21, 106, 235);
    $background_color = imagecolorallocate($image, 235, 236, 237);
    //建立圖示背景