Winrar Monthly Backup Script

I use this script to backup websites and data each month it takes a list of paths and uses winrar via command line appending the current month day year.

@echo off
setlocal enabledelayedexpansion

:: Define the list of folders to archive
set "folders=C:\path\site1 C:\path\site2 C:\path\site3"

:: Get current date components
for /f "tokens=2 delims==" %%I in ('wmic OS Get localdatetime /value') do set datetime=%%I
set "year=!datetime:~0,4!"
set "month=!datetime:~4,2!"
set "day=!datetime:~6,2!"

:: Define WinRAR path (update accordingly)
set "winrar_path=C:\Program Files\WinRAR\WinRAR.exe"

:: Iterate over folders and create archives
for %%F in (%folders%) do (
    for %%A in ("%%F") do set "folder_name=%%~nA"
    set "rar_name=!folder_name!_files_!month!!day!!year!.rar"

    echo Archiving "%%F" as "!rar_name!" with 50GB splits...
    "%winrar_path%" a -r -v50g "!rar_name!" "%%F"
)

echo All archives created successfully with 50GB splits.
endlocal
pause

Pass UTM TAGS Webflow page to all links such as other subdomains/sites

<script>
document.addEventListener('DOMContentLoaded', function(event) {

// create urlParams variable (constant) from URLSearchParams class using current window
const urlParams = new URLSearchParams(window.location.search);
// set UTM medium, source and campaign variables (constants) based on results of URSearchParams
const utm_medium = urlParams.get('utm_medium') || "";
const utm_source = urlParams.get('utm_source') || "";
const utm_campaign = urlParams.get('utm_campaign') || "";
const utm_term = urlParams.get('utm_term') || "";
const utm_content = urlParams.get('utm_content') || "";

const ref_link = urlParams.get('ref') || "";

// get the Outbound button element
links = document.querySelectorAll("a");

links.forEach(function(outboundLink) {
// edit Outbound button element property by appending the URL parameters
var finalLink = "";
if (utm_medium != "")
finalLink += "utm_medium=" + encodeURIComponent(utm_medium);

if (utm_source != "")
{
if (finalLink != "")
finalLink += "&";

finalLink += "utm_source=" + encodeURIComponent(utm_source);
}

if (utm_campaign != "")
{
if (finalLink != "")
finalLink += "&";

finalLink += "utm_campaign" + encodeURIComponent(utm_campaign);
}


if (utm_term != "")
{
if (finalLink != "")
finalLink += "&";

finalLink += "utm_term=" + encodeURIComponent(utm_term);
}

if (ref_link != "")
{
if (finalLink != "")
finalLink += "&";

finalLink += "ref=" + encodeURIComponent(ref_link);
}

if (finalLink != "")
outboundLink.href += "?" + finalLink;

// log final Outbound button link to console
// console.log(outboundLink.href);
});

    } );
</script>
Based on https://stackoverflow.com/a/65297467

Legacy PHP Functions

Just setup a small github repo of some deprecated php function replacements.
I have many websites that I maintain and other old software and always trying to stay on the latest version of PHP. These functions help if you are going from PHP 5 to PHP 7 and PHP 7 to PHP 8

Includes: mysql_* create_function ereg eregi ereg_replace eregi_replace split spliti


https://github.com/VBGAMER45/legacyphpfunctions

Installing Elastic Search 8.0 on CentOS 8 Orcale Linux

A quick guide on setting up Elastic Search

yum install java-1.8.0-openjdk.x86_64
cd /etc/yum.repos.d/
ls
vi elasticsearch.repo
yum install –enablerepo=elasticsearch elasticsearch
systemctl start elasticsearch.service

curl –cacert /etc/elasticsearch/config/certs/http_ca.crt -u elastic hcurl –cacert /etc/elasticsearch/certs/http_ca.crt -u elastic https://localhost:9200

yum install kibana
cd /etc/yum.repos.d/
vi kibana.repo
yum install kibana

/usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana
/bin/systemctl daemon-reload
/bin/systemctl enable kibana.service

sestatus
setsebool httpd_can_network_connect 1 -P

systemctl status firewalld

firewall-cmd –new-zone=elastic-access –permanent


firewall-cmd –zone=elastic-access –add-source=192.68.0.1 –permanent

firewall-cmd –zone=elastic-access –add-port=9200/tcp –permanent

firewall-cmd –zone=elastic-access –add-port=9300/tcp –permanent
firewall-cmd –zone=elastic-access –add-port=5601/tcp –permanent

firewall-cmd –zone=elastic-access –add-port=80/tcp –permanent
firewall-cmd –zone=elastic-access –add-port=443/tcp –permanent

firewall-cmd –reload

/usr/share/kibana/bin/kibana-verification-code

netstat -ntlp

yum -y install nginx httpd-tools

cd /etc/nginx/conf.d

vi es.yoursite.com.conf

nginx -t

service nginx restart