• Home
  • Tools
    • Color Chart
  • Software
    • Windows tricks
      • Windows 11 Speed Up Tricks
      • Windows Command Prompt CMD
    • Android Phone
      • Android – Dangerous Settings to Turn Off
    • Projects
      • Copy Files
      • Php Autoscript
      • Web Tools
  • Payments
  • Notes
  • System Tips

Notes

ACCESS 2022 | Browsers | Css | Htacess | Html | Html5 | Javascript | Microsoft Excel | Mysql | Mysql Dumps | Php | Vb.net | VBscript | Windows <=8 | Windows >=10 | WP | WP Plugin | WP Themes | _Misc Software |

ABCDEFGHIJKLMNOPQRSTUVWXYZ
ON
PRT
OFF

<- Look Inside Data
Conditions:
Order:
1|2|3|4|5|6|7|8|
50 Language Operation Title
Keywords
Application
Code Languageid
Show Html
Show Iframe
Make Public
Viewed
Viewed Date
Mysql Database Using IF In Your Sql Statements
if query
Filtering By Formula
n MySQL, you can use the
IF() function to implement conditional logic directly within your SQL queries.
MySQL IF() function syntax:
sql

IF(condition, value_if_true, value_if_false)

IF(hour=1, (eqMaintenance.intervalof -(equipment.hours -eqMaintenance.hours)), (eqMaintenance.intervalof -(equipment.hours -eqMaintenance.miles)) AS DIFFERENCE

ORDER BY DIFFERENCE
Parameters:

condition: The condition to evaluate.
value_if_true: The value to return if the condition is true.
value_if_false: The value to return if the condition is false.

Example using IF() in a SELECT statement:
sql

SELECT product_id, price, IF(price > 100, 'Expensive', 'Affordable') AS category FROM products;

This query uses the IF() function to categorize products as 'Expensive' if the price is greater than 100, and 'Affordable' otherwise.
Using IF() with PHP:
You can incorporate the MySQL IF() function into your PHP code when constructing SQL queries. For example, to display a message based on the result of a database query, you can use PHP's if statements to handle different scenarios:
Mysql



1
06/06/2025
Mysql Date ADDDATE - Mysql
add date mysql
Mysql



3
02/15/2024
Mysql Date Select The MAX Date Of Each ID
max date unique group
Php
Mysql



2
09/09/2023
Mysql Query Generate The CREATE TABLE Statements
table create exec(
Table Dump
CREATE TABLE `cash` (
`cashid` mediumint(9) NOT NULL AUTO_INCREMENT,
`amount_total` smallint(6) NOT NULL,
`amount_split` smallint(6) NOT NULL,
`caleb` smallint(6) NOT NULL,
`jarrod` smallint(6) NOT NULL,
`received_on` datetime NOT NULL,
`farm` tinyint(4) NOT NULL,
`cutting` tinyint(4) NOT NULL,
`chk_cash` tinyint(4) NOT NULL,
`bale_count` smallint(6) NOT NULL,
`comment` varchar(50) NOT NULL,
`ave_price` decimal(8,2) NOT NULL,
PRIMARY KEY (`cashid`),
KEY `received_on` (`received_on`)
) ENGINE=MyISAM AUTO_INCREMENT=1683 DEFAULT CHARSET=latin1

CREATE TABLE `lastbackup` (
`backupid` mediumint(9) NOT NULL AUTO_INCREMENT,
`to` tinyint(4) NOT NULL,
`type` tinyint(4) NOT NULL,
`method` tinyint(4) NOT NULL,
`device` varchar(30) NOT NULL,
`table_name` varchar(30) NOT NULL,
` database_name` varchar(30) NOT NULL,
`destination` varchar(50) NOT NULL,
`received_on` datetime NOT NULL,
PRIMARY KEY (`backupid`),
KEY `received_on` (`received_on`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1




Programmatically with PHP
You can write a PHP script to connect to your MySQL database and execute queries to generate the CREATE TABLE statements. This is useful for building custom backup tools.
The following approach involves fetching table metadata and reconstructing the SQL, or leveraging PHP's ability to execute shell commands like mysqldump for simplicity:

Executing mysqldump from PHP: This method executes the command-line utility within your PHP script, which is often the most reliable way to get a perfect SQL structure dump.

php

=?php
$db_user = "your_username";
$db_pass = "your_password";
$db_name = "your_database";
$table_name = "your_table";
$output_file = "structure_export.sql";

// Command to export only the structure (--no-data)
$command = "mysqldump -u" . $db_user . " -p" . $db_pass . " " . $db_name . " " . $table_name . " --no-data > " . $output_file;

// Execute the command
exec($command, $output, $return_var);

if ($return_var === 0) {
echo "Table structure exported successfully to " . $output_file;
} else {
echo "Error exporting table structure.";
}
?=


=?php
ALL TABLES
function backup_mysql_database($host, $user, $pass, $dbname, $filename) {
// Ensure the output file has a .sql extension for clarity
if (substr($filename, -4) !== '.sql') {
$filename .= '.sql';
}

// Command to execute mysqldump:
// --opt is enabled by default and is recommended for speed and size
// --single-transaction allows a consistent backup without locking tables for InnoDB tables
$command = sprintf(
'mysqldump -h%s -u%s -p%s --opt --single-transaction %s > %s',
escapeshellarg($host),
escapeshellarg($user),
escapeshellarg($pass),
escapeshellarg($dbname),
escapeshellarg($filename)
);

$output = [];
$result_code = 0;

// Execute the command
exec($command, $output, $result_code);

if ($result_code === 0) {
return "Database dump successful. File saved as: $filename";
} else {
return "Error creating database dump. Command output: " . implode("n", $output);
}
}

// Configuration variables
$DBHOST = 'localhost';
$DBUSER = 'your_username';
$DBPASS = 'your_password';
$DBNAME = 'your_database_name';
$BACKUP_FILE = 'backup_' . date('Y-m-d_H-i-s') . '.sql';

// Run the backup function
$message = backup_mysql_database($DBHOST, $DBUSER, $DBPASS, $DBNAME, $BACKUP_FILE);

echo $message;
?=



=?php
$command = "ls -l"; // Command to list files and directories (on Unix-like systems)
$output_lines = [];
$return_status;

// Execute the command, capture output lines into $output_lines,
// and capture the exit code into $return_status
exec($command, $output_lines, $return_status);

echo "Command Executed:";
echo "$command";

echo "Output Lines:";

print_r($output_lines);
echo "Return Status:";
echo "$return_status"; // 0 usually means success
?=
Mysql



1
12/19/2025
Mysql Query Concat
concat mysql query
UPDATE parts SET pdf=CONCAT(partid,'.pdf'), part_image=CONCAT(partid,'.jpg') WHERE pdf=""

This example numbers the picture names to match the id of the record.

APENDING data before and after a field.
UPDATE `iwspackage` SET iwspackageimg=CONCAT('package',packageid,'.jpg');

UPDATE ads SET img1=CONCAT(adid,'a.jpg'), img2=CONCAT(adid,'b.jpg') , img3=CONCAT(adid,'c.jpg') , img4=CONCAT(adid,'d.jpg'), pdf=CONCAT(adid,'.pdf') WHERE adid>7;
Mysql



1933
09/09/2023
Mysql Query Group By
group by left join
SELECT category,categories.categoryid, COUNT(ads.categoryid) AS junk FROM categories LEFT JOIN ads ON categories.categoryid=ads.categoryid GROUP BY category ORDER BY category


SELECT products.productname, soldout, restock, count( orderedproducts.productid )
FROM categories, products, orderedproducts, orders
WHERE filled = 'Y'
AND orders.orderid = orderedproducts.orderid
AND orderedproducts.productid = products.productid
AND categories.catid = products.catid
AND orders.date>='2010-04-01' AND orders.date<='2010-04-30'
GROUP BY productname


SELECT * FROM `orderedproducts INNER JOIN orders ON orders.orderid=orderedproducts.orderid WHERE orders.date>='2010-04-01' AND orders.date<='2010-04-30'
Mysql



1331
09/09/2023
Mysql Query Finding Orphans Using Left Join
orphan parent left join null
Select * from table1groups left join table1 on table1groups.musgraveid=table1.musgraveid Where table1.musgraveid IS NULL LIMIT 0, 30

The results list only the records that do not have a parent
Mysql



1477
09/09/2023
Mysql Query Alter Tables
add field delete alter table rename update table auto increment engine collation
Mysql



1770
09/09/2023
Mysql Query Using INFORMATION_SCHEMA.COLUMNS To Retrieve Varchar Sizes
field size field length
Field Size Counter
php example stored field in an array
$r=new mysqli_swd();
$sql = "SELECT COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '$database' AND TABLE_NAME = 'purchases' AND (DATA_TYPE = 'varchar' OR DATA_TYPE = 'text')";
$r->dbsql($sql);$result=$r->data;$num=$r->num;
if ($num > 0) {
while($row = $result->fetch_assoc()) {
$res[$row["COLUMN_NAME"]]= $row["CHARACTER_MAXIMUM_LENGTH"];
}
}
Mysql



0
06/05/2025
Mysql Query Different Types Of Queries
sum
Create Queries

SUM

SELECT SUM(amount) AS total_amount FROM orders;
Mysql



0
12/18/2025
Mysql Dumps Archive Database: `softwax3_myfiles
file contact
Mysql Dumps



3
09/09/2023
Mysql Dumps Archive Database: `softwax3_codeSaver`
code language operation
Backup
Mysql Dumps



3
09/09/2023
Php Archive Software Web Activation.php
reg75
Reg75.php
Php



2
01/30/2023
Php Archive Color Change Script
color convert javascript step
Home Page
Php



7
12/28/2022
Php Archive Code Zoom Backup Code
zoom format html_entity_decode
Codezoom.php
Php



0
12/28/2022
Php Constants Setting The Absolute Path
absolute path define constant
Library
Php



3
09/09/2023
Php Customizing Convert Words Into A Graphic
text graphic image convert
$im = imagecreate(400, 30);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);

// The text to draw
$text = 'Testing...';
// Replace path by your own font path
$font = 'arial.ttf';

// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);

// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);


*************************************
The below script would be called with a tag like this from a page:

Header("Content-type: image/gif");
if(!isset($s)) $s=11;
$size = imagettfbbox($s,0,"/fonts/TIMES.TTF",$text);
$dx = abs($size[2]-$size[0]);
$dy = abs($size[5]-$size[3]);
$xpad=9;
$ypad=9;
$im = imagecreate($dx+$xpad,$dy+$ypad);
$blue = ImageColorAllocate($im, 0x2c,0x6D,0xAF);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
ImageRectangle($im,0,0,$dx+$xpad-1,$dy+$ypad-1,$black);
ImageRectangle($im,0,0,$dx+$xpad,$dy+$ypad,$white);
ImageTTFText($im, $s, 0, (int)($xpad/2)+1, $dy+(int)($ypad/2), $black, "/fonts/TIMES.TTF", $text);
ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2)-1, $white, "/fonts/TIMES.TTF", $text);
ImageGif($im);
ImageDestroy($im);
?>

It is very important to realize that you cannot put any HTML tags in this file. There should also not be any spaces or blank lines before or after the tags. If you are getting a broken image using this script, chances are you have a stray carriage return somewhere outside the PHP tags
Php



1860
09/09/2023
Php Customizing Rename A File In PHP
rename file
Change File Names
rename a file in PHP, use the built-in
rename() function. This function takes the old filename/path and the new filename/path as mandatory arguments and returns true on success or false on failure.
rename() Function Syntax


rename($oldname, $newname, $context);

$oldname (Mandatory): Specifies the current name/path of the file or directory.
$newname (Mandatory): Specifies the new name/path for the file or directory.
$context (Optional): Specifies the behavior of the stream.
Php



0
12/19/2025
Php Customizing Using Strip_tags
strip tags html
Unwanted Table Breaks
Php



0
12/20/2025
Php Database Concat - Combine Fields Or Text
add join concat
Php



2
09/09/2023
Php Database Count
count query

count records that link to same file


$sql="SELECT * FROM eqMaintenance WHERE maintenanceid = $value_";
$r->dbsql($sql);$row=$r->data1;
$upfile="../maintenance/".$row['img'];

Start count query


$sql="SELECT count(img) as dog FROM eqMaintenance WHERE img='".$row['img']."' GROUP BY img";
$r->dbsql($sql);$dog=$r->data1[0];
if(file_exists($upfile) && $dog<2)unlink($upfile);

//example from php file creator

SELECT hide,count(hide) as dog FROM `invoice` GROUP BY hide LIMIT 0, 30

SELECT invoices.customerid, `last_name` , `first_name`, COUNT(`last_name`) AS dog,
count(if(`date`< ADDDATE(NOW(), INTERVAL -365 DAY), 1, null)) AS year1, count(if(`date`>= ADDDATE(NOW(), INTERVAL -365 DAY), 1, null)) AS year0, count(if(`date`< ADDDATE(NOW(), INTERVAL -730 DAY), 1, null)) AS year2
FROM `invoices`
INNER JOIN `customer` ON customer.customerid = invoices.customerid
GROUP BY invoices.customerid, `last_name` , `first_name`
ORDER BY year0,year1
Php



3
12/28/2023
Php Database Delete
left join delete orphans
Php



2
09/09/2023
Php Database Find Orphans
left join orphan delete
Php



2
09/09/2023
Php Database Group By
group by inner join
Php



2
09/09/2023
Php Database Insert Table
insert table
Php



2
09/09/2023
Php Database Insert Using Select
insert select
Php



2
09/09/2023
Php Database Variable Lenghts
variable description size
Php



2
09/09/2023
Php Database Inserting Multiple Rows Into A Table
insert multiple records
Database
Php



0
12/04/2023
Php Date Date Functions
time date
$sessionid=strtotime(date("Y-m-d H:i:s"));

format character Description Example returned values
a Lowercase Ante meridiem and Post meridiem am or pm
A Uppercase Ante meridiem and Post meridiem AM or PM
B Swatch Internet time 000 through 999
c ISO 8601 date (added in PHP 5) 2004-02-12T15:19:21+00:00
d Day of the month, 2 digits with leading zeros 01 to 31
D A textual representation of a day, three letters Mon through Sun
F A full textual representation of a month, such as January or March January through December
g 12-hour format of an hour without leading zeros 1 through 12
G 24-hour format of an hour without leading zeros 0 through 23
h 12-hour format of an hour with leading zeros 01 through 12
H 24-hour format of an hour with leading zeros 00 through 23
i Minutes with leading zeros 00 to 59
I (capital i) Whether or not the date is in daylights savings time 1 if Daylight Savings Time, 0 otherwise.
j Day of the month without leading zeros 1 to 31
l (lowercase 'L') A full textual representation of the day of the week Sunday through Saturday
L Whether it's a leap year 1 if it is a leap year, 0 otherwise.
m Numeric representation of a month, with leading zeros 01 through 12
M A short textual representation of a month, three letters Jan through Dec
n Numeric representation of a month, without leading zeros 1 through 12
O Difference to Greenwich time (GMT) in hours Example: +0200
r RFC 2822 formatted date Example: Thu, 21 Dec 2000 16:01:07 +0200
s Seconds, with leading zeros 00 through 59
S English ordinal suffix for the day of the month, 2 characters st, nd, rd or th. Works well with j
t Number of days in the given month 28 through 31
T Timezone setting of this machine Examples: EST, MDT ...
U Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) See also time()
w Numeric representation of the day of the week 0 (for Sunday) through 6 (for Saturday)
W ISO-8601 week number of year, weeks starting on Monday (added in PHP 4.1.0) Example: 42 (the 42nd week in the year)
Y A full numeric representation of a year, 4 digits Examples: 1999 or 2003
y A two digit representation of a year Examples: 99 or 03
z The day of the year (starting from 0) 0 through 365
Z Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive. -43200 through 43200


