CMXX - Include API authorization in index

This commit is contained in:
“VeLiTi”
2025-02-04 13:03:27 +01:00
parent fa09268cd8
commit 8201d7804b
2 changed files with 15 additions and 17 deletions

View File

@@ -1,21 +1,7 @@
<?php
// Prevent direct access to file
defined(security_key) or exit;
//=====================================
// MOVE TO INDEX
//=====================================
//LOGIN TO API
$data = json_encode(array("username" => "paul@veliti.nl", "password" => "test1234"), JSON_UNESCAPED_UNICODE);
$responses = ioAPIv2('/v2/authorization', $data,'');
//Decode Payload
if (!empty($responses)){$responses = json_decode($responses,true);}else{$responses = '400';}
$clientsecret = $responses['token'];
$img_url = substr(api_url, 0, -8);
//=====================================
//end move to index
//=====================================
//Pagination
$current_page = isset($_GET['p']) && is_numeric($_GET['p']) ? (int)$_GET['p'] : 1;
$num_products_on_each_page = 25;
@@ -121,7 +107,7 @@ $view .= ' <div style="margin-top: 30px;display: flex;align-items: center;align-
';
foreach ($categories as $categorie){
if ($categorie['parent_id'] == '0' && $categorie['status'] == 1 && $categorie['filter'] != 1){
$weburl = url('index.php?page=test&category='.$categorie['rowID'].'');
$weburl = url('index.php?page=products&category='.$categorie['rowID'].'');
$view .= '<a href="'.$weburl.'">'.$categorie['name'].'</a>';
}
}