URL amigavel

138 views
Skip to first unread message

alcirlei Antonio Gonçalves

unread,
Apr 15, 2020, 3:04:36 PM4/15/20
to Rumo à certificação PHP
Olá pessoal, preciso que me ajude a esconder a extensão do meu carrinho de compras, tentei e tentei e não consegui nada, nem com .htaccess, nem mesmo com app, o link é este http: alcirlei.com.br/carrinho. php no .htaccess Eu consegui mas causar conflito e  impedi de navegar no site. Quando removo o php manualmente na barra de endereço o site permanece normal.

.htaccess

# DO NOT REMOVE THIS LINE AND THE LINES BELOW HOTLINKID:eraLePadan
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?alcirlei.com.br/.*$      [NC]
RewriteRule .*\.(.*|jpg|jpeg|gif|png|bmp|tiff|avi|mpeg|mpg|wma|mov|zip|rar|exe|mp3|pdf|swf|psd|txt|html|htm|php)$ https://alcirlei.com.br [R,NC]
# DO NOT REMOVE THIS LINE AND THE LINES ABOVE eraLePadan:HOTLINKID
# DO NOT REMOVE THIS LINE AND THE LINES BELLOW Urls amigaveis Sem extensões
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
# DO NOT REMOVE THIS LINE Forçando redirecionamento de http para https (SSL) 
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
# DO NOT REMOVE THIS LINE AND THE LINES BELOW proteção .htaccess
<files ~ "^.*\.([Hh][Tt][Aa])">
order allow,deny
deny from all
satisfy all
</files>
# DO NOT REMOVE THIS LINE AND THE LINES BELLOW Evitando a listagem de diretórios
Options All -Indexes
#url amigaveis passando parametos
RewriteEngine on
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^informacao/detalhes-([0-9]+)$ informacao/detalhes.php?id=$1
##################################
#url amigaveis passando parametos
RewriteEngine on
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^carrinho-([0-9]+)$ carrinho.php


carrinho.php

<?php 
session_start();
require_once "functions/product.php";
require_once "functions/cart.php";

$pdoConnection = require_once "conect/connection.php";

