コード例 #1
0
ファイル: image.func.php プロジェクト: xtaq/shopweb
    imagefilledrectangle($image, 1, 1, $width - 2, $height - 2, $white);
    $chars = buildRandomString($type, $length);
    $_SESSION[$sess_name] = $chars;
    $fontfiles = array('a.ttf', 'b.ttf', 'c.ttf', 'd.ttf', 'e.ttf');
    for ($i = 0; $i < $length; $i++) {
        $size = mt_rand(14, 18);
        $angle = mt_rand(-15, 15);
        $x = 5 + $i * $size;
        $y = mt_rand(20, 26);
        $fontfile = "../fonts/" . $fontfiles[mt_rand(0, count($fontfiles) - 1)];
        $text = substr($chars, $i, 1);
        $color = imagecolorallocate($image, mt_rand(50, 90), mt_rand(80, 200), mt_rand(90, 180));
        imagettftext($image, $size, $angle, $x, $y, $color, $fontfile, $text);
    }
    if ($pixel) {
        for ($i = 0; $i < 50; $i++) {
            imagesetpixel($image, mt_rand(0, $width - 1), mt_rand(0, $height - 1), $black);
        }
    }
    if ($line) {
        for ($i = 1; $i < $line; $i++) {
            $color = imagecolorallocate($image, mt_rand(50, 90), mt_rand(80, 200), mt_rand(90, 180));
            imageline($image, mt_rand(0, $width - 1), mt_rand(0, $height - 1), mt_rand(0, $width - 1), mt_rand(0, $height - 1), $color);
        }
    }
    header("content-type:image/gif");
    imagegif($image);
    imagedestroy($image);
}
verifyImage(1, 4, 1, 10);
コード例 #2
0
ファイル: image.func.php プロジェクト: WeiGrand/phpShop
    $black = imagecolorallocate($im, 0, 0, 0);
    imagefilledrectangle($im, 1, 1, $width - 2, $height - 2, $white);
    $chars = buildRamdonString($type, $length);
    $_SESSION[$sess_name] = $chars;
    for ($i = 0; $i < $length; $i++) {
        $size = mt_rand(14, 18);
        $angle = mt_rand(-15, 15);
        $x = 5 + $i * $size;
        $y = mt_rand(20, 26);
        $color = imagecolorallocate($im, mt_rand(50, 90), mt_rand(80, 200), mt_rand(90, 180));
        $fontfile = "../fonts/SIMYOU.TTF";
        $text = substr($chars, $i, 1);
        imagettftext($im, $size, $angle, $x, $y, $color, $fontfile, $text);
    }
    if ($pixel) {
        for ($i = 0; $i < $pixel; $i++) {
            imagesetpixel($im, mt_rand(0, $width - 1), mt_rand(0, $height - 1), $black);
        }
    }
    if ($line) {
        for ($i = 0; $i < $line; $i++) {
            $color = imagecolorallocate($im, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
            imageline($im, mt_rand(0, $width - 1), mt_rand(0, $height - 1), mt_rand(0, $width - 1), mt_rand(0, $height - 1), $color);
        }
    }
    header('content-type:image/gif');
    imagegif($im);
    imagedestroy($im);
}
verifyImage(2);
コード例 #3
0
ファイル: getVerify.php プロジェクト: xc1129/myshop
<?php

/**
 * Created by PhpStorm.
 * User: Spirit_xc
 * Date: 15/7/13
 * Time: 上午12:47
 */
require_once '../include.php';
verifyImage();
コード例 #4
0
ファイル: getVerify.php プロジェクト: Arc-lin/dankal
<?php

/*
 * 获取随机验证码
 */
require_once '../include.php';
verifyImage(1, 4, 50, 2);
コード例 #5
0
ファイル: getVerify.php プロジェクト: AndLu/MyShop
<?php

require_once '../include.php';
// require_once '../lib/image.func.php';
verifyImage(3, 4, 15, 5);
コード例 #6
0
ファイル: edit.php プロジェクト: euniciaruiz/domremy_system
$servername = "domremy.xsrv.jp";
$username = "******";
$password = "******";
$dbname = "domremy_product";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
$pName = $conn->real_escape_string($_POST['name']);
$pDetail = $conn->real_escape_string($_POST['detail']);
$pPepperText = $conn->real_escape_string($_POST['pepperText']);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
if (is_uploaded_file($_FILES['file']['tmp_name'])) {
    //$filename = $_POST["file"].$_FILES["file"]["name"];
    if (verifyImage() == "OK") {
        $sql = "UPDATE product_tb SET productName ='{$pName}', productDetailText = '{$pDetail}', productPepperText = '{$pPepperText}' WHERE productId='{$id}'";
        if ($conn->query($sql) === TRUE) {
            $temp = explode(".", $_FILES["file"]["name"]);
            $extension = strtolower(end($temp));
            $filename = $id . "." . $extension;
            $sql = "UPDATE product_tb SET productFileName ='{$filename}' WHERE productId='{$id}'";
            $conn->query($sql);
            saveImageToServer($filename);
            echo "Record updated successfully";
        } else {
            echo "Error updating record: " . $conn->error;
        }
    }
} else {
    $sql = "UPDATE product_tb SET productName ='{$pName}', productDetailText = '{$pDetail}', productPepperText = '{$pPepperText}' WHERE productId='{$id}'";
コード例 #7
0
ファイル: image.func.php プロジェクト: denson7/phpstudy
    $_SESSION[$sess_name] = $chars;
    $fontfiles = array("SEGOEUII.TTF", "TAHOMA.TTF", "VERDANA.TTF");
    for ($i = 0; $i < $length; $i++) {
        $size = mt_rand(14, 18);
        $angle = mt_rand(-15, 15);
        $x = 5 + $i * $size;
        $y = mt_rand(20, 26);
        $fontfile = "../fonts/" . $fontfiles[mt_rand(0, count($fontfiles) - 1)];
        $color = imagecolorallocate($image, mt_rand(50, 90), mt_rand(80, 200), mt_rand(90, 180));
        $text = substr($chars, $i, 1);
        imagettftext($image, $size, $angle, $x, $y, $color, $fontfile, $text);
    }
    //添加干扰元素--点
    if ($pixel) {
        for ($i = 0; $i < $pixel; $i++) {
            imagesetpixel($image, mt_rand(0, $width - 1), mt_rand(0, $height - 1), $black);
        }
    }
    //添加干扰元素--线
    if ($line) {
        for ($i = 1; $i < $line; $i++) {
            $color = imagecolorallocate($image, mt_rand(50, 90), mt_rand(80, 200), mt_rand(90, 180));
            imageline($image, mt_rand(0, $width - 1), mt_rand(0, $height - 1), mt_rand(0, $width - 1), mt_rand(0, $height - 1), $color);
        }
    }
    header('content-type:image/gif');
    imagegif($image);
    imagedestroy($image);
}
verifyImage(1, 4, 10, 4);
コード例 #8
0
<?php

require_once '../include.php';
verifyImage(1, 4, 10, 3);