October 22, 2024
Chicago 12, Melborne City, USA
PHP

wordpress show specific html for descktop and another html for mobile

In wordpress I have a header.php that inside it I coded desktop and mobile HTML together. the problem is that for each device the other html are loaded and I just make them display none by media query. that makes performance and SEO problems as I know. I want to just load the html of

Read More
PHP

How to upload a file to a /upload folder in PHP?

<?php if($_SERVER["REQUEST_METHOD"] == "GET"){ $file = $_GET["fname"]; }else{ if(isset($_POST["content"]) && isset($_POST["file"])){ $folder = "/uploads/"; $file = $_POST["file"]; $content = $_POST["content"]; if(file_exists($file)){ echo "<h1>That file already exists on the server</h1>"; }else{ file_put_contents(basename($folder, $file), $content); } }else{ echo "<h1>Request has failed to be sent</h1>"; } } I used file_put_contents because I thought I could just put the

Read More
PHP

My API isn't working correctly, it pulls most data but not all data and I need someone to review my code, please

I made an API for my jobboard. It’s supposed to retrieve jobs from my ATS Vincere and put it in my plugin, WP Job Manager, that manages my jobs on my WordPress website. But every time I put in a Postman test run it puts in everything except the salary. Here is the code for

Read More
PHP

Decrypting aes-128-gcm encrypted file with openssl_decrypt

We are trying to decrypt a file we receive with the AS4 protocol and SOAP messages. We are able to decrypt the key using ‘openssl_private_decrypt’. But the decrypted key has a size of 256 bytes, and does not match the required size for the ‘openssl_decrypt’ key size: $privateKey = '*hidden*'; $passPhrase="*hidden*"; $supplierCypherValue="ePsYNDRENhm/PJ1+3UT7V5U94/mP/wiPtILqBea869SnZh9olcVglJcOJZc7qexii4ewb00qopIW0HP8xYn4uQ7MNoh2fDfCQUd0hwGrIxcYQL3IBijccLJHKx0FmPIOLui3z4+sXLUz5sCBzQdzJWt2q3Uz/fkfXceVbqo5tn5jMwuayQ+uzQg86Uf+fhoGI891XFeVGQgemhPc9NigIlx/Z/W9+4B1QxM+Kd5mgOQHmNl6vF/n+q6g4TIvjZSQFuYPH7/Edb0e7eqDsEHrnfRtmTanw4YEDDALu3KECTI692i2W0f0TJRtXptwjMN9k5rA2i6rQWLyFny+6x74rQ=="; $base64DecodedCipherValue = base64_decode($supplierCypherValue);

Read More
PHP

How to move user-specific log files to AWS S3 and update the user table in CodeIgniter 3 for 1.3 million users?

I am working on a project using CodeIgniter 3 where I store user-specific logs in separate files for each user. I have around 1.3 million users, and I need to move these log files to an AWS S3 bucket. After successfully uploading the files, I also need to update the corresponding entries in the users

Read More
PHP

Looking to modify Go Daddy enhanced checkout button text

I am trying to modify the go daddy enhanced checkout button text. It currently says "Pay Now" and I would like to adjust that. I’m ignorant to this but here is the html code I copied. I am wondering if someone can translate this to a PHP function I can copy into my wordpress theme

Read More
PHP

How to reuse colour palettes across multiple PHP GD canvases/images?

How can I draw and refer to the same set of colours across multiple GD canvasses? I am new to using PHP-GD for images, I have only done a couple very basic things with it. I am creating a map generator that will have 3+ scales as GD canvases. Each scale represents zooming in to

Read More
PHP

Do I need to save state if I'm using a backend database?

I have a simple question. If I am using react on the frontend and node.js or PHP/mysql for a backend, is there any point in using redux to save state? Wouldn’t all my data/state be saved in backend anyway? I know this may be a dumb question, I just don’t want to waist any time.

Read More
PHP

Get WooCommerce product attribute term name from its slug in the current context

I am building a custom table for products, I am attempting to add both simple products and variations to the same table. I have done this so far but I need to modify the title for variation products. I am attempting to do this format: "Product Title Black, 8 in." I have this code: foreach

Read More
PHP

How do I return the response from an asynchronous call?

My goal is to fetch data from MySQL using PHP and Vanilla JS and populate an HTML table using list.js. Fetch is successfully retrieving the data in JSON format; however, I am not 100% sure it’s correct, but I am trying to mimic the example given. Here is the basic outline of the JS: function

Read More