Forum Moderators: coopster
{
// Run a query to activate the account
$activate = mysql_query("UPDATE users SET activated='1' WHERE id='$id'");
die("Your account was successfully activated");
}
else
die("Invalid ID or actication code!"); UPDATE users SET activated='1' WHERE id='17'; // Run a query to activate the account
$activate = mysql_query("UPDATE users SET activated='1' WHERE id='$id'");
die("Your account was successfully activated");
die("Your account of ID : $id was successfully activated"); <b>Your account of ID : 17 was successfully activated</b>
Matthew1980: Also (I see this so often it really surprises me) the int's that you're using need to be UNQUOTED as sql will treat this as them being int's then, quoting int's turns them (for sql reasons I can't recall right now..) into strings type. This will play havoc in your overall DB design.
A common mistake is to protect only string data values. Remember to check numeric data as well. If an application generates a query such as SELECT * FROM table WHERE ID=234 when a user enters the value 234, the user can enter the value 234 OR 1=1 to cause the application to generate the query SELECT * FROM table WHERE ID=234 OR 1=1. As a result, the server retrieves every row in the table. This exposes every row and causes excessive server load. The simplest way to protect from this type of attack is to use single quotation marks around the numeric constants: SELECT * FROM table WHERE ID='234'. If the user enters extra information, it all becomes part of the string. In a numeric context, MySQL automatically converts this string to a number and strips any trailing nonnumeric characters from it.