• Home
    • Payments
  • 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
  • Notes
    • How to Code
    • System Tips
  • News
    • Comparing SSD to HDD

How to Code

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
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



753
05/05/2026
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



2
05/05/2026
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



1
05/05/2026
Php Files Create Directory File List After Database Backup
file list database backup example
Backup Sites
Php



1
05/05/2026
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



1
05/05/2026
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



1190
05/05/2026
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



809
05/05/2026
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



5
05/05/2026
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



3
05/05/2026
Php Formatting Html_entity_decode
decode format
Restoring Html Saves
Php



3
05/05/2026
Php Formatting Htmlentities
html convert format
Html, Php Saves
Php



3
05/05/2026
Php Formatting Remove Ascii > 127
ascii remove delete
String Cleanup
Php



1
05/05/2026
Php Formatting Htmlarea Example
html area SWD
Bible Form
Php



2
05/05/2026
Php Function Create Graphic Button On The Fly
grapic button image color
session_start();
session_register('sessioncode');
//Header("Content-type: image/jpeg");
//echo "beg test";
$filename = "images/image1.gif";
$im = imagecreate(55, 15);
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 100, 100, 100);
imagecolortransparent($im, $bg);
//imagestring($im, 5, 0, 0, substr(strtoupper(md5("Myshit".$sessioncode)), 0,6), $textcolor);
imagestring($im, 5, 0, 0, substr(strtoupper("Myshit"), 0,6), $textcolor);
imageGif($im,$filename);
ImageDestroy($im);
//***************************************************************
$filename = "images/image.gif";
$img = ImageCreate(200,20);
$red = ImageColorAllocate($img, 255, 0, 0); $white = ImageColorAllocate($img, 255, 255, 255);
ImageString($img, 3, 3, 3, "Uh, this is an image!", $white); ImageGif($img, $filename);

ImageDestroy($img);
echo "";
echo "Finished";
exit();
?>
Php



1236
05/05/2026
Php Function Automatically Make Urls Clickable
hyperlinks click email url link
function _make_url_clickable_cb($matches) {
$ret = '';
$url = $matches[2];

if ( empty($url) )
return $matches[0];
// removed trailing [.,;:] from URL
if ( in_array(substr($url, -1), array('.', ',', ';', ':')) === true ) {
$ret = substr($url, -1);
$url = substr($url, 0, strlen($url)-1);
}
//return $matches[1] . "$url" . $ret;
return $matches[1] . "$url" . $ret;
}

function _make_web_ftp_clickable_cb($matches) {
$ret = '';
$dest = $matches[2];
$dest = 'http://' . $dest;

if ( empty($dest) )
return $matches[0];
// removed trailing [,;:] from URL
if ( in_array(substr($dest, -1), array('.', ',', ';', ':')) === true ) {
$ret = substr($dest, -1);
$dest = substr($dest, 0, strlen($dest)-1);
}
return $matches[1] . "$dest" . $ret;
}

function _make_email_clickable_cb($matches) {
$email = $matches[2] . '@' . $matches[3];
return $matches[1] . "$email";
}

function MakeHyperlink($ret) {
$ret = ' ' . $ret;
// in testing, using arrays here was found to be faster
$ret = preg_replace_callback('#([\s>])([\w]+?://[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]*)#is', '_make_url_clickable_cb', $ret);
$ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]*)#is', '_make_web_ftp_clickable_cb', $ret);
$ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret);

// this one is not in an array because we need it to run last, for cleanup of accidental links within links
$ret = preg_replace("#(]+?>|>))]+?>([^>]+?)#i", "$1$3", $ret);
$ret = trim($ret);
return $ret;
}
Php



1618
05/05/2026
Php Function Ziping And Unziping Server Folders Using Php
zip unzip directory folder backup mysql backup directory
// I use a browser script that send the proper data to back up since if have multiple accounts. I separate the small files in one zip and large files in another. Under case 1. you will notice mp3 and zip this prevents bloated zips which may fail. Video and music should be done seperately from the rest of the files. I included a mysql backup that gets the data and makes a .sql file if you give it database information.

class Utils
{
public static function listDirectory($dir)
{
$result = array();
$root = scandir($dir);
foreach($root as $value) {
if($value === '.' || $value === '..') {
continue;
}
if(is_file("$dir$value")) {
$result[] = "$dir$value";
continue;
}
if(is_dir("$dir$value")) {
$result[] = "$dir$value/";
}
foreach(self::listDirectory("$dir$value/") as $value)
{
$result[] = $value;
}
}
return $result;
}
}

/*
use if you need to rename or auto download
$file = '/path/to/zip/file.zip';
$file_name = basename($file);
header("Content-Type: application/zip");
header("Content-Disposition: attachment; filename=" . $file_name);
header("Content-Length: " . filesize($file));
readfile($file);
exit;
*/


