JavaScript to Disable Mouse Right Click ,Cut, Copy and Paste Options

If we want to prevent the user from copying content from a web page,
we need to disable right click and also we need to disable the copy, cut,
paste options.

<!DOCTYPE html>

<html lang="en">

<head>

    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>

    <!--Javascript code for disable right click-->

    <script>
        $(document).ready(function(){
            $(document).on("contextmenu",function(e){
                return false;
            });
        });
    </script>

    <!--Javascript code for disable cut,copy,paste-->

    <script>
        $(document).ready(function(){
            $(document).on("cut copy paste",function(e){
                return false;
            });
        });
    </script>

</head>

<body>

1. contextmenu (also called contextual, shortcut, and pop up or pop-up menu) is a menu in a graphical user interface (GUI) that appears upon user interaction, such as a right-click mouse operation.

2. The on( ) method attaches one or more event handlers for the selected elements and child elements like cut, copy, paste.

</body>

</html>
                              

PHP Documentation and Security and Image Manipulation and Graphs Tools

PHP DOX
An AJAX-powered PHP documentation search engine that enables you to search titles from all PHP documentation pages.

phpDocumentor
phpDocumentor (also known as phpdoc and phpdocu) is a documentation tool for your PHP source code. It has an innumerable amount of features, including the ability to output in HTML, PDF, CHM and XML DocBook formats, and has both a Web-based and command-line interface as well as source-code highlighting. To learn more about phpDocumentor, check out the online manual.

LinkSecurimage
Securimage is a free, open-source PHP CAPTCHA script for generating complex images and CAPTCHA codes to protect forms from spam and abuse.

Scavenger
Scavenger is an open-source, real-time vulnerability management tool. It helps system administrators respond to vulnerability findings, track vulnerability findings and review accepted and false-positive answered vulnerabilities, without “nagging” them with old vulnerabilities.

PHP-IDS
PHP-IDS (PHP-Intrusion Detection System) is a simple-to-use, well-structured, fast and state-of-the-art security layer for your PHP-based Web application.

Pixy: PHP Security Scanner
Pixy is a Java program that performs automatic scans of PHP 4 source code, aimed to detect XSS and SQL injection vulnerabilities. Pixy takes a PHP program as input and creates a report that lists possible vulnerable points in the program, along with additional information for understanding the vulnerability

PHP/SWF Charts
PHP/SWF Charts is a powerful PHP tool that enables you to create attractive Web charts and graphs from dynamic data. You can use PHP scripts to generate and gather data from databases, then pass it to this tool to generate Flash (SWF) charts and graphs.

pChart - a chart-drawing PHP library
pChart is a PHP class oriented framework designed to create aliased charts. Most of today’s chart libraries have a cost; this one is free. Data can be retrieved from SQL queries or CSV files or can be manually provided.

WideImage
WideImage is a PHP library for dynamic image manipulation and processing for PHP 5. To be able to use the library, you should have the GD PHP extension installed on your Web server.

MagickWand For PHP
MagickWand For PHP is a PHP module suite for working with the ImageMagick API, which lets you create, compose and edit bitmap images. It’s a useful tool for quickly incorporating image-editing features in your PHP applications.

PHP Testing Tools

Codeception
Codeception doesn’t only enable us to write Unit Tests, but also Functional and Acceptance Tests. These two latter tests the PHP app as a whole with all features tied together, not as units. Codeception allows us to enable and configure different modules according to our development needs.
http://codeception.com/

SimpleTest
SimpleTest is a straightforward unit-testing platform for PHP applications. To get up and running SimpleTest quickly, read through this pragmatic tutorial that shows you how to create a new test case.
http://www.simpletest.org/

PHPUnit
PHPUnit is a complete port of the popular Junit unit testing suite to PHP 5. It’s a tool that helps you test your Web application’s stability and scalability. Writing test cases within the PHPUnit framework is easy
https://phpunit.de/

Behat
Behat is a popular behaviour-driven PHP testing framework. The tests we can write with Behat look rather like stories than code. Behat uses the StoryBDD subtype of behaviour-driven development (the other subtype is SpecBDD).
http://behat.org/en/latest/

