Jump to content
Larry Ullman's Book Forums

giantsfan24

Members
  • Content Count

    32
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by giantsfan24

  1. Ironically I either figured it out that night or the next day. My apologies Hartley for the lost post but you'll always have the memory of the once great post lol. Anyway, it wasn't really me, it was a tutorial I found on closures. It's weird, in PHP, we don't really have to worry much about closures(maybe in more advanced you do). Anyway, here is the code that looks to do something very similar to Hartley's but instead of looping through the function creation, it just loops through the function(could be semantics as they accomplish the same goal: <script> $(document).ready
  2. Ok, so I am finally back to this. Hartley was absolutely right, this was a closure issue. By the time you "mouseover" the galleryimage, the variable i is already six. So I just spent the last hour trying to figure out how to get the variable i in my Ajax URL to properly assign the right variable for each DOM element in question('#galleryImage') Here is the code in question. I'll shorten it and space it out and add notes to show exactly what I want to do, what I've tried, and how that didn't work. //I'm trying to create a closure so when the for loop gets to that part of the code //(where
  3. Good stuff, but I've discovered a hole in the striptags()(and even htmlspecialchars() and htmlentities(): you can still inject Javascript into the acceptable tags. The script doesn't need to start with "<script>". This is explained here. http://www.deepshiftlabs.com/dev_blog/?p=1885&lang=en-us There seam to be two solutions. 1.To simply not allow any submitted HTML to actually go on your site until you(or an authorized user) approves it(fairly easy with an extra column in the table called "approved"...then the PDO/mysqli will onyl return results that have a true or yes type v
  4. I was alking to one of the IT guys at work and he was telling me that a better career path may be database administration as opposed to being a developer. He was saying the entry level jobs are higher paying and they are more in demand since there are less of them. I wanted to get your thoughts on this? Would it be worth it to abandon developing and moving into DBA or can you do both?
  5. I'll probably come back to this when I have a free hour to devote to it. I have no doubt it's exactly what you said. Thanks again.
  6. The website is learnasp4.com . The basic course is totally free and other than the computer generated voice(sounds like a very proper English gentleman), it really does a good job of walking thru step by step. Hartley, I meant that it is just set up very different than Dreamweaver. It almost seams one with the code, rather than as Dreamweaver, that seams like it's allowing you to access your code through it but the program itself is not interfering. It could be that I haven't really gotten into the main C# part of the videos yet and he's just going thru all the stuff Visual Studio can do.
  7. Thanks alot Margaux. Good tips. Lucky enough, all of those are on my to-learn list this year. I'm breaking it down. Instead of learning one at a time, I'm learning asp.net(and C#) today. Tomorrow is client side day, which means learning or expanding in something the client will actually see(JS, Jquery, CSS/3 HTML/5 and yes Responsive Web Design). Third day is my work day, where I actually work on my current project(of course that can be added to other days as well). That's my little roadmap for this year at least( I know you were dying to know)...and let me tell you, if you've never worked wit
  8. Good deal guys. I guess it's true. Learning one programing language makes each successive language easier to learn since alot of the concepts are the same, just the syntax is different. Maybe a better question would be knowing my history, which would suggest would be the most beneficial to my career: ASP, Jquery(more of it anyway), or Responsive Web Design, or maybe a technology I haven't mentioned. I'm not looking for definitive answers, more your thoughts and experiences.
  9. Coupe things. In the code I was using I did substitute the 1 for the variable i like you showed. It did work in the sense that it created 6 events on the six thumbnails. The part I still can't understand is that url part of the $.ajax function didn't work with the i variable. It wasn't being sent/received by the php ajax page. Anyway, I'm sure your right that it must have been something with my code but I'm not going to spend 2 hours looking for it. Thanks for the help. You are the Larry when Larry is out being Larry.
  10. Unfortunately not, because even though the JS/JQ loop works, it doesn't create the code/function 6 times, it just loops through the function definition 6 times(essentially overwriting itself with each loop) and since those 6 definitions are not output to the browser(my initial fear), the browser only recognizes one script block, with one function definition(the final loop). It was a little experiment that unfortunately didn't work. Luckily there is a pretty easy solution. Since the JS/JQ code is already on a page with PHP on it, I can just run the script block through a PHP for loop six ti
  11. Ok, so I'm attempting to use ajax to bring up the images description when you click on the image thumb nail. To do so, I'm running my function definition through a for loop, replacing select parts of the function to correspond to the image number selected. When it is output in the browser, the code below $(document).ready(function() { is only output once, not 6 times. Does this matter? I'm not nearly as familiar with JS/Jquery as PHP and want to make sure the for loop would be asigning the variable i through six loops. Please also note I have not yet replaced the variable "i" in the for lo
  12. Hey guys, loving Larry's books and will be using Larry's Yii Book to create my own portfolio site to see how much time using a PHP framework saves. Anyway, in doing my current web project, I decided to use Jquery instead of straight Javascript to handle the Ajax and I got to thinking: I love knowing Javascript and the awesome flexibility it gives me, but more and more, I'm seeing people just using Jquery instead to save time. In addition to the many things I hope to add to my developer toolbelt this year(which includes mobile development and even some flash(or it's equivalent)), I see alot
  13. First, thank you for the quick reply. Second, I think your second idea would be better, as to know what all the 'bad' may be harder to pin down than the benign ones. That said, apparently, there is a feature to strip_tags that I didn't know about. It takes a second argument. The first is the data to strip the tags from, and the second optional argument is maybe a string(or array) of allowable tags. That is exactly what i was looking for. Where did I find that? Where else, from Larry's Effortless Ecommerce Example 1, where he uses TinyMCE and runs the content through strip_tags but builds a
  14. Hey Larry, I am building a site using this part of the book to allow users to upload their own articles, and use the $page->getContent() object to output the content, as shown on page 300. Is the only way to have this type system, where an admin did not have to approve every article, be to use TinyMCE(or a similar plugin that uses it's own tag filters)? I ask because the main text field has no tag filter(strip_tags, htmlspecialchars, etc) applied to it either on the input to the database or the output. Is there a way to filter out all tags except benign tags like <p> for long art
  15. Awesome, thanks Larry. That's what I wanted to know. Off to read your article about how to implement Stripe. Also, I still welcome any other comments by others that have used such software.
  16. Having basically grown up in PHP(and JS) with you and your books, pretty much everything in them is hand coded(though I really can't wait to dive into your Yii book to see how much time it will save when starting a new site). Anyway, I am, as your recently alluded to resolution list states, trying to learn or at least be familiar with as many technologies as possible. One of those is shopping cart software. I go to the website template sites(because like you, I can create a pretty decent looking site but when a client wants a really nice site, I know my limitations) and see all these templ
  17. I appreciate the bluntness(word?). I created a complete response detailing: when the ONLY variable was either GET or POST, it changed the ajax.responseText. I then looked at my PHP code again. The IF conditional expected a POST variable, so it progressed to the unset $dbc, but when it ran through GET, it completely bypassed it, and thus the error was never there when using GET. I tested this by simply pasting: $e = mysqli_real_escape_string($dbc, $_POST['email']); outside the IF conditional below, and sure enough, when the ajax ran through GET, it threw an error(maybe technically an exc
  18. Sorry guys, I tend to type how I think, which is not always linear. The $dbc PHP variable was not declared/created on the ajax-version of the validation page, it was just referenced/called(in the mysqli real escape string function). On the 'normal', non-ajax PHP validation script(following the progressive enhancement mindset and was used as the template(with minor alterations) for the ajax version), the script itself was included in another script(index.php), and on THAT page(index.php), it also included a MYSQL PHP script that contained the database connection info, including the $dbc
  19. I was importing some of the Ajax code covered in the book to a completed site. I was testing out my Ajax skills by ajax-ifying a login form. Well, it turns out that if a PHP variable on the ajax-version of the php script is unset(in my case $dbc), the POST request from Ajax doesn't work. I even made sure the ajax-php page only returned the word 'VALID' and it still wouldn't work. Odd as I ran the php script by itself to test it and it never threw an unset variable error. Took me about 2 hours to figure that out. Here's the really funny thing: I switched the Ajax request to GET, and it
  20. On page 292, when adding an order, you get the value for shipping from $_SESSION['shipping']. Where on earth did we set that session variable? I searched through the scripts and couldn't find it. I even used CTRL+F.
  21. It's really more of a ecommerce payment submission type thing(the delay is also used to show the processing .gif to further discourage double clicking...you could also just disable the submit button on click). Larry, you had done basically the identical thing in you Effortless Ecommerce Extras PDF, but for some reason, I remember it not working for me(99.99999% sure I did something wrong). Hartley, thanks for the tip with the appendChild. So using a flag variable, you would basically turn the flag variable false once the user had clicked the submit button once? How would you then prevent a
  22. Woops, I hope everyone sees my first mistake. I put one too many zeroes in the setTimeout function(method). I had it set for 50 seconds. Also now that the form submits after 5 seconds, and reloads the page, the Delay then goes away. For anyone wondering how could I make the reload/submission less obvious(especially if they are going to stay on the same page)....AJAX! I guess to turn this into a base JS script, you would simply use getElementById to grab the form reference, get rid of var form = this, and use whatever base JS function you use(the name escapes me for the moment) to add a
  23. I am loving Javascript. I don't want to be a JS Ninja, but the things it can do really excite me. I am intrigued by all the uses for timers. I searched online for this but have found only mostly JQuery answers, which I don't want(ironically I like the more "spelled out" syntax of base JS). Anyway, if i have a form that needs to be submitted, and I want to delay the submission of the form by 5 seconds and show a processing gif, how would I do that. The closest Jquery thing I could find was the following(again I don't want it in Jquery). I does stop the form submission at first(so I know Jqu
  24. Hi Larry, I must begin my post the same way I begin every new topic: Thank You. Thank You for making PHP(and web programming in general) palatable for the normal folk. My question is quite simple but the answer may not be. How would I port the second example to the Yii framework? I obviously don't mean the database itself or even the original html template files, as Yii is built to use both. It would seem, in going through your mini-series on the Yii framework that when you create the MVC via Yii, it creates it's own validation and such. How much of that type code would you keep in the cu
  25. The specific one I am referring to is on 233-234, but it applies to another procedure defined in chapter 8 as well. Sorry, I thought I included that in my post.
×
×
  • Create New...