$project=$_GET["pr"];$projectid=$_GET["id"];$PHPfolder=$_GET["fo"];$PHPdatabase=$_GET["db"];$user=$_GET["us"]; $password=$_GET["pa"];$return1=$_GET["re"];
$exportstring="pr=$project&fo=$PHPfolder&db=$PHPdatabase&us=$user&pa=$password&re=$return1&id=$projectid";
$server="localhost";
$AC=$_GET["L"];
$topDir=dirname(__FILE__);
$folder0="/".$PHPfolder;
$source_dir = $topDir.$folder0."/";
if(strlen($PHPfolder)==1)$source_dir = $topDir."/"; // For those sites where zipdemo is in their root
if(is_dir($topDir."/BACKED")==false){ mkdir($topDir."/BACKED", 0777); }
if($AC=="" && strlen($PHPdatabase)>1){
mysql_connect($server,$user,$password);
mysql_select_db($PHPdatabase);
$backupFile =$source_dir.$PHPdatabase.".sql";
$result .= "# MySQL Data Backup of ".$PHPdatabase."\n";
$result .= "# This was generated on " . date("m/d/Y") . "\n\n";

$tables = mysql_list_tables($PHPdatabase);
for($i = 0; $i < mysql_num_rows($tables); $i++){
$table = mysql_tablename ($tables, $i);
if(substr($table,0,7)!="tblStat"){
$result .= "# Start of $table \n";
$result .= "TRUNCATE TABLE $table;\n";
$query = mysql_query("select * from $table");
$num_fields = mysql_num_fields($query);
$result .= "$table fields (\n";
for($ii = 0; $ii < $num_fields; $ii++) {
$result.= mysql_field_name($query,$ii)."-".mysql_field_type($query,$ii)."(".mysql_field_len($query,$ii).")".mysql_field_flags($query,$ii)."\n";
}
$result.=");\n";
$numrow = mysql_num_rows($query);

while( $row = mysql_fetch_array($query, MYSQL_NUM))
{
$result .= "INSERT INTO ".$table." VALUES(";
for($j=0; $j<$num_fields; $j++)
{
$row[$j] = addslashes($row[$j]);
$row[$j] = str_replace("\n","\\n",$row[$j]);
$row[$j] = str_replace("\r","",$row[$j]);
if (isset($row[$j]))
$result .= "\"$row[$j]\"";
else
$result .= "\"\"";
if ($j<($num_fields-1))
$result .= ", ";
}
$result .= ");\n";
}
}
if ($i+1 != mysql_num_rows($tables))
$result .= "\n";
}
$ID++;

// ===================

$fp = fopen($backupFile, "w");
fwrite($fp, $result);
// Move to the start of the file
fclose($fp);
}
//echo $topDir."/BACKED".$folder0."L.zip"; echo $exportstring;exit;
switch($AC){
case 1:
$zip_file = $topDir."/BACKED/".$project."L.zip";
$fi0=$_GET["fi0"];
$exportstring.="&fi0=$fi0&fi1=/BACKED/".$project."L.zip";
break;
default:
$zip_file = $topDir."/BACKED/".$project.".zip";
$exportstring.="&fi0=/BACKED/".$project.".zip";
break;
}
//echo $zip_file;exit;
$file_list = Utils::listDirectory($source_dir);
//echo "shit2";exit;
$zip = new ZipArchive();
if ($zip->open($zip_file, ZIPARCHIVE::CREATE) === true) {
foreach ($file_list as $file) {
if ($file !== $zip_file) {
switch($AC){
case 1:
if(filesize($file)>= 250000 && strpos($file,".zip")==0 && strpos($file,".mp3")==0) $zip->addFile($file, substr($file, strlen($source_dir)));
break;
default:
if(filesize($file)<= 250000) $zip->addFile($file, substr($file, strlen($source_dir)));
break;
}
}
//$i++;if($i==10)break;
}
$zip->close();
}
if($AC==""){ header("location:zipdemo.php?$exportstring&L=1");exit; }
else{ header("location:http://$return1?$exportstring"); exit; }
?>

This script includes header files which may hiccup if error reporting is set to show warnings. The one below will handle warnings.

class Utils
{
public static function listDirectory($dir)
{
$result = array();
$root = scandir($dir);
foreach($root as $value) {
if($value === '.' || $value === '..') {
continue;
}
if(is_file("$dir$value")) {
$result[] = "$dir$value";
continue;
}
if(is_dir("$dir$value")) {
$result[] = "$dir$value/";
}
foreach(self::listDirectory("$dir$value/") as $value)
{
$result[] = $value;
}
}
return $result;
}
}

/*
$file = '/path/to/zip/file.zip';
$file_name = basename($file);
header("Content-Type: application/zip");
header("Content-Disposition: attachment; filename=" . $file_name);
header("Content-Length: " . filesize($file));
readfile($file);
exit;
*/
$project=$_GET["pr"];$projectid=$_GET["id"];$PHPfolder=$_GET["fo"];$PHPdatabase=$_GET["db"];$user=$_GET["us"]; $password=$_GET["pa"];$return1=$_GET["re"];
$project="Peak_Wellness";$PHPdatabase="the1324812461410";$user="the1324812461410";$password="v4K#htNPNfeG";
$return1="www.softwarewebdesign.com/SWD/EMAIL/backmeup.php";$projectid=27;
$exportstring="pr=$project&fo=$PHPfolder&db=$PHPdatabase&us=$user&pa=$password&re=$return1&id=$projectid";
$server="the1324812461410.db.11744884.hostedresource.com";
$AC=$_GET["L"];
$topDir=dirname(__FILE__);
$folder0="/".$PHPfolder;
$source_dir = $topDir."/"; //.$folder0."/";
if(is_dir($topDir."/BACKED")==false){ mkdir($topDir."/BACKED", 0777); }
if($AC=="" && strlen($PHPdatabase)>1){
mysql_connect($server,$user,$password);
mysql_select_db($PHPdatabase);
$backupFile =$source_dir.$PHPdatabase.".sql";
$result .= "# MySQL Data Backup of ".$PHPdatabase."\n";
$result .= "# This was generated on " . date("m/d/Y") . "\n\n";

$tables = mysql_list_tables($PHPdatabase);
for($i = 0; $i < mysql_num_rows($tables); $i++){
$table = mysql_tablename ($tables, $i);
if(substr($table,0,7)!="tblStat"){
$result .= "# Start of $table \n";
$result .= "TRUNCATE TABLE $table;\n";
$query = mysql_query("select * from $table");
$num_fields = mysql_num_fields($query);
$result .= "$table fields (\n";
for($ii = 0; $ii < $num_fields; $ii++) {
$result.= mysql_field_name($query,$ii)."-".mysql_field_type($query,$ii)."(".mysql_field_len($query,$ii).")".mysql_field_flags($query,$ii)."\n";
}
$result.=");\n";
$numrow = mysql_num_rows($query);

while( $row = mysql_fetch_array($query, MYSQL_NUM))
{
$result .= "INSERT INTO ".$table." VALUES(";
for($j=0; $j<$num_fields; $j++)
{
$row[$j] = addslashes($row[$j]);
$row[$j] = str_replace("\n","\\n",$row[$j]);
$row[$j] = str_replace("\r","",$row[$j]);
if (isset($row[$j]))
$result .= "\"$row[$j]\"";
else
$result .= "\"\"";
if ($j<($num_fields-1))
$result .= ", ";
}
$result .= ");\n";
}
}
if ($i+1 != mysql_num_rows($tables))
$result .= "\n";
}
$ID++;

// ===================

$fp = fopen($backupFile, "w");
fwrite($fp, $result);
// Move to the start of the file
fclose($fp);
}
//echo "Done sql";exit;
//echo $topDir."/BACKED".$folder0."L.zip"; echo $exportstring;exit;
switch($AC){
case 1:
$zip_file = $topDir."/BACKED/".$project."L.zip";
$fi0=$_GET["fi0"];
$exportstring.="&fi0=$fi0&fi1=/BACKED/".$project."L.zip";
break;
default:
$zip_file = $topDir."/BACKED/".$project.".zip";
$exportstring.="&fi0=/BACKED/".$project.".zip";
break;
}
//echo $zip_file;exit;
$file_list = Utils::listDirectory($source_dir);
//echo "shit2";exit;
$zip = new ZipArchive();
if ($zip->open($zip_file, ZIPARCHIVE::CREATE) === true) {
foreach ($file_list as $file) {
if ($file !== $zip_file) {
switch($AC){
case 1:
if(filesize($file)>= 250000 && strpos($file,".zip")==0 && strpos($file,".mp3")==0) $zip->addFile($file, substr($file, strlen($source_dir)));
break;
default:
if(filesize($file)<= 250000) $zip->addFile($file, substr($file, strlen($source_dir)));
break;
}
}
//$i++;if($i==10)break;
}
$zip->close();
}
/*
if($AC==""){ header("location:zipdemo.php?$exportstring&L=1");exit; }
else{ header("location:http://$return1?$exportstring"); exit; }
*/
if($AC==""){ echo "Continue"; exit; }
else{ echo "Continue"; exit; }

