-
Posts
3,584 -
Joined
-
Last visited
-
Days Won
3
Everything posted by JonnoTheDev
-
Does the user the script is running under have the correct permissions?
-
changing upload size limits
JonnoTheDev replied to gerkintrigg's topic in PHP Installation and Configuration
http://www.cyberciti.biz/faq/wordpress-to-wordpress-php-import-tweak/ -
I would suggest http://uber-uploader.sourceforge.net/
-
changing upload size limits
JonnoTheDev replied to gerkintrigg's topic in PHP Installation and Configuration
via .htaccess php_value upload_max_filesize 20M php_value post_max_size 20M -
Because a directory needs to be empty before it can be removed. Look at the examples for recursive deletion within the manual. http://uk3.php.net/rmdir
-
Look at the strtotime function. http://uk2.php.net/strtotime Example <?php $date = '2010-06-09'; $next = strtotime("+7 day",strtotime($date)); $next = date("Y-m-d", $next); print $next; ?>
-
I would use FPDF to print the barcode to a generated PDF of a custom 2" x 2" size. From there you can print. http://www.fpdf.org/ The constructor allows you to set the page dimensions. Look at the FPDF method in the manual.
-
This is incorrect. Sessions should expire and be cleaned up by php's garbage collection routine. Cookies do not get stolen as such, it is known as session hijacking where packets are sniffed between requests and the session id is displayed within a GET method. A hijacker would have to intercept packets whilst a user is making requests. An old session cookie should not authenticate.
-
As I said, you use cookies if you want to remember a user. The cookie value will initiate a session. Data persists throughout the lifetime of the session whilst the user is on a site. You would not pass session data through a cookie. For example, if your website takes payments from users, data containing the users credit card details may need to persist through multiple pages. This sort of data would never be stored in a cookie. It would persist in a session and destroyed after it is finished with. You do not use one or the other, you can use a combination of both. But in terms of identifying that a user is logged into a site this is done through a session variable. All your cookie does is reinstate a session if a user was lets say to close their browser and then come back to the site later (as long as the cookie has not expired). If the user doesn't want to be remebered by the site at all (so they login each time they visit) you would not set any cookie.
-
I love that word! http://www.visualcandy.co.uk/prod_images_blowup/pikey_large2.gif There was a recent story about a Polish bus driver in the UK who wouldn't let a young child on his bus because he was wearing an England t-shirt which he found offensive. http://www.dailymail.co.uk/news/article-1281019/Driver-orders-toddler-bus-wearing-offensive-England-football-shirt.html
-
You should not be using cookies to store user data such as usernames / passwords. Cookies are stored on a users pc therefore any malicious software could scrape cookie data. There is no reason to keep a users password persistent throughout a login session. Once a user has entered their login credentials succesfully all you require is to set a session value that identifies that the user is logged in. i.e <?php // validate login data: login.php session_start(); if($allLoginDetailsAreOK) { $_SESSION['loggedIn'] = true; header("Location:my-account.php"); exit(); } ?> <?php // my-account.php session_start(); if(!$_SESSION['loggedIn']) { header("Location:login.php"); exit(); } ?> All pages that require the user to be logged in must check for this value. if it does not exist, redirect the user to the login screen. Cookies are used to remember a user so they do not have to keep logging in each time they visit the site (just as this site does). Usually on a login form you may see a checkbox that says, 'remember me'. Again you would not store private user data in this cookie. A unique key is normally stored in the cookie to identify a user to the website. This function returns the users session key. It can be used if you are using a database as a session handler, or you are recording the users currently on your website. It can also be used to restore a users session if lets say they navigate to another website on your server and you want to restore the users session data from the previous website. i.e <?php session_id($_POST['key']); session_start(); ?> This is because you are outputting data prior to sending a header. Headers must be sent prior to any output. i.e <?php // will throw error print "hello"; header("Location:page2.php"); exit(); // corrected if($_GET['proceed']) { header("Location:page2.php"); exit(); } print "hello"; ?>
-
What! Get your flags out. http://www.google.co.uk/search?q=world+cup&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB:official&client=firefox-a
-
database driven content and friendly URLs
JonnoTheDev replied to glennn.php's topic in Miscellaneous
By using mod-rewrite. Check out some beginners mod rewrite rules by doing a bit of googling. You should make your urls friendly and include keywords to help ranking. i.e If I have an article titled 'Ford Motor Cars' with id 42 then the url may be /article.php?id=42 However, making the url look like /article/ford-motor-cars/42 Is much tidier, makes more sense to google as the content of the page is described in the url, and also increases the chance of a click through by the end user as they can see what they searched for is in the url link. Don't underestimate Google or other SE's. If you mash up a database with 4000 records of random bits of text to create a 4000+ page website where the content doesn't differ so much apart from a few strings here and there or a reworked template, Google is not stupid. It will penalise you. Do not try to put new websites containing thousands of pages together straight away. Google will know it is database driven and penalise you. Websites should grow over time. I would recommend the following book for some help on programming with SEO in mind. If you are creating dynamic websites then you should always have SEO on the brain. If you build a website where it is difficult to incorporate SEO concepts, you are onto a loser straight away. This is not an SEO book but more of a tool for incorporating SEO techniques into your PHP code, for friendly URLs, providing data feeds, etc http://www.amazon.co.uk/Professional-Search-Engine-Optimization-PHP/dp/0470100923 -
LOL. I love the world cup. Can't wait. Beer & football. Perfect.
-
Germany should walk that, although being an Everton fan I will be rooting for Tim Cahill & the Aussies.
-
World Cup Fever!!!!! COME ON ENGLAND. Match predictions? 5-0 England
-
The only recognised PHP certification is from ZEND. Here are the details. http://www.zend.com/services/certification/php-5-certification/ There are no other official certifications, and any that claim to be are not! if you are new to PHP then there is no need for you to be doing any kind of exams. If all you are looking for is to test yourself, then I suggest a book from the likes of O'Reilly where they sometimes have test questions or a practical test at the end of each chapter. You will have to browse Amazon to get more info on each book. Also, there maybe training courses available near you, but be warned they are not cheap. I have attended a couple through these guys http://www.wellho.co.uk/ They are good however it was the company I work for that paid for us to attend. It is not something you would pay for yourself really. If you are a hobbyist or looking to do freelance work then learn from books, online tutorials, and forums like these. Try to answer questions from posts to test yourself, even if you are wrong there will be someone who will correct you and you will learn something new. All I can say is be careful with the online stuff. A tutorial may show you a method for a task but it may not be the best, it may even be bad practice. That is why it is good to have reference books. Stick to the methods shown in a book to begin with, and if the online tutorials are showing a different method then you can ask the questions, ask them here in fact. Good luck.
-
The IT team are probably on strike!
-
I was speaking to a rep from RM last week. The data will be released. I think they are still working on how to make it accessible.
-
The Royal Mail database will soon be open source as part of government legislation. It was set to be open as of April this year, however I have not checked it out. http://news.bbc.co.uk/1/hi/technology/8402327.stm I recently went to a conference where the following were doing a presentation on using postcode data. It is a paid service, but check it out. I have used before and it's easy to implement. http://www.postcodeanywhere.co.uk/
-
<?php class myPDO extends PDO { public function fetchClass() { // return data } } ?> Now they are all true! What a stupid question.
-
I think the publishers just use 6 in the title to make it sound like the book is bang upto date. I've just been looking at a few, and the likes of, 'Beginning PHP 6 & MySQL', type of books have nothing to do with a specific version. As I said the core probably still applies to version 4. It's just a marketing thing, or they resell the same book as last year only with 6 in the title instead of 5.
-
The transition between 2 whole versions takes a very long time so therefore you should be focusing on version 5 (5.2 upwards). There are still many sites running that were written on php 4 that are only just making the upgrade to 5. php 6 will certainly not have a massive feature update on 5 but more of a cleanup and improvement on the existing functions. There are plenty of php 5 books available on Amazon, however even if you buy a book that has version 6 in the title it is most likely still going to focus on topics that are available in version 5 such as OO. It will probably highlight the differences between version 5 and 6 showing parts of code that may only work on the latter version. If it is a beginners book then I would guess the core will still apply to even version 4.
-
What's the best platform for an internet magazine?
JonnoTheDev replied to vinnier's topic in Miscellaneous
That is most likely a bespoke system. Wordpress would be your best option. It is highly customisable.