Unrecognized characters in the format string will be printed as-is. The Z format will always return 0 when using gmdate().

Example 1. date() examples
****************************************
a "am" or "pm"
A "AM" or "PM"
B Swatch Internet time
d day of the month, 2 digits with leading zeros; i.e. "01" to "31"
D day of the week, textual, 3 letters; i.e. "Fri"
F month, textual, long; i.e. "January"
g hour, 12-hour format without leading zeros; i.e. "1" to "12"
G hour, 24-hour format without leading zeros; i.e. "0" to "23"
h hour, 12-hour format; i.e. "01" to "12"
H hour, 24-hour format; i.e. "00" to "23"
i minutes; i.e. "00" to "59"
I (capital i) "1" if Daylight Savings Time, "0" otherwise.
j day of the month without leading zeros; i.e. "1" to "31"
l (lowercase 'L') day of the week, textual, long; i.e. "Friday"
L boolean for whether it is a leap year; i.e. "0" or "1"
m month; i.e. "01" to "12"
M month, textual, 3 letters; i.e. "Jan"
n month without leading zeros; i.e. "1" to "12"
r RFC 822 formatted date; i.e. "Thu, 21 Dec 2000 16:01:07 +0200" (added in PHP 4.0.4)
s seconds; i.e. "00" to "59"
S English ordinal suffix, textual, 2 characters; i.e. "th", "nd"
t number of days in the given month; i.e. "28" to "31"
T Timezone setting of this machine; i.e. "MDT"
U seconds since the epoch
w day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)
Y year, 4 digits; i.e. "1999"
y year, 2 digits; i.e. "99"
z day of the year; i.e. "0" to "365"
Z timezone offset in seconds (i.e. "-43200" to "43200"). The offset for timezones west of UTC is always negative, and for those east of UTC is always positive
Php



