Jump to content

kicken

Gurus
  • Posts

    4,704
  • Joined

  • Last visited

  • Days Won

    179

Everything posted by kicken

  1. onchange="this.form.submit()" is a good generic option. All form input elements have a .form property that references it's <form> element.
  2. I think you have to setup IIS's config to point to a fastcgi dll that comes with iis (or is an extension) then configure the fastcgi via a text file with the path to PHP. It's been a while since i setup PHP on IIS, and even when I did last time I think it was on a newer IIS than you are using. Try following this guide for how to configure it: http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60/
  3. Use tools like dig (linux) or nslookup (windows) to debug what nameservers your using and how long they have the domain cached for. For example: Using NSLookup C:\Users\Keith>nslookup -type=A -debug yourdomain.com. Server: google-public-dns-a.google.com Address: 8.8.8.8 ------------ Got answer: HEADER: opcode = QUERY, id = 2, rcode = NOERROR header flags: response, want recursion, recursion avail. questions = 1, answers = 1, authority records = 0, additional = 0 QUESTIONS: yourdomain.com, type = A, class = IN ANSWERS: -> yourdomain.com internet address = 173.230.139.100 ttl = 3128 (52 mins 8 secs) ------------ Non-authoritative answer: Name: yourdomain.com Address: XXX.XXX.139.100 The lines of interest above are the Server: and Address: lines which tell you what dns server (name and ip) your using and the ttl = line which tells you how long the given result will remain in cache. Using dig kicken@linode:~$ dig yourdomain.com. A ; <<>> DiG 9.7.3 <<>> yourdomain.com. A ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 22037 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 0 ;; QUESTION SECTION: ;yourdomain.com. IN A ;; ANSWER SECTION: yourdomain.com. 3600 IN A XXX.XXX.139.100 ;; AUTHORITY SECTION: yourdomain.com. 3600 IN NS ns54.domaincontrol.com. yourdomain.com. 3600 IN NS ns53.domaincontrol.com. ;; Query time: 65 msec ;; SERVER: 75.127.97.6#53(75.127.97.6) ;; WHEN: Sat Jul 28 01:17:35 2012 ;; MSG SIZE rcvd: 104 The lines of interest there is the one below ;;ANSWER SECTION and the one starting ;; SERVER. The number shown in the answer section after the domain (3600 above) is the TTL showing how long the entry is in cache for. The ;; SERVER line is what dns server (name/ip) your using. Once you find out the TTL time for the domain, wait until it should have expired and try the lookups again. If your still getting the wrong results, you'll probably have to contact the network admins and have them investigate what the issue may be.
  4. I don't think a ton of files in a directory is much of an issue on any modern file system. I recall reading about it being a problem in some older systems like FAT16/32 but I'd guess your not using those. The only issue would be like scootstah mentioned, using tools that operate on the list of files. An older system I used to work on would store all uploads in a single directory. I have no idea how many files it had in it total but occasionally someone would accidently try and open that folder in windows explorer and it'd lock up their system for a good 10 minutes or so trying to load and render the list. If I expect a folder to contain a lot of files I try and setup a small tier system where they get split into different directories. Mainly so that if someone does have to actually go in and find a particular file manually it's easier to do. The way I manage the setup is usually to prepend some fixed-length prefix to the filename and then use the first x characters as directories. Generally I'll use the user's ID (zero-padded if needed) as a prefix but sometimes I just generate a random number. Eg. say user #37 uploads avatar.jpg to the site and it should be stored in /Uploads/avatars using a tier-setting of 3 levels The script would take their ID, pad it to at least length=3 (so 037) and prefix it to the filename for 037avatar.jpg Then the script would take the first 3 letters from the name and use them as directories, creating the path: /Uploads/avatars/0/3/7. The image then gets saved as /Uploads/avatars/0/3/7/037avatar.jpg It seems to work pretty well and keeps the directory sizes reasonable by spreading out the files. There are certainly other ways one could accomplish the same thing if desired.
  5. kicken

    SocialEngine

    Some friends of mine have bought and use Social Engine. There are a lot of plugins for it but they don't seem particularlly well developed. They have had quite a few bugs pop up on them with the plugins and a few with the core system. It's slow as all hell too. Some pages take 20-30 seconds to load. Granted they are on shared hosting right now (I'm working on setting up a dedicated server for them) but that's still pretty awful imo. I personally find the code base to be very hard to follow too but that may be more my lack of ever doing anything with Zend framework and it's MVC / Plugin stuff.
  6. The overhead of SSL is mainly just extra CPU usage from all the data having to be encrypted/decrypted by the server at each request, and extra bandwidth costs because the encryption inflates the size some. It doesn't really effect the actual processing of the page such as your SQL queries and what not as they are not involved with the SSL process. Basically SSL only effects data you echo out, and the incoming request data. Pretty much. It is possible to pass the session ID through the URL, and there is even an option in the php.ini file to automatically re-write links and forms to include the ID, but this is generally considered bad pratice as it makes it more likely for the user to inadvertently pass their session to someone else (sharing a link) and might cause fixation problems if a search engine stores your site with a particular ID and references that ID is results. Because of those issues it is generally recommended that you require the user to use cookies to pass the ID, and only accept a session ID from a cookie and not the URL. I believe PHP is configured this way by default these days. You don't have to do anything with it if you don't want. PHP handles it all behind the scenes when you call the session_start() function. For requests without a session ID it generates a new one and creates a new empty session. For requests that include an ID it will load that session from the temp file matching that ID. If by some chance that file does not exist, it acts as if it's a new empty session. Basically. This is where some of the other protection efforts might come in (checking the user-agent, ip address, etc) if you want make the extra effort. Generally though it's assumed that if you have an ID then you are who that ID says you are. Someone can't really pretend to be you and not have your session id. They need that in order for the server to consider them you. If by chance the site re-generates IDs periodically and they manage to get one of your older IDs, then what happens depends on how the regeneration is done. If in the process of re-generating the previous ID has it's data file deleted, then the user would just end up starting a new blank session and not be able to impersonate you. If on the other hand the old ID's data file is still intact and still contains your information then they could impersonate you using the old ID. As such, if you want to re-generate ID's for your users just make sure that you delete the old ID's data file as part of the process.
  7. Aside from your comment saying you want fthr * mhr but the code does fthr + mhr, not really it looks ok. I'm assuming that's just a typo though in one of the spots.
  8. Try using a different name for the function, or change/remove the name attribute on your input element. Right now they are the same and it is probably causing confusion to the browser.
  9. You have to break out of your string to do your condition, and use concatenation to join them. echo' <td> <input type="radio" name="subscribesearches" value="Yes" '.($subscribesearches == 'Yes' ? "checked" : "").' ><span class="r-input"> Yes</span> <input type="radio" name="subscribesearches" value="No" '.($subscribesearches == 'No' ? "checked" : "").' ><span class="r-input"> No</span> </td>';
  10. I just use Edit+ and afaik it doesn't really have theme's per-say. You can go in and change the colors but I don't. I used to be a fan of the reverse setups with a dark background and light text but for the last 5 years or so I've just kept it default with a white background. It doesn't seem to bother me anymore like it used it. Maybe because I tend to work in more well light rooms now than when I was a kid, I dunno. On a somewhat related/interesting note, back in the windows 95/98 days I would go into the system and change the default window background color from white to a slighly darker gray color. Ran into a few cases where it would cause some applications to be hard to use because they authors must have assumed that the default background color would always be white. I remember the home page for Yahoo looked kinda funny because they did not explicitly set a page background color and Netscape used the system's default window background color in those instances so it was a gray background for me. Rather than use GIF images and transparency they used JPEG images with a white background, probably to get better anti-aliasing effects I suppose. Didn't come out right on my end though heh.
  11. Nope, got removed according to the changes page, I guess it used flash and people didn't like it. Aparently it's been replaced by a thing where you can double-click anywhere in the code block and it will convert it to a textarea and select everything so you can just double-click then ctrl-c. Seems like a nice mod, would be nice to have some line numbers for sure.
  12. However, it's not setting the $_REQUEST like we thought it would. The only reasons why $_REQUEST wouldn't have the same keys as $_GET is because either 1) Your php.ini has a non-standard configuration causing get to be excluded or 2) Your code is doing something to change it at some point That said, It's generally considered a good idea to be more explicit about where you get your variables from and use $_POST or $_GET and not use $_REQUEST. That way it is clear how they are being delivered and reduces the chances of someone passing stuff in ways they shouldn't.
  13. Don't bother even closing the connection to mysql. Just delete that line from all your functions. PHP will close it automatically when the script ends. Constantly closing and re-opening a connection to the DB over the duration of a script is a waste of time and resources, not to mention a pain to manage.
  14. I don't think there is a way to send both a file and form-data through the .send method at the same time. You'll have to send your action through the query string like the first example in my previous post. Since $_REQUEST in php contains both get and post variables your php script should still work the same.
  15. If you want to do transactions you have to go with InnoDB, so that pretty much makes your choice for you. MyISAM does support concurrent reads and inserts, but only under certain conditions. Mainly that the table does not have any "gaps" in it's data area from row deletions. So if all your doing is inserting/selecting/updating and not running any delete queries then you should be able to still read from the table while you have inserts going. Otherwise if you are deleting stuff your selects may be blocked until there are no pending inserts or no more gaps in the data block.
  16. It depends on if you want it to be sent as POST data or GET data. For GET data you'd just append it to the URL as part of the query string: xhr.open("POST", 'register/verify_registration?action=check_registration', true); (Just because your using the POST method doesn't mean you can't have GET variables.) Or to send it as post data you pass it to the .send method, but you also have to set some additional headers var data='action=check_registration'; xhr.open("POST", 'register/verify_registration', true); xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhr.setRequestHeader('Content-length', data.length); xhr.send(data);
  17. This topic has been moved to MySQL Help. http://forums.phpfreaks.com/index.php?topic=362164.0
  18. You just need to include a GROUP BY for the username. SELECT username, SUM(b.win_points) as total_points FROM users AS u LEFT JOIN betting AS b ON b.user_id = id GROUP BY u.username ORDER BY total_points
  19. An improperly configured apache server will parse a file such as badimage.php.jpg for PHP code still. It is still possible to upload php code in an image even with a getimagesize check though by including it in meta data. Getimagesize or the fileinfo extension is just a better method of determining if the image is at least valid and prevent your script from trying to resize a .exe or something like that.
  20. If you want to output an Excel document, you cannot output anything else such as HTML for a page. You can only send one document to the browser per request so you can send either a HTML page or the Excel file, but not both. Is this stuff showing in the browser window or is it actually opening excel and showing it in the excel window? If the former, then you probably have output before your header() calls which means the headers indicating the excel content are ignored (you should see a warning unless you have error reporting turned down/off). If the latter, possibly you have extra junk after the excel document (your html page maybe) so excel is opening the file as a text file? I would have expected it to complain about the file being invalid instead but never tried such a thing so not sure how it'd react.
  21. There are a couple ways to do an image gallery, the way you were reading about where it suggest scanning the directory is probably for when you upload the images your self via FTP and then just point the gallery script at that directory. If you want to do your own image upload process via HTTP uploads you can do the thumbnails / descriptions at that time if you want, there is nothing wrong with that really. I personally prefer to do thumbnailing as part of the image viewing process. That way if you need a new thumbnail size, or a thumbnail gets deleted after/never created during the upload it will still get created on the fly. I do this with a caching process so it does not have to re-generate the thumbnail every time. I save a new copy of the image in the folder with a name that looks like $originalFilename.'_'.$newWidth.'x'.$newHeight.'.'.$extension, so for example it might be AtTheParty.jpg_640x480.jpg. That makes checking for an image of a particular size as easy as a file_exists check, and also allows for arbitrary sized images incase you end up later on needing images of different sizes (layout change for example). I have exactly the same issue with adding the details to the database. The tutorials I have read suggest scanning the directory and then inserting, but I would assume it would be more foolproof to insert the details as part of the upload process. You'll just have to either find or track all the images and their thumbnails and run an unlink call on each one. If you were to do a naming scheme like I typically do you could just run glob with the pattern to find the files. eg: $files = glob($originalFilename.'*x*'); unlink($originalFilename); foreach ($files as $thumb){ unlink($thumb); }
  22. The posted code works fine for me, returning: Array ( [CONTENT] => This is ClassAThis is ClassB ) Make sure you didn't miss the . in your .= operator. That sounds like the most likely cause of what you're seeing.
  23. Assuming they are integers, there is nothing wrong with just embedding them in the query. There is no way to bind a "list" value so to speak. What I typically do is just run them through intval and then implode them to a string and call it a day, eg: if (is_array($id)){ $id=array_map('intval', $id); $sql .= 'tablePK IN ('.implode(',', $id).')'; } The only way to do it with actual parameter binding would be to add a separate bind for each element, as in tablePK IN (:id1, :id2, :id3) then bind each param separately. You could do it with a couple foreach loops but it's not necessary for INT values. I will do that if the value is a string, but that is fairly rare.
  24. Never have, probably wont either. For two reasons. 1) I dunno where I'd put a stone wall and 2) I'm sure I'd suck at it. I never was any good at tetris and it's kind of a similar thing, gotta put the right shaped stones in the right places. I'm somewhat of a poor builder in general. Everything always ends up very amateurish looking with various problems. The last thing I "built" was some flower beds next to the house. The ground and bricks are not very level. no matter how much I tried to get them level it seemed to never work out. It's not terrible looking, but it could be a lot better. Before: After:
  25. make is a function that you have to call to get the object. Your not doing the call part and just trying to use it as an object directly which is incorrect. Also your property names age and string need to either be encased in quotes so they are viewed as strings, or you need to use the dot-operator syntax rather than brackets to access them. var o = make(); //Calls the make function which returns the object and stores it in o. document.write("<h1>" + o.age.string + "</h1>");
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.