[svn] * Moved regular script to simple folder, added an expanded version of it.
* Expanded is still in beta so may have errors. --HG-- branch : trunk
@@ -0,0 +1,30 @@
|
||||
= Trinity Core -- Account registration form =
|
||||
|
||||
Copyright (C) Trinity Core (http://www.trinitycore.org)
|
||||
|
||||
This is the somewhat expanded version account registration
|
||||
form that allows users to register game accounts on the web.
|
||||
|
||||
Its still very ugly, but if you get bored enough and make it
|
||||
look somewhat better, feel free to shoot me back a better version
|
||||
and I will include it here with credits :)
|
||||
|
||||
To run this, you will need:
|
||||
|
||||
* MySQL 5.0.45+
|
||||
* A PHP5+ equipped web server
|
||||
|
||||
To install this registration form, simply copy everything to
|
||||
a folder on your web server. You can rename it to anything you
|
||||
like, but it's recommended to keep it as "index.php" and put it
|
||||
in a dedicated directory, such as "/home/public_html/register".
|
||||
|
||||
In order for the script to work correctly, you must rename
|
||||
db.conf.php.dist to db.conf.php and then fill out the correct values.
|
||||
|
||||
|
||||
TODO :
|
||||
Make it look better
|
||||
Allow email checking by sending a code in an email to be confirmed.
|
||||
Maybe switch to recaptcha.
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
// Configuration.
|
||||
// Realm database.
|
||||
$r_db = "realmd";
|
||||
// IP (and port).
|
||||
$ip = "127.0.0.1:3306";
|
||||
// Username.
|
||||
$user = "trinity";
|
||||
// Password.
|
||||
$pass = "trinity";
|
||||
// Site title.
|
||||
$title = "Registration Form";
|
||||
$title2 = "Some Server";
|
||||
// End config.
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,231 @@
|
||||
<?php
|
||||
/*
|
||||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
::
|
||||
:: GIFEncoder Version 2.0 by László Zsidi, http://gifs.hu
|
||||
::
|
||||
:: This class is a rewritten 'GifMerge.class.php' version.
|
||||
::
|
||||
:: Modification:
|
||||
:: - Simplified and easy code,
|
||||
:: - Ultra fast encoding,
|
||||
:: - Built-in errors,
|
||||
:: - Stable working
|
||||
::
|
||||
::
|
||||
:: Updated at 2007. 02. 13. '00.05.AM'
|
||||
::
|
||||
*/
|
||||
Class GIFEncoder {
|
||||
var $GIF = "GIF89a"; /* GIF header 6 bytes */
|
||||
var $VER = "GIFEncoder V2.06"; /* Encoder version */
|
||||
|
||||
var $BUF = Array ( );
|
||||
var $LOP = 0;
|
||||
var $DIS = 2;
|
||||
var $COL = -1;
|
||||
var $IMG = -1;
|
||||
|
||||
var $ERR = Array (
|
||||
'ERR00' =>"Does not supported function for only one image!",
|
||||
'ERR01' =>"Source is not a GIF image!",
|
||||
'ERR02' =>"Unintelligible flag ",
|
||||
'ERR03' =>"Could not make animation from animated GIF source",
|
||||
);
|
||||
|
||||
/*
|
||||
:::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
::
|
||||
:: GIFEncoder...
|
||||
::
|
||||
*/
|
||||
function GIFEncoder (
|
||||
$GIF_src, $GIF_dly, $GIF_lop, $GIF_dis,
|
||||
$GIF_red, $GIF_grn, $GIF_blu, $GIF_mod
|
||||
) {
|
||||
if ( ! is_array ( $GIF_src ) && ! is_array ( $GIF_tim ) ) {
|
||||
printf ( "%s: %s", $this->VER, $this->ERR [ 'ERR00' ] );
|
||||
exit ( 0 );
|
||||
}
|
||||
$this->LOP = ( $GIF_lop > -1 ) ? $GIF_lop : 0;
|
||||
$this->DIS = ( $GIF_dis > -1 ) ? ( ( $GIF_dis < 3 ) ? $GIF_dis : 3 ) : 2;
|
||||
$this->COL = ( $GIF_red > -1 && $GIF_grn > -1 && $GIF_blu > -1 ) ?
|
||||
( $GIF_red | ( $GIF_grn << 8 ) | ( $GIF_blu << 16 ) ) : -1;
|
||||
|
||||
for ( $i = 0; $i < count ( $GIF_src ); $i++ ) {
|
||||
if ( strToLower ( $GIF_mod ) == "url" ) {
|
||||
$this->BUF [ ] = fread ( fopen ( $GIF_src [ $i ], "rb" ), filesize ( $GIF_src [ $i ] ) );
|
||||
}
|
||||
else if ( strToLower ( $GIF_mod ) == "bin" ) {
|
||||
$this->BUF [ ] = $GIF_src [ $i ];
|
||||
}
|
||||
else {
|
||||
printf ( "%s: %s ( %s )!", $this->VER, $this->ERR [ 'ERR02' ], $GIF_mod );
|
||||
exit ( 0 );
|
||||
}
|
||||
if ( substr ( $this->BUF [ $i ], 0, 6 ) != "GIF87a" && substr ( $this->BUF [ $i ], 0, 6 ) != "GIF89a" ) {
|
||||
printf ( "%s: %d %s", $this->VER, $i, $this->ERR [ 'ERR01' ] );
|
||||
exit ( 0 );
|
||||
}
|
||||
for ( $j = ( 13 + 3 * ( 2 << ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 ) ) ), $k = TRUE; $k; $j++ ) {
|
||||
switch ( $this->BUF [ $i ] { $j } ) {
|
||||
case "!":
|
||||
if ( ( substr ( $this->BUF [ $i ], ( $j + 3 ), 8 ) ) == "NETSCAPE" ) {
|
||||
printf ( "%s: %s ( %s source )!", $this->VER, $this->ERR [ 'ERR03' ], ( $i + 1 ) );
|
||||
exit ( 0 );
|
||||
}
|
||||
break;
|
||||
case ";":
|
||||
$k = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
GIFEncoder::GIFAddHeader ( );
|
||||
for ( $i = 0; $i < count ( $this->BUF ); $i++ ) {
|
||||
GIFEncoder::GIFAddFrames ( $i, $GIF_dly [ $i ] );
|
||||
}
|
||||
GIFEncoder::GIFAddFooter ( );
|
||||
}
|
||||
/*
|
||||
:::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
::
|
||||
:: GIFAddHeader...
|
||||
::
|
||||
*/
|
||||
function GIFAddHeader ( ) {
|
||||
$cmap = 0;
|
||||
|
||||
if ( ord ( $this->BUF [ 0 ] { 10 } ) & 0x80 ) {
|
||||
$cmap = 3 * ( 2 << ( ord ( $this->BUF [ 0 ] { 10 } ) & 0x07 ) );
|
||||
|
||||
$this->GIF .= substr ( $this->BUF [ 0 ], 6, 7 );
|
||||
$this->GIF .= substr ( $this->BUF [ 0 ], 13, $cmap );
|
||||
$this->GIF .= "!\377\13NETSCAPE2.0\3\1" . GIFEncoder::GIFWord ( $this->LOP ) . "\0";
|
||||
}
|
||||
}
|
||||
/*
|
||||
:::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
::
|
||||
:: GIFAddFrames...
|
||||
::
|
||||
*/
|
||||
function GIFAddFrames ( $i, $d ) {
|
||||
|
||||
$Locals_str = 13 + 3 * ( 2 << ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 ) );
|
||||
|
||||
$Locals_end = strlen ( $this->BUF [ $i ] ) - $Locals_str - 1;
|
||||
$Locals_tmp = substr ( $this->BUF [ $i ], $Locals_str, $Locals_end );
|
||||
|
||||
$Global_len = 2 << ( ord ( $this->BUF [ 0 ] { 10 } ) & 0x07 );
|
||||
$Locals_len = 2 << ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 );
|
||||
|
||||
$Global_rgb = substr ( $this->BUF [ 0 ], 13,
|
||||
3 * ( 2 << ( ord ( $this->BUF [ 0 ] { 10 } ) & 0x07 ) ) );
|
||||
$Locals_rgb = substr ( $this->BUF [ $i ], 13,
|
||||
3 * ( 2 << ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 ) ) );
|
||||
|
||||
$Locals_ext = "!\xF9\x04" . chr ( ( $this->DIS << 2 ) + 0 ) .
|
||||
chr ( ( $d >> 0 ) & 0xFF ) . chr ( ( $d >> 8 ) & 0xFF ) . "\x0\x0";
|
||||
|
||||
if ( $this->COL > -1 && ord ( $this->BUF [ $i ] { 10 } ) & 0x80 ) {
|
||||
for ( $j = 0; $j < ( 2 << ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 ) ); $j++ ) {
|
||||
if (
|
||||
ord ( $Locals_rgb { 3 * $j + 0 } ) == ( $this->COL >> 0 ) & 0xFF &&
|
||||
ord ( $Locals_rgb { 3 * $j + 1 } ) == ( $this->COL >> 8 ) & 0xFF &&
|
||||
ord ( $Locals_rgb { 3 * $j + 2 } ) == ( $this->COL >> 16 ) & 0xFF
|
||||
) {
|
||||
$Locals_ext = "!\xF9\x04" . chr ( ( $this->DIS << 2 ) + 1 ) .
|
||||
chr ( ( $d >> 0 ) & 0xFF ) . chr ( ( $d >> 8 ) & 0xFF ) . chr ( $j ) . "\x0";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch ( $Locals_tmp { 0 } ) {
|
||||
case "!":
|
||||
$Locals_img = substr ( $Locals_tmp, 8, 10 );
|
||||
$Locals_tmp = substr ( $Locals_tmp, 18, strlen ( $Locals_tmp ) - 18 );
|
||||
break;
|
||||
case ",":
|
||||
$Locals_img = substr ( $Locals_tmp, 0, 10 );
|
||||
$Locals_tmp = substr ( $Locals_tmp, 10, strlen ( $Locals_tmp ) - 10 );
|
||||
break;
|
||||
}
|
||||
if ( ord ( $this->BUF [ $i ] { 10 } ) & 0x80 && $this->IMG > -1 ) {
|
||||
if ( $Global_len == $Locals_len ) {
|
||||
if ( GIFEncoder::GIFBlockCompare ( $Global_rgb, $Locals_rgb, $Global_len ) ) {
|
||||
$this->GIF .= ( $Locals_ext . $Locals_img . $Locals_tmp );
|
||||
}
|
||||
else {
|
||||
$byte = ord ( $Locals_img { 9 } );
|
||||
$byte |= 0x80;
|
||||
$byte &= 0xF8;
|
||||
$byte |= ( ord ( $this->BUF [ 0 ] { 10 } ) & 0x07 );
|
||||
$Locals_img { 9 } = chr ( $byte );
|
||||
$this->GIF .= ( $Locals_ext . $Locals_img . $Locals_rgb . $Locals_tmp );
|
||||
}
|
||||
}
|
||||
else {
|
||||
$byte = ord ( $Locals_img { 9 } );
|
||||
$byte |= 0x80;
|
||||
$byte &= 0xF8;
|
||||
$byte |= ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 );
|
||||
$Locals_img { 9 } = chr ( $byte );
|
||||
$this->GIF .= ( $Locals_ext . $Locals_img . $Locals_rgb . $Locals_tmp );
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->GIF .= ( $Locals_ext . $Locals_img . $Locals_tmp );
|
||||
}
|
||||
$this->IMG = 1;
|
||||
}
|
||||
/*
|
||||
:::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
::
|
||||
:: GIFAddFooter...
|
||||
::
|
||||
*/
|
||||
function GIFAddFooter ( ) {
|
||||
$this->GIF .= ";";
|
||||
}
|
||||
/*
|
||||
:::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
::
|
||||
:: GIFBlockCompare...
|
||||
::
|
||||
*/
|
||||
function GIFBlockCompare ( $GlobalBlock, $LocalBlock, $Len ) {
|
||||
|
||||
for ( $i = 0; $i < $Len; $i++ ) {
|
||||
if (
|
||||
$GlobalBlock { 3 * $i + 0 } != $LocalBlock { 3 * $i + 0 } ||
|
||||
$GlobalBlock { 3 * $i + 1 } != $LocalBlock { 3 * $i + 1 } ||
|
||||
$GlobalBlock { 3 * $i + 2 } != $LocalBlock { 3 * $i + 2 }
|
||||
) {
|
||||
return ( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
return ( 1 );
|
||||
}
|
||||
/*
|
||||
:::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
::
|
||||
:: GIFWord...
|
||||
::
|
||||
*/
|
||||
function GIFWord ( $int ) {
|
||||
|
||||
return ( chr ( $int & 0xFF ) . chr ( ( $int >> 8 ) & 0xFF ) );
|
||||
}
|
||||
/*
|
||||
:::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
::
|
||||
:: GetAnimation...
|
||||
::
|
||||
*/
|
||||
function GetAnimation ( ) {
|
||||
return ( $this->GIF );
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,82 @@
|
||||
<?
|
||||
session_start( );
|
||||
/**
|
||||
@package AnimatedCaptcha
|
||||
@author J Watkins <[email protected]>
|
||||
@desc OOP Interface to AnimCaptcha ( PHP 5 )
|
||||
@static
|
||||
**/
|
||||
class AnimCaptcha
|
||||
{
|
||||
static $frames ;
|
||||
static $time ;
|
||||
static $num ;
|
||||
static $pause ;
|
||||
static $ops ;
|
||||
static $gifs ;
|
||||
static $rand ;
|
||||
static $math ;
|
||||
|
||||
function AnimCaptcha( $gifs, $pause )
|
||||
{
|
||||
if( !class_exists( 'GIFEncoder' ) and !include('GIFEncoder.class.php') )
|
||||
die( 'I require GIFEncoder to be loaded before operation' );
|
||||
|
||||
self::$pause = (int)$pause ;
|
||||
self::$gifs = $gifs ;
|
||||
self::$ops = array
|
||||
(
|
||||
'minus',
|
||||
'plus',
|
||||
'times'
|
||||
);
|
||||
self::$math = array
|
||||
(
|
||||
'-',
|
||||
'+',
|
||||
'*'
|
||||
);
|
||||
|
||||
self::$num['rand1'] = rand( 1, 9 );
|
||||
self::$num['rand2'] = rand( 1, 9 );
|
||||
self::$num['op'] = rand( 0, count( self::$math ) - 1 );
|
||||
|
||||
self::BuildImage( );
|
||||
}
|
||||
function BuildImage( )
|
||||
{
|
||||
self::$frames[ ] = sprintf( '%s/solve.gif', self::$gifs ) ;
|
||||
self::$time[ ] = 260;
|
||||
self::$frames[ ] = sprintf( '%s/%d.gif', self::$gifs, self::$num['rand1'] );
|
||||
self::$time[ ] = self::$pause;
|
||||
self::$frames[ ] = sprintf( '%s/%s.gif', self::$gifs, self::$ops[ self::$num['op'] ] );
|
||||
self::$time[ ] = self::$pause;
|
||||
self::$frames[ ] = sprintf( '%s/%d.gif', self::$gifs, self::$num['rand2'] );
|
||||
self::$time[ ] = self::$pause;
|
||||
self::$frames[ ] = "frames/equals.gif" ;
|
||||
self::$time [ ] = 280;
|
||||
foreach( self::$num as $index => $value ) $_SESSION[ $index ] = self::$num[ $value ];
|
||||
}
|
||||
function GetImage( )
|
||||
{
|
||||
eval( sprintf( '$_SESSION["answer"] = (%d %s %d);',
|
||||
self::$num['rand1'],
|
||||
self::$math[ self::$num['op'] ],
|
||||
self::$num['rand2']
|
||||
) );
|
||||
|
||||
if( $_SESSION['answer'] < 0 )
|
||||
self::AnimCaptcha( self::$gifs, self::$pause );
|
||||
|
||||
$gif = new GIFEncoder( self::$frames, self::$time, 0, 2, 0, 0, 0, "url" );
|
||||
|
||||
if( !headers_sent( ) )
|
||||
{
|
||||
header ( 'Content-type:image/gif' );
|
||||
echo $gif->GetAnimation ( );
|
||||
}
|
||||
}
|
||||
}
|
||||
new AnimCaptcha( 'frames', 140 );
|
||||
AnimCaptcha::GetImage( );
|
||||
?>
|
||||
|
After Width: | Height: | Size: 871 B |
|
After Width: | Height: | Size: 575 B |
|
After Width: | Height: | Size: 506 B |
|
After Width: | Height: | Size: 560 B |
|
After Width: | Height: | Size: 644 B |
|
After Width: | Height: | Size: 544 B |
|
After Width: | Height: | Size: 557 B |
|
After Width: | Height: | Size: 524 B |
|
After Width: | Height: | Size: 660 B |
|
After Width: | Height: | Size: 684 B |
|
After Width: | Height: | Size: 561 B |
|
After Width: | Height: | Size: 683 B |
|
After Width: | Height: | Size: 566 B |
|
After Width: | Height: | Size: 535 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 698 B |
|
After Width: | Height: | Size: 2.8 KiB |
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
/*
|
||||
AnimCaptcha v1.3 >> 6-13-07
|
||||
|
||||
This Animated Gif Captcha system is brought to you courtesy of ...
|
||||
[email protected] ==> Josh Storz
|
||||
http://www.querythe.net/Animated-Gif-Captcha/ ==> Download Current Version
|
||||
|
||||
OOP (PHP 4 & 5) Interface by ...
|
||||
[email protected] ==> J Watkins
|
||||
|
||||
The GIFEncoder class was written by ...
|
||||
http://gifs.hu ==> László Zsidi
|
||||
http://www.phpclasses.org/browse/package/3163.html ==> Download Current Version
|
||||
|
||||
This file is part of QueryThe.Net's AnimatedCaptcha Package.
|
||||
|
||||
QueryThe.Net's AnimatedCaptcha 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
|
||||
(at your option) any later version.
|
||||
|
||||
QueryThe.Net's AnimatedCaptcha 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.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with QueryThe.Net's AnimatedCaptcha; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
include "GIFEncoder.class.php";
|
||||
|
||||
function add_random_frames($frame) {
|
||||
// random number & elapsed time of frames to *hopefully* make a cracker's life tougher
|
||||
|
||||
global $frames ;
|
||||
global $time ;
|
||||
|
||||
$i = 0;
|
||||
$loop = rand(6, 14); // total number of frames in loop loop
|
||||
|
||||
while ($i < $loop)
|
||||
{
|
||||
$frames [ ] = "frames/$frame.gif"; // use the solve frame so that the human eye cannot see a flicker
|
||||
$time [ ] = rand(15, 25); // 5 * 20 = 1 second so the delay is never too terribly long
|
||||
$i ++ ;
|
||||
}
|
||||
}
|
||||
|
||||
// get random numbers & operator and make sure the answer is >= 0
|
||||
$k = 0 ;
|
||||
while($k == 0)
|
||||
{
|
||||
$rand1 = rand(1, 9); // 1st number (1-9)
|
||||
$rand3 = rand(1, 9); // 2nd number (1-9)
|
||||
$rand2 = rand(0, 2); // operator (-,+,*)
|
||||
|
||||
if (($rand2 != 0) || ($rand3 < $rand1)) $k = 1 ;
|
||||
}
|
||||
|
||||
// set sessions for numbers, operator & answer. Only $_SESSION['answer'] is necessary. Others are for displaying full equation if you desire.
|
||||
$_SESSION['r1'] = $rand1 ;
|
||||
$_SESSION['r3'] = $rand3 ;
|
||||
|
||||
if ($rand2 == 0) {$_SESSION['r2'] = " - " ; $_SESSION['answer'] = $rand1 - $rand3 ; $frame_operator = "minus" ;}
|
||||
elseif ($rand2 == 1) {$_SESSION['r2'] = " + " ; $_SESSION['answer'] = $rand1 + $rand3 ; $frame_operator = "plus" ;}
|
||||
else {$_SESSION['r2'] = " * " ; $_SESSION['answer'] = $rand1 * $rand3 ; $frame_operator = "times" ;}
|
||||
|
||||
// build the frame images and elapsed time to show in 2 arrays
|
||||
$frames [ ] = "frames/solve.gif" ; // Intro message " Prove you are human ... "
|
||||
$time [ ] = 140;
|
||||
add_random_frames('solve') ;
|
||||
|
||||
// set 1st random number
|
||||
$frames [ ] = "frames/" .$rand1. ".gif"; // 1st number (0-9)
|
||||
$time [ ] = 35;
|
||||
add_random_frames($rand1) ;
|
||||
|
||||
// set frame for operator
|
||||
$frames [ ] = "frames/" .$frame_operator. ".gif" ;
|
||||
$time [ ] = 60;
|
||||
add_random_frames($frame_operator) ;
|
||||
|
||||
// set 2nd random number
|
||||
$frames [ ] = "frames/" .$rand3. ".gif"; // 2nd number (0-9)
|
||||
$time [ ] = 35;
|
||||
add_random_frames($rand3) ;
|
||||
|
||||
|
||||
// set final frame for equals
|
||||
$frames [ ] = "frames/equals.gif" ; // Ending message " equals = "
|
||||
$time [ ] = 140; // equals frame time (100 = 1 second)
|
||||
add_random_frames('equals') ;
|
||||
|
||||
// encode the gif using the class to avoid gd dependencies
|
||||
$gif = new GIFEncoder (
|
||||
$frames, // frames array
|
||||
$time, // elapsed time array
|
||||
0, // loops (0 = infinite)
|
||||
2, // disposal
|
||||
0, 0, 0, // rgb of transparency
|
||||
"url" // source type
|
||||
);
|
||||
|
||||
// display the image
|
||||
Header ( 'Content-type:image/gif' );
|
||||
echo $gif->GetAnimation ( );
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,504 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 (at your option) any later version.
|
||||
|
||||
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.
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
// Password strength meter v2.0
|
||||
// Matthew R. Miller - 2007
|
||||
// www.codeandcoffee.com
|
||||
// Based off of code from:
|
||||
// http://www.intelligent-web.co.uk
|
||||
// http://www.geekwisdom.com/dyn/passwdmeter
|
||||
|
||||
/*
|
||||
Password Strength Algorithm:
|
||||
|
||||
Password Length:
|
||||
5 Points: Less than 4 characters
|
||||
10 Points: 5 to 7 characters
|
||||
25 Points: 8 or more
|
||||
|
||||
Letters:
|
||||
0 Points: No letters
|
||||
10 Points: Letters are all lower case
|
||||
20 Points: Letters are upper case and lower case
|
||||
|
||||
Numbers:
|
||||
0 Points: No numbers
|
||||
10 Points: 1 number
|
||||
20 Points: 3 or more numbers
|
||||
|
||||
Characters:
|
||||
0 Points: No characters
|
||||
10 Points: 1 character
|
||||
25 Points: More than 1 character
|
||||
|
||||
Bonus:
|
||||
2 Points: Letters and numbers
|
||||
3 Points: Letters, numbers, and characters
|
||||
5 Points: Mixed case letters, numbers, and characters
|
||||
|
||||
Password Text Range:
|
||||
|
||||
>= 90: Very Secure
|
||||
>= 80: Secure
|
||||
>= 70: Very Strong
|
||||
>= 60: Strong
|
||||
>= 50: Average
|
||||
>= 25: Weak
|
||||
>= 0: Very Weak
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// Settings
|
||||
// -- Toggle to true or false, if you want to change what is checked in the password
|
||||
var m_strUpperCase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
var m_strLowerCase = "abcdefghijklmnopqrstuvwxyz";
|
||||
var m_strNumber = "0123456789";
|
||||
var m_strCharacters = "!@#$%^&*?_~"
|
||||
|
||||
// Check password
|
||||
function checkPassword(strPassword)
|
||||
{
|
||||
// Reset combination count
|
||||
var nScore = 0;
|
||||
|
||||
// Password length
|
||||
// -- Less than 4 characters
|
||||
if (strPassword.length < 5)
|
||||
{
|
||||
nScore += 5;
|
||||
}
|
||||
// -- 5 to 7 characters
|
||||
else if (strPassword.length > 4 && strPassword.length < 8)
|
||||
{
|
||||
nScore += 10;
|
||||
}
|
||||
// -- 8 or more
|
||||
else if (strPassword.length > 7)
|
||||
{
|
||||
nScore += 25;
|
||||
}
|
||||
|
||||
// Letters
|
||||
var nUpperCount = countContain(strPassword, m_strUpperCase);
|
||||
var nLowerCount = countContain(strPassword, m_strLowerCase);
|
||||
var nLowerUpperCount = nUpperCount + nLowerCount;
|
||||
// -- Letters are all lower case
|
||||
if (nUpperCount == 0 && nLowerCount != 0)
|
||||
{
|
||||
nScore += 10;
|
||||
}
|
||||
// -- Letters are upper case and lower case
|
||||
else if (nUpperCount != 0 && nLowerCount != 0)
|
||||
{
|
||||
nScore += 20;
|
||||
}
|
||||
|
||||
// Numbers
|
||||
var nNumberCount = countContain(strPassword, m_strNumber);
|
||||
// -- 1 number
|
||||
if (nNumberCount == 1)
|
||||
{
|
||||
nScore += 10;
|
||||
}
|
||||
// -- 3 or more numbers
|
||||
if (nNumberCount >= 3)
|
||||
{
|
||||
nScore += 20;
|
||||
}
|
||||
|
||||
// Characters
|
||||
var nCharacterCount = countContain(strPassword, m_strCharacters);
|
||||
// -- 1 character
|
||||
if (nCharacterCount == 1)
|
||||
{
|
||||
nScore += 10;
|
||||
}
|
||||
// -- More than 1 character
|
||||
if (nCharacterCount > 1)
|
||||
{
|
||||
nScore += 25;
|
||||
}
|
||||
|
||||
// Bonus
|
||||
// -- Letters and numbers
|
||||
if (nNumberCount != 0 && nLowerUpperCount != 0)
|
||||
{
|
||||
nScore += 2;
|
||||
}
|
||||
// -- Letters, numbers, and characters
|
||||
if (nNumberCount != 0 && nLowerUpperCount != 0 && nCharacterCount != 0)
|
||||
{
|
||||
nScore += 3;
|
||||
}
|
||||
// -- Mixed case letters, numbers, and characters
|
||||
if (nNumberCount != 0 && nUpperCount != 0 && nLowerCount != 0 && nCharacterCount != 0)
|
||||
{
|
||||
nScore += 5;
|
||||
}
|
||||
|
||||
|
||||
return nScore;
|
||||
}
|
||||
|
||||
// Runs password through check and then updates GUI
|
||||
function runPassword(strPassword, strFieldID)
|
||||
{
|
||||
// Check password
|
||||
var nScore = checkPassword(strPassword);
|
||||
|
||||
// Get controls
|
||||
var ctlBar = document.getElementById(strFieldID + "_bar");
|
||||
var ctlText = document.getElementById(strFieldID + "_text");
|
||||
if (!ctlBar || !ctlText)
|
||||
return;
|
||||
|
||||
// Set new width
|
||||
ctlBar.style.width = nScore + "%";
|
||||
|
||||
// Color and text
|
||||
// -- Very Secure
|
||||
if (nScore >= 90)
|
||||
{
|
||||
var strText = "Very Secure";
|
||||
var strColor = "#0ca908";
|
||||
}
|
||||
// -- Secure
|
||||
else if (nScore >= 80)
|
||||
{
|
||||
var strText = "Secure";
|
||||
vstrColor = "#7ff67c";
|
||||
}
|
||||
// -- Very Strong
|
||||
else if (nScore >= 70)
|
||||
{
|
||||
var strText = "Very Strong";
|
||||
var strColor = "#1740ef";
|
||||
}
|
||||
// -- Strong
|
||||
else if (nScore >= 60)
|
||||
{
|
||||
var strText = "Strong";
|
||||
var strColor = "#5a74e3";
|
||||
}
|
||||
// -- Average
|
||||
else if (nScore >= 50)
|
||||
{
|
||||
var strText = "Average";
|
||||
var strColor = "#e3cb00";
|
||||
}
|
||||
// -- Weak
|
||||
else if (nScore >= 25)
|
||||
{
|
||||
var strText = "Weak";
|
||||
var strColor = "#e7d61a";
|
||||
}
|
||||
// -- Very Weak
|
||||
else
|
||||
{
|
||||
var strText = "Very Weak";
|
||||
var strColor = "#e71a1a";
|
||||
}
|
||||
ctlBar.style.backgroundColor = strColor;
|
||||
ctlText.innerHTML = "<span style='color: " + strColor + ";'>" + strText + " - " + nScore + "</span>";
|
||||
}
|
||||
|
||||
// Checks a string for a list of characters
|
||||
function countContain(strPassword, strCheck)
|
||||
{
|
||||
// Declare variables
|
||||
var nCount = 0;
|
||||
|
||||
for (i = 0; i < strPassword.length; i++)
|
||||
{
|
||||
if (strCheck.indexOf(strPassword.charAt(i)) > -1)
|
||||
{
|
||||
nCount++;
|
||||
}
|
||||
}
|
||||
|
||||
return nCount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,269 @@
|
||||
<?php
|
||||
session_start();
|
||||
include("db.conf.php");
|
||||
|
||||
$page = '<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
|
||||
#tooltip{
|
||||
position: absolute;
|
||||
left: -300px;
|
||||
width: 150px;
|
||||
border: 1px solid black;
|
||||
padding: 2px;
|
||||
background-color: black;
|
||||
visibility: hidden;
|
||||
z-index: 100;
|
||||
filter: progid:DXImageTransform.Microsoft.Shadow(color=gray,direction=135);
|
||||
}
|
||||
|
||||
#dhtmlpointer{
|
||||
position:absolute;
|
||||
left: -300px;
|
||||
z-index: 101;
|
||||
visibility: hidden;
|
||||
}
|
||||
</style>
|
||||
<title>' . $title . '</title>
|
||||
</head>
|
||||
<body style="background-color:black;color:yellow;font-family:verdana;">
|
||||
<script type="text/javascript">
|
||||
var offsetfromcursorX=12 //Customize x offset of tooltip
|
||||
var offsetfromcursorY=10 //Customize y offset of tooltip
|
||||
|
||||
var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
|
||||
var offsetdivfrompointerY=14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).
|
||||
|
||||
document.write(\'<div id="tooltip"></div>\') //write out tooltip DIV
|
||||
document.write(\'<img id="dhtmlpointer" src="inc/arrow2.gif">\') //write out pointer image
|
||||
|
||||
var ie=document.all
|
||||
var ns6=document.getElementById && !document.all
|
||||
var enabletip=false
|
||||
if (ie||ns6)
|
||||
var tipobj=document.all? document.all["tooltip"] : document.getElementById? document.getElementById("tooltip") : ""
|
||||
|
||||
var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""
|
||||
|
||||
function ietruebody(){
|
||||
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
|
||||
}
|
||||
|
||||
function ttip(thetext, thewidth, thecolor){
|
||||
if (ns6||ie){
|
||||
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
|
||||
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
|
||||
tipobj.innerHTML=thetext
|
||||
enabletip=true
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function positiontip(e){
|
||||
if (enabletip){
|
||||
var nondefaultpos=false
|
||||
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
|
||||
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
|
||||
var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
|
||||
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20
|
||||
|
||||
var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
|
||||
var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY
|
||||
|
||||
var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000
|
||||
|
||||
if (rightedge<tipobj.offsetWidth){
|
||||
tipobj.style.left=curX-tipobj.offsetWidth+"px"
|
||||
nondefaultpos=true
|
||||
}
|
||||
else if (curX<leftedge)
|
||||
tipobj.style.left="5px"
|
||||
else{
|
||||
tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
|
||||
pointerobj.style.left=curX+offsetfromcursorX+"px"
|
||||
}
|
||||
|
||||
if (bottomedge<tipobj.offsetHeight){
|
||||
tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
|
||||
nondefaultpos=true
|
||||
}
|
||||
else{
|
||||
tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
|
||||
pointerobj.style.top=curY+offsetfromcursorY+"px"
|
||||
}
|
||||
tipobj.style.visibility="visible"
|
||||
if (!nondefaultpos)
|
||||
pointerobj.style.visibility="visible"
|
||||
else
|
||||
pointerobj.style.visibility="hidden"
|
||||
}
|
||||
}
|
||||
|
||||
function hidettip(){
|
||||
if (ns6||ie){
|
||||
enabletip=false
|
||||
tipobj.style.visibility="hidden"
|
||||
pointerobj.style.visibility="hidden"
|
||||
tipobj.style.left="-1000px"
|
||||
tipobj.style.backgroundColor=\'\'
|
||||
tipobj.style.width=\'\'
|
||||
}
|
||||
}
|
||||
document.onmousemove=positiontip
|
||||
</script>
|
||||
<form method="post" action="' . $_SERVER["SCRIPT_NAME"] . '">
|
||||
<p style="text-align:center;">
|
||||
<strong>' . $title2 . ' - ' . $title . '</strong>
|
||||
<br /><br /><br />
|
||||
Username:
|
||||
<br /><input name="username" type="text" maxlength="14" /><img src="inc/help.gif" HEIGHT="20" WIDTH="20" alt="help" onMouseover="ttip(\'username must be 5 - 14 chars long\', 300)"; onMouseout="hidettip()"><br />
|
||||
Password:
|
||||
<br /><input name="password" type="password" maxlength="12" onkeyup="runPassword(this.value, \'mypassword\');" /><img src="inc/help.gif" HEIGHT="20" WIDTH="20" alt="help" onMouseover="ttip(\'Password must be 6 - 12 chars long\', 300)"; onMouseout="hidettip()">
|
||||
<div style="width: 100px;text-align:center;">
|
||||
<div id="mypassword_text" style="font-size: 10px;"></div>
|
||||
<div id="mypassword_bar" style="font-size: 1px; height: 2px; width: 0px; border: 1px solid white;"></div>
|
||||
</div></p>
|
||||
<br />
|
||||
<p style="text-align:center;">Email:
|
||||
<br /><input name="email" type="text" maxlength="50" /><img src="inc/help.gif" HEIGHT="20" WIDTH="20" alt="help" onMouseover="ttip(\'Email must be 15 - 50 chars long\', 300)"; onMouseout="hidettip()"><br />
|
||||
<INPUT TYPE=RADIO NAME="expansion" VALUE="0" >Original -
|
||||
<INPUT TYPE=RADIO NAME="expansion" VALUE="1" CHECKED >TBC -
|
||||
<INPUT TYPE=RADIO NAME="expansion" VALUE="2" >WOTLK<br />
|
||||
<img src="inc/OOP5.php" style="border: 1px dashed silver;"><br />
|
||||
<span style="font-size:9px;"><a href="">New question</a></span><br />
|
||||
<input type="text" style="width:160px;" name="AnimCaptcha"><img src="inc/help.gif" HEIGHT="20" WIDTH="20" alt="help" onMouseover="ttip(\'Are you a bot? are you? thats it...im getting my junior torturer kit, dont go anywhere i\'ll be right back.\', 300)"; onMouseout="hidettip()"><br />
|
||||
<br />
|
||||
<img src="inc/help.gif" HEIGHT="20" WIDTH="20" alt="help" onMouseover="ttip(\'Yes everything must be filled. quit whining.\', 300)"; onMouseout="hidettip()"><button type="submit">Submit</button>
|
||||
</p>
|
||||
</form>
|
||||
<script type="text/javascript" src="inc/pwd_strength.js"></script>
|
||||
</body>
|
||||
</html>';
|
||||
|
||||
function error_s ($text) {
|
||||
echo("<p style=\"background-color:black;color:yellow;font-family:verdana;\">" . $text);
|
||||
echo("<br /><br /><a style=\"color:orange;\" href=\"" . $_SERVER["SCRIPT_NAME"] . "\">Go back...</a></p>");
|
||||
};
|
||||
|
||||
$user_chars = "#[^a-zA-Z0-9_\-]#";
|
||||
$email_chars = "/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}$/";
|
||||
|
||||
$con = @mysql_connect($ip, $user, $pass);
|
||||
if (!$con) {
|
||||
error_s("Unable to connect to database: " . mysql_error());
|
||||
};
|
||||
|
||||
if (!empty($_POST)) {
|
||||
if ((empty($_POST["username"]))||(empty($_POST["password"]))||(empty($_POST["email"]))||(empty($_POST["expansion"])) ) {
|
||||
error_s("You did not enter all the required information.");
|
||||
exit();
|
||||
} else {
|
||||
$username = strtoupper($_POST["username"]);
|
||||
$password = strtoupper($_POST["password"]);
|
||||
$email = strtoupper($_POST["email"]);
|
||||
if (strlen($username) < 5) {
|
||||
error_s("Username too short.");
|
||||
exit();
|
||||
};
|
||||
if (strlen($username) > 14) {
|
||||
error_s("Username too long.");
|
||||
exit();
|
||||
};
|
||||
if (strlen($password) < 6) {
|
||||
error_s("Password too short.");
|
||||
exit();
|
||||
};
|
||||
if (strlen($password) > 12) {
|
||||
error_s("Password too long.");
|
||||
exit();
|
||||
};
|
||||
if (strlen($email) < 15) {
|
||||
error_s("Email was too short.");
|
||||
exit();
|
||||
};
|
||||
if (strlen($email) > 50) {
|
||||
error_s("Email was too long.");
|
||||
exit();
|
||||
};
|
||||
if (preg_match($user_chars,$username)) {
|
||||
error_s("Username contained illegal characters.");
|
||||
exit();
|
||||
};
|
||||
if (preg_match($user_chars,$password)) {
|
||||
error_s("Password contained illegal characters.");
|
||||
exit();
|
||||
};
|
||||
if (!preg_match($email_chars,$email)) {
|
||||
error_s("Email was in an incorrect format.");
|
||||
exit();
|
||||
};
|
||||
$username = mysql_real_escape_string($username);
|
||||
$password = mysql_real_escape_string($password);
|
||||
$email = mysql_real_escape_string($email);
|
||||
$qry = @mysql_query("select username from " . mysql_real_escape_string($r_db) . ".account where username = '" . $username . "'", $con);
|
||||
if (!$qry) {
|
||||
error_s("Error querying database: " . mysql_error());
|
||||
};
|
||||
if ($existing_username = mysql_fetch_assoc($qry)) {
|
||||
foreach ($existing_username as $key => $value) {
|
||||
$existing_username = $value;
|
||||
};
|
||||
};
|
||||
$existing_username = strtoupper($existing_username);
|
||||
if ($existing_username == strtoupper($_POST['username'])) {
|
||||
error_s("That username is already taken.");
|
||||
exit();
|
||||
};
|
||||
unset($qry);
|
||||
$qry = @mysql_query("select email from " . mysql_real_escape_string($r_db) . ".account where email = '" . $email . "'", $con);
|
||||
if (!$qry) {
|
||||
error_s("Error querying database: " . mysql_error());
|
||||
};
|
||||
if ($existing_email = mysql_fetch_assoc($qry)) {
|
||||
foreach ($existing_email as $key => $value) {
|
||||
$existing_email = $value;
|
||||
};
|
||||
};
|
||||
if ($existing_email == $_POST['email']) {
|
||||
error_s("That email is already in use.");
|
||||
exit();
|
||||
};
|
||||
unset($qry);
|
||||
$sha_pass_hash = sha1(strtoupper($username) . ":" . strtoupper($password));
|
||||
$register_sql = "insert into " . mysql_real_escape_string($r_db) . ".account (username, sha_pass_hash, email, expansion) values (upper('" . $username . "'),'" . $sha_pass_hash . "','" . $email . "','" . $expansion . "')";
|
||||
if (isset($_POST['AnimCaptcha']))
|
||||
{
|
||||
if (is_numeric($_POST['AnimCaptcha']))
|
||||
{
|
||||
if ( $_POST['AnimCaptcha'] == $_SESSION['answer'])
|
||||
{
|
||||
$qry = @mysql_query($register_sql, $con);
|
||||
}
|
||||
else
|
||||
{
|
||||
error_s("Captcha not filled properly</b></p><p><a href=''>Try again</a></p>");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error_s("<p><b>Enter Numbers or (+/-) only. No alphabetical characters accepted.</b></p><p><a href=''>Try again</a></p>");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
if (!$qry) {
|
||||
error_s("Error creating account: " . mysql_error());
|
||||
};
|
||||
echo("Account successfully created.");
|
||||
exit();
|
||||
};
|
||||
} else {
|
||||
echo($page);
|
||||
};
|
||||
|
||||
echo '<center><a href="http://www.trinitycore.org">Trinity Powered</a></center>';
|
||||
|
||||
?>
|
||||