2090
09/09/2023
Php Date Add Day
add day
Php



3
09/09/2023
Php Date Current Date
today
Php



2
09/09/2023
Php Date Getdate
date breakdown
Php



2
09/09/2023
Php Date Mktime - Create New Date
build date new date
Php



2
09/09/2023
Php Date String To Time
strtotime function convert
Php



4
02/12/2024
Php Files Download Files While Changing Name
download header
$filename = "theDownloadedFileIsCalledThis.mp3";
$myFile = "/absolute/path/to/my/file.mp3";

$mm_type="application/octet-stream";

header("Cache-Control: public, must-revalidate");
header("Pragma: hack"); // WTF? oh well, it works...
header("Content-Type: " . $mm_type);
header("Content-Length: " .(string)(filesize($myFile)) );
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Transfer-Encoding: binaryn");

readfile($myFile);
Php



1402
09/09/2023
Php Files Getting A Files Extension
file extension
File Management
Php



0
11/20/2025
Php Files Reading TXT Files
fclose fgets fopen fread filesize feof read file whole line character
[Reading the Whole File]
The fread function reads a number of bytes from a file, up to the end of the file (whichever comes first). The filesize function returns the size of the file in bytes, and can be used with the fread function, as in the following example.

$listFile = "junk.txt";
if (!($fp = fopen($listFile, "r")))
exit("Unable to open the input file, $listFile.");
$buffer = fread($fp, filesize($listFile));
print "$buffer
\n";
fclose($fp);
?>

