An7hony
Members-
Posts
79 -
Joined
-
Last visited
Everything posted by An7hony
-
I'm trying to use the js below to check whether lunch is inputted as 0.25, 0.5, 0.75 or 1. Below is the code. It seams to be working as: if ((day_object[dayname].lunch) != "0.25"){ but as if (((((day_object[dayname].lunch) != "0.25") || (day_object[dayname].lunch) != "0.5") || (day_object[dayname].lunch) != "0.75") || (day_object[dayname].lunch) != "1") { it pulls the alert whatever is inputted. else if ((day_object[dayname].start_hhmm != "") && (day_object[dayname].finish_hhmm != "") && (day_object[dayname].lunch != "")) { if (((((day_object[dayname].lunch) != "0.25") || (day_object[dayname].lunch) != "0.5") || (day_object[dayname].lunch) != "0.75") || (day_object[dayname].lunch) != "1") { alert("Check lunch hour 0.25 is 1/4 of an hour. 0.5 is 1/2 an hour. 0.75 is 3/4 of an hour. 1 is 1 hour"); day_object[dayname] = new oDay(day_object[dayname].dayname, day_object[dayname].start_hhmm, day_object[dayname].finish_hhmm, 0); } }
-
thanks, you are right. What a pain..
-
$largedate has: 25/10/2011 $smalldate has: 02/10/2011
-
Can anyone help? the date is pulling through without a value shown in bold below. `Timesheet_start_date` >= '2011-02-10 00:00:00' AND `Timesheet_end_date` <= '1970-01-01 00:00:00' ORDER BY id DESC here is my code: $smalldate = $_POST['small']; $largedate = $_POST['large']; $types[] = (isset($_POST['small']) && strlen(trim($_POST['small'])) > 0) ? "`Timesheet_start_date` >= '".date('Y-m-d',strtotime($smalldate))." 00:00:00'" : ''; $types[] = (isset($_POST['large']) && strlen(trim($_POST['large'])) > 0) ? "`Timesheet_end_date` <= '".date('Y-m-d',strtotime($largedate))." 00:00:00'" : ''; i've echo the $largedate and there is a value in there?
-
i fixed it by putting it all into one function function checkLogin(){ global $database; //The database connection /* Check if user has been remembered */ if(isset($_COOKIE['cookname']) && isset($_COOKIE['cookid'])){ $this->username = $_SESSION['username'] = $_COOKIE['cookname']; $this->userid = $_SESSION['userid'] = $_COOKIE['cookid']; } /* Username and userid have been set and not guest */ if(isset($_SESSION['username']) && isset($_SESSION['userid']) && $_SESSION['username'] != GUEST_NAME){ /* Confirm that username and userid are valid */ if($database->confirmUserID($_SESSION['username'], $_SESSION['userid']) != 0){ /* Variables are incorrect, user not logged in */ // unset($_SESSION['username']); // unset($_SESSION['userid']); return false; } /* User is logged in, set class variables */ $this->userinfo = $database->getUserInfo($_SESSION['username']); $this->username = $this->userinfo['username']; $this->userid = $this->userinfo['userid']; $this->userlevel = $this->userinfo['userlevel']; return true; } /* User not logged in */ else{ if(isset($_COOKIE['cookname']) && isset($_COOKIE['cookid'])){ $this->clientname = $_SESSION['username'] = $_COOKIE['cookname']; $this->clientid = $_SESSION['userid'] = $_COOKIE['cookid']; } /* Username and userid have been set and not guest */ if(isset($_SESSION['username']) && isset($_SESSION['userid']) && $_SESSION['username'] != GUEST_NAME){ /* Confirm that username and userid are valid */ if($database->confirmClientID($_SESSION['username'], $_SESSION['userid']) != 0){ /* Variables are incorrect, user not logged in */ unset($_SESSION['username']); unset($_SESSION['userid']); return false; } /* User is logged in, set class variables */ $this->clientinfo = $database->getUserClient($_SESSION['username']); $this->clientname = $this->clientinfo['username']; $this->clientid = $this->clientinfo['userid']; $this->clientlevel = $this->clientinfo['userlevel']; return true; } /* User not logged in */ else{ return false; } } }
-
function checkLogin(){ global $database; //The database connection /* Check if user has been remembered */ if(isset($_COOKIE['cookname']) && isset($_COOKIE['cookid'])){ $this->username = $_SESSION['username'] = $_COOKIE['cookname']; $this->userid = $_SESSION['userid'] = $_COOKIE['cookid']; } /* Username and userid have been set and not guest */ if(isset($_SESSION['username']) && isset($_SESSION['userid']) && $_SESSION['username'] != GUEST_NAME){ /* Confirm that username and userid are valid */ if($database->confirmUserID($_SESSION['username'], $_SESSION['userid']) != 0){ /* Variables are incorrect, user not logged in */ unset($_SESSION['username']); unset($_SESSION['userid']); return false; } /* User is logged in, set class variables */ $this->userinfo = $database->getUserInfo($_SESSION['username']); $this->username = $this->userinfo['username']; $this->userid = $this->userinfo['userid']; $this->userlevel = $this->userinfo['userlevel']; return true; } /* User not logged in */ else{ return false; } }
-
How can i switch between the 2 lines below in my function. At the moment the bottom line is ignored: /* Determine if user is logged in */ $this->logged_in = $this->checkLogin(); /* Determine if client is logged in */ $this->logged_in_Client = $this->checkLoginClient(); function startSession(){ global $database; //The database connection session_start(); //Tell PHP to start the session /* Determine if user is logged in */ $this->logged_in = $this->checkLogin(); /* Determine if client is logged in */ $this->logged_in_Client = $this->checkLoginClient(); if($this->logged_in){ $database->addActiveUser($this->username, $this->time); } if($this->logged_in_Client){ $database->addActiveClient($this->clientname, $this->time); } /* Set referrer page */ if(isset($_SESSION['url'])){ $this->referrer = $_SESSION['url']; }else{ $this->referrer = "/"; } /* Set current url */ $this->url = $_SESSION['url'] = $_SERVER['REQUEST_URI']; }
-
thank you!! what a stupid mistake, now i feel silly
-
I'm having the strangest thing happing. When posting a form i'm not getting the option value. Instead its posting my text field ie: <option name="1">text</option> <?php $query = "SELECT id, name FROM locations ORDER BY name"; $res = mysql_query($query, $cid); while($a = mysql_fetch_array($res)) { echo "<option name=".$a["id"].">".$a["name"]."</option>"; } ?> <?php The code thats grapping it: if($_POST['location']==""){ $location = ""; echo '<div class="message error">Please enter a <strong>Location</strong></div>'; }else{ $location = $_POST['location']; } ?> Can anyone see why? I have also tried it in html to see if its my php, but i get the same result
-
ok i added: $content2 = file_get_contents($file); i have the attachment although when i open the file it is reading code and symbols?
-
this is similar to what i'm getting instead of the file attachment: This is the body of the message. --frontier Content-Type: application/octet-stream Content-Transfer-Encoding: base64 PGh0bWw+CiAgPGhlYWQ+CiAgPC9oZWFkPgogIDxib2R5PgogICAgPHA+VGhpcyBpcyB0aGUg Ym9keSBvZiB0aGUgbWVzc2FnZS48L3A+CiAgPC9ib2R5Pgo8L2h0bWw+Cg== --frontier-- http://en.wikipedia.org/wiki/MIME
-
ok i am not getting any errors now. This is what i have: function sendNewCandidate($user, $email, $agent, $jobtitle, $useremail, $cv) { $file = $_SERVER['DOCUMENT_ROOT']."/elements/".$cv; $file_size = filesize($file); $handle = fopen($file, "r"); $content = fread($handle, $file_size); fclose($handle); $content = chunk_split(base64_encode($content)); $uid = md5(uniqid(time())); $name = basename($file); $subject = "New applicant"; $header = "From: ".$user." <".$useremail.">\r\n"; $header .= "Reply-To: ".$useremail."\r\n"; $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n"; $header .= "This is a multi-part message in MIME format.\r\n"; $header .= "--".$uid."\r\n"; $header .= "Content-type:text/plain; charset=iso-8859-1\r\n"; $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $header .= $agent.",\n\n" ."".$user." has applied for your job ".$jobtitle."." ."We suggest you go to your admin panel and view the CV" ."- Web Site. "; $header .= "--".$uid."\r\n"; $header .= "Content-Type: application/octet-stream; name=\"".$name."\"\r\n"; // use different content types here $header .= "Content-Transfer-Encoding: base64\r\n"; $header .= "Content-Disposition: attachment; filename=\"".$name."\"\r\n\r\n"; $header .= $content."\r\n\r\n"; $header .= "--".$uid."--"; return mail($email, $subject, "", $header); } }; Although instead of the file being attached to the email i am getting 0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAABAAAAIgAAAAAAAAAA etc etc
-
ah it may be because $cv reads path/filename.doc instead of filename.doc
-
At the moment i am getting: Warning: filesize() [function.filesize]: stat failed for http://www.website.co.uk/elements/$cv in /home/*****/public_html/elements/mailer.php on line 93 Warning: fread() [function.fread]: Length parameter must be greater than 0 in /home/******/public_html/elements/mailer.php on line 95 function sendNewCandidate($user, $email, $agent, $jobtitle, $useremail, $cv) { $file = 'http://www.website.co.uk/elements/$cv'; $file_size = filesize($file); $handle = fopen($file, "r"); $content = fread($handle, $file_size); fclose($handle); $content = chunk_split(base64_encode($content)); $uid = md5(uniqid(time())); $name = basename($file); $subject = "New applicant"; $header = "From: ".$user." <".$useremail.">\r\n"; $header .= "Reply-To: ".$useremail."\r\n"; $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n"; $header .= "This is a multi-part message in MIME format.\r\n"; $header .= "--".$uid."\r\n"; $header .= "Content-type:text/plain; charset=iso-8859-1\r\n"; $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $header .= $agent.",\n\n" ."".$user." has applied for your job ".$jobtitle."." ."We suggest you go to your admin panel and view the CV" ."- Website. "; $header .= "--".$uid."\r\n"; $header .= "Content-Type: application/octet-stream; name=\"".$cv."\"\r\n"; // use different content types here $header .= "Content-Transfer-Encoding: base64\r\n"; $header .= "Content-Disposition: attachment; filename=\"".$cv."\"\r\n\r\n"; $header .= $content."\r\n\r\n"; $header .= "--".$uid."--"; return mail($email, $subject, "", $header); } }; can anyone explain? Thanks
-
i have just read this, so i'm going to try it out: $my_file = "somefile.zip"; $my_path = $_SERVER['DOCUMENT_ROOT']."/your_path_here/"; $my_name = "Olaf Lederer"; $my_mail = "my@mail.com"; $my_replyto = "my_reply_to@mail.net"; $my_subject = "This is a mail with attachment."; $my_message = "Hallo,\r\ndo you like this script? I hope it will help.\r\n\r\ngr. Olaf"; mail_attachment($my_file, $my_path, "recipient@mail.org", $my_mail, $my_name, $my_replyto, $my_subject, $my_message);
-
Hi I need to attach a file to an email from my database records So far i have: function sendNewCandidate($user, $email, $agent, $jobtitle, $useremail, $cv) { $from = "From: ".$user." <".$useremail.">"; $subject = "New applicant"; $attachment = chunk_split(base64_encode(file_get_contents('http://www.website.co.uk/$cv'))); $body = $agent.",\n\n" ."".$user." has applied for your job ".$jobtitle."." ."We suggest you go to your admin panel and view the CV" ."- Thank you. "; return mail($email, $subject, $body, $from); } }; $cv holds the location of the file for the user. These files are generally .doc I have read i may need something like this: Content-Type: application/zip; name="attachment.zip" Content-Transfer-Encoding: base64 Content-Disposition: attachment but how would i incorporate this? Thanks guys
-
cool thanks guys echo "Job inserted!", mysql_insert_id(); worked fine
-
so just to confirm i would write this echo "Job inserted!", mysql_insert_id();
-
How would i return the id in the echo of this post: $query = "INSERT INTO jobs SET agent = '".mysql_real_escape_string($agent)."', title = '".mysql_real_escape_string($title)."', location = '".mysql_real_escape_string($location)."', salary_from = '".$salary_from."', salary_to = '".$salary_to."', frequency = '".$frequency."', jobtype='".$jobtype."', description='".$description."', email = '".$email."', created_at = '".$created_at."', closing_date ='".$closing_date."', categories = '".$categories."', sectors = '".$sectors."', ref='".$ref."'"; if(mysql_query($query)) { echo "Job inserted!"; } else { die(mysql_error()); } Thanks for the help guys
-
i've added GROUP BY norton_rent.Prop_VebraID and its working ok now Thanks
-
Hi i am trying to do a join between 2 tables but it is pulling duplicate results. i.e: $query = "SELECT norton_rent.id, norton_rent.Prop_DisplayAddress, norton_rent.Prop_DisplayAddress, norton_rent.Prop_PropType, norton_rent.Prop_Price, norton_rent.Prop_Bedrooms, norton_rent.Prop_Description, norton_rent.Prop_VebraID, norton_rent_img.File_url, norton_rent_img.Prop_VebraID, norton_rent_img.File_index FROM norton_rent LEFT JOIN norton_rent_img ON (norton_rent.Prop_VebraID = norton_rent_img.Prop_VebraID) WHERE norton_rent.Prop_Bedrooms LIKE '%".$_GET['beds']."%' AND norton_rent.Prop_Price < '".$_GET['maxsaleprice']."' AND norton_rent.Prop_VebraID=norton_rent_img.Prop_VebraID AND norton_rent_img.File_index=0 LIMIT ".$offset.", ".$per_page.""; $result = mysql_query($query) or die(mysql_error()); Its ok if i take out WHERE norton_rent.Prop_Bedrooms LIKE '%".$_GET['beds']."%' AND norton_rent.Prop_Price < '".$_GET['maxsaleprice']."' just wondered if anyone can see why? thanks
-
Thanks a lot!!! Works perfectly if(isset($_GET['salary_to'])) { $salary = explode(":", $_GET['salary_to']); } $types[] = (isset($_GET['salary_to']) && strlen(trim($_GET['salary_to'])) > 0) ? "`salary_from` <= " . intval($salary[1]) . " AND `salary_to` >= " . intval($salary[0]) ." " : '';
-
it seemed to work but say my search is 15001 - 20000 it wont show a job which is 15000 - 22000
-
will it be ok to do: if(isset($_GET['salary_to'])) { $salary = explode(":", $_GET['salary_to']); } $types[] = (isset($_GET['salary_to']) && strlen(trim($_GET['salary_to'])) > 0) ? "`salary_from` >= " . intval($salary[0]) . " AND `salary_to` >= " . intval($salary[1]) ." " : '';