scootstah
Staff Alumni-
Posts
3,858 -
Joined
-
Last visited
-
Days Won
29
Everything posted by scootstah
-
Rather than just adding 30 days, you should increment the month by one instead. Not every month has 30 days. Now the logic is simple - simply add one to the current month number. You'd need end-of-the-month and end-of-the-year logic. For example, if your pay day was on the 30th of January, adding one to the month would be the 30th of February - but that doesn't exist. So you'd just come down to that month's last day.
-
The extension doesn't matter. It's just the name of the file, and it's just client input. A file does not have to have any extension at all to be a valid file. This is why you check the mimetype instead, which actually examines the contents of the file.
-
Yes you can format a harddrive with gparted. What do you mean "lose the permission info"?
-
You're only checking the client input, which is not to be trusted. You need to use fileinfo on the temporary file to determine its mime type. $finfo = new finfo(FILEINFO_MIME); $mimetype = $finfo->file($_FILES['cvfile']['tmp_name']); if (!in_array($mimetype, $types)) { $ok = 0; }
-
$error_handler = new Error_Handler; register_shutdown_function(array($error_handler, 'fatal_error_catcher'));
-
You can use CURL with a proxy. That's as much as I'm willing to share, because I don't know your true intentions. Sorry, and good luck.
-
Why not contact the site and try to work it out?
-
Yes that approach seems fine. When the user logs in add the role to the session, and then check it for each menu item. login $_SESSION['role'] = $roleFromDatabase; menus if (logged_in() == true && $_SESSION['role'] == 'candidate') { echo '<a href="candidates-logout.php"><li>Log Out</li></a>'; } else { echo '<a href="candidates-login.php"><li>Login</li></a>'; }
-
You raise good points. It all depends what you're doing, I suppose. I've been mainly working on backend services for quite a while now, so I like to just return a UNIX timestamp and let the client figure out how they want it formatted.
-
var locations = [coords]; You don't need this, coords is already an array. And you misspelled for. or (var i = 0; i < locations.length; i++) { Also, please see this thread as to why you should not be passing the JSON the way that you are.
-
Another way is this: SELECT UNIX_TIMESTAMP(dob) as dob ... echo date('d-m-Y', $row['dob']);This will cause MySQL to return a UNIX timestamp of your DATE field, and then PHP can format it with date(). It's useful if you have standardized date formatting logic and don't want to add the format to every single query.
-
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Introduction_to_Object-Oriented_JavaScript You use dot notation to access object properties in Javascript. Example: var coords = [{"postcode":"AB10","latitude":"57.13","longitude":"-2.11"},{"postcode":"AB11","latitude":"57.13","longitude":"-2.09"}]; // coords[0].postcode // coords[0].latitude // coords[1].postcode // coords[1].latitudeEDIT: You can loop over the array with something like:var coords = [{"postcode":"AB10","latitude":"57.13","longitude":"-2.11"},{"postcode":"AB11","latitude":"57.13","longitude":"-2.09"}]; for (var i = 0; i < coords.length; i++) { document.write('Postcode: '); document.write(coords[i].postcode); document.write('<br />'); }Will output:Postcode: AB10 Postcode: AB11
-
It is an array. An array of objects. You can expand the object in the developer console to examine the properties and values. For example:
-
Google is a start.
- 7 replies
-
- paypal
- integration
-
(and 1 more)
Tagged with:
-
We don't know what you mean when you say "can't get this one working". We can't see your screen. Please be more specific.
-
Are you getting any Javascript errors? If I'm understanding you correctly, the accordion works until you run swapContent(), is that correct?
-
Yes, it should. If you want to see the value of coords in Javascript, use console.dir(coords); and then open the developer console.
-
Enable 2nd Dropdown if the Value of the 1st dropdown is max
scootstah replied to Hailstone's topic in Javascript Help
Can you post your new code please. Also, please use the code tags when you do. -
json_encode() does not want a boolean as the second argument, it wants an option constant. It could be failing to encode and returning false. In your test above you removed the second argument and it works.
-
How have you narrowed it to that? There's nothing wrong with that snippet. And if it's working before your AJAX call, one would think the problem is with whatever the AJAX call is doing. Are you modifying HTML that the accordion depends on or conflicts with?
-
It's not in what you posted. The error should give you a line number or reference.
-
Trouble converting user id into variable
scootstah replied to CloudBreaker's topic in PHP Coding Help
You need to call session_start() before any output. -
So, somewhere you have a stray "<". Find it.