[Reading Line by Line]
The fgets function is used to read a line at a time. The function takes two parameters, the file handle, and the number of bytes to read. The function reads data up to a new line, or the number of bytes specified (whichever comes first), and returns the line read. The following is an example of using the fgets function.

if (!($fp = fopen("junk.txt", "r")))
exit("Unable to open the input file.");
while (!feof($fp))
{
$buffer = fgets($fp, 1024);
print "$buffer
\n";
}
fclose($fp);
?>

[Reading a Character at a time]
The fgetc() function is used to read a single character from a file.

Note: After a call to this function the file pointer has moved to the next character.

Example
The example below reads a file character by character, until the end of file is true:

if (!($f=fopen("welcome.txt","r")))
exit("Unable to open file.");
while (!feof($f))
{
$x=fgetc($f);
echo $x;
}
fclose($f);
?>
Php



1289
09/09/2023
Php Files Write To Txt File
fopen fwrite rewind fopen write file
Writing to Files
The fwrite function is used to write a string, or part of a string to a file. The function takes three parameters, the file handle, the string to write, and the number of bytes to write. If the number of bytes is omitted, the whole string is written to the file. If you want the lines to appear on separate lines in the file, use the \n character. Note: Windows requires a carriage return character as well as a new line character, so if you're using Windows, terminate the string with \r\n.

