mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-30 03:09:22 +02:00
Znote AAC rev 168 from subversion.
This commit is contained in:
parent
ba07284044
commit
21dea78379
@ -0,0 +1,4 @@
|
|||||||
|
Step 1: Copy firstitems.lua to /data/creaturescripts/scripts/ folder
|
||||||
|
-- Edit firstitems.lua with item IDs you want characters to start with on your server.
|
||||||
|
|
||||||
|
Step 2: Restart OT server, and it should work. :)
|
77
LUA/TFS_02/creaturescript firstitems/firstitems.lua
Normal file
77
LUA/TFS_02/creaturescript firstitems/firstitems.lua
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
function onLogin(cid)
|
||||||
|
local storage = 30055 -- storage value
|
||||||
|
|
||||||
|
local sorcItems = {
|
||||||
|
2460, -- Brass helmet
|
||||||
|
2465, -- Brass armor
|
||||||
|
2190, -- Wand of vortex
|
||||||
|
2511, -- Brass shield
|
||||||
|
2478, -- Brass legs
|
||||||
|
2643, -- Leather boots
|
||||||
|
1988, -- Brown backpack
|
||||||
|
2050 -- torch
|
||||||
|
}
|
||||||
|
local druidItems = {
|
||||||
|
2460, -- Brass helmet
|
||||||
|
2465, -- Brass armor
|
||||||
|
2511, -- Brass shield
|
||||||
|
2182, -- Snakebite rod
|
||||||
|
2478, -- Brass legs
|
||||||
|
2643, -- Leather boots
|
||||||
|
1988, -- Brown backpack
|
||||||
|
2050 -- torch
|
||||||
|
}
|
||||||
|
local pallyItems = {
|
||||||
|
2460, -- Brass helmet
|
||||||
|
2465, -- Brass armor
|
||||||
|
2456, -- Bow
|
||||||
|
2478, -- Brass legs
|
||||||
|
2643, -- Leather boots
|
||||||
|
1988, -- Brown backpack
|
||||||
|
}
|
||||||
|
local kinaItems = {
|
||||||
|
2460, -- Brass helmet
|
||||||
|
2465, -- Brass armor
|
||||||
|
2511, -- Brass shield
|
||||||
|
2412, -- Katana
|
||||||
|
2478, -- Brass legs
|
||||||
|
2643, -- Leather boots
|
||||||
|
1988, -- Brown backpack
|
||||||
|
2050 -- torch
|
||||||
|
}
|
||||||
|
|
||||||
|
if getPlayerStorageValue(cid, storage) == -1 then
|
||||||
|
setPlayerStorageValue(cid, storage, 1)
|
||||||
|
if getPlayerVocation(cid) == 1 then
|
||||||
|
-- Sorcerer
|
||||||
|
for i = 1, table.getn(sorcItems), 1 do
|
||||||
|
doPlayerAddItem(cid, sorcItems[i], 1, FALSE)
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif getPlayerVocation(cid) == 2 then
|
||||||
|
-- Druid
|
||||||
|
for i = 1, table.getn(druidItems), 1 do
|
||||||
|
doPlayerAddItem(cid, druidItems[i], 1, FALSE)
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif getPlayerVocation(cid) == 3 then
|
||||||
|
-- Paladin
|
||||||
|
for i = 1, table.getn(pallyItems), 1 do
|
||||||
|
doPlayerAddItem(cid, pallyItems[i], 1, FALSE)
|
||||||
|
end
|
||||||
|
-- 8 arrows
|
||||||
|
doPlayerAddItem(cid, 2544, 8, FALSE)
|
||||||
|
|
||||||
|
elseif getPlayerVocation(cid) == 4 then
|
||||||
|
-- Knight
|
||||||
|
for i = 1, table.getn(kinaItems), 1 do
|
||||||
|
doPlayerAddItem(cid, kinaItems[i], 1, FALSE)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Common for all
|
||||||
|
doPlayerAddItem(cid, 2674, 5, FALSE) -- 5 apples
|
||||||
|
doPlayerAddItem(cid, 2120, 1, FALSE) -- 1 rope
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
1
LUA/TFS_02/talkaction shopsystem/talkaction XML.txt
Normal file
1
LUA/TFS_02/talkaction shopsystem/talkaction XML.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
<talkaction words="!shop" script="znoteshop.lua"/>
|
49
LUA/TFS_02/talkaction shopsystem/znoteshop.lua
Normal file
49
LUA/TFS_02/talkaction shopsystem/znoteshop.lua
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
-- Znote Shop v1.0 for Znote AAC on TFS 0.2.13+ Mystic Spirit.
|
||||||
|
function onSay(cid, words, param)
|
||||||
|
local storage = 54073 -- Make sure to select non-used storage. This is used to prevent SQL load attacks.
|
||||||
|
local cooldown = 15 -- in seconds.
|
||||||
|
|
||||||
|
if getPlayerStorageValue(cid, storage) <= os.time() then
|
||||||
|
setPlayerStorageValue(cid, storage, os.time() + cooldown)
|
||||||
|
local accid = getAccountNumberByPlayerName(getCreatureName(cid))
|
||||||
|
|
||||||
|
-- Create the query
|
||||||
|
local orderQuery = db.storeQuery("SELECT `id`, `type`, `itemid`, `count` FROM `znote_shop_orders` WHERE `account_id` = " .. accid .. " LIMIT 1;")
|
||||||
|
|
||||||
|
-- Detect if we got any results
|
||||||
|
if orderQuery ~= false then
|
||||||
|
-- Fetch order values
|
||||||
|
local q_id = result.getDataInt(orderQuery, "id")
|
||||||
|
local q_type = result.getDataInt(orderQuery, "type")
|
||||||
|
local q_itemid = result.getDataInt(orderQuery, "itemid")
|
||||||
|
local q_count = result.getDataInt(orderQuery, "count")
|
||||||
|
result.free(orderQuery)
|
||||||
|
|
||||||
|
-- ORDER TYPE 1 (Regular item shop products)
|
||||||
|
if q_type == 1 then
|
||||||
|
-- Get wheight
|
||||||
|
local playerCap = getPlayerFreeCap(cid)
|
||||||
|
local itemweight = getItemWeight(q_itemid, q_count)
|
||||||
|
if playerCap >= itemweight then
|
||||||
|
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||||
|
doPlayerAddItem(cid, q_itemid, q_count)
|
||||||
|
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have recieved ".. q_count .." "..getItemName(q_itemid).."(s)!")
|
||||||
|
else
|
||||||
|
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Need more CAP!")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- Add custom order types here
|
||||||
|
-- Type 2 is reserved for premium days and is handled on website, not needed here.
|
||||||
|
-- Type 3 is reserved for character gender(sex) change and is handled on website as well.
|
||||||
|
-- So use type 4+ for custom stuff, like etc packages.
|
||||||
|
-- if q_type == 4 then
|
||||||
|
-- end
|
||||||
|
else
|
||||||
|
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have no orders.")
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Can only be executed once every "..cooldown.." seconds. Remaining cooldown: ".. getPlayerStorageValue(cid, storage) - os.time())
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
@ -0,0 +1,10 @@
|
|||||||
|
Step 1: Copy firstitems.lua to /data/creaturescripts/scripts/ folder
|
||||||
|
-- Edit firstitems.lua with item IDs you want characters to start with on your server.
|
||||||
|
|
||||||
|
Step 2: Edit the /data/creaturescripts/creaturescripts.XML file
|
||||||
|
- ADD: <event type="login" name="firstItems" event="script" value="firstitems.lua"/>
|
||||||
|
|
||||||
|
Step 3: Edit the /data/creaturescripts/scripts/login.lua file
|
||||||
|
- ADD: registerCreatureEvent(cid, "firstItems")
|
||||||
|
|
||||||
|
Step 4: Restart OT server, and it should work. :)
|
77
LUA/TFS_03/creaturescript firstitems/firstitems.lua
Normal file
77
LUA/TFS_03/creaturescript firstitems/firstitems.lua
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
function onLogin(cid)
|
||||||
|
local storage = 30055 -- storage value
|
||||||
|
|
||||||
|
local sorcItems = {
|
||||||
|
2460, -- Brass helmet
|
||||||
|
2465, -- Brass armor
|
||||||
|
2190, -- Wand of vortex
|
||||||
|
2511, -- Brass shield
|
||||||
|
2478, -- Brass legs
|
||||||
|
2643, -- Leather boots
|
||||||
|
1988, -- Brown backpack
|
||||||
|
2050 -- torch
|
||||||
|
}
|
||||||
|
local druidItems = {
|
||||||
|
2460, -- Brass helmet
|
||||||
|
2465, -- Brass armor
|
||||||
|
2511, -- Brass shield
|
||||||
|
2182, -- Snakebite rod
|
||||||
|
2478, -- Brass legs
|
||||||
|
2643, -- Leather boots
|
||||||
|
1988, -- Brown backpack
|
||||||
|
2050 -- torch
|
||||||
|
}
|
||||||
|
local pallyItems = {
|
||||||
|
2460, -- Brass helmet
|
||||||
|
2465, -- Brass armor
|
||||||
|
2456, -- Bow
|
||||||
|
2478, -- Brass legs
|
||||||
|
2643, -- Leather boots
|
||||||
|
1988, -- Brown backpack
|
||||||
|
}
|
||||||
|
local kinaItems = {
|
||||||
|
2460, -- Brass helmet
|
||||||
|
2465, -- Brass armor
|
||||||
|
2511, -- Brass shield
|
||||||
|
2412, -- Katana
|
||||||
|
2478, -- Brass legs
|
||||||
|
2643, -- Leather boots
|
||||||
|
1988, -- Brown backpack
|
||||||
|
2050 -- torch
|
||||||
|
}
|
||||||
|
|
||||||
|
if getPlayerStorageValue(cid, storage) == -1 then
|
||||||
|
setPlayerStorageValue(cid, storage, 1)
|
||||||
|
if getPlayerVocation(cid) == 1 then
|
||||||
|
-- Sorcerer
|
||||||
|
for i = 1, table.getn(sorcItems), 1 do
|
||||||
|
doPlayerAddItem(cid, sorcItems[i], 1, FALSE)
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif getPlayerVocation(cid) == 2 then
|
||||||
|
-- Druid
|
||||||
|
for i = 1, table.getn(druidItems), 1 do
|
||||||
|
doPlayerAddItem(cid, druidItems[i], 1, FALSE)
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif getPlayerVocation(cid) == 3 then
|
||||||
|
-- Paladin
|
||||||
|
for i = 1, table.getn(pallyItems), 1 do
|
||||||
|
doPlayerAddItem(cid, pallyItems[i], 1, FALSE)
|
||||||
|
end
|
||||||
|
-- 8 arrows
|
||||||
|
doPlayerAddItem(cid, 2544, 8, FALSE)
|
||||||
|
|
||||||
|
elseif getPlayerVocation(cid) == 4 then
|
||||||
|
-- Knight
|
||||||
|
for i = 1, table.getn(kinaItems), 1 do
|
||||||
|
doPlayerAddItem(cid, kinaItems[i], 1, FALSE)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Common for all
|
||||||
|
doPlayerAddItem(cid, 2674, 5, FALSE) -- 5 apples
|
||||||
|
doPlayerAddItem(cid, 2120, 1, FALSE) -- 1 rope
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
50
LUA/TFS_03/talkaction shopsystem/Alternatives/znoteshop.lua
Normal file
50
LUA/TFS_03/talkaction shopsystem/Alternatives/znoteshop.lua
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
-- Znote Shop v1.0 for Znote AAC on TFS 0.3.6+ Crying Damson.
|
||||||
|
function onSay(cid, words, param)
|
||||||
|
local storage = 54073 -- Make sure to select non-used storage. This is used to prevent SQL load attacks.
|
||||||
|
local cooldown = 15 -- in seconds.
|
||||||
|
|
||||||
|
if getPlayerStorageValue(cid, storage) <= os.time() then
|
||||||
|
setPlayerStorageValue(cid, storage, os.time() + cooldown)
|
||||||
|
local accid = getAccountNumberByPlayerName(getCreatureName(cid))
|
||||||
|
|
||||||
|
-- Create the query
|
||||||
|
local orderQuery = db.storeQuery("SELECT `id`, `type`, `itemid`, `count` FROM `znote_shop_orders` WHERE `account_id` = " .. accid .. ";")
|
||||||
|
|
||||||
|
-- Detect if we got any results
|
||||||
|
if orderQuery ~= false then
|
||||||
|
-- Fetch order values
|
||||||
|
local q_id = result.getDataInt(orderQuery, "id")
|
||||||
|
local q_type = result.getDataInt(orderQuery, "type")
|
||||||
|
local q_itemid = result.getDataInt(orderQuery, "itemid")
|
||||||
|
local q_count = result.getDataInt(orderQuery, "count")
|
||||||
|
result.free(orderQuery)
|
||||||
|
|
||||||
|
-- ORDER TYPE 1 (Regular item shop products)
|
||||||
|
if q_type == 1 then
|
||||||
|
-- Get wheight
|
||||||
|
local playerCap = getPlayerFreeCap(cid)
|
||||||
|
local itemweight = getItemWeightById(q_itemid, q_count)
|
||||||
|
if playerCap >= itemweight then
|
||||||
|
local delete = db.storeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||||
|
result.free(delete)
|
||||||
|
doPlayerAddItem(cid, q_itemid, q_count)
|
||||||
|
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have recieved ".. q_count .." "..getItemNameById(q_itemid).."(s)!")
|
||||||
|
else
|
||||||
|
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Need more CAP!")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- Add custom order types here
|
||||||
|
-- Type 2 is reserved for premium days and is handled on website, not needed here.
|
||||||
|
-- Type 3 is reserved for character gender(sex) change and is handled on website as well.
|
||||||
|
-- So use type 4+ for custom stuff, like etc packages.
|
||||||
|
-- if q_type == 4 then
|
||||||
|
-- end
|
||||||
|
else
|
||||||
|
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have no orders.")
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Can only be executed once every "..cooldown.." seconds. Remaining cooldown: ".. getPlayerStorageValue(cid, storage) - os.time())
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
1
LUA/TFS_03/talkaction shopsystem/talkaction XML.txt
Normal file
1
LUA/TFS_03/talkaction shopsystem/talkaction XML.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
<talkaction words="!shop" event="script" value="znoteshop.lua"/>
|
49
LUA/TFS_03/talkaction shopsystem/znoteshop.lua
Normal file
49
LUA/TFS_03/talkaction shopsystem/znoteshop.lua
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
-- Znote Shop v1.0 for Znote AAC on TFS 0.3.6+ Crying Damson.
|
||||||
|
function onSay(cid, words, param)
|
||||||
|
local storage = 54073 -- Make sure to select non-used storage. This is used to prevent SQL load attacks.
|
||||||
|
local cooldown = 15 -- in seconds.
|
||||||
|
|
||||||
|
if getPlayerStorageValue(cid, storage) <= os.time() then
|
||||||
|
setPlayerStorageValue(cid, storage, os.time() + cooldown)
|
||||||
|
local accid = getAccountNumberByPlayerName(getCreatureName(cid))
|
||||||
|
|
||||||
|
-- Create the query
|
||||||
|
local orderQuery = db.storeQuery("SELECT `id`, `type`, `itemid`, `count` FROM `znote_shop_orders` WHERE `account_id` = " .. accid .. " LIMIT 1;")
|
||||||
|
|
||||||
|
-- Detect if we got any results
|
||||||
|
if orderQuery ~= false then
|
||||||
|
-- Fetch order values
|
||||||
|
local q_id = result.getDataInt(orderQuery, "id")
|
||||||
|
local q_type = result.getDataInt(orderQuery, "type")
|
||||||
|
local q_itemid = result.getDataInt(orderQuery, "itemid")
|
||||||
|
local q_count = result.getDataInt(orderQuery, "count")
|
||||||
|
result.free(orderQuery)
|
||||||
|
|
||||||
|
-- ORDER TYPE 1 (Regular item shop products)
|
||||||
|
if q_type == 1 then
|
||||||
|
-- Get wheight
|
||||||
|
local playerCap = getPlayerFreeCap(cid)
|
||||||
|
local itemweight = getItemWeightById(q_itemid, q_count)
|
||||||
|
if playerCap >= itemweight then
|
||||||
|
db.executeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||||
|
doPlayerAddItem(cid, q_itemid, q_count)
|
||||||
|
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have recieved ".. q_count .." "..getItemNameById(q_itemid).."(s)!")
|
||||||
|
else
|
||||||
|
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Need more CAP!")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- Add custom order types here
|
||||||
|
-- Type 2 is reserved for premium days and is handled on website, not needed here.
|
||||||
|
-- Type 3 is reserved for character gender(sex) change and is handled on website as well.
|
||||||
|
-- So use type 4+ for custom stuff, like etc packages.
|
||||||
|
-- if q_type == 4 then
|
||||||
|
-- end
|
||||||
|
else
|
||||||
|
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have no orders.")
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Can only be executed once every "..cooldown.." seconds. Remaining cooldown: ".. getPlayerStorageValue(cid, storage) - os.time())
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
BIN
captcha/AHGBold.ttf
Normal file
BIN
captcha/AHGBold.ttf
Normal file
Binary file not shown.
25
captcha/LICENSE.txt
Normal file
25
captcha/LICENSE.txt
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
COPYRIGHT:
|
||||||
|
Copyright (c) 2011 Drew Phillips
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
- Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
- Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
12
captcha/README.FONT.txt
Normal file
12
captcha/README.FONT.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
AHGBold.ttf is used by Securimage under the following license:
|
||||||
|
|
||||||
|
Alte Haas Grotesk is a typeface that look like an helvetica printed in an old Muller-Brockmann Book.
|
||||||
|
|
||||||
|
These fonts are freeware and can be distributed as long as they are
|
||||||
|
together with this text file.
|
||||||
|
|
||||||
|
I would appreciate very much to see what you have done with it anyway.
|
||||||
|
|
||||||
|
yann le coroller
|
||||||
|
www.yannlecoroller.com
|
||||||
|
yann@lecoroller.com
|
180
captcha/README.txt
Normal file
180
captcha/README.txt
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
NAME:
|
||||||
|
|
||||||
|
Securimage - A PHP class for creating captcha images and audio with many options.
|
||||||
|
|
||||||
|
VERSION: 3.2RC2
|
||||||
|
|
||||||
|
AUTHOR:
|
||||||
|
|
||||||
|
Drew Phillips <drew@drew-phillips.com>
|
||||||
|
|
||||||
|
DOWNLOAD:
|
||||||
|
|
||||||
|
The latest version can always be
|
||||||
|
found at http://www.phpcaptcha.org
|
||||||
|
|
||||||
|
DOCUMENTATION:
|
||||||
|
|
||||||
|
Online documentation of the class, methods, and variables can
|
||||||
|
be found at http://www.phpcaptcha.org/Securimage_Docs/
|
||||||
|
|
||||||
|
REQUIREMENTS:
|
||||||
|
PHP 5.2 or greater
|
||||||
|
GD 2.0
|
||||||
|
FreeType (Required, for TTF fonts)
|
||||||
|
|
||||||
|
SYNOPSIS:
|
||||||
|
|
||||||
|
require_once 'securimage.php';
|
||||||
|
|
||||||
|
$image = new Securimage();
|
||||||
|
|
||||||
|
$image->show();
|
||||||
|
|
||||||
|
// Code Validation
|
||||||
|
|
||||||
|
$image = new Securimage();
|
||||||
|
if ($image->check($_POST['code']) == true) {
|
||||||
|
echo "Correct!";
|
||||||
|
} else {
|
||||||
|
echo "Sorry, wrong code.";
|
||||||
|
}
|
||||||
|
|
||||||
|
DESCRIPTION:
|
||||||
|
|
||||||
|
What is Securimage?
|
||||||
|
|
||||||
|
Securimage is a PHP class that is used to generate and validate CAPTCHA images.
|
||||||
|
The classes uses an existing PHP session or creates its own if none is found to store the
|
||||||
|
CAPTCHA code. Variables within the class are used to control the style and display of the image.
|
||||||
|
The class supports TTF fonts and effects for strengthening the security of the image.
|
||||||
|
An audible code can also be streamed to the browser for visually impared users.
|
||||||
|
|
||||||
|
|
||||||
|
COPYRIGHT:
|
||||||
|
Copyright (c) 2012 Drew Phillips
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
- Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
- Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
The WavFile.php class used in Securimage by Drew Phillips and Paul Voegler is
|
||||||
|
used under the BSD License. See WavFile.php for details.
|
||||||
|
Many thanks to Paul Voegler (http://voegler.eu/audio/pub) for contributing to
|
||||||
|
Securimage.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Flash code created for Securimage by Age Bosma & Mario Romero (animario@hotmail.com)
|
||||||
|
Many thanks for releasing this to the project!
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Portions of Securimage contain code from Han-Kwang Nienhuys' PHP captcha
|
||||||
|
|
||||||
|
Han-Kwang Nienhuys' PHP captcha
|
||||||
|
Copyright June 2007
|
||||||
|
|
||||||
|
This copyright message and attribution must be preserved upon
|
||||||
|
modification. Redistribution under other licenses is expressly allowed.
|
||||||
|
Other licenses include GPL 2 or higher, BSD, and non-free licenses.
|
||||||
|
The original, unrestricted version can be obtained from
|
||||||
|
http://www.lagom.nl/linux/hkcaptcha/
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
AHGBold.ttf (AlteHaasGroteskBold.ttf) font was created by Yann Le Coroller and is distributed as freeware
|
||||||
|
|
||||||
|
Alte Haas Grotesk is a typeface that look like an helvetica printed in an old Muller-Brockmann Book.
|
||||||
|
|
||||||
|
These fonts are freeware and can be distributed as long as they are
|
||||||
|
together with this text file.
|
||||||
|
|
||||||
|
I would appreciate very much to see what you have done with it anyway.
|
||||||
|
|
||||||
|
yann le coroller
|
||||||
|
www.yannlecoroller.com
|
||||||
|
yann@lecoroller.com
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Portions of securimage_play.swf use the PopForge flash library for playing audio
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright(C) 2007 Andre Michelle and Joa Ebert
|
||||||
|
*
|
||||||
|
* PopForge is an ActionScript3 code sandbox developed by Andre Michelle and Joa Ebert
|
||||||
|
* http://sandbox.popforge.de
|
||||||
|
*
|
||||||
|
* PopforgeAS3Audio is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* PopforgeAS3Audio is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Some graphics used are from the Humility Icon Pack by WorLord
|
||||||
|
|
||||||
|
License: GNU/GPL (http://findicons.com/pack/1723/humility)
|
||||||
|
http://findicons.com/icon/192558/gnome_volume_control
|
||||||
|
http://findicons.com/icon/192562/gtk_refresh
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Background noise sound files are from SoundJay.com
|
||||||
|
http://www.soundjay.com/tos.html
|
||||||
|
|
||||||
|
All sound effects on this website are created by us and protected under
|
||||||
|
the copyright laws, international treaty provisions and other applicable
|
||||||
|
laws. By downloading sounds, music or any material from this site implies
|
||||||
|
that you have read and accepted these terms and conditions:
|
||||||
|
|
||||||
|
Sound Effects
|
||||||
|
You are allowed to use the sounds free of charge and royalty free in your
|
||||||
|
projects (such as films, videos, games, presentations, animations, stage
|
||||||
|
plays, radio plays, audio books, apps) be it for commercial or
|
||||||
|
non-commercial purposes.
|
||||||
|
|
||||||
|
But you are NOT allowed to
|
||||||
|
- post the sounds (as sound effects or ringtones) on any website for
|
||||||
|
others to download, copy or use
|
||||||
|
- use them as a raw material to create sound effects or ringtones that
|
||||||
|
you will sell, distribute or offer for downloading
|
||||||
|
- sell, re-sell, license or re-license the sounds (as individual sound
|
||||||
|
effects or as a sound effects library) to anyone else
|
||||||
|
- claim the sounds as yours
|
||||||
|
- link directly to individual sound files
|
||||||
|
- distribute the sounds in apps or computer programs that are clearly
|
||||||
|
sound related in nature (such as sound machine, sound effect
|
||||||
|
generator, ringtone maker, funny sounds app, sound therapy app, etc.)
|
||||||
|
or in apps or computer programs that use the sounds as the program's
|
||||||
|
sound resource library for other people's use (such as animation
|
||||||
|
creator, digital book creator, song maker software, etc.). If you are
|
||||||
|
developing such computer programs, contact us for licensing options.
|
||||||
|
|
||||||
|
If you use the sound effects, please consider giving us a credit and
|
||||||
|
linking back to us but it's not required.
|
||||||
|
|
||||||
|
|
1861
captcha/WavFile.php
Normal file
1861
captcha/WavFile.php
Normal file
File diff suppressed because it is too large
Load Diff
BIN
captcha/audio/0.wav
Normal file
BIN
captcha/audio/0.wav
Normal file
Binary file not shown.
BIN
captcha/audio/1.wav
Normal file
BIN
captcha/audio/1.wav
Normal file
Binary file not shown.
BIN
captcha/audio/10.wav
Normal file
BIN
captcha/audio/10.wav
Normal file
Binary file not shown.
BIN
captcha/audio/11.wav
Normal file
BIN
captcha/audio/11.wav
Normal file
Binary file not shown.
BIN
captcha/audio/12.wav
Normal file
BIN
captcha/audio/12.wav
Normal file
Binary file not shown.
BIN
captcha/audio/13.wav
Normal file
BIN
captcha/audio/13.wav
Normal file
Binary file not shown.
BIN
captcha/audio/14.wav
Normal file
BIN
captcha/audio/14.wav
Normal file
Binary file not shown.
BIN
captcha/audio/15.wav
Normal file
BIN
captcha/audio/15.wav
Normal file
Binary file not shown.
BIN
captcha/audio/16.wav
Normal file
BIN
captcha/audio/16.wav
Normal file
Binary file not shown.
BIN
captcha/audio/17.wav
Normal file
BIN
captcha/audio/17.wav
Normal file
Binary file not shown.
BIN
captcha/audio/18.wav
Normal file
BIN
captcha/audio/18.wav
Normal file
Binary file not shown.
BIN
captcha/audio/19.wav
Normal file
BIN
captcha/audio/19.wav
Normal file
Binary file not shown.
BIN
captcha/audio/2.wav
Normal file
BIN
captcha/audio/2.wav
Normal file
Binary file not shown.
BIN
captcha/audio/20.wav
Normal file
BIN
captcha/audio/20.wav
Normal file
Binary file not shown.
BIN
captcha/audio/3.wav
Normal file
BIN
captcha/audio/3.wav
Normal file
Binary file not shown.
BIN
captcha/audio/4.wav
Normal file
BIN
captcha/audio/4.wav
Normal file
Binary file not shown.
BIN
captcha/audio/5.wav
Normal file
BIN
captcha/audio/5.wav
Normal file
Binary file not shown.
BIN
captcha/audio/6.wav
Normal file
BIN
captcha/audio/6.wav
Normal file
Binary file not shown.
BIN
captcha/audio/7.wav
Normal file
BIN
captcha/audio/7.wav
Normal file
Binary file not shown.
BIN
captcha/audio/8.wav
Normal file
BIN
captcha/audio/8.wav
Normal file
Binary file not shown.
BIN
captcha/audio/9.wav
Normal file
BIN
captcha/audio/9.wav
Normal file
Binary file not shown.
BIN
captcha/audio/A.wav
Normal file
BIN
captcha/audio/A.wav
Normal file
Binary file not shown.
BIN
captcha/audio/B.wav
Normal file
BIN
captcha/audio/B.wav
Normal file
Binary file not shown.
BIN
captcha/audio/C.wav
Normal file
BIN
captcha/audio/C.wav
Normal file
Binary file not shown.
BIN
captcha/audio/D.wav
Normal file
BIN
captcha/audio/D.wav
Normal file
Binary file not shown.
BIN
captcha/audio/E.wav
Normal file
BIN
captcha/audio/E.wav
Normal file
Binary file not shown.
BIN
captcha/audio/F.wav
Normal file
BIN
captcha/audio/F.wav
Normal file
Binary file not shown.
BIN
captcha/audio/G.wav
Normal file
BIN
captcha/audio/G.wav
Normal file
Binary file not shown.
BIN
captcha/audio/H.wav
Normal file
BIN
captcha/audio/H.wav
Normal file
Binary file not shown.
BIN
captcha/audio/I.wav
Normal file
BIN
captcha/audio/I.wav
Normal file
Binary file not shown.
BIN
captcha/audio/J.wav
Normal file
BIN
captcha/audio/J.wav
Normal file
Binary file not shown.
BIN
captcha/audio/K.wav
Normal file
BIN
captcha/audio/K.wav
Normal file
Binary file not shown.
BIN
captcha/audio/L.wav
Normal file
BIN
captcha/audio/L.wav
Normal file
Binary file not shown.
BIN
captcha/audio/M.wav
Normal file
BIN
captcha/audio/M.wav
Normal file
Binary file not shown.
BIN
captcha/audio/MINUS.wav
Normal file
BIN
captcha/audio/MINUS.wav
Normal file
Binary file not shown.
BIN
captcha/audio/N.wav
Normal file
BIN
captcha/audio/N.wav
Normal file
Binary file not shown.
BIN
captcha/audio/O.wav
Normal file
BIN
captcha/audio/O.wav
Normal file
Binary file not shown.
BIN
captcha/audio/P.wav
Normal file
BIN
captcha/audio/P.wav
Normal file
Binary file not shown.
BIN
captcha/audio/PLUS.wav
Normal file
BIN
captcha/audio/PLUS.wav
Normal file
Binary file not shown.
BIN
captcha/audio/Q.wav
Normal file
BIN
captcha/audio/Q.wav
Normal file
Binary file not shown.
BIN
captcha/audio/R.wav
Normal file
BIN
captcha/audio/R.wav
Normal file
Binary file not shown.
BIN
captcha/audio/S.wav
Normal file
BIN
captcha/audio/S.wav
Normal file
Binary file not shown.
BIN
captcha/audio/T.wav
Normal file
BIN
captcha/audio/T.wav
Normal file
Binary file not shown.
BIN
captcha/audio/TIMES.wav
Normal file
BIN
captcha/audio/TIMES.wav
Normal file
Binary file not shown.
BIN
captcha/audio/U.wav
Normal file
BIN
captcha/audio/U.wav
Normal file
Binary file not shown.
BIN
captcha/audio/V.wav
Normal file
BIN
captcha/audio/V.wav
Normal file
Binary file not shown.
BIN
captcha/audio/W.wav
Normal file
BIN
captcha/audio/W.wav
Normal file
Binary file not shown.
BIN
captcha/audio/X.wav
Normal file
BIN
captcha/audio/X.wav
Normal file
Binary file not shown.
BIN
captcha/audio/Y.wav
Normal file
BIN
captcha/audio/Y.wav
Normal file
Binary file not shown.
BIN
captcha/audio/Z.wav
Normal file
BIN
captcha/audio/Z.wav
Normal file
Binary file not shown.
BIN
captcha/audio/error.wav
Normal file
BIN
captcha/audio/error.wav
Normal file
Binary file not shown.
BIN
captcha/audio/noise/check-point-1.wav
Normal file
BIN
captcha/audio/noise/check-point-1.wav
Normal file
Binary file not shown.
BIN
captcha/audio/noise/crowd-talking-1.wav
Normal file
BIN
captcha/audio/noise/crowd-talking-1.wav
Normal file
Binary file not shown.
BIN
captcha/audio/noise/crowd-talking-6.wav
Normal file
BIN
captcha/audio/noise/crowd-talking-6.wav
Normal file
Binary file not shown.
BIN
captcha/audio/noise/crowd-talking-7.wav
Normal file
BIN
captcha/audio/noise/crowd-talking-7.wav
Normal file
Binary file not shown.
BIN
captcha/audio/noise/kids-playing-1.wav
Normal file
BIN
captcha/audio/noise/kids-playing-1.wav
Normal file
Binary file not shown.
BIN
captcha/backgrounds/bg3.jpg
Normal file
BIN
captcha/backgrounds/bg3.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
captcha/backgrounds/bg4.jpg
Normal file
BIN
captcha/backgrounds/bg4.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
captcha/backgrounds/bg5.jpg
Normal file
BIN
captcha/backgrounds/bg5.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
BIN
captcha/backgrounds/bg6.png
Normal file
BIN
captcha/backgrounds/bg6.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
13
captcha/captcha.html
Normal file
13
captcha/captcha.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<!-- The following is example HTML that can be used on your form -->
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<img id="siimage" style="border: 1px solid #000; margin-right: 15px" src="./securimage_show.php?sid=<?php echo md5(uniqid()) ?>" alt="CAPTCHA Image" align="left">
|
||||||
|
<object type="application/x-shockwave-flash" data="./securimage_play.swf?bgcol=#ffffff&icon_file=./images/audio_icon.png&audio_file=./securimage_play.php" height="32" width="32">
|
||||||
|
<param name="movie" value="./securimage_play.swf?bgcol=#ffffff&icon_file=./images/audio_icon.png&audio_file=./securimage_play.php" />
|
||||||
|
</object>
|
||||||
|
|
||||||
|
<a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false"><img src="./images/refresh.png" alt="Reload Image" onclick="this.blur()" align="bottom" border="0"></a><br />
|
||||||
|
<strong>Enter Code*:</strong><br />
|
||||||
|
<input type="text" name="ct_captcha" size="12" maxlength="8" />
|
||||||
|
</p>
|
||||||
|
|
1
captcha/database/.htaccess
Normal file
1
captcha/database/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
deny from all
|
1
captcha/database/index.html
Normal file
1
captcha/database/index.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
BIN
captcha/database/securimage.sqlite
Normal file
BIN
captcha/database/securimage.sqlite
Normal file
Binary file not shown.
214
captcha/example_form.ajax.php
Normal file
214
captcha/example_form.ajax.php
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
<?php
|
||||||
|
session_start(); // this MUST be called prior to any output including whitespaces and line breaks!
|
||||||
|
|
||||||
|
$GLOBALS['ct_recipient'] = 'YOU@EXAMPLE.COM'; // Change to your email address!
|
||||||
|
$GLOBALS['ct_msg_subject'] = 'Securimage Test Contact Form';
|
||||||
|
|
||||||
|
$GLOBALS['DEBUG_MODE'] = 1;
|
||||||
|
// CHANGE TO 0 TO TURN OFF DEBUG MODE
|
||||||
|
// IN DEBUG MODE, ONLY THE CAPTCHA CODE IS VALIDATED, AND NO EMAIL IS SENT
|
||||||
|
|
||||||
|
|
||||||
|
// Process the form, if it was submitted
|
||||||
|
process_si_contact_form();
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
||||||
|
<title>Securimage Example Form</title>
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
#success_message { border: 1px solid #000; width: 550px; text-align: left; padding: 10px 7px; background: #33ff33; color: #000; font-weight; bold; font-size: 1.2em; border-radius: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px; }
|
||||||
|
fieldset { width: 90%; }
|
||||||
|
legend { font-size: 24px; }
|
||||||
|
.note { font-size: 18px; }
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function reloadCaptcha()
|
||||||
|
{
|
||||||
|
document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random();
|
||||||
|
}
|
||||||
|
|
||||||
|
function processForm()
|
||||||
|
{
|
||||||
|
new Ajax.Request('<?php echo $_SERVER['PHP_SELF'] ?>', {
|
||||||
|
method: 'post',
|
||||||
|
parameters: $('contact_form').serialize(),
|
||||||
|
onSuccess: function(transport) {
|
||||||
|
try {
|
||||||
|
var r = transport.responseText.evalJSON();
|
||||||
|
|
||||||
|
if (r.error == 0) {
|
||||||
|
$('success_message').show();
|
||||||
|
$('contact_form').reset();
|
||||||
|
reloadCaptcha();
|
||||||
|
setTimeout("$('success_message').hide()", 30000);
|
||||||
|
} else {
|
||||||
|
alert("There was an error with your submission.\n\n" + r.message);
|
||||||
|
}
|
||||||
|
} catch(ex) {
|
||||||
|
alert("There was an error parsing the json");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onFailure: function(err) {
|
||||||
|
alert("Ajax request failed");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>Example Form</legend>
|
||||||
|
|
||||||
|
<p class="note">
|
||||||
|
This is an example PHP form that processes user information, checks for errors, and validates the captcha code.<br />
|
||||||
|
This example form also demonstrates how to submit a form to itself to display error messages.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div id="success_message" style="display: none">Your message has been sent!<br />We will contact you as soon as possible.</div>
|
||||||
|
|
||||||
|
<form method="post" action="" id="contact_form" onsubmit="return processForm()">
|
||||||
|
<input type="hidden" name="do" value="contact" />
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Name*:</strong><br />
|
||||||
|
<input type="text" name="ct_name" size="35" value="" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Email*:</strong><br />
|
||||||
|
<input type="text" name="ct_email" size="35" value="" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>URL:</strong><br />
|
||||||
|
<input type="text" name="ct_URL" size="35" value="" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Message*:</strong><br />
|
||||||
|
<textarea name="ct_message" rows="12" cols="60"></textarea>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<img id="siimage" style="border: 1px solid #000; margin-right: 15px" src="./securimage_show.php?sid=<?php echo md5(uniqid()) ?>" alt="CAPTCHA Image" align="left" />
|
||||||
|
<object type="application/x-shockwave-flash" data="./securimage_play.swf?bgcol=#ffffff&icon_file=./images/audio_icon.png&audio_file=./securimage_play.php" height="32" width="32">
|
||||||
|
<param name="movie" value="./securimage_play.swf?bgcol=#ffffff&icon_file=./images/audio_icon.png&audio_file=./securimage_play.php" />
|
||||||
|
</object>
|
||||||
|
|
||||||
|
<a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false"><img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0" /></a><br />
|
||||||
|
<strong>Enter Code*:</strong><br />
|
||||||
|
<input type="text" name="ct_captcha" size="12" maxlength="8" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<br />
|
||||||
|
<input type="submit" value="Submit Message" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// The form processor PHP code
|
||||||
|
function process_si_contact_form()
|
||||||
|
{
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] == 'POST' && @$_POST['do'] == 'contact') {
|
||||||
|
// if the form has been submitted
|
||||||
|
|
||||||
|
foreach($_POST as $key => $value) {
|
||||||
|
if (!is_array($key)) {
|
||||||
|
// sanitize the input data
|
||||||
|
if ($key != 'ct_message') $value = strip_tags($value);
|
||||||
|
$_POST[$key] = htmlspecialchars(stripslashes(trim($value)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$name = @$_POST['ct_name']; // name from the form
|
||||||
|
$email = @$_POST['ct_email']; // email from the form
|
||||||
|
$URL = @$_POST['ct_URL']; // url from the form
|
||||||
|
$message = @$_POST['ct_message']; // the message from the form
|
||||||
|
$captcha = @$_POST['ct_captcha']; // the user's entry for the captcha code
|
||||||
|
$name = substr($name, 0, 64); // limit name to 64 characters
|
||||||
|
|
||||||
|
$errors = array(); // initialize empty error array
|
||||||
|
|
||||||
|
if (isset($GLOBALS['DEBUG_MODE']) && $GLOBALS['DEBUG_MODE'] == false) {
|
||||||
|
// only check for errors if the form is not in debug mode
|
||||||
|
|
||||||
|
if (strlen($name) < 3) {
|
||||||
|
// name too short, add error
|
||||||
|
$errors['name_error'] = 'Your name is required';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen($email) == 0) {
|
||||||
|
// no email address given
|
||||||
|
$errors['email_error'] = 'Email address is required';
|
||||||
|
} else if ( !preg_match('/^(?:[\w\d]+\.?)+@(?:(?:[\w\d]\-?)+\.)+\w{2,4}$/i', $email)) {
|
||||||
|
// invalid email format
|
||||||
|
$errors['email_error'] = 'Email address entered is invalid';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen($message) < 20) {
|
||||||
|
// message length too short
|
||||||
|
$errors['message_error'] = 'Please enter a message';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only try to validate the captcha if the form has no errors
|
||||||
|
// This is especially important for ajax calls
|
||||||
|
if (sizeof($errors) == 0) {
|
||||||
|
require_once dirname(__FILE__) . '/securimage.php';
|
||||||
|
$securimage = new Securimage();
|
||||||
|
|
||||||
|
if ($securimage->check($captcha) == false) {
|
||||||
|
$errors['captcha_error'] = 'Incorrect security code entered';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sizeof($errors) == 0) {
|
||||||
|
// no errors, send the form
|
||||||
|
$time = date('r');
|
||||||
|
$message = "A message was submitted from the contact form. The following information was provided.<br /><br />"
|
||||||
|
. "Name: $name<br />"
|
||||||
|
. "Email: $email<br />"
|
||||||
|
. "URL: $URL<br />"
|
||||||
|
. "Message:<br />"
|
||||||
|
. "<pre>$message</pre>"
|
||||||
|
. "<br /><br />IP Address: {$_SERVER['REMOTE_ADDR']}<br />"
|
||||||
|
. "Time: $time<br />"
|
||||||
|
. "Browser: {$_SERVER['HTTP_USER_AGENT']}<br />";
|
||||||
|
|
||||||
|
if (isset($GLOBALS['DEBUG_MODE']) && $GLOBALS['DEBUG_MODE'] == false) {
|
||||||
|
// send the message with mail()
|
||||||
|
mail($GLOBALS['ct_recipient'], $GLOBALS['ct_msg_subject'], $message, "From: {$GLOBALS['ct_recipient']}\r\nReply-To: {$email}\r\nContent-type: text/html; charset=ISO-8859-1\r\nMIME-Version: 1.0");
|
||||||
|
}
|
||||||
|
|
||||||
|
$return = array('error' => 0, 'message' => 'OK');
|
||||||
|
die(json_encode($return));
|
||||||
|
} else {
|
||||||
|
$errmsg = '';
|
||||||
|
foreach($errors as $key => $error) {
|
||||||
|
// set up error messages to display with each field
|
||||||
|
$errmsg .= " - {$error}\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$return = array('error' => 1, 'message' => $errmsg);
|
||||||
|
die(json_encode($return));
|
||||||
|
}
|
||||||
|
} // POST
|
||||||
|
} // function process_si_contact_form()
|
192
captcha/example_form.php
Normal file
192
captcha/example_form.php
Normal file
@ -0,0 +1,192 @@
|
|||||||
|
<?php
|
||||||
|
session_start(); // this MUST be called prior to any output including whitespaces and line breaks!
|
||||||
|
|
||||||
|
$GLOBALS['DEBUG_MODE'] = 1;
|
||||||
|
// CHANGE TO 0 TO TURN OFF DEBUG MODE
|
||||||
|
// IN DEBUG MODE, ONLY THE CAPTCHA CODE IS VALIDATED, AND NO EMAIL IS SENT
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
||||||
|
<title>Securimage Example Form</title>
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
.error { color: #f00; font-weight: bold; font-size: 1.2em; }
|
||||||
|
.success { color: #00f; font-weight: bold; font-size: 1.2em; }
|
||||||
|
fieldset { width: 90%; }
|
||||||
|
legend { font-size: 24px; }
|
||||||
|
.note { font-size: 18px;
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>Example Form</legend>
|
||||||
|
|
||||||
|
<p class="note">
|
||||||
|
This is an example PHP form that processes user information, checks for errors, and validates the captcha code.<br />
|
||||||
|
This example form also demonstrates how to submit a form to itself to display error messages.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$GLOBALS['ct_recipient'] = 'YOU@EXAMPLE.COm'; // Change to your email address!
|
||||||
|
$GLOBALS['ct_msg_subject'] = 'Securimage Test Contact Form';
|
||||||
|
|
||||||
|
process_si_contact_form(); // Process the form, if it was submitted
|
||||||
|
|
||||||
|
if (isset($_SESSION['ctform']['error']) && $_SESSION['ctform']['error'] == true): /* The last form submission had 1 or more errors */ ?>
|
||||||
|
<span class="error">There was a problem with your submission. Errors are displayed below in red.</span><br /><br />
|
||||||
|
<?php elseif (isset($_SESSION['ctform']['success']) && $_SESSION['ctform']['success'] == true): /* form was processed successfully */ ?>
|
||||||
|
<span class="success">The captcha was correct and the message has been sent!</span><br /><br />
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<form method="post" action="<?php echo $_SERVER['REQUEST_URI'] . $_SERVER['QUERY_STRING'] ?>" id="contact_form">
|
||||||
|
<input type="hidden" name="do" value="contact" />
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Name*:</strong> <?php echo @$_SESSION['ctform']['name_error'] ?><br />
|
||||||
|
<input type="text" name="ct_name" size="35" value="<?php echo htmlspecialchars(@$_SESSION['ctform']['ct_name']) ?>" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Email*:</strong> <?php echo @$_SESSION['ctform']['email_error'] ?><br />
|
||||||
|
<input type="text" name="ct_email" size="35" value="<?php echo htmlspecialchars(@$_SESSION['ctform']['ct_email']) ?>" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>URL:</strong> <?php echo @$_SESSION['ctform']['URL_error'] ?><br />
|
||||||
|
<input type="text" name="ct_URL" size="35" value="<?php echo htmlspecialchars(@$_SESSION['ctform']['ct_URL']) ?>" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Message*:</strong> <?php echo @$_SESSION['ctform']['message_error'] ?><br />
|
||||||
|
<textarea name="ct_message" rows="12" cols="60"><?php echo htmlspecialchars(@$_SESSION['ctform']['ct_message']) ?></textarea>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<img id="siimage" style="border: 1px solid #000; margin-right: 15px" src="./securimage_show.php?sid=<?php echo md5(uniqid()) ?>" alt="CAPTCHA Image" align="left" />
|
||||||
|
<object type="application/x-shockwave-flash" data="./securimage_play.swf?bgcol=#ffffff&icon_file=./images/audio_icon.png&audio_file=./securimage_play.php" height="32" width="32">
|
||||||
|
<param name="movie" value="./securimage_play.swf?bgcol=#ffffff&icon_file=./images/audio_icon.png&audio_file=./securimage_play.php" />
|
||||||
|
</object>
|
||||||
|
|
||||||
|
<a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false"><img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0" /></a><br />
|
||||||
|
<strong>Enter Code*:</strong><br />
|
||||||
|
<?php echo @$_SESSION['ctform']['captcha_error'] ?>
|
||||||
|
<input type="text" name="ct_captcha" size="12" maxlength="8" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<br />
|
||||||
|
<input type="submit" value="Submit Message" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// The form processor PHP code
|
||||||
|
function process_si_contact_form()
|
||||||
|
{
|
||||||
|
$_SESSION['ctform'] = array(); // re-initialize the form session data
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] == 'POST' && @$_POST['do'] == 'contact') {
|
||||||
|
// if the form has been submitted
|
||||||
|
|
||||||
|
foreach($_POST as $key => $value) {
|
||||||
|
if (!is_array($key)) {
|
||||||
|
// sanitize the input data
|
||||||
|
if ($key != 'ct_message') $value = strip_tags($value);
|
||||||
|
$_POST[$key] = htmlspecialchars(stripslashes(trim($value)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$name = @$_POST['ct_name']; // name from the form
|
||||||
|
$email = @$_POST['ct_email']; // email from the form
|
||||||
|
$URL = @$_POST['ct_URL']; // url from the form
|
||||||
|
$message = @$_POST['ct_message']; // the message from the form
|
||||||
|
$captcha = @$_POST['ct_captcha']; // the user's entry for the captcha code
|
||||||
|
$name = substr($name, 0, 64); // limit name to 64 characters
|
||||||
|
|
||||||
|
$errors = array(); // initialize empty error array
|
||||||
|
|
||||||
|
if (isset($GLOBALS['DEBUG_MODE']) && $GLOBALS['DEBUG_MODE'] == false) {
|
||||||
|
// only check for errors if the form is not in debug mode
|
||||||
|
|
||||||
|
if (strlen($name) < 3) {
|
||||||
|
// name too short, add error
|
||||||
|
$errors['name_error'] = 'Your name is required';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen($email) == 0) {
|
||||||
|
// no email address given
|
||||||
|
$errors['email_error'] = 'Email address is required';
|
||||||
|
} else if ( !preg_match('/^(?:[\w\d]+\.?)+@(?:(?:[\w\d]\-?)+\.)+\w{2,4}$/i', $email)) {
|
||||||
|
// invalid email format
|
||||||
|
$errors['email_error'] = 'Email address entered is invalid';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen($message) < 20) {
|
||||||
|
// message length too short
|
||||||
|
$errors['message_error'] = 'Please enter a message';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only try to validate the captcha if the form has no errors
|
||||||
|
// This is especially important for ajax calls
|
||||||
|
if (sizeof($errors) == 0) {
|
||||||
|
require_once dirname(__FILE__) . '/securimage.php';
|
||||||
|
$securimage = new Securimage();
|
||||||
|
|
||||||
|
if ($securimage->check($captcha) == false) {
|
||||||
|
$errors['captcha_error'] = 'Incorrect security code entered<br />';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sizeof($errors) == 0) {
|
||||||
|
// no errors, send the form
|
||||||
|
$time = date('r');
|
||||||
|
$message = "A message was submitted from the contact form. The following information was provided.<br /><br />"
|
||||||
|
. "Name: $name<br />"
|
||||||
|
. "Email: $email<br />"
|
||||||
|
. "URL: $URL<br />"
|
||||||
|
. "Message:<br />"
|
||||||
|
. "<pre>$message</pre>"
|
||||||
|
. "<br /><br />IP Address: {$_SERVER['REMOTE_ADDR']}<br />"
|
||||||
|
. "Time: $time<br />"
|
||||||
|
. "Browser: {$_SERVER['HTTP_USER_AGENT']}<br />";
|
||||||
|
|
||||||
|
$message = wordwrap($message, 70);
|
||||||
|
|
||||||
|
if (isset($GLOBALS['DEBUG_MODE']) && $GLOBALS['DEBUG_MODE'] == false) {
|
||||||
|
// send the message with mail()
|
||||||
|
mail($GLOBALS['ct_recipient'], $GLOBALS['ct_msg_subject'], $message, "From: {$GLOBALS['ct_recipient']}\r\nReply-To: {$email}\r\nContent-type: text/html; charset=ISO-8859-1\r\nMIME-Version: 1.0");
|
||||||
|
}
|
||||||
|
|
||||||
|
$_SESSION['ctform']['error'] = false; // no error with form
|
||||||
|
$_SESSION['ctform']['success'] = true; // message sent
|
||||||
|
} else {
|
||||||
|
// save the entries, this is to re-populate the form
|
||||||
|
$_SESSION['ctform']['ct_name'] = $name; // save name from the form submission
|
||||||
|
$_SESSION['ctform']['ct_email'] = $email; // save email
|
||||||
|
$_SESSION['ctform']['ct_URL'] = $URL; // save URL
|
||||||
|
$_SESSION['ctform']['ct_message'] = $message; // save message
|
||||||
|
|
||||||
|
foreach($errors as $key => $error) {
|
||||||
|
// set up error messages to display with each field
|
||||||
|
$_SESSION['ctform'][$key] = "<span style=\"font-weight: bold; color: #f00\">$error</span>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$_SESSION['ctform']['error'] = true; // set error floag
|
||||||
|
}
|
||||||
|
} // POST
|
||||||
|
}
|
||||||
|
|
||||||
|
$_SESSION['ctform']['success'] = false; // clear success value after running
|
60
captcha/examples/display_value.php
Normal file
60
captcha/examples/display_value.php
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display Value Captcha Example
|
||||||
|
* 2012-04-18
|
||||||
|
* @version 3.2RC2 (April 2012)
|
||||||
|
*
|
||||||
|
* This example shows how to use the "display_value" option in Securimage which
|
||||||
|
* allows the application to define the code that will be displayed on the
|
||||||
|
* captcha image.
|
||||||
|
*
|
||||||
|
* Note: This value is not stored in the session or database! The display_value
|
||||||
|
* parameter would be used by a 3rd party application that uses Securimage only
|
||||||
|
* to display captcha images, but generates and manages the codes independently.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Set debugging
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
|
||||||
|
// Defines Securimage class
|
||||||
|
require_once '../securimage.php';
|
||||||
|
|
||||||
|
// Create an array of options to give to Securimage
|
||||||
|
// This example sets the captcha text to the current time
|
||||||
|
// In order to use the display_value, a captchaId must be supplied so a random one is created
|
||||||
|
// Next we set turn off some unnecessary options and set properties of captcha
|
||||||
|
// image_width makes the image wide enough to hold the time
|
||||||
|
// no_session tells Securimage not to start or use a session to store codes
|
||||||
|
// no_exit tells Securimage not to terminate after calling Securimage::show()
|
||||||
|
// use_sqlite_db tells Securimage not to use SQLite
|
||||||
|
// send_headers tells Securimage not to send HTTP headers for the image; by not
|
||||||
|
// sending headers, you can capture the output and save it to file or serve it
|
||||||
|
// to the browser
|
||||||
|
|
||||||
|
$options = array('display_value' => date('h:i:s a'),
|
||||||
|
'captchaId' => sha1(uniqid($_SERVER['REMOTE_ADDR'] . $_SERVER['REMOTE_PORT'])),
|
||||||
|
'image_width' => 250,
|
||||||
|
'no_session' => true,
|
||||||
|
'no_exit' => true,
|
||||||
|
'use_sqlite_db' => false,
|
||||||
|
'send_headers' => false);
|
||||||
|
|
||||||
|
// construct new Securimage object with the given options
|
||||||
|
$img = new Securimage($options);
|
||||||
|
|
||||||
|
// show the image using the supplied display_value
|
||||||
|
// this demonstrates how to use output buffering to capture the output
|
||||||
|
|
||||||
|
ob_start(); // start the output buffer
|
||||||
|
$img->show(); // output the image so it is captured by the buffer
|
||||||
|
$imgBinary = ob_get_contents(); // get contents of the buffer
|
||||||
|
ob_end_clean(); // turn off buffering and clear the buffer
|
||||||
|
|
||||||
|
header('Content-Type: image/png');
|
||||||
|
header('Content-Length: ' . strlen($imgBinary));
|
||||||
|
|
||||||
|
echo $imgBinary;
|
||||||
|
|
65
captcha/examples/securimage_show_example.php
Normal file
65
captcha/examples/securimage_show_example.php
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Project: Securimage: A PHP class for creating and managing form CAPTCHA images<br />
|
||||||
|
* File: securimage_show_example.php<br />
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Drew Phillips
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Any modifications to the library should be indicated clearly in the source code
|
||||||
|
* to inform users that the changes are not a part of the original software.<br /><br />
|
||||||
|
*
|
||||||
|
* If you found this script useful, please take a quick moment to rate it.<br />
|
||||||
|
* http://www.hotscripts.com/rate/49400.html Thanks.
|
||||||
|
*
|
||||||
|
* @link http://www.phpcaptcha.org Securimage PHP CAPTCHA
|
||||||
|
* @link http://www.phpcaptcha.org/latest.zip Download Latest Version
|
||||||
|
* @link http://www.phpcaptcha.org/Securimage_Docs/ Online Documentation
|
||||||
|
* @copyright 2012 Drew Phillips
|
||||||
|
* @author Drew Phillips <drew@drew-phillips.com>
|
||||||
|
* @version 3.2RC2 (April 2012)
|
||||||
|
* @package Securimage
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once '../securimage.php';
|
||||||
|
|
||||||
|
$img = new Securimage();
|
||||||
|
|
||||||
|
//Change some settings
|
||||||
|
$img->image_width = 250;
|
||||||
|
$img->image_height = 80;
|
||||||
|
$img->perturbation = 0.85;
|
||||||
|
$img->image_bg_color = new Securimage_Color("#f6f6f6");
|
||||||
|
$img->use_transparent_text = true;
|
||||||
|
$img->text_transparency_percentage = 30; // 100 = completely transparent
|
||||||
|
$img->num_lines = 7;
|
||||||
|
$img->line_color = new Securimage_Color("#eaeaea");
|
||||||
|
$img->image_signature = 'phpcaptcha.org';
|
||||||
|
$img->signature_color = new Securimage_Color(rand(0, 64), rand(64, 128), rand(128, 255));
|
||||||
|
$img->use_wordlist = true;
|
||||||
|
|
||||||
|
$img->show('backgrounds/bg3.jpg'); // alternate use: $img->show('/path/to/background_image.jpg');
|
||||||
|
|
63
captcha/examples/securimage_show_example2.php
Normal file
63
captcha/examples/securimage_show_example2.php
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Project: Securimage: A PHP class for creating and managing form CAPTCHA images<br />
|
||||||
|
* File: securimage_show_example2.php<br />
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012, Drew Phillips
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Any modifications to the library should be indicated clearly in the source code
|
||||||
|
* to inform users that the changes are not a part of the original software.<br /><br />
|
||||||
|
*
|
||||||
|
* If you found this script useful, please take a quick moment to rate it.<br />
|
||||||
|
* http://www.hotscripts.com/rate/49400.html Thanks.
|
||||||
|
*
|
||||||
|
* @link http://www.phpcaptcha.org Securimage PHP CAPTCHA
|
||||||
|
* @link http://www.phpcaptcha.org/latest.zip Download Latest Version
|
||||||
|
* @link http://www.phpcaptcha.org/Securimage_Docs/ Online Documentation
|
||||||
|
* @copyright 2012 Drew Phillips
|
||||||
|
* @author Drew Phillips <drew@drew-phillips.com>
|
||||||
|
* @version 3.2RC2 (April 2012)
|
||||||
|
* @package Securimage
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once '../securimage.php';
|
||||||
|
|
||||||
|
$img = new Securimage();
|
||||||
|
|
||||||
|
//Change some settings
|
||||||
|
$img->image_width = 280;
|
||||||
|
$img->image_height = 100;
|
||||||
|
$img->perturbation = 0.9; // high level of distortion
|
||||||
|
$img->code_length = rand(5,6); // random code length
|
||||||
|
$img->image_bg_color = new Securimage_Color("#ffffff");
|
||||||
|
$img->num_lines = 12;
|
||||||
|
$img->noise_level = 5;
|
||||||
|
$img->text_color = new Securimage_Color("#000000");
|
||||||
|
$img->noise_color = $img->text_color;
|
||||||
|
$img->line_color = new Securimage_Color("#cccccc");
|
||||||
|
|
||||||
|
$img->show();
|
98
captcha/examples/static_captcha.php
Normal file
98
captcha/examples/static_captcha.php
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Static Captcha Example Script
|
||||||
|
* 2012-04-18
|
||||||
|
* @version 3.2RC2 (April 2012)
|
||||||
|
*
|
||||||
|
* The static captcha exposes an easy to use interface that applications can
|
||||||
|
* use to generate captcha challenges and validate them by a unique ID. A
|
||||||
|
* captcha image can be associated with an ID and no PHP sessions are required.
|
||||||
|
* The captcha ID can be stored in a SQLite database by Securimage.
|
||||||
|
*
|
||||||
|
* Tip: To give the user a refresh captcha button, use Ajax to request a new ID,
|
||||||
|
* update the hidden form input with the new captcha ID, and update the image source
|
||||||
|
* to securimage_show.php providing the captcha ID.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// set debugging
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
|
||||||
|
// defines Securimage class
|
||||||
|
require_once '../securimage.php';
|
||||||
|
|
||||||
|
// get the captcha ID from the url (if supplied)
|
||||||
|
$captchaId = (isset($_GET['id'])) ? $_GET['id'] : '';
|
||||||
|
|
||||||
|
// if the validate option is set
|
||||||
|
if (isset($_GET['validate'])) {
|
||||||
|
// get the user input of the captcha code
|
||||||
|
$input = (isset($_GET['input'])) ? $_GET['input'] : '';
|
||||||
|
|
||||||
|
// call Securimage::checkCaptchaId to validate input
|
||||||
|
// returns true if the code and id are a valid pair, false if not
|
||||||
|
if (Securimage::checkByCaptchaId($captchaId, $input) == true) {
|
||||||
|
echo "<h2>Success</h2>"
|
||||||
|
."<span style='color: #33cc00'>The captcha code entered was correct!</span>"
|
||||||
|
."<br /><br />";
|
||||||
|
} else {
|
||||||
|
echo "<h2>Incorrect Code</h2>"
|
||||||
|
."<span style='color: #f00'>Incorrect captcha code, try again.</span>"
|
||||||
|
."<br /><br />";
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (isset($_GET['display'])) {
|
||||||
|
// display the captcha with the supplied ID from the URL
|
||||||
|
|
||||||
|
// construct options specifying the existing captcha ID
|
||||||
|
// also tell securimage not to start a session
|
||||||
|
$options = array('captchaId' => $captchaId,
|
||||||
|
'no_session' => true);
|
||||||
|
$captcha = new Securimage($options);
|
||||||
|
|
||||||
|
// show the image, this sends proper HTTP headers
|
||||||
|
$captcha->show();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// generate a new captcha ID and challenge
|
||||||
|
$captchaId = Securimage::getCaptchaId();
|
||||||
|
|
||||||
|
// output the captcha ID, and a form to validate it
|
||||||
|
// the form submits to itself and is validated above
|
||||||
|
echo <<<EOD
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
||||||
|
<title>Static Captcha Example</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h2>Static Captcha Example</h2>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
Synopsis:
|
||||||
|
<ul>
|
||||||
|
<li>Request new captchaId using <em>Securimage::getCaptchaId()</em></li>
|
||||||
|
<li>Display form with hidden field containing captchaId</li>
|
||||||
|
<li>Display captcha image passing the captchaId to the image</li>
|
||||||
|
<li>Validate captcha input against captchaId using <em>Securimage::checkByCaptchaId()</em></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<p> </p>
|
||||||
|
<div>
|
||||||
|
Captcha ID: $captchaId<br /><br />
|
||||||
|
<img src="{$_SERVER['PHP_SELF']}?display&id=$captchaId" alt="Captcha Image" /><br />
|
||||||
|
|
||||||
|
<form method="get" action="{$_SERVER['PHP_SELF']}">
|
||||||
|
<input type="hidden" name="validate" value="1" />
|
||||||
|
<input type="hidden" name="id" value="$captchaId" />
|
||||||
|
Enter Code:
|
||||||
|
<input type="text" name="input" value="" />
|
||||||
|
<input type="submit" name="submit" value="Check Captcha" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOD;
|
BIN
captcha/images/audio_icon.png
Normal file
BIN
captcha/images/audio_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
captcha/images/refresh.png
Normal file
BIN
captcha/images/refresh.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
1
captcha/index.php
Normal file
1
captcha/index.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php header('Location: ../pages/frontpage.php'); ?>
|
1857
captcha/securimage.php
Normal file
1857
captcha/securimage.php
Normal file
File diff suppressed because it is too large
Load Diff
47
captcha/securimage_play.php
Normal file
47
captcha/securimage_play.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Project: Securimage: A PHP class for creating and managing form CAPTCHA images<br />
|
||||||
|
* File: securimage_play.php<br />
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or any later version.<br /><br />
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.<br /><br />
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA<br /><br />
|
||||||
|
*
|
||||||
|
* Any modifications to the library should be indicated clearly in the source code
|
||||||
|
* to inform users that the changes are not a part of the original software.<br /><br />
|
||||||
|
*
|
||||||
|
* If you found this script useful, please take a quick moment to rate it.<br />
|
||||||
|
* http://www.hotscripts.com/rate/49400.html Thanks.
|
||||||
|
*
|
||||||
|
* @link http://www.phpcaptcha.org Securimage PHP CAPTCHA
|
||||||
|
* @link http://www.phpcaptcha.org/latest.zip Download Latest Version
|
||||||
|
* @link http://www.phpcaptcha.org/Securimage_Docs/ Online Documentation
|
||||||
|
* @copyright 2012 Drew Phillips
|
||||||
|
* @author Drew Phillips <drew@drew-phillips.com>
|
||||||
|
* @version 3.2RC2 (April 2012)
|
||||||
|
* @package Securimage
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once dirname(__FILE__) . '/securimage.php';
|
||||||
|
|
||||||
|
$img = new Securimage();
|
||||||
|
|
||||||
|
// To use an alternate language, uncomment the following and download the files from phpcaptcha.org
|
||||||
|
// $img->audio_path = $img->securimage_path . '/audio/es/';
|
||||||
|
|
||||||
|
// If you have more than one captcha on a page, one must use a custom namespace
|
||||||
|
// $img->namespace = 'form2';
|
||||||
|
|
||||||
|
$img->outputAudioFile();
|
BIN
captcha/securimage_play.swf
Normal file
BIN
captcha/securimage_play.swf
Normal file
Binary file not shown.
77
captcha/securimage_show.php
Normal file
77
captcha/securimage_show.php
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Project: Securimage: A PHP class for creating and managing form CAPTCHA images<br />
|
||||||
|
* File: securimage_show.php<br />
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011, Drew Phillips
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Any modifications to the library should be indicated clearly in the source code
|
||||||
|
* to inform users that the changes are not a part of the original software.<br /><br />
|
||||||
|
*
|
||||||
|
* If you found this script useful, please take a quick moment to rate it.<br />
|
||||||
|
* http://www.hotscripts.com/rate/49400.html Thanks.
|
||||||
|
*
|
||||||
|
* @link http://www.phpcaptcha.org Securimage PHP CAPTCHA
|
||||||
|
* @link http://www.phpcaptcha.org/latest.zip Download Latest Version
|
||||||
|
* @link http://www.phpcaptcha.org/Securimage_Docs/ Online Documentation
|
||||||
|
* @copyright 2012 Drew Phillips
|
||||||
|
* @author Drew Phillips <drew@drew-phillips.com>
|
||||||
|
* @version 3.2RC2 (April 2012)
|
||||||
|
* @package Securimage
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Remove the "//" from the following line for debugging problems
|
||||||
|
// error_reporting(E_ALL); ini_set('display_errors', 1);
|
||||||
|
|
||||||
|
require_once dirname(__FILE__) . '/securimage.php';
|
||||||
|
|
||||||
|
$img = new Securimage();
|
||||||
|
|
||||||
|
// You can customize the image by making changes below, some examples are included - remove the "//" to uncomment
|
||||||
|
|
||||||
|
//$img->ttf_file = './Quiff.ttf';
|
||||||
|
//$img->captcha_type = Securimage::SI_CAPTCHA_MATHEMATIC; // show a simple math problem instead of text
|
||||||
|
//$img->case_sensitive = true; // true to use case sensitve codes - not recommended
|
||||||
|
//$img->image_height = 90; // width in pixels of the image
|
||||||
|
//$img->image_width = $img->image_height * M_E; // a good formula for image size
|
||||||
|
//$img->perturbation = .75; // 1.0 = high distortion, higher numbers = more distortion
|
||||||
|
//$img->image_bg_color = new Securimage_Color("#0099CC"); // image background color
|
||||||
|
//$img->text_color = new Securimage_Color("#EAEAEA"); // captcha text color
|
||||||
|
//$img->num_lines = 8; // how many lines to draw over the image
|
||||||
|
//$img->line_color = new Securimage_Color("#0000CC"); // color of lines over the image
|
||||||
|
//$img->image_type = SI_IMAGE_JPEG; // render as a jpeg image
|
||||||
|
//$img->signature_color = new Securimage_Color(rand(0, 64),
|
||||||
|
// rand(64, 128),
|
||||||
|
// rand(128, 255)); // random signature color
|
||||||
|
|
||||||
|
// see securimage.php for more options that can be set
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$img->show(); // outputs the image and content headers to the browser
|
||||||
|
// alternate use:
|
||||||
|
// $img->show('/path/to/background_image.jpg');
|
15457
captcha/words/words.txt
Normal file
15457
captcha/words/words.txt
Normal file
File diff suppressed because it is too large
Load Diff
1
engine/cache/deaths.cache.php
vendored
Normal file
1
engine/cache/deaths.cache.php
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"time":"0","level":"8","killed_by":"Testing","is_player":"1","mostdamage_by":"Testing","mostdamage_is_player":"1","unjustified":"1","mostdamage_unjustified":"1","victim":"Znote"},{"time":"0","level":"8","killed_by":"Rat","is_player":"0","mostdamage_by":"Cave Rat","mostdamage_is_player":"0","unjustified":"0","mostdamage_unjustified":"0","victim":"Testing"}]
|
1
engine/cache/gallery.cache.php
vendored
Normal file
1
engine/cache/gallery.cache.php
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"title":"Quest Done!","desc":"Yaay! Finally!","date":"1370715254","image":"4!47qyHg!jpg"},{"title":"Testing stuff.","desc":"I am testing if this system still works.","date":"1370561230","image":"1!hqxwUn!png"}]
|
1
engine/cache/highscores.cache.php
vendored
Normal file
1
engine/cache/highscores.cache.php
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
[false,false,false,false,false,false,false,false,false]
|
1
engine/cache/houses.cache.php
vendored
Normal file
1
engine/cache/houses.cache.php
vendored
Normal file
File diff suppressed because one or more lines are too long
1
engine/cache/houses/sqldata.cache.php
vendored
Normal file
1
engine/cache/houses/sqldata.cache.php
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"name":"Znote","id":"3"},{"name":"Mister Dude","id":"4"}]
|
1
engine/cache/killers.cache.php
vendored
Normal file
1
engine/cache/killers.cache.php
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"killed_by":"Testing","kills":"1"}]
|
1
engine/cache/lastkillers.cache.php
vendored
Normal file
1
engine/cache/lastkillers.cache.php
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"victim":"Znote","killed_by":"Testing","time":"0"}]
|
1
engine/cache/news.cache.php
vendored
Normal file
1
engine/cache/news.cache.php
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"id":"7","title":"BBcode test","text":"[size=6][b]Big size 6 bold text[\/b][\/size]\r\n[img]http:\/\/media.npr.org\/assets\/img\/2013\/01\/29\/cat-bird_wide-85ce4b8383b9440d3ff03413cdd913513e9737bf-s6-c30.jpg[\/img]\r\n[center]Centered text[\/center]\r\n\r\n[b]Bold text[\/b]\r\n[color=red]Red Text[\/color]\r\n[color=green]green Text[\/color]\r\n\r\n[*]element 1[\/*]\r\n[*]element 2[\/*]\r\n[*]element 3[\/*]\r\n\r\nLink without text assigned:\r\n[link]http:\/\/otland.net\/f118\/znote-aac-1-3-forgotten-server-0-2-13-forgotten-server-0-3-6-0-4-a-166722\/[\/link]\r\n\r\nLink with text assigned:\r\n[link=http:\/\/otland.net\/f118\/znote-aac-1-3-forgotten-server-0-2-13-forgotten-server-0-3-6-0-4-a-166722\/]CLICK HERE TO VIEW ZNOTE AAC[\/link]","date":"1370778017","name":"Znote"}]
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user