Laravel 12 Sanctum + React Vite blocked by CORS policy

I created an app using Laravel 12 + Sanctum and react.

Locally in my laptop my app is working properly then I upload it to a Windows Server (IIS). With the same port 5173 of React and port 82 for the Laravel app. All of my methods (GET, POST, DELETE AND PATCH) have has been blocked by CORS policy No Access Allow Origin errors.

I tried the following.

  • installed FruitCake on Laravel 12 but is not compatible.
  • allowed_origins to * to cors.php
  • Config Clear and Cache
  • Edited my Sanctum_domain
  • deleting CORS and publish it again

Still nothing is working.

My React App in sending Methods.

    withCredentials: true,
    withXSRFToken: true,
    headers: {
        "Content-Type": "application/json",
        "Accept": "application/json",
    },

config/CORS

paths' => ['api/*', 'sanctum/csrf-cookie', 'login', 'logout','password-creation','password-reset'],
    'allowed_methods' => ['*'],
    'allowed_origins' => ['http://localhost:5173'],
    'allowed_origins_patterns' => [],
    'allowed_headers' => ['*'],
    'exposed_headers' => [],
    'max_age' => 0,

My env

SESSION_DOMAIN=127.0.0.1
SANCTUM_STATEFUL_DOMAINS=127.0.0.1:5173
SESSION_DRIVER=cookie

How do I load data into a dhtmlx 4.2 grid? [closed]

Has any one used Codeignigter 4 with DHTMLX 5

I haveing trouble getting Codeignigter 4.2 and DHTMLX 5.2 to fill the dhtlmx5.2 grid with data

the header show on the page but no data

I get an error

myGrid.load( "grid/data" ); cause the error


dhtmlx.js:9 Uncaught 
  1. XMLHttpRequest {readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, onreadystatechange: ƒ, …}
function callCodeIgniterController() {
        

    myGrid = new dhtmlXGridObject("winVP");
    myGrid.setHeader("Part Id, Part Number");
    myGrid.init();
    
    myGrid.load( "grid/data" );
    
    console.log('here')
    return;
}

routes

<?php

use CodeIgniterRouterRouteCollection;

/**
 * @var RouteCollection $routes
 */
$routes->get('/', 'Erp::index');
$routes->get("grid/curinv", "Grids::index");
$routes->get('grid/data/(:any)', 'Grids::data/$1'); 
$routes->get('grid/data', 'Grids::data'); 

?>

controller

<?php             
namespace AppControllers;

require_once("dhtmlx5.2/Connector/grid_connector.php");
require_once("dhtmlx5.2/Connector/db_phpci.php");
class Grids extends BaseController 
{                  
    public function index(){       
        $this->load->view('curinv');  
    }
    public function data(){                       
        console.log(1111);          
        $this->load->database();//data feed   
        console.log(2222);                     
        $connector = new GridConnector($this->db, "phpCI");    
        console.log(3333);   
        $connector->configure(                                 
            "parts",                                           
            "part_id",                                         
            "part_id,part_number"                    
        );                                                     
        $connector->render();                                  
    }                                                          
};
?>

How to Replace DOCX Placeholder with table in PHPWord?

I’m using the PHPWord package in Laravel to replace placeholders in a DOCX template.

I have a placeholder ${table} in my DOCX file and I’ve done code like:

$tableStyle = [
 'width' => 100 * 50,
 'unit' => 'pct',
 'cellMargin' => 150,
 'borderColor' => '000000',
 'borderSize' => 6,
 ];
 $table = new Table($tableStyle);
 $table->addRow();
 $nameCell = $table->addCell(2000);
 $nameCell->getStyle()->setGridSpan();
 $nameCell->addText('Name', ['bold' => true, 'size' => 8]);
 $processor->setComplexBlock('table', $table);

Now when I add placeholder like:
${table}
${table}

in docx multiple time it’s only replacing first placeholder.

