<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1054610" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1054610</link>
    <description></description>
    <language>en</language>
          <item>
    <title>ensure you setup the db</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/php-login-and-form-questions#comment-1281379</link>
    <description> &lt;p&gt;ensure you setup the db fields to only store the type of data it is suppose to.&lt;br /&gt;
ensure you escape all session vars ($_REQUEST/$_POST/$_GET)&lt;br /&gt;
ensure you escape all sql queries&lt;br /&gt;
ensure you strip all malicious characters from form data&lt;br /&gt;
md5 (hash) anything you would like to keep private&lt;br /&gt;
ensure valid use of session/cookie data and keep your sessions clean&lt;/p&gt;
 </description>
     <pubDate>Fri, 02 Nov 2012 00:45:25 +0000</pubDate>
 <dc:creator>Nullified</dc:creator>
 <guid isPermaLink="false">comment 1281379 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>The basic starting point is</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/php-login-and-form-questions#comment-1281335</link>
    <description> &lt;p&gt;The basic starting point is to ensure people are entering data that you want them to, so only data that suits the form field they&#039;re using. &lt;/p&gt;
&lt;p&gt;EG if you have a DATE entry, there should only be numeric chars entered, no alpha or other chars like !&quot;£$ etc. AGE would be numeric only, username you may want to limit to alphanumeric, etc..&lt;/p&gt;
&lt;p&gt;If you start by limiting their entry to what they should be doing, your on the way to maintaining security as you&#039;ll naturally remove their ability to enter various bad chars like apostrophes and quotes,  and also ensure you get useful info too, like alpha only for names, and numeric for dates, age etc.&lt;/p&gt;
&lt;p&gt;You also need to check the total characters they used in a string. So if they&#039;re entering 3 chars for DAY when it should be 2, or 100 chars for name when it should be max 40 etc, you can issue an error to them without even touching the DB with the info, it&#039;s all done in PHP until you&#039;re happy with their data.&lt;br /&gt;
This also ensures users are entering the correct data to suit your database structure. Such as USERNAME may be a varchar(40), so you limit them entering 40 chars, otherwise you end up with a headache in your DB and, for example, logins wont work.&lt;br /&gt;
(HTML&#039;s form &quot;maxlength&quot; is easy to get around so checking in PHP is essential)&lt;/p&gt;
&lt;p&gt;You should always check all data as outlined above before even thinking about accessing your DB.&lt;br /&gt;
Once you&#039;ve sanitised those checks and you&#039;re happy they&#039;ve entered sensible info and data that suits the fields they using, then the script can move on to the DB part and store it.&lt;br /&gt;
It might still be rubbish or nonsense, but there&#039;s no easy way to stop that, important thing is it&#039;ll be safe and correctly formatted to store in your DB.&lt;/p&gt;
&lt;p&gt;As you&#039;re ready to insert, you should also ALWAYS use mysql_real_escape_string on all data before entering into the DB. (although you should be using MySQLi or PDO_MySQL these days)&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;quote-msg&quot;&gt;&lt;div class=&quot;quote-author&quot;&gt;&lt;em&gt;tbcproductions&lt;/em&gt; wrote:&lt;/div&gt;there won&#039;t be any critical personal information in the database other than email addresses and names&lt;/div&gt;&lt;br /&gt;
There is - their passwords are saved in the DB. So make sure you&#039;re hashing passwords before saving (MD5/SHA etc) if your database is compromised and you&#039;re saving in plaintext, all your users&#039; accounts can be accessed by whoever has the data.&lt;br /&gt;
SALT is a more secure addition, but not completely essential unless you have high security requirements.&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;quote-msg&quot;&gt;&lt;div class=&quot;quote-author&quot;&gt;&lt;em&gt;tbcproductions&lt;/em&gt; wrote:&lt;/div&gt;&lt;br /&gt;
If successful, it will take you to the login page... which doesn&#039;t work. Somethings wrong in the code, because no matter what username or password you enter, you get an error, even if the info is correct.&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
Either the PHP code is invalid, or you&#039;re doing something wrong with the data.&lt;/p&gt;
&lt;p&gt;Is the data correct in the database? Echo it out onto the page.&lt;br /&gt;
Are you entering the correct data that matches the DB data?&lt;br /&gt;
Is the final PHP script which attempts login getting the correct data as above two questions?&lt;/p&gt;
&lt;p&gt;Try echoing all relevant variables and printing arrays you&#039;re working with, sometimes it&#039;s something simple/obvious you&#039;ve missed along the way. Showing all the data that PHP is working with behind the scenes that you wouldn&#039;t normally see can highlight the issue.&lt;/p&gt;
&lt;p&gt;If it&#039;s a PHP specific error, feel free to paste the code and we&#039;ll take a look &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;
 </description>
     <pubDate>Mon, 29 Oct 2012 18:52:51 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1281335 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
