Jump to content

jamesxg1

Members
  • Posts

    1,133
  • Joined

  • Last visited

Everything posted by jamesxg1

  1. Maybe try, $conjugations = array(); $conjugations[] = array("hablar", "hablo", "hablas", "habla", "hablamos", "habláis", "hablan"); $conjugations[] = array("estudiar", "estudio", "estudias", "estudia", "estudiamos", "estudiáis", "estudian"); $conjugations[] = array("cantar", "canto", "cantas", "canta", "cantamos", "cantáis", "cantan"); $conjugations[] = array("nadar", "nado", "nadas", "nada", "nadamos", "nadáis", "nadan"); $conjugations[] = array("tocar", "toco", "tocas", "toca", "tocamos", "tocáis", "tocan"); $conjugations[] = array("dibujar", "dibujo", "dibujas", "dibuja", "dibujamos", "dibujáis", "dibujan"); print_r($conjugations); It echo's Array ( [0] => Array ( [0] => hablar [1] => hablo [2] => hablas [3] => habla [4] => hablamos [5] => habláis [6] => hablan ) [1] => Array ( [0] => estudiar [1] => estudio [2] => estudias [3] => estudia [4] => estudiamos [5] => estudiáis [6] => estudian ) [2] => Array ( [0] => cantar [1] => canto [2] => cantas [3] => canta [4] => cantamos [5] => cantáis [6] => cantan ) [3] => Array ( [0] => nadar [1] => nado [2] => nadas [3] => nada [4] => nadamos [5] => nadáis [6] => nadan ) [4] => Array ( [0] => tocar [1] => toco [2] => tocas [3] => toca [4] => tocamos [5] => tocáis [6] => tocan ) [5] => Array ( [0] => dibujar [1] => dibujo [2] => dibujas [3] => dibuja [4] => dibujamos [5] => dibujáis [6] => dibujan ) ) James.
  2. Hiya peeps! I have this. It's extremely large, and will be diffrent everytime but this is the usual size of what the script will be handling. (See uploaded script, text too large, plus I had to delete some of the array as the file was too large). I was wondering how I would make this all one array and not loads. Many thanks James. [attachment deleted by admin]
  3. Given that you are using the non-standard alternative language constructs that make it more difficult to identify the start and end of code blocks, using proper indentation is more important. It's no wonder you need help with your logic, you cannot read it and no one else can either. Agreed.
  4. :S I have to go through every page and indent my code? WOW! I would prefer to have it hard to read LOL! I have well over 100 pages on this project LOL! Many thanks James.
  5. OK, I didn't know that I will change this, I know but I like to play on the safe side LOL! Ah this is a problem I cannot control as my IDE does not indent the code, but I fully agree with you on this. Many thanks James.
  6. Hiya! I dont understand this, when I submit the for and I leave the username and password field empty I get the correct error. But when I fill the fields in, I just get a blank screen. <?php session_start(); include 'system/core/template.php'; $template = new template(); if(isset($_SESSION['username']) && isset($_SESSION['id']) && isset($_SESSION['status'])): header('Location: myaccount.php'); endif; if(isset($_GET['i'])): if($_GET['i'] == 1): $get = 'Your account has been built but is currently suspended until an Admin approves you.'; elseif ($_GET['i'] == 2): $get = 'Thank you for registering, you may now login and apply for jobs. We hope you enjoy the services we are offering you.'; endif; endif; if(isset($_POST['submit']) && isset($_POST['username']) && isset($_POST['password'])): if(!empty($_POST['username']) && !empty($_POST['password'])): $username = mysql_real_escape_string(trim(addslashes($_POST['username']))); $password = mysql_real_escape_string(trim(addslashes(base64_encode(md5(sha1(md5(mhash(MHASH_CRC32, '823ehshfw87sajkahsDD' . $_POST['password'] . '823ehsp2192u')))))))); $usernamecheck = "SELECT `username` FROM `members` WHERE `username` = '$username' LIMIT 1"; $runucheck = mysql_query($usernamecheck); if(!$runucheck): $text = 'Failed to complete your requested action to login, please contact support or try again.'; else: if(mysql_num_rows($runucheck) != 1): $text = 'Incorrect Username, please try again.'; else: $passwordcheck = "SELECT `password` FROM `members` WHERE `username` = '$username' AND `password` = '$password' LIMIT 1"; $runpcheck = mysql_query($passwordcheck); if(!$runpcheck): $text = 'Failed to complete your requested action to login, please contact support or try again.'; else: if(mysql_num_rows($runpcheck) != 1): $text = 'Incorrect Password, please try again.'; else: $getdetails = "SELECT * FROM `members` WHERE `username` = '$username' AND `password` = '$password' LIMIT 1"; $rungd = mysql_query($getdetails); if(!$rungd): $text = 'Failed to complete your requested action to login, please contact support or try again.'; else: while($details = mysql_fetch_assoc($rungd)): $banned = $details['banned']; $id = $details['id']; $username = $details['username']; $status = $details['status']; $permission = $details['permission']; endwhile; if($banned == 0): $_SESSION['id'] = $id; $_SESSION['username'] = $username; $_SESSION['status'] = $status; elseif($banned == 1): $text = 'Your account seems to be suspended, please contact support.'; endif; if($permission == 1): $_SESSION['permission'] = 1; header('Location: admin/index.php'); elseif ($permission == 0): header('Location: myaccount.php'); endif; endif; endif; endif; endif; endif; else: $text = 'Username or Password empty!'; endif; endif; $parts = array('TITLE' => 'Login', 'CONTAINERTWOTITLE' => '', 'CONTAINERTWOCONTENT' => '', 'CONTAINERTHREETITLE' => '', 'CONTAINERTHREECONTENT' => '', 'CONTAINERONETITLE' => 'Login', 'CONTAINERONECONTENT' => '<form id="loginn" name="loginn" action="" method="post"> <center> <br /> <p><font color="red">' . $text . ' ' . $get . '</font></p> <p>Username</p> <p><input type="text" id="username" name="username" /></p> <p>Password</p> <p><input type="password" id="password" name="password" /></p> <p><input type="submit" class="button" id="submit" name="submit" value="Login" /></p> </center> </form>'); $template->load($parts); ?> Many thanks James.
  7. Spot on, cheers mate. Many thanks James.
  8. Hiya peeps, Here's my search code. function getcid($cid) { $cid = mysql_real_escape_string(trim(addslashes($cid))); $cmp = "SELECT `companyid` FROM `uploadedcompanylogos` WHERE `username` = '$cid'"; $rcmp = mysql_query($cmp); if($rcmp): while($c = mysql_fetch_assoc($rcmp)): return $c['companyid']; endwhile; endif; } if(!isset($_REQUEST['key']) OR empty($_REQUEST['key'])): echo 'No search criteria entered.'; exit; endif; if(isset($_POST['key'])): $key = mysql_real_escape_string(trim(addslashes($_POST['key']))); elseif (isset($_GET['key'])): $key = mysql_real_escape_string(trim(addslashes($_GET['key']))); endif; echo '<table id="theTable" cellpadding="0" cellspacing="0" class="sortable-onload-3 no-arrow rowstyle-alt colstyle-alt paginate-10 max-pages-7 paginationcallback-callbackTest-calculateTotalRating paginationcallback-callbackTest-displayTextInfo sortcompletecallback-callbackTest-calculateTotalRating">'; echo '<tfoot>'; echo '<tr>'; echo '<td colspan="6">This information is propery of Shawaghir and should remain only on this site.</td>'; echo '</tr>'; echo '</tfoot>'; echo '<thead>'; echo '<tr>'; echo '<th class="date" scope="col">Company</th> <th scope="col">Location</th> <th scope="col">Title</th> <th scope="col">Description</th> <th scope="col">Type</th> <th scope="col">Salary</th>'; echo '</tr>'; echo '</thead>'; echo '<tbody>'; $cud = "SELECT * FROM `jobs` WHERE `approval` = '0' AND `delete` = '0' AND `id` LIKE '%$key%' OR `company` LIKE '%$key%' OR `location` LIKE '%$key%' OR `industry` LIKE '%$key%' OR `jobtype` LIKE '%$key%' OR `experience` LIKE '%$key%' OR `education` LIKE '%$key%' OR `careerlevel` LIKE '%$key%' OR `salary` LIKE '%$key%' OR `description` LIKE '%$key%' OR `title` LIKE '%$key%' OR `employername` LIKE '%$key%' OR `employerphone` LIKE '%$key%'"; $displaycu = mysql_query($cud); if($displaycu): if(mysql_num_rows($displaycu) == 0): echo '<tr class="alt">'; echo '<td>No Records</td>'; echo '<td class="sized1">No Records</td>'; echo '<td class="sized2"><i>No Records</i></td>'; echo '<td class="sized3">No Records</td>'; echo '<td class="sized3">No Records</td>'; echo '<td class="sized3">No Records</td>'; echo '</tr>'; else: while($cu = mysql_fetch_assoc($displaycu)): echo '<tr class="alt">'; echo '<td class="sized1"><a href="companyprofile.php?companyid=' . getcid($cu['username']) . '">' . $cu['company'] . '</a></td>'; echo '<td class="sized1">' . $cu['id'] . '</td>'; echo '<td class="sized2"><a href="job.php?jobid=' . $cu['id'] . '">' . truncate($cu['title'], '15') . '</a></td>'; echo '<td class="sized3">' . truncate($cu['description'], '15') . '</td>'; echo '<td class="sized3">' . $cu['jobtype'] . '</td>'; echo '<td class="sized3">£' . $cu['salary'] . '</td></tr>'; endwhile; endif; else: echo '<tr class="alt">'; echo '<td>ERROR</td>'; echo '<td class="sized1">ERROR</td>'; echo '<td class="sized2"><i>ERROR</i></td>'; echo '<td class="sized3">ERROR</td>'; echo '<td class="sized3">ERROR</td>'; echo '</tr>'; endif; echo '</tbody>'; echo '</table>'; I have made the script search various fields but its not completing the `delete` and `approval` part of the query. Anyone have any ideas why ? Many thanks James.
  9. B to the U to the M to the P.
  10. Hiya! I have this code. $newID = "SELECT `id` FROM `jobs` ORDER BY `id` DESC"; $getID = mysql_query($newID); if($getID): while($nid = mysql_fetch_assoc($getID)): $id = $nid['id']; endwhile; if($id == 0): $id = 1; endif; else: return 'Failed to complete your request to open a new job, please contact support.'; endif; But its returning 1 everytime, even when the MySQL database has ID's like (1,2,3,4,5,6) ect. It should be adding +1 on the highest ID. Many thanks James
  11. Ok, runactions.php <?php session_start(); include 'mysql.php'; $mysql = new mysql(); $mysql->connect(); include 'actions.php'; $action = new actions(); $action->approvalValues(); switch($_GET['cmd']): case viewjobs: echo $action->listJobs(); break; case delete: echo '<center>' . $action->deleteJob($_GET['id']) . '</center>'; break; case addJob: echo $action->newJob($_POST['company'], $_POST['location'], $_POST['industry'], $_POST['jobtype'], $_POST['experience'], $_POST['education'], $_POST['careerlevel'], $_POST['salary'], $_POST['description'], $_POST['title'], $_POST['empname'], $_POST['empphone']); break; case editJob: echo $action->editJob($_POST['jid'], $_POST['company'], $_POST['location'], $_POST['industry'], $_POST['jobtype'], $_POST['experience'], $_POST['education'], $_POST['careerlevel'], $_POST['salary'], $_POST['description'], $_POST['title'], $_POST['empname'], $_POST['empphone']); break; endswitch; ?> actions.php <?php session_start(); class actions { private $jobID; private $company; private $location; private $industry; private $jobtype; private $experience; private $education; private $careerlevel; private $salary; private $description; private $title; private $empname; private $empphone; function approvalValues() { $approval = "SELECT * FROM `settings`"; $runapproval = mysql_query($approval); if($runapproval): while($app = mysql_fetch_assoc($runapproval)): $this->editapproval = $app['approvaledit']; $this->addapproval = $app['approvaladd']; $this->deleteapproval = $app['approvaldelete']; endwhile; else: echo 'Failed to complete your requested action, please contact support!'; exit; endif; } function truncate($string, $length) { settype($string, 'string'); settype($length, 'integer'); for($a = 0; $a < $length AND $a < strlen($string); $a++): $output .= $string[$a]; endfor; return($output); } function listJobs() { $sid = mysql_real_escape_string(trim(addslashes($_SESSION['id']))); $susername = mysql_real_escape_string(trim(addslashes($_SESSION['username']))); echo '<script> $("span#edit").hide(); $("span#add").hide(); $("a#delete").click(function() { var delid = $(this).attr("class"); $("span#feedback").empty().load("./system/core/runactions.php?cmd=delete&id=" + delid); }); $("a#edit").click(function() { var eid = $(this).attr("class"); $("span#edit").slideDown("slow").show(); $("input#jid").attr("value", eid); $("span#add").hide(); }); $("form#editjob").submit(function() { var company = $("input#company").val(); var location = $("input#location").val(); var industry = $("input#industry").val(); var jobtype = $("select#jobtype").val(); var experience = $("input#experience").val(); var education = $("input#education").val(); var careerlevel = $("input#careerlevel").val(); var salary = $("input#salary").val(); var title = $("input#title").val(); var description = $("textarea#description").val(); var empname = $("input#empname").val(); var empphone = $("input#empphone").val(); var jid = $("input#jid").val(); $.post("./system/core/runactions.php?cmd=editJob", { company: company, location: location, industry: industry, jobtype: jobtype, experience: experience, education: education, careerlevel: careerlevel, salary: salary, title: title, description: description, empname: empname, emphone: emphone, jid: jid }, function(data) { var datas = data; $("span#feedback").html(datas); }); return false; }); $("form#addjob").submit(function(){ var company = $("input#acompany").val(); var location = $("input#alocation").val(); var industry = $("input#aindustry").val(); var jobtype = $("select#ajobtype").val(); var experience = $("input#aexperience").val(); var education = $("input#aeducation").val(); var careerlevel = $("input#acareerlevel").val(); var salary = $("input#asalary").val(); var title = $("input#atitle").val(); var description = $("textarea#adescription").val(); var empname = $("input#aempname").val(); var empphone = $("input#aempphone").val(); $.post("./system/core/runactions.php?cmd=addJob", { company: company, location: location, industry: industry, jobtype: jobtype, experience: experience, education: education, careerlevel: careerlevel, salary: salary, title: title, description: description, empname: empname, emphone: emphone }, function(data) { alert(data); }); return false; }); $("input#addjob").click(function() { $("span#add").show(); $("span#edit").hide(); }); </script> <span id="feedback"></span><p align="right"><input type="submit" id="addjob" class="button" value="New Job"><table cellpadding="0" cellspacing="0" border="0" class="Box-table" > <thead> <tr> <th class="date" scope="col">Title</th> <th scope="col">Description</th> <th scope="col">Location</th> <th scope="col">Type</th> <th scope="col">Salary</th> <th scope="col">Controls</th> </tr> </thead> <tbody>'; $sql = "SELECT * FROM `jobs` WHERE `oid` = '$sid' AND `username` = '$susername'"; $run = mysql_query($sql); if($run): if(mysql_num_rows($run) > 0): while($job = mysql_fetch_assoc($run)): $id = $job['id']; $title = $job['title']; $description = $job['description']; $location = $job['location']; $type = $job['jobtype']; $salary = $job['salary']; $jobid = $job['id']; $delete = $job['delete']; $taken = $job['taken']; endwhile; echo '<tr class="odd"> <td class="date">' . $this->truncate($title, '20') . '</td> <td>' . $this->truncate($description, '15') . '</td> <td>' . $this->truncate($location, '15') . '</td> <td>' . $type . '</td> <td>£' . $salary . '</td>'; if($delete == 1): echo '<td>DELETED</td>'; elseif ($taken == 1): echo '<td>TAKEN</TD>'; else: echo '<td><a href="#" id="delete" class="' . $id . '"><img src="assets/images/delete.jpg" width="15" height="15"></a><a href="#" id="edit" class="' . $id . '"><img src="assets/images/edit.png" width="15" height="15"></a></td>'; endif; echo '</tr> </tbody> </table> <style> .feedbackform{ padding: 5px; } div.fieldwrapper{ width: 550px; /*width of form rows*/ overflow: hidden; padding: 5px 0; } div.fieldwrapper label.styled{ /* label elements that should be styled (left column within fieldwrapper DIV) */ float: left; width: 150px; /*width of label (left column)*/ text-transform: capitalized; border-bottom: 1px solid blue; margin-right: 15px; /*spacing with right column*/ } div.fieldwrapper div.thefield{ /* DIV that wraps around the actual form fields (right column within fieldwrapper DIV) */ float: left; margin-bottom: 10px; /* space following the field */ } div.fieldwrapper div.thefield input[type="text"]{ /* style for INPUT type="text" fields. Has no effect in IE7 or below! */ width: 250px; } div.fieldwrapper div.thefield input[type="password"]{ /* style for INPUT type="text" fields. Has no effect in IE7 or below! */ width: 250px; } div.fieldwrapper div.thefield textarea{ /* style for TEXTAREA fields. */ width: 300px; height: 150px; } </style> <span id="add"> <form id="addjob" action="#" method="post" class="feedbackform"> <hr></hr> <div class="fieldwrapper"> <label for="company" class="styled">Company:</label> <div class="thefield"> <input id="acompany" name="company" type="text" maxlength="255" value=""/> </div> </div> <div class="fieldwrapper"> <label for="Location" class="styled">Location:</label> <div class="thefield"> <input id="alocation" name="location" type="text" maxlength="255" value=""/> </div> </div> <div class="fieldwrapper"> <label for="industry" class="styled">Industry:</label> <div class="thefield"> <input id="aindustry" name="industry" type="text" maxlength="255" value=""/> </div> </div> <div class="fieldwrapper"> <label for="jobtype" class="styled">Job Type:</label> <div class="thefield"> <select id="ajobtype" name="jobtype"> <option value="Full Time">Full Time</option> <option value="Part Time">Part Time</option> </select> </div> </div> <div class="fieldwrapper"> <label for="experience" class="styled">Experience:</label> <div class="thefield"> <input id="aexperience" name="experience" type="text" maxlength="255" value=""/> </div> </div> <div class="fieldwrapper"> <label for="education" class="styled">Education:</label> <div class="thefield"> <input id="aeducation" name="education" type="text" maxlength="255" value=""/> </div> </div> <div class="fieldwrapper"> <label for="careerlevel" class="styled">Career Level:</label> <div class="thefield"> <input id="acareerlevel" name="careerlevel" type="text" maxlength="255" value=""/> </div> </div> <div class="fieldwrapper"> <label for="salary" class="styled">Salary:</label> <div class="thefield"> <input id="asalary" name="salary" type="text" maxlength="255" value=""/> </div> </div> <div class="fieldwrapper"> <label for="title" class="styled">Title:</label> <div class="thefield"> <input id="atitle" name="title" type="text" maxlength="255" value=""/> </div> </div> <div class="fieldwrapper"> <label for="description" class="styled">Description:</label> <div class="thefield"> <textarea id="adescription" name="description"></textarea> </div> </div> <div class="fieldwrapper"> <label for="empname" class="styled">Employer Name:</label> <div class="thefield"> <input id="aempname" name="empname" type="text" maxlength="255" value=""/> </div> </div> <div class="fieldwrapper"> <label for="empphone" class="styled">Employer Phone:</label> <div class="thefield"> <input id="aempphone" name="empphone" type="text" maxlength="255" value=""/> </div> </div> <input type="submit" id="asubmit" name="submit" value="Submit" class="button"> </form> </span> <span id="edit"> <form id="editjob" action="#" method="post" class="feedbackform"> <hr></hr> <div class="fieldwrapper"> <label for="company" class="styled">Company:</label> <div class="thefield"> <input id="company" name="company" type="text" maxlength="255" value=""/> </div> </div> <div class="fieldwrapper"> <label for="Location" class="styled">Location:</label> <div class="thefield"> <input id="location" name="location" type="text" maxlength="255" value=""/> </div> </div> <div class="fieldwrapper"> <label for="industry" class="styled">Industry:</label> <div class="thefield"> <input id="industry" name="industry" type="text" maxlength="255" value=""/> </div> </div> <div class="fieldwrapper"> <label for="jobtype" class="styled">Job Type:</label> <div class="thefield"> <select id="jobtype" name="jobtype"> <option value="Full Time">Full Time</option> <option value="Part Time">Part Time</option> </select> </div> </div> <div class="fieldwrapper"> <label for="experience" class="styled">Experience:</label> <div class="thefield"> <input id="experience" name="experience" type="text" maxlength="255" value=""/> </div> </div> <div class="fieldwrapper"> <label for="education" class="styled">Education:</label> <div class="thefield"> <input id="education" name="education" type="text" maxlength="255" value=""/> </div> </div> <div class="fieldwrapper"> <label for="careerlevel" class="styled">Career Level:</label> <div class="thefield"> <input id="careerlevel" name="careerlevel" type="text" maxlength="255" value=""/> </div> </div> <div class="fieldwrapper"> <label for="salary" class="styled">Salary:</label> <div class="thefield"> <input id="salary" name="salary" type="text" maxlength="255" value=""/> </div> </div> <div class="fieldwrapper"> <label for="title" class="styled">Title:</label> <div class="thefield"> <input id="title" name="title" type="text" maxlength="255" value=""/> </div> </div> <div class="fieldwrapper"> <label for="description" class="styled">Description:</label> <div class="thefield"> <textarea id="description" name="description"></textarea> </div> </div> <div class="fieldwrapper"> <label for="empname" class="styled">Employer Name:</label> <div class="thefield"> <input id="empname" name="empname" type="text" maxlength="255" value=""/> </div> </div> <div class="fieldwrapper"> <label for="empphone" class="styled">Employer Phone:</label> <div class="thefield"> <input id="empphone" name="empphone" type="text" maxlength="255" value=""/> </div> </div> <input type="hidden" name="jid" id="jid" value=""> <input type="submit" id="submit" name="submit" value="Submit" class="button"> </form> </span>'; else: echo '<tr class="odd"> <td class="date">No Records Found</td> <td>No Records Found</td> <td>No Records Found</td> <td>No Records Found</td> <td>No Records Found</td> <td>No Records Found</td> </tr> </tbody> </table>'; endif; else: echo '<tr class="odd"> <td class="date">Error</td> <td>Error</td> <td>Error</td> <td>Error</td> <td>Error</td> <td>Error</td> </tr> </tbody> </table>'; endif; } function newJob($company, $location, $industry, $jobtype, $experience, $education, $careerlevel, $salary, $description, $title, $empname, $empphone) { $company = mysql_real_escape_string(trim(addslashes($company))); $loaction = mysql_real_escape_string(trim(addslashes($loaction))); $industrty = mysql_real_escape_string(trim(addslashes($industry))); $jobtype = mysql_real_escape_string(trim(addslashes($jobtype))); $experience = mysql_real_escape_string(trim(addslashes($experience))); $education = mysql_real_escape_string(trim(addslashes($education))); $careerlevel = mysql_real_escape_string(trim(addslashes($careerlevel))); $salary = mysql_real_escape_string(trim(addslashes($salary))); $description = mysql_real_escape_string(trim(addslashes($description))); $title = mysql_real_escape_string(trim(addslashes($title))); $empname = mysql_real_escape_string(trim(addslashes($empname))); $empphone = mysql_real_escape_string(trim(addslashes($empphone))); $sid = mysql_real_escape_string(trim(addslashes($_SESSION['id']))); $susername = mysql_real_escape_string(trim(addslashes($_SESSION['username']))); if(!isset($company) OR !isset($location) OR !isset($industry) OR !isset($jobtype) OR !isset($experience) OR !isset($education) OR !isset($careerlevel) OR !isset($salary) OR !isset($description) OR !isset($title) OR !isset($empphone) OR !isset($empname) OR empty($company) OR empty($loaction) OR empty($industry) OR empty($jobtype) OR empty($experience) OR empty($education) OR empty($careerlevel) OR empty($salary) OR empty($description) OR empty($title) OR empty($empname) OR empty($empphone) OR strlen($company) > 100 OR strlen($loaction) > 150 OR strlen($industry) > 100 OR strlen($jobtype) > 80 OR strlen($experience) > 60 OR strlen($education) > 200 OR strlen($careerlevel) > 100 OR strlen($salary) > 10 OR strlen($description) > 250 OR strlen($title) > 60 OR strlen($empname) > 100 OR strlen($empphone) > 12): return 'Failed. Missing, incorrect or empty inputs detected.'; else: $newID = "SELECT `id` FROM `jobs` ORDER BY `id` DESC LIMIT 1"; $getID = mysql_query($newID); if($getID): while($nid = mysql_fetch_assoc($getID)): $id = $nid['id']; endwhile; if($id == 0): $id = 1; endif; else: return 'Failed to complete your request to open a new job, please contact support.'; endif; if($this->addapproval == 1): $approval = 0; elseif ($this->addapproval == 0): $approval = 1; endif; $addnew = "INSERT INTO `jobs` (`id`, `company`, `location`, `industry`, `jobtype`, `experience`, `education`, `careerlevel`, `salary`, `description`, `title`, `employername`, `employerphone`, `approval`, `taken`, `delete`, `username`, oid`) VALUES('$id', '$company', '$location', '$jobtype', '$experience', '$education', '$careerlevel', '$salary', '$description', '$title, '$empname', '$empphone', '$approval', '0', '0', '$susername', '$sid')"; $runaddnew = mysql_query($addnew); if($runaddnew): return 'Job successfully posted.'; else: return 'Failed to complete you request to open a new job, please contact support or try again.'; endif; endif; } function editJob($jobID, $company, $location, $industry, $jobtype, $experience, $education, $careerlevel, $salary, $description, $title, $empname, $empphone) { $jobID = mysql_real_escape_string(trim(addslashes($jobID))); $company = mysql_real_escape_string(trim(addslashes($company))); $loaction = mysql_real_escape_string(trim(addslashes($loaction))); $industrty = mysql_real_escape_string(trim(addslashes($industry))); $jobtype = mysql_real_escape_string(trim(addslashes($jobtype))); $experience = mysql_real_escape_string(trim(addslashes($experience))); $education = mysql_real_escape_string(trim(addslashes($education))); $careerlevel = mysql_real_escape_string(trim(addslashes($careerlevel))); $salary = mysql_real_escape_string(trim(addslashes($salary))); $description = mysql_real_escape_string(trim(addslashes($description))); $title = mysql_real_escape_string(trim(addslashes($title))); $empname = mysql_real_escape_string(trim(addslashes($empname))); $empphone = mysql_real_escape_string(trim(addslashes($empphone))); if(!isset($jobID) OR !isset($company) OR !isset($location) OR !isset($industry) OR !isset($jobtype) OR !isset($experience) OR !isset($education) OR !isset($careerlevel) OR !isset($salary) OR !isset($description) OR !isset($title) OR !isset($empphone) OR !isset($empname) OR empty($jobID) OR empty($company) OR empty($loaction) OR empty($industry) OR empty($jobtype) OR empty($experience) OR empty($education) OR empty($careerlevel) OR empty($salary) OR empty($description) OR empty($title) OR empty($empname) OR empty($empphone) OR strlen($company) > 100 OR strlen($loaction) > 150 OR strlen($industry) > 100 OR strlen($jobtype) > 80 OR strlen($experience) > 60 OR strlen($education) > 200 OR strlen($careerlevel) > 100 OR strlen($salary) > 10 OR strlen($description) > 250 OR strlen($title) > 60 OR strlen($empname) > 100 OR strlen($empphone) > 12): echo 'Failed. Missing, incorrect or empty inputs detected.'; exit; else: $getapp = "SELECT `approved` FROM `jobs` WHERE `id` = '$jobID' LIMIT 1"; $rungetapp = mysql_query($getapp); if($rungetapp): while($app = mysql_fetch_assoc($rungetapp)): $app = $app['approval']; endwhile; else: echo 'Failed to complete your action to edit/update one of your existing job posts.'; exit; endif; if($app == 1): if($this->editapproval == 1): $approval = 0; elseif ($this->editapproval == 0): $approval = 1; endif; else: $approval = 0; endif; $updatejob = "UPDATE `jobs` SET `company` = '$company', `location` = '$loaction', `industry` = '$industry', `jobtype` = '$jobtype', `experience` = '$experience', `education` = '$education', `careerlevel` = '$careerlevel', `salary` = '$salary', `description` = '$description', `title` = '$title', `employername` = '$empname', `employerphone` = '$empphone', `approval` = '$approval' WHERE `id` = '$jobID'"; $runupdate = mysql_query($updatejob); if($runupdate): echo 'Job successfully updated.'; else: echo 'Failed to complete your action to edit/update one of your existing job posts.'; exit; endif; endif; } function deleteJob($jobID) { $jobID = mysql_real_escape_string(trim(addslashes($jobID))); if(!isset($jobID) OR empty($jobID) OR strlen($jobID) > 11): echo 'Failed. Incorrect job detected.'; exit; else: if($this->deleteapproval == 1): $del = "UPDATE `jobs` SET `delete` = '1' WHERE `id` = '$jobID'"; elseif ($this->deleteapproval == 0): $del = "DELETE FROM `jobs` WHERE `id` = '$jobID' LIMIT 1"; endif; $rundel = mysql_query($del); if($rundel): echo 'Job successfully deleted.'; exit; else: echo 'Failed to complete your request to delete a job post, please contact support or try again.'; exit; endif; endif; } } ?> Many thanks James.
  12. Hiya Peeps! I have this echo'ed in a script. $("form#addjob").submit(function(){ var company = $("input#company").val(); var location = $("input#location").val(); var industry = $("input#industry").val(); var jobtype = $("select#jobtype").val(); var experience = $("input#experience").val(); var education = $("input#education").val(); var careerlevel = $("input#careerlevel").val(); var salary = $("input#salary").val(); var title = $("input#title").val(); var description = $("textarea#description").val(); var empname = $("input#empname").val(); var empphone = $("input#empphone").val(); $.post("./system/core/runactions.php?cmd=addjob", { company: company, location: location, industry: industry, jobtype: jobtype, experience: experience, education: education, careerlevel: careerlevel, salary: salary, title: title, description: description, empname: empname, emphone: emphone }, function(data) { var data = data; $("span#feedback").html(data); }); return false; }); Its not working past var empphone = $("input#empphone").val(); Can anyone see why ? Many thanks James.
  13. Hiya bud, Thanks for the reply mate, the its PHP 5.0 so instead of having this... if(continue) { }else{ } You have... if(continue): else: endif; And nah all it prints ok, but there is no action being made, LOL. Many thanks James. This has nothing to do with php5 and can be used in any version of php as an alternative syntax. Its not common in the business layer but allot of people use this alternate syntax in there view layer. Oh my bad, LOL. Sorry. I like this version better, I think it is more easier to read. Many thanks James.
  14. B to the U to the M to the P .
  15. Hiya bud, Thanks for the reply mate, the its PHP 5.0 so instead of having this... if(continue) { }else{ } You have... if(continue): else: endif; And nah all it prints ok, but there is no action being made, LOL. Many thanks James.
  16. Anyone see any problems with my logic or syntax ? Many thanks James.
  17. Hiya peeps! In my index page I have a search box that submits to search.php, This is the code I am using in search. <?php session_start(); include 'system/core/template.php'; $template = new template(); if(isset($_POST['keyword'])): $js = 'alert(\'LOL\'); var key = "' . $_POST['keyword'] . '"; $.post("system/core/switchboard.php?cmd=search", { key: key }, function(data) { $("span#search").html(data); }); return false; });'; endif; $parts = array('TITLE' => 'Search', 'CONTAINERTWOTITLE' => '', 'CONTAINERTWOCONTENT' => '', 'CONTAINERTHREETITLE' => '', 'CONTAINERTHREECONTENT' => '', 'CONTAINERONETITLE' => 'Search Results.', 'CONTAINERONECONTENT' => '<span id="search"></span>', 'JQUERY' => '' . $js . ' $("form#search").submit(function(){ var key = $("input#keyword").val(); $.post("system/core/switchboard.php?cmd=search", { key: key }, function(data) { $("span#search").html(data); }); return false; });', 'INCLUDES' => '<script language="javascript" type="text/javascript" src="assets/js/paginate.js"></script> <script language="javascript" type="text/javascript" src="assets/js/tablesort.js"></script>', 'IECSS' => 'ul.fdtablePaginater {display:inline-block;} ul.fdtablePaginater {display:inline;} ul.fdtablePaginater li {float:left;} ul.fdtablePaginater {text-align:center;} table { border-bottom:1px solid #C1DAD7; }'); $template->load($parts); ?> The source code is containg all the correct data but, as you can see I have an alert() this is not working nor is the post. I dont understand why. Anyone got any ideas? Many thanks James.
  18. Hiya peeps! Heres the code. foreach($_POST as $key => $val): echo '\$' . $key . ' = mysql_real_escape_string(trim(addslashes(\$_POST[' . $key . '])));<br />'; foreach; Heres whats returned. Parse error: syntax error, unexpected ';', expecting '(' in *** on line 12 I dont understand, I have escaped all vars. Many thanks James.
  19. Hiya! Everytime I input something into my site it gets stored in a database like this. جبل اللونيبدة- شارع ضرار بن الازور رقم 17 Is there anyway I can get this to come out like normal text ? Many thanks James.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.