i have register form ! this is check registering :
<?php
// Database .......
//PHP Code For request and etc
$sql=mysql_query("select username from members where (username='$username' or email='$email')");
$rst=mysql_fetch_array($sql);
if($rst) // check if username and email found show template
{
function main() // generate site template
{
// php code
if($rst["email"]==$_REQUEST["email"])
{
$msg1=" member with email <b>$email</b> already exists.";
}
else
{
$msg1=" member with username <b>$username</b> already exists.";
}
?>
<div> <?php echo $msg1; ?> </div> <- example template
<?php
}
include_once "temp.php"; // html based template
}
else
{
// php code for save data in Mysql database and send email to user and more
header("Location: signin.php?errmsg=".urlencode("You are successfully registered"));
die();
}
?>
now i check captcha with this method :
if (empty($_REQUEST['captcha'])) {
echo "field empty"; }
else
{// check true or false captcha . . .
}
now for show true or false message in template in need to add this to function main() .
Example :
if(($_SESSION['_captcha']) or ($rst)) // this is my problem
function main() {
// etc
}
else
{// etc
}
Now How to fix this ?