The following example logs the visitor to a file, then displays all the entries in the file.

$logFile = "stats.txt";
// Open the file in append/read mode
$fp = fopen($logFile, "a+");
// Create a string containing the user details
$userDetails = $HTTP_USER_AGENT;
if (isset($HTTP_REFERER))
$userDetails = $userDetails . " $HTTP_REFERER
\r\n";
else
$userDetails = $userDetails . "
\r\n";
// Write the user details to the file
fwrite($fp, "$userDetails");
// Move to the start of the file
rewind($fp);
$entries = 0;
// Display each line in the file
while(!feof($fp))
{
$buffer = fgets($fp, 1024);
if ($buffer != "")
{
print $buffer;
$entries++;
}
}
// Show a summary
print "There are $entries entries in the log file
";
fclose ($fp);
?>



Php



990
09/09/2023
Php Files Clean Url
? url clean & #
if you ever add variables to the url line you need to use this function
urldecode for passing gets.
$urlpart1=urldecode($urlpart1);
$urlpart2=urldecode($urlpart2);
$url="http://www.mydomain.com?$urlpart1&$urlpart2;

Do not use it on a completed url. It will totally mess everything up.
Php



1325
09/09/2023
Php Files Warning: Mkdir() [function.mkdir]: Permission Denied
mkdir permission denied 777
I had difficulty using mkdir() function until I set the above folder permission to 777. So anytime you write files or create directories using php, check your folder permissions using your cpanel's file manager. 755 did not help only 777 would work for me.

