loadTemplateFile("career.tpl",true,true); $tpl->setVariable("header",$header); $tpl->setVariable("left",$left); $tpl->setVariable("right",$right); $tpl->setVariable("footer",$footer); $tpl->setVariable("all_jobs",$career."?job=all#highlight"); if(isset($_GET['job'])) { $search_all = $_GET['job']; if($search_all != 'all') { $tpl->hideBlock("JOBSEARCH"); $tpl->hideBlock("REQUIRE"); $tpl->show(); exit(); } } function getWords($text, $limit) { $array = explode(" ",$text, $limit+1); if (count($array) > $limit) { unset($array[$limit]); } return implode(" ", $array); } if(isset($_SESSION['msg'])) { $tpl->setvariable("msg",$_SESSION['msg']); $tpl->setvariable("name",$_SESSION['name']); $tpl->setvariable("email",$_SESSION['email']); unset($_SESSION['msg']); unset($_SESSION['name']); unset($_SESSION['email']); } else { $tpl->setvariable("msg"," "); $tpl->setvariable("name",""); $tpl->setvariable("email",""); } if(isset($_POST['username'])) { $username=$_POST['username']; $email=$_POST['useremail']; $_SESSION['name']=$username; $_SESSION['email']=$email; $docs=$_FILES['user_resume']['name']; $docs=strtolower($docs); $docs_ext=explode(".",$docs); $count_docs_ext=count($docs_ext); $count_docs_ext=$count_docs_ext-1; $new_docs_name=$docs_ext[0].mktime().".".$docs_ext[$count_docs_ext]; $docs_temp=$_FILES['user_resume']['tmp_name']; $error=0; if($username=="") { $error=1; $_SESSION['msg']="Please enter the name."; } else if($email=="") { $error=1; $_SESSION['msg']="Please enter the email."; } else if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,5})$", $email)) { $error=1; $_SESSION['msg']="Please enter the correct email format."; } else if($docs=="") { $error=1; $_SESSION['msg']="Please upload your resume."; } else if($docs_ext[$count_docs_ext]!="doc" && $docs_ext[$count_docs_ext]!="txt" && $docs_ext[$count_docs_ext]!="docx" && $docs_ext[$count_docs_ext]!="rtf" && $docs_ext[$count_docs_ext]!="pdf") { $error=1; $_SESSION['msg']="Please upload your resume in valid format."; } if($error=="1") { header("location:career.html"); exit; } move_uploaded_file($docs_temp, 'resume/' .$new_docs_name); $m= new Mail; // create the mail $m->From($email); $m->To("gmateo@ehh-inc.com"); //$m->To("rajanshriwastava@infoway.us"); $m->Subject( $username." - Resume" ); $message= "Name: ".$username."\n Email: ".$email; $m->Body( $message); // set the body $m->Priority(4) ; // set the priority to Low $m->Attach( "resume/".$new_docs_name,"application/x-msword", "attachment" ) ; // attach a file of type image/gif $m->Send(); // send the mail //echo "the mail below has been sent:
", $m->Get(), "
"; unlink("resume/".$new_docs_name); unset($_SESSION['name']); unset($_SESSION['email']); $_SESSION['msg']="Your resume uploaded successfully."; header("location:career.html"); } if(!isset($_GET['submit'])) { $search=strtolower(trim($_GET['keyword'])); $search=preg_replace("/^[^a-z0-9A-Z]+|[^a-z0-9A-Z]+$|[(){}]+/","$1",$search); $search=str_replace("[","",$search); $desc=array(); $title=array(); $id=array(); if($search) { $count=0; $sql="select * from ".$table_hospice_jobs." where job_id = '".$search."'" ; $run=mysql_query($sql); $num=mysql_num_rows($run); if($num==0) { $sql="select * from ".$table_hospice_jobs." where job_title like '%".$search."%'" ; $run=mysql_query($sql); $num=mysql_num_rows($run); if($num==0) { $sql="select * from ".$table_hospice_jobs ; $run=mysql_query($sql); while($row=mysql_fetch_array($run)) { $data = $row['job_desc']; if(stristr($data, $search) != FALSE) { array_push($desc,$row['job_desc']); array_push($title,$row['job_title']); array_push($id,$row['job_id']); } } $num=count($desc); if($num>0) { $tpl->setCurrentBlock("JOB"); for($i=0;$i<$num;$i++) { if($i%2==0) { $tpl->setVariable("job","job"); } else $tpl->setVariable("job",job2); $desc_more=$desc[$i]; $wrd_count = str_word_count($desc[$i]); if($wrd_count > 30) { $desc=getWords($desc[$i],30); $desc=$desc."..."; $desc_more=$desc[$i]; $tpl->setvariable("job_desc_more",$desc_more); $tpl->touchBlock("more"); $tpl->touchBlock("less"); } else { $desc=$desc[$i]; $tpl->hideBlock("more"); $desc_more=$desc[$i]; $tpl->setvariable("job_desc_more",$desc_more); $tpl->hideBlock("less"); } $tpl->setvariable("job_title",$title[$i]); $tpl->setvariable("job_desc",$desc); $tpl->setvariable("job_id",$id[$i]); $tpl->parseCurrentBlock("JOB"); } $tpl->touchBlock("REQUIRE"); } else { $tpl->setCurrentBlock("JOBNONE"); $tpl->setVariable("align","pad_left1"); $tpl->setvariable("job_title", "Sorry, No result found for search term "".$search."".

Suggestions:
"); $tpl->parseCurrentBlock("JOBNONE"); $tpl->hideBlock("REQUIRE"); } } else { $tpl->setCurrentBlock("JOB"); while($row=mysql_fetch_array($run)) { if($count%2==0) { $tpl->setVariable("job","job"); } else $tpl->setVariable("job",job2); $count++; $wrd_count = str_word_count($row['job_desc']); if($wrd_count > 30) { $desc=getWords($row['job_desc'],30); $desc=$desc."..."; $desc_more=$row['job_desc']; $tpl->setvariable("job_desc_more",$desc_more); $tpl->touchBlock("more"); $tpl->touchBlock("less"); } else { $desc=$row['job_desc']; $tpl->hideBlock("more"); $desc_more=$row['job_desc']; $tpl->setvariable("job_desc_more",$desc_more); $tpl->hideBlock("less"); } $tpl->setvariable("job_title",$row['job_title']); $tpl->setvariable("job_desc",$desc); $tpl->setvariable("job_id",$row['job_id']); $tpl->parseCurrentBlock("JOB"); }$tpl->touchBlock("REQUIRE"); } } else { $tpl->setCurrentBlock("JOB"); while($row=mysql_fetch_array($run)) { if($count%2==0) { $tpl->setVariable("job","job"); } else $tpl->setVariable("job",job2); $count++; $wrd_count = str_word_count($row['job_desc']); if($wrd_count > 30) { $desc=getWords($row['job_desc'],30); $desc=$desc."..."; $desc_more=$row['job_desc']; $tpl->setvariable("job_desc_more",$desc_more); $tpl->touchBlock("more"); $tpl->touchBlock("less"); } else { $desc=$row['job_desc']; $tpl->hideBlock("more"); $desc_more=$row['job_desc']; $tpl->setvariable("job_desc_more",$desc_more); $tpl->hideBlock("less"); } $tpl->setvariable("job_title",$row['job_title']); $tpl->setvariable("job_desc",$desc); $tpl->setvariable("job_id",$row['job_id']); $tpl->parseCurrentBlock("JOB"); }$tpl->touchBlock("REQUIRE"); } } else { $tpl->hideBlock("JOBSEARCH"); } } if($search_all == 'all') { $count=0; $sql="select * from ".$table_hospice_jobs; $run=mysql_query($sql); $num=mysql_num_rows($run); if($num>0) { $tpl->touchBlock("JOBSEARCH"); $tpl->setCurrentBlock("JOB"); while($row=mysql_fetch_array($run)) { if($count%2==0) { $tpl->setVariable("job","job"); } else $tpl->setVariable("job",job2); $count++; $wrd_count = str_word_count($row['job_desc']); if($wrd_count > 30) { $desc=getWords($row['job_desc'],30); $desc=$desc."..."; $desc_more=$row['job_desc']; $tpl->setvariable("job_desc_more",$desc_more); $tpl->touchBlock("more"); $tpl->touchBlock("less"); } else { $desc=$row['job_desc']; $tpl->hideBlock("more"); $desc_more=$row['job_desc']; $tpl->setvariable("job_desc_more",$desc_more); $tpl->hideBlock("less"); } $tpl->setvariable("job_title",$row['job_title']); $tpl->setvariable("job_desc",$desc); $tpl->setvariable("job_id",$row['job_id']); $tpl->parseCurrentBlock("JOB"); } $tpl->touchBlock("REQUIRE"); } else { $tpl->touchBlock("JOBSEARCH"); $tpl->setCurrentBlock("JOBNONE"); $tpl->setVariable("align","pad_left2"); $tpl->setvariable("job_title","Sorry, There is no Job Opening right now"); $tpl->parseCurrentBlock("JOBNONE"); $tpl->hideBlock("REQUIRE"); } } $tpl->show(); ?>