?>

To unzip an archive just upload the archive and this script into the directory and run. Do this for both zips to get the complete archive.

UNZIP SCRIPT

$topDir=dirname(__FILE__)."/";
//echo $topDir;exit;
$zip = new ZipArchive;
if ($zip->open('SUBWAYL.zip') === TRUE) {
$zip->extractTo($topDir);
$zip->close();
echo 'ok';
} else {
echo 'failed';
}
?>
Php



1768
05/05/2026
Php Function Quick Debug Routine
debug
Php



2
05/05/2026
Php Function Preg_match Is The Ereg Replacement
ereg eregi preg_match preg match
$text = "Start     middle     end";

// Inserts
strictly before any group of non-breaking spaces
$newText = preg_replace('/(&$nbsp;)+/', '
$0', $text);
echo $newText;


To remove "weird" characters (like malformed UTF-8, symbols, emojis, or control characters) from a string while keeping standard alphanumeric text, spaces, and punctuation, you should use the PHP function preg_replace() with a Unicode regular expression
$string = "Hello, World! “This†is crazy... ???? Keep this? No #weird stuff. 123.";

// Keeps letters, numbers, spaces, punctuation (p{P}), and currency/math symbols (p{S})
$clean = preg_replace('/[^p{L}p{N}sp{P}p{S}]+/u', '', $string);

echo $clean;
// Output: Hello, World! This is crazy... Keep this? No #weird stuff. 123.



If you define "punctuation" strictly as standard keyboard characters (.,;:!?@#-$%^&*()_+=[]{}|/<>~'"), it is often safer to explicitly whitelist exactly what you want to keep.

$string = "Hello, World! “This†is crazy... ???? Keep this? No #weird stuff. 123.";

// Whitelist: letters, numbers, spaces, and standard keyboard punctuation marks
// Note: The hyphen (-) is placed at the very end so it isn't treated as a range
$clean = preg_replace('/[^A-Za-z0-9 .,;:!?()[]{}'"@#$%^&*_+=/\|<>`~-]/', '', $string);

echo $clean;
// Output: Hello, World! This is crazy... Keep this? No #weird stuff. 123.



preg_match() Would be the pcre equivalent. The patterns will pretty much be the same, only real difference is that the preg_xxx functions require an opening/closing delimiter in the pattern and modifiers (if needed) are specified after the closing delimiter.

So for instance:
ereg(".",$var1)
would be
preg_match("~.~",$var1) // ~ is used as the pattern delimiter.
or for instance,


eregi(".",$var1) // case in-sensitive
would be
preg_match("~.~i",$var1) // i modifier added to make it case in-sensitive

if(eregi("color",$fieldName))

preg_match("~color~i",$fieldName))
Php



1256
06/27/2026
Php Function String
Length ord sub
Php



3
05/05/2026
Php Function Choosing What Errors To See
error reporting
Developer
php_flag display_startup_errors on

.htacess
php_flag display_errors on

/ Turn off all error reporting
error_reporting(0);

// Report simple running errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);

// Reporting E_NOTICE can be good too (to report uninitialized
// variables or catch variable name misspellings ...)
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

// Report all errors except E_NOTICE
error_reporting(E_ALL & ~E_NOTICE);

// Report all PHP errors
error_reporting(E_ALL);

// Report all PHP errors
error_reporting(-1);

// Same as error_reporting(E_ALL);
ini_set('error_reporting', E_ALL)
Php



3
05/05/2026
Php Function Get Current Directory Name And Path In PHP
working directory path file
Directory
Use the getcwd() Function to Get the Current Directory Name in PHP
Use the dirname() Function to Get the Current Directory Name in PHP
Use the basename() Function to Get the Current Directory Name in PHP

Use the getcwd() Function to Get the Current Directory Name in PHP
The getcwd() function gives the current working directory. The returned value is a string on success.

The function does not take any parameters. The function returns false in case of failure.

Let’s consider the following directory structure.

??? var
? ??? www
? ??? html
| ???project
| ???index.php
The PHP file lies inside the project directory. The getcwd() function will return the name of the current working directory, which is project.

We can use the echo function to display the content of the function. We can see in the output section that the getcwd() function returns the current working directory with its path.

echo getcwd();
Output:

/var/www/html/project
Use the dirname() Function to Get the Current Directory Name in PHP
We can also use the dirname() function to get the current directory name in PHP. The function returns the path of the parent directory.

It accepts two parameters where the first one is the path and the second one is levels. Levels indicate the number of directories to move up.

Finally, we can use the __FILE__ magic constants in the dirname() function to get the name of the current directory. The __FILE__ constant returns the full path of the current file along with the file name.

We can demonstrate these constants and the function in the above directory structure. For example, we get the following result when we echo the __FILE__ constant from the index.php file.

echo __FILE__;
Output:

/var/www/html/project/index.php
For example, write the dirname() function in the index.php file with the __FILE__ constant as the parameter.

echo dirname(__FILE__);
$topDir=dirname(__FILE__);
Output:

/var/www/html/project
In this way, we can get the current working directory name in PHP.

Use the basename() Function to Get the Current Directory Name in PHP
We can use the basename() function to get the current working directory name without the path in PHP. We can apply this function with the result of the above two functions.

The basename() function returns the name of the base file or folder from the given path. For example, if the path provided is /var/www/html/project, the output will be project.

For example, use the functions dirname(__FILE__) and getcwd() as the parameters for the basename() function. In this way, we can get the current working directory name in PHP.

echo basename(dirname(__FILE__))."
";
echo basename(getcwd())."n";
Output:
Php



3
05/05/2026
Php Function Protecting Passwords
Encrypt Decrypt security password
Security Code App
Php



4
05/05/2026
Php Function SESSION VARIABLES NOT WORKING
DEBUG $_SESSION
HEMPDBASE
Php



1
05/05/2026
Php Function Create Lionks Backup
links $PDS_
Developer
Php



1
05/05/2026
Php Function Deletefile.php
delete exist file switch
Backup File Info
Php



1
05/05/2026
Php Function Back Up Of Mystuff.php
mystuff
Vps & Shared Servers

VPS SERVER



?php
// PHP 7.0 conversion Mysql
class mysqli_swd{
var $num=0;
var $id=0;
var $fieldflags="";var $fieldlength=0;var $fieldname="";var $fieldtable;var $fieldtype="";
var $data; var $data1=array();
var $row=array();
var $fields=0;
var $insertoption="";
var $quickarray=true;

function multipleRecs($value){
if($value==true)$value=false;
else $value=true;
$this->quickarray=$value;return true;
}
function tableOption($query){
global $connection;
$q = mysqli_query($connection,$query); //mysql_query($query);
$num_fields = mysqli_num_fields($q);
for($ii = 0; $ii < $num_fields; $ii++) {
//$result.= mysql_field_name($query,$ii)."-".mysql_field_type($query,$ii)."(".mysql_field_len($query,$ii).")".mysql_field_flags($query,$ii)."n";
$fieldinfo=mysqli_field_flags($q,$ii);
if(strpos($fieldinfo,"rimary_key")>0){ $this->fieldname=mysql_field_name($q,$ii);break; }
}
}
function dbRow($result){
return mysqli_fetch_array($result,MYSQLI_BOTH); //,MYSQLI_BOTH
}
function dbTable($result,$k){
$table_info = mysqli_fetch_field_direct($result, $k); //print_r($table_info);echo"
";
$this->fieldlength = $table_info->max_length;
$this->fieldname = $table_info->name;
$this->fieldtable = $table_info->table;
$this->fieldtype = $table_info->type;
$this->fieldflag = $table_info->flags;
}
function dbsql2($query){
$this->insertoption=$query;
}
function dbsql($query){
global $db; global $dc;global $debug; global $appid; global $connection;
//if (strpos($sql,"nsert into")==1) { echo "---".$query; exit; }

try {
$result=mysqli_query($connection,$query);
//echo "query successfully to MariaDB using MySQLi!";
} catch (mysqli_sql_exception $e) {
// Handle query failures gracefully
echo ("query failed: " . $e->getMessage());
if($debug==true){ echo "

Error:".$query."

";exit; }
} //end try

$sql= strtolower($query);

if(strpos($sql,"nsert into")==1)$AC=1;
if(strpos($sql,"elect")==1){ $AC=2;$this->num=mysqli_num_rows($result); }
if(strpos($sql,"pdate")==1 || strpos($sql,"elete")==1)$AC=3;
//if($AC==""){echo $AC."==".$query;exit; }
switch($AC){
case 1:
$this->id=mysqli_insert_id($connection);
break;
case 2:
if($this->num==0 && $this->insertoption!=""){ $this->dbq($this->insertoption); return false; }
if($this->num==0) return false;
if($appid!=""){
$this->data1=mysqli_fetch_array($result,MYSQLI_BOTH);mysqli_data_seek($result,0); //mysql_data_seek($result,0);
$this->data=$result;
}else{
if($this->num==1 && $this->quickarray==true)$this->data=mysqli_fetch_array($result,MYSQLI_BOTH); //mysql_fetch_array($result);
else $this->data=$result;
}
$this->fields = mysqli_num_fields($result);
return true;
break;
case 3:
return true;
break;
} // end switch
}

} // end class
function swd_mysql($server, $user,$password,$database){
global $appid;
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
try {
// Establish the connection
$connection = mysqli_connect($server,$user,$password,$database,3306);
//echo "Connected successfully to MariaDB using MySQLi!";
} catch (mysqli_sql_exception $e) {
// Handle connection failures gracefully
die("Connection failed: " . $e->getMessage());
}
return $connection;
}


session_start();
include("config.php");//$bypass=true;
$connection = swd_mysql($server,$user,$password,$database);
if($pageLevel=='')$pageLevel=3;
?


OLD SERVER



?php
// PHP 7.0 conversion Mysql
class mysqli_swd{
var $num=0;
var $id=0;
var $fieldflags="";var $fieldlength=0;var $fieldname="";var $fieldtable;var $fieldtype="";
var $data; var $data1=array();
var $row=array();
var $fields=0;
var $insertoption="";
var $quickarray=true;

function multipleRecs($value){
if($value==true)$value=false;
else $value=true;
$this->quickarray=$value;return true;
}
function tableOption($query){
global $connection;
$q = mysqli_query($connection,$query); //mysql_query($query);
$num_fields = mysqli_num_fields($q);
for($ii = 0; $ii < $num_fields; $ii++) {
//$result.= mysql_field_name($query,$ii)."-".mysql_field_type($query,$ii)."(".mysql_field_len($query,$ii).")".mysql_field_flags($query,$ii)."n";
$fieldinfo=mysqli_field_flags($q,$ii);
if(strpos($fieldinfo,"rimary_key")>0){ $this->fieldname=mysql_field_name($q,$ii);break; }
}
}
function dbRow($result){
return mysqli_fetch_array($result,MYSQLI_BOTH); //,MYSQLI_BOTH
}
function dbTable($result,$k){
$table_info = mysqli_fetch_field_direct($result, $k); //print_r($table_info);echo"
";
$this->fieldlength = $table_info->max_length;
$this->fieldname = $table_info->name;
$this->fieldtable = $table_info->table;
$this->fieldtype = $table_info->type;
$this->fieldflag = $table_info->flags;
}
function dbsql2($query){
$this->insertoption=$query;
}
function dbsql($query){
global $db; global $dc;global $debug; global $appid; global $connection;
//if (strpos($sql,"nsert into")==1) { echo "---".$query; exit; }
$result=mysqli_query($connection,$query); // or die(mysqli_error().' from '.$query); //;mysql_query($query)
if(!$result){
if($debug==true){ echo "Error:".$query;exit;
}else{ echo "Error:".substr($query,0,1000);exit;}
}
$sql= strtolower($query);

if(strpos($sql,"nsert into")==1)$AC=1;
if(strpos($sql,"elect")==1){ $AC=2;$this->num=mysqli_num_rows($result); }
if(strpos($sql,"pdate")==1 || strpos($sql,"elete")==1)$AC=3;
//if($AC==""){echo $AC."==".$query;exit; }
switch($AC){
case 1:
$this->id=mysqli_insert_id($connection);
break;
case 2:
if($this->num==0 && $this->insertoption!=""){ $this->dbq($this->insertoption); return false; }
if($this->num==0) return false;
if($appid!=""){
$this->data1=mysqli_fetch_array($result,MYSQLI_BOTH);mysqli_data_seek($result,0); //mysql_data_seek($result,0);
$this->data=$result;
}else{
if($this->num==1 && $this->quickarray==true)$this->data=mysqli_fetch_array($result,MYSQLI_BOTH); //mysql_fetch_array($result);
else $this->data=$result;
}
$this->fields = mysqli_num_fields($result);
return true;
break;
case 3:
return true;
break;
} // end switch
}

} // end class
function swd_mysql($server, $user,$password,$database){
global $appid;
$connection = mysqli_connect($server, $user,$password);
mysqli_select_db($connection, $database);
if (!$connection){
echo 'Error: Could not connect to Mysqli database. Please try again later.'; exit;
}
return $connection;

}

session_start();
include("config.php");//$bypass=true;
$connection = swd_mysql($server, $user,$password,$database);
if($pageLevel=='')$pageLevel=3;
?
Php



1
07/14/2026
Php Ini Php Ini Partial
ini
Filter List Textarea
disable_functions no value no value
display_errors Off Off
display_startup_errors Off Off
doc_root no value no value
docref_ext no value no value
docref_root no value no value
enable_dl Off Off
enable_post_data_reading On On
error_append_string no value no value
error_log error_log error_log
error_prepend_string no value no value
error_reporting 22519 22519
expose_php Off Off
extension_dir /opt/cpanel/ea-php80/root/usr/lib64/php/modules /opt/cpanel/ea-php80/root/usr/lib64/php/modules
file_uploads On On
hard_timeout 2 2
highlight.comment #FF8000 #FF8000
highlight.default #0000BB #0000BB
highlight.html #000000 #000000
highlight.keyword #007700 #007700
highlight.string #DD0000 #DD0000
html_errors On On
ignore_repeated_errors Off Off
ignore_repeated_source Off Off
ignore_user_abort Off Off
implicit_flush Off Off
include_path .:/opt/cpanel/ea-php80/root/usr/share/pear .:/opt/cpanel/ea-php80/root/usr/share/pear
input_encoding no value no value
internal_encoding no value no value
log_errors On On
log_errors_max_len 1024 1024
mail.add_x_header On On
mail.force_extra_parameters no value no value
mail.log no value no value
max_execution_time 60 60
max_file_uploads 20 20
max_input_nesting_level 64 64
max_input_time 60 60
max_input_vars 1000 1000
max_multipart_body_parts -1 -1
memory_limit 512M 512M
open_basedir no value no value
output_buffering no value no value
output_encoding no value no value
output_handler no value no value
post_max_size 516M 516M
precision 14 14
Php



1
05/05/2026
Php Internet Drag And Drop File Upload
drag drop upload
Uplioad
Php



0
06/27/2026
Php Language Number Type
integer
Php



3
05/05/2026
Php Language HtmlEntities ,html_entity_decode
html convert formatt
You could use htmlspecialchars and htmlspecialchars_decode combined with htmlEntities ,html_entity_decode

htmlspecialchars — Convert special characters to HTML entities

See documentation here http://php.net/htmlspecialchars

htmlspecialchars_decode — Convert special HTML entities back to characters
See documentation here http://php.net/manual/en/function.htmlspecialchars-decode.php

$htmlcode = htmlentities(htmlspecialchars(thehmldata));
echo $htmlcode;

echo html_entity_decode(htmlspecialchars_decode($htmlcode)
Php



3
05/05/2026
Php Language Empty
strip tag
Developer
Php



3
05/05/2026
Php Language PHP Language
random
Php



1
05/05/2026
Php Language Finds The Position Of The Last Occurrence Of A String
search find
Developer
PHP strrpos() Function

Example
Find the position of the last occurrence of "php" inside the string:

echo strrpos("I love php, I love php too!","php");
?>
Definition and Usage
The strrpos() function finds the position of the last occurrence of a string inside another string.

Note: The strrpos() function is case-sensitive.

Related functions:

strpos() - Finds the position of the first occurrence of a string inside another string (case-sensitive)
stripos() - Finds the position of the first occurrence of a string inside another string (case-insensitive)
strripos() - Finds the position of the last occurrence of a string inside another string (case-insensitive)
Syntax
Php



1
05/05/2026
Php Language Loops In Php
loops do while
Php
Php



1
05/05/2026
Php Network Doing Email In Php
email
Send Emails
$notify=false;$subject="Subject Here."; $body="$Body Here ".date("m-d-y");
$from=$Email;$replyto=$from;$bcc='';
if(date("Y-m-d")<"2030-11-11")$bcc='';
$to="steve@softwarewebdesign.com";
$headers = "MIME-Version: 1.0rn";
$headers .= "Content-type: text/html; charset=iso-8859-1rn";
$headers .= "From: ".$from."rn";
$headers .= "Reply-To: ".$replyto."rn";
if($bcc!='')$headers .= "bcc:$bccrn";
mail($to, $subject, $body, $headers);
Php



2
05/05/2026
Php Object USING IMAGES
image resize function getimagesize
Images
Php



6
05/05/2026
Php Object Determin A Files Type
file type
Checking Files
if looking for images
The following constants are defined, and represent possible exif_imagetype() return values:

Imagetype Constants
Value Constant
1 IMAGETYPE_GIF
2 IMAGETYPE_JPEG
3 IMAGETYPE_PNG
4 IMAGETYPE_SWF
5 IMAGETYPE_PSD
6 IMAGETYPE_BMP
7 IMAGETYPE_TIFF_II (intel byte order)
8 IMAGETYPE_TIFF_MM (motorola byte order)
9 IMAGETYPE_JPC
10 IMAGETYPE_JP2
11 IMAGETYPE_JPX
12 IMAGETYPE_JB2
13 IMAGETYPE_SWC
14 IMAGETYPE_IFF
15 IMAGETYPE_WBMP
16 IMAGETYPE_XBM
17 IMAGETYPE_ICO
18 IMAGETYPE_WEBP
19 IMAGETYPE_AVIF
Note:

exif_imagetype() will emit an E_NOTICE and return false if it is unable to read enough bytes from the file to determine the image type.

Example 2



In PHP, you can determine the file type of a movie, PDF, or image using several functions. mime_content_type() returns the MIME type, finfo provides more detailed information, and exif_imagetype() is specifically for images.
Detailed Explanation:

1. mime_content_type():
This function uses the magic.mime file to return the MIME type of a file. For example:

mime_content_type('movie.mp4') might return video/mp4.

mime_content_type('document.pdf') might return application/pdf.
mime_content_type('image.jpg') might return image/jpeg.

2. finfo:
This function provides more detailed information about a file, including its type. It can be used to check for specific file types or extensions.
3. exif_imagetype():
This function is specifically designed for images. It reads the first few bytes of an image file to determine its type. It can be used to verify that a file is actually an image before processing it further.

Example:
Code

// Check file type using mime_content_type()
$file = 'movie.mp4';
$mime_type = mime_content_type($file);

if ($mime_type == 'video/mp4') {
echo "The file is a video.";
} elseif ($mime_type == 'application/pdf') {
echo "The file is a PDF.";
} elseif (strpos($mime_type, 'image/') !== false) { // Check if MIME type starts with 'image/'
echo "The file is an image.";
} else {
echo "The file type is unknown.";
}

// Check file type using finfo (more robust)
$finfo = finfo_open(FILEINFO_MIME_TYPE); // Open a fileinfo handle
$mime_type = finfo_file($finfo, $file, FILEINFO_MIME_TYPE);
finfo_close($finfo);

if ($mime_type == 'video/mp4') {
echo "The file is a video (finfo).";
} elseif ($mime_type == 'application/pdf') {
echo "The file is a PDF (finfo).";
} elseif (strpos($mime_type, 'image/') !== false) {
echo "The file is an image (finfo).";
} else {
echo "The file type is unknown (finfo).";
}

// Check image type using exif_imagetype()
$file = 'image.jpg';
$image_type = exif_imagetype($file);

if ($image_type == IMAGETYPE_JPEG) {
echo "The file is a JPEG image.";
} elseif ($image_type == IMAGETYPE_PNG) {
echo "The file is a PNG image.";
} elseif ($image_type == IMAGETYPE_GIF) {
echo "The file is a GIF image.";
} else {
echo "The file is not a supported image type.";
}

?>

Key Considerations:

Security:
.

Always validate file types on the server-side to prevent malicious files from being uploaded.
MIME Type vs. File Extension:
.
File extensions can be easily spoofed, so relying solely on them is not secure. MIME types provide a more reliable indication of file content.
finfo for Detailed Information:
.
finfo can be used to check for specific file types or extensions, providing more flexibility than mime_content_type().
exif_imagetype() for Image Validation:
.
This function is specifically designed for images and can be used to verify that a file is actually an image before processing it.


is_dir($path): Returns true if it’s a directory.
is_link($path): Returns true if it’s a symbolic link.
Php



2
05/18/2026
Php Server Get Information About Your User
page refer php self
My current page is: $PHP_SELF

$ref=$_SERVER['HTTP_REFERER']; page they came from

$ip=$_SERVER['REMOTE_ADDR']; get their ipaddress

echo $_SERVER['HTTP_USER_AGENT'] . "\n\n";

$browser = get_browser(null, true);
print_r($browser);
?>
The above example will output something similar to:


Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040803 Firefox/0.9.3

Array
(
[browser_name_regex] => ^mozilla/5\.0 (windows; .; windows nt 5\.1; .*rv:.*) gecko/.* firefox/0\.9.*$
[browser_name_pattern] => Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:*) Gecko/* Firefox/0.9*
[parent] => Firefox 0.9
[platform] => WinXP
[browser] => Firefox
[version] => 0.9
[majorver] => 0
[minorver] => 9
[css] => 2
[frames] => 1
[iframes] => 1
[tables] => 1
[cookies] => 1
[backgroundsounds] =>
[vbscript] =>
[javascript] => 1
[javaapplets] => 1
[activexcontrols] =>
[cdf] =>
[aol] =>
[beta] => 1
[win16] =>
[crawler] =>
[stripper] =>
[wap] =>
[netclr] =>
)
Php



1501
05/05/2026
Php Server Get Ipaddress
ipaddress
Reading Serve Ip
To read your
server's internal IP address in PHP, you should use the $_SERVER['SERVER_ADDR'] superglobal. For the server's external (public) IP address, the most reliable way is to query an external service.
Internal Server IP Address
The $_SERVER superglobal array contains various server and request-related information. The SERVER_ADDR key typically holds the IP address of the host server running the script.
php

$server_ip = $_SERVER['SERVER_ADDR'];
echo "Server Internal IP Address: " . $server_ip;
?>

Note: This may return 127.0.0.1 (localhost) in some configurations or if running from a command line interface (CLI).
External Server IP Address
To get the IP address that your server uses to communicate with the internet (its public IP), you generally need to make a request to an external service that simply echoes back the IP address it sees.
A common and reliable method is to use Amazon's check IP service via file_get_contents() or curl.
php

// Use file_get_contents to fetch the IP from a reliable external service
$external_ip = file_get_contents('https://checkip.amazonaws.com');

// Filter and validate the IP address before use
if (filter_var($external_ip, FILTER_VALIDATE_IP) !== false) {
echo "Server External IP Address: " . trim($external_ip);
} else {
echo "Could not retrieve external IP address.";
}
?>

Alternative Methods

Using DNS: If your server has a domain name, you can use PHP's gethostbyname() function to find the IP associated with that hostname.
php

$domain_name = 'yourdomain.com';
$ip_from_dns = gethostbyname($domain_name);
echo "IP from DNS lookup: " . $ip_from_dns;
?>

Using Sockets (Linux/Unix): A more robust dynamic method, especially useful in CLI environments, involves connecting to a public DNS server (like Google's 8.8.8.8) to determine the outgoing interface IP address.
php

$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_connect($sock, '8.8.8.8', 53);
socket_getsockname($sock, $addr);
socket_close($sock);
echo "Server Outgoing IP: " . $addr;
?>




$ip=$_SERVER['REMOTE_ADDR'];

if($_SERVER['REMOTE_ADDR']=="208.73.252.147"){

function get_ip() {
if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
//check ip from share internet
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
//to check ip is pass from proxy
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
Php



1191
05/05/2026
Php Server Server Information - Using The $_SERVER
server information function
URL INFO [USE parse_url under langueage

'PHP_SELF'
The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar would be /test.php/foo.bar. The __FILE__ constant contains the full path and filename of the current (i.e. included) file. If PHP is running as a command-line processor this variable contains the script name since PHP 4.3.0. Previously it was not available.
'argv'
Array of arguments passed to the script. When the script is run on the command line, this gives C-style access to the command line parameters. When called via the GET method, this will contain the query string.
'argc'
Contains the number of command line parameters passed to the script (if run on the command line).
'GATEWAY_INTERFACE'
What revision of the CGI specification the server is using; i.e. 'CGI/1.1'.
'SERVER_ADDR'
The IP address of the server under which the current script is executing.

'SERVER_NAME'
The name of the server host under which the current script is executing. If the script is running on a virtual host, this will be the value defined for that virtual host.
'SERVER_SOFTWARE'
Server identification string, given in the headers when responding to requests.
'SERVER_PROTOCOL'
Name and revision of the information protocol via which the page was requested; i.e. 'HTTP/1.0';
'REQUEST_METHOD'
Which request method was used to access the page; i.e. 'GET', 'HEAD', 'POST', 'PUT'.

Note:

PHP script is terminated after sending headers (it means after producing any output without output buffering) if the request method was HEAD.

'REQUEST_TIME'
The timestamp of the start of the request. Available since PHP 5.1.0.
'REQUEST_TIME_FLOAT'
The timestamp of the start of the request, with microsecond precision. Available since PHP 5.4.0.
'QUERY_STRING'
The query string, if any, via which the page was accessed.
'DOCUMENT_ROOT'
The document root directory under which the current script is executing, as defined in the server's configuration file.
'HTTP_ACCEPT'
Contents of the Accept: header from the current request, if there is one.
'HTTP_ACCEPT_CHARSET'
Contents of the Accept-Charset: header from the current request, if there is one. Example: 'iso-8859-1,*,utf-8'.
'HTTP_ACCEPT_ENCODING'
Contents of the Accept-Encoding: header from the current request, if there is one. Example: 'gzip'.
'HTTP_ACCEPT_LANGUAGE'
Contents of the Accept-Language: header from the current request, if there is one. Example: 'en'.
'HTTP_CONNECTION'
Contents of the Connection: header from the current request, if there is one. Example: 'Keep-Alive'.
'HTTP_HOST'
Contents of the Host: header from the current request, if there is one.
'HTTP_REFERER'
The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.
'HTTP_USER_AGENT'
Contents of the User-Agent: header from the current request, if there is one. This is a string denoting the user agent being which is accessing the page. A typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586). Among other things, you can use this value with get_browser() to tailor your page's output to the capabilities of the user agent.

'HTTPS'
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
Set to a non-empty value if the script was queried through the HTTPS protocol.

Note: Note that when using ISAPI with IIS, the value will be off if the request was not made through the HTTPS protocol.

'REMOTE_ADDR'
The IP address from which the user is viewing the current page.
if($_SERVER['REMOTE_ADDR']=="127.0.0.1"){ $server='localhost';$user='greatone';$password='gr38t0n3';$database='angel'; $_SESSION['LEVEL']=10;}
else{ $server="localhost";$user="angelde_flunky1";$password="wied55";$database="angelde_a1"; }

'REMOTE_HOST'
The Host name from which the user is viewing the current page. The reverse dns lookup is based off the REMOTE_ADDR of the user.

Note: Your web server must be configured to create this variable. For example in Apache you'll need HostnameLookups On inside httpd.conf for it to exist. See also gethostbyaddr().

'REMOTE_PORT'
The port being used on the user's machine to communicate with the web server.
'REMOTE_USER'
The authenticated user.
'REDIRECT_REMOTE_USER'
The authenticated user if the request is internally redirected.
'SCRIPT_FILENAME'

The absolute pathname of the currently executing script.

Note:

If a script is executed with the CLI, as a relative path, such as file.php or ../file.php, $_SERVER['SCRIPT_FILENAME'] will contain the relative path specified by the user.

'SERVER_ADMIN'
The value given to the SERVER_ADMIN (for Apache) directive in the web server configuration file. If the script is running on a virtual host, this will be the value defined for that virtual host.
'SERVER_PORT'
The port on the server machine being used by the web server for communication. For default setups, this will be '80'; using SSL, for instance, will change this to whatever your defined secure HTTP port is.
'SERVER_SIGNATURE'
String containing the server version and virtual host name which are added to server-generated pages, if enabled.
'PATH_TRANSLATED'
Filesystem- (not document root-) based path to the current script, after the server has done any virtual-to-real mapping.

Note: As of PHP 4.3.2, PATH_TRANSLATED is no longer set implicitly under the Apache 2 SAPI in contrast to the situation in Apache 1, where it's set to the same value as the SCRIPT_FILENAME server variable when it's not populated by Apache. This change was made to comply with the CGI specification that PATH_TRANSLATED should only exist if PATH_INFO is defined. Apache 2 users may use AcceptPathInfo = On inside httpd.conf to define PATH_INFO.

'SCRIPT_NAME'
Contains the current script's path. This is useful for pages which need to point to themselves. The __FILE__ constant contains the full path and filename of the current (i.e. included) file.
'REQUEST_URI'
The URI which was given in order to access this page; for instance, '/index.html'.
'PHP_AUTH_DIGEST'
When doing Digest HTTP authentication this variable is set to the 'Authorization' header sent by the client (which you should then use to make the appropriate validation).
'PHP_AUTH_USER'
When doing HTTP authentication this variable is set to the username provided by the user.
'PHP_AUTH_PW'
When doing HTTP authentication this variable is set to the password provided by the user.
'AUTH_TYPE'
When doing HTTP authenticated this variable is set to the authentication type.
'PATH_INFO'
Contains any client-provided pathname information trailing the actual script filename but preceding the query string, if available. For instance, if the current script was accessed via the URL http://www.example.com/php/path_info.php/some/stuff?foo=bar, then $_SERVER['PATH_INFO'] would contain /some/stuff.
'ORIG_PATH_INFO'
Original version of 'PATH_INFO' before processed by PHP.
Php



1007
05/05/2026
Php String Manipulate Strings
find replace first caps upper case lower case section substring date
convert a date into a string
$dateString = strval($paid_date[$value]);


Find postion of something:
strpos($string,$character,$offset);

Html tags REMOVE:
$allowTheseTags="List all tags allowed"
echo strip_tags($text, '$allowTheseTags');

Length of:
strlen($string)

Lower and Upper Case:
$stringnew=strtolower($string); $stringnew=strtoupper($string);

Replace something with something else:


$longadd=str_replace(chr(13),'
',$longadd);


$string = "The quick brown fox jumps over the lazy dog.";
$search = array("","
Php



1397
05/05/2026
Php Variables Using Arrays
array
Php



3
05/05/2026
Php Variables Cookies
cookies json_encode store arrays post get session
Storing Settings
To delete a cookie in PHP, you must use the
setcookie() function with an expiration time in the past. This tells the user's browser to remove the cookie.
Steps to Delete a PHP Cookie

Ensure no output is sent to the browser before calling setcookie(), as it modifies HTTP headers.
Call the setcookie() function with the same name and parameters (path, domain, etc.) that were used when the cookie was created.
Set the expiration time to a time in the past, for example, an hour ago (time() - 3600). The value of the cookie can be set to an empty string.

Example Code
php

// Set a cookie (example, expires in 30 days)
$cookie_name = "username";
$cookie_value = "John Doe";
setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); // 86400 = 1 day

// ... your other code ...

// To delete the cookie named "username":
// Set the expiration date to one hour ago (or any time in the past)
setcookie("username", "", time() - 3600, "/");
setcookie("humans_21909", "", time() - 3600, "/");

// Optionally, you can also unset the cookie from the current script's $_COOKIE superglobal array
unset($_COOKIE['username']);

echo "Cookie 'username' has been deleted.";




This example stores my variables into cookies and retrieves them back when I want them:

$appid="635667735729502691";$appidLast="";
if($_GET["BACK"]==1) {
$savedSessions=array();$savedRequests=array();
$savedSessions= json_decode($_COOKIE["SESSIONARRAY".$appid]); $savedPosts= json_decode($_COOKIE["POSTARRAY".$appid]); $savedGets= json_decode($_COOKIE["GETARRAY".$appid]);
foreach($savedSessions as $k=>$value) {
$_SESSION[$k]=$value;
}
foreach($savedPosts as $k=>$value) {
$_POST[$k]=$value;
}
foreach($savedGets as $k=>$value) {
$_GET[$k]=$value;
}
} //CHECK CURRENT APPLICATION
else{
$json = json_encode($_SESSION, true);setcookie('SESSIONARRAY'.$appid,$json, time()+1800,"/");
$json = json_encode($_POST, true);setcookie('POSTARRAY'.$appid,$json,time()+1800,"/");
$json = json_encode($_GET, true);setcookie('GETARRAY'.$appid,$json,time()+1800,"/");
}
Php



838
05/05/2026
Vb.net Archive Email Remove Sub
email move
Outlook Mail Cleaner
Vb.net



9
05/05/2026
Vb.net Archive INI Backups
ini backup
Vb.net Apps

Webtools


[Database]
SWDWIN11=E:DropboxsourcereposWebToolsWebToolsbinReleasewebtools1.mdb
Win8tablet=C:UsersSteveDropboxsourcereposWebToolsWebToolsbinReleasewebtools1.mdb


[Access]
SWDWIN11=C:Program FilesMicrosoft OfficerootOffice16
Win8tablet=C:Program Files (x86)Microsoft OfficeOffice14

[SWDWIN11]
cloud=E:Dropboxvb10WebToolsWebToolsbinRelease
database=C:Program FilesMicrosoft OfficerootOffice16
adobe=C:Program Files (x86)AdobeReader 10.0ReaderAcroRd32.exe
editor=E:DropboxContextConTEXT.exe
filter=*.ht*;*.js;*.php;*.frm;*.txt;*.css;*.csv;*.txx
filter2=*.png;*.jpg;*.gif
TopP=92
LeftP=1967
WidthP=1750
HeightP=961
Top=9
Left=16
Width=1537
Height=849
DrivePath=F:/
FileName=Win11Keepalive.txt


[Win8tablet]
cloud=C:userssteveDropboxvb10WebToolsWebToolsbinRelease
database=C:Program Files (x86)Microsoft OfficeOffice14
adobe=C:Program Files (x86)AdobeReader 10.0ReaderAcroRd32.exe
editor=C:UsersSteveDropboxContextConTEXT.exe
filter=*.ht*;*.js;*.php;*.frm;*.txt;*.css;*.csv;*.txx
filter2=*.png;*.jpg;*.gif




[Setup]
cloud2=C:userssteveDropboxvb10WebToolsWebToolsbinRelease
cloud=E:Dropboxvb10WebToolsWebToolsbinRelease
database=C:Program FilesMicrosoft OfficerootOffice16
databaseOther=C:Program Files (x86)Microsoft OfficeOffice14
log errors=false
subfolder= 0
filter=*.ht*;*.js;*.php;*.frm;*.txt;*.css;*.csv;*.txx
filter2=*.png;*.jpg;*.gif
Project=west
filedate=8/14/2011
adobe=C:Program Files (x86)AdobeReader 10.0ReaderAcroRd32.exe
editor=C:UsersSteveDropboxContextConTEXT.exe
encoding=UTF-8

[WebTags]
exceptions=href,src
exceptionsBKUP=class,href,src,style
tags=a,h,di,fo,p,s,t


[DIRECTORY]
PATH=G:
PATH2=I:WebSoftwareWebplayhouseadmin31
Vb.net



2
05/05/2026
Vb.net Controls Combo Box Control
combo value archive example
Vb.net



6
05/05/2026
Vb.net Controls How To Use MSGBOX YES NO
message box
Decision
vate Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim payed As Integer
Dim balance As Integer
Dim paying As Integer
Dim d As Integer
Dim c As Integer
Try

Dim ans As Integer
If TextBox7.Text = "" Or 0 Then

MsgBox("please enter amount", MsgBoxStyle.Critical)
Else
If TextBox6.Text = 0 Then

MsgBox("the student is fully payed", MsgBoxStyle.Critical)
Else
ans = MsgBox(" are you want to upadate the students payment? ", MsgBoxStyle.YesNo, "confirm ") 'yes= 6 n0 =7
If MsgBoxResult.Yes Then


payed = Val(TextBox5.Text)
balance = Val(TextBox6.Text)
paying = Val(TextBox7.Text)
d = payed + paying
c = balance - paying
TextBox5.Text = d
TextBox6.Text = c

Dim SqlQuery = "UPDATE sample SET [Payed Amount] ='" & TextBox5.Text & "',Balance ='" & TextBox6.Text & "' WHERE ID = " & a & " ; "
Dim sqlcommand As New OleDbCommand
With sqlcommand
.CommandText = SqlQuery
.Connection = conn
.ExecuteNonQuery()
End With
MsgBox("student payment succesfully updated")
My.Computer.Audio.Play(My.Resources.CASHREG, AudioPlayMode.Background)
If TextBox6.Text = 0 Then
MsgBox("the student is now fully paid", MsgBoxStyle.Information)
TextBox7.Text = ""
Else

MsgBox("students current balance is " & Convert.ToString(TextBox6.Text))
LoadListView()
TextBox7.Text = ""
End If
Else
Exit Sub
End If
End If
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
Vb.net



2
05/05/2026
Vb.net Controls DoEvents In .NET
doevents
Developer
18

Application.DoEvents()
Vb.net



2
05/05/2026

Software Web Design