$topDir=dirname(__FILE__);
$folder0="/".$PHPfolder;
$source_dir = $topDir."/"; //.$folder0."/";
if(is_dir($topDir."/BACKED")==false){ mkdir($topDir."/BACKED", 0777,true); }
Php



1196
09/09/2023
Php Files Making An Image Viewer
files images viewer
Sometimes i have pictures that people want to view but are too numerous or inconvenient to email.
I just do a batch conversion on the images (I use Irfan view a free app) and upload them to a new folder I called "stylists". Using this script in an index.php, I dump it with the pictures. It will show them in your browser.

[Create image viewer]
$imagedirectory="../stylists/";
$dir = opendir($imagedirectory);

while ($file = readdir($dir)){
//for ($i=1; $i<=500; $i++){
// $file = readdir($dir);
$fullpath=$current_dir.$file;

echo "

$file
";
}
closedir($dir);
?>

You can tweak it to your folder requirements
Php



752
09/09/2023
Php Files Config.php
config
Config.php
config.php->
require_once($_SERVER['DOCUMENT_ROOT']."/activate75.php");
if($_SERVER['REMOTE_ADDR']=="127.0.0.1"){ $server='localhost';$user='greatone';$password='gr38t0n3';$database='hairshoppe'; $_SESSION['LEVEL']=10; $_SESSION["EMPLOYEE"]=1;}
else{ $server='localhost';$user='softwax3_Steve99';$password='pay99.bill';$database='softwax3_hairShoppe'; }// if($_SESSION['EMPLOYEE']==""){ echo "Login Again";exit; } }
$LEVEL=$_SESSION['LEVEL'];$debug=true;$domain="softwarewebdesign.com|127.0.0.1";
$sessionListSave="EMPLOYEE";$lightbox="https://www.softwarewebdesign.com";
define('SWD_KEY', 'KingOfKings');
setcookie("humans_21909", "", time() - 3600, "/");
//define('SWD_AUTHENTICATE', true); // inactivate75.php


activate75.php ->
if($bypass!=true){
$user='softwax3_build99';$password='Web2Build.now';$database='softwax3_SoftwareUsers';
$connection = swd_mysql("localhost", $user,$password,$database);
//if($appid>"636390303046554897"){$qu=new mysqli_swd();}else{$qu=new dbase();}
$qu=new mysqli_swd();
$sql="SELECT lock_device FROM users WHERE device_name='".$_COOKIE["machine_id"]."'";
$qu->dbsql($sql);
if($qu->num==0 || $qu->data1[0]==1) { echo "You are locked out";exit; }
$_SESSION['LEVEL']=10;
mysqli_close($connection);
define('SWD_AUTHENTICATE', true);
}define('SWD_KEY', 'JesusIsLord');
if($bypass==true){define('SWD_AUTHENTICATE', true);}
Php



1
05/11/2025
Php Files Upload Multiple Files
multiple files upload download
Developer
Php



2
12/23/2023
Php Files Activate75.php
activate security
Developer
//require_once($_SERVER['DOCUMENT_ROOT']."/activate75.php");

if($bypass!=true){
$appid="636390303046554890";
$user='softwax3_build99';$password='Web2Build.now';$database='softwax3_SoftwareUsers';
$connection = swd_mysql("localhost", $user,$password,$database);
//if($appid>"636390303046554897"){$qu=new mysqli_swd();}else{$qu=new dbase();}
$qu=new mysqli_swd();
$sql="SELECT lock_device,security_level FROM users WHERE device_name='".$_COOKIE["machine_id"]."'";
$qu->dbsql($sql);
if($qu->num==0 || $qu->data1[0]==1) { echo "You are locked out";exit; }
$_SESSION['LEVEL']=$qu->data1[1]; $LEVEL=$qu->data1[1];
define('SWD_AUTHENTICATE', true);define('SWD_KEY', 'JesusIsLord');
}
if($bypass==true){define('SWD_AUTHENTICATE', true);}

