Reputation Activity
-
adamsmith got a reaction from utuxia in mod_rewrite working on my localhost but not livehost...got that covered I think
above my RewriteRules I have...
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
-
adamsmith got a reaction from Neji in Learning Database DesignYou need to learn the concept of "3rd normal form", this is designing a database so that data needn't be stored more than once.
For instance, if you had a website where people signed up and wanted to buy cars they might have to choose 3 car models that they are interested in, this could be shown as such in a users table
1 | Adam | Smith | 23 | Male | *email* | Vauxhall
2 | Adam | Smith | 23 | Male | *email* | Ford
3 | Adam | Smith | 23 | Male | *email* | Toyota
This is inefficient because your database would soon be 5/6 times the size and it would take longer to search and have much the same data, 3rd normal form would split it up as such and turn that 1 table into 3; User, Cars, UserCars
User
1 | Adam | Smith | 23 | Male | *email *
Cars
1 | Ford
2 | Renault
3 | Mazda
4 | Toyota
5 | Vauxhall
UserCars
UserID | CarID
1 | 1
1 | 4
1 | 5
This is a basic example, the joining table links the user to the cars, this method can be used no matter how big the database is or how much information you may have in it.
So start by searching 3rd normal form.
-
adamsmith got a reaction from Leonvv in Learning Database DesignYou need to learn the concept of "3rd normal form", this is designing a database so that data needn't be stored more than once.
For instance, if you had a website where people signed up and wanted to buy cars they might have to choose 3 car models that they are interested in, this could be shown as such in a users table
1 | Adam | Smith | 23 | Male | *email* | Vauxhall
2 | Adam | Smith | 23 | Male | *email* | Ford
3 | Adam | Smith | 23 | Male | *email* | Toyota
This is inefficient because your database would soon be 5/6 times the size and it would take longer to search and have much the same data, 3rd normal form would split it up as such and turn that 1 table into 3; User, Cars, UserCars
User
1 | Adam | Smith | 23 | Male | *email *
Cars
1 | Ford
2 | Renault
3 | Mazda
4 | Toyota
5 | Vauxhall
UserCars
UserID | CarID
1 | 1
1 | 4
1 | 5
This is a basic example, the joining table links the user to the cars, this method can be used no matter how big the database is or how much information you may have in it.
So start by searching 3rd normal form.
-
adamsmith reacted to Renaissance-Design in PHP frameworkA framework is only a set of libraries to make development faster, so you're not having to rewrite form sanitation or a front controller or whatever every time you start a new project.
A CMS is a finished software product for the purpose of running sites.
ExpressionEngine is a CMS written on top of a framework (CodeIgniter).
Edited to add: Any CMS that has an extension architecture will have elements of framework available for the purpose of writing those extensions/plugins/whatever.
-
adamsmith reacted to porkchops in Where do you guys get your backgrounds?http://www.patternify.com/
http://subtlepatterns.com/
I'll work with purchased or free stock photos (after a little photoshop tweaking to fit whatever color scheme we have working) sometimes, but more often than not I'm working on a pure white background with a super subtle texture or pattern.
-
adamsmith got a reaction from Fractal Fragger in htaccess neededTry this...
Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^([a-z0-9]+)*$ index.php?page=$1 [NC]
I think that should work, it should also work for anything such as offer54 and will take the user to ?page=offer54
-
adamsmith got a reaction from oakleaves in .co vs .co.ukWhich do you guys think is better and more 'professional'?
I first bought my .co domain name and have coded the site under that, yesterday I also bought the .co.uk domain name and now I'm too'ing and fro'ing on which should be the main one. I can't afford .com yet as it is £1500 - ridiculous, I hate those companies that buy domain names just to sell on, going off on a tangent is there anyway I can get the .com for a reasonable price?
Anyway, I got the .co as it was supposed to be a good alternative for .com but it hasn't really taken off and seems to have become synonymous with url shorteners, my problem with .co.uk is that my site is an international site and having a .co.uk seems to take away from it's 'internationalness' and makes it seem smaller and less important.
Are there any other alternatives that you guys like using, .net doesn't really do it for me and .org is taken...
-
adamsmith got a reaction from web-itec in htaccess neededTry this...
Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^([a-z0-9]+)*$ index.php?page=$1 [NC]
I think that should work, it should also work for anything such as offer54 and will take the user to ?page=offer54
-
adamsmith got a reaction from jamesosix in Join me on a protectReminds me of this lol
http://www.delvedeeper.co/2012/www.27bslash6.com/333
-
adamsmith reacted to Jason Dexter in Website patentsUsually these patents are for making money, such as serving advertisements much like Adsense, Adwords and Facebooks own advertisement systems. It's not the actual coding as such, its the way everything works.
To be perfectly honest, alot of the patents aren't really to do with their website. Just because they're Yahoo aren't a physical store, doesn't mean they don't "do" other things.
Also, a lot of these companies snap up patents to sell on, much like domain brokering. Yahoo would've probably had good intentions on using these patents but they're being sold to bolster their cash.
To be perfectly honest mate, the only time they will chase you down because it's in conflict with their patent is when you're in competition with them. By that, I mean when you have a revenue of a few hundred million.
-
adamsmith got a reaction from Lovelock in How to sanatize and validate form input.There's a few bits wrong with it, first thing I do is add a blanket sanitisation...
// Function to make general data safe function clean($string_name) { if (get_magic_quotes_gpc()) { $string_name = stripslashes($string_name); // strip slashes if magic_quotes is on } $string_name = trim($string_name); // Trim empty space before and after if (function_exists("mysql_real_escape_string")) { $string_name = mysql_real_escape_string($string_name); // mysql_real_escape_string } else { $string_name = addslashes($string_name); } return $string_name; } // Function to sanitize email data from form function clean_email($string_email) { if (get_magic_quotes_gpc()) { $string_email = stripslashes($string_email); // Add slashes } $string_email = filter_var($string_email, FILTER_SANITIZE_EMAIL); // Sanitize email data $string_email = trim($string_email); // Trim empty space before and after if (function_exists("mysql_real_escape_string")) { $string_email = mysql_real_escape_string($string_email); // mysql_real_escape_string } else { $string_email = addslashes($string_email); } return $string_email; } // Now you can clean all your input for the database $Suggestion = clean($_POST['Suggestion']); $Email = clean_email($_POST['email']); if (empty($Suggestion)) { //use die to end the script otherwise it will carry on die('Suggestion box can not be empty'); } if (empty($Email)) { die('Email can not be empty'); } // This checks the email is valid if (!filter_var($Email, FILTER_VALIDATE_EMAIL)) { die('Not a valid email'); } //Now insert the clean data $sql="INSERT INTO suggestions (Suggestion, Email) VALUES ('$Suggestion','$Email')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Suggestion Added! <br/> Redirecting back to Vinyl Penguin."; mysql_close($con);
That should make it at least safe to insert into your database and does a few checks for you, obviously you can go into a lot more detail but this should get you on your way.
-
adamsmith reacted to Renaissance-Design in does anyone know of a better way...Use cURL to fetch the page and regex to find a lost of porn-related stopwords in the page content. Fairly easy to process on submission.
-
adamsmith reacted to andy9l in Check if URL is real/existsI've just put the two together and come up with this which works for me. Give it a shot...
function domainExists($domain) { $invalid_http_codes = array(0, 404); if(!filter_var($domain, FILTER_VALIDATE_URL)) return FALSE; $curlInit = curl_init($domain); curl_setopt($curlInit,CURLOPT_CONNECTTIMEOUT,10); curl_setopt($curlInit,CURLOPT_HEADER,true); curl_setopt($curlInit,CURLOPT_NOBODY,true); curl_setopt($curlInit,CURLOPT_RETURNTRANSFER,true); curl_exec($curlInit); $httpCode = curl_getinfo($curlInit, CURLINFO_HTTP_CODE); curl_close($curlInit); return !in_array($httpCode, $invalid_http_codes); }
-
adamsmith got a reaction from Sparrow in ~ Rescue me from Table Hell ~Haven't tested anything but try this...
<html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <style type="text/css"> .center1 { background-color:#CCFF33; margin:0px; text-align:center; border:0px; display: block; border-collapse: collapse; } </style> </head> <body> <table cellspacing="0" cellpadding="0" border-collapse="collapse" border-spacing="0" border="0" margin="0" display="block" bgcolor="#000000" > <tr><td class="center1" width="600">Table Cell</td></tr> <tr><td class="center1" width="600">Table Cell</td></tr> <tr><td class="center1" width="600">Table Cell</td></tr> <tr><td class="center1" width="600">Table Cell</td></tr> </table> </body> </html>
-
adamsmith reacted to Nitin Reddy in How many SQL connections is too many?You can never really tell how many queries is too many because you can have a web page that looks like the following:
* A banner image on top from an ad manager script
* The site title pulled from a CMS table
* The home page content obtained from a CMS table
* A sidebar newsfeed obtained from querying a table containing blog posts
* A footer containing links obtained from another CMS table
These are 5 queries right here so if you compare that to a static HTML page that has no database interaction at all, you are looking at two very different pages right there. You can also have a 'chat' page that makes a database query every 20 seconds so there could be over a hundred database queries being made by that page (though, ideally, one shouldn't built a chat application in this manner the world is less than perfect).
If you aren't experiencing any kind of a performance problem or foresee a performance problem in future, you probably don't need to bother about the number of queries or the number of connections because the effort you put into it may not really pay off... though if you can do it right, you should, as it would be a great learning experience.
-
adamsmith got a reaction from Tex0gen in Select * from 2 tablesWell you can either do 2 seperate SQL queries, or do 1 query with a UNION ALL operator.
-
adamsmith got a reaction from Tex0gen in Select * from 2 tablesSorry that's my mistake.
Well as far as I can see there is a couple ways you can go about it.
Using 2 SQL queries is perfectly fine, there is nothing wrong with it.
Or
You could insert the data into the applications table first then do a union select on that table since you will be creating a link between the person and the job.
I think you should just stick to using 2 SQL queries though. Are you sure that you aren't calling the same data from another part of the site for the user such as login where you could capture the CV data and maybe store as a SESSION. Then you would only need to use the one query for the job.
-
adamsmith reacted to Jay Gilford in comparing stringsWell first and foremost, your original code will never output "match". strcmp returns an integer, so '0' will never match when the strings do. You need to remove the quotes from around it
As for them being identical, yes they will work just the same if you make my edit above. Note that you also don't need the third = in your first example either, since it's always going to return an integer
-
adamsmith reacted to Renaissance-Design in Zend & phpMyAdminYup. That'll stop you having to change it all the time. You can also set display_errors to a looser value in your dev install.
-
adamsmith reacted to ReformedGeek in Should this be 1 table or 2Hi Adam
The more correct way is to have three tables. A members table, a specialities table, and a linking table members_specialities. They would have the following fields:
Members (UserID, First_Name, Last_Name, Email_Address.... etc)
Specialities (SpecID, Spec_Name... etc)
Member_Specialities (UserID,SpecID) This would have a compound primary key.
This structure is closer to third normal form and solves a number of issues:
1. You don't have to change the table structure or code to add a new speciality or remove one
2. Allows you to store multiple specialities in the future
3. Joined queries can be constructed more easily to use the tables for different purposes
It's a bit more coding but the code will be easier to understand and adapt in the future.
Hope this helps
Gareth
-
adamsmith reacted to mrchristoph in Why does my site not stop loadingCome on it's not hard if you can search on google:
http://www.######.com/forum/announcements/2160-disabling-analytics-code.html
Goddam hashes again, anyway search on google for "0 0 0 webhost remove tracking"
-
adamsmith reacted to zed in count() isn't equalling 0http://www.brightcherry.co.uk/scribbles/2008/09/06/php-count-files-in-a-directory/ -
adamsmith reacted to Barth in large text boxesNormal CSS should do it
resize:none;
-
adamsmith got a reaction from vernz in Profile Websitecorrect, but to be able to view other peoples profiles you instead need to have something like,
SELECT * FROM users WHERE UserID = $ID
then $ID can be set from a $_GET function or from the $_SESSION['ID']
and pull all the information that way, otherwise you would only be able to see your own profile once you are logged in.