user registration script. help needed
Posted: Tue Jan 29, 2008 9:30 am
i have been trying to make this code return an error for each item supplied. any thoughts?
<?
session_start();
include_once "../main.php";
include_once "../configuration.inc.php";
if ($upass == $cpass)
else
{
echo "<center><br><br><br><font color=red><b> The password/confirm password fields don`t match. <br> Please go <a class=ERR href=jobseeker_registration.php> back</a> and fill them properly.</b></font></center>";
}
{
if (!empty($uname)
{
Print "<br><br><font font size='2' face='Verdana' color='#000099'><b>Oops</b></font><font font size='2' face='Verdana' color='black'>, you forgot to fill in your Username.<br> Please go back and try again.</font>";
exit;
}
$result=mysql_query("SELECT * FROM job_seeker_info WHERE uname='$uname'");
if (mysql_num_rows($result) >=1)
{
Print "<br><br><font font size='2' face='Verdana' color='#000099'><b>Sorry </b></font><font font size='2' face='Verdana' color='black'>, that username is taken.<br> Please go back and try again.</font>";
}
&& !empty($fname)
{
Print "<br><br><font font size='2' face='Verdana' color='#000099'><b>Oops</b></font><font font size='2' face='Verdana' color='black'>, you forgot to fill in your first name.<br> Please go back and try again.</font>";
exit;
}
&& !empty($lname)
{
Print "<br><br><font font size='2' face='Verdana' color='#000099'><b>Oops</b></font><font font size='2' face='Verdana' color='black'>, you forgot to fill in your last name.<br> Please go back and try again.</font>";
exit;
}
&& !empty($job_seeker_email)
{
Print "<br><br><font font size='2' face='Verdana' color='#000099'><b>Oops</b></font><font font size='2' face='Verdana' color='black'>, you forgot to fill in your email address.<br> Please go back and try again.</font>";
exit;
}
)
else
{
if (is_array($JobCategory))
{
$JobStr = implode("," , $JobCategory);
}
if($careerlevel == '1')
{
$clname = 'Student (High School)';
}
elseif($careerlevel == '2')
{
$clname = 'Student (undergraduate/graduate)';
}
elseif($careerlevel == '3')
{
$clname = 'Entry Level (less than 2 years of experience)';
}
elseif($careerlevel == '4')
{
$clname = 'Mid Career (2+ years of experience)';
}
elseif($careerlevel == '5')
{
$clname = 'Management (Manager/Director of Staff)';
}
elseif($careerlevel == '6')
{
$clname = 'Executive (SVP, EVP, VP)';
}
elseif($careerlevel == '7')
{
$clname = 'Senior Executive (President, CEO)';
}
$query = "insert into job_seeker_info set
uname = \"$uname\",
upass = \"$upass\",
title = \"$title\",
fname = \"$fname\",
lname = \"$lname\",
income = \"$income\",
city = \"$city\",
state = \"$state\",
country = \"$country\",
zip = \"$zip\",
address = \"$address\",
phone = \"$phone\",
phone2 = \"$phone2\",
job_seeker_email = \"$job_seeker_email\",
job_seeker_web = \"$job_seeker_web\",
job_category = \"$JobStr\",
careerlevel = \"$clname\",
target_company = \"$target_company\",
relocate = \"$relocate\"
";
$result = mysql_query($query) or die('<br><br><center> <?=$EREG?> </center>');
$qcl = "insert into job_careerlevel set
uname = \"$uname\",
clnumber = \"$careerlevel\",
clname = \"$clname\" ";
$rcl = mysql_query($qcl) or die(mysql_error());
$to = $job_seeker_email;
$subject = "Your account at $mydomain";
$message = "This is your account information at $mydomain\n\n username: $uname\n password: $upass\n\n\n Keep this information in a secure place. \n\n Thanks for your registration. We believe you will find a job at \n http://$myurl";
$from = "From: <$contactemail>";
mail($to, $subject, $message, $from);
session_register("uname");
session_register("upass");
echo "<br><br><br>
<p align=center>
Thank you ! You are now registered as a job seeker.<br>Start <a href=post-resume.php>building your resume</a> or <a href=job-search.php> search for a job</a>.
</p>
";
}
}
?>
<? include_once('../footer.php'); ?>
<?
session_start();
include_once "../main.php";
include_once "../configuration.inc.php";
if ($upass == $cpass)
else
{
echo "<center><br><br><br><font color=red><b> The password/confirm password fields don`t match. <br> Please go <a class=ERR href=jobseeker_registration.php> back</a> and fill them properly.</b></font></center>";
}
{
if (!empty($uname)
{
Print "<br><br><font font size='2' face='Verdana' color='#000099'><b>Oops</b></font><font font size='2' face='Verdana' color='black'>, you forgot to fill in your Username.<br> Please go back and try again.</font>";
exit;
}
$result=mysql_query("SELECT * FROM job_seeker_info WHERE uname='$uname'");
if (mysql_num_rows($result) >=1)
{
Print "<br><br><font font size='2' face='Verdana' color='#000099'><b>Sorry </b></font><font font size='2' face='Verdana' color='black'>, that username is taken.<br> Please go back and try again.</font>";
}
&& !empty($fname)
{
Print "<br><br><font font size='2' face='Verdana' color='#000099'><b>Oops</b></font><font font size='2' face='Verdana' color='black'>, you forgot to fill in your first name.<br> Please go back and try again.</font>";
exit;
}
&& !empty($lname)
{
Print "<br><br><font font size='2' face='Verdana' color='#000099'><b>Oops</b></font><font font size='2' face='Verdana' color='black'>, you forgot to fill in your last name.<br> Please go back and try again.</font>";
exit;
}
&& !empty($job_seeker_email)
{
Print "<br><br><font font size='2' face='Verdana' color='#000099'><b>Oops</b></font><font font size='2' face='Verdana' color='black'>, you forgot to fill in your email address.<br> Please go back and try again.</font>";
exit;
}
)
else
{
if (is_array($JobCategory))
{
$JobStr = implode("," , $JobCategory);
}
if($careerlevel == '1')
{
$clname = 'Student (High School)';
}
elseif($careerlevel == '2')
{
$clname = 'Student (undergraduate/graduate)';
}
elseif($careerlevel == '3')
{
$clname = 'Entry Level (less than 2 years of experience)';
}
elseif($careerlevel == '4')
{
$clname = 'Mid Career (2+ years of experience)';
}
elseif($careerlevel == '5')
{
$clname = 'Management (Manager/Director of Staff)';
}
elseif($careerlevel == '6')
{
$clname = 'Executive (SVP, EVP, VP)';
}
elseif($careerlevel == '7')
{
$clname = 'Senior Executive (President, CEO)';
}
$query = "insert into job_seeker_info set
uname = \"$uname\",
upass = \"$upass\",
title = \"$title\",
fname = \"$fname\",
lname = \"$lname\",
income = \"$income\",
city = \"$city\",
state = \"$state\",
country = \"$country\",
zip = \"$zip\",
address = \"$address\",
phone = \"$phone\",
phone2 = \"$phone2\",
job_seeker_email = \"$job_seeker_email\",
job_seeker_web = \"$job_seeker_web\",
job_category = \"$JobStr\",
careerlevel = \"$clname\",
target_company = \"$target_company\",
relocate = \"$relocate\"
";
$result = mysql_query($query) or die('<br><br><center> <?=$EREG?> </center>');
$qcl = "insert into job_careerlevel set
uname = \"$uname\",
clnumber = \"$careerlevel\",
clname = \"$clname\" ";
$rcl = mysql_query($qcl) or die(mysql_error());
$to = $job_seeker_email;
$subject = "Your account at $mydomain";
$message = "This is your account information at $mydomain\n\n username: $uname\n password: $upass\n\n\n Keep this information in a secure place. \n\n Thanks for your registration. We believe you will find a job at \n http://$myurl";
$from = "From: <$contactemail>";
mail($to, $subject, $message, $from);
session_register("uname");
session_register("upass");
echo "<br><br><br>
<p align=center>
Thank you ! You are now registered as a job seeker.<br>Start <a href=post-resume.php>building your resume</a> or <a href=job-search.php> search for a job</a>.
</p>
";
}
}
?>
<? include_once('../footer.php'); ?>