?>
Php



0
05/11/2025
Php Files Create Directory File List After Database Backup
file list database backup example
Backup Sites
Php



0
12/19/2025
Php Files Copy A File In PHP
file copy
Copying Files
To copy a file in PHP, you use the built-in
copy() function. This function takes the source file path and the destination path as arguments and returns true on success or false on failure.
Syntax
php

bool copy(string $source, string $destination, resource $context = null): bool

$source (Required): The path to the original file you want to copy.
$destination (Required): The path, including the new filename, where the file will be copied. If the destination file already exists, it will be overwritten.
$context (Optional): A context resource created with stream_context_create().

Example
Here is a basic example of how to copy a file and check the result:

=?php

// Specify the source file path
$source_file = 'path/to/original_file.txt';

// Specify the destination path, including the new filename
$destination_file = 'path/to/new_directory/copied_file.txt';

// Use the copy() function
if (copy($source_file, $destination_file)) {
echo "File copied successfully!";
} else {
echo "Something went wrong while copying the file. Check permissions.";
}

?=


Important Considerations

File Permissions: The PHP script must have permission to read the source file and write to the destination directory. Permission errors are a common reason for failure.
Destination Path: The destination must include the new filename, not just the directory name. For example, you need .../new_dir/copied.txt, not just .../new_dir/.
Error Handling: The copy() function returns a boolean, so it is important to use an if statement to handle potential errors gracefully.
Moving vs. Copying: If you want to move a file (delete the original after copying), use the rename() function instead.
Uploaded Files: For handling files uploaded via an HTML form (HTTP POST method), you must use the specialized move_uploaded_file() function, not copy().
Php



0
12/20/2025
Php Formatting Physically Resize An Image
resize image
/*
* File: SimpleImage.php
* Author: Simon Jarvis
* Copyright: 2006 Simon Jarvis
* Date: 08/11/06
* Link: http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
* http://www.gnu.org/licenses/gpl.html
*
*/

class SimpleImage {

var $image;
var $image_type;

function load($filename) {
$image_info = getimagesize($filename);
$this->image_type = $image_info[2];
if( $this->image_type == IMAGETYPE_JPEG ) {
$this->image = imagecreatefromjpeg($filename);
} elseif( $this->image_type == IMAGETYPE_GIF ) {
$this->image = imagecreatefromgif($filename);
} elseif( $this->image_type == IMAGETYPE_PNG ) {
$this->image = imagecreatefrompng($filename);
}
}
function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null) {
if( $image_type == IMAGETYPE_JPEG ) {
imagejpeg($this->image,$filename,$compression);
} elseif( $image_type == IMAGETYPE_GIF ) {
imagegif($this->image,$filename);
} elseif( $image_type == IMAGETYPE_PNG ) {
imagepng($this->image,$filename);
}
if( $permissions != null) {
chmod($filename,$permissions);
}
}
function output($image_type=IMAGETYPE_JPEG) {
if( $image_type == IMAGETYPE_JPEG ) {
imagejpeg($this->image);
} elseif( $image_type == IMAGETYPE_GIF ) {
imagegif($this->image);
} elseif( $image_type == IMAGETYPE_PNG ) {
imagepng($this->image);
}
}
function getWidth() {
return imagesx($this->image);
}
function getHeight() {
return imagesy($this->image);
}
function resizeToHeight($height) {
$ratio = $height / $this->getHeight();
$width = $this->getWidth() * $ratio;
$this->resize($width,$height);
}
function resizeToWidth($width) {
$ratio = $width / $this->getWidth();
$height = $this->getheight() * $ratio;
$this->resize($width,$height);
}
function scale($scale) {
$width = $this->getWidth() * $scale/100;
$height = $this->getheight() * $scale/100;
$this->resize($width,$height);
}
function resize($width,$height) {
$new_image = imagecreatetruecolor($width, $height);
imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight());
$this->image = $new_image;
}
}
?>
============
Save the above file as SimpleImage.php and take a look at the following examples of how to use the script.

The first example below will load a file named picture.jpg resize it to 250 pixels wide and 400 pixels high and resave it as picture2.jpg

