FAQ - Hook: php_index_page

Hook: php_index_page

4274


Use this hook to execute PHP code in the index.php file between the page.

For example:

// Confirm user
   	if ($page == 'rf_ual') {
   	if (is_numeric($page1) && is_numeric($page2) && jak_row_exist($page1, DB_PREFIX.'user') && jak_field_not_exist($page2, DB_PREFIX.'user', 'activatenr')) {
   			
   			$result = $jakdb->query('UPDATE '.DB_PREFIX.'user SET access = access - 1, activatenr = 0 WHERE id = "'.smartsql($page1).'" AND activatenr = "'.smartsql($page2).'"');
   		
   	if (!$result) {
   		jak_redirect(JAK_PARSE_ERROR);
   		exit;
   	} else {
   	
   		$userlink = BASE_URL.'admin/index.php?p=user&sp=edit&ssp='.$page1;
   	
   		$admail = new PHPMailer();
   		$adlinkmessage = $tl['login']['l16'].$userlink;
   		$adbody = str_ireplace("[]",'',$adlinkmessage);
   		$admail->SetFrom(JAK_EMAIL, JAK_TITLE);
   		$admail->AddAddress(JAK_EMAIL, JAK_TITLE);
   		$admail->Subject = JAK_TITLE.' - '.$tl['login']['l11'];
   		$admail->MsgHTML($adbody);
   		$admail->Send(); // Send email without any warnings
   		
   		jak_redirect(JAK_PARSE_SUCCESS);
   		exit;
   	}
   		
   	} else {
   		jak_redirect(BASE_URL);
   		exit;
   	}
   	}