PHP - Moved: Ajax Date Check
This topic has been moved to Ajax Help.
http://www.phpfreaks.com/forums/index.php?topic=313543.0 Similar TutorialsI want to see if a date is more than 10 days overdue. if ($row['duedate'] < "todays date plus 10 days"){ How do I do that? I put in quote sup there in "english" what I want... Hi Guys, Need some help I have two dates: Now= 2011-02-08 Expires= 2011-06-15 How can I check if we are getting close to the expire date. For example. Lets say we were 5 days away from 2011-06-15 ( todays date was 2011-06-10 ) for example.. How can i tell this? / return 1 Ie: if date is 5 days or less away do ( this ) Its s essentially so i can email people when something is due to expire. Many thanks L Hi, I have database stored a field of date. I want to check if the date in the DB field is the same as the current date, how to do it? Code: $oracle = mysqli_real_escape_string($con, $_POST['oracle']); $query = mysqli_query($con, "SELECT indate FROM staff WHERE OracleID ='$oracle'"); $row = mysqli_fetch_array($query); $num_row = mysqli_num_rows($query); if ($num_row > 0) { $curdate = date(); if ($row['indate'] !== $curdate) { $query1=mysqli_query($con, "update staff set ClockedIn = 0, ClockedOut = 0 where OracleID='$session_id'")or die('Error In Session'); header('location:home.php'); } }
Currently I have an Input field for a "Written On Date". What is the best way to make sure a valid date is entered? Should I use Regular Expressions? Some PHP Date-Checking Function? Or switch to Drop-Down Lists to better control the selectable values? (Which won't catch things like June 31?!) Debbie What is the best way to check for a Date in a Form? I see there is a CheckDate() function, but how does that know what format the Date is in? Should I use a Regular Expression? My Form Field is just a Text Box... Thanks, Debbie I am having a problem making this work. It adds and deletes but it does it by passing the date directly to the PHP files and refreshing the screen. I want it to do it through the jquery Ajax script. This should work according to what I have read but no mater what I try the jquery script does not work.
<html> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/jquery-ui.min.js"></script> </head> <body> <script type="text/javascript"> $(document).ready(function(){ $('MySignform').submit(function(e) { e.preventDefault(); $.ajax({ type: 'POST', url: $('MySignform').prop('action'), data: $('MySignform').serialize(), success: function() { alert("It worked!"); } }); }); }); </script> <script type="text/javascript"> $(document).ready(function(){ $('DelForm').submit(function(e) { e.preventDefault(); $.ajax({ type: 'POST', url: $('DelForm').prop('action'), data: $('DelForm').serialize(), success: function() { alert("It worked!"); } }); }); }); </script> <br /> <br /> <br /> <center> <form name="MySignform" action="addsigningfee.php" method="post"> <label>Signing fee</label> <input name="signingfee" type="text" id="signingfee"/> <input name="pid" type="hidden" value="7"/> <p></p> <button id="form-submit" type="submit">Save</button> </form> <br /> <div id="result"></div> <br /> <form name="DelForm" action="delsigningfee.php" method="post"> <select name="signingfee"> <?php require_once("connect.php"); foreach ($db->query("SELECT signingfee,id FROM options WHERE signingfee <> '' AND pid = '7'") as $row) { echo "<option value=" . $row['id'] . ">" . $row['signingfee'] . "</option>"; } ?> </select> <p></p> <button type="submit" >Delete</button> </form> </center> </body> </html> Adding and Deleteing mysql date using jquery Ajax I am having a problem making this work. It adds and deletes but it does it by passing the date directly to the PHP files and refreshing the screen. I want it to do it through the jquery Ajax script. This should work according to what I have read but no mater what I try the jquery script does not work. Some help getting me In the right direction would be great. Code: I am trying to check if a credit card has expired. My criterion is whether or not the date submitted is prior to this month if the year matches 2011. Code: [Select] // Check for Expired Card. if (($expYear = date('Y')) && ($expMonth < date('M'))){ $errors['expDate'] = 'Expiration Date cannot be in the past.'; } Why is this not working? I chose March 2011 and it fails. In fact, it fails for any date?! Debbie Hi all, How can I check in PHP if this date has already passed in the following format: 2012-12-12 check date is in format of Y-m-d I have two text fields in a form. Both accepts dates. I'd like to check whether the second date provided is exactly one year in the future from the first provided date.
I can easily do this in PHP but since I need to do the check once the user leaves the second field, I have to resort to JavaScript, using onblur or something.
There are two issues I have.
1. Make sure that the strings provided are indeed dates (I would use strtodate() in PHP for this)
2. Regardless of month provided, making sure that the second date is exactly a year in the future of the already provided year
I've only captured the values and passed them to Date(). However, it can only handle european style, and if I enter 1981-06-16, the value returned is Jun 15 1981 17:00:00 which is obviously wrong.
Here is the simple broken code I have
var text1 = document.getElementById("text1"); var start_date = new Date(text1.value); var text2 = document.getElementById("text2"); var end_date = new Date(text2.value); alert(start_date);I need some guidance. This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=312841.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=351379.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=333348.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=325858.0 Hello guys, i have a problem that i am trying to solve myself for the entire past week. I am not a php programmer and i wish you can help me. There is a russian project called Crot Anti-Plagiarism, it is a open source moodle plugin. I started to use it and it is a really nice feature. The problem is that there are quite few people that are developing it and new features are coming once a year... I see a big "hole" in this project (at least for me) : The plugin checks for plagiarism in the file that you submit only once, if a student resubmits the file it doesn't see that and you need to start the plugin's test again for all the files which is time consuming if you have a lot of submitted files to check. I would like to add a function that will check if a file changed his modified date , if yes - mark for checking, if no - skip the checking. I already added a similar function that checks if the name has changed, but it seems harder to check it by uploaded time(modified time). Things i have already done: I added a new column "assignment_submissions_timemodified" in database. I added a new function that records the "time modified" of the file in the database. But i can't add and i cannot make the comparison between the date of the first time the file submitted versus the date of the second time the same file was resubmitted. Alright no more bullsh**t here is the code: (there are 3 comments that shows what i've changed, starting with //my job...) Thanks a lot! Code: [Select] $apath= $CFG->dataroot."/$assignment->course/moddata/assignment/$asubmission->assignment/$asubmission->userid"; $timemodified= filemtime($apath); //my job... it checks the file's modified time. $files = scandir($apath, 1); if (! $unprocessedsubm = get_record("crot_submissions", "submissionid", $asubmission->id, "crot_submission_file_name", $files[0], "assignment_submissions_timemodified", $timemodified)) //my job...now i guess here is the problem ( "assignment_submissions_timemodified", $timemodified) { echo "$timemodified"; echo "$unprocessedsubm"; print_r($unprocessedsubm); echo "\nsubmission $asubmission->id was not processed yet. start processing now ... \n" ; $atime = microtime(); $atime = explode(" ",$atime); $atime = $atime[1] + $atime[0]; $astarttime = $atime; if(!count($files))break; //TODO we should verify if filename changed //TODO add loop on the documents folder as well as loop for unzipping $apath = $apath."/$files[0]"; // call tokenizer to get plain text and store it in crot_submissions $atext = tokenizer ($apath); // update the crot_submissions table // delete if exists delete_records("crot_submissions", "submissionid", $asubmission->id); // insert the new record $record->submissionid=$asubmission->id; $record->updated = time(); $record->crot_submission_file_name = $files[0]; $record->assignment_submissions_timemodified = $timemodified; //this is my job.... it is recording the date as it has to. $submid = insert_record("crot_submissions", $record); // insert into documents $docrecord->crot_submission_id = $submid; Also i have attached the whole file crot_crone.php. This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=309753.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=332473.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=347835.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=348693.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=323434.0 |