Reputation: 1099
So I have this function register_user
in a php file called functions
, this function has been used to activate user who register on my website.
function register_user($register_data) {
array_walk($register_data, 'sanitise_array');
$register_data['password'] = md5($register_data['password']);
$fields = '`' . implode('`, `', array_keys($register_data)) . '`';
$data = '\'' . implode('\', \'', $register_data) . '\'';
mysql_query("INSERT INTO `mock_exam_users` ($fields) VALUES ($data)");
email($register_data['email_address'], 'Activate your account', "Hello " . $register_data['first_name'] .",\n\nTo activate your account, click on the link below or copy and paste the URL on to your browser.\nhttp://7ea8d47c.ngrok.io/mocktime/activate.php?email=" . $register_data['email_address'] . "&email_code=" . $register_data['email_code'] ." \n\nmockTime");
}
Within my login page where I check for validations when user logins, one of my check is to check if the user has activated their email.
if (user_active($email_address) === false) {
$errors[] = 'Email Address is not activated !';
}
I would like to know if there is anyway I could pass in the register_user
function within this if statement as an alternative way of re-sending the email.
I hope I described the problem in good detail, however if you guys need any more details please message.
Upvotes: 1
Views: 55
Reputation: 508
Short-answer:
require_once('file_containing_registered_user.php');
Upvotes: 1
Reputation: 605
First include functions.php file and then call register_user function with parameters:
Include("functions.php"); register_user(data);
Upvotes: 1