Can you tell me about this code

Can you tell me if this code sends email notifications?

<?php 
if (IS_LOGGED == true && empty($_GET['id'])) {
    header("Location: " . PT_Link(''));
    exit();
}

if (empty($_GET['id']) || empty($_GET['u_id'])) {
	header("Location: " . PT_Link(''));
    exit();
}

$email_code = PT_Secure($_GET['id']);
$username = PT_Secure($_GET['u_id']);

$check_for_code = $db->where('username', $username)->where('email_code', $email_code)->getOne(T_USERS);

if (empty($check_for_code)) {
	header("Location: " . PT_Link(''));
    exit();
}
$email_code = sha1(time() + rand(111,999));
$db->where('username', $username)->update(T_USERS, array('email_code' => $email_code));
$link = $email_code . '/' . $check_for_code->email; 
$data['EMAIL_CODE'] = $link;
$data['USERNAME'] = $username;
$send_email_data = array(
	'from_email' => $pt->config->email,
	'from_name' => $pt->config->name,
	'to_email' => $check_for_code->email,
	'to_name' => $username,
	'subject' => 'Confirm your account',
	'charSet' => 'UTF-8',
	'message_body' => PT_LoadPage('emails/confirm-account', $data),
	'is_html' => true
);

$send_message = PT_SendMessage($send_email_data);
header("Location: " . PT_Link('login?resend=true'));
exit();

what does it do?

I look forward to your help/reply

It looks like it calls the PT_SendMessage function passing it the $send_email_data array when the code makes it that far.

thank you

Would you be interested in telling me what this code does?

<?php 
if (IS_LOGGED == false) {
	header("Location: " . PT_Link('login'));
	exit();
}

$pt->page = 'messages';
$pt->title = $lang->messages . ' | ' . $pt->config->title;
$pt->description = $pt->config->description;
$pt->keyword = $pt->config->keyword;

$chat_id = 0;
$chat_user = array();

if (!empty($_GET['id'])) {
	$get_user_id = $db->where('username', PT_Secure($_GET['id']))->getValue(T_USERS, 'id');
	if (!empty($get_user_id)) {
		$chat_user = PT_UserData($get_user_id);
		if ($chat_user->id != $pt->user->id) {
			$chat_id = $chat_user->id;
		} else {
			$chat_user = array();
		}
	} else {
		$chat_user = array();
	}
}

if (empty($chat_id)) {
	$html = PT_LoadPage("messages/ajax/no-messages");
} else {
	$messages_html = PT_GetMessages($chat_id, array('chat_user' => $chat_user, 'return_method' => 'html'));
	if (!empty($messages_html)) {
		$html = PT_LoadPage("messages/{$pt->config->server}/messages", array('MESSAGES' => $messages_html));
	} else {
		$html = PT_LoadPage("messages/ajax/no-messages-users");
	}
}

$users_html = PT_GetMessagesUserList(array('return_method' => 'html'));
if (empty($users_html)) {
	$users_html = '<p class="empty_state"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-users"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="9" cy="7" r="4"></circle><path d="M23 21v-2a4 4 0 0 0-3-3.87"></path><path d="M16 3.13a4 4 0 0 1 0 7.75"></path></svg>No users found</p>';
}

$pt->chat_id = $chat_id;
$pt->chat_user = $chat_user;

$sidebar = PT_LoadPage('messages/sidebar', array('USERS' => $users_html));
$pt->content = PT_LoadPage("messages/{$pt->config->server}/content", array(
	'SIDEBAR' => $sidebar,
	'HTML' => $html
));

I look forward to any help.
Thanks again

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.