Jump to content
Larry Ullman's Book Forums

briansgl

Members
  • Posts

    25
  • Joined

  • Last visited

briansgl's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Just having a snoop through the forum and came across this. I can’t for the life in me understand why Mike thinks someone would want to pry into his personal information for ilisset reasons. We all have access to the internet and if someone wanted to know something about anyone it’s not difficult to find. This forum is brilliant I’ve had a lot of constructive help from Jonathon and Antonio. I’ve put some pretty stupid questions on and Jonathon has not been shy at telling me. I knew nothing before I started here and even now I’m far far far from being an expert but I do have half an idea of what I’m doing and if I get stuck I ask here, well that’s what it’s for. There is always someone willing to help and I’m not worrying if they’re after my personal information but if I’m asked I would tell them. (As long as they don’t ask for my bank account and pin number)
  2. When I try and post a new job to the database I am receiving the following error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'description = "test new Form", j_target = "1 Days", salary = "2.50", s_period' at line 11 Here is the PHP Code: <?php include_once "accesscontrol.php"; $ename = $_SESSION[ename]; $q1 = "select plan, JS_number, JP_number from job_employer_info where ename = \"$ename\" "; $r1 = mysql_query($q1) or die(mysql_error()); $a1 = mysql_fetch_array($r1); if(!empty($a1[plan])) { $a11 = $a1[JP_number]; $submit=$_POST[submit]; if(isset($submit) && $submit == 'Post this job') { $q2 = "select * from job_employer_info where ename = \"$ename\" "; $r2 = mysql_query($q2) or die(mysql_error()); $a2 = mysql_fetch_array($r2); if (is_array($JobCategory)) { $JobStr = implode("," , $JobCategory); } $qc = "select job_id from job_post order by job_id desc"; $rc = mysql_query($qc) or die(mysql_error()); $ac = mysql_fetch_array($rc); $job_id = $ac[0] + 1; $position = strip_tags($position); $description = strip_tags($description); $EXday = date('d', mktime(0,0,0,0, date(d) + $_POST[exdays1], 0)); $EXmonth = date('m', mktime(0,0,0, date(m), date(d) + $_POST[exdays1], 0)); $EXyear = date('Y', mktime(0,0,0,date(m) ,date(d) + $_POST[exdays1], date(Y))); $JobCategory = PagePostArrayComma(JobCategory); $JobSkills = PagePostArrayComma(JobSkills); $careerlevel = PagePostArrayComma(careerlevel); $description = PagePost(description); $CompanyCountry = PagePost(CompanyCountry); $ContactName = PagePost(cname); $CompanyState = PagePost(CompanyState); $position = PagePost(position); $salary = PagePost(salary); $s_period = PagePost(s_period); $showp = PagePost(showp); $showe = PagePost(showe); $shown = PagePost(shown); $town = PagePost(town); $salary = str_replace("£", "", $salary); $q3 = "insert into job_post set job_id = \"$job_id\", ename = \"$ename\", ContactName = \"$ContactName\", CompanyCountry = \"$CompanyCountry\", CompanyState = \"$CompanyState\", Company = \"$a2[CompanyName]\", position = \"$position\", JobCategory = \"$JobCategory\", JobSkills = \"$JobSkills\"; description = \"$description\", j_target = \"$careerlevel\", salary = \"$salary\", s_period = \"$s_period\", showp = \"$showp\", showe = \"$showe\", shown = \"$shown\", EXmonth = \"$EXmonth\", EXday = \"$EXday\", EXyear = \"$EXyear\", job_location= \"$town\""; $r3 = mysql_query($q3) or die(mysql_error()); $a11 = $a11 - 1; $q4 = "update job_employer_info set JP_number = \"$a11\" where ename = \"$ename\" "; $r4 = mysql_query($q4) or die(mysql_error()); ?> And here is the form. I have shortened the <select> bits so its not a long form: <form action="<?=$PHP_SELF?>" method="post" name="form" onSubmit="return checkFields();"> <table align=center width=450> <tr> <td colspan=2> <p><br> <font size="2" face="Arial, Helvetica, sans-serif"><b> You have the following credits remaining on your plan</b></font></p> <ul> <li><font size="2" face="Arial, Helvetica, sans-serif"> <?=$a11?> job postings; </font></li> <li><font size="2" face="Arial, Helvetica, sans-serif"> <?=$a1[JS_number]?> CV reviews; </font></li> </ul></td> <tr> <strong>The plan you have chosen is: <font color=green><?=$a1[plan]?> <br> <td colspan=2 align=center><div align="left"><font size="2" face="Arial, Helvetica, sans-serif"></font> <br><center><font color=red>IMPORTANT NOTICE TO EMPLOYERS </strong><br><br>Please be aware that it is illegal to discriminate in job adverts. By continuing you are confirming that: <br>You understand and agree to conform to the rules on Discrimination.</br><br>An extract from those rules can be found <a href="http://smsjobsite.co.uk/discrimination.php">HERE</a> The form will retain your details.</br><br></div></td> </tr><font size="2" face="Arial, Helvetica, sans-serif"> </font> <tr> <td><font size="2" face="Arial, Helvetica, sans-serif"><strong>Job Title:</strong></font></p><p> </p></td> <td><font size="2" face="Arial, Helvetica, sans-serif"> <input type=text name=position></font></p><p> </p></td> </tr> <tr> <td height="45" valign=top><font class="smalltext"><b><strong>Category:</strong></b></font><br /></td> <td valign=top> <font size="3" face="Arial, Helvetica, sans-serif"> <select name=JobCategory size="1" id="JobCategory" onchange="fillSecondCombo();return false;"> <option selected value="0">Please select an option</option> <option value="Agriculture">Agriculture</option> <option value="Catering and Hotel Work">Catering and Hotel Work</option> </select> </font></td> </tr> <tr> <td height="47" valign=top><font class="smalltext"><br><strong> Job Skills:</strong></br></font></td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <select name="JobSkills" size="1" id="JobSkills" style="width:200px;height:23px;z-index:24;"> </select> <br /> </font></td> </tr> <tr> <td valign=top><font class="smalltext"><b><strong> Description:</strong></b></font></td> <td><font class="smalltext"> <textarea rows=12 cols=55 name=description placeholder=You can type your advert or copy and paste from your text editor e.g. Word, Notepad ect.></textarea> </font></td> </tr> <tr> <td valign=top><font class="smalltext"><b><strong><br>Duration:</strong></b></br> </font></td> <td><br> <?php PopulateHTMLMultiCheckboxWithDBTable("", "Settings_CareerLevel", "careerlevel", "careerlevel[]", "285"); ?></br> <br><br><font color=green><strong>Job Location</strong></font> </tr> <tr> <td class=normalboldtext><font class="smalltext"> <b>County:</b></font></td> <td> <select name=CompanyState> <OPTION VALUE="">Select</OPTION> <OPTION VALUE="Avon">Avon <OPTION VALUE="Berkshire">Berkshire </select> </td> </tr> <tr> <td><font size="2" face="Arial, Helvetica, sans-serif"><strong><br>Town</br></strong>:</font></td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <input type=text name=town> </font></td> </tr> <tr> <td><strong><font size="2" face="Arial, Helvetica, sans-serif">First Name:</font></strong></td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <input type=text name=cname> </font></td> </tr> <tr> <td><strong><font size="2" face="Arial, Helvetica, sans-serif"><br>Surame:</br></font></strong></td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <br><input type=text name=lname></br> </font></td> </tr> <tr> <td><font class="smalltext"><b><br>Salary:</br></b></font></td> <td> <font class="smalltext"><b> <br><input type=text name=salary size=11> <select name=s_period></br> <option value=Yearly> Yearly </option> <option value=Monthly>Monthly </option> <option value=Weekly>Weekly </option> <option value=Hourly>Houry </option> </select></b> </font></td> <tr> <td><font class="smalltext"><b> <br>Show for</br> </b></font></td> <td> <font class="smalltext"><b> <br><select name=exdays1></br> <option value=30> 30 </option> <option value=60> 60 </option> <option value=90> 90 </option> </select></b> days. </font></td> </tr> <tr> <td><font class="smalltext"><b><br> Show My:</br> </b></font></td> <td> <font class="smalltext"> <br>Telephone Number <input type="checkbox" name="showp" value="1"/> Name <input type="checkbox" name="shown" value="1"/> Email <input type="checkbox" name="showe" value="1"/></br> </font></td> </tr> <tr> <td align=left> <font size="2" face="Arial, Helvetica, sans-serif"> </font></td> <td align=right> <div align="left"><font class="smalltext"><b><br> <input type=submit name=submit value="Post this job"> <input type=submit name=submit value=Reset></b> </font></div></td> </tr> </table> May be worth pointing out all the other forms that have been upgraded work fine. Its just this one.
  3. Just a question really. I have a basic text area on a form that's coded like below: <tr> <td valign=top><font class="smalltext"><b><strong> Description:</strong></b></font></td> <td><font class="smalltext"> <textarea rows=12 cols=55 name=description></textarea> </font></td> </tr> <tr> What I was wanting to know was can I add some formatting like the user being to make the text bold, change colour, Centre, left, right and justify. You know the normal formatting aids. Is this difficult to do. I have done a search on the internet "Text box with formatting" but the stuff that comes up is not what I was really looking for.
  4. Thanks Jon and Antonio. I went through the code in word pad and looked at some advice on the internet. After looking at all the possible solutions I discovered that the PagePost should have actually been PagePostArray. Once I figured that out it worked fine. $submit = $_POST[submit]; if ($submit == "Register me") { if ($_POST[upass] == $_POST[cpass]) { $uname = PagePost(uname); $upass = PagePost(upass); $cpass = PagePost(cpass); $title = PagePost(title); $fname = PagePost(fname); $lname = PagePost(lname); $bmonth = PagePost(bmonth); $bday = PagePost(bday); $byear = PagePost(byear); $city = PagePost(city); $zip = PagePost(zip); $address1 = PagePost(address); $address2 = PagePost(address2); $phone = PagePost(phone); $phone2 = PagePost(phone2); $job_seeker_email = PagePost(job_seeker_email); $state = PagePost(state); $JobCategory = PagePost(JobCategory); $JobSkills = PagePostArray(JobSkills); $relocation = PagePost(relocate);
  5. Thanks Jon and Antonio. I'm starting to think this is just getting a little above my skills. I will have to study the code to find out which bits don't relate to the site. I may take a while. I figured out the DB element but then I wouldn't be able to populate the skills area with multi select (Would I?) Jon this is the code I used for the Javascript bit and the relating form: <script type="text/javascript"> function fillSecondCombo() { var combo1 = document.getElementById('JobCategory'); var combo2 = document.getElementById('JobSkills'); var selected = combo1.options[combo1.options.selectedIndex].value; if (selected == "Agriculture") { combo2.options.length = 3; combo2.options[0] = new Option("Agricultural Engineer", "Agricultural Engineer"); combo2.options[1] = new Option("Animal Care", "Animal Care"); combo2.options[2] = new Option("Dairy Worker", "Dairy Worker"); combo2.options[3] = new Option("Farm Worker", "Farm Worker"); combo2.options[4] = new Option("Harvesting Equipment Driver", "Harvesting Equipment Driver"); combo2.options[5] = new Option("Tractor Driver", "Tractor Driver"); combo2.options[6] = new Option("Zoo and Safari Park Worker", "Zoo and Safari Park Worker"); combo2.options[7] = new Option("Other - Not Listed", "Other - Not Listed"); } </script> Form: <tr><td valign=top bgcolor="<?php echo $top_cell;?>" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> Job Category:<font color=red>*</font></font></td> <td valign=top> <font size="3" face="Arial, Helvetica, sans-serif"> <select name=JobCategory size="1" id="JobCategory" onchange="fillSecondCombo();return false;"> <option selected value="0">Please select an option</option> <option value="Agriculture">Agriculture</option> </select> </font></td> </tr> <tr> <td bgcolor="<?php echo $top_cell;?>" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> Job Skills:<font color=red>*</font></font></td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <select name="JobSkills[]" multiple size="1" id="JobSkills" style="width:226px;height:123px;z-index:24;"> </select>
  6. Thanks Antonio. The site was built originally using code from another site and modifying it. the JobCategory was populated from the database to make it accessible site wide, however it gave checkbox options for JobCategory to make it multi select on the Jobseekers registration page. I wanted to make it more user friendly by adding Job Skills for each category. I managed to work out how to do this using java script and modified the form accordingly. I think modifying the database may be a little beyond my skills, having said that on another site we have counties that reflect the towns within the counties so I may be able to study how that was done but it's not multi select. I would have to work out how to do that. The functions page is a bit long winded but I will add it just incase you see something that may solve the problem, however I do thing that the database is the best way to go. Thanks <?php function GetFullPageURL() { $pageURL = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } function RememberPageUrl() { $_SESSION["RequestedURL"] = GetFullPageURL(); } function ForgetPageUrl() { $_SESSION["RequestedURL"] = ""; } function GetRememberedPageURL() { if (isset ($_SESSION["RequestedURL"])) return $_SESSION["RequestedURL"]; else return ""; } function IsAnyUserLoggedIn() { if (isset($_SESSION["user_id"])) return true; else return false; } if ($MustBeLoggedIn && !IsAnyUserLoggedIn()) { RememberPageUrl(); header('Location: http://www.wcrltd.co.uk/login.php'); } if (IsAnyUserLoggedIn()) { $RememberedUrl = GetRememberedPageURL(); if ($RememberedUrl != "") { ForgetPageUrl(); header("Location: $RememberedUrl"); } } //TODO: Limit user passwords to 30 chars. // Pops up a JavaScript alert if defined $PopupError = ""; $PopupDebug = ""; $PopupMsg = ""; $BaseURL = "http://www.wcrltd.co.uk"; // Database credentials $DBHost = "localhost"; $DBUserName = "j_jobsite"; $DBPasswd = "jobsite1"; $DBName = "j_jobsite"; $Connection = mysql_connect($DBHost, $DBUserName, $DBPasswd) or die(mysql_error()); $Database = mysql_select_db($DBName); function DoPopupErrors() { global $PopupError, $PopupDebug, $PopupMsg; echo("<script type=\"text/javascript\" language=\"javascript\">\n"); if ($PopupError != "") { echo("alert(\"$PopupError\");\n"); } if ($PopupDebug != "") { echo("alert(\"$PopupDebug\");\n"); } if ($PopupMsg != "") { echo("alert(\"$PopupMsg\");\n"); } echo("</script>\n"); } function EmitCSS() { echo("<style type=\"text/css\">\n"); echo("div#container\n"); echo("{\n"); echo(" width: 810px;\n"); echo(" position: relative;\n"); echo(" margin-top: 0px;\n"); echo(" margin-left: auto;\n"); echo(" margin-right: auto;\n"); echo(" text-align: left;\n"); echo("}\n"); echo("body\n"); echo("{\n"); echo(" text-align: center;\n"); echo(" margin: 0;\n"); echo("}\n"); echo("</style>\n"); } function EmitDOCType() { echo ('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'); } function EmitMETAData($PageTitle) { echo("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">"); echo("<meta name=\"author\" content=\"Stubbs Transport Management\">"); echo("<meta name=\"generator\" content=\"Stubbs Transport Management www.wcrltd.co.uk\">"); echo("<title>$PageTitle</title>"); echo("<meta name=\"description\" content=\"Driver and Transport jobs - Fitters and Mechanics Jobs - Agencies - Driving Schools - Breakdown - Search and Post return loads - Search and Post empty vehicles and trailers - return loads - CPC - International - Multi-Drop - PSV - Coach \">"); echo("<meta name=\"keywords\" content=\"LGV (HGV) driving jobs - Hiab - Multi-Drop - Coach - PSV - PCV and van driving jobs - Fork Lift - Warehouse Jobs - Agencies - Freight Fowarding - Freight Exchange - Return Loads - Transport Manager - Drivers CPC - Transport Manager - Traffic Clerk - HGV Fitters - UK - Nationwide - Long Distance - Overnights - CPC National - International - Breakdowns - Class 2 - 7.5 Ton - Drivers Mates - HGV Training - LGV Training - Truck Driver Training - HGV Driver Training - Fuel Cards - Diesil - Tacograph Training - Digital Tacos - Tanker Drivers - Removals - Storage - Haulage - Scania - Garage - Scania Agent - Daf Garage, Daf Agent, Truck Drivers, Employment Agency, Employment Agencies, Recruitment Agency, Recruitment Agencies, Job Agency, Job Agencies Driving Agency, Drivers agency\">"); } function ValidateCaptcha() { if (isset($_POST['captcha_code'],$_SESSION['random_txt']) && md5($_POST['captcha_code']) == $_SESSION['random_txt']) return true; else return false; } function PagePost($name) { if (isset($_POST[$name])) return mysql_real_escape_string(htmlentities($_POST[$name])); else return ""; } function PagePostHTML($name) { return addslashes($_POST[$name]); } function PageGet($name) { if (isset($_GET[$name])) return mysql_real_escape_string(htmlentities($_GET[$name])); else return ""; } function PagePostArrayNoImplode($name) { if (isset($_POST[$name])) { $SafeArray = array(); foreach ($_POST[$name] as &$item) { $SafeArray[] = mysql_real_escape_string(htmlentities($item)); } return $SafeArray; } return ""; } // Covert the array into a string, where each item is wrapped in semicolons function PagePostArrayComma($name) { if (isset($_POST[$name])) { $ValArray = $_POST[$name]; $Val = implode(",", $ValArray); //$Val = ";$Val;"; return mysql_real_escape_string(htmlentities($Val)); } return ""; } // Covert the array into a string, where each item is wrapped in semicolons function PagePostArray($name) { if (isset($_POST[$name])) { $ValArray = $_POST[$name]; $Val = implode(";", $ValArray); $Val = ";$Val;"; return mysql_real_escape_string(htmlentities($Val)); } return ""; } function PopupMsg($msg) { global $PopupMsg; if ($PopupMsg == "") { $PopupMsg = "INFO: " . $msg; } else { $PopupMsg = $PopupMsg . "; " . $msg; } } function FatalError($msg) { global $PopupError; if ($PopupError == "") { $PopupError = "ERROR: " . $msg; } else { $PopupError = $PopupError . "; " . $msg; } } function DebugMessage($msg) { global $PopupDebug; $PopupDebug = "DEBUG: " . $msg; } function ValidateEmail($email) { $pattern = '/^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i'; return preg_match($pattern, $email); } function EmitJavascriptMultiSelectValidation($FieldName, $ErrorMsg) { echo("var chks = document.getElementById(\"$FieldName\").childNodes;\n"); echo("var hasChecked = false;\n"); echo("var firstSeenIndex= -1;\n"); echo("for (var i=0; i < chks.length; i++)\n"); echo("{\n"); echo(" if (chks[i].type == \"checkbox\")\n"); echo(" {\n"); echo(" if (firstSeenIndex == -1)\n"); echo(" {\n"); echo(" firstSeenIndex = i;\n"); echo(" }\n"); echo(" if (chks[i].checked)\n"); echo(" {\n"); echo(" hasChecked = true;\n"); echo(" break;\n"); echo(" }\n"); echo(" }\n"); echo("}\n"); echo("if (!hasChecked)\n"); echo("{\n"); echo(" alert(\"$ErrorMsg\");\n"); echo(" chks[firstSeenIndex].focus();\n"); echo(" return false;\n"); echo("}\n"); } function EmitJavascriptSelectValidation($Form, $FieldName, $ErrorMsg, $MultiSelect = 0) { if ($MultiSelect == 1) { echo("if ($Form.$FieldName.selectedIndex < 0)\n"); } else { echo("if ($Form.$FieldName.selectedIndex == 0)\n"); } echo("{\n"); echo(" alert(\"$ErrorMsg\");\n"); echo(" $Form.$FieldName.focus();\n"); echo(" return false;\n"); echo("}\n"); } function EmitJavaScriptEditValidation($Form, $FieldName, $ErrorMsg, $MaxLen = 10) { echo("if ($Form.$FieldName.value == \"\")\n"); echo("{\n"); echo(" alert(\"$ErrorMsg\");\n"); echo(" $Form.$FieldName.focus();\n"); echo(" return false;\n"); echo("}\n"); echo("if ($Form.$FieldName.value.length > $MaxLen)\n"); echo("{\n"); echo(" alert(\"$ErrorMsg\");\n"); echo(" $Form.$FieldName.focus();\n"); echo(" return false;\n"); echo("}\n"); } function EmitJavaScriptEmailValidation($Form, $FieldName, $ErrorMsg, $MaxLen = 40) { echo("var strValue = $Form.$FieldName.value;\n"); echo('var strFilter = /^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i;' . "\n"); echo("if (!strFilter.test(strValue))\n"); echo("{\n"); echo(" alert(\"$ErrorMsg\");\n"); echo(" $Form.$FieldName.focus();\n"); echo(" return false;\n"); echo("}\n"); EmitJavaScriptEditValidation($Form, $FieldName, $ErrorMsg, $MaxLen); } // Generate entries for a HTML select statement. $Items is the array of items, $MultiSelect is 1 if multiple // selections are available, and $Selected specifies the value of the currently selected item. function PopulateHTMLSelect($Items, $MultiSelect, $Selected) { // If not multi select and no item selected, first if ($MultiSelect == 0) { if ($Selected == "") { echo("<option SELECTED>$Select</option>\n"); } else { echo("<option>$Select</option>\n"); } } foreach ($Items as &$Select) { if ($MultiSelect) { if (strpos($Selected, ";$Select;") !== false) { echo("<option SELECTED>$Select</option>\n"); } else { echo("<option>$Select</option>\n"); } } else { if ($Selected == $Select) { echo("<option SELECTED>$Select</option>\n"); } else { echo("<option>$Select</option>\n"); } } } } // Generate entries for a HTML select statement. $MultiSelect is 1 if multiple // selections are available, and $Selected specifies the value of the currently selected item. // Values are in the range $Start .. $End. function PopulateHTMLSelectWithRange($MultiSelect, $Selected, $Start, $End) { $Items = array(); for ($i = $Start; $i <= $End; $i++) { $Items[] = $i; } PopulateHTMLSelect($Items, $MultiSelect, $Selected); } function PopulateHTMLMultiCheckboxWithDBTable($Selected, $Table, $ValidationName, $FieldName, $Width = "172px", $Height = "155px") { global $Database; echo("<div id=\"$ValidationName\" style=\"width:$Width;height:$Height;padding:5px;overflow:auto;border:1px solid #ccc\">\n"); $Query = "select Data from $Table order by Data ASC"; $Result = mysql_query ($Query) or die (mysql_error()); $Items = array(); while($Row = mysql_fetch_array($Result)) { if (strpos($Selected, $Row["Data"]) !== false) { echo("<input type=\"checkbox\" checked=\"yes\" name=\"" . $FieldName . "\" value=\"" . $Row["Data"] . "\">" . $Row["Data"] . "<br />\n"); } else { echo("<input type=\"checkbox\" name=\"" . $FieldName . "\" value=\"" . $Row["Data"] . "\">" . $Row["Data"] . "<br />\n"); } } echo("</div>"); } function PopulateHTMLSelectWithDBTable($MultiSelect, $Selected, $Table, $SortASC=1) { if ($SortASC == 1) { $Query = "select Data from $Table order by Data ASC"; } else { $Query = "select Data from $Table"; } $Result = mysql_query ($Query) or die (mysql_error()); $Items = array(); while($Row = mysql_fetch_array($Result)) { $Items[] = $Row["Data"]; } PopulateHTMLSelect($Items, $MultiSelect, $Selected); } function GetAuthCodeForUser($Username) { global $Database; $Query = "select Authenticated from UserDetails where UserName = '$Username' LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); return $Row["Authenticated"]; } function CheckIfUserNameExists($Name) { global $Database; $Query = "select id from UserDetails where UserName = '$Name';"; $Result = mysql_query($Query) or die (mysql_error()); return mysql_num_rows($Result); } function GetBusinessName($UserID) { $Query = "select CompanyName from UserDetails_AgencyMisc where UserID = '$UserID' LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); if (mysql_num_rows($Result) == 1) { $Row = mysql_fetch_array($Result); return $Row["Business"]; } $Query = "select CompanyName from UserDetails_TransportOperatorMisc where UserID = '$UserID' LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); if (mysql_num_rows($Result) == 1) { $Row = mysql_fetch_array($Result); return $Row["CompanyName"]; } return "Unknown"; } function GetUserIdFromUsernamePassword($Username, $Password) { $Query = "select id from UserDetails where UserName = '$Username' and Password = '$Password' LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); if (mysql_num_rows($Result) == 0) { return -1; } $Row = mysql_fetch_array($Result); return $Row["id"]; } function GetAgencyUserDetailsFromID($UserID) { $Query = "SELECT * from UserDetails, UserDetails_AgencyMisc where UserDetails.id = '$UserID' and UserDetails.id = UserDetails_AgencyMisc.UserID;"; $Result = mysql_query ($Query) or die (mysql_error()); if (mysql_num_rows($Result) == 0) { return -1; } $Row = mysql_fetch_array($Result); return $Row; } function GetListStartPageArgument() { $QueryStart = 0; if (isset($_GET["Start"])) { $Val = PageGet("Start"); if (is_numeric($Val)) $QueryStart = $Val; } return $QueryStart; } function GetListCountPageArgument() { $QueryCount = 3; if (isset($_GET["Count"])) { $Val = PageGet("Count"); if (is_numeric($Val)) $QueryCount = $Val; } return $QueryCount; } function EmitJobSummary($id, $Title, $Desc, $Location, $Salary, $DatePosted, $Descr, $User, $OwnerControls = 0 ) { static $EmittedHeader = 0; define("MAX_DESCRIPTION_SIZE", 30); if ($EmittedHeader == 0) { echo <<<EOF <style type="text/css"> <!-- .pretty-table { padding: 0; margin: 0; border-collapse: collapse; border: 0px solid #333; font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; font-size: 0.9em; color: #000; background: #bcd0e4 url("http://www.wcrltd.co.uk/images/widget-table-bg.jpg") top left repeat-x; } .sortableXX a { color: #ffffff; text-decoration: none; font-style:italic; } .pretty-table caption { caption-side: top; font-size: 0.9em; font-style: italic; text-align: center; padding: 0.5em 0; } .pretty-table th, .pretty-table td { border: 1px dotted #666; padding: 0.5em; text-align: left; color: #632a39; } .pretty-table th[scope=col] { color: #000; background-color: #8fadcc; text-transform: uppercase; font-size: 0.9em; border-bottom: 2px solid #333; border-right: 2px solid #333; } .pretty-table th[scope=colx] { color: #fff; font-size: 0.9em; text-transform: uppercase; background-color: #7d98b3; border-bottom: 2px solid #333; } .pretty-table th+th[scope=col] { color: #fff; background-color: #7d98b3; border-right: 1px dotted #666; } .pretty-table th[scope=row] { background-color: #b8cfe5; border-right: 2px solid #333; } .pretty-table tr.alt th, .pretty-table tr.alt td { color: #2a4763; } .pretty-table tr:hover th[scope=row], .pretty-table tr:hover td { background-color: #632a2a; color: #fff; } --> </style> EOF; echo ('<table border="0" cellpadding="3" cellspacing="1" class="pretty-table">'); if ($User != "") { echo('<thead><tr><th scope="col" class="sortableX">Title</th><th scope="col" class="sortableX">Location</th><th scope="col" class="sortableX">Salary</th><th scope="col" class="sortableX">Date Posted</th><th scope="col" class="sortableX">Company</th><th scope="col" class="sortableX">Description</th>'); } else { echo('<thead><tr><th scope="col" class="sortableX">Title</th><th scope="col" class="sortableX">Location</th><th scope="col" class="sortableX">Salary</th><th scope="col" class="sortableX">Date Posted</th><th scope="col" class="sortableX">Description</th>'); } if ($OwnerControls != 0) { echo('<th scope="col" class="sortableX">Delete</th>'); } echo("</tr></thead>"); $EmittedHeader = 1; } if (strlen($Descr) >= MAX_DESCRIPTION_SIZE) { $Descr = substr_replace($Descr, "...", MAX_DESCRIPTION_SIZE); } if ($OwnerControls != 0) $link = "onclick=\"window.location='post_job.php?edit=$id'\""; else $link = "onclick=\"window.location='../jobs_folder/post_job.php?view=$id'\""; echo("<tr>\n"); echo("<td $link>"); echo("$Title"); echo("</td>"); echo("<td $link>"); echo("$Location"); echo("</td>"); echo("<td $link>"); echo("$Salary"); echo("</td>"); echo("<td $link>"); echo $DatePosted; echo("</td>"); if ($User != "") { echo("<td $link>"); echo("$User"); echo("</td>"); } echo("<td $link>"); echo("$Descr"); echo("</td>"); if ($OwnerControls == 1) { echo("<td><a href=\"http://www.wcrltd.co.uk/jobs_folder/list_jobs.php?delete=$id\" onclick=\"return confirm('Are you sure you want to delete this job post?')\"><img src=\"../images/b_dele.png\" border=\"0\"></a></td>"); } echo("</tr>\n"); } function DeleteJobPost($id, $CurrentUser) { $Query = "select * from JobPost where id = '$id' and UserID = '$CurrentUser' LIMIT 1"; $Result = mysql_query ($Query) or die (mysql_error()); if (mysql_num_rows($Result) == 1) { $Query = "delete from JobPost where id = '$id' and UserID = '$CurrentUser' LIMIT 1"; $Result = mysql_query ($Query) or die (mysql_error()); $Query = "delete from JobPost_ADRPackages where JobPostId = '$id'"; $Result = mysql_query ($Query) or die (mysql_error()); $Query = "delete from JobPost_ADRTanks where JobPostId = '$id'"; $Result = mysql_query ($Query) or die (mysql_error()); $Query = "delete from JobPost_JobCategory where JobPostId = '$id'"; $Result = mysql_query ($Query) or die (mysql_error()); $Query = "delete from JobPost_JobPostCategory where JobPostId = '$id'"; $Result = mysql_query ($Query) or die (mysql_error()); $Query = "delete from JobPost_JobType where JobPostId = '$id'"; $Result = mysql_query ($Query) or die (mysql_error()); $Query = "delete from JobPost_LicenseDetails where JobPostId = '$id'"; $Result = mysql_query ($Query) or die (mysql_error()); $Query = "delete from JobPost_Skills where JobPostId = '$id'"; $Result = mysql_query ($Query) or die (mysql_error()); } } function DeleteUser($UserID) { $Query = "delete from UserDetails where id = '$UserID' LIMIT 1;"; mysql_query ($Query) or die (mysql_error ()); $Query = "delete from UserDetails_ADRPackages where UserID = '$UserID' LIMIT 1;"; mysql_query ($Query) or die (mysql_error ()); $Query = "delete from UserDetails_ADRTanks where UserID = '$UserID' LIMIT 1;"; mysql_query ($Query) or die (mysql_error ()); $Query = "delete from UserDetails_AgencyMisc where UserID = '$UserID' LIMIT 1;"; mysql_query ($Query) or die (mysql_error ()); $Query = "delete from UserDetails_FLT where UserID = '$UserID' LIMIT 1;"; mysql_query ($Query) or die (mysql_error ()); $Query = "delete from UserDetails_JobCategory where UserID = '$UserID' LIMIT 1;"; mysql_query ($Query) or die (mysql_error ()); $Query = "delete from UserDetails_JobseekerMisc where UserID = '$UserID' LIMIT 1;"; mysql_query ($Query) or die (mysql_error ()); $Query = "delete from UserDetails_JobType where UserID = '$UserID' LIMIT 1;"; mysql_query ($Query) or die (mysql_error ()); $Query = "delete from UserDetails_LicenseDetails where UserID = '$UserID' LIMIT 1;"; mysql_query ($Query) or die (mysql_error ()); $Query = "delete from UserDetails_Skills where UserID = '$UserID' LIMIT 1;"; mysql_query ($Query) or die (mysql_error ()); $Query = "delete from UserDetails_TransportOperatorMisc where UserID = '$UserID' LIMIT 1;"; mysql_query ($Query) or die (mysql_error ()); // Get all job posts, call DeleteJobPost ($id, $UserID); $Query = "select id from JobPost where UserID='$UserID';"; $Result = mysql_query ($Query) or die (mysql_error()); while($Row = mysql_fetch_array($Result)) { DeleteJobPost ($Row["id"], $UserID); } // TODO: Insert data into UserDetails_Unregistered. } function TrimJobSearchResults($Jobs, $Start, $Count) { $TrimmedResults = array(); $i = 0; $pos = 0; while($Row = mysql_fetch_array($Jobs)) { $include = true; if ($pos < $Start) { $include = false; $i++; } if ($include) { $TrimmedResults[$i]["id"] = $Row["id"]; $TrimmedResults[$i]["Title"] = $Row["Title"]; $TrimmedResults[$i]["Description"] = $Row["Description"]; $TrimmedResults[$i]["Location"] = $Row["Location"]; $TrimmedResults[$i]["Salary"] = $Row["Salary"]; $TrimmedResults[$i]["User"] = GetBusinessName($Row["UserID"]); $TrimmedResults[$i]["DatePosted"] = $Row["DatePosted"]; $TrimmedResults[$i]["PostCode"] = $Row["PostCode"]; $i = $i + 1; } $pos++; } return $TrimmedResults; } function GetJobPost($PostID) { $Query = "SELECT * FROM JobPost where id = $PostID;"; $Result = mysql_query($Query) or die (mysql_error()); return mysql_fetch_array($Result); } function GetJobPostsByCurrentUser() { $UserID = GetLoggedInUserID(); $Query = "SELECT JobPost.id as id, Settings_County.Data AS Location, Settings_Towns.Data as Town, Settings_Towns.PostCode AS PostCode, JobPost.Title AS Title, JobPost.County AS County, JobPost.Description AS Description, JobPost.Salary AS Salary, JobPost.DatePosted AS DatePosted FROM JobPost, Settings_County, Settings_Towns, UserDetails where JobPost.UserID = UserDetails.id AND Settings_County.id = JobPost.County AND JobPost.Town = Settings_Towns.id and JobPost.UserID = $UserID"; $Result = mysql_query ($Query) or die (mysql_error()); return $Result; } function GetTransportOperatorUserDetailsFromID($UserID) { $Query = "SELECT * from UserDetails, UserDetails_TransportOperatorMisc where UserDetails.id = '$UserID' and UserDetails.id = UserDetails_TransportOperatorMisc.UserID;"; $Result = mysql_query ($Query) or die (mysql_error()); if (mysql_num_rows($Result) == 0) { return -1; } $Row = mysql_fetch_array($Result); return $Row; } function GetJobseekerUserDetailsFromID($UserID) { global $Database; $Query = "SELECT * FROM UserDetails, UserDetails_JobseekerMisc WHERE UserDetails.id = '$UserID' AND UserDetails.id = UserDetails_JobseekerMisc.UserID LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); if (mysql_num_rows($Result) == 0) { return -1; } $Row = mysql_fetch_array($Result); return $Row; } function GetUserIDFromName($name) { global $Database; $Query = "select id from UserDetails where UserName = '$name';"; $Result = mysql_query($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); return $Row["id"]; } function GetUserPasswordFromID($ID) { $Query = "select Password from UserDetails where id = '$ID';"; $Result = mysql_query($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); return $Row["Password"]; } function GetUserEmailFromID($ID) { $Query = "select Email from UserDetails where id = '$ID';"; $Result = mysql_query($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); return $Row["Email"]; } function ChangePassword($UserID, $NewPassword) { $Query = "UPDATE UserDetails SET Password = '$NewPassword' WHERE id = '$UserID' LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); } function AuthorizeAccount($Username, $Code) { global $Database; if (CheckIfUserNameExists($Username) == 0) { FatalError("Invalid username"); return false; } $ExpectedCode = GetAuthCodeForUser($Username); if ($ExpectedCode != $Code) { FatalError("Invalid code"); return false; } if ($ExpectedCode == 0) { FatalError("Account already authorized"); return false; } $Query = "UPDATE UserDetails SET Authenticated = '0' WHERE UserName = '$Username' LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); PopupMsg("Your account is now authorized. You can now log in"); } function CheckIfEmailExists($UserType, $Email) { global $Database; $TypeOfUser = GetIDFromSettingsTable("Settings_UserType", $UserType); $Query = "select id from UserDetails where Email = '$Email' AND UserType = '$TypeOfUser';"; $Result = mysql_query($Query) or die (mysql_error()); return mysql_num_rows($Result); } function GetUsernameFromEmail($Email) { global $Database; $Query = "select UserName from UserDetails where Email = '$Email' LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); return $Row["UserName"]; } function GetDataFromSettingsTable($Table, $ID) { $Query = "select Data from $Table where id = '$ID' LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); return $Row["Data"]; } function GetIDFromSettingsTable($Table, $Val) { $Query = "select id from $Table where Data = '$Val' LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); return $Row["id"]; } function GetAcceptedLogoUploadFileExtensions() { $Extensions = array(); $Query = "select extension from Settings_SupportedLogoFileTypes;"; $Result = mysql_query ($Query) or die (mysql_error()); while ($Row = mysql_fetch_array($Result)) { $Extensions[] = $Row[0]; } return $Extensions; } function GetAcceptedUploadFileExtensions() { $Extensions = array(); $Query = "select extension from Settings_SupportedCVFileTypes;"; $Result = mysql_query ($Query) or die (mysql_error()); while ($Row = mysql_fetch_array($Result)) { $Extensions[] = $Row[0]; } return $Extensions; } function GetPasswordFromEmail($Email) { global $Database; $Query = "select Password from UserDetails where Email = '$Email' LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); return $Row["Password"]; } function LogOutUser() { unset($_SESSION['user_id']); unset($_SESSION['username']); } function GetUserType($UserID) { $Query = "select UserType from UserDetails where id = '$UserID' LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); return GetDataFromSettingsTable("Settings_UserType", $Row["UserType"]); } function DoLogin($UserID, $Username) { $_SESSION["user_id"] = $UserID; $_SESSION["username"] = $Username; $Query = "select UserType from UserDetails where id = '$UserID' LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); $_SESSION["type"] = GetUserType($UserID); } function GetLoggedInUserID() { return $_SESSION["user_id"]; } function GetJobPosterName($PostID) { $UserID = GetLoggedInUserID(); $Query = "SELECT FirstName FROM UserDetails, JobPost WHERE JobPost.id = '$PostID' AND JobPost.UserID = UserDetails.id LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); return $Row["FirstName"]; } function GetJobPosterEmailAddress($PostID) { $UserID = GetLoggedInUserID(); $Query = "SELECT Email FROM UserDetails, JobPost WHERE JobPost.id = '$PostID' AND JobPost.UserID = UserDetails.id LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); return $Row["Email"]; } function GetLoggedInEmail() { $UserID = GetLoggedInUserID(); $Query = "select Email from UserDetails where id = '$UserID' LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); return $Row["Email"]; } function GetLoggedInTitle() { $UserID = GetLoggedInUserID(); $Query = "select Title from UserDetails where id = '$UserID' LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); return GetDataFromSettingsTable("Settings_Title", $Row["Title"]); } function GetLoggedInFirstName() { $UserID = GetLoggedInUserID(); $Query = "select FirstName from UserDetails where id = '$UserID' LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); return $Row["FirstName"]; } function GetLoggedInSurname() { $UserID = GetLoggedInUserID(); $Query = "select Surname from UserDetails where id = '$UserID' LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); return $Row["Surname"]; } function GetLoggedInFullName() { return GetLoggedInTitle() . " " . GetLoggedInFirstName() . " " . GetLoggedInSurname(); } function GetLoggedInUserName() { return $_SESSION["username"]; } function IsUserLogggedIn($UserType) { if (isset($_SESSION["user_id"])) { if (GetUserType($_SESSION["user_id"]) == $UserType) { return 1; } } return 0; } function IsJobseekerUserLoggedIn() { return IsUserLogggedIn("Jobseeker"); } function IsAgencyLoggedIn() { return IsUserLogggedIn("Agency"); } function IsTransportOperatorLoggedIn() { return IsUserLogggedIn("TransportOperator"); } function SendEmailWithResume($uname, $Title, $Body, $Email, $Data1 = "", $Data2 = "", $Data3 = "", $Data4 = "", $Data5 = "", $Data6 = "", $Data7 = "", $Data8 = "", $Data9 = "", $Data10 = "") { $RandomHash = md5(date('r', time())); $Body = str_replace('$Data10', $Data10, $Body); $Body = str_replace('$Data1', $Data1, $Body); $Body = str_replace('$Data2', $Data2, $Body); $Body = str_replace('$Data3', $Data3, $Body); $Body = str_replace('$Data4', $Data4, $Body); $Body = str_replace('$Data5', $Data5, $Body); $Body = str_replace('$Data6', $Data6, $Body); $Body = str_replace('$Data7', $Data7, $Body); $Body = str_replace('$Data8', $Data8, $Body); $Body = str_replace('$Data9', $Data9, $Body); $headers = "From: www.smsjobsite.co.uk <paul@wcrltd.co.uk>\r\n"; $headers .= "BCC: paul@wcrltd.co.uk\r\n"; $headers .= "Content-Type: multipart/mixed; boundary=\"PHP-mixed-".$RandomHash."\"\r\n"; // $headers .= "BCC: paul@westcoastrecruitment.co.uk\r\n"; $message = "--PHP-mixed-$RandomHash\r\n"; $message .= "Content-Type: multipart/alternative; boundary=\"PHP-alt-$RandomHash\"\r\n"; $message .= "--PHP-alt-$RandomHash\r\n"; $message .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n"; $message .= "Content-Transfer-Encoding: 7bit\r\n"; $message .= "\r\n$Body\r\n"; $Query = "SELECT OCTET_LENGTH(attachment) as Size, attachment, attachment_type as ContentType FROM job_seeker_info where uname = '$uname'"; $Result = mysql_query ($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); $fileType = $Row['ContentType']; if ($fileType == "application/msword") { $filename="TRSBClientResume.doc"; } else if ($fileType == "application/rtf") { $filename="TRSBClientResume.rtf"; } else if ($fileType == "application/pdf") { $filename="TRSBClientResume.pdf"; } else if ($fileType == "application/vnd.openxmlformats-officedocument.wordprocessingml.document") { $filename="TRSBClientResume.docx"; } else if ($fileType == "text/plain") { $filename="TRSBClientResume.txt"; } else { echo "Your CV is in an invalid format $fileType"; } $FileName = $filename; if (isset($Row["Size"]) && $Row["Size"] > 0) { $message .= "--PHP-mixed-$RandomHash\r\n"; $message .= "Content-Type: " . $Row["ContentType"] . "; name=\"$FileName\"\r\n"; $message .= 'Content-Length: ' . $Row["Size"] . "\r\n"; $message .= "Content-Transfer-Encoding: base64\r\n"; $message .= "Content-Disposition: attachment\r\n\r\n"; $message .= chunk_split(base64_encode($Row["attachment"])) . "\r\n"; } $message .= "--PHP-mixed-$RandomHash--\r\n"; mail($Email, $Title, $message, $headers); } function GetFormContent($Title, $Data1 = "", $Data2 = "", $Data3 = "", $Data4 = "", $Data5 = "", $Data6 = "", $Data7 = "", $Data8 = "", $Data9 = "", $Data10 = "") { $Body = GetEmailFromSettingsTable($Title); $Body = str_replace('$Data1', $Data1, $Body); $Body = str_replace('$Data2', $Data2, $Body); $Body = str_replace('$Data3', $Data3, $Body); $Body = str_replace('$Data4', $Data4, $Body); $Body = str_replace('$Data5', $Data5, $Body); $Body = str_replace('$Data6', $Data6, $Body); $Body = str_replace('$Data7', $Data7, $Body); $Body = str_replace('$Data8', $Data8, $Body); $Body = str_replace('$Data9', $Data9, $Body); $Body = str_replace('$Data10', $Data10, $Body); return $Body; } function SendEmailFrom($To, $Subject, $Message, $From) { $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html\r\n"; $headers .= "From: www.smsjobsite.co.uk <$From>\n"; $headers .= "X-Mailer: PHP/" . phpversion()."\n"; mail($To, $Subject, $Message, $headers); } function SendEmail($Title, $Body, $Email, $Data1 = "", $Data2 = "", $Data3 = "", $Data4 = "", $Data5 = "", $Data6 = "", $Data7 = "", $Data8 = "", $Data9 = "", $Data10 = "", $Data11 = "", $Data12 = "", $Data13 = "") { $Body = str_replace('$Data10', $Data10, $Body); $Body = str_replace('$Data11', $Data11, $Body); $Body = str_replace('$Data12', $Data12, $Body); $Body = str_replace('$Data13', $Data13, $Body); $Body = str_replace('$Data1', $Data1, $Body); $Body = str_replace('$Data2', $Data2, $Body); $Body = str_replace('$Data3', $Data3, $Body); $Body = str_replace('$Data4', $Data4, $Body); $Body = str_replace('$Data5', $Data5, $Body); $Body = str_replace('$Data6', $Data6, $Body); $Body = str_replace('$Data7', $Data7, $Body); $Body = str_replace('$Data8', $Data8, $Body); $Body = str_replace('$Data9', $Data9, $Body); $Body = str_replace('\r\n', "<br />", $Body); $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html\r\n"; $headers .= "From: www.smsjobsite.co.uk <paul@wcrltd.co.uk>\n"; $headers .= "X-Mailer: PHP/" . phpversion()."\n"; // $headers .= "BCC: davestubbs@hotmail.com\r\n"; $headers .= "BCC: paul@wcrltd.co.uk\r\n"; mail($Email, $Title, $Body, $headers); } function GetEmailFromSettingsTable($Type) { global $Database; $Query = "SELECT Data FROM Settings_Emails where Type = '$Type' LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); return stripslashes($Row["Data"]); } function GetEmailFromSettingsTableStripParagraph($Type) { $res = GetEmailFromSettingsTable($Type); $res = str_replace("<p>", "", $res); $res = str_replace("</p>", "", $res); return $res; } function GetNotesFromSettingsTable($Type) { global $Database; $Query = "SELECT Notes FROM Settings_Emails where Type = '$Type' LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); return $Row["Notes"]; } function GetMultiSelectUserDetails($UserID, $ArrayName, $SettingsTableName, $UserDetailsTableName) { global $Database; $Query = "SELECT Data FROM $UserDetailsTableName, $SettingsTableName WHERE UserID=$UserID AND $UserDetailsTableName.DetailID = $SettingsTableName.id;"; $Result = mysql_query ($Query) or die (mysql_error()); if (mysql_num_rows($Result) == 0) { return ""; } while ($Row = mysql_fetch_array($Result)) { $implode[] = $Row['Data']; } $Val = implode(';', $implode); $Val = ";$Val;"; return mysql_real_escape_string(htmlentities($Val)); } function SaveMultiSelectUserDatails($UserID, $ArrayName, $SettingTableName, $UserDetailsTableName) { $DetailsArray = array(); $DetailsArray = PagePostArrayNoImplode($ArrayName); if ($DetailsArray != "") { foreach ($DetailsArray as &$Detail) { $ID = GetIDFromSettingsTable("$SettingTableName", $Detail); $Query = "INSERT INTO $UserDetailsTableName (UserID, DetailID) VALUES ('$UserID', '$ID');";; $Result = mysql_query ($Query) or die (mysql_error()); } } } function GetMultiSelectJobPost($TableName, $PostID) { $Query = "select * from JobPost_$TableName, Settings_$TableName where JobPostID = $PostID and JobPost_$TableName.DetailID = Settings_$TableName.id;"; $Result = mysql_query ($Query) or die (mysql_error()); if (mysql_num_rows($Result) == 0) { return ""; } while ($Row = mysql_fetch_array($Result)) { $implode[] = $Row['Data']; } $Val = implode(';', $implode); $Val = ";$Val;"; return mysql_real_escape_string(htmlentities($Val)); } function SaveMultiSelectDatails($JobPostID, $ArrayName, $SettingTableName, $UserDetailsTableName) { $DetailsArray = array(); $DetailsArray = PagePostArrayNoImplode($ArrayName); if ($DetailsArray != "") { foreach ($DetailsArray as &$Detail) { $ID = GetIDFromSettingsTable("$SettingTableName", $Detail); $Query = "INSERT INTO $UserDetailsTableName (JobPostID, DetailID) VALUES ('$JobPostID', '$ID');";; $Result = mysql_query ($Query) or die (mysql_error()); } } } function SendUserCredentialsReminderEmail($Email, $UserName, $Password) { $Body = GetEmailFromSettingsTable("CredentialsReminder"); $Subject = "West Coast Recruitment Ltd user credentials reminder"; SendEmail($Subject, $Body, $Email, $UserName, $Password); } function UpdateMultiSelectJobPostDatails($JobPostID, $ArrayName, $SettingTableName, $DataTableName) { // Delete all old settings $Query = "DELETE FROM $DataTableName WHERE JobPostID = $JobPostID"; $Result = mysql_query ($Query) or die (mysql_error()); SaveMultiSelectDatails($JobPostID, $ArrayName, $SettingTableName, $DataTableName); } function UpdateMultiSelectUserDatails($UserID, $ArrayName, $SettingTableName, $UserDetailsTableName) { // Delete old settings first $Query = "DELETE FROM $UserDetailsTableName WHERE UserID = $UserID"; $Result = mysql_query ($Query) or die (mysql_error()); if ($_FILES["CVFileUploadField"]['tmp_name'] != "") { $FileType = GetIDFromSettingsTable("Settings_SupportedCVFileTypes", $_FILES["CVFileUploadField"]['type']); if ($FileType == "") { FatalError("Invalid CV type. Please upload a supported CV file (" . $_FILES["CVFileUploadField"]['type'] . ")"); return false; } } SaveMultiSelectUserDatails($UserID, $ArrayName, $SettingTableName, $UserDetailsTableName); } function StoreNewUserDetails($Title, $FirstName, $Surname, $Address1, $Address2, $Town, $PostCode, $Phone, $Mobile, $Email, $UserName, $Password, $County, $TypeOfUser) { srand(time()); $AuthorizationCode = (rand() % 10000) + 1; $TitleToInsert = GetIDFromSettingsTable("Settings_Title", $Title); $CountyToInsert = GetIDFromSettingsTable("Settings_County", $County); $UserType = GetIDFromSettingsTable("Settings_UserType", $TypeOfUser); $Query = "INSERT INTO UserDetails ("; $Query .= "Title,"; $Query .= "FirstName,"; $Query .= "Surname,"; $Query .= "Address1,"; $Query .= "Address2,"; $Query .= "Town,"; $Query .= "County,"; $Query .= "PostCode,"; $Query .= "Phone,"; $Query .= "Mobile,"; $Query .= "Email,"; $Query .= "UserName,"; $Query .= "Password,"; $Query .= "Admin,"; $Query .= "Authenticated,"; $Query .= "UserType"; $Query .= ")"; $Query .= "VALUES ("; $Query .= "'$TitleToInsert', '$FirstName', '$Surname', '$Address1', '$Address2', '$Town', "; $Query .= "'$CountyToInsert', '$PostCode', '$Phone', '$Mobile',"; $Query .= " '$Email', '$UserName', '$Password', '0', '$AuthorizationCode', '$UserType'"; $Query .= ");"; $Result = mysql_query ($Query) or die (mysql_error()); return $AuthorizationCode; } function StoreUpdatedUserDetails($Title, $County, $FirstName, $Surname, $Address1, $Address2, $Town, $County, $PostCode, $Email, $UserName, $Password, $UserID, $TypeOfUser, $AuthorizationCode, $Phone, $Mobile) { // All is good, add the user srand(time()); $TitleToInsert = GetIDFromSettingsTable("Settings_Title", $Title); $CountyToInsert = GetIDFromSettingsTable("Settings_County", $County); $UserType = GetIDFromSettingsTable("Settings_UserType", $TypeOfUser); $Query = "UPDATE UserDetails SET "; $Query .= "Title = '$TitleToInsert', "; $Query .= "FirstName = '$FirstName', "; $Query .= "Surname = '$Surname', "; $Query .= "Address1 = '$Address1', "; $Query .= "Address2 = '$Address2', "; $Query .= "Town = '$Town', "; $Query .= "County = '$CountyToInsert', "; $Query .= "PostCode = '$PostCode', "; $Query .= "Phone = '$Phone', "; $Query .= "Mobile = '$Mobile', "; $Query .= "Email = '$Email', "; $Query .= "UserName = '$UserName', "; $Query .= "Password = '$Password', "; $Query .= "Admin = '0', "; $Query .= "Authenticated = '$AuthorizationCode', "; $Query .= "UserType = '$UserType' "; $Query .= "WHERE id = '$UserID' LIMIT 1;"; $Result = mysql_query ($Query) or die (mysql_error()); } function UpdatedUserDetailsGood($UserName, $UserID, $Email, $Password) { // Make sure they don't try and change their username if ($UserName != GetLoggedInUserName()) { FatalError("You cannot change your username"); return false; } // Make sure they enter the correct password if (GetUserPasswordFromID($UserID) != $Password) { FatalError("You must enter your correct password to update your details"); return false; } if (!ValidateCaptcha()) { FatalError("Invalid code entered, please try again"); return false; } if (ValidateEmail($Email) == 0) { FatalError("Invalid email address, please try again"); return false; } return true; } function UserDetailsGood($UserType, $UserName, $Email) { if (CheckIfUserNameExists($UserName) != 0) { FatalError("Username already exists, please choose another one"); return false; } // Only allow duplicate emails if for different sections if (CheckIfEmailExists($UserType, $Email) != 0) { FatalError("You are already registered with this site. A reminder email has been sent to your email address"); SendUserCredentialsReminderEmail($Email, GetUsernameFromEmail($Email), GetPasswordFromEmail($Email)); return false; } if (!ValidateCaptcha()) { FatalError("Invalid code entered, please try again"); return false; } if (ValidateEmail($Email) == 0) { FatalError("Invalid email address, please try again"); return false; } return true; } // TODO: PostCode lookup should be case insensitive function DistanceBetweenPostCodes($PostCode1, $PostCode2) { // We only care about the firts part if (strpos ($PostCode1, ' ')) $PostCode1 = substr ($PostCode1, 0, strpos ($PostCode1, ' ')); if (strpos ($PostCode2, ' ')) $PostCode2 = substr ($PostCode2, 0, strpos ($PostCode2, ' ')); $Query = "select latitude, longitude from postcodes where outcode = '$PostCode1'"; $Result = mysql_query ($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); $lat1 = $Row["latitude"]; $lon1 = $Row["latitude"]; $Query = "select latitude, longitude from postcodes where outcode = '$PostCode2'"; $Result = mysql_query ($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); $lat2 = $Row["latitude"]; $lon2 = $Row["latitude"]; // Fails sometimes $Distance = (3958*3.1415926*sqrt(($lat2-$lat1)*($lat2-$lat1) + cos($lat2/57.29578)*cos($lat1/57.29578)*($lon2-$lon1)*($lon2-$lon1))/180); /* $pi80 = M_PI / 180; $lat1 *= $pi80; $lng1 *= $pi80; $lat2 *= $pi80; $lng2 *= $pi80; $r = 6372.797; // mean radius of Earth in km $dlat = $lat2 - $lat1; $dlng = $lng2 - $lng1; $a = sin($dlat / 2) * sin($dlat / 2) + cos($lat1) * cos($lat2) * sin($dlng / 2) * sin($dlng / 2); $c = 2 * atan2(sqrt($a), sqrt(1 - $a)); $km = $r * $c; return $km * 0.621371192; */ return $Distance; } function WithinDistance($PostCode1, $PostCode2, $MaxDist) { return DistanceBetweenPostCodes($PostCode1, $PostCode2) < $MaxDist; } function EnableDevelopmentPages() { // Expire in 1 year $Time = 60 * 60 * 24 * 30 + time(); setcookie("DS_Developer", "davestubbs", $Time, "/"); } function DisableDevelopmentPages() { $Past = time() - 10; setcookie("DS_Developer", "", $Past, "/"); } function ShowDevelopmentPages() { $DevCookie = $_COOKIE['DS_DeveloperAug2010']; if ($DevCookie == "davestubbs") return true; return false; } function RedirectToHomePage() { if (IsJobseekerUserLoggedIn()) header('Location: http://www.wcrltd.co.uk/jobseekers/jobseeker_home.php'); else if (IsTransportOperatorLoggedIn()) header('Location: http://www.wcrltd.co.uk/operators/operators_home.php'); else if (IsAgencyLoggedIn()) header('Location: http://www.wcrltd.co.uk/agencies/agencies_home.php'); else header('Location: http://www.wcrltd.co.uk/'); return; } function EmitMenuBarOptions() { echo("<script type=\"text/javascript\">\n"); echo("<!--\n"); echo("var wbMenuMenuBar1 =\n"); echo("[\n"); echo("[null, 'Jobseekers', '$BaseURL/jobseekers/jobseeker_home.html', '_self', 'Jobseekers',\n"); echo("[null, 'Jobseeker Information Page', '$BaseURL/jobseekers/jobseeker_home.php', '_self', 'Jobseeker Information Page'],\n"); echo("[null, 'CV Advice', '$BaseURL/cv_advice.html', '_self', 'CV Advice'],\n"); if (!IsJobseekerUserLoggedIn()) { echo ("[null, 'Login', '$BaseURL/login.php', '_self', 'Login'],"); echo ("[null, 'Register Free', '$BaseURL/jobseekers/jobseeker_register.php', '_self', 'Register Free'],"); } else { echo ("[null, 'Edit Details', '$BaseURL/jobseekers/jobseeker_register.php?EditDetails', '_self', 'Edit Details'],"); echo ("[null, 'Change Password', '$BaseURL/change_password.php', '_self', 'Change Password'],"); echo ("[null, 'Search', null, '_self', 'Search',"); echo ("[null, 'Jobs', '$BaseURL/search_folder/search_jobs.php', '_self', 'Jobs'],"); if (ShowDevelopmentPages()) { echo ("[null, 'Agencies', '$BaseURL/search_folder/search_agencies.php', '_self', 'Agencies'],"); echo ("[null, 'Companies', '$BaseURL/search_folder/search_companies.php', '_self', 'Companies'],"); echo ("[null, 'Garages', '$BaseURL/search_folder/co_search_garages.php', '_self', 'Garages'],"); echo ("[null, 'Training', '$BaseURL/search_folder/search_training.php', '_self', 'Training']"); } echo ("],"); echo ("[null, 'Logout', '$BaseURL/logout.php', '_self', 'Logout']"); } echo("],\n"); echo("[null, 'Transport Operators', './../operators/operators_home.php', '_self', 'Transport Operators',\n"); echo("[null, 'Operator Information Page', './../operators/operators_home.php', '_self', 'Operator Information Page'],\n"); if (!IsTransportOperatorLoggedIn()) { echo("[null, 'Login', '$BaseURL/login.php', '_self', 'Login'],"); echo("[null, 'Register Free', '$BaseURL/operators/operators_create_account.php', '_self', 'Register Free'],"); } else { echo("[null, 'Edit Account', '$BaseURL/operators/operators_create_account.php?EditDetails', '_self', 'Edit Account'],"); echo("[null, 'Change Password', '$BaseURL/change_password.php', '_self', 'Change Password'],"); echo("[null, 'Post Job', '$BaseURL/jobs_folder/post_job.php', '_self', 'Post Job'],"); echo("[null, 'List Jobs', '$BaseURL/jobs_folder/list_jobs.php', '_self', 'List Job'],"); echo("[null, 'Search', null, '_self', 'Search',"); echo("[null, 'Jobs', '$BaseURL/search_folder/search_jobs.php', '_self', 'Jobs'],"); echo("],"); } if (ShowDevelopmentPages()) { echo("[null, 'Search', null, '_self', 'Search',"); echo("[null, 'Agencies', '$BaseURL/search_folder/search_agencies.php', '_self', 'Agencies'],"); echo("[null, 'Freight', '$BaseURL/freight/freight_home.html', '_self', 'Freight'],"); echo("[null, 'Garages', '$BaseURL/search_folder/co_search_garages.php', '_self', 'Garages'],"); echo("[null, 'Operators', '$BaseURL/search_folder/search_companies.php', '_self', 'Operators'],"); echo("[null, 'Training', '$BaseURL/search_folder/search_training.php', '_self', 'Training']"); echo("[null, 'Jobseekers', '$BaseURL/search_folder/co_search_jobseekers.php', '_self', 'Jobseekers'],"); echo("],"); } if (IsTransportOperatorLoggedIn()) { echo("[null, 'Logout', '$BaseURL/logout.php', '_self', 'Logout']"); } echo("],\n"); echo("[null, 'Freight', null, '_self', 'Freight',\n"); if (ShowDevelopmentPages()) { echo("[null, 'Freight Home Page', './../freight/freight_home.html', '_self', 'Freight Home Page'],\n"); echo("[null, 'Search', null, '_self', 'Search',\n"); echo("[null, 'Vehicles', null, '_self', 'Vehicles',\n"); echo("[null, 'UK to UK', './../freight/search_vehicles/search_vehicles_uk_to_uk.php', '_self', 'UK to UK'],\n"); echo("[null, 'Europe to Europe', './../freight/search_vehicles/search_vehicles_europe_to_europe.php', '_self', 'Europe to Europe'],\n"); echo("[null, 'UK to Europe', './../freight/search_vehicles/search_vehicles_uk_to_europe.php', '_self', 'UK to Europe'],\n"); echo("[null, 'Europe to UK', './../freight/search_vehicles/search_vehicles_europe_to_uk.php', '_self', 'Europe to UK']\n"); echo("],\n"); echo("[null, 'Freight', null, '_self', 'Freight',\n"); echo("[null, 'UK to UK', './../freight/search_loads/search_uk_to_uk.php', '_self', 'UK to UK'],\n"); echo("[null, 'Europe to Europe', './../freight/search_loads/search_europe_to_europe.php', '_self', 'Europe to Europe'],\n"); echo("[null, 'UK to Europe', './../freight/search_loads/search_uk_to_europe.php', '_self', 'UK to Europe'],\n"); echo("[null, 'Europe to UK', './../freight/search_loads/search_europe_to_uk.php', '_self', 'Europe to UK']\n"); echo("]\n"); echo("],\n"); echo("[null, 'Post', null, '_self', 'Post',\n"); echo("[null, 'Vehicles', null, '_self', 'Vehicles',\n"); echo("[null, 'UK to UK', './../freight/post_vehicles/post_vehicles_uk_to_uk.php', '_self', 'UK to UK'],\n"); echo("[null, 'Europe to Europe', './../freight/post_vehicles/post_vehicles_europe_to_europe.php', '_self', 'Europe to Europe'],\n"); echo("[null, 'UK to Europe', './../freight/post_vehicles/post_vehicles_uk_to_europe.php', '_self', 'UK to Europe'],\n"); echo("[null, 'Europe to UK', './../freight/post_vehicles/post_vehicles_europe_to_uk.php', '_self', 'Europe to UK']\n"); echo("],\n"); echo("[null, 'Freight', null, '_self', 'Freight',\n"); echo("[null, 'UK to UK', './../freight/post_loads/post_uk_to_uk.php', '_self', 'UK to UK'],\n"); echo("[null, 'Europe to Europe', './../freight/post_loads/post_europe_to_europe.php', '_self', 'Europe to Europe'],\n"); echo("[null, 'UK to Europe', './../freight/post_loads/post_uk_to_europe.php', '_self', 'UK to Europe'],\n"); echo("[null, 'Europe to UK', './../freight/post_loads/edit_freight_europe_to_uk.php', '_self', 'Europe to UK']\n"); echo("]\n"); echo("]\n"); } echo("],\n"); echo("[null, 'Agencies', './../agencies/agencies_home.php', '_self', 'Agencies',\n"); echo("[null, 'Agency Information Page', './../agencies/agencies_home.php', '_self', 'Agency Information Page'],\n"); if (ShowDevelopmentPages()) { if (!IsAgencyLoggedIn()) { echo("[null, 'Login', './../login.php', '_self', 'Login'],"); echo("[null, 'Register Free', './../agencies/ag_create_account.php', '_self', 'Register Free'],"); } else { echo("[null, 'Edit Account', './../agencies/ag_create_account.php?EditDetails', '_self', 'Edit Account'],"); echo ("[null, 'Change Password', '$BaseURL/change_password.php', '_self', 'Change Password'],"); } echo("[null, 'Post Job', './../jobs_folder/post_job.php', '_self', 'Post Job'],"); echo("[null, 'Edit Job', './../jobs_folder/edit_job.php', '_self', 'Edit Job'],"); echo("[null, 'Delete Job', './../jobs_folder/co_edit_delete_job.html', '_self', 'Delete Job'],"); echo("[null, 'Search', null, '_self', 'Search',"); echo("[null, 'Agencies', './../search_folder/search_agencies.php', '_self', 'Agencies'],"); echo("[null, 'Freight', './../freight/freight_home.html', '_self', 'Freight'],"); echo("[null, 'Garages', './../search_folder/co_search_garages.php', '_self', 'Garages'],"); echo("[null, 'Jobs', './../search_folder/search_jobs.php', '_self', 'Jobs'],"); echo("[null, 'Jobseekers', './../search_folder/co_search_jobseekers.php', '_self', 'Jobseekers'],"); echo("[null, 'Operators', './../search_folder/search_companies.php', '_self', 'Operators'],"); echo("[null, 'Training', './../search_folder/search_training.php', '_self', 'Training']"); echo("],"); if (IsAgencyLoggedIn()) { echo("[null, 'Logout', './../logout.php', '_self', 'Logout']"); } } echo("],\n"); echo("[null, 'Training', './../training/training_home.php', '_self', 'Training',\n"); echo("[null, 'Training Information Page', './../training/training_home.php', '_self', 'Training Information Page'],\n"); if (ShowDevelopmentPages()) { echo("[null, 'Login', './../login.php', '_self', 'Login'],"); echo("[null, 'Create Account', './../training/tr_create_account.php', '_self', 'Create Account'],"); echo("[null, 'Edit Account', './../training/tr_edit_account.php', '_self', 'Edit Account'],"); echo("[null, 'Change Password', '$BaseURL/change_password.php', '_self', 'Change Password'],"); echo("[null, 'Post Job', './../jobs_folder/post_job.php', '_self', 'Post Job'],"); echo("[null, 'Edit Job', './../jobs_folder/edit_job.php', '_self', 'Edit Job'],"); echo("[null, 'Delete Job', './../jobs_folder/co_edit_delete_job.html', '_self', 'Delete Job'],"); echo("[null, 'Search', null, '_self', 'Search',"); echo("[null, 'Agencies', './../search_folder/search_agencies.php', '_self', 'Agencies'],"); echo("[null, 'Freight', './../freight/freight_home.html', '_self', 'Freight'],"); echo("[null, 'Garages', './../search_folder/co_search_garages.php', '_self', 'Garages'],"); echo("[null, 'Jobs', './../search_folder/search_jobs.php', '_self', 'Jobs'],"); echo("[null, 'Jobseekers', './../search_folder/co_search_jobseekers.php', '_self', 'Jobseekers'],"); echo("[null, 'Operators', './../search_folder/search_companies.php', '_self', 'Operators'],"); echo("[null, 'Training', './../search_folder/search_training.php', '_self', 'Training']"); echo("],"); echo("[null, 'Logout', './../logout.php', '_self', 'Logout']"); } echo("],\n"); echo("[null, 'Garages', './../garages/garages_home.php', '_self', 'Garages',\n"); echo("[null, 'Garage\'s Information Page', './../garages/garages_home.php', '_self', 'Garage\'s Information Page'],\n"); if (ShowDevelopmentPages()) { echo("[null, 'Login', './../login.php', '_self', 'Login'],"); echo("[null, 'Create Account', './../garages/gr_create_account.php', '_self', 'Create Account'],"); echo("[null, 'Edit Account', './../garages/gr_edit_account.php', '_self', 'Edit Account'],"); echo("[null, 'Change Password', '$BaseURL/change_password.php', '_self', 'Change Password'],"); echo("[null, 'Post Job', './../jobs_folder/post_job.php', '_self', 'Post Job'],"); echo("[null, 'Edit Job', './../jobs_folder/edit_job.php', '_self', 'Edit Job'],"); echo("[null, 'Delete Job', './../jobs_folder/co_edit_delete_job.html', '_self', 'Delete Job'],"); echo("[null, 'Search', null, '_self', 'Search',"); echo("[null, 'Agencies', './../search_folder/search_agencies.php', '_self', 'Agencies'],"); echo("[null, 'Freight', './../freight/freight_home.html', '_self', 'Freight'],"); echo("[null, 'Garages', './../search_folder/co_search_garages.php', '_self', 'Garages'],"); echo("[null, 'Jobs', './../search_folder/search_jobs.php', '_self', 'Jobs'],"); echo("[null, 'Jobseekers', './../search_folder/co_search_jobseekers.php', '_self', 'Jobseekers'],"); echo("[null, 'Operators', './../search_folder/search_companies.php', '_self', 'Operators'],"); echo("[null, 'Training', './../search_folder/search_training.php', '_self', 'Training']"); echo("],"); echo("[null, 'Logout', './../logout.php', '_self', 'Logout']"); } echo("]\n"); echo("];\n"); echo("-->\n"); echo("</script>\n"); } ?>
  7. I have created a form with a field called JobCategory. I also have a field called JobSkill. The JobSkill is populated based on a selection from the JobCategory using javascript. The Database fields have the same names. The problem i am getting is when I fill in the form i get the message "you must enter a job skill" even though I have done. If i disable the validation for JobSkills the form works and the data is sent to the database. Problem is the JobCategory field in the db is populated but the JobSkills field is empty. Not sure what I'm doing wrong. This is the HTML form script I've shortened the page so its easier to read: <? include_once "../main.php"; include_once "../functions.php"; include_once "../conn.php"; $user=PageGet(user); $verify=PageGet(verify); if ($user != "" && $verify != "") { $q = "select * from job_seeker_info where uname = \"$user\" and unverified = \"$verify\""; $r = mysql_query($q) or die(mysql_error()); $a = mysql_fetch_array($r); if ($a[uname]) { $q2 = "update job_seeker_info SET unverified = \"0\" where uname = \"$user\" and unverified = \"$verify\""; $r2 = mysql_query($q2) or die(mysql_error()); echo "Your account is now verified.<br><br> You can log in and access all the features of the site.<br><br> Please remember to upload your CV Without doing this Employers will not be able<br> to find you in any CV searches.<br><br> Thank you for choosing our site and we wish you every success in finding employment"; include_once('../footer.php'); exit(0); } else { echo "You have already verified your email address. You can now login!"; include_once('../footer.php'); exit(0); } } $q = "select * from job_seeker_info where uname = \"$uname\""; $r = mysql_query($q) or die(mysql_error()); $a = mysql_fetch_array($r); ?> </script> <script type="text/javascript"> function fillSecondCombo() { var combo1 = document.getElementById('JobCategory'); var combo2 = document.getElementById('JobSkills'); var selected = combo1.options[combo1.options.selectedIndex].value; if (selected == "Agriculture") { combo2.options.length = 3; combo2.options[0] = new Option("Agricultural Engineer", "Agricultural Engineer"); combo2.options[1] = new Option("Animal Care", "Animal Care"); combo2.options[2] = new Option("Dairy Worker", "Dairy Worker"); combo2.options[3] = new Option("Farm Worker", "Farm Worker"); combo2.options[4] = new Option("Harvesting Equipment Driver", "Harvesting Equipment Driver"); combo2.options[5] = new Option("Tractor Driver", "Tractor Driver"); combo2.options[6] = new Option("Zoo and Safari Park Worker", "Zoo and Safari Park Worker"); combo2.options[7] = new Option("Other - Not Listed", "Other - Not Listed"); } </script> <table width="428" border="0" cellspacing="1" cellpadding="4" align=center> <tr> <td width="420"><img alt="career seeker" src="../images/career_seeker.gif" width="238" height="42"></td> </tr> <tr> <td><img alt="horizontal line" src="../images/horz.jpg" width="420" height="1"><br> </td> </tr> <tr> <td><form action=jobseeker_registration2_new.php method=post name="job_seeker_reg" onsubmit="return check_form();"> <table align=center width=430 border=0 cellspacing=2 cellpadding=2> <tr> <td bgcolor="<?php echo $top_cell;?>"><font size="2" face="Arial, Helvetica, sans-serif"> <b>Username:</b><font color=red>*</font></font> </td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <input type=text name=uname size=23 maxlength=10> <br> <font size="1">max. 10 symbols (letters and/or numbers) </font></font> </td> </tr> <tr> <td bgcolor="<?php echo $top_cell;?>" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> Password:<font color=red>*</font></font> </td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <input type=password name=upass size=23 maxlength=10> <br> <font size="1">max. 10 symbols (letters and/or numbers) </font></font> </td> </tr> <tr> <td bgcolor="<?php echo $top_cell;?>" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> Confirm Password:<font color=red>*</font></font> </td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <input type=password name=cpass size=23 maxlength=10> </font></td> </tr> <tr> <td bgcolor="<?php echo $top_cell;?>" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> Title:<font color=red>*</font></font> </td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <select name=title> <option value=""> </option> <option value="Mr.">Mr. </option> <option value="Mrs.">Mrs. </option> <option value="Miss.">Miss. </option> <option value="Ms.">Ms. </option> </select> </font></td> </tr> <tr> <td bgcolor="<?php echo $top_cell;?>" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> First Name:<font color=red>*</font></font> </td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <input type="text" name="fname" size="15" maxlengh="20" /> </tr> <tr> <td bgcolor="<?php echo $top_cell;?>" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> Last Name:<font color=red>*</font></font> </td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <input type=text name=lname size=23> </font></td> </tr> <tr> <td bgcolor="<?php echo $top_cell;?>" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> Address:<font color=red>*</font></font> </td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <input type=text name=address> </font></td> </tr> <tr> <td bgcolor="<?php echo $top_cell;?>" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> Address 2:<font color=red>*</font></font> </td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <input type=text name=address2> </font></td> </tr> <tr> <td bgcolor="<?php echo $top_cell;?>" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> City / Town:<font color=red>*</font></font> </td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <input type=text name=city size=33> </font></td> </tr> <tr> <td bgcolor="<?php echo $top_cell;?>" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> County:<font color=red>* </font></td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <select name=state> <OPTION VALUE="">Select</OPTION> <OPTION VALUE="Avon">Avon <OPTION VALUE="Bedfordshire">Bedfordshire </select> </font></td> </tr> <tr> <td bgcolor="<?php echo $top_cell;?>" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> Post Code:<font color=red>*</font></font> </td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <input type=text name=zip size=7> </font></td> </tr> <tr> <td bgcolor="<?php echo $top_cell;?>" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> Date of Birth: <font color=red>*</font></font> </td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <select name=bday> <option value=""> Day </option> <option value=1> 1 </option> </select> <select name=byear> <option value=""> Year </option> <?php $currentYear = date("Y"); for ($i = ($currentYear-15); $i >= ($currentYear-70); $i--) { echo ("<option value='$i'>$i</option>"); } ?> </select> </font></td> </tr> <tr> <td bgcolor="<?php echo $top_cell;?>" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> Phone:<font color=red>*</font></font> </td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <input type=text name=phone> </font></td> </tr> <tr> <td bgcolor="<?php echo $top_cell;?>" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> Mobile Number: </font></td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <input type=text name=phone2> </font></td> </tr> <tr> <td bgcolor="<?php echo $top_cell;?>" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> Email:<font color=red>*</font></font> </td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <input type=text name=job_seeker_email> </font></td> </tr> <tr> <td valign=top bgcolor="<?php echo $top_cell;?>" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> Job Category:<font color=red>*</font></font></td> <td valign=top> <font size="3" face="Arial, Helvetica, sans-serif"> <select name=JobCategory size="1" id="JobCategory" onchange="fillSecondCombo();return false;"> <option selected value="0">Please select an option</option> <option value="Agriculture">Agriculture</option> </select> </font></td> </tr> <tr> <td bgcolor="<?php echo $top_cell;?>" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> Job Skills:<font color=red>*</font></font><br><br><font color=red>You can select more than one job skill by holding down the CTRL key on your keyboard </font</font></td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <select name="JobSkills[]" multiple size="1" id="JobSkills" style="width:226px;height:123px;z-index:24;"> </select> <br /> </font></td> </tr> <tr> <td bgcolor="<?php echo $top_cell;?>" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> Availability:<font color=red>*</font></font> </td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <?php PopulateHTMLMultiCheckboxWithDBTable("", "Settings_CareerLevel", "careerlevel", "careerlevel[]", "285"); <select name="careerlevel[]" multiple size=5> <option value="">Please Select</option> <OPTION VALUE="Days">Days</OPTION> <OPTION VALUE="Nights">Nights</OPTION> </select> ?> <br /> </font></td> </tr> <tr> <td valign=top bgcolor="<?php echo $top_cell;?>" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> Willing to Relocate? </font></td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <input type=radio name=relocate value=Yes> Yes<br> <input type=radio name=relocate value=No checked> No </font></td> </tr> <tr> <td align=left> <font size="2" face="Arial, Helvetica, sans-serif"> </font></td> <td align=left> <font size="2" face="Arial, Helvetica, sans-serif"> <input class=s2 type=submit name=submit value="Register me" align=left> <input class=s2 type=reset name=reset value="Reset" align=right> </font></td> </tr> </table> </form> </td> </tr> </table> And this is the form processor: <? session_start(); include_once "../main.php"; include_once "../functions.php"; $submit=$_POST[submit]; if($submit=="Register me") { if ($_POST[upass] == $_POST[cpass]) { $uname=PagePost(uname); $upass=PagePost(upass); $cpass=PagePost(cpass); $title=PagePost(title); $fname=PagePost(fname); $lname=PagePost(lname); $bmonth=PagePost(bmonth); $bday=PagePost(bday); $byear=PagePost(byear); $city=PagePost(city); $zip=PagePost(zip); $address1=PagePost(address); $address2=PagePost(address2); $phone=PagePost(phone); $phone2=PagePost(phone2); $job_seeker_email=PagePost(job_seeker_email); $state=PagePost(state); $JobCategory=PagePost(JobCategory); $JobSkills=PagePost(JobSkills); $relocation=PagePost(relocate); $careerlevel = PagePostArrayComma(careerlevel); if (!empty($uname) && !empty($upass) && !empty($cpass) && !empty($title) && !empty($fname) && !empty($lname) && !empty($bmonth) && !empty($bday) && !empty($byear) && !empty($city) && !empty($zip) && !empty($address1) && !empty($phone) && !empty($job_seeker_email) && !empty($JobCategory) && !empty($JobSkills) && !empty($careerlevel)) { $verifyNum = rand (1, 1000); $query = "insert into job_seeker_info set uname = \"$uname\", upass = \"$upass\", title = \"$title\", fname = \"$fname\", lname = \"$lname\", bmonth = \"$bmonth\", bday = \"$bday\", byear = \"$byear\", city = \"$city\", state = \"$state\", country = \"$country\", zip = \"$zip\", address = \"$address1\", address2 = \"$address2\", phone = \"$phone\", phone2 = \"$phone2\", job_seeker_email = \"$job_seeker_email\", JobCategory = \"$JobCategory\", JobSkills= \"$JobSkills\", relocate = \"$relocation\", unverified = \"$verifyNum\" "; $result = mysql_query($query) or die('<font size=2 face=Arial, Helvetica, sans-serif><br><br><center>This username is already in use. Please choose another. </center>'); $qcl = "insert into job_careerlevel set uname = \"$uname\", clnumber = \"$careerlevel\", clname = \"$clname\" "; $rcl = mysql_query($qcl) or die(mysql_error()); function SendRegistrationEmail($Title, $FirstName, $Surname, $UserName, $Password, $AuthorizationCode, $Email) { $Body = GetEmailFromSettingsTable("JobseekerRegistration"); $Subject = "You are now registered with http://www.trsb.co.uk"; $AuthorizationURL = "http://www.smsjobsite.co.uk/jobseekers/jobseeker_registration.php?verify=$AuthorizationCode&user=$UserName"; SendEmail($Subject, $Body, $Email, $UserName, $Password, $Title, $FirstName, $Surname, $AuthorizationURL); } SendRegistrationEmail($title, $fname, $lname, $uname, $upass, $verifyNum, $job_seeker_email); $message = "Dear $fname<br><br> Thank you for registering with <a href=http://www.smsjobsite.co.uk>TRSB Jobsite</a> <br><br> Your new user name and password are:<br> <br> <font color=green> ***************************<br> Username: $uname<br> Password: $upass<br> ***************************<br> </font> <br> Before you can you the site you must verify you email address. You can do that by visiting <a href=\"http://www.smsjobsite.co.uk/jobseekers/jobseeker_registration.php?verify=$verifyNum&user=$uname\">http://www.smsjobsite.co.uk/jobseekers/jobseeker_registration.php?verify=$verifyNum&user=$uname</a>. You will not be able to log in until you have verified your email address. <br> <br> Please keep this information in a secure place. You can change your password or your details at any time by using the edit details button on the main menu.<br> <br> <br> Please be sure that you have either uploaded or created your CV. Without doing this employers will not be able to see you in any CV searches.<br> <br> We will send you details of any vacancies that match your profile. Make sure that you have selected all the relevant industries. Employers may post jobs to more than one industry. You can select as many industries as you like by holding down the control key on your keyboard. To edit your details please go to <a href=http://www.smsjobsite.co.uk> S.M.S. Jobsite</a> Login and select edit details from the main menu.<br> <br> <center> <font color=red> Note for your security<br> </center> <br> You should never need to provide bank account details, other financial information, or make any form of payment; if you are ever asked to do this by a recruiter on our site please email <a href=mailto:paul@wcrltd.co.uk>Security</a> with the title of the job vacancy and Job ID number.<br> </font> <br> Thank you for registering with us and we wish you every success in your job search. We can be contacted at <a href=http://www.trsb.co.uk>http://www.trsb.co.uk</a> if you have any questions or concerns.<br> <br> Thanks and Regards,<br> <br> <font color=green><a href=http://www.smsjobsite.co.uk>smsjobsite.co.uk</a>.</font><br> (Recruitment Team)<br><br> <font color=green=================================================================================================</font><br> <font color=black>This message and any attachments are intended for the persons named as addressees only and may contain confidential information. In addition they may be protected by copyright. If you receive it in error, notify us, delete it and do not make use of or copy it. You must not copy, disseminate or otherwise distribute or publish this message, except for the purposes for which this message is intended, without our consent. Please note that this e-mail has been created in the knowledge that Internet e-mail is not a 100% secure communications medium. We advise that you understand and accept this lack of security when e-mailing us. This message has been scanned for viruses by our anti virus software, however we will not be held liable for any damaged caused by this e-mail or any attachments sent with it. It is up to you the recipient to satisfy themselves that this e-mail is safe and from a reliable source. Any views expressed in this e-mail are those of the writer and do not represent those of the company. It can not be relied upon to form any legally binding agreement between the writer or this company and the recipient. For further details and to view our privacy policy please follow the link below and select <font color=blue>Privacy Policy</font> from the main menu<br><br> $url"; $sMessage =""; $sMessage .="<table width=800 border=0 align=center cellpadding=0 cellspacing=0>"; $sMessage .="<tr><td align=left valign=top><img src=$url/images/logo-1.jpg width=800 height=205 /></td></tr>"; $sMessage .="<tr bgcolor=#f1f9fb><td height=300 align=center valign=top><font face=Verdana size=2><table width=780 border=0 cellspacing=0 cellpadding=0><tr><td>$message</td></tr></table></font></td></tr>"; $sMessage .="<tr><td height=35 align=center valign=middle bgcolor=#0DA5BC> </td></tr></table>"; $from = "From: $_SERVER[HTTP_HOST] <$aset[ContactEmail]>"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "Content-Transfer-Encoding: 8bit\n"; $headers .= "X-Priority: 1\n"; $headers .= "From: $from <$from>\r\n"; $headers .= "X-MSMail-Priority: High\n"; mail($to, $subject, $sMessage, $headers); $message = "A New Jobseeker has registered at $site_name\n\n username: $uname\n password: $upass\n\n\n"; $from = "From: $_SERVER[HTTP_HOST] <$job_seeker_email>"; mail($aset[ContactEmail], 'New Jobseeker Registration', $message, $from); echo "<br><br> <p align=center> <font size=2 face=Arial, Helvetica, sans-serif><font color=green><font size=6>$title $fname $lname<br><br></font><font color=black>Welcome to our site. Your registration was completed successfully.<br><br> You will shortly receive an email with your details. Within this email for your<br> security you will need to verify your email address before you can log into the site.<br><br>Once you have verified your email address and logged into the site<br> Please remember to upload CV. </a> </p> "; } else { echo "<center><br><br><br><font size=2 face=Arial, Helvetica, sans-serif><font color=red><b> Required fields are missing.<br> Please Go <a class=ERR href=jobseeker_registration.php><font color=blue> back</font> </a> and fill in the missing information.</b></font></center>"; if (empty($uname)) echo "You must create a username<br>"; if (empty($upass)) echo "You must select a password<br>"; if (empty($cpass)) echo "You have not confirmed your password<br>"; if (empty($title)) echo "You must select a title<br>"; if (empty($fname)) echo "Please enter your first name<br>"; if (empty($lname)) echo "Please enter your last name<br>"; if (empty($bmonth)) echo "Missing birth month<br>"; if (empty($bday)) echo "Missing birth day<br>"; if (empty($byear)) echo "Missing birth year<br>"; if (empty($city)) echo "You must enter a city<br>"; if (empty($state)) echo "You must select a county<br>"; if (empty($zip)) echo "Please enter your Post Code<br>"; if (empty($address1)) echo "Address line 1 cannot be left blank<br>"; if (empty($address2)) echo "Address line 2 cannot be left blank<br>"; if (empty($phone)) echo "Please enter a contact number<br>"; if (empty($job_seeker_email)) echo "You must enter a valid email address<br>"; if (empty($JobCategory)) echo "You must select at least 1 job category<br>"; if (empty($JobSkills)) echo "You must enter a job skill<br>"; if (empty($careerlevel)) echo "You must enter your Availability<br>"; } } } else { echo "<center><br><br><br><font size=2 face=Arial, Helvetica, sans-serif><b> You have made a mistake filling the password/confirm password fields. <br> Please Go <a class=ERR href=jobseeker_registration.php> back </a> and fill in the confirm password correctly.</b></font></center>"; } ?>
  8. Thanks Jon. I have managed to make the normal fields sticky: <span style="color:#000000;font-family:Arial;font-size:12px;">First Name:</span></div> <input type="text" id="fname" name="fname" value="<?php if(isset($_POST['fname'])) echo $_POST['fname'];?>"> The Multi Select Box is sorted by: <option>Month</option> <option value="selected="selected"January">January</option> <option value="selected="selected"February">February</option> I also have a Year field and not sure how to do that. The code picks up the year using a php function <select name=byear> <option value=""> Year </option> <?php $currentYear = date("Y"); for ($i = ($currentYear-15); $i >= ($currentYear-70); $i--) { echo ("<option value='$i'>$i</option>"); } ?> </select> Could anyone help with this one please?
  9. I have figured out how to make a form sticky but couldn't make a list box sticky. Could anyone help Code below Thanks <tr> <td bgcolor="#F1F9FB" class=normalboldtext><font size="2" face="Arial, Helvetica, sans-serif"> Title:<font color=red>*</font></font> </td> <td> <font size="2" face="Arial, Helvetica, sans-serif"> <select name=title> <option value=""> </option> <option value="Mr.">Mr. </option> <option value="Mrs.">Mrs. </option> <option value="Miss.">Miss. </option> <option value="Ms.">Ms. </option> </select> </font></td> </tr>
  10. I've sort of got the hang of it. Iv'e figured out the JavaScript and also the form knows the user is not logged in (I think) it takes me to the login page when I try and access the page. I just can't seem to put the data in the database. Every time I try everything just disapears off the page including the form. The table name is job_seekers_info and the two columns are job_category and skills. I have added the page and would be grateful of any help. <?php require_once "../conn.php"; include_once "accesscontrol.php"; $uname = $_SESSION[uname]; ?> <script type="text/javascript" src="jquery-1.7.2.min.js"></script> <script type="text/javascript"> function Validateskillsfrm(theForm) { var regexp; if (theForm.JobCategory.selectedIndex < 0) { alert("You must select a \"Job Category\""); theForm.JobCategory.focus(); return false; } if (theForm.JobSkills.selectedIndex < 0) { alert("You must select at least 1 \"Skill\""); theForm.JobSkills.focus(); return false; } return true; } </script> <script type="text/javascript" src="wwb9.min.js"></script> <script type="text/javascript"> $(document).ready(function() { LoadValue('JobCategory', 'session', 2); LoadValue('JobSkills', 'session', 2); $("#skillsfrm").submit(function(event) { StoreValue('JobCategory', 'session', 2); StoreValue('JobSkills', 'session', 2); return true; }); }); </script> <script type="text/javascript"> function fillSecondCombo() { var combo1 = document.getElementById('JobCategory'); var combo2 = document.getElementById('JobSkills'); var selected = combo1.options[combo1.options.selectedIndex].value; if (selected == "Agriculture") { combo2.options.length = 3; combo2.options[0] = new Option("Agricultural Engineer", "Agricultural Engineer"); combo2.options[1] = new Option("Animal Care", "Animal Care"); combo2.options[2] = new Option("Dairy Worker", "Dairy Worker"); combo2.options[3] = new Option("Farm Worker", "Farm Worker"); combo2.options[4] = new Option("Harvesting Equipment Driver", "Harvesting Equipment Driver"); combo2.options[5] = new Option("Tractor Driver", "Tractor Driver"); combo2.options[6] = new Option("Zoo and Safari Park Worker", "Zoo and Safari Park Worker"); combo2.options[7] = new Option("Other (As Per CV)", "Other (As Per CV)"); } else if (selected == "Catering and Hotel Work") { combo2.options.length = 3; combo2.options[0] = new Option("Baker", "Baker"); combo2.options[1] = new Option("Bar Worker", "Bar Worker"); combo2.options[2] = new Option("Barista", "Barista"); combo2.options[3] = new Option("Butcher", "Butcher"); combo2.options[4] = new Option("Chef / Cook", "Chef / Cook"); combo2.options[5] = new Option("Catering Manager", "Catering Manager"); combo2.options[6] = new Option("Housekeeping", "Housekeeping"); combo2.options[7] = new Option("Hotel Management", "Hotel Management"); combo2.options[8] = new Option("Hotel Front of House", "Hotel Front of House"); combo2.options[9] = new Option("Hotel Portering", "Hotel Portering"); combo2.options[10] = new Option("Licensed Premises Manager", "Licensed Premises Manager"); combo2.options[11] = new Option("Restaurant Manager", "Restaurant Manager"); combo2.options[12] = new Option("Waiting at Tables", "Waiting at Tables"); combo2.options[13] = new Option("Other (As Per CV)", "Other (As Per CV)"); } } </script> </head> <body> <div id="container"> <div id="wb_Home_Page_Text" style="position:absolute;left:390px;top:1173px;width:108px;height:16px;z-index:9;text-align:left;"> <span style="color:#000000;font-family:Arial;font-size:13px;"><a href="./../index.php" class="style1">Home Page</a></span></div> <div id="wb_home" style="position:absolute;left:393px;top:1114px;width:57px;height:57px;z-index:10;"> <a href="./skills.php"><img src="images/home.png" id="home" alt="return to home page button" style="width:57px;height:57px;"></a></div> <div id="wb_skillsfrm" style="position:absolute;left:67px;top:10px;width:386px;height:402px;z-index:11;"> <form name="skillsfrm" method="post" action="<?php echo basename(__FILE__);?>" enctype="multipart/form-data" accept-charset="UTF-8" id="skillsfrm" onsubmit="return Validateskillsfrm(this)"> <select name="Job_Category" size="1" id="JobCategory" onchange="fillSecondCombo();return false;" style="position:absolute;left:141px;top:89px;width:111px;height:25px;z-index:0;" tabindex="5" title="Job Category:"> <option selected value="0">Please select an option</option> <option value="Agriculture">Agriculture</option> <option value="Catering and Hotel Work">Catering and Hotel Work</option> <option value="Cleaning and Environmental">Cleaning and Environmental</option> <option value="Education and Training">Education and Training</option> <option value="Engineering">Engineering</option> <option value="Finance and Legal">Finance and Legal</option> <option value="Horticulture">Horticulture</option> <option value="Information Technology">Information Technology</option> <option value="Leisure Industry">Leisure Industry</option> <option value="Manufacturing">Manufacturing</option> <option value="Medical">Medical</option> <option value="Office and Commercial">Office and Commercial</option> <option value="Plant and Construction">Plant and Construction</option> <option value="Sales and Retail">Sales and Retail</option> <option value="Security">Security</option> <option value="Transport and Motor Trade">Transport and Motor Trade</option> <option value="Warehouse and Logistics">Warehouse and Logistics</option> <option value="Veterinary Services">Veterinary Services</option> </select> <div id="wb_Text7" style="position:absolute;left:10px;top:91px;width:128px;height:16px;z-index:1;text-align:left;"> <span style="color:#0000CD;font-family:Arial;font-size:13px;"><strong>Main Job Category:</strong></span></div> <div id="wb_Text8" style="position:absolute;left:1px;top:120px;width:146px;height:64px;z-index:2;text-align:left;"> <span style="color:#0000CD;font-family:Arial;font-size:13px;"><strong> Main Job Skills:</strong></span><span style="color:#000000;font-family:Arial;font-size:13px;"><br><br></span><span style="color:#FF0000;font-family:Arial;font-size:13px;"><strong>Auto Populates from "Main Job Category"</strong></span></div> <input type="submit" id="Button1" name="submit" value="Update" style="position:absolute;left:142px;top:299px;width:96px;height:25px;z-index:3;"> <input type="reset" id="Button2" name="reset" value="Reset" style="position:absolute;left:143px;top:337px;width:96px;height:25px;z-index:4;"> <div id="wb_Text11" style="position:absolute;left:0px;top:195px;width:134px;height:60px;text-align:center;z-index:5;"> <span style="color:#000000;font-family:Arial;font-size:12px;">You can select more than one job skill by holding down the CTRL key on your keyboard</span></div> <select name="Job_Skills[]" multiple size="1" id="JobSkills" style="position:absolute;left:142px;top:121px;width:226px;height:163px;z-index:6;" tabindex="6" title="Job Skills:"> </select> <div id="wb_Text1" style="position:absolute;left:64px;top:25px;width:279px;height:32px;text-align:center;z-index:8;"> <span style="color:#000000;font-family:Arial;font-size:13px;"><strong>Please use this form to add or update your "Job Category" and "Skills"</strong></span></div> </form> </div> </div> </body> </html>
  11. Ye I knew the arrays should be in js. I will get the pages done and make sure they work
  12. Thanks Jon. I may need a bit of guidance with this. To start I was thinking of creating a duplicate of the registration form and putting it in a test folder together with the form processor which in this case is jobseeker_registration2.php. I can then remove the relevant industry section from the form and rename the welcome message to read something along the lines of "Thank you for registering on the site. You will shortly receive a welcome email, contained within this email will be a verification link. You must verify your account by clicking on the link to fully register. Once your account is registered please login, you will then be able to select your industry and skills. and also upload your C.V." That's my thinking so far. I don't want to alter the original signup form or the form processor until I have the new ones right just in case I screw something up. Am I thinking along the right lines by creating all the new form in a test folder and making sure they work first.
  13. I have a registration form on my job-site that I would like to change slightly. Part of the form consists of "Job Category" and "Skills" the skills area is dynamically populated from an item that a user selects from the "Job Category". When they register on the site they are sent a registration email. Contained within the email is a verification link. The user verifies their account and are then able to login. When they login they are then taken to the login screen with the welcome message Dear John welcome back to the site. All pretty normal stuff really, however I have discovered that some job seekers have skills in more than one "Job Category" so what i was wanting to do was the following: Take off the "Job Category and Skills" from the registration form and create new forms with just these two elements and also give the user the option to add a further Job Category or not. In order to do this when a user first logs in after verifying their account is it possible to direct them to the Job Category and Skills page so they can make their selection and is there a way of checking that if they don't but log in again the site knows that this function has not been completed and keep sending them to the Job Category and Skills page every time they log in until they have completed this task. once this has been completed and the user logs in again it will just take them to the welcome page as normal. Sorry if this is a bit long winded but It was the best way I could explain it. A simple Yes this can be done or No it cant would suffice. If this can't be done I have another idea by simply leaving the form as is and adding a link to the menu when the user is logged in that takes them to the new form and allows then to add Job categories and Skills. Any help appreciated Thanks
  14. Not to sure what iv'e done wrong here. If a user tries to upload an invalid file I wanted the site to echo "File format invalid. Valid formats are .pdf, .wks." ect but the site is allowing file uploads of all types but then when I try and access the file I get "Invalid file format" The Function code is: $Query = "SELECT OCTET_LENGTH(attachment) as Size, attachment, attachment_type as ContentType FROM job_seeker_info where uname = '$uname'"; $Result = mysql_query ($Query) or die (mysql_error()); $Row = mysql_fetch_array($Result); $fileType = $Row['ContentType']; if ($fileType == "application/msword") { $filename="TRSBClientResume.doc"; } else if ($fileType == "application/rtf") { $filename="TRSBClientResume.rtf"; } else if ($fileType == "application/pdf") { $filename="TRSBClientResume.pdf"; } else if ($fileType == "application/vnd.openxmlformats-officedocument.wordprocessingml.document") { $filename="TRSBClientResume.docx"; } else if ($fileType == "text/plain") { $filename="TRSBClientResume.txt"; } else { echo "Your CV is in an invalid format $fileType"; } $FileName = $filename; if (isset($Row["Size"]) && $Row["Size"] > 0) { $message .= "--PHP-mixed-$RandomHash\r\n"; $message .= "Content-Type: " . $Row["ContentType"] . "; name=\"$FileName\"\r\n"; $message .= 'Content-Length: ' . $Row["Size"] . "\r\n"; $message .= "Content-Transfer-Encoding: base64\r\n"; $message .= "Content-Disposition: attachment\r\n\r\n"; $message .= chunk_split(base64_encode($Row["attachment"])) . "\r\n"; } The Form code is: <?php require_once "../conn.php"; include_once "accesscontrol.php"; $uname = $_SESSION[uname]; $qs = "select rTitle from job_seeker_info where uname = \"$uname\" "; //echo "$qs"; $rs = mysql_query($qs) or die(mysql_error()); $as = mysql_fetch_array($rs); if(!empty($as[0])) { echo "<br><br><center> <font size=2 face=Arial, Helvetica, sans-serif>You have already uploaded your C.V.<br>If you want to edit it, click <a href=edit_resume.php>here </a></center>"; } else { ?> <SCRIPT LANGUAGE="JavaScript"> <!-- function checkFields() { missinginfo = ""; if (document.form.rTitle.value == "") { missinginfo += "\n - Resume titie"; document.form.rTitle.focus(); } if (missinginfo != "") { missinginfo ="Choose a title for your resume."; alert(missinginfo); return false; } else return true; } --> </script> <table width="426" height="21" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><img src="../images/career_seeker.gif" width="233" height="42"></td> </tr> <tr> <td><br> <img src="../images/horz.jpg" width="420" height="1"> </td> </tr> <tr> <td width="426"><p> </p> <p><font class="smalltext">Upload your C.V. now. Choose your title and write a short introduction about yourself.</font> </p> <p><img src="../images/horz.jpg" width="420" height="1"> <form action="resume.php" method=post name=form enctype="multipart/form-data" onSubmit="return checkFields();"> <p><font class="smalltext"><b>Title </b> <font size="1">(choose a title for your resume, 2 - 3 words)</font><br> <input type=text name=rTitle size=35> </font></p> <p><font class="smalltext"> Introduce yourself to the employers <font size="1">(a short paragraph about you)</font> </font><br> <textarea cols=40 rows=4 name=rPar></textarea> <br><br> <font class="smalltext">Upload File <br> <input type="file" name="BannerFile" />(Ex.word,pdf.ect)</font> <br><br> <input type=submit value="Submit Resume" name=postsearch> </p> </form></p> </td> </tr> </table> <p> </p> <? } ?> <? include_once('../footer.php'); ?> And the Form Processor code is: <?php require_once "../conn.php"; include_once "accesscontrol.php"; include_once "../functions.php"; $uname = $_SESSION[uname]; /* DaveS: The crap below tries to upload to a file on the server, and reference it from the db. Don't do that - it's better off stored in the DB for backup reasons. */ if($_FILES[BannerFile]['size'] > 0) { $fileName = $_FILES[BannerFile]['name']; $tmpName = $_FILES[BannerFile]['tmp_name']; $fileSize = $_FILES[BannerFile]['size']; $fileType = $_FILES[BannerFile]['type']; $rTitle = PagePost("rTitle"); $rPar = PagePost("rPar"); $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } $query = "UPDATE job_seeker_info SET attachment = '$content', attachment_type = '$fileType', attachment_size = '$fileSize', rTitle='$rTitle', rPar='$rPar' where uname = \"$uname\"; "; mysql_query($query) or die(mysql_error()); $qs = "select attachment_size from job_seeker_info where uname = \"$uname\" "; //echo "$qs"; $rs = mysql_query($qs) or die(mysql_error()); $as = mysql_fetch_array($rs); if(!empty($as[0])) { echo "<br><br><center> <font size=2 face=verdana, Helvetica, sans-serif>You CV Uploaded Successfully.<br>If you want to edit it, click <a href=edit_resume.php>here </a></center>"; } else { echo "Error uploading CV"; } } /* old code.... */ include_once('../footer.php');
×
×
  • Create New...