deleting one day old files from folder using php

We given php  code for Checking directory and deleting one day old files from folder using php, from folder in windows or linux through php language. For deleting the files from folder in any system (windows or linux). I created the PHP script for deleting the old files from system.

Earlier I created the script for deleting files from folder but that was for only linux. Then I created script which will work independently. Following script will work in mac or windows or linux.

deleting one day old files from folder using php

 /***************** Delete one day old files ****************/
 $dir = "C://Inetpub/vhosts/yourdomain/tmpfiles";

 if (is_dir($dir)) {
 if ($dh = opendir($dir)) {
 while ($file = readdir($dh)) {
 if(!is_dir($dir.$file)) {
 if (filemtime($dir.DIRECTORY_SEPARATOR.$file) <     strtotime('-1 days')) { //if 1 days old, delete
<div id=":1o">echo "Deleting $dir.$file (old)\n";
 unlink($dir.$file);
 }
 }
 }
 } else {
echo "ERROR. Could not open directory: $dir\n";
 }
 } else {
 echo "ERROR. Specified path is not a directory: $dir\n";
 }
 closedir($dh);

// Above script is platform independent.</div>

How to install ec2-api-tools for fedora

When we want to connect to amazon server instance through linux terminal then you need to install ec2-api-tools for fedora. We given full detailed information.

How to install ec2-api-tools for fedora

For installing the ec2-api-tools in linux box follow the steps.

You will find the rpm package in following URL:

http://www.rpmfind.net/linux/rpm2html/search.php?query=ec2-api-tools&submit=Search+…&system=&arch=

Use following commands for installing the api-tools.
[root@localhost www]# cd /tmp/
[root@localhost tmp]# wget ftp://195.220.108.108/linux/rpmfusion/nonfree/fedora/releases/12/Everything/i386/os/ec2-api-tools-1.3.36506-1.fc12.noarch.rpm
After this when I started to connect my amazon server instance then I got following error message.

Permissions 0755 for ‘ec2-project.pem’ are too open.

It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: ec2-project.pem

For solving the issue you need to change the key file permission to 700. For that use following command

[root@localhost EC2key]$ chmod 700 -R ec2-project.pem
[root@localhost EC2key]$ ssh -i ec2-project.pem root@ec2-59-16-79-85.compute-1.amazonaws.com
Last login: Mon Jan 10 01:08:27 2011 from 158.162.131.50
[root@domU-18-33-35-0B-D5-02 ~]#

 

How to install ec2-api-tools for fedora
How to install ec2-api-tools for fedora

If you are still facing issue then write to me.

convert avi to flv using ffmpeg with Thumbnail

Video upload functionality is needed in every networking site. I will give best option the create the thumbnail from video file and convert video file to flv format.

convert avi to flv using ffmpeg with Thumbnail

For conversion of video files and creating the thumbnail we need the ffmpeg software need to be installed on server. Here I used the linux server. For installing the FFmpeg I used following article.

http://mysql-apache-php.com/ffmpeg-install.htm

After installing the ffmpeg software in linux you can use the command prompt for converting the video file.

Use the following command for covert the avi or video file to flv format.

#ffmpeg -i VIDEOFILE.avi  -ab 56 -ar 44100 -b 200 -r 15 -s 320×240 -f flv final.flv

If you are using the PHP then you can use following code in your PHP script for converting the video file.


exec("ffmpeg -i VIDEOFILE.avi  -ab 56 -ar 44100 -b 200 -r 15 -s 320x240 -f flv final.flv");

//For creating the thumbnail use the following code

exec("ffmpeg -y -i moviefile.avi -vframes 1 -ss 00:01:60 -an -vcodec png -f rawvideo -s 110x90 new.png");

converting the video files to flv format that takes some time. So I recommend not to convert the video file to flv while uploading.

Just create the thumbnail and show to use.

For converting the video file to flv format use the cronjob. Create two or One cronjob setting and daily two or more time through script convert the video files to flv.

free WordPress Theme – WPAPI for download

WordPressapi is launching the free premium wordpress theme. This theme is magazine style. This wordpress theme is free for download. We are very happy to announce this wordpress theme.

free WordPress Theme – WPAPI for download

[viral-lock message=”Download and Demo Link is Hidden! It’s Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.”]

Demo |  Download 

[/viral-lock]

High Quality (HQ) Free WordPres Themes collection, Magazine Style, News Paper Style, 1 Columns, 2 Columns, 3 Columns, Mixed Colums, Widgets,google adsense ready, infolinks ready,?Seo Friendly, Jquery slider, and many more.

What’s on Wpapi

  • Widget Support
  • Fixed Width
  • 3 columns
  • Right Sidebar
  • Google Ads
  • Gravatar Support
  • Custom Image Header
  • XHTML & CSS valid
  • WordPress 3.0
  • Menu Support
  • Premium version // Sub Page Menu
  • Premium version // Theme Options
  • Premium version // Banner Management
  • Premium version // Page Comment Templates
  • Premium version // FeedBurner Integration
  • Premium version // 2 Color Schemes ready
  • Premium version // Auto Generated Image (with or without custom fields)
  • Premium version // Included Nice Widget (Dynamic Recent Post and Flickr)
  • Premium version // Beautiful Themes Options
  • Premium version // Features Post
  • Premium version // Social Bookmark integration
  • Premium version // and many more
  • Infolinks Ads
  • Jquery Slider
  • Logo and favicon configuration

