Jump to content

JonnoTheDev

Staff Alumni
  • Posts

    3,584
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JonnoTheDev

  1. No, I would use a session. Simple. <?php session_start(); /* login attempt */ if(isset($_POST['submit']) && $_POST['submit'] == 'login') { if($_SESSION['attempts'] > 2) { /* redirect to forgotten page */ header("Location:forgotten.php"); exit(); } /* validate user */ if($_POST['username'] == 'foo' && $_POST['password'] == 'bar') { /* successful login */ $_SESSION['loggedin'] = true; unset($_SESSION['attempts']); header("Location:welcome.php"); exit(); } /* failed login */ $_SESSION['attempts']++; } ?>
  2. http://uk.php.net/strip_tags
  3. There is no issue with this as long as you have a properly indexed database table. If you need to obtain the same data on various pages then running the query on every page from a function call is perfectly acceptable. MySQL will cache the query so if the same query is called again it will be much faster. I would store the data in a session if it is part of an authentication process i.e the user has to login. Once their username/password has been accepted, all the information for that user could be put into a session so you do not need any further queries. What you must consider is that if a users data changes i.e they can update their details or email address, you must update the database aswell as the session variable.
  4. Bad, bad, bad. Global variables are to be avoided like the plague. Functions are designed to be called whether you call it once or a hundred times in a script. If you want to change the value of a variable outside the scope of a function you can pass by reference. See the following <?php function foo($x) { return $x+1; } $y = 0; $y = foo($y); print $y."<br />"; $y = foo($y); print $y."<br />"; $y = foo($y); print $y."<br /><br />"; /* pass by ref */ function bar(&$x) { $x = $x+1; } $z = 0; bar($z). print $z."<br />"; bar($z). print $z."<br />"; bar($z). print $z."<br />"; ?>
  5. Nice template design. The only issue I can see is that your product images look poor quality because they are rescaled from 1,200px × 1,200px. I think you should actually resample your images to the actual dimensions set in your XHTML/CSS. This will make the site load quicker as the images are smaller and of the correct dimension. The largest image should only be used where you have the zoomin widget.
  6. I use ioncube. http://www.ioncube.com/ From Ioncube
  7. Just read your thread and i'm sorry that I can't offer advice as I do not know much about the hardware used in top end gaming rigs, however it is interesting you ask as I was watching a video (it was either on ign.com or gamespot.com) recently where they were starting to build the best gaming machine possible consisting of the best components that each manufacturer offers (intel, nVidia, etc). I think the processors cost about £300 each, so the whole setup was probably around the £5000 mark. Unbelievable!
  8. I've had murder with the companies that supply our office PCs. We usually get DELL or HP machines and what happens is we order a machine that has about 8gb of RAM and they ship it with the 32 bit version of the OS, then to say that it is what the machine is installed with. Tossers, why would you pay for a machine with that amout of memory when the OS isn't compatible.
  9. You can use fread() to read portions of the file until what you are looking for has been found. http://uk2.php.net/fread You could import the data from the text file into a database table and use queries to search for required data. Or, you could use a full text search engine such as sphinx http://sphinxsearch.com/ to generate an index of your text file giving you the ability to perform super fast searches. It really depends on the size of the file in question. If it is megabytes then the first 2 options are valid. If it is hundreds of megabytes then the last option would be my choice.
  10. I think I would prefer to actually import the CSV data straight into a flat MySQL table. This can be done easily enough. Then you can loop through the records and insert into your properly normalized tables. Once a record has been processed it can be removed from the import table. This way there is no need to work directly with the CSV file.
  11. You can see from the link that the problem is caused after installing software. In that users case it was Norton AV. So, try uninstalling, re-installing any AV software. Or, the software that is mentioned above, do the same thing. Also you have Limewire, probably used for downloading all kinds of illegal stuff which in my eyes is a minefield for viruses, trojans, etc.
  12. http://uber-uploader.sourceforge.net/
  13. Why not use an online backup service? I have heard really good things about the likes of iDrive, etc. Really secure 2gb for free and you can restore files from anywhere. I also like the idea of the network backup drives that you can plug into your router and access your files from anywhere. http://www.idrive.com/
  14. http://social.answers.microsoft.com/Forums/en-US/w7desktop/thread/0f95be4b-b62f-4d23-bbe5-e3188aa5bda2
  15. Where did you get that information from? nofollow simply prevents Google from passing any pagerank or anchor text keywords through the link. Spiders will not follow the target link from the source. It does not stop the target pages getting indexed if they are linked to from other sites or have been submitted to Google.
  16. LOL. What I would do is, use what you want to do as a reward for getting the important stuff done. So, if you have work that needs to be done, say to yourself, "once I have done this, I can play computer games, or go for a beer". Once you get into the work you should start to focus on what you are doing. If you start playing computer games or watching TV you become lackadaisical and will find it very difficult to turn to something else.
  17. Does your web host allow you to change these values? Do you also know that Apache has a timeout value? Using a standard form file field to upload a file of that size is a bad move. You need a more complex upload procedure. I would recommend using http://sourceforge.net/projects/uber-uploader/
  18. I dunno. I like to have control of when errors display or not so I usually set the option in a config file for each site. I usually have the php ini file set display_errors to on and then when I want them off, use an ini_set directive, error reporting level, in my website config file. I guess it doesn't matter which way round you do it, i.e keep display_errors to off in your ini file and then set them to on using ini_set. Just my preference.
  19. As Thorpe has stated, it supresses any errors that cause the script to exit or display a warning message. It can be used on any function. It should only be used if your script can still continue without the return result of the function. In your case this is a no, because if the function cannot connect to your database, no queries will run. So handle the errors as such: if(!$conn = mysql_connect(/*params here*/)) { // do something such as send an email, write to an error log, print a message to the screen. print "Could not connect to database, sorry about this."; exit(); }
  20. Do you understand how SEO works? Have you looked at Google ads?
  21. Its a good film. Saw it on Sky the other month.
  22. You should get into the habbit of renaming files when they are uploaded through a web form. A good option is to use an md5 hash on a filename so it becomes unique. This is done at the point of upload and then the filename can be saved to your database. This is irrelevant.
  23. Stick to freelance work first to build a portfollio
  24. Simple. Get a wireless router. Connect it to your phone line with the broadband on. Any PC, games console you have with wireless technology will connect to it.
  25. http://www.webidsupport.com/
×
×
  • 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.