This is Ashok from India
As I'm a Beginner in PHP so I need your help to solve my Problem
My Code is here
Code: Select all
<?php
//All database connections are running Successfully
function validateEmail($email){
$output = "This address may be valid.";
$email = trim($email);
If ((strlen($email)<5) or strstr($email," ")){
$output = "ERROR";
}
If (substr_count($email, "@")<>1){
$output = "ERROR";
}
Else{ #it has an at,split into 2 halves on the @
$halves=explode ("@", $email);
If (strlen($halves[0])<1 or strlen($halves[1])<=3){
$output = "ERROR";
}
If (substr($halves[0],0,1)=="." or substr($halves[0],-1,1)=="."){
$output = "ERROR";
}
If (substr($halves[1],0,1)=="." or substr($halves[1],-1,1)=="."){
$output = "ERROR";
}
if (!strstr($halves[1],".") or strstr($halves[1],"..")){
$output = "ERROR";
}
}
return $output;
}
$msg="";
$fuid=$_POST['ruid'];
$fpassword=$_POST['rpassword'];
$cfpassword=$_POST['rcpassword'];
$femail=$_POST['remail'];
$ffname=$_POST['rfname'];
$flname=$_POST['rlname'];
$fcity=$_POST['rcity'];
$fmobile=$_POST['rmobile'];
$fsmsalert=$_POST['rsmsalert'];
$gndr=$_POST['gndr'];
if($fpassword!=$cfpassword)
{
$msg="<font color='red'><b>Error: </b> Password Does Not Match !</font>";
header("location: index.php?msg=$msg");
exit();
}
if(!$femail)
{
$msg="<font color='red'><b>Error: </b> Please Enter Your Email !</font>";
header("location: index.php?msg=$msg");
exit();
}
else
{
if(validateEmail($femail)=="ERROR")
{
$msg="<font color='red'><b>Error: </b> Invalid Email Address !</font>";
header("location: index.php?msg=$msg");
exit();
}
else
{
///More Validation Gose Here
if(!$fuid)
{
$msg="<font color='red'><b>Error: </b> Please Enter a User Name !</font>";
header("location: index.php?msg=$msg");
exit();
}
else
{
$qry="SELECT * FROM nonreg WHERE uid='$fuid'";
$result=mysql_query($qry);
if($result)
{
if(mysql_num_rows($result) == 1)
{
$msg="<font color='green'><b>$fuid</b> This Username Already Taken !</font>";
header("location: index.php?msg=$msg");
exit();
}
}
else //USern Name Not Taken
{
$qury="INSERT INTO `nonreg`
(`id`,
`uid`,
`password`,
`fname`,
`lname`,
`gender`,
`email`,
`mobile`,
`landline`,
`city`,
`country`,
`smsalert`)
VALUES
('',
'$fuid',
'$fpassword',
'$ffname',
'$flname',
'$gndr',
'$femail',
'$fmobile',
'',
'$fcity',
'',
'$fsmsalert')";
$r=mysql_query($qury);
if(!quury)
{
$msg="<font color='red'><b>ERROR:</b> Registraion Incomplete !</font>";
header("location: index.php?msg=$msg");
exit();
}
else
{
$msg="<font color='green'><b>Thank You!</b> Registed with Us!</font>";
header("location: youraccount.php?msg=$msg");
exit();
}
}
}//End of Else UID
}//End of Else validateEmail
}//End of Else $femail
?>
if Email is Wrong its Show an Error
but if it is right then My Page is being Empty No any Errors No any Other things
Please Help Me Out...!
Thanks in Advanced for Your Kind Support.
Contact:
Email: akvlko@in.com
ashok.it@versatilesolutions.info