Can anyone tell me what can be issue here? It’s working for the normal placeholder like setValue function for other type of placeholder.

Pdflib PCOS get color space

I’m trying to get the color spaces being used in the file that I am importing using pdflib pcos, and iam getting this error.

“Fatal error: Uncaught PDFlibException: Can’t retrieve object ‘colorspaces[0]/name’ in evaluation mode
(only small documents)…”

Below is my code in php:

   $colorspace_count = $s->pcos_get_number($sraw, "length:colorspaces");
   for ($i = 0; $i <= ($colorspace_count-1); $i++) {
      $color_type[] = $s->pcos_get_string($sraw, "colorspaces[".$i."]/name");
   }
   $color_list = implode(', ',$color_type);

Add Imagick to Xampp on linux

I am on linux mint and probably do not have the best setup but I currently have imagick installed in my global version of php8.4 and it shows in when I grep for it and in phpinfo.

I have a php application setup with xampp using its own php version 8.0 (it starts to have problems after php8.0) but this php doesnt have the imagick added. I have added the extension.so for it to the ini but it doesnt show in the phpinfo

How do I add imagick to the xampp php or have it see the imagick that the global php is seeing

Etag Implementation in Magento2

this code I am using to set etag in header, I am able to set etag in response header but If-None-Match always coming empty. 1. Nginx Server 2. Magento Version – 2.4.8-P1

 $etag = md5($category->getId();

 $etagHeader = 'W/"' . $etag . '"';

 $this->response->setHeader('Etag', $etagHeader, true);
 $this->response->setHeader('Cache-Control', 'public, max-age=3600', true);
 $this->response->setHeader('Pragma', 'cache', true);

 if (trim($this->request->getHeader('If-None-Match')) === $etag) {
       $logger->info('ETag matches, returning 304');
       $this->response->setHttpResponseCode(304);
       $this->response->clearBody();
 }

Opening website on localhost show black page [closed]

This is the black page shown when I open it on the localhost server.

I have three websites on the localhost XAMPP server. Two of them are on WordPress, which works fine, but when I open the third website, which is a non-WordPress site, it shows a black page. whereas the website from the previous two weeks is working fine. It suddenly began to show a black page. I don’t know what is the reason behind this.

This is the index page code

<?php 
include "admin/param.php";
include "admin/func.php";
include "live.php";
?>
<!DOCTYPE html>
<html>
<head>
    <title><?=$web_title?></title>
      <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <!-- <link rel="icon" href="im/favicon.png" type="image/x-icon"> -->
    <link href="bootstrap-4.3.1/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="bootstrap-4.3.1/css/bootstrap-grid.css" rel="stylesheet" type="text/css" />
    <link href="custom.css" rel="stylesheet" type="text/css" />
    <link href="css/owl.carousel.min.css" rel="stylesheet" type="text/css" />
    <link href="css/owl.theme.default.min.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="css/fontawesome.css">
    <link rel="stylesheet" type="text/css" href="css/all.css">
    <link href="fonts/style.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="css/animate.min.css">
    <link rel="stylesheet" type="text/css" href="css/wow-animate.css">
    <link rel="stylesheet" type="text/css" href="css/left-menu.css">
    <link href="css/swiper.min.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css"/>
    <link href='https://unpkg.com/[email protected]/css/boxicons.min.css' rel='stylesheet'>
</head>
<body>




<?php 
    include "top.php";
    include "slider.php"; 
    include "achievement.php"; 
    include "catagoury.php"; 
    // include "feature.php";
    include "instagram.php";
    include "btm.php";
?>



<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="bootstrap-4.3.1/js/bootstrap.js"></script>
<script type="text/javascript" src="bootstrap-4.3.1/js/bootstrap.bundle.js"></script>
<script type="text/javascript" src="js/swiper.min.js"></script>
<script type="text/javascript" src="js/owl.carousel.min.js"></script>
<script type="text/javascript" src="js/fontawesome.js"></script>
<script type="text/javascript" src="js/all.js"></script>
<script type="text/javascript" src="js/custom.js"></script>
<script type="text/javascript" src="js/wow.min.js"></script>

  <script>
    var swiper = new Swiper('.swiper-container', {
      slidesPerView: 'auto',
      spaceBetween: 2,
      loop: true,
      loopFillGroupWithBlank: true,
       navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
      },
    });
  </script>
