Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. Why don't you just use a column of type timestamp?
  2. *it seems like I'm repeating a lot of what mjdamato wrote, but I swear I was writing this at the same time he was * Yes, md5 is a 1-way hash. Hashes are used in a lot of different ways and were really designed to help fingerprint data or provide checksums. People still gravitate towards it because it is a fast computation and has been widely implemented. For example, in redhat linux's RPM system, when you generate a package, md5 is used to fingerprint every file in the package. This can later be used to determine if a particular file that came in the package was changed since the time it was originally installed. The benefit of using it for a password is that it absolves you of responsibility or ability to look at someone's password, which over time has become the generally accepted best practice. Just for the record, you do have the alternative of using sha1 which is cryptographically stronger than md5. I don't want to overstate the issue however. What many people seem to miss is that the weak link is typically someone's password. So if you allow a system to brute force attack your site trying different accounts and using a table of passwords there is a good chance they will determine the password for any number of users. That is a far more likely scenario, and requires code and strategies to prevent it from happening.
  3. The assumption in using a salt is that some other mistake will have been made (a SQL injection usually) that in some way discloses the md5 hash. Otherwise, I agree with the comments made in the previous replies. You should use a salt, however it's just an additional degree of protection. What you're really trying to do is avoid a worst case scenario where your entire user table leaks out, and you become the source for people reverse engineering the passwords of all your users. This is certainly a bad situation but not as bad as one where you have the raw md5 hashes that allow anyone with a rainbow table determine what your user's password is, which can then be used to attempt logins at the user's other sites like facebook, gmail etc. Most people use the same password across multiple sites. With the salt applied, someone would have to generate an entire new table using the salt, which is also why it's much better to have a salt per user.
  4. Debbie, You have repeated the same question 3 times. Did you *read* my first reply? Did you read my followup? There is nothing to talk about in the abstract. We get it.. you have a menu and you want the content div to change. Are you interested in how to do that? If so, I provided the answer for you. It does not require a database and could be working for you in about 10 minutes time. Summary: 1 php script "Index.php". Contains the header/footer/sidebards etc. + small block of php that loads the content div using a url parameter. Other scripts/pages only need to have the content that goes into main section. That is the answer to your question in regards to how to do what you are asking for. No you won't have 18 redundant pages. You have 1 that contains your layout and the logic to be able to load in the appropriate content page. Code for index.php br /> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 3 equalising column min-max with sticky footer News Breaking Local U.S. World Politics Local White House Congress Gov't Elections Business Economy Markets Investing Small Biz Jobs Real Estate Sports NBA MLB NFL NHL NCAAF Golf Travel U.S. S. America Europe Africa Asia Australia Tips Weather Current Forecast U.S. News Records Opinion Debbie D. Frank S. Suzy Q. Jane D. Staff Reader Comments Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : Other content goes here : $article = basename($_GET['article']); $basepath = ''; $baseext = '.html'; $filename = $basepath . $article . $baseext; if (file_exists($filename)) { include($filename); } else { // Someone tried to screw with your system or there is a bad link. } ?> Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : Adverting goes here : footer Note the url for the Breaking news link. That is the only one I changed for the purpose of demonstrating how this works. new file named "breaking.html" This is breaking news Today we coded up some php. Put this in the same directory as the index.php, which should be in the same directory as your original html file. Click on Breaking news link... see content.
  5. You didn't provide the information I requested.
  6. Hey aabid, Did you read the oop section of the php manual? I think you need to really understand the mechanics of php oop really well before taking on design patterns, and it's possible that trying to kill two birds with one stone is not the best approach.
  7. What I provided is still my answer to your question The only thing I think that would be of further help would be for you to post the html you have, and have me take that and insert the code and then have you run it on your own site. Not having seen any of your current markup, I made educated guesses as a placeholder for what you might actually have. I used "article" as the parameter, but you could use page if that makes you more comfortable. In order to understand what I suggested you do need to understand url's and in particular url parameters. PHP's mechanism for giving you access in your php script to url parameters is the $_GET superglobal array. I do realize you are a self admitted rank beginner here, so I provided minimal code that does not involve oop or mysql or anything like that -- purely some simple file handling and include(). Include basically does what the name suggests. If you have a file and you include a file, it is as if you had the contents of the file, and at the point where the include() happens, you will have a file exactly as if someone had copy/pasted the included file into it at that point.
  8. Maq deserves the php "e-knight" badge for defending my honor. Thanks amigo But back to the important part of my reply, which is -- please for all that is good and right in the world of php development, lose all the null strings!!!!!!!!
  9. There has already been a couple of takes on this problem -- expertsexchange, yahoo answers and more recently stackoverflow. I'm not holding my breath that this site will morph into something like either of those sites, but of the two stackoverflow certainly has the more creative and fun take on reputation.
  10. Glad to hear you have made so much progress, and that we helped out.
  11. Mod-Jay, The problem is that line before is missing the ';' at the end. However, I have to ask why are you concatenating a bunch of empty strings there? There is no reason for that, just pass your parameters in there... php does typcasting on the fly.
  12. I think litebearer might have misinterpreted that comment. It only referred to some sample gd code. There is no problem doing .gif or png files with the library you are using as far as I can see. It supports jpg, gif, bmp and png. I really don't know what the issue is. What does it say when you run phpinfo() in the gd section?
  13. When you have an array you can foreach through it. $tags = explode(' ', $_POST['tags']); foreach ($tags as $tag) { // do some mysql stuff here } As to what the actual queries should be, that depends on your database structure. You haven't provided us any information on that and there are a variety of approaches to take.
  14. Your posts model should be sophisticated enough that you can pass a parameter that is the equivalent of adding a WHERE clause to it that limits the result set to just the universe of posts for that section. This seems like a database design question. Each controller would pass the applicable constant. There is no value in my opinion to trying to make something generic there. You have to write a controller and passing the appropriate "posttype" is not going to change once you've written the controller.
  15. It seems to me there are 2 parts to your question. The first part concerns oop. Do you absolutely need to use oop? No. There's no great barrier to oop and many advantages in my experience, so I gravitate towards it, but if it's not something you are fluent with and it's not 2nd nature to you to write oop based code at this point, you are not breaking any taboos by sticking with procedural code. The 2nd question involves structure. How you structure your code, where you put includes and things of that nature is a choice. You can have one giant script with everything in it, or you can choose to have a number of different scripts as well as scripts in different directories. It's really an organizational question. The argument about mixing logic with markup is a much more important one. When you have if-then-else constructs that are pages long it is a lot harder to see the forest for the trees when you have to later edit those files. It's just a lot better to put the markup in seperate files that you include as needed.
  16. Ok, so it's great to see that you're interested in learning how to build your own site technology from the ground up. In terms of what I provided, I just took what nicholas offered and addressed your question, throwing in my own 2 cents. I'm not sure if there's a clear outstanding question based on this reply chain. What I offered allows you to: - have all your existing html + css work in a file that is mostly what you already had - Have separate articles in .php or .html pages (my example assumes .html pages that can be updated as simply as adding a new one to your site. - do so with a modicum of security. If you have any questions about any of that please feel free to ask Any functions i used can easily be reference by putting in www.php.net/functionname
  17. I forgot to add that you would name this "controller" index.php, so that it is the default page for your site.
  18. Hello Debbie, First off I want to ask you why you dismissed the use of wordpress out of hand? I'm no great fan of wordpress, however, based on your description it sounds like it offers everything you are asking for out of the box. The only effort involved (and I understand that it is non-trivial for someone who doesn't understand php or programming) is to translate your design into a wordpress template. Second, Nicholas pretty much gave you the bare-bones minimalist answer to your question in terms of the mechanics, but what I'd suggest is to implement a simple controller that takes a single url parameter of article. www.yoursite.com?article=your_article_title So what you would do at that point is take your site and create a master template. This will be 99% the existing markup you have. You can start by making a copy of the article html you have and renaming it to .php. One of the great things about php is that you can intermix php and html by dropping in and out of php by putting the start and end tags where you need them. So rather than splitting everything into its own seperate include file you can instead just have the article section inside a php block. // your existing markup $article = basename($_GET['article']); $basepath = '/path/to/articles/'; $baseext = '.html'; $filename = $basepath . $article . $baseext; if (file_exists($filename)) { include($filename); } else { // Someone tried to screw with your system or there is a bad link. You might want to return a 404 error or show a default article } ?> ... the rest of your markup This code has a few basic security measures built in and assumes that you will name are your articles as "title.php" or "title.html".
  19. All you really need is explode to get the words into an array, and a routine that builds a mysql insert statement.
  20. Let's see your code then.
  21. Just to address this first question, you have to realize that you are not doing enough to entice people to join up and play the game. At very least you need some screen shots and information about what the game looks like when they actually register.
  22. Take a look at jqueryui datepicker. http://jqueryui.com/demos/datepicker/
  23. That makes no sense. "exit" tells the script to stop executing. You can look this up on php.net.
  24. That is the pass-by-reference operator. If you don't use that, variables are passed by value, which is to say, that a copy of the variable is made. Once the function concludes the copy is disposed of. With pass by reference, the actual variable is passed into the array, and any changes made to it inside the function will be retained when function execution is completed.
  25. It's pretty clear from the start of that snippet "exit;==1)" that you have provided something out of context, or that code is just completely wrong.
×
×
  • 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.