darkfreaks Posted December 8, 2007 Share Posted December 8, 2007 im not sure why it skips email validation? any thoughts? <?phph session_start(); include_once "../functions.php"; include_once "../main.php"; include_once "../configuration.inc.php"; if ($upass == $cpass) { if (!empty($uname) && !empty($upass) && !empty($cpass) && !empty($title) && !empty($fname) && !empty($lname) && !empty($city) && !empty($country) && !empty($zip) && !empty($address) && !empty($phone) && !empty($job_seeker_email) && !empty($JobCategory) && !empty($careerlevel)) { 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= mysql_real_escape_string($query); $query= strip_tags($query); $query= trim($query); $query= RemoveXSS($query); $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= mysql_real_escape_string($qcl); $qcl= strip_tags($qcl); $qcl= trim($qcl); $qc1= RemoveXSS($qc1); $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["uname"]=$uname; $_SESSION["upass"]=$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> "; } else { echo "<center><br><br><br><font color=red><b> You miss to fill some of the required fields.<br> Please go <a class=ERR href=jobseeker_registration.php> back</a> and fill all of them properly.</b></font></center>"; } } 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 (isset($_POST['job_seeker_email'])) { if (isValidEmail($_POST['job_seeker_email'])){ echo "<tr><td>The email: ".$_POST['job_seeker_email']." is valid!</td></tr>"; } else{ echo "<tr><td>The email: ".$_POST['job_seeker_email']." is invalid!</td></tr>"; } } ?> <?php include_once('../footer.php'); ?> Quote Link to comment Share on other sites More sharing options...
Northern Flame Posted December 8, 2007 Share Posted December 8, 2007 try this <?php session_start(); include_once "../functions.php"; include_once "../main.php"; include_once "../configuration.inc.php"; if ($upass == $cpass) { if (!empty($uname) && !empty($upass) && !empty($cpass) && !empty($title) && !empty($fname) && !empty($lname) && !empty($city) && !empty($country) && !empty($zip) && !empty($address) && !empty($phone) && !empty($job_seeker_email) && !empty($JobCategory) && !empty($careerlevel)) { 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= mysql_real_escape_string($query); $query= strip_tags($query); $query= trim($query); $query= RemoveXSS($query); $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(mysql_error()); $qcl= mysql_real_escape_string($qcl); $qcl= strip_tags($qcl); $qcl= trim($qcl); $qc1= RemoveXSS($qc1); $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["uname"]=$uname; $_SESSION["upass"]=$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> "; } else { echo "<center><br><br><br><font color=red><b> You miss to fill some of the required fields.<br> Please go <a class=ERR href=jobseeker_registration.php> back</a> and fill all of them properly.</b></font></center>"; } } 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 (isset($_POST['job_seeker_email'])) { if (isValidEmail($_POST['job_seeker_email'])){ echo "<tr><td>The email: ".$_POST['job_seeker_email']." is valid!</td></tr>"; } else{ echo "<tr><td>The email: ".$_POST['job_seeker_email']." is invalid!</td></tr>"; } } ?> <?php include_once('../footer.php'); ?> Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted December 8, 2007 Share Posted December 8, 2007 You are not using $_POST variables anywhere else in this script... is anything actually posted to this script? You have a multiple script structure here, so it's hard to tell what has already been done before this script was called. If nothing is posted to this script, then your problem should be solved by: <?php if ( isset($job_seeker_email) ) { if ( isValidEmail($job_seeker_email) ) { echo "<tr><td>The email: ".$job_seeker_email." is valid!</td></tr>"; } else { echo "<tr><td>The email: ".$job_seeker_email." is invalid!</td></tr>"; } } PhREEEk Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted December 8, 2007 Author Share Posted December 8, 2007 it doesnt work still it still skips it? ??? Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted December 8, 2007 Author Share Posted December 8, 2007 <?php // This function tests whether the email address is valid function isValidEmail($job_seeker_email){ $pattern = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"; if (eregi($pattern, $job_seeker_email)){ return true; } else { return false; } }?> maybe my function is wrong? ??? Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted December 9, 2007 Share Posted December 9, 2007 When you say it 'skips' it, do you mean nothing gets echo'd? The way you have it setup, if $job_seeker_email is set, then one of two things are definitely going to print to screen. If $job_seeker_email is NOT set, then nothing will print. Does anything print? If something does print, I would assume the same one prints every time? In that case, your function is going to be our problem. PhREEEk Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted December 9, 2007 Author Share Posted December 9, 2007 nothing gets echoed and its bugging me. i changed it to <?php function isValidEmail($job_seeker_email){ if (!preg_match("/^( [a-zA-Z0-9] )+( [a-zA-Z0-9\._-] ) *@( [a-zA-Z0-9_-] )+( [a-zA-Z0-9\._-] +)+$/" , $job_seeker_email)) { return false; } return true;}?> still nothing gets outputted ??? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.