<script> 
$(document).ready(function(){
    $("#search").click(function(){
        $("#searchshow").slideToggle("slow");
    });
});
</script>
<script type="text/javascript">
$(document).ready(function () {
    $('#sidebarCollapse').on('click', function () {
        $('#sidebar').toggleClass('active');
        $(this).toggleClass('active');
    });
});
</script>
<script type="text/javascript">
$(document).ready(function(){
    $(".dropdown").hover(            
        function() {
            $('.dropdown-menu', this).not('.in .dropdown-menu').stop(true,true).fadeIn("400");
            $(this).toggleClass('open');        
        },
        function() {
            $('.dropdown-menu', this).not('.in .dropdown-menu').stop(true,true).fadeOut("400");
            $(this).toggleClass('open');       
        }
    );
});
</script>
<script>
  wow = new WOW(
    {
      animateClass: 'animated',
      offset:       100,
      callback:     function(box) {
        console.log("WOW: animating <" + box.tagName.toLowerCase() + ">")
      }
    }
  );
  wow.init();
</script>
</body>
</html>

This is the top bar code:

<style>
    .top1-f-main{
        background-color: #709f00;
        padding: 3px 0px;
        color: white;
    }
    
    .tp1 p{
        text-align: center;
        font-size: 12px;
    }
    
    .top-f-main {
    background-color: #000000;
    padding: 10px 15px;
    font-size: 12px;
}
    
.top-main ul li {
    display: inline-block;
    margin-left: -21px;
}
    
.header-fluid {
    position: unset;
    z-index: 999;
    background-color: #1e1e1e !important;
}
    
.b {
    
     border: thin solid #709f00;
    padding: 9px 10px;
    border-radius: 30px;
    background-color: #709f00;
    color: white;
    margin-top: -8px;
    margin-right: 2px;
    margin-left: 5px;
}

    #mobile-menu-open1{
        margin-top: 5px;
    }   
    
    #navbar {
    box-sizing: border-box;
    transition: background-color 0.4s ease-out;
    transition: all 0.5s ease;
    padding: 0px 1px;
}
    
nav.scroll {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #1e1e1e;
    color: #eef;
    box-shadow: 0px 2px 8px #000;
    z-index: 99999999;
    height: auto;
}
    
    nav{
        position: relative;
        z-index: 1000;
    }   
    
    
.navbar-dark .navbar-nav .nav-link:hover{
    color: #709f00 !important;
}
    
.nav-link:after {
    content: "";
    position: absolute;
    left: 26px;
    bottom: 27%;
    width: 0px;
    height: 4px;
    background-color: #709f00;
    transition: all 0.5s ease;
}
    
    .Dropdown:hover .fa-chevron-down{
        transform: rotate(180deg);
    }
    
    .navbar-nav{
        position: relative;
    }
    
    .Dropdown{
        position: relative;
    }
    
    .dropdown-content{
        
        position: absolute;
        min-width: 150px;
        border: 3px solid #709f00;
        background-color: #709f00;
        color: white;
        border-radius: 0 0  3px 3px;
        list-style: none;
        display: none;
    }
    
    .dropdown-content li{
        padding: 20px;
    }
    
    .sub-dropdown-content{
        position:absolute;
        top:5%;
        left: 100%;
        border: 3px solid #709f00;
        background-color: #709f00;
        min-width: 120px;
        list-style: none;
    }
    
    .sub-dropdown-content li{
        padding: 20px;
        border-bottom: 1px solid white;
    }
    
    .Dropdown:hover .dropdown-content{
        display: block;
    }
    
    .top-main ul li a {
    display: block;
    color: #ffffff;
    padding: 0 20px;
}
    
