• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

AAC QueryString (Maybe) - Help pls

luhfe

New Member
Joined
Apr 26, 2018
Messages
48
Reaction score
2
Bottom to go on page Status.
<a href="?status?refer=<?= $_GET['refer'] ?>">

?status its a .php to call twig
?refer=numbers identification

ulr send
https://exemple.com/?status?refer=numbers

Returns myaac "the page /?status?refer=numbers" not found.


Perhaps because Myaac understands "status" "link to identification" as a single URL name. How do I fix this?

i have try to use :
<a href="?status&refer=<?= $_GET['refer'] ?>">
 
Last edited:
Ty for ur fast rep, if u can explain more about it i'll appreciate...its about querystring right?
for my line of reasoning, this is a sub-address within a sub-address, but cant handle becouse the first one "?status" has resolved like the entery strings "?status?refer=numbers"...?refer=numbers is a second querystring, a requeriment inside of php...
maybe i'm fully wrong, but that's what I understood so far, I never took a course on anything, so I'm kind of dumb in that area :p

Both cods dont handle...
"page not found in this server"

make.php (a-1)

<?php
/**
* Rules
*
*/
defined('MYAAC') or die('Direct access not allowed!');

$title = 'Piece of Pie';

if(empty($action)) {
if(!$logged) {
echo 'You are not logged in. <a href="' . getLink('account/manage') . '">Log in</a> first to make a donate..';
}
else {
$account_email = $account_logged->getEMail();
function obfuscate_email($email)
{
$em = explode("@",$email);
$name = implode('@', array_slice($em, 0, count($em)-1));
$len = floor(strlen($name)/2);

return substr($name,0, $len) . str_repeat('*', $len) . "@" . end($em);
}

// to see in action:
$emails = [$account_email];

foreach ($emails as $email)
{
$masker = obfuscate_email($email);
}

require PAGES . 'pix/index.php';
}
}

?>

Index.php (a-2)
<?php
$produtos = include('produtos.php');
?>
<!-- criar um formulário para enviar os produtos selecionados -->
<form method="post" action="?pixdonate">
<table border="1">
<thead>
<tr>
<th></th><!-- deixe vazia -->
<th>Nome</th>
<th>Descrição</th>
<th>Valor</th>
</tr>
</thead>
<tbody>
<?php foreach ($produtos as $produto) { ?>
<tr>
<!-- troque o id por um input checkbox para enviar somente os ids dos produtos desejados -->
<td><input type="checkbox" name="id[]" value="<?= $produto['id'] ?>"></td>
<td><?= $produto['nome'] ?></td>
<td><?= $produto['descricao'] ?></td>
<td><?= $produto['valor'] ?></td>
</tr>
<? } ?>
</tbody>
</table>
<!-- adiciona um botão para enviar o formulário -->
<input type="submit" value="Donate">
</form>

pixdonate.php (b-1)
<?php
/**
* Rules
*
*/
defined('MYAAC') or die('Direct access not allowed!');

$title = 'Give us a Piece of Pie';

if (empty($_POST)) {
header('location: index.php');
}

require PAGES . 'pix/donate.php';

?>

donate.php(b-2)
<?php
//caso não tenha selecionado nenhum produto e enviado o formulário, retorna para index.php
if (empty($_POST)) {
header('location: index.php');
}

//recuperar os produtos para obter os valores
$produtos = include('produtos.php');

$total = 0;
//iterar sobre os produtos selecionados
foreach ($_POST['id'] as $id) {
$total += $produtos[$id]['valor'];
}
echo 'Total: ' . $total;
$length = 10;
$number = substr(str_shuffle('0123456789'),1,$length);
$solicitacao = [
'referenceId' => $number,
'callbackUrl' => 'http://'.$_SERVER['HTTP_HOST'].'/?notificacao',
'value' => $total,
'buyer' => [
'firstName' => 'João',
'lastName' => 'Da Silva',
'document' => '123.456.789-10',
'email' => '[email protected]',
'phone' => '+55 27 12345-6789'
]
];
$picPayToken = 'you-token';
// inicializar o cURL
$ch = curl_init();
// fornecer a url de destino
curl_setopt($ch, CURLOPT_URL, 'https://appws.picpay.com/ecommerce/public/payments');
// passar o parâmetro para retornar a resposta
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// fornecer os dados necessários para gerar o QR Code
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($solicitacao));
// informar que iremos fazer uma requisição utilizando o método POST
curl_setopt($ch, CURLOPT_POST, true);

// enviar os headers obrigatórios
$headers = [];
$headers[] = 'Content-Type: application/json';
$headers[] = 'X-Picpay-Token: ' . $picPayToken;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// fazer a requisição
$result = curl_exec($ch);
// armazenar a resposta
$resposta = json_decode($result);
// exibir o conteúdo da resposta
var_dump($resposta);
// abortar caso aconteça algum erro
if (curl_errno($ch)) {
die('Erro: ' . curl_error($ch));
}
// fechar a conexão
curl_close($ch);
?>
<img src="<?= $resposta->qrcode->base64 ?>" alt="QR Code">
<br>
<a href="<?= $resposta->qrcode->content ?>" title="Ir para o site do PicPay">Pagar no PicPay</a>
<br>
<a href="?subtopic=status&referencia=<?= $resposta->referenceId ?>" title="Consultar o status">Consultar o status</a>
<br>
<a href="index.php" title="Voltar para os produtos">Voltar para os produtos</a>

pixstatus.php (c-1)

<?php
/**
* Rules
*
*/
defined('MYAAC') or die('Direct access not allowed!');

$title = 'Give us a Piece of Pie';

require PAGES . 'pix/status.php';

?>

status.php (c-2)

<?php
// recebe o código de referência por GET
if (empty($_GET) && !isset($_GET['referencia'])) {
// aborta caso não tenha passado o código
die('Forneça a refência');
}
$picPayToken = 'you-token';
// monta a url
$url = 'https://appws.picpay.com/ecommerce/public/payments/'.$_GET['referencia'].'/status';
// inicializa o cURL
$ch = curl_init();
// fornece a url de destino
curl_setopt($ch, CURLOPT_URL, $url);
// passa o parâmetro para retornar a resposta
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// envia os headers obrigatórios
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'X-Picpay-Token: ' . $picPayToken
]);
// faz a requisição
$result = curl_exec($ch);
// armazena a resposta
$resposta = json_decode($result);
// exibe o conteúdo da resposta
var_dump($resposta);
// aborta caso aconteça algum erro
if (curl_errno($ch)) {
die('Error: ' . curl_error($ch));
}
// fecha a conexão
curl_close($ch);
?>
<?php if ($resposta->authorizationId) { ?>
<br> e o código da autorização é <?= $resposta->authorizationId ?>.
<br>
<a href="cancelar.php?referencia=<?= $_GET['referencia'] ?>&autorizacao=<?= $resposta->authorizationId?>">Cancelar</a>
<?php } else {?>
<br>
<a href="cancelar.php?referencia=<?= $_GET['referencia'] ?>">Cancelar</a>
<?php } ?>

All pages works fine with codes, but at check status page still dont find it...
maybe i need put some code to identify this subpage? on pixstatus.php...
Post automatically merged:

Nevermind !!!

I moved some files, specifying the status.php, to PAGE folder and it worked perfectly ... then I realized I was making a call as if it were twig on the php page stupidly, I could put all php in the PAGE folder, execute no call and using the code you gave works perfectly, I did not understand redirection of myaac in the folders, now I understand. thanks...


as I said, a little dumb on the subject, I made a mess ! :p
 
Last edited:
Back
Top