include('SimpleImage.php');
$image = new SimpleImage();
$image->load('picture.jpg');
$image->resize(250,400);
$image->save('picture2.jpg');
?>
If you want to resize to a specifed width but keep the dimensions ratio the same then the script can work out the required height for you, just use the resizeToWidth function.

include('SimpleImage.php');
$image = new SimpleImage();
$image->load('picture.jpg');
$image->resizeToWidth(250);
$image->save('picture2.jpg');
?>
You may wish to scale an image to a specified percentage like the following which will resize the image to 50% of its original width and height

include('SimpleImage.php');
$image = new SimpleImage();
$image->load('picture.jpg');
$image->scale(50);
$image->save('picture2.jpg');
?>
You can of course do more than one thing at once. The following example will create two new images with heights of 200 pixels and 500 pixels

include('SimpleImage.php');
$image = new SimpleImage();
$image->load('picture.jpg');
$image->resizeToHeight(500);
$image->save('picture2.jpg');
$image->resizeToHeight(200);
$image->save('picture3.jpg');
?>
The output function lets you output the image straight to the browser without having to save the file. Its useful for on the fly thumbnail generation

header('Content-Type: image/jpeg');
include('SimpleImage.php');
$image = new SimpleImage();
$image->load('picture.jpg');
$image->resizeToWidth(150);
$image->output();
?>
The following example will resize and save an image which has been uploaded via a form

if( isset($_POST['submit']) ) {
include('SimpleImage.php');
$image = new SimpleImage();
$image->load($_FILES['uploaded_image']['tmp_name']);
$image->resizeToWidth(150);
$image->output();
} else {
?>


}
?>
Php



1189
09/09/2023
Php Formatting Preparing Url For Passing With Php
url encoding encode special characters
Special characters such as spaces will mess up a url to the point where it will not work. PHP has these functions to handle this. Your will need to apply for each parameter passed or the "&" sign will be replaced

for passing $_GETS

rawurlencode()

urlencode($var1) and urldecode($var1) //return the information into a readable format
Php



808
09/09/2023
Php Formatting Strip Html Tags
strip html
Library
$text = '

Test paragraph.

Other text';
echo strip_tags($text);
echo "n";

// Allow

and
echo strip_tags($text, '

');

// as of PHP 7.4.0 the line above can be written as:
// echo strip_tags($text, ['p', 'a']);
?>




The strip_tags() function strips a string from HTML, XML, and PHP tags.

Note: HTML comments are always stripped. This cannot be changed with the allow parameter.

Note: This function is binary-safe.

Syntax
strip_tags(string,allow)
Parameter Values
Parameter Description
string Required. Specifies the string to check
allow Optional. Specifies allowable tags. These tags will not be removed
Technical Details
Return Value: Returns the stripped string

Example
Strip the string from HTML tags, but allow <b> tags to be used:

<?php
echo strip_tags("Hello <b><i>world!</i></b>","<b>");
?>
Php



4
09/09/2023
Php Formatting Formating For Numbers
number format
Ereg Eregi Preg_match Preg Match
keywords: ereg eregi preg_match preg match

Syntax:

preg_replace( $pattern, $replacement, $subject, $limit, $count )

Return Value: This function returns an array if the subject parameter is an array, or a string otherwise.

Example: In this example we use preg_replace to remove non-numeric characters from a string, leaving only the numbers. It then prints the extracted numbers from the string.


// PHP program to illustrate
// preg_replace function

// Declare a variable and initialize it
$geeks = 'Welcome 2 Geeks 4 Geeks.';

// Filter the Numbers from String
$int_var = preg_replace('/[^0-9]/', '', $geeks);

// print output of function
echo("The numbers are: $int_var n");
?>
Output
The numbers are: 24
===========================================
filter_var
You can use filter_var and sanitize the string to only include integers.
$s = "Lesson 001: Complete";
echo filter_var($s, FILTER_SANITIZE_NUMBER_INT);
==========================================

$s = "Lesson 001: Complete";
preg_match("/([0-9]+)/", $s, $matches);
echo $matches[1];
==========================================
number_format (1234.567);
//Returns the number 1,235
number_format (1234.567, 2);
//Returns the number 1,234.57

number_format (1234.567, 2, ',', ' ');
//Returns the number 1 234,57

number_format (1234.567, 1, 'a', 'b');
//Returns the number 1b234a6
Php



2
09/09/2023

Software Web Design