[viral-lock message=”Download and Demo Link is Hidden! It’s Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.”]

Demo |  Download 

[/viral-lock]

 

how to disable wordpress post revisions

disable wordpress post revisions and increase wordpress performance. For improving the WordPress website or blog performance you need use following method.

WordPress saves the post revisions after every 2 min. That takes so much mysql storage.
To save MySQL storage, some WordPress user will be happy using this method, this method is Disable WordPress Post Revision.

how to disable wordpress post revisions

Why we need disabled this featured?

It’ because WordPress created such as dummy data revision and this one make our table sized increased. And if you have limited space, this is bad idea, and of course disable Post Revision also made your WordPress running faster.

Open your wp-config.php file and put the following code in that file. If you are not wordpress developer then dont use following code. Please consult with any wordpress developer for this code.

/* disable post-revisioning nonsense */
define('WP_POST_REVISIONS', FALSE);

Add Text to RSS in wordpress Post Title

I faced very complex issue when my post get published. That post copied from other sites. Due to some wordpress plugin that is happening. wp-matic and wp-robots wordpress plugins are very bad which are stilling the other site blog and content.

Add Text to RSS in wordpress Post Title

Prevent the coping your content you should use my method. This method will add the additional text in your title so your wordpress posts will became more secure.
If you are wordpress developer then only use following code. Open your functions.php file from your theme and put following code in that file.

    function wordpressapi_rss_title($content) {
    global $wp_query;
    $postid = $wp_query->post->ID;
    $gpost = get_post_meta($postid, 'guest_post', true);
    $spost = get_post_meta($postid, 'sponsored_post', true);

    $content = 'Post by WordPressapi.com - '.$content;

    return $content;
    }
    add_filter('the_title_rss', 'wordpressapi_rss_title');

This code will add the custom text in your title. For more information you can search in my blog
https://purabtech.in

Modify wordpress Custom excerpt length

In wordpress api we having the the_excerpt method for showing the short description from wordpress post.
On WordPress 2.9 there are new featured that we can added on the_excerpt(), one of them is change the excerpt length.

Modify wordpress Custom excerpt length

For Modify wordpress Custom excerpt length we need use the filter for modify the wordpress excerpt length. Use our custom code and put in functions.php file

For changing the length of excerpt we need use the filter for modify the wordpress excerpt length.
We only needed to put some function on our functions.php themes file and added some hook to call this functions.

<?php
// Add custom excerpt length
function custom_excerpt_length($length) {
return 20;
}
add_filter('excerpt_length', 'custom_excerpt_length');
?>

Using above code you can control the character length in wordpress description.

50 CSS Tequniqe and Tips every web developer should check

Many Developer want to do work in CSS. Web Developer has special value for CSS. Since CSS 2.0 and CSS 3.0 came many techniques and Tricks invented by Web developers. Here I am giving you some list of CSS Tips. You can found following links very useful and powerful for your website while developing your website.

50 CSS Tequniqe and Tips every web developer should check

50 CSS Tequniqe and Tips every web developer should check
50 CSS Tequniqe and Tips every web developer should check
  • Multiple Columns
  • Multiple Backgrounds
  • Creating A Realistic Looking Button With CSS3
  • 56. A Crash Course In Advanced CSS3 Effects

how to show author information on each wordpress post

show author information on each wordpress post is really good habit in wordpress post. So reader will know information writer who is writing the article. Many people like this information and they really read the information about author.

how to show author information on each wordpress post

how to show author information on each wordpress post
how to show author information on each wordpress post

For showing the author information you need put following code in the functions.php file show after your post content the author information will displayed to reader.


function get_author_bio($content=''){
global $post;

$post_author_name=get_the_author_meta("display_name");
$post_author_description=get_the_author_meta("description");
$html="</pre>
<div id="about_author" class="clearfix">\n";
$html.="<img class="avatar" src="http://www.gravatar.com/avatar.php?gravatar_id=&quot;.md5(get_the_author_email()). &quot;&default=&quot;.urlencode($GLOBALS[" alt="PG" width="80" height="80" />\n";
$html.="
<div class="author_text">\n";
$html.="
<h4>Author: ".$post_author_name."</h4>
\n";
$html.= $post_author_description."\n";
$html.="</div>
</div>
<pre>
\n";
$html.="</pre>
<div class="clear"></div>
<pre>
\n";
$content .= $html;

return $content;
}

add_filter('the_content', 'get_author_bio');

Just put the above code in functions.php file. You dont need to do code in single.php file.

where to put google analytics code in wordpress blog

Answered wordpress question, where to put google analytics code in wordpress blog. Google analytics service is required in all the wordpress websites. For putting goolge analytics code in wordpress theme.

where to put google analytics code in wordpress blog

where to put google analytics code in wordpress blog
where to put google analytics code in wordpress blog

You can use the following code.

Open your functions.php file from wordpress theme folder and put following code in that file. You just need to put your google analytics code instead of my code.

<?php
add_action('wp_footer', 'googleanalytics');

function googleanalytics() { ?>
// Paste your Google Analytics code here
<script type="text/javascript">

 var _gaq = _gaq || [];
 _gaq.push(['_setAccount', 'UA-12453889-1']);
 _gaq.push(['_trackPageview']);

 (function() {
 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
 })();

</script>

<?php } ?>