Calvary Greetings in the name of our Lord Jesus
Christ.
Good site you have here. Anyway, l have a problem that
have been bothering me since the past few months. I am
a newbie in PHP Programming. I am trying to build a
secured user management site with access keys
functions.
The basics of the access is that, l want a user to
enter a valid number among those that are stored in a
database. For instance, in a registration form, let say
there is an activation code that must be inputed into
the registration in the activation code field.
Then user input a wrong code that does not match or
validate among those stored in the activation data
table, then it should return as invalid activation
code. And if it is valid then the user can fill other
informations as well as the username and password in
the registration form.
On verification of a valid activation code, the same
valid activation code should be inserted into the a row
called 'used'.
So if a user tries to re-register with the same
activation code, then mysql and php should check that;
- The activation code is incorrect or invalid at the
activation code row
- The activation code if valid then mysql and php
should check if it has not been used by checking the
'used' row.
Below is the mqsl database:
CREATE TABLE customer (
customerid bigint(32) NOT NULL auto_increment,
username varchar(20),
password varchar(20),
email varchar(255),
activation varchar(50),
used varchar(50) NOT NULL,
fname varchar(255),
lname varchar(255),
gender varchar(50),
dob varchar(100),
address varchar(255),
city varchar(50),
state varchar(50),
zip varchar(50),
country varchar(255),
phone varchar(255),
PRIMARY KEY (customerid),
KEY used (used),
UNIQUE username (username)
);
This should check if the activation code has been used
function checkused($used)
{
$sql = "select customerid from customer where
activation='$used'";
$result = $this->select($sql);
if (empty($used)) {
return 0;
}else{
$used = $result[0]["used"];
return $result;
}
}
I need a code to check if the activation code entered
is valid at the activation row.
I will really appreciate if you can help me solve this
problem.
I shall remain grateful.
Thanks.
Sammie