Php

How to create a directory using php code

Create folder php code

php code to create a directory Use mkdir() to create a directory in a php. Specify the path where you would like to create a directory or a folder. Syntax to create a directory: mkdir(path); Example: $path = '/home/w3calc/'; @mkdir($path); //will create a directory in the specified  ..


How to use php cookies

Create and use cookies values

How to use php cookies Cookies allow the webmaster to store information about the site visitor on their computer to be accessed again the next time they visit. One common use of cookies is to store your username and password on your computer so you don't need to login again each  ..


Function to check leap year

How to check leap year ot not

How to check leap year ot not The following php function will check whether the given year is a leap year or not. <?php function isLeap($yr) { echo $yr, ': ', (date('L', strtotime("$yr-01-01")) ? 'is Leap Year' : 'is not leap year'), ''; } ?> The above function will say the argument passed to the isLeap function  ..


How to enable curl in xampp

Enable curl function in php.ini

How to enable curl in XAMPP Curl module might not be enabled by default in xampp. Before you do confirm by seeing your phpinfo(). Check whether curl is enabled or not <?php phpinfo(); ?> write the above php script in a file and execute the script. The php info will print the information of the modules  ..


Howto secure php

Securing PHP

Well PHP is one of the most popular applications that run on Linux and Windows servers today. It's also one of the main sources for servers and user accounts getting compromised. I want to go over some of the things you can do to help lock down PHP, securing php  ..


Executing statments as a string using eval function

Eval a statement as string

A statement stored in a string can be executed using the eval function. Most of the programming language has build-in eval function which is used to evaluate a math operations PHP Code <?php $str = "\$math=15*log(10);"; eval($str); echo $math; ?> Output: 34.5387763949 The above php code will evaluate the math query or statement which is stored in a  ..


Php detect crawler script

Php function to detect crawler

Detect crawlers using PHP script Very simple php function used to analyze $_SERVER['HTTP_USER_AGENT'] variable and looking for crawler signature. If function founds crawler, it will return it's name, otherwise the php sccript will return false. function crawlerDetect($USER_AGENT) { $crawlers = array(array('Google', 'Google'), array('msnbot', 'MSN'), array('Rambler', 'Rambler'), array('Yahoo', 'Yahoo'), array('AbachoBOT', 'AbachoBOT'), array('accoona', 'Accoona'), array('AcoiRobot', 'AcoiRobot'), array('ASPSeek', 'ASPSeek'), array('CrocCrawler', 'CrocCrawler'), array('Dumbot', 'Dumbot'), array('FAST-WebCrawler',  ..



All rights reserved. © www.w3calculator.com