How to take backup dump of MySQL database with PHP script
Here is a simple script to take backup of MySQL database, using a PHP script. <?php backup_tables(‘localhost’,'username’,'password’,'dbname’); /* backup the db OR just a table */ function...
View ArticleCan you recommend some post upload checks?
Delete unwanted files, like ‘test’, ‘copy of’, etc. Give write permission (777) to the required folders. If .htaccess file has been uploaded, make sure it runs according the the server settings....
View ArticleHow do I detect mobile browser in PHP?
// Create the function, so you can use it function isMobile() { return...
View ArticleWhat are some good WordPress plugins
Business Directory Calendar Contact Form Custom Post Order My Post Order My Page Order Fancy Transition Header Slider Google Analytics Sharethis Simple Pagination Spider FAQs White Label CMS .html on...
View ArticleHow to download a file on server in PHP
<?php $file = ‘http://www.url.com/file.zip’; $newfile = ‘newfile.zip’; if (!copy($file, $newfile)) { echo “failed to copy $file…\n”; } ?>
View ArticleHow to recursively extract/unzip a folder in PHP
$zip = new ZipArchive; $zip->open(‘innovapain.zip’); $zip->extractTo(‘./’); $zip->close();
View ArticlePATH_INFO not working on Godaddy how to enable PATH_INFO in Godaddy
Create a file named “php5.ini”, add the following text cgi.fix_pathinfo = On Upload this file to the root directory of your web site, wait for some minutes.
View ArticleHow to prevent ENTER keypress to submit a web form
Place the following code in head. <script type=”text/javascript”> function searchItem(e){ e = e? e : window.event; var k = e.keyCode? e.keyCode : e.which? e.which : null; if (k == 13){ if...
View ArticleHow to make .htaccess rewrite rules for URL with or without “www”
#Redirect www to non-www RewriteEngine on RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] #Redirect non-www to www RewriteEngine on...
View ArticleHow to switch on PHP magic quotes gpc and magic quotes runtime on Hostgator...
There are two steps involved in it. First, under public_html folder, in .htaccess file write the following code. <IfModule mod_suphp.c> suPHP_ConfigPath /home/username <Files php.ini> order...
View ArticleHow to download large files in PHP using cURL
<?php $url = 'http://www.example.com/a-large-file.zip'; $path = $_SERVER['DOCUMENT_ROOT'] . '/downloads/a-large-file.zip'; $fp = fopen($path, 'w'); $ch = curl_init($url); curl_setopt($ch,...
View ArticleMAMP on Mavericks updated to Yosemite – Apache does not start
Rename the file “envvars” located in /Applications/MAMP/Library/bin into “_envvars” and it should work like charm.
View ArticleHow to generate a dropdown of PHP time zones
$timezones = array ( '(GMT-12:00) International Date Line West' => 'Pacific/Wake', '(GMT-11:00) Midway Island' => 'Pacific/Apia', '(GMT-11:00) Samoa' => 'Pacific/Apia', '(GMT-10:00) Hawaii'...
View ArticleHow to sort and print multidimensional array in PHP
<?php $result = array( array(‘name’ => ‘John’, ‘age’ => ’40′), array(‘name’ => ‘James’, ‘age’ => ’30′), array(‘name’ => ‘Ana’, ‘age’ => ’20′), array(‘name’ => ‘Tania’, ‘age’...
View ArticlePHP MongoDB case insensitive sorting (Solved)
Although MondoDB does not offer it, but you can very easily do it in PHP or any other language. Here is how to do it in PHP. <?php $cn = new MongoClient($dbHost); $db = $cn->selectDB($dbName);...
View Article
More Pages to Explore .....