Selenium
Selenium Remote Control (RC) is a test tool that allows you to write automated Web application UI tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser. It can be used in conjunction with PHPUnit to create and run automated tests within a Web browser.

http://www.seleniumhq.org/

PHP_CodeSniffer
PHP_CodeSniffer is a PHP 5 script for detecting conformance to a predefined PHP coding standard. It’s a helpful tool for maintaining uniform coding styles for large projects and teams.
https://github.com/squizlabs/PHP_CodeSniffer

dBug
dBug is ColdFusion’s cfDump for PHP. It’s a simple tool for outputting data tables that contain information about arrays, classes and objects, database resources and XML resources, making it very useful for debugging purposes.
https://github.com/ospinto/dBug

PHP Profile Class
PHP Profile Class is an excellent PHP profiling tool for your Web applications. Using this class will help you quickly and easily gain insight into which parts of your app could use some refactoring and optimization.
http://www.coderholic.com/php-profile-class/

PHPSpec
PHPSpec also follows the behaviour-driven testing approach, but its other subtype called SpecBDD. With PHPSpec we need to write the specifications first that describe how the application code will behave. It was also inspired by a Ruby testing framework called RSpec.
http://www.phpspec.net/en/stable/

Storyplayer
Storyplayer is a full-stack testing framework that makes it possible to write end-to-end tests for an entire platform. Storyplayer has support for creating and destroying test environments on demand. It follows the TDD testing approach, and allows us to write functional tests that can check an application as a whole.
https://datasift.github.io/storyplayer/

Peridot
Peridot is a lightweight, extensible testing framework for PHP. It features an event-driven architecture that allows testers to easily customize the framework via plugins and reporters.
Atoum

Atoum
Atoum is an intuitive and modern PHP testing framework that allows us to run unit tests. It simplifies test development, and as it’s a young framework it makes use of some newer capabilities that were introduced in PHP 5.3 (it can‘t be used with older PHP versions) to provide us with a quick and easy-to-understand testing process.

Kahlan
Kahlan is a full-featured BDD testing framework that makes it possible to write Unit Tests using the describe-itsyntax. It embraces the KISS (Keep It Simple, Stupid) design principle. Kahlan requires at least PHP 5.5.
https://github.com/kahlan/kahlan


PHP Debugging Tools

Pinba

Pinba is an open source MySQL storage engine that acts as a statistics server for PHP. It uses the data received to analyze the performance of PHP apps and locate any problems quickly.

http://pinba.org/

PHP_Debug
PHP_Debug is an open-source project that gives you useful information about your PHP code that can be used for debugging. It can output processing times of your PHP and SQL, check the performance of particular code blocks and get variable dumps in graphical form, which is great if you need a more visual output than the one given to you by print_r() or var_dump().

https://pear.php.net/package/PHP_Debug

DBG
DBG is a robust and popular PHP debugger for use in local and remote PHP debugging. It plugs into numerous PHP IDE’s and can easily be used with the command line.

Webgrind 
Webgrind is a Xdebug profiling web frontend in PHP5. It implements a subset of the features of kcachegrind and installs in seconds and works on all platforms. For quick N dirty optimizations, it does the job

https://github.com/jokkedk/webgrind

PHPMD
PHPMD is an easy to configure, user-friendly front-end for the raw metrics that PHP Depend measures. It looks for several potential problems in your code, including possible bugs, suboptimal code, unused parameters, and more.

https://phpmd.org/

Xdebug
Xdebug is one of the most popular debugging PHP extensions. It provides a ton of useful data to help you quickly find bugs in your source code. Xdebug plugs right into many of the most popular PHP applications, such as PHPEclipse and phpDesigner.

https://xdebug.org/

Gubed PHP Debugger
As the name implies, Gubed PHP Debugger is a PHP debugging tool for hunting down logic errors.

http://gubed.mccabe.nu/

PHP_Dyn
PHP_Dyn is another excellent PHP debugging tool that’s open-source. You can trace execution and get an output of the argument and return values of your functions.

https://github.com/dyninc/dyn-php

