Jump to content


  • Posts

  • Joined

  • Last visited


About Thierry

  • Birthday 12/10/1987

Profile Information

  • Gender
  • Location

Thierry's Achievements


Member (2/5)



  1. Currently I'm working on building a menu at the top of the page. Each item is 12.5% (1/8) in width, with a float:left to keep them nicely aligned next to each other. Another div inside it gives it a border per item, but this doesn't extend the width. In FF and Chrome it works fine, but in IE there's an anomaly when I use overflow:auto on the page itself. Seeing as how FF and Chrome don't show the scrollbar unless it is needed, I want the same for IE. However, when I set overflow:auto on the body/HTML, IE throws the last DIV underneath the other ones, as if the page suddenly lost a few pixels of width. I also noted the menu items don't fill the entire width of the page in IE when maximized, there are a few pixels at the right edge that aren't being filled, but I can't increase the width of the items without getting the same issue. I'm thinking it's some weird IE rounding error and that it can't correctly calculate the widths needed. Examples below, first how it is done right by Chrome (and FF) In Chrome And how it is done by IE, first without overflow: auto; IE no overflow And in IE with overflow: auto; IE with overflow The menu itself as said is very simple. 8 divs with 'width:12.5%; float:left;' and a div inside it that gives it a white border on the right side. Only the last div doesn't have that border, but none of the borders extend the width in any way. If there's a fix for this without having to resort to using position absolute and creating 8 separate classes with the right positions, I'd love to hear it.
  2. I'm currently trying to hash a password value with a salt and then encrypt that with MD5 several times. Right now I'm using this function I made. // Encrypts a key using MD5 and strengthens the key by the given amount of bits function encryptMD5($string, $bits = 0, $msecDelay = 0){ // Encrypt the string as normal $encrypted = md5($string); // Start looping for($i = 0; $i < pow(2, $bits); ++$i){ // Start encrypting $encrypted = md5($encrypted); } //We might want to pause the script for a while in case of a brute force attack usleep(($msecDelay*1000)); //Return the key return $encrypted; } It works fine, but I was wondering what I should store in my database. The main reason I use this is so that you can't use a rainbow table on the password in the cookie/session. However, currently I'm only storing the salt itself and the fully hashed password+salt value in the database. This means however that when someone logs in, I have to hash their password with each salt to try and get a match. If I end up with a lot of users, this could mean dozens or hundreds of salts to cross check with. Should I store an MD5 value of only the password itself without the salt in my database rows for quick matching? If the database ever got hacked, they could see the salt anyway, so having a single MD5 hash of the password in only the database (but not the cookie) shouldn't hurt, right? All I really want to achieve is to avoid having bad people quickly determing the password via the MD5 hash in the session/cookie.
  3. You already have the URL itself (where you're uploading it) All you'd need to do is create a table with unique ID and the url in a varchar field. You could that in the same if() that you are echoing 'has been uploaded' in. Something like... mysql_query("INSERT INTO uploaded_images (image_url)VALUES('uploads/".$_FILES["pfrontimage"]["name"]."')") or die(mysql_error());
  4. There's always the option to use an array and check with in_array or something like that. Don't know about performance and such though. if(in_array($var,array("value1","value2","value3)) { }
  5. If you really need it to be sent with a form, rename the select field to 'gotcha-type fake' and add a hidden input field with the actual name 'gotcha-type' with value you need.
  6. Might have to do with it being an integer, printing them won't give a result. Try to adding "". before it and see if it works then.
  7. I'm aware that abstract classes can't be instantiated (that's what it's for), I was more curious as to whether or not to keep it that way when faced with generic functions/methods. Looks like keeping it static/abstract and doing Date::Format is the way to go. I suppose the other way would be to make an object out of literally everything so that a new date value becomes a Date object with $date->Format on it. Would make even the simplest operation a lot more complicated though, as I'd have to do stuff like $int->getVal() just to get the value of an int.
  8. I have some generic functionality in my application that I'd like to put into classes, as currently all the functions are in a single php file which is then included. However I'm not sure whether or not I should make the class abstract (or should I even use a class). For example, my application comes across dates all the time and has to swap them between the ISO format of YYYY-MM-DD and the format of DD-MM-YYYY or MM-DD-YYYY. Another function for dates checks if it's a valid one and yet another translates any given date to seconds. I'd rather put such functionality under classes, but I was wondering how that should be done. On one side I feel it should be abstract and made available everywhere, so that you can simple do a 'Date::Format($date)'. Since there is no need to create multiple instances of the class, abstract would seem to do fine. Still, this leaves me to wonder what the point would be of using a class only as abstract without extending it (aside from some encapsulation and class constants). The other way would be to keep it not abstract and create an instance either once at the top or each time for each page and use '$Date->Format($date)' This example is ofcourse just with dates, I have quite a few more for strings, numbers etc. What should I do? Where does generic functionality that an application will use everywhere fit in OOP?
  9. $word->version returns version 12.0, don't know if that's any help. On php.net I thought I found the answer However, after trying this and using both interactive user or admin user, it still gives the same error. Don't know if I have to restart something other than Apache before these take effect though.
  10. I'm working on reading the content of a bunch of Word files into a text field in MySQL. My setup runs on Windows and has Word 2007 installed so I figured I could use the .COM object. I quickly found a promising bit of code, but whatever I do I keep getting the following error: Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft Word<br/><b>Description:</b> This command is not available because no document is open.' in C:\Apache\htdocs\XXX\public_html\misc\docReader.php:10 Stack trace: #0 C:\Apache\htdocs\XXX\public_html\misc\docReader.php(10): unknown() #1 {main} thrown in C:\Apache\htdocs\XXX\public_html\misc\docReader.php on line 10 It doesn't crash on the line where it opens the file, but where I want to use the ActiveDocument to read the content. If I deliberatly pass a bad path to a file, it gives a different error, so it does seem to be able to find the file. The code is as followed. $word = new COM("word.application") or die ("Could not initialise MS Word object."); $word->Documents->Open(realpath("test.doc")); // Extract content. $content = (string) $word->ActiveDocument->Content; echo $content; $word->ActiveDocument->Close(false); $word->Quit(); $word = null; unset($word); Is there something about Word 2007 that I'm missing maybe? I've had no problems with .COM on Word 2000/2003, although I haven't used it in quite a while. I've tried Documents->Add, Document[0], Document[1], Document["test.doc"], all to no avail. Any ideas?
  11. Was wondering which is better to use, or more reliable across browsers. The object is a div, and it is created with document.createElement. The id will later be used for a few JS functions, but which one should I use? For as far as I can see doing: divRow.SetAttribute("id", "1") is the same as: divRow.id = "1"; Which should I use, and which is faster in performance?
  12. Ah yes, I didn't modify the position of the Area Shape relative to the image itself, thx!
  13. Hello, I'm trying to create an image map with some countries in it, and although it works if the image itself is static, I need the image to be positioned via left & top, so I need to use position:absolute; However when I do, the image maps cease to work, giving them position:absolute didn't work. Anyone know how to get an image with position:absolute to work with image maps?
  14. Yup, you're correct, I had notepad set on UTF-8, its fixed now, thx.
  15. When I do more then a single require() (also tried include, same deal) I get a strange character "" printed to the page in IE7 (Firefox works fine), which causes a linebreak to occur. Since I may end up using more then a single include/require in my pages I really need to find a fix for this, is it some setting in php.ini? I checked all the stuff I was including and that didnt cause it (merely including a blank piece of text twice causes it). What the requires include doesnt seem to matter, if I do require("page with AA in it") and then require("page with BB in it"), I get "AABB" in my source code in IE7. Note that the first require/include doesnt get the character to show at the end, it seems to show at the start of the second include. Any ideas what could be causing this?
  • 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.