Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by Matt

  1. This code example shows what is going on in my case: Please note for using global variable in child functions: This won't work correctly... <?php function foo(){ $f_a = 'a'; function bar(){ global $f_a; echo '"f_a" in BAR is: ' . $f_a . '<br />'; // doesn't work, var is empty! } bar(); echo '"f_a" in FOO is: ' . $f_a . '<br />'; } ?> This will... <?php function foo(){ global $f_a; // <- Notice to this $f_a = 'a'; function bar(){ global $f_a; echo '"f_a" in BAR is: ' . $f_a . '<br
  2. HartleySan and I have most likely found the source of the problem! It has to do with $dbc losing scope within the get_password_hash() function! global $dbc; Yes, $dbc was set as global within the functions, but as it turns out, that didn't matter! Terry, you hit the nail right on the head! Last night, HartleySan and I stayed up trying to figure this out over the phone. We tried out several things and finally honed in on the problem. After a bit of troubleshooting, we then tried pasting the following into the get_password_hash() function, and to our surprise the login
  3. Larry, I have made great progress working on the "Art Gallery" site I had posted about a few weeks ago! A Site With Subdirectories For Each User! I have the user registering on the main index page, then they are directed to a page where they create a gallery/profile (they fill out a form where they input their name, gallery name, name of the directory that will be created, upload a profile pic, etc...). I have the php set up to create the gallery directory and drop an index file into it and it works perfectly. The problem I am having is that I am trying to develop a login syst
  4. Larry, I just wanted to let you know that I went back and scoured the PHP 6 & MYSQL 5 book and you were right! There is a proxy script for displaying images in the Chapter 17 - E-Commerce example, but it wasn't labeled as such, so I think that's why it was hard for me to find. When I first read the book, the only chapters I didn't read were 15 & 17. I just skimmed over them, so I completely missed the proxy script! Again, my apologies for giving you a hard time about that! Also, where do you recommend putting the proxy script? In the book, you put it right with all ther ot
  5. Larry, My apologies! I was just getting buried in new concepts (and trying to do 10 different things at once), and when I got stuck on the proxy script thing it made me a little frustrated. And then, when I start looking at other people's code, the first thing I think is "Oh no! What would Larry do here? I need to get Larry's opinion on this!" - he, he. Believe me, that is a compliment However, it's all starting to make sense now, and you're right that I was making it more complicated than it is! Also, my mistake about the Javascript/popup window thing! I didn't have the book
  6. Thanks Larry! You are right about the '@' being used everywhere! What's going on with that? However, what do you think should be done to improve the code? I haven't implemented it yet, so any advice regarding how to handle possible errors would be greatly appreciated! More importantly, I had a little trouble accessing the images once they were uploaded! You go into great detail in the book about the virtues of placing uploaded files outside of the web directory. However, in the ecommerce example, you completely go against this and place the images in the web root! I had to refer to
  7. Larry, I think I have found a solution to the image file upload security problems you talk about in book! As you know, I am making an art gallery section for my Underworld website. Every user will have his own index page within a personal directory. I want to allow them to upload images (profile image, artwork, etc...). HartleySan and I have talked about this and feel that the most logical way to store these is within a subfolder of the artist's directory itself (i.e. within the web root directory). Well, I was looking at Facebook profiles and I have noticed that all the images in
  8. Larry I understand completely! Don't get me wrong, I wasn't trying to attack anyone on this forum for paying more for a hosting service per say. Rather, I was trying to elicit a response/justification for spending that much because I am obviously inexperienced in that area, and it worked! I've basically come to the same general conclusion as you. For non-profit or development sites, I think my host is fine. For running any sort of web business, then I would definitely need to look elsewhere! I always have my eyes and ears open for new and better hosting services, especially for sta
  9. I have always used GlobeDomain! A few years ago, one of my fellow IT allumni recommended it to me. It is very cheap - starting at $4.95/year, however, they are quite professional and have all the necessities (C-panel, mySQL, full PHP support, CGI support, etc...) I've heard that they are geared more for the experienced web developer, so support is very limited (i.e. you need to know what you are doing), but for anyone who is reading any of Larry's books, this shouldn't be rocket science. For my Underworld website I use the G-2000 plan - 2000MB disk space, 20GB data transfer/m
  10. Thanks Jonathon! I ran a info.php script on my host and it does show that GD is installed! Matt
  11. Hello everyone, I am currently writing a script that allows users to create a profile. They upload an image, and using Larry's code, it saves it in a folder outside the web directory. Because users could theoretically upload images of any width and/or height, I decided that I wanted to resize them during the upload to constrain their size. I found a highly recommended script by a guy named Mike Lopez that does exactly what I wanted (although it appears to be mainly for loading/resizing images from other URLs). The problem is that it was written in 2006, and the sparse documen
  12. Thank you Larry and HartleySan for your help! It was the backtick (grave accent marks) that were the problem! I fixed them and now the script works fine! Matt
  13. Hello everyone, I am working on a script which takes a user`s profile information and then writes it to a table called "profiles" in the database. The code is based almost entirely on the registration script from Larry`s "knowledge Is Power" example! The problem is I keep getting an error at the line where it tries to run the query (actually, the error line number the one for the "if" statement). Also, when I go into PhpMyAdmin, it`s not adding the record to the database. I spent almost 2 hours playing with it last night, but can`t figure out what is preventing the INSERT! I
  14. Thanks again Jonathon! Yeah, this is both perplexing, and frustrating! Perhaps someone else (i.e. Larry - since this is essentially your code) has an idea of what`s going on. Thanks, Matt
  15. Thanks Jonathon! I have seen a warning about that too! I am on a hosted server and I think I am running in safe mode. Why does safe mode matter? All I`m doing is passing a string to an array, which I`ve done all the way through the code without any trouble! Errors like this are simply ridiculous!
  16. Does anyone know what the following error means: An error occurred in script '/home/tueslcom/public_html/ecommerce/create_profile.php' on line 96: shell_exec() has been disabled for security reasons It is being generated by the following line: $reg_errors[`directory_name`] = `Directory ` . $dn . ` already exists.`; This code is nested down in a few if-else statements. I have tried many combinations (i.e. `Directory already exists`, "Directory already exists", etc...), but to no avail! My only guess is that perhaps variable scope is being lost for $reg_errors, but tha
  17. Terry, Thank you very much for your detailed response! It has really cleared all of this up for me! That`s why I said that "I hate to ask such a stupid question"! I do own "PHP 6 and MySQL 5" and have gone through it at least twice over the past 3 years! In fact, it is pretty tattered and pages are starting to fall out from having carried it around so much! It`s very straight forward and I pretty much have it down! I also own, "PHP 5 Advanced", but I use it more as a reference and have only skimmed through certain topics. That`s the problem here: Larry has never, in
  18. Larry, Thank you very much for your responses! I think I have enough to go with to get started. Actually, I already started setting this up. I decided to use the "Knowledge is Power" example from "Effortless E-Commerce" as a starting point. The code is much more up-to-date and secure compared with the "PHP6 and MYSQL 5: Visual Quickpro Guide" user registration code from ch16. I do need to take out the whole PayPal payment code and a few other things, but everything else is almost ready to go! I just had one last (I hope) question for now: As you know, I need have a profile
  19. Larry, Thank you so much for your reply! Good points! As * Hartleysan said, I`m not sure why this is necessary. It just seems more logical to have all the artists media kept within the folder for his gallery. If done outside the artists`s folder, then you get into the added complexity of linking a specific artist with his/her image files (adding a new table to the database, writing more code, putting more demand on the server, etc...). What do you think about Hartleysan`s suggestions? I didn`t even think about this one! Thank you so much Larry! Hartleysan thoug
  20. Larry, I hate to ask such a stupid (and probably obvious to most) question, but what exactly is a URI? In your book, you define it as "/path/to/Web/parent/directory/", however that doesn`t tell me much! My domain name is "www.tuesdaygirl.com", but how in the name of god do you point to the parent folder of a root web directory that a domain name is pointing to? Perhaps I sound like a smart ass, but should it be "../" Well, since I have no idea how to set that up, I decided to just point the BASE_URI to the web directory itself. In this case is I`m guessing that the URI should
  21. Hi Larry! This is "phaseblue" (the Flash guy) from your last forum. I know you don`t cover mkdir() in "PHP5 Advanced: Visual QuickPro Guide", but given that my situation is a bit "advanced" I thought that this was the best forum to post this. As you know, I run a fan website for the group Underworld in Japan. Many of the fans are quite tech savvy and quite a few are into visual/musical arts. Recently I have been playing with the idea of creating an art gallery on the site where fans can create a profile and post their work. What I think should happen is this: 1) A fan/ar
  22. DeeDee, Like HartleySan, I just tested this as well and it`s working perfectly! Sorry, I wrote my reply late last night and looking at your code again I realize that you actually were attempting a "timestamp" in the database, so my apologies for the confusion. However, I think I got confused because you put the "NOW()" function call in a variable: I`m sure this is perfectly fine, but I think doing that is completely unnecessary. As HartleySan said, something like the following (which is the code I used) should work fine: $q = "UPDATE users SET last_login=now() WHERE
  23. DeeDee, I would not suggest grabbing the last login time this way: The best way to do this is with a timestamp in the database! If you grab the date/time from the user`s machine, then it will depend on the user`s location/time zone. Since many of your visitors will certainly come from different parts of the world, this will cause you to lose a precise point of reference If you use a timestamp, then all dates/times will be entered relative to one time zone (i.e. GMT or wherever your server is located)! Hope this helps! Matt
  • Create New...