MacGDBp
MacGDBp is a live PHP debugger application for the Mac OS. It has all the features you’d expect from a fully featured debugger, such as the ability to step through your code and set breakpoints.

https://www.bluestatic.org/software/macgdbp/

Kint
When debugging PHP code, var_dump(), print_r() and debug_backtrace()are usually our best friends. Kint, an open source resource, is a zero-setup replacement that offers a better debugging experience. It smartly detects the type of data being dumped displays tailored alternatives to otherwise hardly readable data. The name of the variable, file, its line and the function wrapping it are all presented.

https://github.com/kint-php/kint

DebugBar
DebugBar is a free and open source app that can integrate into any PHP project and collect + present profiling data. It has no dependencies, supports Ajax requests and includes generic data collectors and collectors for well-known libraries. The bar is 100% JavaScript that sits in the footer (like Dev. Tools). New collectors and views can be added with ease and it is possible to save/re-run previous requests.

http://phpdebugbar.com/

Whoops
Whoops is a PHP library for handling errors and debugging them much easier. The library provides stack-based error handling with a good-looking error interface. It has a simple API for dealing with exceptions, trace frames + their data and can integrate with any framework (ready-to-use integrations exist for the end and Silex).


Krumo
Many PHP developers use print_r() & var_dump() for debugging which output hard to read/unformatted results. Krumo is a replacement for these functions which can display structured information about any PHP variable. Once Krumo is running, the output is displayed in a collapsible DHTML tree built around the structure of the dumped PHP variable. Also, it speeds up the debugging process by the ability to turn it “off” rather than disabling every dumping route inside the code.

How to Parse/Divide URL in PHP?

parse_url is a simple tool/predefined function to parse/divide URL into individual components.

components are:

1. scheme
2. host
3. path
4. query


example:


<?php

//URL
$url = "http://www.phpjavascript.com/post.php?par1=one&par2=two";

$url = parse_url($url);

//print_r($url);

echo 'scheme = '.$url['scheme'];
echo 'host = '.$url['host'];
echo 'path = '.$url['path'];
echo 'query = '.$url['query'];

?>

Result:

scheme = http
host = www.phpjavascript.com
path = /post.php
query = par1=one&par2=two

Delete files from folder using php

Sometimes we need to free the space of the web server by deleting old or specific or all files from a directory. Means we want to remove files from the folder without know the name of the files. This type of functionality required for the following situation.
1. Need to remove all files in a folder for free the space of web server.
2. Need to remove old files in a folder which are used before the specific time.
3. Need to remove some files from a folder which holds a specific extension.

To delete files from directory we’ll use glob() and unlink() functions in PHP.
glob() function is used to get filenames or directories as an array based on the specified pattern.
unlink() function is used to delete a file.
Delete All Files from Folder:
The following script removes all files from the folder.
<?php
$files = glob('NewFolder/*'); //get all file names
// NewFolder is the name of folder
foreach($files as $file){   
 if(is_file($file))        
unlink($file); //delete file
}
?>
Delete Specific Type of file  from Folder:
The following script removes only those files which have a specific extension.(In this example delete all file with .jpg extension )
<?php
$files = glob('NewFolder/*.jpg'); //get all file names
// NewFolder is name of folder
foreach($files as $file){   
 if(is_file($file))        
unlink($file); //delete file
}
?>
Delete Old Files from Folder:
The following script removes the files which modified before the specified time.
<?php
$files = glob('NewFolder/*'); //get all file names
// NewFolder is the name of folder
foreach($files as $file) {    
$lastModifiedTime = filemtime($file);    
$currentTime = time();    
$timeDiff = abs( $currentTime - $lastModifiedTime) / (60 * 60); //in one hours   
 if (is_file($file) &&  $timeDiff > 10) //check if file is modified before 10 hours     
 unlink($file); //delete file
}

Labels

php (35) javascript (31) phpjavascript (30) jquery (23) html (20) mysql (14) database (9) codeigniter (4) json (4) bar chart (2) calendar (2) column chart (2) framework (2) google maps (2) query (2) tables (2) url (2) dropdown (1)

Popular Posts