if(isset($_GET['acao']) && in_array($_GET['acao'], array('add', 'del', 'up'))) {
if($_GET['acao'] == 'add' && isset($_GET['id']) && preg_match("/^[0-9]+$/", $_GET['id'])){ 
addCart($_GET['id'], 1);
}

if($_GET['acao'] == 'del' && isset($_GET['id']) && preg_match("/^[0-9]+$/", $_GET['id'])){ 
deleteCart($_GET['id']);
}

if($_GET['acao'] == 'up'){ 
if(isset($_POST['prod']) && is_array($_POST['prod'])){ 
foreach($_POST['prod'] as $id => $qtd){
updateCart($id, $qtd);
}
}
header('location: carrinho.php');
}

$resultsCarts = getContentCart($pdoConnection);
$totalCarts  = getTotalCart($pdoConnection);


?>
<!DOCTYPE html>
<html lang="en">
<head>
    <!-- Global site tag (gtag.js) - Google Analytics -->
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-161888915-1');
</script>
<meta charset="UTF-8">
<title>Alcirlei A. Gonçalves</title>
<script id="hotmart_launcher_script">
(function(l,a,u,n,c,h,e,r){l['HotmartLauncherObject']=c;l[c]=l[c]||function(){
(l[c].q=l[c].q||[]).push(arguments)},l[c].l=1*new Date();h=a.createElement(u),
e=a.getElementsByTagName(u)[0];h.async=1;h.src=n;e.parentNode.insertBefore(h,e)
})(window,document,'script','//launcher.hotmart.com/launcher.js','hot');

hot('account','c7fc26db-6c08-306a-9f1b-e3649a917c8f');
</script>

<!-- Facebook Pixel Code -->
<script>
  !function(f,b,e,v,n,t,s)
  {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
  n.callMethod.apply(n,arguments):n.queue.push(arguments)};
  if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
  n.queue=[];t=b.createElement(e);t.async=!0;
  t.src=v;s=b.getElementsByTagName(e)[0];
  s.parentNode.insertBefore(t,s)}(window, document,'script',
  fbq('init', '2249829705322712');
  fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
/></noscript>
<!-- End Facebook Pixel Code -->
</head>
<body>
    <script>insert_event_code_here;</script>
<?php

include "rodape_cabecalho/cabecalho.php";

?>
<div class="container carrinho">
          
<?php if($resultsCarts) : ?>
<form action="carrinho.php?acao=up" method="post">
<table class="table table-strip">
<thead>
<tr>
<th>Imagem</th>
<th>Produto</th>
<th>Quantidade</th>
<th>Preço</th>
<th>Subtotal</th>
<th>Ação</th>

</tr>
</thead>
<tbody>
  <?php foreach($resultsCarts as $result) : ?>
<tr>
<td><img class="imgc" src="image/<?php echo $result['image']?>"> </td>

<td><?php echo $result['name']?></td>
<td>
<!--<input type="text" name="prod[<?php echo $result['id']?>]" value="<?php echo $result['quantity']?>" size="1" />-->
<center>1</center>
</td>
<td>R$ <?php echo number_format($result['price'], 2, ',', '.')?></td>
<td>R$ <?php echo number_format($result['subtotal'], 2, ',', '.')?></td>
<td><br><br><br><br><br><br><center><a mp-mode="dftl" href="https://www.mercadopago.com.br/checkout/v1/redirect?pref_id=192147959-3c2888ce-e85d-43f4-ae95-c87b5df1f8ac" name="MP-payButton" class='green-tr-l-ov-brall'>Pagar</a>
<script type="text/javascript">
(function(){function $MPC_load(){window.$MPC_loaded !== true && (function(){var s = document.createElement("script");s.type = "text/javascript";s.async = true;s.src = document.location.protocol+"//secure.mlstatic.com/mptools/render.js";var x = document.getElementsByTagName('script')[0];x.parentNode.insertBefore(s, x);window.$MPC_loaded = true;})();}window.$MPC_loaded !== true ? (window.attachEvent ?window.attachEvent('onload', $MPC_load) : window.addEventListener('load', $MPC_load, false)) : null;})();
</script>

</tr>
<?php endforeach;?>
 <tr>
  <td colspan="3" class="text-right"><b>Total: </b></td>
  <td>R$ <?php echo number_format($totalCarts, 2, ',', '.')?></td>
  <td></td>
 </tr>
</tbody>
</table>


</form>
<?php endif?>
<br />
<br />
<script data-ad-client="ca-pub-5351394647473739" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
       <script>
  fbq('track', 'Purchase', {
    value: 20,
    currency: 'BRL',
  });
</script>
<br />
<br />
</div>
<center><a class="btn btn-info" href="index">voltar</a></center>
</div>
<br><br>
      
<?php

include "rodape_cabecalho/rodape.php";

?>
  </body>
</html>


index.php

<!--**
 * @pagina desenvolvida usando framework bootstrap,
 * o código é aberto e o uso é free,
 * porém lembre -se de conceder os créditos ao desenvolvedor.
 *-->
<?php require("conect/conexao.php");
//Verificar se está sendo passado na URL a página atual, senao é atribuido a pagina 
$pagina = (isset($_POST['pagina']))? $_POST['pagina'] : 1;

//Selecionar todos os produtos da tabela
$sql = "SELECT * FROM produtos";
$qr = mysqli_query($conexao, $sql);

//Contar o total de produtos
$total_produtos = mysqli_num_rows($qr);
//$produtos = $total_produtos / 3;
//Seta a quantidade de produtos por pagina
$quantidade_pg = 6;

//calcular o número de pagina necessárias para apresentar os produtos
$num_pagina = ceil($total_produtos/$quantidade_pg);

//Calcular o inicio da visualizacao
$incio = ($quantidade_pg*$pagina)-$quantidade_pg;

//Selecionar os produtos a serem apresentado na página
$sql = "SELECT * FROM produtos limit $incio, $quantidade_pg";
$qr = mysqli_query($conexao, $sql);
$total_produtos = mysqli_num_rows($qr);
?>
<!DOCTYPE html>
<html lang="pt-br">
  <head>
      
      <!-- Global site tag (gtag.js) - Google Analytics -->
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-161888915-1');
</script>
      
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    
    <title>Alcirlei A. Gonçalves</title>


 <!-- Favicons
    ================================================== -->
    <link rel="shortcut icon" size="32" href="imgage/favicon.ico" type="image/x-icon">
    <link rel="apple-touch-icon" size="57" href="imgage/favicon.png">
    <link rel="apple-touch-icon" sizes="72x72" href="imgage/favicon.png">
    <link rel="apple-touch-icon" sizes="114x114" href="imgage/favicon.png">

   
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="./css/estilo.css" type="text/css">
      <!-- Main Stylesheet CSS -->

      <link rel="stylesheet" type="text/css"  href="css/bootstrap.css">
      <link rel="stylesheet" type="text/css"  href="css/main.css">
      <link rel="stylesheet" type="text/css"  href="css/normalize.css">
      
      
       <script type ="text/javascript" src="js/cssrefresh.js"> </script>
       

<!-- anúncio google adsense -->
<script data-ad-client="ca-pub-5351394647473739" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<!-- Facebook Pixel Code -->
<script>
  !function(f,b,e,v,n,t,s)
  {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
  n.callMethod.apply(n,arguments):n.queue.push(arguments)};
  if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
  n.queue=[];t=b.createElement(e);t.async=!0;
  t.src=v;s=b.getElementsByTagName(e)[0];
  s.parentNode.insertBefore(t,s)}(window, document,'script',
  fbq('init', '2249829705322712');
  fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
/></noscript>
<!-- End Facebook Pixel Code -->
</head>

   <body data-spy="scroll" data-target=".navbar" data-offset="82">
       <script>insert_event_code_here;</script>
<div class="site-loader" style="display: none;">
         <div class="loader-dots">
            <div class="circle circle-1"></div>
            <div class="circle circle-2"></div>
         </div>
      </div>




      <section class="" id="hero">
         <div >

 
            


 <div class="alcirlei">
               <!-- container-start -->
               
               <h1>Alcirlei A. Gonçalves</h1>
             </div>

             
             <div class="banner burger  align-item-center parallax" style="background-position-y: 0px;">
            <div class="container">
               <!-- container-start -->
               
               <div class="row align-item-center mt3">
                  <!-- row start -->
                  <div class="col-sm-6 col-lg-6 ">
                     <!-- column start-->
                     <div class="banner-text">
                        <h1 class="wow fadeIn text-left" data-wow-delay="1s" data-wow-duration="2s"><strong class="template-color">Não perca esta promoção!</strong> Oportunidade única de mudar de vida.</h1>
                        <p class="big-pera thumbit">Com 80% de DESCONTO!</p>
                        <div class="mt3 banner-btn-group">
                            
                        </div>
                     </div>

<div class="timer-box caixa" >
                        <center><h2 class="mt0 ">Não espere o tempo acabar. </h2></center>
                        <div class="timer">
                           <div class="days">19<span>Days</span></div>
                           <div class="hours">09<span>Hours</span></div>
                           <div class="minutes">41<span>Minutes</span></div>
                           <div class="seconds">49<span>Seconds</span></div>
                        </div>
                        <div class="timer-text"><center> <span>Promoção por tempo limitado!</span></center></div>
                        
                     </div>

                  </div>
                  <!-- column end -->
                  <div class="col-sm-6 col-lg-5 col-lg-offset-1">
                  
                         <?php while($ln = mysqli_fetch_assoc($qr)){ ?>
                             
          <div class="text-centerter col-sm-6 col-md-3">
            <div class="thumbnail">
            <br>
             <img src=<?php echo '"image/'.$ln['imagem'].'" '; ?>/><br /><br>
              <div class="vitrine ">

                <a href="informacao/detalhes-<?php echo $ln['id']; ?>">

                  <h3><?php echo $ln['nome']; ?></h3></a>
                  
               <?php echo '<h2> R$ ' .number_format($ln['preco'], 2,',','.').'</h2><br/>'; ?>
                <p><a href="carrinho<?php  echo '?acao=add&id='.$ln['id'].''; ?>" class="btn btn-primary" role="button">Comprar</a> </p> 
               
                  
                <!-- carrinho?acao=add&id='.$ln['id'].'         class="btn btn-primary" role="button"-->
              </div>
            </div>
          </div>
        <?php } ?>
                    
                       
                  
                  </div>
               </div>
               <!-- row end -->
            </div>
            <!-- container end -->
         </div>
         
         <!--================= banner-end ==================-->
      </section>





    <div class="contate theme-showcase" role="main">
    
      <div class="row">
         <div class="page-header">
        <center><a href="email/contato" class="btn btn-primary my-btn dark" >Contato</a></center>
                  
    
         <br><br>
      </div>
      </div>
    </div>
    
      <br />
<br />
<br />
<br />
                      
<script>
  fbq('track', 'Purchase', {
    value: 20,
    currency: 'BRL',
  });
</script>




      
<?php
include "rodape_cabecalho/rodape.php";
?>
  </body>
</html>
Reply all
Reply to author
Forward
0 new messages