About the wonderful problem of account activation,
Ask the great God my this piece of code has what problem, before good, but now appear inexplicable problem, editor is NetBeans, also reinstall.
Now the runtime can execute to the second _query function, that is, the operation of the database is successful, and then skip the Mysql_affected_rows () that segment directly executes the following else {
_alert_back (' illegal operation ');
}
if (Isset ($_get[' active ')) && $_get[' action '] = = = ' OK ') {
$_active = _mysql_string ($_get[' active ');
if (Mysql_fetch_array (_query ("Select tg_active from Tg_user WHERE tg_active= ' $_active ' LIMIT 1"), Mysql_assoc)) {
Set Tg_active to Actived
_query ("UPDATE tg_user SET tg_active= ' actived ' WHERE tg_active= ' $_active ' LIMIT 1");
if (mysql_affected_rows () = = 1) {
Mysql_close ();
_location (' Account activation successful ', ' login.php ');
} else {
Mysql_close ();
_location (' Account activation failed ', ' register.php ');
}
} else {
_alert_back (' illegal operation ');
}
}
------to solve the idea----------------------
Check your code, it should be
if (Mysql_fetch_array (_query ("Select tg_active from Tg_user WHERE tg_active= ' $_active ' LIMIT 1"), MYSQL_ASSOC))
This segment is problematic and you're sure there's an implementation to the _query stage
if (Mysql_fetch_array (_query ("Select tg_active from Tg_user WHERE tg_active= ' $_active ' LIMIT 1"), Mysql_assoc)) {
Set Tg_active to Actived
_query ("UPDATE tg_user SET tg_active= ' actived ' WHERE tg_active= ' $_active ' LIMIT 1");
if (mysql_affected_rows () = = 1) {
Mysql_close ();
_location (' Account activation successful ', ' login.php ');
} else {
Mysql_close ();
_location (' Account activation failed ', ' register.php ');
}
} else {
_alert_back (' illegal operation ');
}
------to solve the idea----------------------
In terms of the code you posted, it's impossible to say what you're saying.
Because
_query ("UPDATE tg_user SET ....")
And
_alert_back (' illegal operation ');
Sub-genus
if (Mysql_fetch_array (_query ("Select Tg_active from ...
Two branches of
cannot be executed at the same time!
Therefore, you can assume that you are not actually running this code