-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
Cheers for that, looks like a useful tool!
-
Are you setting the error reporting level..?
-
Just to add to that, if you have the page available from two different URLs, Google will assume you're using "black hat" techniques to get better rankings. More pages = more content. So as Neil says, always stick to one (the SEO friendly) scheme.
-
You need to sign a contract with them.
-
You need to perform a multidimensional array_search(). Somebody posted their effort at a custom function for it on the manual.
-
Do you know anything about SSL certificates or configuring Apache?
-
I haven't read it, but try reading this. Please search Google before asking in future, there's thousands of articles out there that explain what a framework is.
-
I want spinner (numeric up/down field) to display numbers properly
Adam replied to malcom p's topic in Javascript Help
Answer 1: Just run the value through parseInt(). Integers don't have leading 0s, so they will be ignored / stripped out in the return value. Answer 2: 'onchange' of the input I would record the last valid number in a variable. 'onblur' if the input was then empty/invalid, I would then set the value to the history variable. I'm not going to implement it into your object, but here's a simplified example: <script> window.onload = function() { var input = document.getElementById('history_input'); var history; input.onchange = function() { if (this.value.match(/^[0-9]+$/)) { history = this.value; } } input.onblur = function() { if (!this.value.match(/^[0-9]+$/)) { if (typeof history != 'undefined') { this.value = history; } else { this.value = ''; } } } } </script> <input type="text" id="history_input"> -
What are you expecting this to be? You need to pass in the element object to the function: function clearText(obj) { if(obj.value == obj.defaultValue) { obj.value = ""; } else if(obj.value.length == 0) { obj.value = obj.defaultValue; } } But as I said, you need to pass in the element object when you call it. This can be done in a variety of ways... clearText(document.formName.inputName); clearText(document.getElementById('inputID')); // etc.
-
[jQuery] "Joining" two arrays with jQuery loop?
Adam replied to fishbaitfood's topic in Javascript Help
If the keys match, within the callback function you can define two parameters. The first being the key and the second being the value. As an example, run this: <script> $(document).ready(function() { $(['one', 'two', 'three']).each(function(key, value) { alert('Key: ' + key + ' / Value: ' + value); }); }); </script> Using the key you can just look-up the value in the other array. -
Apologies I got distracted when replying to your other thread and forgot to go back to it. No, there is no 'download complete' event. JavaScript's reach only extends to the DOM (Document Object Model) within HTML. Remember with what I was saying before, when you send the response as whatever content-type, you're not sending it as text/html. Therefore JS does not exist in that type of request. There's also no way of wrapping the request using AJAX, as AJAX is limited to plain-text and there's very limited support for opening new windows with a specified content-type. Then again even if you did it that way, pushed the data into a new window and managed to change the content-type dynamically, the download dialogues are browser-based behaviour anyway, there's still no way of hooking onto them with JS - it's not built for that. Unfortunately there's just no way of knowing (using HTML/JS) whether or not a download was successful. Instead, you should do what every other site does and change your context. Don't say "your download is complete", say "your download is starting". That will make sense and should be a familiar experience for the user. Hope this helps.
-
It's good practise to add a prefix to your constants, to prevent such ambiguity.
-
permissions on a login folder out of the public_html
Adam replied to maccy93's topic in Miscellaneous
PHP runs under the Apache username, if that answers it? -
Modified login post but after modified its is blank page
Adam replied to shebbycs's topic in PHP Coding Help
FYI ZulfadlyAshBurn, empty() performs an isset() check first. So this: if (!isset($_SESSION['is_logged_in']) || empty($_SESSION['is_logged_in'])) { Will always evaluate to the same as this: if (empty($_SESSION['is_logged_in'])) { -
You're using single quotes around the column values in your SQL query, so when you have a single quote within a variable the resulting string contains two single quotes, breaking the syntax. You need to use mysql_real_escape_string to escape any quotes, but also to protect yourself against SQL injections. You should always escape any form of user input used in a query!
-
Hmm perhaps should be a bit clearer; by refresh the page, I mean when you view the source it sends a repeat request to get the source, instead of just showing it you. If it's a POST request, a pop-up within the source window will confirm you want to re-submit the data. It's not a huge problem, minor annoyance I would like to disable if I can. Checked the settings and I can't find anything that sounds like it's related, and nothing in about:config as far as I can tell.
-
True, but when reading through long exception object dumps and such it's a bit clunky. Plus you loose it on the next page load, which isn't handy to refer back to. I just want a plain text pop-up. @cs.punk - I've had it about a week, maybe more?
-
One of the minor things I always liked about Firefox over Chrome is that it didn't require you to refresh the page in order to view the source. In a recent release though, I think 8.0, they've changed it so now you do. Can be quite annoying, for example when you're debugging issues that only allow one submission. Is there any way to disable it?
-
Thoughts on storing credit card data for an instance?
Adam replied to dadamssg87's topic in Application Design
You need to conform to PCI standards if you're going to be processing transactions (even if using a third-party gateway) and storing card information. Just because you're using SSL, doesn't mean there aren't vulnerabilities in your system. It doesn't even need to be a vulnerability as such, just leaked private information into the wrong hands -- consider an error email with a backtace exposing the customer's card details). If there are and the bank companies suffer any form of damages, they will prosecute you. In certain places it's as good as a law anyway. Card data for example *always* has to be encrypted. Also you should never send full card information via email, just the last few characters of their card number instead so they can recognise it. By storing the information on your own servers, whether it be temporary or permanent, you open yourself up to a lot more requirements. I imagine you will fall under merchant level 4 (less than 20,000 Visa transactions a year), so you should complete a self-assessment ASAP and start working towards compliance. You've got some reading to do. -
You just need to read the contents of the directory containing the videos into an array (glob will make that easy), and use array_rand to randomly select one item from the array. You may want to later cache such a listing if this will be used heavily, but for now just concentrate on reading the contents using glob. TCP/IP actually stands for "Transmission Control Protocol / Internet Protocol"
-
What does the following code display..? for ($i=0; $i<count($thumbImg); $i++) var_dump($thumbImg[$i]);
-
I suspect if system() has been disabled, exec() and all the other system commands will be disabled too. I very much doubt your host will enable it for you either. In order to have full control of the server you need to get a private server (or a virtual private server). Obviously these will cost more though...
-
pass a username javascript variable to next page as hidden
Adam replied to sungpeng's topic in PHP Coding Help
Whoops, misread your post. You're not actually passing any data across..? -
pass a username javascript variable to next page as hidden
Adam replied to sungpeng's topic in PHP Coding Help
The data sent in a POST method form *is* hidden from sight. It's not difficult to retrieve of course, but then again no client-side data is. If your system is vulnerable when somebody changes the value, then you need to rethink your server side security, not the client-side. -
freelance84 provided you with a tutorial that explains how to retrieve MySQL data using PHP. After reading it carefully for a good understanding, you should be able to adapt the examples there to fit what you need to do. If you get stuck, show us the code you have so far and we'll go from there.