.searchTerm {
    background-color: transparent;
    border: 0;
    border-bottom: solid 7px #709f00;
    color: #709f00;
    height: 100px;
    padding-left: 15px;
    width: 100%;
    font-family: Myriad Pro Regular;
    font-size: 25px;
    max-width: 800px;
    margin-top: 43vh;
}
    
    .fa-w-11{
        color: #709f00;
    }
    
    
@media screen and (max-width: 767px) {
    .nav-link div {
        background-color: #fff;
        margin-top: -40px;
    }
}
    
    
@media screen and (max-width: 550px) {
    .nav-link div {
        background-color: #fff;
        margin-top: -40px;
    }
}   
    
@media (max-width: 767px) {
    .logo img {
        max-width: 112px !important;
        padding-top: 0 !important;
        margin-top: 13px;
    }
}
    
    
@media (max-width: 550px) {
    .logo {
    position: relative;
    top: 0px;
    left: -190px;
    padding-left: 0px;
    margin-left: 0px;
    }
    
    @media (max-width: 520px) {
    .logo {
    position: relative;
    top: 0px;
    left: -180px;
    padding-left: 0px;
    margin-left: 0px;
    }
}
    
        
    
    @media (max-width: 492px) {
    .logo {
    position: relative;
    top: 0px;
    left: -165px;
    padding-left: 0px;
    margin-left: 0px;
    }
}
    
.gtranslate_wrapper .gt_switcher-popup{
        color: #fff;
    }
    nav.scroll .gtranslate_wrapper {
          margin-right: 20px !important;
    }   
</style>



<script>window.gtranslateSettings = {"default_language":"en","wrapper_selector":".gtranslate_wrapper","flag_size":24,"flag_style":"3d"}</script>
<script src="https://cdn.gtranslate.net/widgets/latest/popup.js" defer></script>


<a href="https://api.whatsapp.com/send?phone=+923096030541&amp;text=Hi" target="_blank" id="wa">
<img src="im/whatsapp.png" style="position: fixed;bottom: 55px;z-index: 9999;max-width: 60px;right: 15px;">
</a>



<div id="mobile-menu-show">
    <button id="mobile-menu-close"><i class="fas fa-times"></i></button>
<ul class="list-unstyled components">
                <ul class="navbar-nav visiable-xs">
                        <li class="nav-item">
                            <a class="nav-link" href="index.php">Home</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="content.php?p=3">ABOUT</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="products.php?live=12_49_0_0" id="click">PRODUCTS<span class="dropdown-toggle"></span></a>
                            <ul id="show" style="display: none !important;padding-top: 0;padding-left: 20px;">
                                          <?php
$QRY = qry_run("Select * from tbl_main where pshow = 'Yes' order by ranking");
if (num_rec($QRY) > 0)
{
while($rs = fetch_rec($QRY))
{
$secid = 0;
?>
<?php
$QRYs = qry_run("select * from tbl_section where mainid = ".$rs['mainid']." order by ranking");
if (num_rec($QRYs) > 0)
{
$rss = fetch_rec($QRYs);
$secid = $rss['secid'];
}
?>
<!---------  ------>
                            <li><a href="products.php?live=<?=$rs['mainid']?>_<?=$rss['secid']?>_0_0"><?=$rs['pname']?></a></li>
     <?php
      }
}
      ?> 
                            </ul>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="content.php?p=5">contact</a>
                        </li> 
                        <div class="">
                          <form action="search.php" method="post">
                              <input type="text" name="search" placeholder="Search" style="width: 100%;
height: 50px;
padding-left: 15px;">
                          </form>
                        </div>  
                    </ul>
                </ul>
    
</div>








<div id="mobile-menu-show1" >
<ul class="list-unstyled components">
  <div class="laptop-menu">
    <h3>Social</h3>
    <ul>
      <li><a href="#">Facebook</a></li>
      <li><a href="#">Instagram</a></li>
      
      
      <p> Airport Road Gohadpur Sialkot _51310  51310, Pakistan.</p>
      <p>[email protected]</p>
      <p>+92 370 9236904</p>
    
    </ul>
  </div>
                </ul>
    
</div>




<div class="container-fluid top1-f-main">
  <div class="row">
  <div class="col-md-12 col-12">
     <div class="tp1">
      <p>Manufacturers and Exporterts off all kinds of sports clothing.</p>  
     </div>
</div> 
</div>
</div>

<div class="container-fluid top-f-main">
  <div class="row">
    <div class="col-md-6 col-6">
      
    </div>
    <div class="col-md-6 col-6">
    <div class="top-main">
      <ul>
        <li><a href="#">Need Help?</a></li>  
        <li><a href="#"><i class="fab fa-facebook-f"></i></a></li>
        <li><a href="#"><i class="fab fa-twitter"></i></a></li>
        <li><a href="#"><i class="fab fa-instagram"></i></a></li>
      </ul>

    </div>
  
    </div>
  </div>

</div>






<!--------------------- Header Start ---------------------------->
<div class="container-fluid header-fluid" style="position: inherit;">
  <nav id="navbar">

    <div class="row align-items-center">
        


        <div class="col-md-2 animatable bounceIn">
            
      <div class="logo">
                <a href="index.php"><img src="img/logo.png"/></a>
            </div>

        </div>
        
        <div class="col-md-8 animatable bounceInRight">
      <navbar class="navbar navbar-expand-md bg-dark navbar-dark">
                <a class="navbar-brand" href="index.php"><img src="img/logo.png" /></a>
                
                 <a href="#0" id="mobile-menu-open" class="nav-link icon-ico visiable-xs"><div></div></a>
                
                <div class="collapse navbar-collapse nav-hidden" id="navbar">
                    <ul class="navbar-nav pt-0">
                        <!-- <li class="nav-item">
                            <a class="nav-link" href="index.php">Home</a>
                        </li> -->
                        <li class="nav-item">
                            <a class="nav-link" href="content.php?p=3">ABOUT US</a>
                        </li>
                        
                         <li class="nav-item">
                            <a class="nav-link" href="sustainability.php">Sustainability</a>
                        </li>
                        
                        <li class="nav-item Dropdown">
                            <!--href="products.php?live=12_49_0_0"-->
                            <a class="nav-link">Products <i class="fa fa-chevron-down"></i></a>
                            <ul class="dropdown-content">
                              <li><a href="products.php?live=9_33_0_0#collapse1">Sports Wear</a></li>
                              <li><a href="products.php?live=10_40_0_0#collapse2">Fitness wear</a></li>
                              <li><a href="products.php?live=12_49_0_0#collapse3">Boxing Gear</a></li>
                              <li><a href="products.php?live=11_44_0_0#collapse4">Martial Arts</a></li>
                            </ul>
                        </li>
                        
                        <li class="nav-item Dropdown">
                            <a class="nav-link">Help/Guide <i class="fa fa-chevron-down"></i></a>
                            <ul class="dropdown-content">
                              <li class="sub-dropdown">
                                  <a href="#">Fabric Guide<!--<i class="fa fa-chevron-right"></i>--></a>
                                  <!---<ul class="sub-dropdown-content">
                                      <li><a href="#">Fabric 1</a></li>
                                      <li><a href="#">Fabric 1</a></li>
                                      <li><a href="#">Fabric 1</a></li>
                                  </ul>--->
                              </li>
                              <li><a href="#">Order Guide</a></li>
                              <li><a href="#">Size Chart</a></li>
                            </ul>
                        </li>
                        
                        
                        <li class="nav-item">
                            <a class="nav-link" href="production.php">Production</a>
                        </li>
                        <!-- <li class="nav-item">
                            <a class="nav-link" href="#">Catalogues</a>
                        </li> -->
                        <li class="nav-item">
                            <a class="nav-link" href="content.php?p=5">Contact Us</a>
                        </li>
                       
  
                    </ul>
                </div>  
            </navbar>
            
        </div>
        


   <div class="col-md-2" style="position: unset;">
     <ul class="icon-alls">
       <!-- <div class="gtranslate_wrapper">
          
        </div>-->

     
                        <li class="nav-item " id="flip">
                          <a href="#" class="nav-link icon-ico icn"><i class="fas fa-search" style="font-size: 24px; color: white;"></i></a>
                        </li> 

                       <!--- <a class="cart" href="basket.php"><i class="fas fa-shopping-cart"></i></a>---!>



                       <!--<form action="search.php" method="post">-->
                       <!--   <input type="text" name="search">-->
                       <!-- </form>-->
         
                        <li class="nav-item " id="flip">
                            <a href="#" class="b">Let's Talk <i class="far fa-comments"></i></a>
                        </li> 

                        

                        <li class="nav-item pt-0">
                          <a href="#" id="mobile-menu-open1" class="nav-link icon-ico"><div></div></a>
                        </li> 
                      </ul>
   </div>


    </div>

<div class="menu-button">
  <a href="#0" id="mobile-menu-open1" class="nav-link icon-ico"><div></div></a>
</div>




<div id="searchshow" class="search-show">
    <form action="search.php" method="post">
        <input type="text" name="search" placeholder="Search">
    </form>
</div>
</nav>

</div>



<div id="panel" style="text-align: center;">
<button id="close" style="float: right;
background-color: transparent;
border: 0;
color: #d71921;
font-size: 35px;
padding: 11px 25px;"><i class="fa fa-times" aria-hidden="true"></i>
</button>
<!-- <img src="im/logo.png" style="position: absolute;top: 50px;left: 0;margin: 0 auto;right: 0;max-width: 165px;
width: 100%;" /> -->
<form action="search.php" method="post" style="margin: 0;" >
    <input type="text" name="search" class="searchTerm" placeholder="Search">
</form>
</div>
<!--------------------- Header End ---------------------------->

number_format only works up to 999,99 [closed]

We’ve created a comprehensive table that retrieves currency amounts from a database.

With

number_format($mlz_s_us, 2,'.','')

amounts up to 999.99 are correctly displayed as 999.99.

However, if the amount is higher than 1000, then, for example, the amount 3,113.75 is displayed as “3.11.”

What’s wrong here?

This is Alma Linux 8.10.0 / MariaDB 10.11.13 (latin1_swedish_ci – German) PHP 8.4

How to reference current property value in class property attribute in PHP 8.4?

I’ve done a lot of Googling and may have missed this, there’s so many examples of using the new Attribute feature in PHP but none of them show if this is possible. What I would like to be able to do is use the current value of the class property in the constructor arguments for the attribute. Basically something like

<?php

#[Attribute]
class MyAttr {
    public function __construct ($propValue, $otherArg) { }
}

class Test {
    #[MyAttr(__PROPERTY__, 'other')]
    public string $prop = 'MyProp';
}

So that when using ReflectionAttribute::newInstance from within the class it effectively does new Attr('MyProp', 'other'). Obviously __PROPERTY__ is wrong here, that just gives me the property name rather than its current value. Is it possible to get the property value in that context?

display table data between the selected date range

I have a table where daily sales of products is recorded. The products which are not sold for a particular date is not recorded in the table. But in the blade page, I have to list out all the dates within a particular range of date selected by the user. For certain dates, where sales is zero, it should display as zero.

==========================================
product || total_sales  || date
A       || 500          || 2025-07-01
B       || 800          || 2025-07-01
A       || 200          || 2025-07-02
B       || 250          || 2025-07-02
A       || 500          || 2025-07-04
B       || 780          || 2025-07-04
A       || 180          || 2025-07-05
A       || 615          || 2025-07-06
B       || 756          || 2025-07-06
==========================================

Now if the user selects the date range between 07-01 to 07-05, then the output should be shown as::

==========================================
product || total_sales  || date
A       || 500          || 2025-07-01
B       || 800          || 2025-07-01
A       || 200          || 2025-07-02
B       || 250          || 2025-07-02
A       || 0            || 2025-07-03
B       || 0            || 2025-07-03
A       || 500          || 2025-07-04
B       || 780          || 2025-07-04
A       || 180          || 2025-07-05
B       || 0            || 2025-07-05
==========================================

How can I do it?

Controller class::

public function index()
    {
        try {
        
            $from = date('2025/07/01');
            $to = date('2025/07/05');
            $sales = Sales::whereBetween('sales_date_eng',[$from, $to])->get();
            return view('admin.sales', compact('sales'));
        } catch (Exception $exception) {
            return response()->json(['status'=>'error', 'error'=> $exception->getMessage()]);
        }
    }

How to display such data using laravel?

htaccess rewrite ‘some_category_and_tags_vars.ics’ to call ‘makethisics.php?vars=some_category_and_tags_vars’ [closed]

Exactly as stated above. I need to grab ANY request for an .ics file and redirect it to a standard .php file with the .ics filename as PHP variable.

The PHP file will then spit out an ics file with the correct headers using the category and tag variables to filter it appropriately.

I have coded everything and it all works – just need this rewrite so I can comply with Google Calendar subscription URL requirements.

Inserting into a table with a foreign key

I am trying to insert audio media for users into tables with foreign keys. I have a user table that registers users , an album table that is supposed to store album information for each users album and albumsongs table that is supposed to store songs for an album in the album table.

This is my SQL

users table
userid| username | password | profilepicture
PK/AI userid

albums table
albumid | userid | albumpicture | albumname | albumgenre
PK/AI albumid     
FK userid to users

albumsongs table
songid | userid | albumid | songname | songpath
PK/AI songid   
FK userid to users  
FK albumid to albums

This is my PHP code to insert album info into album table:

   <?php
         if(isset($_POST["submit1"])) {

        $albumname = $_POST['albumname'];
        $albumgenre = $_POST['albumgenre'];
        $id = mysqli_insert_id($conn);
       
        $imagename = $_FILES['image']['name'];
        $tempName = $_FILES['image']['tmp_name'];
        $filepath = "albumpictures/".$imagename;
        
        if(move_uploaded_file($tempName, $filepath)) {
        }

        $qry = "SELECT userid FROM user WHERE userid = '$id'";
        
        $result = mysqli_query($conn, $qry);
        $num_rows = mysqli_num_rows($result);

        if($num_rows > 0) {
            $sql = "INSERT INTO albums (userid, albumname, albumpicture, albumgenre) VALUES ('$id', '$albumname', '$imagename', '$albumgenre')";
              $result = mysqli_query($conn, $sql);
    }
}
?>

This is my php code to insert into albumsongs table:

  <?php
        if(isset($_POST["submit2"])) {

            $songaname1 = filter_input(INPUT_POST, 'songaname1', FILTER_SANITIZE_SPECIAL_CHARS);
            $id = mysqli_insert_id($conn); // Get the last inserted album ID

            $audioname1 = $_FILES['audio1']['name'];
            $audio_tmp1 = $_FILES['audio1']['tmp_name'];
            $audio_folder1 = "albums/".$audioname;
            if(move_uploaded_file($audio_tmp1, $audio_folder1)) {
               $sql1 = "INSERT INTO albumsongs (userid, songaname1, audio1) VALUES ('$id', '$songaname1', '$audioname1')";
               $result1 = mysqli_query($conn, $sql1);
            }
        }
        ?>

I have tried using mysqli_insert_id.

I would like album info to be inserted into album table and songs for the album to be inserted into albumsongs.

How to enqueue custom CSS and JS files in a WordPress child theme?

I’m building a custom WordPress theme for a client and using a child theme.

I want to enqueue my custom CSS (style.css) and a JavaScript file (custom.js) located in the child theme’s folder.

Here’s what I’ve tried in functions.php:

function my_custom_scripts() {
    wp_enqueue_style('my-style', get_stylesheet_directory_uri() . '/style.css');
    wp_enqueue_script('my-script', get_stylesheet_directory_uri() . '/custom.js');
}
add_action('wp_enqueue_scripts', 'my_custom_scripts');

Unable to install Composer [closed]

I’m trying to set up Composer on my Windows computer, but the installation keeps failing with the following message:

The PHP exe file you specified did not run correctly:
C:Program Filesphp8.3.9php.exe

The php.ini used by your command-line PHP is: C:Program Filesphp8.3.9php.ini

A setting in your php.ini could be causing the problem: Either the ‘extension_dir’ value is incorrect or a dll does not exist.

Program Output:

PHP Warning: Module “ldap” is already loaded

PHP Warning: Module “mysqli” is already loaded

PHP Warning: PHP Startup: Unable to load dynamic library ‘openssl.dll’ (tried: C:Program Filesphp8.3.9extopenssl.dll (The specified module could not be found), C:Program Filesphp8.3.9extphp_openssl.dll.dll (The specified module could not be found))

PHP Warning: PHP Startup: Unable to load dynamic library ‘php_wincache.dll’ (tried: C:Program Filesphp8.3.9extphp_wincache.dll (The specified module could not be found), C:Program Filesphp8.3.9extphp_php_wincache.dll.dll (The specified module could not be found))

I’ve seen similar issues that recommended uncommenting the line “extension=openssl.dll” in my php.ini file, but I’ve done that and I’m still getting the same error message. Does anyone know what I can do to resolve the issue and complete the installation?

Woocommerce Custom Payment Gateway Order Status

I am using custom Purchase Order based payment gateway method in Woocommerce and have registered my custom status status – Pending PO Verification for all orders made using this payment method. The issue is i am getting Payment Pending message on admin and customer my account-> Order page attached screenshot for the same. admin order status screenshot and customer my account->Order page screenshot . My custom order status code below:

// WooCommerce order page status add Pending PO Verification //
// 1. Register custom order status
function register_pending_po_verification_order_status() {
    register_post_status( 'wc-pending-po-verification', array(
        'label'                     => 'Pending PO Verification',
        'public'                    => true,
        'exclude_from_search'       => false,
        'show_in_admin_all_list'    => true,
        'show_in_admin_status_list' => true,
        'label_count'               => nnoop( 'Pending PO Verification (%s)', 'Pending PO Verification (%s)' )
    ));
}
add_action( 'init', 'register_pending_po_verification_order_status' );
// 2. Add to WooCommerce order status list
function add_pending_po_verification_to_order_statuses( $order_statuses ) {
    $new_order_statuses = array();
    // Insert after 'wc-pending'
    foreach ( $order_statuses as $key => $status ) {
        $new_order_statuses[ $key ] = $status;
        if ( 'wc-pending' === $key ) {
            $new_order_statuses['wc-pending-po-verification'] = 'Pending PO Verification';
        }
    }
    return $new_order_statuses;
}
add_filter( 'wc_order_statuses', 'add_pending_po_verification_to_order_statuses' );

Attached is the link https://posterika.com/op.html of my custom Purchase Order Gateway

I have tried everything to make it work but the order status isnot changing to Pending PO Verification.

Looking forward to your help.
Thanks

I have tried all the combination like renaming the order status, hooks to change the order status but it is not working. I want you to advise me where is the issue in my code. Request a solution where the order status changes to Pending PO Verification after placing the order using Purchase Order Gateway.