I need some help on creating a captcha generator for my registration form. People are using wpe pro to spam my registration and it is waisting mysql space. If any help creating one i have to thank you.
Here is my registration code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>DigiChat Member</title>
<link rel="stylesheet" href="images/main.css" media="screen">
<link rel="stylesheet" href="images/colors.css" media="screen">
<link href="loginmodule.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.style1 {
color: #CCCCCC;
font-style: italic;
font-weight: bold;
}
</style>
</head>
<body>
<p> </p>
<p> </p>
<div id="container">
<div id="header">
<a id="logo" href="#" title="Support Center"><img src="images/head.png" alt="Support Center" width="801" height="64" border="0"></a></div>
<ul id="nav">
<li><a class="ticket_status" href="./index.php">Home</a></li>
<li><a class="new_ticket" href="./members.php">Members</a><a class="new_ticket" href="./register.php">Register</a><a class="new_ticket" href="./news.php">News</a></li>
<li></li>
</ul>
<div id="content">
<div id="index"><?php
if( isset($_SESSION['ERRMSG_ARR']) && is_array($_SESSION['ERRMSG_ARR']) && count($_SESSION['ERRMSG_ARR']) >0 ) {
echo '<ul class="err">';
foreach($_SESSION['ERRMSG_ARR'] as $msg) {
echo '<li>',$msg,'</li>';
}
echo '</ul>';
unset($_SESSION['ERRMSG_ARR']);
}
?>
<h1 align="left">Register A Free Account! </h1>
<form id="loginForm" name="loginForm" method="post" action="register-exec.php">
<p> </p>
<table width="300" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<th>First Name </th>
<td><input name="fname" type="text" class="textfield" id="fname" /></td>
</tr>
<tr>
<th width="124">Real Name </th>
<td width="168"><input name="realname" type="text" class="textfield" id="realname" /></td>
</tr>
<tr>
<th>Last Name </th>
<td><input name="lname" type="text" class="textfield" id="lname" /></td>
</tr>
<tr>
<th>Login</th>
<td><input name="login" type="text" class="textfield" id="login" /></td>
</tr>
<tr>
<th>Site ID</th>
<td><input name="SiteID" type="text" class="textfield" id="SiteID" /></td>
</tr>
<tr>
<th>Age</th>
<td><input name="Age" type="text" class="textfield" id="Age" /></td>
</tr>
<tr>
<th>Exit Message </th>
<td><input name="exitmessage" type="text" class="textfield" id="exitmessage" /></td>
</tr>
<tr>
<th>Comments </th>
<td><input name="comments" type="text" class="textfield" id="comments" /></td>
</tr>
<tr>
<th>Url</th>
<td><input name="Url" type="text" class="textfield" id="Url" /></td>
</tr>
<tr>
<th>Password</th>
<td><input name="password" type="password" class="textfield" id="password" /></td>
</tr>
<tr>
<th>Confirm Password </th>
<td><input name="cpassword" type="password" class="textfield" id="cpassword" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Register" /></td>
</tr>
</table>
</form>
</div>
<div style="clear:both"></div>
</div>
<div id="footer"></div>
</div>
<div align="center">
<img src="images/poweredby.png" alt="Powered by osTicket" height="38" width="802"></div>
</body></html>
and i would like one for my login if possible to impliment:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>DigiChat Member</title>
<link rel="stylesheet" href="images/main.css" media="screen">
<link rel="stylesheet" href="images/colors.css" media="screen">
<link href="loginmodule.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.style1 {
color: #CCCCCC;
font-style: italic;
font-weight: bold;
}
</style>
</head>
<body>
<p> </p>
<p> </p>
<div id="container">
<div id="header">
<a id="logo" href="#" title="Support Center"><img src="images/head.png" alt="Support Center" width="801" height="64" border="0"></a></div>
<ul id="nav">
<li><a class="ticket_status" href="./index.php">Home</a></li>
<li><a class="new_ticket" href="./members.php">Members</a><a class="new_ticket" href="./register.php">Register</a><a class="new_ticket" href="./news.php">News</a></li>
<li></li>
</ul>
<div id="content">
<div id="index">
<h1>Welcome to DigiScript MemberShip</h1>
<p class="big">DigiScript Membership is a php/msql web based membership script. It's sole purpose is to provide a simple and easy database to allow new and old users to sign into your chat server. By allowing users to register and login, they can pick a variety of setting's for their profile and be able to login to your chat only as a member. </p>
<hr>
<table width="773" height="147" border="0" align="left">
<tr>
<td width="407"><h3 align="center"><span class="rcol">Login To Your Account! </span></h3>
<p align="center">Please be sure to login to your free account with the correct detail's you inserted when registering, Thank You. </p>
<form id="loginForm" name="loginForm" method="post" action="login-exec.php">
<table width="300" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td width="112"><b>Login</b></td>
<td width="188"><input name="login" type="text" class="style1" id="login" /></td>
</tr>
<tr>
<td><b>Password</b></td>
<td><input name="password" type="password" class="style1" id="password" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit2" value="Login" /></td>
</tr>
</table>
</form>
</td>
<td width="407"><h3 align="center"><span class="rcol">Register Now! </span></h3>
<p align="center">Registering an account is free and safe to use. Without registering, you cannot access our chat system. </p>
<form>
<div align="center">
<input name="BUTTON" type="BUTTON" onClick="window.location.href='./register.php'" value="Register">
</div>
</form>
</td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p><br>
</p>
</div>
<div style="clear:both"></div>
</div>
<div id="footer"></div>
</div>
<div align="center">
<img src="images/poweredby.png" alt="Powered by DigiChat.info" height="38" width="802"></div>
</body></html>
Thank you in advanced!
Regards,
Virgin Mobile
No help? This is quit depressing.
Hello,
I have a registration form here is the source: 'register.php'
<?php session_start() ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>DigiChat Member</title>
<link rel="stylesheet" href="images/main.css" media="screen">
<link rel="stylesheet" href="images/colors.css" media="screen">
<link href="loginmodule.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.style1 {
color: #CC;
font-style: italic;
font-weight: bold;
}
</style>
</head>
<body>
<p> </p>
<p> </p>
<div id="container">
<div id="header">
<a id="logo" href="#" title="Support Center"><img src="images/head.png" alt="Support Center" width="801" height="64" border="0"></a></div>
<ul id="nav">
<li><a class="ticket_status" href="./index.php">Home</a></li>
<li><a class="new_ticket" href="./members.php">Members</a><a class="new_ticket" href="./register.php">Register</a><a class="new_ticket" href="./news.php">News</a></li>
<li></li>
</ul>
<div id="content">
<div id="index"><?php
if( isset($_SESSION['ERRMSG_ARR']) && is_array($_SESSION['ERRMSG_ARR']) && count($_SESSION['ERRMSG_ARR']) >0 ) {
echo '<ul class="err">';
foreach($_SESSION['ERRMSG_ARR'] as $msg) {
echo '<li>',$msg,'</li>';
}
echo '</ul>';
unset($_SESSION['ERRMSG_ARR']);
}
?>
<h1 align="left">Register A Free Account! </h1>
<form id="loginForm" name="loginForm" method="post" action="register-exec.php">
<p> </p>
<table width="300" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<th>First Name </th>
<td><input name="fname" type="text" class="textfield" id="fname" /></td>
</tr>
<tr>
<th width="124">Real Name </th>
<td width="168"><input name="realname" type="text" class="textfield" id="realname" /></td>
</tr>
<tr>
<th>Last Name </th>
<td><input name="lname" type="text" class="textfield" id="lname" /></td>
</tr>
<tr>
<th>Login</th>
<td><input name="login" type="text" class="textfield" id="login" /></td>
</tr>
<tr>
<th>Site ID</th>
<td><input name="SiteID" type="text" class="textfield" id="SiteID" /></td>
</tr>
<tr>
<th>Age</th>
<td><input name="Age" type="text" class="textfield" id="Age" /></td>
</tr>
<tr>
<th>Exit Message </th>
<td><input name="exitmessage" type="text" class="textfield" id="exitmessage" /></td>
</tr>
<tr>
<th>Comments </th>
<td><input name="comments" type="text" class="textfield" id="comments" /></td>
</tr>
<tr>
<th>Url</th>
<td><input name="Url" type="text" class="textfield" id="Url" /></td>
</tr>
<tr>
<th>Password</th>
<td><input name="password" type="password" class="textfield" id="password" /></td>
</tr>
<tr>
<th>Confirm Password </th>
<td><input name="cpassword" type="password" class="textfield" id="cpassword" /></td>
</tr>
<tr>
<tr></tr>
<tr></tr>
<tr></tr>
<td></td>
<td><input type="submit" name="Submit" value="Register" /></td>
</tr>
</table>
</form>
</div>
<div style="clear:both"></div>
</div>
<div id="footer"></div>
</div>
<div align="center">
<img src="images/poweredby.png" height="38" width="802"></div>
</body></html>
And it's validation: 'login-exec.php'
<?php
//Start session
session_start();
//Include database connection details
require_once('config.php');
//Array to store validation errors
$errmsg_arr = array();
//Validation error flag
$errflag = false;
//Connect to mysql server
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
die('Failed to connect to server: ' . mysql_error());
}
//Select database
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
die("Unable to select database");
}
//Function to sanitize values received from the form. Prevents SQL injection
function clean($str) {
$str = @trim($str);
if(get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
return mysql_real_escape_string($str);
}
//Sanitize the POST values
$fname = clean($_POST['fname']);
$lname = clean($_POST['lname']);
$login = clean($_POST['login']);
$SiteID = clean($_POST['SiteID']);
$Age = clean($_POST['Age']);
$Url = clean($_POST['Url']);
$realname = clean($_POST['realname']);
$exitmessage = clean($_POST['exitmessage']);
$comments = clean($_POST['comments']);
$password = clean($_POST['password']);
$cpassword = clean($_POST['cpassword']);
//Input Validations
if($fname == '') {
$errmsg_arr[] = 'First name missing';
$errflag = true;
}
if($lname == '') {
$errmsg_arr[] = 'Last name missing';
$errflag = true;
}
if($login == '') {
$errmsg_arr[] = 'Login ID missing';
$errflag = true;
}
if($SiteID == '') {
$errmsg_arr[] = 'Site ID missing';
$errflag = true;
}
if($Age == '') {
$errmsg_arr[] = 'Age missing';
$errflag = true;
}
if($Url == '') {
$errmsg_arr[] = 'Url missing';
$errflag = true;
}
if($exitmessage == '') {
$errmsg_arr[] = 'Exit Message missing';
$errflag = true;
}
if($comments == '') {
$errmsg_arr[] = 'Comments missing';
$errflag = true;
}
if($realname == '') {
$errmsg_arr[] = 'Real Name missing';
$errflag = true;
}
if($password == '') {
$errmsg_arr[] = 'Password missing';
$errflag = true;
}
if($cpassword == '') {
$errmsg_arr[] = 'Confirm password missing';
$errflag = true;
}
if( strcmp($password, $cpassword) != 0 ) {
$errmsg_arr[] = 'Passwords do not match';
$errflag = true;
}
//Check for duplicate login ID
if($login != '') {
$qry = "SELECT * FROM members WHERE login='$login'";
$result = mysql_query($qry);
if($result) {
if(mysql_num_rows($result) > 0) {
$errmsg_arr[] = 'Login ID already in use';
$errflag = true;
}
@mysql_free_result($result);
}
else {
die("Query failed");
}
}
//If there are input validations, redirect back to the registration form
if($errflag) {
$_SESSION['ERRMSG_ARR'] = $errmsg_arr;
session_write_close();
header("location: register.php");
exit();
}
//Create INSERT query
$qry = "INSERT INTO members(firstname, lastname, login, SiteID, Age, Url, exitmessage, comments, realname, passwd) VALUES('$fname','$lname','$login','$SiteID','$Age','$Url','$exitmessage','$comments','$realname','".md5($_POST['password'])."')";
$result = @mysql_query($qry);
//Check whether the query was successful or not
if($result) {
header("location: success.php");
exit();
}else {
die("Query failed");
}
?>
I would like to implement a captcha code in my registration form but i am slow at knowing exactly how to do that. The captcha i would like to do is on this site. If i could get help with this is would really appreciate it, thank you!
Site: http://www.adscaptcha.com/Resources.aspx#php
Regards,
xxcorrosionxx
:sneaky:


Sign In
Create Account

Back to top









