Jump to content
Larry Ullman's Book Forums

HartleySan

Members
  • Posts

    3047
  • Joined

  • Last visited

  • Days Won

    243

Everything posted by HartleySan

  1. Here's the copy and paste from my other message: ********************************** BASE_URI refers to the base directory of your server, which should be outside the public HTML directory, and inaccessible from www.domain-name.com. I can't tell you what string to use for the BASE_URI constant, as this is completely dependent on the hosting environment provided by your hosting company. Please contact them if you cannot figure this out on your own. If you have some sort of control panel for your site though, it should be listed in there somewhere. The BASE_URL constant is just the www.domain-name.com string. Obviously, domain-name needs to change to whatever the correct domain is. The other two are based on the BASE_URI constant, but the idea is that there should be a directory called "pdfs" within the root directory of your server, and the MySQL script should also be in the base directory, so that both are inaccessible from the web. That all make sense? Also, in the future, please post your questions on the forum so that everyone can benefit from them. Thanks.
  2. Jorge, did I not already answer your question in my response to your PM?
  3. That's valid, and I apologize for any steam-inducing comments I made. I spend my days these days working for a bunch of university types that don't understand technology at all, and I quite often get the most ridiculous requests that are akin to, "Could you please build a Google search engine by yourself in a week?" or, "This sucks right now, but if you make this one little thing animate, then it'll be perfect." Because it's my job (and also because I enjoy the challenge), I quite often try to accept their requests as best I can, but I also know all too well the feeling of someone else making a request like it's nothing, when you know full and well how much work it is to make that "simple request" a reality. With that said though, I have also come to realize that most of the time, the requests are reasonable and fair, and as such, I really should try my best to grant them, as they lead to a better overall experience. And if nothing else, I try to put a positive spin on everything and realize that the reality is no matter who you work with, you will always get too many unreasonable requests, tons of gold plating, etc., but it will make you a better programmer. Anyway, I simply wanted to share that anecdote because I wanted to convey the fact that I know how you must have felt when I made those comments. Luckily, when you're only allowing images for uploads, it's not that hard to keep things secure. In my experience, the end all-be all is to simply make a new copy of the image and discard the old one. That will stop any tomfoolery. And it's usually a necessary step anyway, as most sites quite often have to make several sizes for a given image to handle responsive layouts. Anyway, I didn't mean to cause you a lot of headaches. I know it's hard when you're still learning JS and jQuery, but I just wanted to share my thoughts. Best of luck with the site.
  4. Seems decent, but the most import thing is that it's secure. I'd make sure there are no glaring bugs. Sticking with a widely used library will probably better ensure the security of it.
  5. It doesn't work because getElementsByClassName returns an array (technically, a node list, which is an array-like structure). My advice would be to use querySelector and querySelectorAll instead of getElementsByClassName, as the former have better browser support and are easier to use in all cases. If there is only one element in the DOM with a given class name, then you can use querySelector and reference the returned element like getElementById. However, if you need to capture multiple elements, then you will need to use querySelectorAll/getElementsByClassName, and loop through the results set. As a side note, innerHTML does not change the href of the link, it changes the text within the opening and closing tags. That help?
  6. If it works for you, then great. I just feel like a Flash solution is not the best, but maybe there's something I'm missing. Do you have everything figured out then?
  7. Copying the uploaded images into a div is as simple as creating a bunch of Image objects with the proper src properties and appending them as children of the div in the DOM. That shouldn't be hard at all. And as for the SWFUpload plug-in, I would drop that immediately. The link you sent me to says that it has not been under development for years, and as you know, iDevices do not even support Flash. I would either go with a simple PHP upload solution, or if you don't want to reload the page, use XHR2's File API in combo with a hidden Ajax iframe hack for older browsers.
  8. Edward, glad you found success. Would you mind sharing in more detail how you solved the problem though? I'm still a bit unsure what all you did. Also, what are you using Flash for, and why do you need a div instead of an upload button? Still rather confused. Sorry.
  9. This may be of use: http://www.php.net//manual/en/regexp.reference.unicode.php This may also help: http://stackoverflow.com/questions/5767056/php-regex-for-multiple-unicode-characters And finally, this may help (especially the link in the top-rated answer): http://stackoverflow.com/questions/6407983/utf-8-in-php-regular-expressions
  10. I'll take your word for it. Please keep playing with it until you get what you want. Thanks.
  11. If only the last one works, then you are experiencing JS closure issues. Please read more about JS closures to see what I mean. Warning: Closures are a tricky topic.
  12. Roger Federer's backhand can be troublesome, yes. Hehe! I would recommend a different approach to this problem. Write the CSS classes necessary to completely style the div and GIF the way you want them, including an opacity of 0. (Here's a quick link for opacity in old IE: http://css-tricks.com/snippets/css/cross-browser-opacity/). Next, write a function that allows you to easily create instances of this image placeholder as many times as you need. For example: function createImgPlaceholder() { var div = document.createElement('div'), img = new Image(); div.className = 'class-for-GIF-containing-div'; img.className = 'thumbnail'; img.src = '/images/ajax/ajax-loader-item.gif'; div.appendChild(img); return div; } Then, when you need say 10 of these placeholders, run a loop that calls the createImgPlaceholder function 10 times, and place all of those on the screen. Upon rendering the ten instances on the screen, you could then even attach an additional class to each, which would create a nice transition from opacity 0 to opacity 1. Finally, to handle the inconsistent loading of the GIF to begin with, the easy solution is to preload the GIF so that it's in the browser cache. Here is my favorite technique for preloading images: http://www.thecssninja.com/css/even-better-image-preloading-with-css2 Any questions?
  13. The trigger method is used to cause an event to occur, not to set one up. In other words, it's probably not what you want. With that said, I'm honestly a bit unclear on what you want. What do you want exactly?
  14. You don't have to make the change. I was simply letting you know. With a smaller chunk of JS code, you probably won't see the difference.
  15. That is one way to do it, yes. As a side note, you're better off making the anonymous function into a named function elsewhere, and then just referencing that function by name as the argument for the each method. By doing that, you're only creating one function object in memory, as opposed to the countless ones you are now. For example, if the each method executes 20 times, then you are creating 20 different function objects, which is a waste of memory. Just my two cents.
  16. Quake, sorry, but you didn't read/understand my post at all. Please go to the page with the error yourself, and open the browser console. Please try to debug from there yourself. Thanks.
  17. There are lots of services out there that can detect the country of origin based on IP address. You have to use one of those, and then display the currency and country accordingly. That make sense?
  18. Are you talking about the base URL constant? What other constants do you want / think you need? Thanks.
  19. The CSS file will simply "pretty up" stuff, and likely not affect the functionality. With that said, pull open your browser console and look for any errors that might be getting output. Likely, your either aren't putting the file(s) in the right place, or you are not correctly referencing the objects/functions in the library. Without more info, it's hard to help though. Thanks.
  20. Please check Larry's books and/or an online resource for the answer. Basically, the mysqli_query function requires two arguments.
  21. It's because you haven't actually executed the query yet with mysqli_query. Use that function to execute the query and store the result in a variable. From there, make the first argument of mysqli_fetch_array the returned results object, not the DB connection.
  22. Did that correction solve your problem, or are you still getting an error? What kind of error are you getting?
  23. quijote, welcome to the forums. I think we're going to need more information and code than that, but if you're looking for the drop-downs to immediately respond to a change in state, you're going to need JavaScript to hook all of that up.
×
×
  • Create New...