Archive for the ‘Uncategorized’ Category

 

How to Unzip/Extract zip file into one directory.

Wednesday, February 3rd, 2010

ini_set(‘memory_limit’,’800M’);
set_time_limit(36000);
/**
* @Module to Extract folder in one directory
* @package general
* @copyright Copyright 2010-11 COG IT Solutions Development Team
* @Author: Mr. Manoj M.Ninave
**/
//create media/import directory in root dir
$dir = $_SERVER['DOCUMENT_ROOT'].”/media/import”;
$filename = $dir.”/ABC.zip”;//destination
$zip_file = “http://www.yourssite.com/ABC.zip”;//source

$contents = file_get_contents($zip_file);
//echo $contents;
$handle = fopen($filename, “w+”);
fwrite($handle,$contents);
fclose($handle);
$zip = zip_open($filename);
if ($zip)
{
while ($zip_entry = zip_read($zip))
{
$zipEntry = zip_entry_name($zip_entry);
$zipEntryFile = substr($zipEntry,strrpos($zipEntry,”/”)+1);
$dirFile = $zipEntryFile;//unzipped directory
$dirPath = $dir.”/”.$dirFile;
$fp = fopen($dirPath, “w+”);
if (!$fp)
continue;
if(zip_entry_open($zip,$zip_entry, “r”))
{
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
fwrite($fp,$buf);
zip_entry_close($zip_entry);
fclose($fp);
}
}
zip_close($zip);
}
unlink($filename);
//unlink($dirPath);
echo “Unzipped successfully.”;

First it will copy zip file from source to destination.
All the files in subdirectory will extract in one directory i.e. in media/import directory.

Regard

Manoj Ninave

Software Engineer,
COG IT Solutions Pvt. Ltd.
www.cogitsolutions.com
n.manoj@cogitsolutions.com

Delete multiple table in single query

Wednesday, October 14th, 2009

Delete orders ,orders_products from orders INNER JOIN orders_products where orders.orders_id = orders_products.orders_id and orders.orders_id =24

m.ganesh@cogitsolutions.com
M/S COG IT SOLUTIONS

update with replace

Wednesday, October 14th, 2009

update with replace
UPDATE wp_posts SET post_body = REPLACE(post_body, ‘needle’, ‘chocolate’);

m.ganesh@cogitsolutions.com
M/S COG IT SOLUTIONS

Check record an insert with in one query

Wednesday, October 14th, 2009

Check record and insert with in one query
insert int tbl (Col1,col2,col3) select col1,col2,col3 from tbl where col1=”val”

LI tag – list item

Wednesday, October 14th, 2009

LI tag – list item

Used within the

    or

      tags to create the actual items of the list. Every list item should use the endtag

      but many WYSIWYG web page editors omit the tag which can cause problems validating the resulting HTML file. The

    1. tag attributes are now deprecated in HTML4. Use CSS list-style-image and list-style-type properties of the
    2. tag.

      * li style = “list-style-type:none”
      * li style = “list-style-type:disc”
      * li style = “list-style-type:circle”
      * li style = “list-style-type:square”
      * li style = “list-style-type:decimal”
      * li style = “list-style-type:upper-roman”
      * li style = “list-style-type:lower-roman”
      * li style = “list-style-type:upper-alpha”
      * li style = “list-style-type:lower-alpha”
      * li style = “list-style-image:url(../images/spot.png);”
      * li style = “list-style-position:inside;”
      * li style = “list-style-position:outside;”

      “used style such as followes .Section1 ul
      {
      padding:3px;

      }
      .Section1 ul>li
      {
      padding:2px 5px 2px;
      font-weight:normal;
      list-style-image:url(“”images/icon_bullet.gif”");
      list-style-position:inside;
      }”

      m.ganesh@cogitsolutions.com
      M/S COG IT SOLUTIONS

Site map | Blog
Copyright © 2008, COG IT Solutions Pvt. Ltd. All Rights Reserved
XHTML Validated